@d3plus/core 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +686 -671
  2. package/es/src/charts/AreaPlot/index.js +2 -1
  3. package/es/src/charts/AreaPlot/index.js.map +1 -1
  4. package/es/src/charts/BarChart/index.js +3 -1
  5. package/es/src/charts/BarChart/index.js.map +1 -1
  6. package/es/src/charts/BoxWhisker/index.js +2 -1
  7. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  8. package/es/src/charts/BumpChart/index.js +2 -1
  9. package/es/src/charts/BumpChart/index.js.map +1 -1
  10. package/es/src/charts/Geomap/index.js +2 -1
  11. package/es/src/charts/Geomap/index.js.map +1 -1
  12. package/es/src/charts/LinePlot/index.js +2 -1
  13. package/es/src/charts/LinePlot/index.js.map +1 -1
  14. package/es/src/charts/Matrix/index.js +1 -0
  15. package/es/src/charts/Matrix/index.js.map +1 -1
  16. package/es/src/charts/Network/index.js +2 -1
  17. package/es/src/charts/Network/index.js.map +1 -1
  18. package/es/src/charts/Pack/index.js +1 -0
  19. package/es/src/charts/Pack/index.js.map +1 -1
  20. package/es/src/charts/Pie/index.js +1 -0
  21. package/es/src/charts/Pie/index.js.map +1 -1
  22. package/es/src/charts/Plot/index.js +22 -12
  23. package/es/src/charts/Plot/index.js.map +1 -1
  24. package/es/src/charts/Plot/pipelineDomains.js +3 -3
  25. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  26. package/es/src/charts/Plot/stackHelpers.js +128 -9
  27. package/es/src/charts/Plot/stackHelpers.js.map +1 -1
  28. package/es/src/charts/Radar/index.js +2 -1
  29. package/es/src/charts/Radar/index.js.map +1 -1
  30. package/es/src/charts/RadialMatrix/index.js +1 -0
  31. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  32. package/es/src/charts/Rings/index.js +2 -1
  33. package/es/src/charts/Rings/index.js.map +1 -1
  34. package/es/src/charts/Sankey/index.js +2 -1
  35. package/es/src/charts/Sankey/index.js.map +1 -1
  36. package/es/src/charts/Tree/index.js +2 -1
  37. package/es/src/charts/Tree/index.js.map +1 -1
  38. package/es/src/charts/Treemap/index.js +1 -0
  39. package/es/src/charts/Treemap/index.js.map +1 -1
  40. package/es/src/shapes/Image.js +2 -3
  41. package/es/src/shapes/Image.js.map +1 -1
  42. package/es/src/shapes/Shape.js +35 -36
  43. package/es/src/shapes/Shape.js.map +1 -1
  44. package/es/src/shapes/sceneSort.js +304 -24
  45. package/es/src/shapes/sceneSort.js.map +1 -1
  46. package/es/src/shapes/shapeConfig.js.map +1 -1
  47. package/es/src/utils/D3plusConfig.js.map +1 -1
  48. package/package.json +9 -9
  49. package/types/src/charts/Plot/index.d.ts +22 -6
  50. package/types/src/charts/Plot/stackHelpers.d.ts +62 -4
  51. package/types/src/shapes/Image.d.ts +2 -3
  52. package/types/src/shapes/Shape.d.ts +0 -2
  53. package/types/src/shapes/sceneSort.d.ts +83 -8
  54. package/types/src/shapes/shapeConfig.d.ts +7 -0
  55. package/types/src/utils/D3plusConfig.d.ts +19 -2
  56. package/umd/d3plus-core.full.js +1581 -561
  57. package/umd/d3plus-core.full.js.map +1 -1
  58. package/umd/d3plus-core.full.min.js +1091 -927
  59. package/umd/d3plus-core.js +541 -224
  60. package/umd/d3plus-core.js.map +1 -1
  61. package/umd/d3plus-core.min.js +468 -363
@@ -1,10 +1,10 @@
1
1
  /*
2
- @d3plus/core v4.1.0
2
+ @d3plus/core v4.2.0
3
3
  Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-selection"),require("@d3plus/data"),require("@d3plus/dom"),require("@d3plus/locales"),require("@d3plus/render"),require("@d3plus/text"),require("d3-color"),require("d3-brush"),require("d3-scale"),require("d3-zoom"),require("@d3plus/color"),require("@d3plus/format"),require("open-color/open-color.js"),require("d3-transition"),require("d3-shape"),require("@d3plus/math"),require("@floating-ui/dom"),require("d3-interpolate"),require("d3-time-format"),require("d3-tile"),require("d3-geo"),require("d3-geo-projection"),require("d3-composite-projections"),require("topojson-client"),require("d3-force"),require("d3-polygon"),require("d3-hierarchy"),require("d3-sankey")):"function"==typeof define&&define.amd?define("@d3plus/core",["exports","d3-array","d3-selection","@d3plus/data","@d3plus/dom","@d3plus/locales","@d3plus/render","@d3plus/text","d3-color","d3-brush","d3-scale","d3-zoom","@d3plus/color","@d3plus/format","open-color/open-color.js","d3-transition","d3-shape","@d3plus/math","@floating-ui/dom","d3-interpolate","d3-time-format","d3-tile","d3-geo","d3-geo-projection","d3-composite-projections","topojson-client","d3-force","d3-polygon","d3-hierarchy","d3-sankey"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).d3plus={},e.d3Array,e.d3Selection,e.data,e.dom,e.locales,e.render,e.text,e.d3Color,e.d3Brush,e.scales,e.d3Zoom,e.color,e.format,e.pkg,e.d3Transition,e.d3Shape,e.math,e.dom$1,e.d3Interpolate,e.d3TimeFormat,e.d3Tile,e.d3GeoCore,e.d3GeoProjection,e.d3CompositeProjections,e.topojsonClient,e.d3Force,e.d3Polygon,e.d3Hierarchy,e.d3Sankey)}(this,function(e,t,i,s,n,a,o,r,c,h,l,d,u,m,f,g,p,y,_,x,b,k,v,C,S,w,z,D,M,A){"use strict";function $(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var B=$(l),P=$(p),T=$(v),O=$(C),R=$(S);
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-selection"),require("@d3plus/data"),require("@d3plus/dom"),require("@d3plus/locales"),require("@d3plus/render"),require("@d3plus/text"),require("d3-color"),require("d3-brush"),require("d3-scale"),require("d3-zoom"),require("@d3plus/color"),require("@d3plus/format"),require("open-color/open-color.js"),require("d3-transition"),require("@d3plus/math"),require("d3-shape"),require("@floating-ui/dom"),require("d3-interpolate"),require("d3-time-format"),require("d3-tile"),require("d3-geo"),require("d3-geo-projection"),require("d3-composite-projections"),require("topojson-client"),require("d3-force"),require("d3-polygon"),require("d3-hierarchy"),require("d3-sankey")):"function"==typeof define&&define.amd?define("@d3plus/core",["exports","d3-array","d3-selection","@d3plus/data","@d3plus/dom","@d3plus/locales","@d3plus/render","@d3plus/text","d3-color","d3-brush","d3-scale","d3-zoom","@d3plus/color","@d3plus/format","open-color/open-color.js","d3-transition","@d3plus/math","d3-shape","@floating-ui/dom","d3-interpolate","d3-time-format","d3-tile","d3-geo","d3-geo-projection","d3-composite-projections","topojson-client","d3-force","d3-polygon","d3-hierarchy","d3-sankey"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).d3plus={},e.d3Array,e.d3Selection,e.data,e.dom,e.locales,e.render,e.text,e.d3Color,e.d3Brush,e.scales,e.d3Zoom,e.color,e.format,e.pkg,e.d3Transition,e.math,e.d3Shape,e.dom$1,e.d3Interpolate,e.d3TimeFormat,e.d3Tile,e.d3GeoCore,e.d3GeoProjection,e.d3CompositeProjections,e.topojsonClient,e.d3Force,e.d3Polygon,e.d3Hierarchy,e.d3Sankey)}(this,function(e,t,i,s,n,a,o,r,c,h,l,d,u,m,f,g,p,y,_,x,b,k,v,C,S,w,z,D,M,A){"use strict";function $(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var B=$(l),P=$(y),T=$(v),O=$(C),R=$(S);
8
8
  /**
9
9
  Wraps non-function variables in a simple return function.
10
10
  @param value The value to wrap in a return function.
@@ -796,7 +796,7 @@ let n=s?s.slice():[],[a,o]=i;e.schema.range&&(void 0!==e.schema.range[0]&&(a=e.s
796
796
  /** Splits a log scale into positive/negative sub-scales when it spans zero. */(e,c),e._d3Scale.padding&&e._d3Scale.padding(e.schema.scalePadding),e._d3Scale.paddingInner&&e._d3Scale.paddingInner(e.schema.paddingInner),e._d3Scale.paddingOuter&&e._d3Scale.paddingOuter(e.schema.paddingOuter),e._d3ScaleNegative=null,"log"===e.schema.scale&&function(e){const i=e._d3Scale.domain(),s=e._data;if(0===i[0]){const e=t.min([t.min(s),Math.abs(i[1])]);i[0]=0===e||1===e?1e-6:e<=1?De(e):1,ze(i[1])&&(i[0]*=-1)}else if(0===i[i.length-1]){const e=t.min([t.min(s),Math.abs(i[0])]);i[i.length-1]=0===e||1===e?1e-6:e<=1?De(e):1,ze(i[0])&&(i[i.length-1]*=-1)}const n=e._d3Scale.range();if(ze(i[0])&&ze(i[i.length-1]))e._d3ScaleNegative=e._d3Scale.copy().domain(i).range(n),e._d3Scale=null;else if(i[0]>0&&i[i.length-1]>0)e._d3Scale.domain(i).range(n);else{const a=i.map(e=>Math.log10(Math.abs(e))).map(e=>e||-1e-6),o=a[0]/t.sum(a)*(n[1]-n[0]);let r=t.min([t.min(s.filter(e=>e>=0)),Math.abs(i[1])]);1===r&&(r=1e-6);let c=t.min([t.min(s.filter(ze)),Math.abs(i[0])]);1===c&&(c=1e-6);const h=0===r?1e-6:r<=1?De(r):1,l=0===c?-1e-6:c<=1?De(c):1,d=t.min([Math.abs(h),Math.abs(l)]);e._d3ScaleNegative=e._d3Scale.copy(),(ze(i[0])?e._d3Scale:e._d3ScaleNegative).domain([ze(i[0])?d:-d,i[1]]).range([n[0]+o,n[1]]),(ze(i[0])?e._d3ScaleNegative:e._d3Scale).domain([i[0],ze(i[0])?-d:d]).range([n[0],n[0]+o])}}
797
797
  /** Resolves the tick + label value arrays (config, scale ticks, or domain). */(e);const{ticks:h,labels:l}=function(e){let t=(e.schema.ticks?"time"===e.schema.scale?e.schema.ticks.map(n.date):e.schema.ticks:(e._d3Scale?e._d3Scale.ticks:e._d3ScaleNegative?.ticks)?e._getTicks():e.schema.domain).slice(),i=(e.schema.labels?"time"===e.schema.scale?e.schema.labels.map(n.date):e.schema.labels:(e._d3Scale?e._d3Scale.ticks:e._d3ScaleNegative?.ticks)?e._getLabels():t).slice();return"time"===e.schema.scale&&(t=t.map(Number),i=i.map(Number)),t=t.sort((t,i)=>e._getPosition(t)-e._getPosition(i)),i=i.sort((t,i)=>e._getPosition(t)-e._getPosition(i)),{ticks:t,labels:i}}
798
798
  /** Sets `axis._tickUnit` for the "smallest" linear tick-suffix mode. */(e);!function(e,t){if("linear"===e.schema.scale&&"smallest"===e.schema.tickSuffix){const i=t.filter(e=>e>=1e3);if(i.length>0){const t=Math.min(...i);let s=1;for(;s&&s<7&&t/Math.pow(10,3*s)>=1;)e._tickUnit=s,s+=1}}}
799
- /** Drops ticks that would visually collide, recording available/visible sets. */(e,l);const d=function(e,t,i){const s=[];return e._availableTicks=t,t.forEach((t,n)=>{let a=i({id:t,tick:!0},n);"Circle"===e.schema.shape&&(a*=2);const o=e._getPosition(t);!s.length||Math.abs(y.closest(o,s.filter(e=>!1!==e))-o)>2*a?s.push(o):s.push(!1)}),t=t.filter((e,t)=>!1!==s[t]),e._visibleTicks=t,t}(e,h,s);return{range:o,ticks:d,labels:l}}
799
+ /** Drops ticks that would visually collide, recording available/visible sets. */(e,l);const d=function(e,t,i){const s=[];return e._availableTicks=t,t.forEach((t,n)=>{let a=i({id:t,tick:!0},n);"Circle"===e.schema.shape&&(a*=2);const o=e._getPosition(t);!s.length||Math.abs(p.closest(o,s.filter(e=>!1!==e))-o)>2*a?s.push(o):s.push(!1)}),t=t.filter((e,t)=>!1!==s[t]),e._visibleTicks=t,t}(e,h,s);return{range:o,ticks:d,labels:l}}
800
800
  /**
801
801
  The standalone axis layout pass. Accepts any object satisfying the
802
802
  Axis-instance shape (the production `Axis` class is the canonical input).
@@ -844,30 +844,10 @@ let n="Circle"===e.schema.shape?"function"==typeof e.schema.shapeConfig.r?e.sche
844
844
  rect-style hitArea is configured; Line's path-style hitArea is covered by its
845
845
  own geometry.
846
846
  */
847
- /** Image's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const Oe=[{key:"duration",coerce:"identity",default:600},{key:"height",coerce:"accessor",default:F("height")},{key:"id",coerce:"identity",default:F("id")},{key:"opacity",coerce:"const",default:L(1)},{key:"pointerEvents",coerce:"const",default:L("auto")},{key:"renderMode",coerce:"identity",default:"full"},{key:"url",coerce:"identity",default:F("url")},{key:"width",coerce:"accessor",default:F("width")},{key:"x",coerce:"const",default:F("x",0)},{key:"y",coerce:"const",default:F("y",0)}];class Re{config(e){if(!arguments.length)return{...this.schema,data:this._data,select:this._select};const t=e;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(
848
- // `this[k]` resolves the fluent accessor via the index signature.
849
- "function"==typeof this[e]?this[e](t[e]):this.schema[e]=t[e]);return this}
850
- /**
851
- Renders the current Image to the page. If a *callback* is specified, it will be called once the images are done drawing.
852
- @param callback Optional callback invoked after rendering completes.
853
- */render(e){
854
- // Compute mode is a no-op for DOM emission — the caller will read
855
- // `toScene()` to get a SceneNode tree, no need to mount.
856
- if("compute"===this.schema.renderMode)return e&&setTimeout(e,0),this;void 0===this._select&&this.select(i.select("body").append("svg").style("width",`${window.innerWidth}px`).style("height",`${window.innerHeight}px`).style("display","block").node());const t=this._select.selectAll(".d3plus-Image").data(this._data,this.schema.id),s=t.enter().append("image").attr("class","d3plus-Image").attr("opacity",0).attr("width",0).attr("height",0).attr("x",(e,t)=>this.schema.x(e,t)+this.schema.width(e,t)/2).attr("y",(e,t)=>this.schema.y(e,t)+this.schema.height(e,t)/2),n=g.transition().duration(this.schema.duration),a=this;return s.merge(t).attr("xlink:href",this.schema.url).style("pointer-events",this.schema.pointerEvents).transition(n).attr("opacity",this.schema.opacity).attr("width",(e,t)=>this.schema.width(e,t)).attr("height",(e,t)=>this.schema.height(e,t)).attr("x",(e,t)=>this.schema.x(e,t)).attr("y",(e,t)=>this.schema.y(e,t)).each(function(e,t){const s=i.select(this),n=a.schema.url(e,t);if(!(0===n.indexOf("http://")||0===n.indexOf("https://"))||0===n.indexOf(window.location.hostname)){const e=new window.Image;e.src=n,e.crossOrigin="Anonymous",e.onload=function(){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;t.getContext("2d").drawImage(e,0,0),s.attr("xlink:href",t.toDataURL("image/png"))}}}),t.exit().transition(n).attr("width",(e,t)=>this.schema.width(e,t)).attr("height",(e,t)=>this.schema.height(e,t)).attr("x",(e,t)=>this.schema.x(e,t)).attr("y",(e,t)=>this.schema.y(e,t)).attr("opacity",0).remove(),e&&setTimeout(e,this.schema.duration+100),this}data(e){return arguments.length?(this._data=e,this):this._data}
857
- /**
858
- Compute-mode scene emission. Mirrors Shape.toScene's shape — a
859
- keyed GroupNode wrapping per-datum ImageNodes. Used by chart
860
- compositors (Shape._backgroundImageClass, plotPaint) that need
861
- Image to participate in the scene graph rather than emit
862
- d3-selection DOM.
863
- */toScene(){return{type:"group",key:"d3plus-Image",children:(this._data||[]).map((e,t)=>({type:"image",key:`${this.schema.id(e,t)}`,x:this.schema.x(e,t),y:this.schema.y(e,t),width:this.schema.width(e,t),height:this.schema.height(e,t),href:this.schema.url(e,t),paint:{opacity:this.schema.opacity(e,t)},datum:e,index:t}))}}select(e){return arguments.length?(this._select=i.select(e),this):this._select}
864
- /**
865
- Invoked when creating a new class instance, and sets any default parameters.
866
- @private
867
- */constructor(){re(this,Oe)}}
868
847
  /** Follows the chart (`__d3plus__`) and shape (`__d3plusShape__`) wrappers back
869
848
  to the source datum, so a `sort` comparator sees the same object the other
870
- per-datum accessors receive. */function Le(e){let t=e;for(;t.__d3plus__&&t.data;)t=t.data;return t.__d3plusShape__?t.data:t}
849
+ per-datum accessors receive. */
850
+ function Oe(e){let t=e;for(;t.__d3plus__&&t.data;)t=t.data;return t.__d3plusShape__?t.data:t}
871
851
  /**
872
852
  Ranks `data` by a `sort` layering comparator WITHOUT reordering it. Returns
873
853
  `rank[i]` = the paint position of datum `i` (lower = painted first = behind),
@@ -876,15 +856,62 @@ if("compute"===this.schema.renderMode)return e&&setTimeout(e,0),this;void 0===th
876
856
  comparator or nothing to reorder, so callers emit no `z` and the fast
877
857
  append-order path is preserved.
878
858
  */
879
- /** Coerces a value to a finite number, or undefined. @private */function Ee(e){const t=Number(e);return Number.isFinite(t)?t:void 0}
880
- /** Returns a non-empty string, or undefined. @private */function Fe(e){return null==e||""===e?void 0:String(e)}
881
- /** Parses an SVG stroke-dasharray value into an array of numbers. @private */function We(e){if(null==e||"none"===e||""===e)return;if("number"==typeof e)return[e];const t=String(e).split(/[\s,]+/).map(Number).filter(e=>Number.isFinite(e));return t.length?t:void 0}
882
- /** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const Ne=[{key:"activeOpacity",coerce:"identity",default:.25},{key:"ariaLabel",coerce:"const",default:L("")},{key:"backgroundImage",coerce:"const",default:L(!1)},{key:"discrete",coerce:"identity"},{key:"duration",coerce:"identity",default:600},{key:"fill",coerce:"const",default:L("black")},{key:"fillOpacity",coerce:"const",default:L(1)},{key:"hitArea",coerce:"const"},{key:"hoverOpacity",coerce:"identity",default:.5},{key:"id",coerce:"accessor",default:(e,t)=>void 0!==e.id?e.id:t},{key:"label",coerce:"const",default:L(!1)},{key:"labelBounds",coerce:"const"},{key:"opacity",coerce:"const",default:L(1)},{key:"pointerEvents",coerce:"const",default:L("visiblePainted")},{key:"renderMode",coerce:"identity",default:"full"},{key:"role",coerce:"const",default:L("presentation")},{key:"rotate",coerce:"const",default:L(0)},{key:"rx",coerce:"const",default:L(0)},{key:"ry",coerce:"const",default:L(0)},{key:"scale",coerce:"const",default:L(1)},{key:"shapeRendering",coerce:"const",default:L("geometricPrecision")},{key:"stroke",coerce:"const"},{key:"strokeDasharray",coerce:"const",default:L("0")},{key:"strokeLinecap",coerce:"const",default:L("butt")},{key:"strokeOpacity",coerce:"const",default:L(1)},{key:"strokeWidth",coerce:"const",default:L(0)},{key:"textAnchor",coerce:"const",default:L("start")},{key:"texture",coerce:"const",default:L(!1)},{key:"vectorEffect",coerce:"const",default:L("non-scaling-stroke")},{key:"verticalAlign",coerce:"const",default:L("top")},
859
+ /**
860
+ The local-space bounding box `{x, y, width, height}` a backgroundImage fills,
861
+ derived from a datum's scene geometry. Rect/Bar geometry is already a box;
862
+ Circle is centered at (cx, cy) with radius r; a `path` uses the exact
863
+ (DOM-free) bounds of its `d`; Area/Line fall back to their polygon `points`.
864
+ Returns null when no finite extent can be determined.
865
+ */
866
+ function Re(e,t){if("number"==typeof e.width&&"number"==typeof e.height){return{x:"number"==typeof e.x?e.x:-e.width/2,y:"number"==typeof e.y?e.y:-e.height/2,width:e.width,height:e.height}}if("number"==typeof e.r){const t="number"==typeof e.cx?e.cx:0,i="number"==typeof e.cy?e.cy:0;return{x:t-e.r,y:i-e.r,width:2*e.r,height:2*e.r}}if("string"==typeof e.d){const t=p.pathBounds(e.d);return t.width>0&&t.height>0?t:null}
867
+ /** Bounding box of a list of polygon points, or null when degenerate. */
868
+ return function(e){if(!e.length)return null;let t=1/0,i=1/0,s=-1/0,n=-1/0;for(const[a,o]of e)a<t&&(t=a),o<i&&(i=o),a>s&&(s=a),o>n&&(n=o);return!Number.isFinite(t)||s<=t||n<=i?null:{x:t,y:i,width:s-t,height:n-i}}(t)}
869
+ /** Rounded-rectangle path `d` (falls back to a plain rect when radii are 0). */function Le(e,t,i,s,n,a){return`M${e+(n=Math.min(n,i/2))},${t}h${i-2*n}a${n},${a=Math.min(a,s/2)} 0 0 1 ${n},${a}v${s-2*a}a${n},${a} 0 0 1 ${-n},${a}h${-(i-2*n)}a${n},${a} 0 0 1 ${-n},${-a}v${-(s-2*a)}a${n},${a} 0 0 1 ${n},${-a}Z`}
870
+ /**
871
+ The shape's own geometry expressed as a clip region in its LOCAL coordinate
872
+ space, so a background image can be clipped to the shape itself (a Path image
873
+ is clipped to the path, a Circle image to the circle, etc.). Returns
874
+ undefined when the geometry has no usable outline.
875
+ */function Ee(e,t){if("string"==typeof e.d)return{type:"path",d:e.d};if("number"==typeof e.width&&"number"==typeof e.height){const t="number"==typeof e.x?e.x:-e.width/2,i="number"==typeof e.y?e.y:-e.height/2,s="number"==typeof e.rx?e.rx:0,n="number"==typeof e.ry?e.ry:0;return s>0||n>0?{type:"path",d:Le(t,i,e.width,e.height,s||n,n||s)}:{type:"rect",x:t,y:i,width:e.width,height:e.height}}if("number"==typeof e.r){const t="number"==typeof e.cx?e.cx:0,i="number"==typeof e.cy?e.cy:0,s=e.r;return{type:"path",d:`M${t-s},${i}a${s},${s} 0 1,0 ${2*s},0a${s},${s} 0 1,0 ${-2*s},0Z`}}if(t.length>2){return{type:"path",d:`M${t.map(([e,t])=>`${e},${t}`).join("L")}Z`}}}
876
+ /** A polygon (local coords) approximating the shape outline, for `largestRect`. */
877
+ /**
878
+ Resolves a backgroundImage's box + clip + `preserveAspectRatio` for a datum's
879
+ geometry, honoring the fit mode:
880
+
881
+ - `cover` — the image fills the shape's bounding box and is cropped
882
+ (`xMidYMid slice`), clipped to the shape's own outline.
883
+ - `contain` — the whole image is centered and fully visible inside the shape:
884
+ it is fit (`xMidYMid meet`) into the shape's largest inscribed axis-aligned
885
+ rectangle (a Rect uses itself; a Circle its inscribed square; a Path/Area
886
+ uses `largestRect` of its polygon). No clip is needed since the box already
887
+ sits inside the shape.
888
+
889
+ Returns null when no usable box can be derived.
890
+ */
891
+ function Fe(e,t,i){if("contain"!==i){const i=Re(e,t);return i?{box:i,clip:Ee(e,t),preserveAspectRatio:"xMidYMid slice"}:null}
892
+ // contain: fit inside the largest inscribed rectangle, fully visible.
893
+ let s=null;if("number"==typeof e.width&&"number"==typeof e.height)s=Re(e,t);// a rect contains itself
894
+ else if("number"==typeof e.r){
895
+ // Inscribed square of a circle: side = r·√2, centered on (cx, cy).
896
+ const t="number"==typeof e.cx?e.cx:0,i="number"==typeof e.cy?e.cy:0,n=e.r/Math.SQRT2;s={x:t-n,y:i-n,width:2*n,height:2*n}}else{const i=function(e,t){return"string"==typeof e.d?p.path2polygon(e.d):t}(e,t),n=i.length>2?p.largestRect(i,{angle:0}):null;s=n?{x:n.cx-n.width/2,y:n.cy-n.height/2,width:n.width,height:n.height}:Re(e,t)}return s?{box:s,preserveAspectRatio:"xMidYMid meet"}:null}
897
+ /**
898
+ Emits the per-datum background images collected during `Shape.toScene`. Each
899
+ image is wrapped in its own group carrying the shape's datum + transform, so
900
+ it is clipped to the shape's outline, positioned in local space, and dims/
901
+ raises together with its shape on hover. The image is non-interactive (and
902
+ keyed apart from the shape) so pointer events pass through to the shape below.
903
+ When `rank` is set (a `sort` comparator is active) every group needs a `z`
904
+ so the backend sort keeps images above the geometry in their own order.
905
+ */
906
+ /** Coerces a value to a finite number, or undefined. @private */function We(e){const t=Number(e);return Number.isFinite(t)?t:void 0}
907
+ /** Returns a non-empty string, or undefined. @private */function Ne(e){return null==e||""===e?void 0:String(e)}
908
+ /** Parses an SVG stroke-dasharray value into an array of numbers. @private */function He(e){if(null==e||"none"===e||""===e)return;if("number"==typeof e)return[e];const t=String(e).split(/[\s,]+/).map(Number).filter(e=>Number.isFinite(e));return t.length?t:void 0}
909
+ /** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const je=[{key:"activeOpacity",coerce:"identity",default:.25},{key:"ariaLabel",coerce:"const",default:L("")},{key:"backgroundImage",coerce:"const",default:L(!1)},{key:"backgroundImageFit",coerce:"const",default:L("cover")},{key:"discrete",coerce:"identity"},{key:"duration",coerce:"identity",default:600},{key:"fill",coerce:"const",default:L("black")},{key:"fillOpacity",coerce:"const",default:L(1)},{key:"hitArea",coerce:"const"},{key:"hoverOpacity",coerce:"identity",default:.5},{key:"id",coerce:"accessor",default:(e,t)=>void 0!==e.id?e.id:t},{key:"label",coerce:"const",default:L(!1)},{key:"labelBounds",coerce:"const"},{key:"opacity",coerce:"const",default:L(1)},{key:"pointerEvents",coerce:"const",default:L("visiblePainted")},{key:"renderMode",coerce:"identity",default:"full"},{key:"role",coerce:"const",default:L("presentation")},{key:"rotate",coerce:"const",default:L(0)},{key:"rx",coerce:"const",default:L(0)},{key:"ry",coerce:"const",default:L(0)},{key:"scale",coerce:"const",default:L(1)},{key:"shapeRendering",coerce:"const",default:L("geometricPrecision")},{key:"stroke",coerce:"const"},{key:"strokeDasharray",coerce:"const",default:L("0")},{key:"strokeLinecap",coerce:"const",default:L("butt")},{key:"strokeOpacity",coerce:"const",default:L(1)},{key:"strokeWidth",coerce:"const",default:L(0)},{key:"textAnchor",coerce:"const",default:L("start")},{key:"texture",coerce:"const",default:L(!1)},{key:"vectorEffect",coerce:"const",default:L("non-scaling-stroke")},{key:"verticalAlign",coerce:"const",default:L("top")},
883
910
  // "accessor" (not "const"): a string names a data key (`.x("year")`), a
884
911
  // number is a constant (`.x(50)`), and a function passes through — so a
885
912
  // standalone shape given string accessors (as the pipeline never does, but
886
913
  // direct users do) reads the field instead of treating "x" as the literal.
887
- {key:"x",coerce:"accessor",default:F("x",0)},{key:"y",coerce:"accessor",default:F("y",0)}];class He extends j{
914
+ {key:"x",coerce:"accessor",default:F("x",0)},{key:"y",coerce:"accessor",default:F("y",0)}];class Ge extends j{
888
915
  /**
889
916
  Given a specific data point and index, returns the aesthetic properties of the shape.
890
917
  @param data point*
@@ -942,7 +969,7 @@ return Te({data:this._data,dataFilter:this._dataFilter?this._dataFilter.bind(thi
942
969
  */_scenePaint(e,t){
943
970
  // A texture resolves to a stable "pattern:<key>" token (the same JSON config
944
971
  // render() uses); each backend materializes or degrades it.
945
- const i=this._getTextureKey(e,t);return{fill:i?`pattern:${i}`:Fe(this._styleVal(this.schema.fill,e,t)),fillOpacity:Ee(this._styleVal(this.schema.fillOpacity,e,t)),stroke:Fe(this._styleVal(this.schema.stroke,e,t)),strokeWidth:Ee(this._styleVal(this.schema.strokeWidth,e,t)),strokeOpacity:Ee(this._styleVal(this.schema.strokeOpacity,e,t)),strokeDasharray:We(this._styleVal(this.schema.strokeDasharray,e,t)),strokeLinecap:Fe(this._styleVal(this.schema.strokeLinecap,e,t)),vectorEffect:Fe(this._styleVal(this.schema.vectorEffect,e,t)),shapeRendering:Fe(this._nestWrapper(this.schema.shapeRendering)(e,t)),opacity:Ee(this._nestWrapper(this.schema.opacity)(e,t))}}
972
+ const i=this._getTextureKey(e,t);return{fill:i?`pattern:${i}`:Ne(this._styleVal(this.schema.fill,e,t)),fillOpacity:We(this._styleVal(this.schema.fillOpacity,e,t)),stroke:Ne(this._styleVal(this.schema.stroke,e,t)),strokeWidth:We(this._styleVal(this.schema.strokeWidth,e,t)),strokeOpacity:We(this._styleVal(this.schema.strokeOpacity,e,t)),strokeDasharray:He(this._styleVal(this.schema.strokeDasharray,e,t)),strokeLinecap:Ne(this._styleVal(this.schema.strokeLinecap,e,t)),vectorEffect:Ne(this._styleVal(this.schema.vectorEffect,e,t)),shapeRendering:Ne(this._nestWrapper(this.schema.shapeRendering)(e,t)),opacity:We(this._nestWrapper(this.schema.opacity)(e,t))}}
946
973
  /**
947
974
  Returns the geometry-specific scene fields for a data point. Overridden by
948
975
  each shape subclass; the base provides none.
@@ -952,17 +979,10 @@ const i=this._getTextureKey(e,t);return{fill:i?`pattern:${i}`:Fe(this._styleVal(
952
979
  Produces a backend-agnostic scene graph for this shape's data, reusing the
953
980
  same accessors render() applies to the DOM. This is the migration seam toward
954
981
  the @d3plus/render pluggable backends; it has no effect on render().
955
- */toScene(){let e=this._data;this._dataFilter&&(e=this._dataFilter(e));const t=[],i=[],s=function(e,t){if(!t||e.length<2)return null;const i=e.map((e,t)=>t);i.sort((i,s)=>t(Le(e[i]),Le(e[s])));const s=new Array(e.length);return i.forEach((e,t)=>s[e]=t),s}
956
- /**
957
- Renders the per-datum background images collected during `Shape.toScene` as
958
- flat sibling nodes. When `rank` is set (a `sort` comparator is active) every
959
- returned node needs a `z` — otherwise the backend sort would collapse the
960
- images to 0 and interleave them among the geometry — so they are placed
961
- above all geometry (ranks span `0..dataLen-1`) while keeping their own order.
962
- */(e,this.schema.sort);
963
- // Build the backgroundImage data for emission below. Each datum that
964
- // resolves to a non-false `backgroundImage(d, i)` becomes an
965
- // ImageNode positioned at the shape's geometry.
982
+ */toScene(){let e=this._data;this._dataFilter&&(e=this._dataFilter(e));const t=[],i=[],s=function(e,t){if(!t||e.length<2)return null;const i=e.map((e,t)=>t);i.sort((i,s)=>t(Oe(e[i]),Oe(e[s])));const s=new Array(e.length);return i.forEach((e,t)=>s[e]=t),s}(e,this.schema.sort);
983
+ // Collected background images, emitted below (after the geometry) as clipped,
984
+ // transformed groups. Each datum whose `backgroundImage(d, i)` resolves to a
985
+ // truthy URL contributes one spec.
966
986
  // NOTE: Labels are NOT pushed here. The canonical aggregation point is
967
987
  // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`
968
988
  // AND `shape._labelClass.toScene()` independently. Pushing labels here
@@ -975,20 +995,32 @@ return e.forEach((e,n)=>{const a=this._sceneGeometry(e,n);if(!a)return;const o=t
975
995
  if(this.schema.hitArea){const i=function(e,t,i,s,n,a,o,r){const c="function"==typeof e?e(t,i,s):e;return c&&"number"==typeof c.width&&"number"==typeof c.height?{type:"rect",x:"number"==typeof c.x?c.x:-c.width/2,y:"number"==typeof c.y?c.y:-c.height/2,width:c.width,height:c.height,key:`${n}::hit`,datum:a,index:i,shapeType:o,paint:{fill:"transparent"},transform:r,aria:{hidden:!0}}:null}(this.schema.hitArea,e,n,this._aes(e,n),o,r,this._name,c);
976
996
  // Share the datum's rank so the hit area stays paired just behind its
977
997
  // own geometry (equal `z`, kept in push order by the stable sort).
978
- i&&t.push(s?{...i,z:s[n]}:i)}t.push({...a,key:o,datum:r,index:n,shapeType:this._name,paint:this._scenePaint(e,n),transform:c,aria:{role:Fe(this._nestWrapper(this.schema.role)(e,n)),label:Fe(this._nestWrapper(this.schema.ariaLabel)(e,n))},...s?{z:s[n]}:{}});
979
- // backgroundImage: collect a per-datum image when the accessor
980
- // returns a truthy URL. The image is sized to the shape's
981
- // geometry (preferring width/height fields when present).
982
- const h=this._nestWrapper(this.schema.backgroundImage)(e,n);if(h){const t=a,s=this._sceneTransform(e,n),o="number"==typeof t.width?t.width:void 0,r="number"==typeof t.height?t.height:void 0,c="number"==typeof t.cx?t.cx:"number"==typeof t.x?t.x:0,l="number"==typeof t.cy?t.cy:"number"==typeof t.y?t.y:0,d="number"==typeof t.r?t.r:void 0,u=o??(null!=d?2*d:0),m=r??(null!=d?2*d:0);
983
- // Shape geometry is origin-centered; its on-screen position lives in
984
- // the node transform. The background image is emitted as a flat sibling
985
- // (no transform), so bake the shape's translate into the image x/y —
986
- // otherwise every image lands at the origin (top-left).
987
- i.push({__d3plus__:!0,data:e,i:n,id:this._nestWrapper(this.schema.id)(e,n),url:h,x:(s.x??0)+c-u/2,y:(s.y??0)+l-m/2,width:u,height:m})}}),
998
+ i&&t.push(s?{...i,z:s[n]}:i)}t.push({...a,key:o,datum:r,index:n,shapeType:this._name,paint:this._scenePaint(e,n),transform:c,aria:{role:Ne(this._nestWrapper(this.schema.role)(e,n)),label:Ne(this._nestWrapper(this.schema.ariaLabel)(e,n))},...s?{z:s[n]}:{}});
999
+ // backgroundImage: collect a per-datum image (see backgroundImageLayout for
1000
+ // the cover/contain fit). The wrapping group carries the shape transform,
1001
+ // so the image box + clip stay in local space.
1002
+ const h=this._nestWrapper(this.schema.backgroundImage)(e,n);if(h){const t=a,s=Fe(t,"string"!=typeof t.d&&"number"!=typeof t.width&&"number"!=typeof t.r?this._aes(e,n).points??[]:[],"contain"===this._nestWrapper(this.schema.backgroundImageFit)(e,n)?"contain":"cover");
1003
+ // Only Area/Line lack a `d`/box and need polygon points; Path/Rect/Circle
1004
+ // derive their layout from `d`/width/r directly.
1005
+ s&&i.push({key:o,index:n,datum:r,url:h,box:s.box,clip:s.clip,preserveAspectRatio:s.preserveAspectRatio,opacity:We(this._nestWrapper(this.schema.opacity)(e,n)),transform:c})}}),
988
1006
  // Emit background images AFTER shape children so they paint above the
989
1007
  // shape's fill — matches the DOM order where the <image> was
990
1008
  // appended as a sibling of the shape.
991
- i.length&&t.push(...function(e,t,i,s){e.data(t).id(e=>`${e.id}`).url(e=>e.url).x(e=>e.x).y(e=>e.y).width(e=>e.width).height(e=>e.height).renderMode("compute");const n=e.toScene();return n&&Array.isArray(n.children)?(i&&n.children.forEach((e,t)=>e.z=s+t),n.children):[]}(this._backgroundImageClass,i,s,e.length)),{type:"group",key:`${this._name}-group`,children:t}}render(e){
1009
+ i.length&&t.push(...function(e,t,i){return e.map((e,s)=>{const n={type:"image",
1010
+ // Keyed apart from the shape (which uses `spec.key`): sharing the key would
1011
+ // let this non-interactive image overwrite the shape in the hit-test index.
1012
+ key:`${e.key}-bgimage-img`,x:e.box.x,y:e.box.y,width:e.box.width,height:e.box.height,href:e.url,preserveAspectRatio:e.preserveAspectRatio,
1013
+ // Decorative: pointer events fall through to the shape underneath.
1014
+ interactive:!1};return{type:"group",key:`${e.key}-bgimage`,children:[n],
1015
+ // Carry the shape's datum/index so hover/active dimming treats the image
1016
+ // like its shape — dimming and hover-raising the two together (the group
1017
+ // is emitted after the geometry, so at equal `z` the image stays on top).
1018
+ datum:e.datum,index:e.index,interactive:!1,
1019
+ // A group-level opacity gives the enter/exit animation a target to fade
1020
+ // to/from (matching the shape): the animate layer collapses it to 0 on
1021
+ // enter and eases up to this. It also cascades to the image, so hover
1022
+ // dimming applied here fades the picture with its shape.
1023
+ paint:{opacity:e.opacity??1},...e.transform?{transform:e.transform}:{},...e.clip?{clip:e.clip}:{},...t?{z:i+s}:{}}})}(i,s,e.length)),{type:"group",key:`${this._name}-group`,children:t}}render(e){
992
1024
  // Populate the label TextBox so toScene() reads correct label data. The
993
1025
  // label class is always in compute mode — the scene path materializes text.
994
1026
  const t=this._labelClass;if(t&&"function"==typeof t.renderMode&&t.renderMode("compute"),
@@ -1026,7 +1058,7 @@ if(m&&"function"==typeof m.destroy&&m.destroy(),!m)for(;t.firstChild;)t.removeCh
1026
1058
  /**
1027
1059
  Invoked when creating a new class instance, and sets any default parameters.
1028
1060
  @private
1029
- */constructor(e="g"){super(),re(this,Ne),this._backgroundImageClass=new Re,this._data=[],this._labelClass=new Wt,this._name="Shape",this._tagName=e,this._textureDefs={},
1061
+ */constructor(e="g"){super(),re(this,je),this._data=[],this._labelClass=new Gt,this._name="Shape",this._tagName=e,this._textureDefs={},
1030
1062
  // stroke defaults to a darker shade of fill — closes over `this.schema`
1031
1063
  // so it tracks the current fill accessor. A fill that doesn't parse as a
1032
1064
  // color (e.g. "none"/"transparent", a gradient token) has no darker shade,
@@ -1042,7 +1074,7 @@ this.schema.labelConfig={fontColor:(e,t)=>u.colorContrast(this.schema.fill(e,t))
1042
1074
  // when `shapeConfig.opacity` is 0). Reads `this.schema.opacity` live —
1043
1075
  // like `fontColor` reads `fill` — which unwraps nested label data.
1044
1076
  fontOpacity:(e,t)=>this.schema.opacity(e,t),fontResize:!0,fontMax:50,fontMin:8,fontSize:12,padding:5,textAnchor:"start",verticalAlign:"top"},this.schema.textureDefault={}}}
1045
- /** Area's own fluent accessor schema, layered on top of Shape's. */const je=[{key:"curve",coerce:"const",default:L("linear")},{key:"defined",coerce:"identity",default:()=>!0}];class Ge extends He{
1077
+ /** Area's own fluent accessor schema, layered on top of Shape's. */const Ie=[{key:"curve",coerce:"const",default:L("linear")},{key:"defined",coerce:"identity",default:()=>!0}];class qe extends Ge{
1046
1078
  /**
1047
1079
  Returns the area geometry as a "d" string built by the same area generator
1048
1080
  render() uses, with the center offset baked into the x/x0/x1/y/y0/y1 accessors
@@ -1065,8 +1097,8 @@ return this.schema.x1?r.x1(a(this.schema.x1)):r.x1(null),this.schema.y1?r.y1(o(t
1065
1097
  /**
1066
1098
  Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
1067
1099
  @private
1068
- */constructor(){super(),re(this,je),this._name="Area",this.schema.labelBounds=(e,t,i)=>{const s=y.largestRect(i.points);return s?{angle:s.angle,width:s.width,height:s.height,x:s.cx-s.width/2-this.schema.x(e,t),y:s.cy-s.height/2-this.schema.y(e,t)}:null},this.schema.labelConfig=Object.assign(this.schema.labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this.schema.x=F("x"),this.schema.x0=F("x"),this.schema.x1=null,this.schema.y=L(0),this.schema.y0=L(0),this.schema.y1=F("y")}}
1069
- /** Bar's own fluent accessor schema, layered on top of Shape's. */const Ie=[{key:"height",coerce:"accessor",default:L(10)},{key:"width",coerce:"accessor",default:L(10)}];class qe extends He{
1100
+ */constructor(){super(),re(this,Ie),this._name="Area",this.schema.labelBounds=(e,t,i)=>{const s=p.largestRect(i.points);return s?{angle:s.angle,width:s.width,height:s.height,x:s.cx-s.width/2-this.schema.x(e,t),y:s.cy-s.height/2-this.schema.y(e,t)}:null},this.schema.labelConfig=Object.assign(this.schema.labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this.schema.x=F("x"),this.schema.x0=F("x"),this.schema.x1=null,this.schema.y=L(0),this.schema.y0=L(0),this.schema.y1=F("y")}}
1101
+ /** Bar's own fluent accessor schema, layered on top of Shape's. */const Ye=[{key:"height",coerce:"accessor",default:L(10)},{key:"width",coerce:"accessor",default:L(10)}];class Ke extends Ge{
1070
1102
  // v4: render() is inherited from Shape — the scene path handles drawing.
1071
1103
  /**
1072
1104
  Returns the bar geometry for a data point, matching _applyPosition: width/height
@@ -1107,13 +1139,13 @@ _sceneGeometry(e,t){const i=this._getWidth(e,t),s=this._getHeight(e,t);return{ty
1107
1139
  /**
1108
1140
  Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
1109
1141
  @private
1110
- */constructor(){super("rect"),re(this,Ie),this._name="Bar",this.schema.labelBounds=(e,t,i)=>({width:i.width,height:i.height,x:null!==this.schema.x1?this._getX(e,t):-i.width/2,y:null===this.schema.x1?this._getY(e,t):-i.height/2}),
1142
+ */constructor(){super("rect"),re(this,Ye),this._name="Bar",this.schema.labelBounds=(e,t,i)=>({width:i.width,height:i.height,x:null!==this.schema.x1?this._getX(e,t):-i.width/2,y:null===this.schema.x1?this._getY(e,t):-i.height/2}),
1111
1143
  // Bar labels are horizontally centered inside their bar (vs. Shape's
1112
1144
  // "start" default used by Treemap/Pie/etc.). Pre-merged into the
1113
1145
  // Shape.labelConfig defaults so plotPaint's userConfig override
1114
1146
  // path doesn't have to know about it.
1115
1147
  Object.assign(this.schema.labelConfig,{textAnchor:"middle"}),this.schema.x=F("x"),this.schema.x0=F("x"),this.schema.x1=null,this.schema.y=L(0),this.schema.y0=L(0),this.schema.y1=F("y")}}
1116
- /** Circle's own fluent accessor schema, layered on top of Shape's. */const Ye=[{key:"r",coerce:"accessor",default:F("r")},
1148
+ /** Circle's own fluent accessor schema, layered on top of Shape's. */const Xe=[{key:"r",coerce:"accessor",default:F("r")},
1117
1149
  // Motion-trail toggle: when true, the animate layer sweeps a tapering cone
1118
1150
  // behind each point as it moves between frames (Timeline play), on both the
1119
1151
  // SVG and Canvas backends.
@@ -1123,7 +1155,7 @@ Object.assign(this.schema.labelConfig,{textAnchor:"middle"}),this.schema.x=F("x"
1123
1155
  // keeps a long slowly-fading tail. Requires `trail: true`. Setting it also
1124
1156
  // makes the chart use a single-period timeline + fixed axes automatically
1125
1157
  // (see vizPreDraw) — the conditions a persistent trail needs to stay coherent.
1126
- {key:"trailPersist",coerce:"identity",default:0}];class Ke extends He{
1158
+ {key:"trailPersist",coerce:"identity",default:0}];class Ve extends Ge{
1127
1159
  /**
1128
1160
  Provides the default positioning to the <rect> elements.
1129
1161
  @private
@@ -1144,7 +1176,7 @@ _sceneGeometry(e,t){return{type:"circle",cx:0,cy:0,r:Number(this.schema.r(e,t)),
1144
1176
  /**
1145
1177
  Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
1146
1178
  @private
1147
- */constructor(){super("circle"),re(this,Ye),this._name="Circle",
1179
+ */constructor(){super("circle"),re(this,Xe),this._name="Circle",
1148
1180
  // Bound the label to the full circle (diameter box) and tag it
1149
1181
  // `shape: "circle"`, so the label TextBox flows text as circle chords —
1150
1182
  // lines fill the interior, shorter near the top and bottom and full width
@@ -1153,7 +1185,7 @@ _sceneGeometry(e,t){return{type:"circle",cx:0,cy:0,r:Number(this.schema.r(e,t)),
1153
1185
  // chart that repositions the label with its own `labelBounds` (e.g. Tree's
1154
1186
  // external node labels) gets ordinary rectangular wrapping.
1155
1187
  this.schema.labelBounds=(e,t,i)=>({width:2*i.r,height:2*i.r,x:-i.r,y:-i.r,shape:"circle"}),this.schema.labelConfig=n.assign(this.schema.labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}}
1156
- /** Rect's own fluent accessor schema, layered on top of Shape's. */const Xe=[{key:"height",coerce:"accessor",default:F("height")},
1188
+ /** Rect's own fluent accessor schema, layered on top of Shape's. */const Ue=[{key:"height",coerce:"accessor",default:F("height")},
1157
1189
  // Motion-trail toggle: when true, the animate layer sweeps a tapering cone
1158
1190
  // behind each rect as it moves between frames (Timeline play), sized to the
1159
1191
  // rect's silhouette perpendicular to travel — so a square at 45° trails
@@ -1162,7 +1194,7 @@ this.schema.labelBounds=(e,t,i)=>({width:2*i.r,height:2*i.r,x:-i.r,y:-i.r,shape:
1162
1194
  // Persistent-trail length (see Circle): 0 = ephemeral, a number keeps that
1163
1195
  // many past segments, `true` keeps a long fading tail. Requires `trail: true`;
1164
1196
  // setting it auto-switches the chart to a single-period timeline + fixed axes.
1165
- {key:"trailPersist",coerce:"identity",default:0},{key:"width",coerce:"accessor",default:F("width")}];class Ve extends He{
1197
+ {key:"trailPersist",coerce:"identity",default:0},{key:"width",coerce:"accessor",default:F("width")}];class Je extends Ge{
1166
1198
  // v4: render() is inherited from Shape — the scene path handles drawing.
1167
1199
  /**
1168
1200
  Returns the rect geometry for a data point, matching _applyPosition: the
@@ -1182,8 +1214,8 @@ _sceneGeometry(e,t){const i=Number(this.schema.width(e,t)),s=Number(this.schema.
1182
1214
  /**
1183
1215
  Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
1184
1216
  @private
1185
- */constructor(){super("rect"),re(this,Xe),this._name="Rect",this.schema.labelBounds=(e,t,i)=>({width:i.width,height:i.height,x:-i.width/2,y:-i.height/2})}}
1186
- /** Line's own fluent accessor schema, layered on top of Shape's. */const Ue=[{key:"curve",coerce:"const",default:L("linear")},{key:"defined",coerce:"identity",default:e=>e}];class Je extends He{
1217
+ */constructor(){super("rect"),re(this,Ue),this._name="Rect",this.schema.labelBounds=(e,t,i)=>({width:i.width,height:i.height,x:-i.width/2,y:-i.height/2})}}
1218
+ /** Line's own fluent accessor schema, layered on top of Shape's. */const Qe=[{key:"curve",coerce:"const",default:L("linear")},{key:"defined",coerce:"identity",default:e=>e}];class Ze extends Ge{
1187
1219
  /**
1188
1220
  Filters/manipulates the data array before binding each point to an SVG group.
1189
1221
  @param data @private
@@ -1203,10 +1235,10 @@ _dataFilter(e){const i=t.groups(e,this.schema.id).map(([i,n])=>{const a={key:i,v
1203
1235
  /**
1204
1236
  Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
1205
1237
  @private
1206
- */constructor(){super(),re(this,Ue),this._name="Line",this._path=P.line(),
1238
+ */constructor(){super(),re(this,Qe),this._name="Line",this._path=P.line(),
1207
1239
  // Line-specific overrides of inherited Shape defaults.
1208
- this.schema.fill=L("none"),this.schema.stroke=L("black"),this.schema.strokeWidth=L(1),this.schema.hitArea=L({d:e=>this._path(e.values),fill:"none","stroke-width":10,transform:null})}}const Qe={Circle:Ke,Rect:Ve},Ze=[{key:"duration",coerce:"identity",default:600},{key:"endpoint",coerce:"const",default:F("endpoint","Rect")},{key:"length",coerce:"const",default:F("length",25)},{key:"orient",coerce:"const",default:F("orient","top")},{key:"renderMode",coerce:"identity",default:"full"},{key:"x",coerce:"const",default:F("x",0)},{key:"y",coerce:"const",default:F("y",0)}];
1209
- /** Whisker's fluent accessor schema. Config storage lives on `this.schema.<key>`. */class et extends j{
1240
+ this.schema.fill=L("none"),this.schema.stroke=L("black"),this.schema.strokeWidth=L(1),this.schema.hitArea=L({d:e=>this._path(e.values),fill:"none","stroke-width":10,transform:null})}}const et={Circle:Ve,Rect:Je},tt=[{key:"duration",coerce:"identity",default:600},{key:"endpoint",coerce:"const",default:F("endpoint","Rect")},{key:"length",coerce:"const",default:F("length",25)},{key:"orient",coerce:"const",default:F("orient","top")},{key:"renderMode",coerce:"identity",default:"full"},{key:"x",coerce:"const",default:F("x",0)},{key:"y",coerce:"const",default:F("y",0)}];
1241
+ /** Whisker's fluent accessor schema. Config storage lives on `this.schema.<key>`. */class it extends j{
1210
1242
  /**
1211
1243
  Draws the whisker.
1212
1244
  @param callback Optional callback invoked after rendering completes.
@@ -1215,9 +1247,9 @@ render(e){const s="compute"===this.schema.renderMode;void 0!==this._select||s||t
1215
1247
  // Draw whisker line. Don't pass `callback` to the inner Line —
1216
1248
  // doing so would fire the caller's done-callback after the LINE
1217
1249
  // finished but BEFORE endpoint shapes (below) are rendered.
1218
- this._line=(new Je).data(o).renderMode(s?"compute":"full").select(a("g.d3plus-Whisker")).config(G.bind(this)(this.schema.lineConfig,"shape")).render();const r=this._data.map((e,t)=>{const i={__d3plus__:!0};i.data=e,i.i=t,i.endpoint=this.schema.endpoint(e,t),i.length=this.schema.length(e,t),i.orient=this.schema.orient(e,t);let s=this.schema.x(e,t);"left"===i.orient?s-=i.length:"right"===i.orient&&(s+=i.length);let n=this.schema.y(e,t);return"top"===i.orient?n-=i.length:"bottom"===i.orient&&(n+=i.length),i.x=s,i.y=n,i});
1250
+ this._line=(new Ze).data(o).renderMode(s?"compute":"full").select(a("g.d3plus-Whisker")).config(G.bind(this)(this.schema.lineConfig,"shape")).render();const r=this._data.map((e,t)=>{const i={__d3plus__:!0};i.data=e,i.i=t,i.endpoint=this.schema.endpoint(e,t),i.length=this.schema.length(e,t),i.orient=this.schema.orient(e,t);let s=this.schema.x(e,t);"left"===i.orient?s-=i.length:"right"===i.orient&&(s+=i.length);let n=this.schema.y(e,t);return"top"===i.orient?n-=i.length:"bottom"===i.orient&&(n+=i.length),i.x=s,i.y=n,i});
1219
1251
  // Draw whisker endpoint.
1220
- return this._whiskerEndpoint=[],t.groups(r,e=>e.endpoint).forEach(([e,t])=>{this._whiskerEndpoint.push((new Qe[e]).data(t).renderMode(s?"compute":"full").select(a(`g.d3plus-Whisker-Endpoint-${e}`)).config({height:e=>"top"===e.orient||"bottom"===e.orient?5:20,width:e=>"top"===e.orient||"bottom"===e.orient?20:5}).config(G.bind(this)(this.schema.endpointConfig,"shape",e)).render())}),
1252
+ return this._whiskerEndpoint=[],t.groups(r,e=>e.endpoint).forEach(([e,t])=>{this._whiskerEndpoint.push((new et[e]).data(t).renderMode(s?"compute":"full").select(a(`g.d3plus-Whisker-Endpoint-${e}`)).config({height:e=>"top"===e.orient||"bottom"===e.orient?5:20,width:e=>"top"===e.orient||"bottom"===e.orient?20:5}).config(G.bind(this)(this.schema.endpointConfig,"shape",e)).render())}),
1221
1253
  // Fire the user's done-callback only after endpoints render. The inner
1222
1254
  // shapes don't share one transition queue, so schedule against
1223
1255
  // `duration + 100`.
@@ -1236,7 +1268,7 @@ e&&setTimeout(e,this.schema.duration+100),this}
1236
1268
  /**
1237
1269
  Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.
1238
1270
  @private
1239
- */constructor(){super(),re(this,Ze),this.schema.endpointConfig={Circle:{r:F("r",5)}},this.schema.lineConfig={},this._whiskerEndpoint=[]}}const tt={Circle:Ke,Rect:Ve},it=e=>"function"==typeof e?e:F(e),st=[{key:"orient",coerce:"const",default:F("orient","vertical")},{key:"outlier",coerce:"const",default:F("outlier","Circle")},{key:"rectWidth",coerce:"const",default:L(50)},{key:"renderMode",coerce:"identity",default:"full"},{key:"whiskerMode",coerce:e=>Array.isArray(e)?e:[e,e],default:["tukey","tukey"]},{key:"x",coerce:it,default:F("x",250)},{key:"y",coerce:it,default:F("y",250)}];
1271
+ */constructor(){super(),re(this,tt),this.schema.endpointConfig={Circle:{r:F("r",5)}},this.schema.lineConfig={},this._whiskerEndpoint=[]}}const st={Circle:Ve,Rect:Je},nt=e=>"function"==typeof e?e:F(e),at=[{key:"orient",coerce:"const",default:F("orient","vertical")},{key:"outlier",coerce:"const",default:F("outlier","Circle")},{key:"rectWidth",coerce:"const",default:L(50)},{key:"renderMode",coerce:"identity",default:"full"},{key:"whiskerMode",coerce:e=>Array.isArray(e)?e:[e,e],default:["tukey","tukey"]},{key:"x",coerce:nt,default:F("x",250)},{key:"y",coerce:nt,default:F("y",250)}];
1240
1272
  // Box's x/y setters wrap every non-function (including numbers) in
1241
1273
  // `accessor(...)`, unlike the "accessor" coerce which would `constant(...)`
1242
1274
  // a non-string — so a custom coerce preserves the exact behavior.
@@ -1244,7 +1276,7 @@ e&&setTimeout(e,this.schema.duration+100),this}
1244
1276
  Computes the box statistics (quartiles, limits, geometry) for a single
1245
1277
  orientation group and appends any outliers to `outlierData`.
1246
1278
  */
1247
- function nt(e,i,n,a){const o={key:i,values:n};o.data=s.merge(o.values),o.i=e._data.indexOf(o.values[0]),o.orient=e.schema.orient(o.data,o.i);const r=o.values.map("vertical"===o.orient?e.schema.y:e.schema.x);r.sort((e,t)=>e-t),o.first=t.quantile(r,.25),o.median=t.quantile(r,.5),o.third=t.quantile(r,.75);!
1279
+ function ot(e,i,n,a){const o={key:i,values:n};o.data=s.merge(o.values),o.i=e._data.indexOf(o.values[0]),o.orient=e.schema.orient(o.data,o.i);const r=o.values.map("vertical"===o.orient?e.schema.y:e.schema.x);r.sort((e,t)=>e-t),o.first=t.quantile(r,.25),o.median=t.quantile(r,.5),o.third=t.quantile(r,.75);!
1248
1280
  /**
1249
1281
  Resolves the lower/upper whisker limits on `d` from the configured
1250
1282
  whiskerMode (tukey/extent/quantile) and the sorted group values.
@@ -1260,7 +1292,7 @@ function(e,t,i){t.values.forEach((s,n)=>{const a="vertical"===t.orient?e.schema.
1260
1292
  /**
1261
1293
  Builds the whisker startpoint coordinates (two per box) from the computed
1262
1294
  box geometry.
1263
- */class at extends j{
1295
+ */class rt extends j{
1264
1296
  /**
1265
1297
  Draws the Box.
1266
1298
  */
@@ -1268,18 +1300,18 @@ render(){const e="compute"===this.schema.renderMode;void 0!==this._select||e||th
1268
1300
  // Compute-mode helper: mount inner shapes scene-only (no parent
1269
1301
  // group needed). `select(null)` is the formal "no mount" signal —
1270
1302
  // Shape.render() honors it as long as renderMode is "compute".
1271
- const s=t=>e?null:n.elem(t,{parent:this._select}).node(),a=[],o=t.groups(this._data,(e,t)=>"vertical"===this.schema.orient(e,t)?this.schema.x(e,t):this.schema.y(e,t)).map(([e,t])=>nt(this,e,t,a));
1303
+ const s=t=>e?null:n.elem(t,{parent:this._select}).node(),a=[],o=t.groups(this._data,(e,t)=>"vertical"===this.schema.orient(e,t)?this.schema.x(e,t):this.schema.y(e,t)).map(([e,t])=>ot(this,e,t,a));
1272
1304
  // Draw box.
1273
- this._box=(new Ve).data(o).x(e=>e.x).y(e=>e.y).renderMode(e?"compute":"full").select(s("g.d3plus-Box")).config(G.bind(this)(this.schema.rectConfig,"shape")).render(),
1305
+ this._box=(new Je).data(o).x(e=>e.x).y(e=>e.y).renderMode(e?"compute":"full").select(s("g.d3plus-Box")).config(G.bind(this)(this.schema.rectConfig,"shape")).render(),
1274
1306
  // Draw median.
1275
- this._median=(new Ve).data(o).x(e=>"vertical"===e.orient?e.x:e.median).y(e=>"vertical"===e.orient?e.median:e.y).height(e=>"vertical"===e.orient?1:e.height).width(e=>"vertical"===e.orient?e.width:1).renderMode(e?"compute":"full").select(s("g.d3plus-Box-Median")).config(G.bind(this)(this.schema.medianConfig,"shape")).render();
1307
+ this._median=(new Je).data(o).x(e=>"vertical"===e.orient?e.x:e.median).y(e=>"vertical"===e.orient?e.median:e.y).height(e=>"vertical"===e.orient?1:e.height).width(e=>"vertical"===e.orient?e.width:1).renderMode(e?"compute":"full").select(s("g.d3plus-Box-Median")).config(G.bind(this)(this.schema.medianConfig,"shape")).render();
1276
1308
  // Draw 2 lines using Whisker class.
1277
1309
  // Construct coordinates for whisker startpoints and push it to the whiskerData.
1278
1310
  const r=function(e){const t=[];return e.forEach((e,i)=>{const s=e.x,n=e.y,a=e.first-e.lowerLimit,o=e.upperLimit-e.third;if("vertical"===e.orient){const r=n-e.height/2,c=n+e.height/2;t.push({__d3plus__:!0,data:e,i:i,x:s,y:r,length:a,orient:"top"},{__d3plus__:!0,data:e,i:i,x:s,y:c,length:o,orient:"bottom"})}else if("horizontal"===e.orient){const r=s+e.width/2,c=s-e.width/2;t.push({__d3plus__:!0,data:e,i:i,x:r,y:n,length:o,orient:"right"},{__d3plus__:!0,data:e,i:i,x:c,y:n,length:a,orient:"left"})}}),t}(o);
1279
1311
  // Draw whiskers.
1280
- return this._whisker=(new et).data(r).renderMode(e?"compute":"full").select(s("g.d3plus-Box-Whisker")).config(G.bind(this)(this.schema.whiskerConfig,"shape")).render(),
1312
+ return this._whisker=(new it).data(r).renderMode(e?"compute":"full").select(s("g.d3plus-Box-Whisker")).config(G.bind(this)(this.schema.whiskerConfig,"shape")).render(),
1281
1313
  // Draw outliers.
1282
- this._whiskerEndpoint=[],t.groups(a,e=>e.outlier).forEach(([t,i])=>{this._whiskerEndpoint.push((new tt[t]).data(i).renderMode(e?"compute":"full").select(s(`g.d3plus-Box-Outlier-${t}`)).config(G.bind(this)(this.schema.outlierConfig,"shape",t)).render())}),this}
1314
+ this._whiskerEndpoint=[],t.groups(a,e=>e.outlier).forEach(([t,i])=>{this._whiskerEndpoint.push((new st[t]).data(i).renderMode(e?"compute":"full").select(s(`g.d3plus-Box-Outlier-${t}`)).config(G.bind(this)(this.schema.outlierConfig,"shape",t)).render())}),this}
1283
1315
  /**
1284
1316
  Compute-mode scene aggregation. When Box is rendered with
1285
1317
  `renderMode("compute")`, the inner Rect/Whisker/Circle/etc.
@@ -1296,8 +1328,28 @@ this._whiskerEndpoint=[],t.groups(a,e=>e.outlier).forEach(([t,i])=>{this._whiske
1296
1328
  /**
1297
1329
  Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.
1298
1330
  @private
1299
- */constructor(){super(),re(this,st),this.schema.medianConfig={fill:L("black")},this.schema.outlierConfig={Circle:{r:F("r",5)},Rect:{height:(e,t)=>"vertical"===this.schema.orient(e,t)?5:20,width:(e,t)=>"vertical"===this.schema.orient(e,t)?20:5}},this.schema.rectConfig={fill:L("white"),stroke:L("black"),strokeWidth:L(1)},this.schema.whiskerConfig={},this._whiskerEndpoint=[]}}
1300
- /** Path's own fluent accessor schema, layered on top of Shape's. */const ot=[{key:"d",coerce:"const",default:F("path")}];class rt extends He{
1331
+ */constructor(){super(),re(this,at),this.schema.medianConfig={fill:L("black")},this.schema.outlierConfig={Circle:{r:F("r",5)},Rect:{height:(e,t)=>"vertical"===this.schema.orient(e,t)?5:20,width:(e,t)=>"vertical"===this.schema.orient(e,t)?20:5}},this.schema.rectConfig={fill:L("white"),stroke:L("black"),strokeWidth:L(1)},this.schema.whiskerConfig={},this._whiskerEndpoint=[]}}
1332
+ /** Image's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const ct=[{key:"duration",coerce:"identity",default:600},{key:"height",coerce:"accessor",default:F("height")},{key:"id",coerce:"identity",default:F("id")},{key:"opacity",coerce:"const",default:L(1)},{key:"pointerEvents",coerce:"const",default:L("auto")},{key:"renderMode",coerce:"identity",default:"full"},{key:"url",coerce:"identity",default:F("url")},{key:"width",coerce:"accessor",default:F("width")},{key:"x",coerce:"const",default:F("x",0)},{key:"y",coerce:"const",default:F("y",0)}];class ht{config(e){if(!arguments.length)return{...this.schema,data:this._data,select:this._select};const t=e;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(
1333
+ // `this[k]` resolves the fluent accessor via the index signature.
1334
+ "function"==typeof this[e]?this[e](t[e]):this.schema[e]=t[e]);return this}
1335
+ /**
1336
+ Renders the current Image to the page. If a *callback* is specified, it will be called once the images are done drawing.
1337
+ @param callback Optional callback invoked after rendering completes.
1338
+ */render(e){
1339
+ // Compute mode is a no-op for DOM emission — the caller will read
1340
+ // `toScene()` to get a SceneNode tree, no need to mount.
1341
+ if("compute"===this.schema.renderMode)return e&&setTimeout(e,0),this;void 0===this._select&&this.select(i.select("body").append("svg").style("width",`${window.innerWidth}px`).style("height",`${window.innerHeight}px`).style("display","block").node());const t=this._select.selectAll(".d3plus-Image").data(this._data,this.schema.id),s=t.enter().append("image").attr("class","d3plus-Image").attr("opacity",0).attr("width",0).attr("height",0).attr("x",(e,t)=>this.schema.x(e,t)+this.schema.width(e,t)/2).attr("y",(e,t)=>this.schema.y(e,t)+this.schema.height(e,t)/2),n=g.transition().duration(this.schema.duration),a=this;return s.merge(t).attr("xlink:href",this.schema.url).style("pointer-events",this.schema.pointerEvents).transition(n).attr("opacity",this.schema.opacity).attr("width",(e,t)=>this.schema.width(e,t)).attr("height",(e,t)=>this.schema.height(e,t)).attr("x",(e,t)=>this.schema.x(e,t)).attr("y",(e,t)=>this.schema.y(e,t)).each(function(e,t){const s=i.select(this),n=a.schema.url(e,t);if(!(0===n.indexOf("http://")||0===n.indexOf("https://"))||0===n.indexOf(window.location.hostname)){const e=new window.Image;e.src=n,e.crossOrigin="Anonymous",e.onload=function(){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;t.getContext("2d").drawImage(e,0,0),s.attr("xlink:href",t.toDataURL("image/png"))}}}),t.exit().transition(n).attr("width",(e,t)=>this.schema.width(e,t)).attr("height",(e,t)=>this.schema.height(e,t)).attr("x",(e,t)=>this.schema.x(e,t)).attr("y",(e,t)=>this.schema.y(e,t)).attr("opacity",0).remove(),e&&setTimeout(e,this.schema.duration+100),this}data(e){return arguments.length?(this._data=e,this):this._data}
1342
+ /**
1343
+ Compute-mode scene emission. Mirrors Shape.toScene's shape — a
1344
+ keyed GroupNode wrapping per-datum ImageNodes. Used by chart
1345
+ compositors (e.g. plotPaint) that need Image to participate in the
1346
+ scene graph rather than emit d3-selection DOM.
1347
+ */toScene(){return{type:"group",key:"d3plus-Image",children:(this._data||[]).map((e,t)=>({type:"image",key:`${this.schema.id(e,t)}`,x:this.schema.x(e,t),y:this.schema.y(e,t),width:this.schema.width(e,t),height:this.schema.height(e,t),href:this.schema.url(e,t),paint:{opacity:this.schema.opacity(e,t)},datum:e,index:t}))}}select(e){return arguments.length?(this._select=i.select(e),this):this._select}
1348
+ /**
1349
+ Invoked when creating a new class instance, and sets any default parameters.
1350
+ @private
1351
+ */constructor(){re(this,ct)}}
1352
+ /** Path's own fluent accessor schema, layered on top of Shape's. */const lt=[{key:"d",coerce:"const",default:F("path")}];class dt extends Ge{
1301
1353
  /**
1302
1354
  Returns the path geometry for a data point (the raw "d" string).
1303
1355
  @private
@@ -1307,27 +1359,27 @@ _sceneGeometry(e,t){return{type:"path",d:String(this.schema.d(e,t))}}
1307
1359
  Given a specific data point and index, returns the aesthetic properties of the shape.
1308
1360
  @param data point*
1309
1361
  @param index @private
1310
- */_aes(e,t){return{points:y.path2polygon(this.schema.d(e,t))}}config(e){return arguments.length?(super.config(e),this):super.config()}
1362
+ */_aes(e,t){return{points:p.path2polygon(this.schema.d(e,t))}}config(e){return arguments.length?(super.config(e),this):super.config()}
1311
1363
  /**
1312
1364
  Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
1313
1365
  @private
1314
- */constructor(){super("path"),re(this,ot),this._name="Path",this.schema.labelBounds=(e,t,i)=>{const s=this.schema.labelConfig.rotate,n=y.largestRect(i.points,{angle:s?s(e,t):0});return!!n&&{angle:n.angle,width:n.width,height:n.height,x:n.cx-n.width/2,y:n.cy-n.height/2}},this.schema.labelConfig=Object.assign(this.schema.labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}}var ct=Object.freeze({__proto__:null,Area:Ge,Bar:qe,Box:at,Circle:Ke,Image:Re,Line:Je,Path:rt,Rect:Ve,Shape:He,Whisker:et});
1315
- /* catches for -0 and less*/const ht=e=>e<0||Object.is(e,-0),lt=e=>Math.pow(10,Math.floor(Math.log10(Math.abs(e))))*Math.pow(-1,ht(e)?1:0),dt=e=>Math.pow(10,Math.ceil(Math.log10(Math.abs(e))))*Math.pow(-1,ht(e)?1:0),ut=e=>{const t=`${e}`;if(t.includes("e-")||"0"===t)return 0;const i=t.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/);if(i)return+`${i[1]}${+i[2]+1}`;const s=t.match(/(-*[0-9]+\.[0]*)([1-9]+)0*[0-9]*0{3,}[0-9]+$/);return s?+`${s[1]}${+s[2]}`:e},mt=936e5;
1366
+ */constructor(){super("path"),re(this,lt),this._name="Path",this.schema.labelBounds=(e,t,i)=>{const s=this.schema.labelConfig.rotate,n=p.largestRect(i.points,{angle:s?s(e,t):0});return!!n&&{angle:n.angle,width:n.width,height:n.height,x:n.cx-n.width/2,y:n.cy-n.height/2}},this.schema.labelConfig=Object.assign(this.schema.labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}}var ut=Object.freeze({__proto__:null,Area:qe,Bar:Ke,Box:rt,Circle:Ve,Image:ht,Line:Ze,Path:dt,Rect:Je,Shape:Ge,Whisker:it});
1367
+ /* catches for -0 and less*/const mt=e=>e<0||Object.is(e,-0),ft=e=>Math.pow(10,Math.floor(Math.log10(Math.abs(e))))*Math.pow(-1,mt(e)?1:0),gt=e=>Math.pow(10,Math.ceil(Math.log10(Math.abs(e))))*Math.pow(-1,mt(e)?1:0),pt=e=>{const t=`${e}`;if(t.includes("e-")||"0"===t)return 0;const i=t.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/);if(i)return+`${i[1]}${+i[2]+1}`;const s=t.match(/(-*[0-9]+\.[0]*)([1-9]+)0*[0-9]*0{3,}[0-9]+$/);return s?+`${s[1]}${+s[2]}`:e},yt=936e5;
1316
1368
  /**
1317
1369
  * Calculates ticks from a given scale (negative and/or positive)
1318
1370
  * @param {scale} scale A d3-scale object
1319
1371
  * @private
1320
1372
  */
1321
- function ft(e,i=!1){const s=B.scaleLinear().domain([200,1200]).range([8,28]),n=e.range(),a=Math.abs(n[1]-n[0]);let o=Math.floor(s(a));if("time"===this.schema.scale)if(this._data&&this._data.length){const e=t.extent(this._data),s=this._data.reduce((e,t,i,s)=>{if(i){const n=Math.abs(t-s[i-1]);n<e&&(e=n)}return e},1/0),n=Math.round((e[1]-e[0])/s);o=t.min([o*(i?2:.5),n])}else o=i?2*o:o/2;return Math.floor(o)}
1373
+ function _t(e,i=!1){const s=B.scaleLinear().domain([200,1200]).range([8,28]),n=e.range(),a=Math.abs(n[1]-n[0]);let o=Math.floor(s(a));if("time"===this.schema.scale)if(this._data&&this._data.length){const e=t.extent(this._data),s=this._data.reduce((e,t,i,s)=>{if(i){const n=Math.abs(t-s[i-1]);n<e&&(e=n)}return e},1/0),n=Math.round((e[1]-e[0])/s);o=t.min([o*(i?2:.5),n])}else o=i?2*o:o/2;return Math.floor(o)}
1322
1374
  /**
1323
1375
  * Calculates ticks from a given scale (negative and/or positive)
1324
1376
  * @param {scale} scale A d3-scale object
1325
1377
  * @private
1326
- */function gt(e,i=!1){let s=[];const n=e.copy();if("time"===this.schema.scale&&this._data.length){const i=t.extent(this._data),s=i.map(t=>e(t));n.domain(i).range(s)}const a=n.domain(),o=a[1]<a[0],r=ft.bind(this)(n,i);if(i||"log"!==this.schema.scale){if(s=n.ticks(r),!i&&!["log","time"].includes(this.schema.scale)&&s.length>1){const e=Math.abs(2*ut(s[1]-s[0]));s=s.filter(t=>{const i=Math.abs(t)%e,s=ut(i);return s!==i?!s||s===e:0===i})}}else{const e=a.map(e=>Math.log10(e)%1==0?e:(o?dt:lt)(e)),i=e[1]<e[0],c=e.map(e=>(ht(e)?-1:1)*([-1,1].includes(e)||Math.abs(e)<1?1:Math.log10(Math.abs(e)))),h=Math.ceil((Math.abs(c[1]-c[0])+1)/(.65*r));s=h<=1&&c[0]===c[1]||i!==o?n.ticks(r).filter(e=>+`${e}`.replace("0.","")%2==0):t.range(c[0],c[1],c[1]<c[0]?-1:1).concat([c[1]]).filter(e=>Math.abs(e)%h===0).map(e=>+(""+(ht(e)?-1:1)*(e?Math.pow(10,Math.abs(e)):Math.sign(1/e)>0?1:-1)).replace(/9+/g,"1"))}
1378
+ */function xt(e,i=!1){let s=[];const n=e.copy();if("time"===this.schema.scale&&this._data.length){const i=t.extent(this._data),s=i.map(t=>e(t));n.domain(i).range(s)}const a=n.domain(),o=a[1]<a[0],r=_t.bind(this)(n,i);if(i||"log"!==this.schema.scale){if(s=n.ticks(r),!i&&!["log","time"].includes(this.schema.scale)&&s.length>1){const e=Math.abs(2*pt(s[1]-s[0]));s=s.filter(t=>{const i=Math.abs(t)%e,s=pt(i);return s!==i?!s||s===e:0===i})}}else{const e=a.map(e=>Math.log10(e)%1==0?e:(o?gt:ft)(e)),i=e[1]<e[0],c=e.map(e=>(mt(e)?-1:1)*([-1,1].includes(e)||Math.abs(e)<1?1:Math.log10(Math.abs(e)))),h=Math.ceil((Math.abs(c[1]-c[0])+1)/(.65*r));s=h<=1&&c[0]===c[1]||i!==o?n.ticks(r).filter(e=>+`${e}`.replace("0.","")%2==0):t.range(c[0],c[1],c[1]<c[0]?-1:1).concat([c[1]]).filter(e=>Math.abs(e)%h===0).map(e=>+(""+(mt(e)?-1:1)*(e?Math.pow(10,Math.abs(e)):Math.sign(1/e)>0?1:-1)).replace(/9+/g,"1"))}
1327
1379
  // for time scale, if data array has been provided, filter out ticks that are not in the array
1328
- if("time"===this.schema.scale&&this._data.length){const e=this._data.map(Number);s=s.filter(t=>{const i=+t;return e.find(e=>e>=i-mt&&e<=i+mt)})}
1380
+ if("time"===this.schema.scale&&this._data.length){const e=this._data.map(Number);s=s.filter(t=>{const i=+t;return e.find(e=>e>=i-yt&&e<=i+yt)})}
1329
1381
  // forces min/max into ticks, if not present
1330
- return this._d3ScaleNegative&&ht(a[o?1:0])!==s.some(e=>ht(e))||s.map(Number).includes(+a[0])||s.unshift(a[0]),this._d3ScaleNegative&&ht(a[o?0:1])!==s.some(e=>ht(e))||s.map(Number).includes(+a[1])||s.push(a[1]),s}
1382
+ return this._d3ScaleNegative&&mt(a[o?1:0])!==s.some(e=>mt(e))||s.map(Number).includes(+a[0])||s.unshift(a[0]),this._d3ScaleNegative&&mt(a[o?0:1])!==s.some(e=>mt(e))||s.map(Number).includes(+a[1])||s.push(a[1]),s}
1331
1383
  /**
1332
1384
  Builds the per-tick config array consumed by the tick Shape. Extracted from
1333
1385
  `Axis.render` so the render method stays under the per-function line budget;
@@ -1338,7 +1390,7 @@ return this._d3ScaleNegative&&ht(a[o?1:0])!==s.some(e=>ht(e))||s.map(Number).inc
1338
1390
  Converts an attribute-style config (e.g. gridConfig, barConfig) into a Paint.
1339
1391
  @private
1340
1392
  */
1341
- function pt(e,t,i,s=0){
1393
+ function bt(e,t,i,s=0){
1342
1394
  // Resolve a config value that may be a function (d3-selection style
1343
1395
  // accessor invocation pattern) or a literal. Functions are evaluated
1344
1396
  // against the Axis instance and receive the datum + index, so per-line
@@ -1349,8 +1401,8 @@ const n=t=>{if("function"==typeof t)try{return t.call(e,i,s)}catch{return}return
1349
1401
  Replicates _gridPosition's math to compute each gridline's endpoints in the
1350
1402
  axis's internal coordinate space.
1351
1403
  @private
1352
- */const{theme:yt}=f,_t=[{key:"align",coerce:"identity",default:"middle"},{key:"domain",coerce:"identity",default:[0,10]},{key:"duration",coerce:"identity",default:600},{key:"grid",coerce:"identity"},{key:"gridLog",coerce:"identity",default:!1},{key:"gridSize",coerce:"identity"},{key:"height",coerce:"identity",default:400},{key:"labels",coerce:"identity"},{key:"labelOffset",coerce:"identity",default:!1},{key:"maxSize",coerce:"identity"},{key:"minSize",coerce:"identity"},{key:"padding",coerce:"identity",default:5},{key:"paddingInner",coerce:"identity",default:.1},{key:"paddingOuter",coerce:"identity",default:.1},{key:"range",coerce:"identity"},{key:"renderMode",coerce:"identity",default:"full"},{key:"rounding",coerce:"identity",default:"none"},{key:"roundingInsideMinPrefix",coerce:"identity",default:"< "},{key:"roundingInsideMinSuffix",coerce:"identity",default:""},{key:"roundingInsideMaxPrefix",coerce:"identity",default:""},{key:"roundingInsideMaxSuffix",coerce:"identity",default:"+"},{key:"scale",coerce:"identity",default:"linear"},{key:"scalePadding",coerce:"identity",default:.5},{key:"shape",coerce:"identity",default:"Line"},{key:"tickFormat",coerce:"identity"},{key:"ticks",coerce:"identity"},{key:"tickSize",coerce:"identity",default:8},{key:"tickSuffix",coerce:"identity",default:"normal"},{key:"timeLocale",coerce:"identity",default:void 0},{key:"title",coerce:"identity"},{key:"width",coerce:"identity",default:400}];
1353
- /** Axis's fluent accessor schema. Config storage lives on `this.schema.<key>`. */class xt extends j{
1404
+ */const{theme:kt}=f,vt=[{key:"align",coerce:"identity",default:"middle"},{key:"domain",coerce:"identity",default:[0,10]},{key:"duration",coerce:"identity",default:600},{key:"grid",coerce:"identity"},{key:"gridLog",coerce:"identity",default:!1},{key:"gridSize",coerce:"identity"},{key:"height",coerce:"identity",default:400},{key:"labels",coerce:"identity"},{key:"labelOffset",coerce:"identity",default:!1},{key:"maxSize",coerce:"identity"},{key:"minSize",coerce:"identity"},{key:"padding",coerce:"identity",default:5},{key:"paddingInner",coerce:"identity",default:.1},{key:"paddingOuter",coerce:"identity",default:.1},{key:"range",coerce:"identity"},{key:"renderMode",coerce:"identity",default:"full"},{key:"rounding",coerce:"identity",default:"none"},{key:"roundingInsideMinPrefix",coerce:"identity",default:"< "},{key:"roundingInsideMinSuffix",coerce:"identity",default:""},{key:"roundingInsideMaxPrefix",coerce:"identity",default:""},{key:"roundingInsideMaxSuffix",coerce:"identity",default:"+"},{key:"scale",coerce:"identity",default:"linear"},{key:"scalePadding",coerce:"identity",default:.5},{key:"shape",coerce:"identity",default:"Line"},{key:"tickFormat",coerce:"identity"},{key:"ticks",coerce:"identity"},{key:"tickSize",coerce:"identity",default:8},{key:"tickSuffix",coerce:"identity",default:"normal"},{key:"timeLocale",coerce:"identity",default:void 0},{key:"title",coerce:"identity"},{key:"width",coerce:"identity",default:400}];
1405
+ /** Axis's fluent accessor schema. Config storage lives on `this.schema.<key>`. */class Ct extends j{
1354
1406
  /**
1355
1407
  Returns the scale's domain, taking into account negative and positive log scales.
1356
1408
  @private
@@ -1359,7 +1411,7 @@ _getDomain(){let e=[];this._d3ScaleNegative&&(e=this._d3ScaleNegative.domain()),
1359
1411
  /**
1360
1412
  Returns a value's scale position, taking into account negative and positive log scales.
1361
1413
  @param d @private
1362
- */_getPosition(e){if("log"===this.schema.scale){if(0===e)return(this._d3Scale||this._d3ScaleNegative).range()[this._d3Scale?0:1];const t=ht(e)?this._d3ScaleNegative:this._d3Scale;return t?t(e):0}return this._d3Scale?this._d3Scale(e):0}
1414
+ */_getPosition(e){if("log"===this.schema.scale){if(0===e)return(this._d3Scale||this._d3ScaleNegative).range()[this._d3Scale?0:1];const t=mt(e)?this._d3ScaleNegative:this._d3Scale;return t?t(e):0}return this._d3Scale?this._d3Scale(e):0}
1363
1415
  /**
1364
1416
  Returns the scale's range, taking into account negative and positive log scales.
1365
1417
  @private
@@ -1367,7 +1419,7 @@ _getDomain(){let e=[];this._d3ScaleNegative&&(e=this._d3ScaleNegative.domain()),
1367
1419
  /**
1368
1420
  Returns the scale's labels, taking into account negative and positive log scales.
1369
1421
  @private
1370
- */_getLabels(){let e=[];if(this._d3ScaleNegative&&(e=e.concat(gt.bind(this)(this._d3ScaleNegative,!1))),this._d3Scale&&(e=e.concat(gt.bind(this)(this._d3Scale,!1))),"log"===this.schema.scale){if(e.some(e=>ht(e))&&e.some(e=>e>0)){const i=t.min([...this._d3ScaleNegative.domain().map(Math.abs),...this._d3Scale.domain()]);
1422
+ */_getLabels(){let e=[];if(this._d3ScaleNegative&&(e=e.concat(xt.bind(this)(this._d3ScaleNegative,!1))),this._d3Scale&&(e=e.concat(xt.bind(this)(this._d3Scale,!1))),"log"===this.schema.scale){if(e.some(e=>mt(e))&&e.some(e=>e>0)){const i=t.min([...this._d3ScaleNegative.domain().map(Math.abs),...this._d3Scale.domain()]);
1371
1423
  // add minValue if it does not exist, and should
1372
1424
  e.includes(i)||e.splice(e.findIndex(e=>e>i),0,i),
1373
1425
  // remove -minValue if minValue also exists
@@ -1375,7 +1427,7 @@ e.includes(-i)&&e.includes(i)&&e.splice(e.indexOf(-i),1)}}return e}
1375
1427
  /**
1376
1428
  Returns the scale's ticks, taking into account negative and positive log scales.
1377
1429
  @private
1378
- */_getTicks(){if(["band","ordinal","point","time"].includes(this.schema.scale)&&this._data.length&&this._data.length<this.schema.width/4)return"time"===this.schema.scale?this._data.map(e=>n.date(e)):this._data;let e=[];return this._d3ScaleNegative&&(e=e.concat(gt.bind(this)(this._d3ScaleNegative,!0))),this._d3Scale&&(e=e.concat(gt.bind(this)(this._d3Scale,!0))),"log"===this.schema.scale&&e.includes(-1)&&e.includes(1)&&e.splice(e.indexOf(-1),1),e}
1430
+ */_getTicks(){if(["band","ordinal","point","time"].includes(this.schema.scale)&&this._data.length&&this._data.length<this.schema.width/4)return"time"===this.schema.scale?this._data.map(e=>n.date(e)):this._data;let e=[];return this._d3ScaleNegative&&(e=e.concat(xt.bind(this)(this._d3ScaleNegative,!0))),this._d3Scale&&(e=e.concat(xt.bind(this)(this._d3Scale,!0))),"log"===this.schema.scale&&e.includes(-1)&&e.includes(1)&&e.splice(e.indexOf(-1),1),e}
1379
1431
  /**
1380
1432
  Produces a backend-agnostic scene graph for this axis with no DOM dependency:
1381
1433
  gridlines + domain bar emitted natively, tick marks/labels composed from the
@@ -1391,11 +1443,11 @@ return function(e){const t=[],i=e._gridLineData??[];(function(e){if(!e._gridLine
1391
1443
  /**
1392
1444
  Replicates _barPosition's math to compute the domain-bar endpoints.
1393
1445
  @private
1394
- */)(e).forEach((s,n)=>{const a=pt(e,e.schema.gridConfig,i[n],n);t.push({type:"line",key:`grid-${n}`,points:s.points,paint:a})});const s=e._tickShape&&"function"==typeof e._tickShape.toScene?e._tickShape.toScene():null;
1446
+ */)(e).forEach((s,n)=>{const a=bt(e,e.schema.gridConfig,i[n],n);t.push({type:"line",key:`grid-${n}`,points:s.points,paint:a})});const s=e._tickShape&&"function"==typeof e._tickShape.toScene?e._tickShape.toScene():null;
1395
1447
  // Tick LABELS — appended here because Shape.toScene no longer
1396
1448
  // includes _labelClass children (collectComputed is the canonical
1397
1449
  // aggregator for the chart pipeline; Axis composes labels itself).
1398
- if(s&&t.push(s),e._tickShape){const i=e._tickShape._labelClass;if(i&&"function"==typeof i.toScene&&i._data&&i._data.length){const e=i.toScene();e&&Array.isArray(e.children)&&t.push(...e.children)}}const n=function(e){if(!e._d3Scale&&!e._d3ScaleNegative)return null;const{height:t,x:i,y:s,opposite:n}=e._position,a=e._margin[n],o=["top","left"].includes(e.schema.orient)?e._outerBounds[s]+e._outerBounds[t]-a:e._outerBounds[s]+a,r="band"===e.schema.scale?e._d3Scale.step()-e._d3Scale.bandwidth():"point"===e.schema.scale?e._d3Scale.step()*e._d3Scale.padding():0,c="band"===e.schema.scale?e._d3Scale.step():"point"===e.schema.scale?e._d3Scale.step()*e._d3Scale.padding():0,h=(e._d3ScaleNegative?e._d3ScaleNegative.domain():[]).concat(e._d3Scale?e._d3Scale.domain():[]).sort((e,t)=>e-t);if(!h.length)return null;const l=e._getPosition(h[0])-r,d=e._getPosition(h[h.length-1])+c;return{points:"x"===i?[[l,o],[d,o]]:[[o,l],[o,d]]}}(e);if(n){const i=pt(e,e.schema.barConfig);t.push({type:"line",key:"bar",points:n.points,paint:i})}
1450
+ if(s&&t.push(s),e._tickShape){const i=e._tickShape._labelClass;if(i&&"function"==typeof i.toScene&&i._data&&i._data.length){const e=i.toScene();e&&Array.isArray(e.children)&&t.push(...e.children)}}const n=function(e){if(!e._d3Scale&&!e._d3ScaleNegative)return null;const{height:t,x:i,y:s,opposite:n}=e._position,a=e._margin[n],o=["top","left"].includes(e.schema.orient)?e._outerBounds[s]+e._outerBounds[t]-a:e._outerBounds[s]+a,r="band"===e.schema.scale?e._d3Scale.step()-e._d3Scale.bandwidth():"point"===e.schema.scale?e._d3Scale.step()*e._d3Scale.padding():0,c="band"===e.schema.scale?e._d3Scale.step():"point"===e.schema.scale?e._d3Scale.step()*e._d3Scale.padding():0,h=(e._d3ScaleNegative?e._d3ScaleNegative.domain():[]).concat(e._d3Scale?e._d3Scale.domain():[]).sort((e,t)=>e-t);if(!h.length)return null;const l=e._getPosition(h[0])-r,d=e._getPosition(h[h.length-1])+c;return{points:"x"===i?[[l,o],[d,o]]:[[o,l],[o,d]]}}(e);if(n){const i=bt(e,e.schema.barConfig);t.push({type:"line",key:"bar",points:n.points,paint:i})}
1399
1451
  // The axis was placed inside a container the caller positioned (e.g. Plot's
1400
1452
  // xGroup); preserve that placement on the scene root.
1401
1453
  let a;e._titleClass&&"function"==typeof e._titleClass.toScene&&e._titleClass._data&&e._titleClass._data.length&&t.push(e._titleClass.toScene());const o=e._select&&"function"==typeof e._select.node?e._select.node():null;if(o&&"function"==typeof o.getAttribute){const e=o.getAttribute("transform");if(e){const t=/translate\(\s*([-\d.eE]+)[\s,]+([-\d.eE]+)/.exec(e);t&&(a={x:Number(t[1]),y:Number(t[2])})}}return{type:"group",key:`Axis-${e._uuid.slice(0,8)}`,...a?{transform:a}:{},children:t}}(this)}
@@ -1441,7 +1493,7 @@ const c=function(e,t){const{ticks:i,labels:s,textData:n,tickFormat:a,hBuff:o,lab
1441
1493
  Instantiates and renders the compute-mode tick Shape from `tickData`.
1442
1494
  Extracted from `Axis.render`; behavior is identical.
1443
1495
  @private
1444
- */(this,t);return function(e,t){e._tickShape=(new ct[e.schema.shape]).renderMode("compute").select(null).data(t).duration(e.schema.duration).labelConfig({ellipsis:e=>e&&e.length?`${e}...`:"",
1496
+ */(this,t);return function(e,t){e._tickShape=(new ut[e.schema.shape]).renderMode("compute").select(null).data(t).duration(e.schema.duration).labelConfig({ellipsis:e=>e&&e.length?`${e}...`:"",
1445
1497
  // The label TextBox invokes this with the laid-out label record, whose
1446
1498
  // tick datum (carrying `rotate`) sits on `.data`; fall back to the raw
1447
1499
  // datum for any path that passes it directly.
@@ -1480,22 +1532,22 @@ e._titleClass.renderMode("compute").data(e.schema.title?[{text:e.schema.title}]:
1480
1532
  /**
1481
1533
  Invoked when creating a new class instance, and sets any default parameters.
1482
1534
  @private
1483
- */constructor(){super(),this._d3Scale=null,this._d3ScaleNegative=null,re(this,_t),this._data=[],this._labelRotation=!1,this.schema.barConfig={stroke:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},"stroke-width":1},this.schema.gridConfig={stroke:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)===u.colorDefaults.dark?yt.colors.gray[200]:yt.colors.gray[600]},"stroke-width":1},this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this.schema.shapeConfig={fill:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},height:e=>e.tick?8:0,label:e=>e.text,labelBounds:e=>e.labelBounds,labelConfig:{fontColor:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},fontResize:!1,fontSize:L(12),padding:5,textAnchor:()=>{const e=n.rtl();return"left"===this.schema.orient?e?"start":"end":"right"===this.schema.orient?e?"end":"start":this._labelRotation?"bottom"===this.schema.orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this.schema.orient?"top":"top"===this.schema.orient?this._labelRotation?"top":"bottom":"middle"},r:e=>e.tick?4:0,stroke:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},strokeWidth:1,width:e=>e.tick?8:0},this._tickUnit=0,this._titleClass=new Wt,this.schema.titleConfig={fontColor:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},fontSize:12,textAnchor:"middle"},this._margin={top:0,right:0,bottom:0,left:0},this._availableTicks=[],this._visibleTicks=[]}}class bt extends xt{
1535
+ */constructor(){super(),this._d3Scale=null,this._d3ScaleNegative=null,re(this,vt),this._data=[],this._labelRotation=!1,this.schema.barConfig={stroke:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},"stroke-width":1},this.schema.gridConfig={stroke:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)===u.colorDefaults.dark?kt.colors.gray[200]:kt.colors.gray[600]},"stroke-width":1},this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this.schema.shapeConfig={fill:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},height:e=>e.tick?8:0,label:e=>e.text,labelBounds:e=>e.labelBounds,labelConfig:{fontColor:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},fontResize:!1,fontSize:L(12),padding:5,textAnchor:()=>{const e=n.rtl();return"left"===this.schema.orient?e?"start":"end":"right"===this.schema.orient?e?"end":"start":this._labelRotation?"bottom"===this.schema.orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this.schema.orient?"top":"top"===this.schema.orient?this._labelRotation?"top":"bottom":"middle"},r:e=>e.tick?4:0,stroke:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},strokeWidth:1,width:e=>e.tick?8:0},this._tickUnit=0,this._titleClass=new Gt,this.schema.titleConfig={fontColor:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},fontSize:12,textAnchor:"middle"},this._margin={top:0,right:0,bottom:0,left:0},this._availableTicks=[],this._visibleTicks=[]}}class St extends Ct{
1484
1536
  /**
1485
1537
  Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
1486
1538
  @private
1487
1539
  */
1488
- constructor(){super(),this.orient("bottom")}}class kt extends xt{
1540
+ constructor(){super(),this.orient("bottom")}}class wt extends Ct{
1489
1541
  /**
1490
1542
  Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
1491
1543
  @private
1492
1544
  */
1493
- constructor(){super(),this.orient("left")}}class vt extends xt{
1545
+ constructor(){super(),this.orient("left")}}class zt extends Ct{
1494
1546
  /**
1495
1547
  Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
1496
1548
  @private
1497
1549
  */
1498
- constructor(){super(),this.orient("right")}}class Ct extends xt{
1550
+ constructor(){super(),this.orient("right")}}class Dt extends Ct{
1499
1551
  /**
1500
1552
  Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
1501
1553
  @private
@@ -1505,11 +1557,11 @@ constructor(){super(),this.orient("top")}}
1505
1557
  Runs the row-wrapping pass: builds rows, retries label-free if it overflows,
1506
1558
  then distributes row `y` offsets. Returns the resolved `spaceNeeded`.
1507
1559
  */
1508
- function St(e,i,s,a){const o={lines:1,newRows:[],maxLines:t.max(e._lineData.map(e=>e.words.length))};if(e._wrapLines=()=>
1560
+ function Mt(e,i,s,a){const o={lines:1,newRows:[],maxLines:t.max(e._lineData.map(e=>e.words.length))};if(e._wrapLines=()=>
1509
1561
  /** Attempts to wrap labels onto an additional line, recursing into rows. */function(e,i,s,a){if(i.lines++,i.lines>i.maxLines)return;const o=1===i.lines?e._lineData.slice():e._lineData.filter(t=>t.width+t.shapeWidth+e.schema.padding*(t.width?2:1)>s&&t.words.length>=i.lines).sort((e,t)=>t.sentence.length-e.sentence.length);if(o.length&&a>o[0].height*i.lines){let s=!1;for(let e=0;e<o.length;e++){const a=o[e],c=a.og,h=c.height*i.lines,l=c.width*(1/i.lines*1.5),d=r.textWrap().fontFamily(a.f).fontSize(a.s).lineHeight(a.lh).width(l).height(h)(a.sentence);if(d.truncated){s=!0;break}a.width=Math.ceil(t.max(d.lines.map(e=>n.textWidth(e,{"font-family":a.f,"font-size":a.s}))))+a.s,a.height=d.lines.length*(a.lh+1)}s||e._wrapRows()}else i.newRows=[]}
1510
1562
  /** Packs the measured labels into rows that fit the available width/height. */(e,o,i,s),e._wrapRows=()=>function(e,i,s,n){i.newRows=[];let a=1,o=0;for(let r=0;r<e._lineData.length;r++){const c=e._lineData[r],h=c.width+e.schema.padding*(c.width?2:1)+c.shapeWidth;if(t.sum(i.newRows.map(e=>t.max(e,e=>t.max([e.height,e.shapeHeight]))))>n){i.newRows=[];break}if(h>s){i.newRows=[],e._wrapLines();break}o+h<s?o+=h:"column"!==e.schema.direction&&(o=h,a++),i.newRows[a-1]||(i.newRows[a-1]=[]),i.newRows[a-1].push(c),"column"===e.schema.direction&&(o=0,a++)}}(e,o,i,s),e._wrapRows(),!o.newRows.length||t.sum(o.newRows,e._rowHeight.bind(e))+e.schema.padding>s){a=t.sum(e._lineData.map(t=>t.shapeWidth+e.schema.padding))-e.schema.padding;for(let t=0;t<e._lineData.length;t++)e._lineData[t].width=0,e._lineData[t].height=0;e._wrapRows()}return o.newRows.length&&t.sum(o.newRows,e._rowHeight.bind(e))+e.schema.padding<s&&(o.newRows.forEach((i,s)=>{i.forEach(i=>{s&&(i.y=t.sum(o.newRows.slice(0,s),e._rowHeight.bind(e)))})}),a=t.max(o.newRows,e._rowWidth.bind(e))),a}
1511
1563
  /** Computes `_outerBounds` (size + aligned x/y offset) from the laid-out rows. */
1512
- /** Legend's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const wt=[{key:"align",coerce:"identity",default:"center"},{key:"direction",coerce:"identity",default:"row"},{key:"duration",coerce:"identity",default:600},{key:"height",coerce:"identity",default:200},{key:"id",coerce:"identity",default:F("id")},{key:"label",coerce:"const",default:F("id")},{key:"padding",coerce:"identity",default:5},{key:"renderMode",coerce:"identity",default:"full"},{key:"shape",coerce:"const",default:L("Rect")},{key:"title",coerce:"identity"},{key:"verticalAlign",coerce:"identity",default:"middle"},{key:"width",coerce:"identity",default:400}];class zt extends j{
1564
+ /** Legend's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const At=[{key:"align",coerce:"identity",default:"center"},{key:"direction",coerce:"identity",default:"row"},{key:"duration",coerce:"identity",default:600},{key:"height",coerce:"identity",default:200},{key:"id",coerce:"identity",default:F("id")},{key:"label",coerce:"const",default:F("id")},{key:"padding",coerce:"identity",default:5},{key:"renderMode",coerce:"identity",default:"full"},{key:"shape",coerce:"const",default:L("Rect")},{key:"title",coerce:"identity"},{key:"verticalAlign",coerce:"identity",default:"middle"},{key:"width",coerce:"identity",default:400}];class $t extends j{
1513
1565
  /**
1514
1566
  @param key The configuration key.
1515
1567
  @param d The data point.
@@ -1551,9 +1603,9 @@ this._group=n.elem("g.d3plus-Legend",{parent:this._select}),this._titleGroup=n.e
1551
1603
  /** Wraps + measures the title, setting `_titleHeight` / `_titleWidth`. */function(e){if(e._titleHeight=0,e._titleWidth=0,e.schema.title){const i=e.schema.titleConfig.fontFamily||e._titleClass.fontFamily()(),s=e.schema.titleConfig.fontSize||e._titleClass.fontSize()();let n=e.schema.titleConfig.lineHeight||e._titleClass.lineHeight();n="function"==typeof n?n():n??1.4*s;const a=r.textWrap().fontFamily(i).fontSize(s).lineHeight(n).width(e.schema.width).height(e.schema.height)(e.schema.title);e._titleHeight=n+a.lines.length+e.schema.padding,e._titleWidth=t.max(a.widths)}}
1552
1604
  /** Measures each datum's swatch + wrapped label into the `_lineData` array. */(this);const s=this.schema.height-this._titleHeight;this._lineData=function(e,i){return e._data.map((s,a)=>{const o=e.schema.label(s,a),c=e.schema.shape(s,a),h=e._fetchConfig("r",s,a);let l={data:s,i:a,id:e.schema.id(s,a),shape:c,shapeR:h,shapeWidth:"Circle"===c?2*h:e._fetchConfig("width",s,a),shapeHeight:"Circle"===c?2*h:e._fetchConfig("height",s,a),y:0};if(!o)return l.sentence=!1,l.words=[],l.height=0,l.width=0,l;const d=e._fetchConfig("fontFamily",s,a),u=e._fetchConfig("lineHeight",s,a),m=e._fetchConfig("fontSize",s,a),f=i-(e._data.length+1)*e.schema.padding,g=e.schema.width,p=r.textWrap().fontFamily(d).fontSize(m).lineHeight(u).width(g).height(f)(o);return l=Object.assign(l,p),l.width=Math.ceil(t.max(l.lines.map(e=>n.textWidth(e,{"font-family":d,"font-size":m}))))+10,l.height=Math.ceil(l.lines.length*(u+1)),l.og={height:l.height,width:l.width},l.f=d,l.s=m,l.lh=u,l})}(this,s);let a=this._rowWidth(this._lineData);const o=this.schema.width-2*this.schema.padding;
1553
1605
  /** Renders the title TextBox into the legend's title group. */var c;
1554
- /** Builds the per-shape data and renders the Circle/Rect swatch groups. */return("column"===this.schema.direction||a>o)&&(a=St(this,o,s,a)),function(e,i){const s=t.max(e._lineData,(i,s)=>t.max([i.height,e._fetchConfig("height",i.data,s)])+i.y)+e._titleHeight,n=t.max([i,e._titleWidth]);e._outerBounds.width=n,e._outerBounds.height=s;let a=e.schema.padding,o=e.schema.padding;"center"===e.schema.align?a=(e.schema.width-n)/2:"right"===e.schema.align&&(a=e.schema.width-e.schema.padding-n),"middle"===e.schema.verticalAlign?o=(e.schema.height-s)/2:"bottom"===e.schema.verticalAlign&&(o=e.schema.height-e.schema.padding-s),e._outerBounds.x=a,e._outerBounds.y=o}(this,a),(c=this)._titleClass.renderMode("compute").data(c.schema.title?[{text:c.schema.title}]:[]).duration(c.schema.duration).select(c._titleGroup.node()).textAnchor({left:"start",center:"middle",right:"end"}[c.schema.align]).width(c.schema.width-2*c.schema.padding).x(c.schema.padding).y(c._outerBounds.y).config(c.schema.titleConfig).render(),function(e){e._shapes=[];const t=G.bind(e)(e.schema.shapeConfig,"legend"),i={id:e=>e.id,label:e=>e.label,lineHeight:e=>e.lH},s=e._data.map((t,i)=>({__d3plus__:!0,data:t,i:i,id:e.schema.id(t,i),label:!!e._lineData[i].width&&e.schema.label(t,i),lH:e._fetchConfig("lineHeight",t,i),shape:e.schema.shape(t,i)}));e._shapes=[],["Circle","Rect"].forEach(a=>{e._shapes.push(// Child shapes are compute-only — Legend composes the swatches into its
1606
+ /** Builds the per-shape data and renders the Circle/Rect swatch groups. */return("column"===this.schema.direction||a>o)&&(a=Mt(this,o,s,a)),function(e,i){const s=t.max(e._lineData,(i,s)=>t.max([i.height,e._fetchConfig("height",i.data,s)])+i.y)+e._titleHeight,n=t.max([i,e._titleWidth]);e._outerBounds.width=n,e._outerBounds.height=s;let a=e.schema.padding,o=e.schema.padding;"center"===e.schema.align?a=(e.schema.width-n)/2:"right"===e.schema.align&&(a=e.schema.width-e.schema.padding-n),"middle"===e.schema.verticalAlign?o=(e.schema.height-s)/2:"bottom"===e.schema.verticalAlign&&(o=e.schema.height-e.schema.padding-s),e._outerBounds.x=a,e._outerBounds.y=o}(this,a),(c=this)._titleClass.renderMode("compute").data(c.schema.title?[{text:c.schema.title}]:[]).duration(c.schema.duration).select(c._titleGroup.node()).textAnchor({left:"start",center:"middle",right:"end"}[c.schema.align]).width(c.schema.width-2*c.schema.padding).x(c.schema.padding).y(c._outerBounds.y).config(c.schema.titleConfig).render(),function(e){e._shapes=[];const t=G.bind(e)(e.schema.shapeConfig,"legend"),i={id:e=>e.id,label:e=>e.label,lineHeight:e=>e.lH},s=e._data.map((t,i)=>({__d3plus__:!0,data:t,i:i,id:e.schema.id(t,i),label:!!e._lineData[i].width&&e.schema.label(t,i),lH:e._fetchConfig("lineHeight",t,i),shape:e.schema.shape(t,i)}));e._shapes=[],["Circle","Rect"].forEach(a=>{e._shapes.push(// Child shapes are compute-only — Legend composes the swatches into its
1555
1607
  // own toScene, so sub-shapes never auto-render their own <svg>.
1556
- (new ct[a]).renderMode("compute").parent(e).data(s.filter(e=>e.shape===a)).duration(e.schema.duration).labelConfig({padding:0}).select(e._shapeGroup.node()).verticalAlign("top").config(n.assign({},t,i)).render())})}(this),
1608
+ (new ut[a]).renderMode("compute").parent(e).data(s.filter(e=>e.shape===a)).duration(e.schema.duration).labelConfig({padding:0}).select(e._shapeGroup.node()).verticalAlign("top").config(n.assign({},t,i)).render())})}(this),
1557
1609
  // Standalone render: paint the scene into the user's `_select`. Inside a
1558
1610
  // Viz the legend runs in compute mode and the Viz composes its toScene().
1559
1611
  "compute"!==this.schema.renderMode&&q(this),e&&setTimeout(e,this.schema.duration+100),this}
@@ -1577,14 +1629,14 @@ this._group=n.elem("g.d3plus-Legend",{parent:this._select}),this._titleGroup=n.e
1577
1629
  the `legend` instance so they read live `_lineData` / `_outerBounds` /
1578
1630
  `_rtl` / `_titleHeight` state during render.
1579
1631
  */
1580
- var e;super(),re(this,wt),this._titleClass=new Wt,this._data=[],this._lineData=[],this._outerBounds={width:0,height:0,x:0,y:0},this._shapes=[],this.schema.shapeConfig=(e=this,{fill:F("color"),height:L(12),hitArea:(i,s)=>{const n=e._lineData[s],a=t.max([n.height,n.shapeHeight]);return{width:n.width+n.shapeWidth,height:a,x:-n.shapeWidth/2,y:-a/2}},labelBounds:(i,s)=>{const n=e._lineData[s];let a=n.shapeWidth/2;"Circle"===n.shape&&(a-=n.shapeR/2);const o=t.max([n.shapeHeight,n.height]),r=e._rtl?n.shapeWidth+n.width+2*e.schema.padding:0;return{width:n.width,height:o,x:a+5-r,y:-o/2}},labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},fontFamily:e._titleClass.fontFamily(),fontResize:!1,fontSize:L(10),
1632
+ var e;super(),re(this,At),this._titleClass=new Gt,this._data=[],this._lineData=[],this._outerBounds={width:0,height:0,x:0,y:0},this._shapes=[],this.schema.shapeConfig=(e=this,{fill:F("color"),height:L(12),hitArea:(i,s)=>{const n=e._lineData[s],a=t.max([n.height,n.shapeHeight]);return{width:n.width+n.shapeWidth,height:a,x:-n.shapeWidth/2,y:-a/2}},labelBounds:(i,s)=>{const n=e._lineData[s];let a=n.shapeWidth/2;"Circle"===n.shape&&(a-=n.shapeR/2);const o=t.max([n.shapeHeight,n.height]),r=e._rtl?n.shapeWidth+n.width+2*e.schema.padding:0;return{width:n.width,height:o,x:a+5-r,y:-o/2}},labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},fontFamily:e._titleClass.fontFamily(),fontResize:!1,fontSize:L(10),
1581
1633
  // The swatch's `hitArea` already spans the label, so let it own pointer
1582
1634
  // events for the whole item. A bare label would carry a different scene
1583
1635
  // key than its swatch, so hovering across the swatch→label padding would
1584
1636
  // otherwise read as leaving one item and entering another.
1585
1637
  pointerEvents:L("none"),verticalAlign:"middle"},opacity:1,r:L(6),width:L(12),x:(t,i)=>{const s=e._lineData[i],n=s.y,a="left"===e.schema.align||"right"===e.schema.align&&"column"===e.schema.direction?0:"center"===e.schema.align?(e._outerBounds.width-e._rowWidth(e._lineData.filter(e=>n===e.y)))/2:e._outerBounds.width-e._rowWidth(e._lineData.filter(e=>n===e.y)),o=e._lineData.slice(0,i).filter(e=>n===e.y),r=e._rtl?s.width+e.schema.padding:0;return e._rowWidth(o)+e.schema.padding*(o.length?s.sentence?2:1:0)+e._outerBounds.x+s.shapeWidth/2+a+r},y:(i,s)=>{const n=e._lineData[s];return n.y+e._titleHeight+e._outerBounds.y+t.max(e._lineData.filter(e=>n.y===e.y).map(e=>e.height).concat(e._data.map((t,i)=>e._fetchConfig("height",t,i))))/2}}),this.schema.titleConfig={fontSize:12},this._rtl=!1,this._titleHeight=0,this._titleWidth=0}}
1586
1638
  /** Builds the jenks (ckmeans) threshold scale and assigns it to the instance. */
1587
- /** Builds the linear/log/buckets/quantile scale and assigns it to the instance. */function Dt(e,i){let s=e.schema.buckets instanceof Array?e.schema.buckets:void 0;const n=i.diverging&&!i.colors?
1639
+ /** Builds the linear/log/buckets/quantile scale and assigns it to the instance. */function Bt(e,i){let s=e.schema.buckets instanceof Array?e.schema.buckets:void 0;const n=i.diverging&&!i.colors?
1588
1640
  /** Resolves the diverging linear-gradient color/bucket arrays. */function(e,i,s){const{domain:n,numBuckets:a}=i,o=Math.floor(a/2),r=x.interpolateRgb.gamma(2.2)(e.schema.colorMin,e.schema.colorMid),c=t.range(0,o,1).map(e=>r(e/o)),h=(a%2?[0]:[]).map(()=>e.schema.colorMid),l=x.interpolateRgb.gamma(2.2)(e.schema.colorMax,e.schema.colorMid),d=t.range(0,o,1).map(e=>l(e/o)).reverse(),u=c.concat(h).concat(d);if(!s){const i=(u.length-1)/2;s=[n[0],e.schema.midpoint,n[1]],s=t.range(n[0],e.schema.midpoint,-(n[0]-e.schema.midpoint)/i).concat(t.range(e.schema.midpoint,n[1],(n[1]-e.schema.midpoint)/i)).concat([n[1]])}return{colors:u,buckets:s}}
1589
1641
  /** Resolves the non-diverging linear-gradient color/bucket arrays. */(e,i,s):function(e,i,s){const{allValues:n,domain:a,negative:o,positive:r,diverging:c,numBuckets:h}=i;let{colors:l}=i;if(!l){
1590
1642
  // Single-hue ramp of the relevant pole, stepped in OKLab (light→dark).
@@ -1593,16 +1645,16 @@ const t=o?e.schema.colorMin:e.schema.colorMax;if("buckets"===e.schema.scale||"qu
1593
1645
  /**
1594
1646
  Solves the color scale (jenks or linear) for the current ColorScale config,
1595
1647
  assigning `_colorScale` and returning the values the render branches need.
1596
- */function Mt(e){const i=["bottom","top"].includes(e.schema.orient),n=i?"height":"width",a=i?"width":"height",o=i?"x":"y",r=i?"y":"x",c=e._data.map(e.schema.value).filter(e=>null!==e&&"number"==typeof e).sort((e,t)=>e-t),h=e.schema.domain||t.extent(c),d=h[0]<e.schema.midpoint,m=h[1]>e.schema.midpoint,f=d&&m,g=t.min([e.schema.buckets instanceof Array?e.schema.buckets.length:e.schema.buckets,f&&"jenks"!==e.schema.scale?2*Math.floor(s.unique(c).length/2)-1:s.unique(c).length]);let p=f&&(!e.schema.color||e.schema.color instanceof Array&&!e.schema.color.includes(e.schema.colorMid))?void 0:e.schema.color;!p||p instanceof Array||(
1648
+ */function Pt(e){const i=["bottom","top"].includes(e.schema.orient),n=i?"height":"width",a=i?"width":"height",o=i?"x":"y",r=i?"y":"x",c=e._data.map(e.schema.value).filter(e=>null!==e&&"number"==typeof e).sort((e,t)=>e-t),h=e.schema.domain||t.extent(c),d=h[0]<e.schema.midpoint,m=h[1]>e.schema.midpoint,f=d&&m,g=t.min([e.schema.buckets instanceof Array?e.schema.buckets.length:e.schema.buckets,f&&"jenks"!==e.schema.scale?2*Math.floor(s.unique(c).length/2)-1:s.unique(c).length]);let y=f&&(!e.schema.color||e.schema.color instanceof Array&&!e.schema.color.includes(e.schema.colorMid))?void 0:e.schema.color;!y||y instanceof Array||(
1597
1649
  // A single hue expands to a light→dark ramp, stepped in OKLab.
1598
- p=u.colorRamp(p,g));const _={allValues:c,domain:h,negative:d,positive:m,diverging:f,numBuckets:g,
1650
+ y=u.colorRamp(y,g));const _={allValues:c,domain:h,negative:d,positive:m,diverging:f,numBuckets:g,
1599
1651
  // A single color string is expanded to an array above, so by here this
1600
1652
  // is always an array (or undefined).
1601
- colors:p},x="jenks"===e.schema.scale?function(e,i){const{allValues:s,diverging:n,numBuckets:a}=i;let o,r,{colors:c}=i;const h=t.min([c?c.length:a,a,s.length]);let d=[];if(e.schema.buckets instanceof Array)o=e.schema.buckets;else{if(n&&e.schema.centered){const i=Math.floor(h/2),n=h%2,a=s.filter(t=>t<e.schema.midpoint),o=t.deviation(a),r=s.concat(e.schema.midpoint).filter(t=>t>=e.schema.midpoint),c=t.deviation(r),l=o>c?1:0,u=c>o?1:0,m=y.ckmeans(a,t.min([i+n*l,a.length])),f=y.ckmeans(r,t.min([i+n*u,r.length]));d=m.concat(f)}else d=y.ckmeans(s,h);o=d.map(e=>e[0])}const m=new Set(o);if(o.length!==m.size&&(r=Array.from(m)),!c)if(n){const t=[e.schema.colorMin,e.schema.colorMid,e.schema.colorMax];c=t;const i=o.slice(0,h).filter((t,i)=>t<e.schema.midpoint&&o[i+1]<=e.schema.midpoint),s=o.slice(0,h).filter((t,i)=>t<=e.schema.midpoint&&o[i+1]>e.schema.midpoint),n=o.slice(0,h).filter(t=>t>e.schema.midpoint),a=i.map((e,s)=>s?u.colorLighter(t[0],s/i.length):t[0]),r=s.map(()=>t[1]),l=n.map((e,i)=>i===n.length-1?t[2]:u.colorLighter(t[2],1-(i+1)/n.length));c=a.concat(r).concat(l)}else
1653
+ colors:y},x="jenks"===e.schema.scale?function(e,i){const{allValues:s,diverging:n,numBuckets:a}=i;let o,r,{colors:c}=i;const h=t.min([c?c.length:a,a,s.length]);let d=[];if(e.schema.buckets instanceof Array)o=e.schema.buckets;else{if(n&&e.schema.centered){const i=Math.floor(h/2),n=h%2,a=s.filter(t=>t<e.schema.midpoint),o=t.deviation(a),r=s.concat(e.schema.midpoint).filter(t=>t>=e.schema.midpoint),c=t.deviation(r),l=o>c?1:0,u=c>o?1:0,m=p.ckmeans(a,t.min([i+n*l,a.length])),f=p.ckmeans(r,t.min([i+n*u,r.length]));d=m.concat(f)}else d=p.ckmeans(s,h);o=d.map(e=>e[0])}const m=new Set(o);if(o.length!==m.size&&(r=Array.from(m)),!c)if(n){const t=[e.schema.colorMin,e.schema.colorMid,e.schema.colorMax];c=t;const i=o.slice(0,h).filter((t,i)=>t<e.schema.midpoint&&o[i+1]<=e.schema.midpoint),s=o.slice(0,h).filter((t,i)=>t<=e.schema.midpoint&&o[i+1]>e.schema.midpoint),n=o.slice(0,h).filter(t=>t>e.schema.midpoint),a=i.map((e,s)=>s?u.colorLighter(t[0],s/i.length):t[0]),r=s.map(()=>t[1]),l=n.map((e,i)=>i===n.length-1?t[2]:u.colorLighter(t[2],1-(i+1)/n.length));c=a.concat(r).concat(l)}else
1602
1654
  // Single-hue light→dark ramp, stepped in OKLab (see @d3plus/color).
1603
- c=u.colorRamp(e.schema.colorMax,a);return o.length<=h&&(c=c.slice(-o.length)),c=[c[0]].concat(c),e._colorScale=l.scaleThreshold().domain(o).range(c),{colors:c,ticks:o,labels:r}}(e,_):Dt(e,_);return e._colorScale.clamp&&e._colorScale.clamp(!0),{allValues:c,domain:h,ticks:x.ticks,labels:x.labels,colors:x.colors,horizontal:i,height:n,width:a,x:o,y:r}}
1655
+ c=u.colorRamp(e.schema.colorMax,a);return o.length<=h&&(c=c.slice(-o.length)),c=[c[0]].concat(c),e._colorScale=l.scaleThreshold().domain(o).range(c),{colors:c,ticks:o,labels:r}}(e,_):Bt(e,_);return e._colorScale.clamp&&e._colorScale.clamp(!0),{allValues:c,domain:h,ticks:x.ticks,labels:x.labels,colors:x.colors,horizontal:i,height:n,width:a,x:o,y:r}}
1604
1656
  /** Builds the axis/label configs and trims the gradient for end labels. */
1605
- /** Renders the smooth-gradient (and bucketed-rect) ColorScale variant. */function At(e,t,i){const s={x:0,y:0},{axisConfig:a,labelConfig:r,axisDomain:c,labelData:h}=function(e,t,i){const{horizontal:s,height:a,width:o,domain:r,labels:c,ticks:h}=t,l=r.slice();if(e.schema.bucketAxis){const e=l[l.length-1],t=l[l.length-2],i=e?e/10:t/10,s=i>=1||i<=-1?Math.round(i).toString().length-1:-1*i.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,n=Math.pow(10,s);l[l.length-1]=e+n}const d=n.assign({domain:s?l:l.slice().reverse(),duration:e.schema.duration,height:e.schema.height,labels:c||h,orient:e.schema.orient,padding:e.schema.padding,scale:"log"===e.schema.scale?"log":"linear",ticks:h,width:e.schema.width},e.schema.axisConfig),u=n.assign({height:e.schema[a]/2,width:e.schema[o]/2},e.schema.labelConfig);e._labelClass.config(u);const m=[];if(s&&e._labelMin){const t={"font-family":e._labelClass.fontFamily()(e._labelMin),"font-size":e._labelClass.fontSize()(e._labelMin),"font-weight":e._labelClass.fontWeight()(e._labelMin)};t["font-family"]instanceof Array&&(t["font-family"]=t["font-family"][0]);let a=n.textWidth(e._labelMin,t);a&&a<e.schema[o]/2&&(m.push(e._labelMin),a+=e.schema.padding,s&&(i.x+=a),d[o]=d[o]-a)}if(s&&e._labelMax){const t={"font-family":e._labelClass.fontFamily()(e._labelMax),"font-size":e._labelClass.fontSize()(e._labelMax),"font-weight":e._labelClass.fontWeight()(e._labelMax)};t["font-family"]instanceof Array&&(t["font-family"]=t["font-family"][0]);let a=n.textWidth(e._labelMax,t);a&&a<e.schema[o]/2&&(m.push(e._labelMax),a+=e.schema.padding,s||(i.y+=a),d[o]=d[o]-a)}return{axisConfig:d,labelConfig:u,axisDomain:l,labelData:m}}
1657
+ /** Renders the smooth-gradient (and bucketed-rect) ColorScale variant. */function Tt(e,t,i){const s={x:0,y:0},{axisConfig:a,labelConfig:r,axisDomain:c,labelData:h}=function(e,t,i){const{horizontal:s,height:a,width:o,domain:r,labels:c,ticks:h}=t,l=r.slice();if(e.schema.bucketAxis){const e=l[l.length-1],t=l[l.length-2],i=e?e/10:t/10,s=i>=1||i<=-1?Math.round(i).toString().length-1:-1*i.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,n=Math.pow(10,s);l[l.length-1]=e+n}const d=n.assign({domain:s?l:l.slice().reverse(),duration:e.schema.duration,height:e.schema.height,labels:c||h,orient:e.schema.orient,padding:e.schema.padding,scale:"log"===e.schema.scale?"log":"linear",ticks:h,width:e.schema.width},e.schema.axisConfig),u=n.assign({height:e.schema[a]/2,width:e.schema[o]/2},e.schema.labelConfig);e._labelClass.config(u);const m=[];if(s&&e._labelMin){const t={"font-family":e._labelClass.fontFamily()(e._labelMin),"font-size":e._labelClass.fontSize()(e._labelMin),"font-weight":e._labelClass.fontWeight()(e._labelMin)};t["font-family"]instanceof Array&&(t["font-family"]=t["font-family"][0]);let a=n.textWidth(e._labelMin,t);a&&a<e.schema[o]/2&&(m.push(e._labelMin),a+=e.schema.padding,s&&(i.x+=a),d[o]=d[o]-a)}if(s&&e._labelMax){const t={"font-family":e._labelClass.fontFamily()(e._labelMax),"font-size":e._labelClass.fontSize()(e._labelMax),"font-weight":e._labelClass.fontWeight()(e._labelMax)};t["font-family"]instanceof Array&&(t["font-family"]=t["font-family"][0]);let a=n.textWidth(e._labelMax,t);a&&a<e.schema[o]/2&&(m.push(e._labelMax),a+=e.schema.padding,s||(i.y+=a),d[o]=d[o]-a)}return{axisConfig:d,labelConfig:u,axisDomain:l,labelData:m}}
1606
1658
  /** Renders the measurement + visible axes, returning bounds and the position scale. */(e,t,s),{axisBounds:d,axisScale:u,scaleRange:m}=function(e,t,i,s,a){const{horizontal:o,height:r,width:c,x:h,y:l}=t;e._axisTest.renderMode("compute").select(n.elem("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:e._group}).node()).config(s).duration(0).render();const d=e._axisTest.outerBounds();e._outerBounds[c]=e.schema[c]-2*e.schema.padding,e._outerBounds[r]=d[r]+e.schema.size,e._outerBounds[h]=e.schema.padding,e._outerBounds[l]=e.schema.padding,"middle"===e.schema.align?e._outerBounds[l]=(e.schema[r]-e._outerBounds[r])/2:"end"===e.schema.align&&(e._outerBounds[l]=e.schema[r]-e.schema.padding-e._outerBounds[r]);const u=e._outerBounds[l]+(["bottom","right"].includes(e.schema.orient)?e.schema.size:0)-(s.padding||e._axisClass.padding()),m=`translate(${a.x+(o?0:u)}, ${a.y+(o?u:0)})`;return e._axisClass.renderMode("compute").select(n.elem("g.d3plus-ColorScale-axis",n.assign(i.groupParams,{condition:!0,enter:{transform:m},update:{transform:m}})).node()).config(s).align("start").render(),{axisBounds:d,axisScale:e._axisTest._getPosition.bind(e._axisTest),scaleRange:e._axisTest._getRange()}}
1607
1659
  /**
1608
1660
  Computes the smooth-gradient spec and stashes its serializable fill token on
@@ -1618,14 +1670,14 @@ c=u.colorRamp(e.schema.colorMax,a);return o.length<=h&&(c=c.slice(-o.length)),c=
1618
1670
  return e._rectClass.renderMode("compute").data(h||[0]).id((e,t)=>t).select(i.rectGroup.node()).config(p).render(),p}
1619
1671
  /** Renders the labelMin/labelMax text alongside the gradient. */(e,t,i,{axisScale:u,scaleRange:m,axisDomain:c,axisBounds:d,offsets:s});!function(e,t,i,s,n,a){const{horizontal:o,height:r,width:c}=t;s.height=e._outerBounds[r],s.width=e._outerBounds[c],e._labelClass.renderMode("compute"),e._labelClass.config(s).data(a).select(i.labelGroup.node()).x(t=>t===e._labelMax?n.x+n.width/2+e.schema.padding:e._outerBounds.x).y(t=>n.y-e._labelClass.fontSize()(t)/2).text(e=>e).rotate(o?0:"right"===e.schema.orient?90:-90).render()}(e,t,i,r,f,h)}
1620
1672
  /** Renders the discrete legend ColorScale variant (jenks/buckets/quantile). */
1621
- /** ColorScale's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const $t=[{key:"align",coerce:"identity",default:"middle"},{key:"buckets",coerce:"identity",default:5},{key:"bucketAxis",coerce:"identity",default:!1},{key:"bucketFormat",coerce:"identity"},{key:"bucketJoiner",coerce:"identity",default:(e,t)=>e!==t?`${e} - ${t}`:`${e}`},{key:"centered",coerce:"identity",default:!0},
1673
+ /** ColorScale's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const Ot=[{key:"align",coerce:"identity",default:"middle"},{key:"buckets",coerce:"identity",default:5},{key:"bucketAxis",coerce:"identity",default:!1},{key:"bucketFormat",coerce:"identity"},{key:"bucketJoiner",coerce:"identity",default:(e,t)=>e!==t?`${e} - ${t}`:`${e}`},{key:"centered",coerce:"identity",default:!0},
1622
1674
  // No default palette: an unset `color` falls through to the single-hue
1623
1675
  // (colorMax / colorMin) ramp or the diverging (min↔mid↔max) construction,
1624
1676
  // so magnitude reads as one hue getting darker rather than a multi-hue ramp.
1625
1677
  {key:"color",coerce:"identity"},
1626
1678
  // Blue high pole (and default sequential hue), gray "nothing" midpoint, red
1627
1679
  // low pole — warm/cool poles that stay distinct under color-vision deficiency.
1628
- {key:"colorMax",coerce:"identity",default:u.colorDefaults.sequential},{key:"colorMid",coerce:"identity",default:u.colorDefaults.light},{key:"colorMin",coerce:"identity",default:u.colorDefaults.off},{key:"domain",coerce:"identity"},{key:"duration",coerce:"identity",default:600},{key:"height",coerce:"identity",default:200},{key:"midpoint",coerce:"identity",default:0},{key:"orient",coerce:"identity",default:"bottom"},{key:"padding",coerce:"identity",default:5},{key:"renderMode",coerce:"identity",default:"full"},{key:"scale",coerce:"identity",default:"linear"},{key:"size",coerce:"identity",default:10},{key:"value",coerce:"const",default:F("value")},{key:"width",coerce:"identity",default:400}];class Bt extends j{
1680
+ {key:"colorMax",coerce:"identity",default:u.colorDefaults.sequential},{key:"colorMid",coerce:"identity",default:u.colorDefaults.light},{key:"colorMin",coerce:"identity",default:u.colorDefaults.off},{key:"domain",coerce:"identity"},{key:"duration",coerce:"identity",default:600},{key:"height",coerce:"identity",default:200},{key:"midpoint",coerce:"identity",default:0},{key:"orient",coerce:"identity",default:"bottom"},{key:"padding",coerce:"identity",default:5},{key:"renderMode",coerce:"identity",default:"full"},{key:"scale",coerce:"identity",default:"linear"},{key:"size",coerce:"identity",default:10},{key:"value",coerce:"const",default:F("value")},{key:"width",coerce:"identity",default:400}];class Rt extends j{
1629
1681
  /**
1630
1682
  Renders the current ColorScale to the page.
1631
1683
  @param callback Optional callback invoked after rendering completes.
@@ -1637,7 +1689,7 @@ render(e){
1637
1689
  // compute mode, where the caller reads `toScene()` and no DOM is created.
1638
1690
  void 0===this._select&&"compute"!==this.schema.renderMode&&this.select(i.select("body").append("div").node()),
1639
1691
  // Shape <g> Group
1640
- this._group=n.elem("g.d3plus-ColorScale",{parent:this._select});const t=Mt(this),s=this.schema.bucketAxis||!["buckets","jenks","quantile"].includes(this.schema.scale),a=g.transition().duration(this.schema.duration),o={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:a,update:{opacity:1}},r={labelGroup:n.elem("g.d3plus-ColorScale-labels",Object.assign({condition:s},o)),rectGroup:n.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:s},o)),legendGroup:n.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!s},o)),groupParams:o,gradient:s};return s?At(this,t,r):function(e,t,i){const{horizontal:s,allValues:a,ticks:o,colors:r}=t;n.elem("g.d3plus-ColorScale-axis",Object.assign({condition:i.gradient},i.groupParams));let c=o.reduce((t,i,s)=>{const n=e.schema.bucketFormat.bind(e)(i,s,o,a);
1692
+ this._group=n.elem("g.d3plus-ColorScale",{parent:this._select});const t=Pt(this),s=this.schema.bucketAxis||!["buckets","jenks","quantile"].includes(this.schema.scale),a=g.transition().duration(this.schema.duration),o={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:a,update:{opacity:1}},r={labelGroup:n.elem("g.d3plus-ColorScale-labels",Object.assign({condition:s},o)),rectGroup:n.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:s},o)),legendGroup:n.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!s},o)),groupParams:o,gradient:s};return s?Tt(this,t,r):function(e,t,i){const{horizontal:s,allValues:a,ticks:o,colors:r}=t;n.elem("g.d3plus-ColorScale-axis",Object.assign({condition:i.gradient},i.groupParams));let c=o.reduce((t,i,s)=>{const n=e.schema.bucketFormat.bind(e)(i,s,o,a);
1641
1693
  // `_isColorScaleBucket` marks these as range buckets (not groupBy rows)
1642
1694
  // so a parent Viz's `_drawLabel` titles their tooltip with the bucket
1643
1695
  // label (`id`) instead of resolving to "undefined" via groupBy.
@@ -1670,7 +1722,7 @@ let i;this.schema.bucketAxis||!["buckets","jenks","quantile"].includes(this.sche
1670
1722
  /**
1671
1723
  Invoked when creating a new class instance, and sets any default parameters.
1672
1724
  @private
1673
- */constructor(){super(),re(this,$t),this._axisClass=new xt,this.schema.axisConfig={gridSize:0},this._axisTest=new xt,this.schema.bucketFormat=(e,i,s,n)=>{const a=this.schema.axisConfig.tickFormat?this.schema.axisConfig.tickFormat:m.formatAbbreviate,o=s[i+1],r=!!i&&s[i-1],c=i===s.length-1;if(e===o||c){const i=c&&e<t.max(n)?"+":"";return`${a(e)}${i}`}{const s=o?o/100:e/100,c=s>=1||s<=-1?Math.round(s).toString().length-1:-1*s.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,h=Math.pow(10,c),l=a(r===e&&1===i?t.min([e+h,n.find(t=>t>e&&t<o)]):e),d=a(e&&1===i?o:t.max([o-h,n.reverse().find(t=>t>e&&t<o)]));return this.schema.bucketJoiner(l,d)}},this._data=[],this._labelClass=new Wt,this.schema.labelConfig={fontColor:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},fontSize:12},this._legendClass=new zt,this.schema.legendConfig={shapeConfig:{stroke:u.colorDefaults.dark,strokeWidth:1}},this._outerBounds={width:0,height:0,x:0,y:0},this._rectClass=(new Ve).parent(this),this.schema.rectConfig={stroke:"#999",strokeWidth:1}}}class Pt{
1725
+ */constructor(){super(),re(this,Ot),this._axisClass=new Ct,this.schema.axisConfig={gridSize:0},this._axisTest=new Ct,this.schema.bucketFormat=(e,i,s,n)=>{const a=this.schema.axisConfig.tickFormat?this.schema.axisConfig.tickFormat:m.formatAbbreviate,o=s[i+1],r=!!i&&s[i-1],c=i===s.length-1;if(e===o||c){const i=c&&e<t.max(n)?"+":"";return`${a(e)}${i}`}{const s=o?o/100:e/100,c=s>=1||s<=-1?Math.round(s).toString().length-1:-1*s.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,h=Math.pow(10,c),l=a(r===e&&1===i?t.min([e+h,n.find(t=>t>e&&t<o)]):e),d=a(e&&1===i?o:t.max([o-h,n.reverse().find(t=>t>e&&t<o)]));return this.schema.bucketJoiner(l,d)}},this._data=[],this._labelClass=new Gt,this.schema.labelConfig={fontColor:()=>{const e=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(e)},fontSize:12},this._legendClass=new $t,this.schema.legendConfig={shapeConfig:{stroke:u.colorDefaults.dark,strokeWidth:1}},this._outerBounds={width:0,height:0,x:0,y:0},this._rectClass=(new Je).parent(this),this.schema.rectConfig={stroke:"#999",strokeWidth:1}}}class Lt{
1674
1726
  /**
1675
1727
  Removes the message from the page.
1676
1728
  */
@@ -1684,14 +1736,14 @@ exit(e,t){e.transition().duration(t).style("opacity",0).transition().remove(),th
1684
1736
  /**
1685
1737
  Invoked when creating a new class instance, and sets any default parameters.
1686
1738
  @private
1687
- */constructor(){this._isVisible=!1}}const Tt={i:"font-style: italic;",em:"font-style: italic;",b:"font-weight: bold;",strong:"font-weight: bold;"};
1688
- /** Parses a "style: foo; …" string from defaultHtmlLookup into TextRun style. */function Ot(e){const t={};for(const i of e.split(";")){const[e,s]=i.split(":").map(e=>e.trim());e&&s&&("font-weight"===e?t.weight=/^\d+$/.test(s)?Number(s):s:"font-style"===e&&(t.style="italic"===s?"italic":"normal"))}return void 0===t.weight&&void 0===t.style?void 0:t}
1739
+ */constructor(){this._isVisible=!1}}const Et={i:"font-style: italic;",em:"font-style: italic;",b:"font-weight: bold;",strong:"font-weight: bold;"};
1740
+ /** Parses a "style: foo; …" string from defaultHtmlLookup into TextRun style. */function Ft(e){const t={};for(const i of e.split(";")){const[e,s]=i.split(":").map(e=>e.trim());e&&s&&("font-weight"===e?t.weight=/^\d+$/.test(s)?Number(s):s:"font-style"===e&&(t.style="italic"===s?"italic":"normal"))}return void 0===t.weight&&void 0===t.style?void 0:t}
1689
1741
  /**
1690
1742
  Walks one wrapped line, applies the regex cleanup (closing dangling
1691
1743
  open tags, opening trailing closing tags), then splits it into runs by the
1692
1744
  configured htmlLookup. Returns the new openTag state for the next line so a
1693
1745
  multi-line bold/italic continues to style subsequent lines.
1694
- */function Rt(e,t,i){
1746
+ */function Wt(e,t,i){
1695
1747
  // textContent escaping: keep entity escaping in sync with render()
1696
1748
  // so SVG output stays identical.
1697
1749
  let s=e.trimEnd().replace(/&([^;&]*)/g,(e,t)=>"amp"===t?e:`&amp;${t}`).replace(/<([^A-z^/]+)/g,(e,t)=>`&lt;${t}`).replace(/<$/g,"&lt;").replace(/(<[^>^/]+>)([^<^>]+)$/g,(e,t,i)=>`${t}${i}${t.replace("<","</")}`).replace(/^([^<^>]+)(<\/[^>]+>)/g,(e,t,i)=>`${i.replace("</","<")}${t}${i}`),n=i;
@@ -1699,15 +1751,15 @@ let s=e.trimEnd().replace(/&([^;&]*)/g,(e,t)=>"amp"===t?e:`&amp;${t}`).replace(/
1699
1751
  // line with the opening tag so the same tag closes within the line.
1700
1752
  n&&!s.startsWith("<")&&(s=`<${n}>${s}`,s.includes(`</${n}>`)||(s+=`</${n}>`));const a=/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g,o=[];let r,c=0;for(;null!==(r=a.exec(s));){r.index>c&&o.push({text:s.slice(c,r.index)});const i=r[1],a=r[2],h=t[i];h?(
1701
1753
  // If the original raw line contains a closing tag, the tag has terminated.
1702
- n=!e.includes(`</${i}>`)&&i,o.push({text:a,style:Ot(h)})):o.push({text:a}),c=r.index+r[0].length}return c<s.length&&o.push({text:s.slice(c)}),
1754
+ n=!e.includes(`</${i}>`)&&i,o.push({text:a,style:Ft(h)})):o.push({text:a}),c=r.index+r[0].length}return c<s.length&&o.push({text:s.slice(c)}),
1703
1755
  // If the raw line never opened a tag but we already had openTag set, the
1704
1756
  // line is fully inside that tag — wrap it.
1705
1757
  !o.length&&s&&o.push({text:s}),{runs:o,openTag:n}}
1706
1758
  /** Builds the per-line LineRun arrays from wrapped lines, carrying open-tag state. */
1707
- /** Assembles the final TextBoxDatum from the resolved layout values. */function Lt(e,t,i,s){const{lineData:n,line:a,fS:o,lH:r,w:c,h:h,vA:l,style:d,widths:u,padding:m}=s,f=a*r,g=e.schema.rotate(t,i);let p=0===g?"top"===l?0:"middle"===l?h/2-f/2:h-f:0;p-=.1*r;
1759
+ /** Assembles the final TextBoxDatum from the resolved layout values. */function Nt(e,t,i,s){const{lineData:n,line:a,fS:o,lH:r,w:c,h:h,vA:l,style:d,widths:u,padding:m}=s,f=a*r,g=e.schema.rotate(t,i);let p=0===g?"top"===l?0:"middle"===l?h/2-f/2:h-f:0;p-=.1*r;
1708
1760
  // Pre-compute per-line runs from HTML markup, carrying open-tag state
1709
1761
  // across lines so a multi-line <b> continues to bold subsequent lines.
1710
- const y=function(e,t){let i=null;if(e.schema.html){const s=e.schema.html;let n=!1;const a=[];let o=!1;for(const e of t){const{runs:t,openTag:i}=Rt(e,s,n);a.push(t),n=i,t.some(e=>e.style)&&(o=!0)}
1762
+ const y=function(e,t){let i=null;if(e.schema.html){const s=e.schema.html;let n=!1;const a=[];let o=!1;for(const e of t){const{runs:t,openTag:i}=Wt(e,s,n);a.push(t),n=i,t.some(e=>e.style)&&(o=!0)}
1711
1763
  // Only emit runs when at least one line carries a style; otherwise
1712
1764
  // leave runs unset so the renderer emits a single text node.
1713
1765
  o&&(i=a)}return i}
@@ -1715,7 +1767,7 @@ o&&(i=a)}return i}
1715
1767
  /**
1716
1768
  Computes the laid-out text box for a single data point, or null when the
1717
1769
  text is undefined or wraps to no visible lines.
1718
- */function Et(e,i,s){const a=e;let o=e.schema.text(i,s);if(void 0===o)return null;o=`${o}`.trim();const c=e.schema.fontResize(i,s),h=e.schema.lineHeight(i,s)/e.schema.fontSize(i,s);let l=c?e.schema.fontMax(i,s):e.schema.fontSize(i,s),d=c?l*h:e.schema.lineHeight(i,s),u=1,m=[],f={lines:[],truncated:!1,widths:[]};const g={"font-family":n.fontExists(e.schema.fontFamily(i,s)),"font-size":l,"font-weight":e.schema.fontWeight(i,s),"line-height":d},p=n.parseSides(e.schema.padding(i,s)),y=e.schema.height(i,s)-(p.top+p.bottom),_=e.schema.width(i,s)-(p.left+p.right),x=e.schema.shape(i,s),b=r.textWrap().fontFamily(g["font-family"]).fontSize(l).fontWeight(g["font-weight"]).lineHeight(d).maxLines(e.schema.maxLines(i,s)).height(y).overflow(e.schema.overflow(i,s)).shape(x).width(_).split(e.schema.split),k=e.schema.fontMax(i,s),v=e.schema.fontMin(i,s),C=e.schema.verticalAlign(i,s),S=e.schema.split(o,s);return _>v&&(y>d||c&&y>v*h)&&(c&&(l=function(e,i,s,a,o,r,c){const h=n.textWidth(o,r),l=1.165+i/s*.1,// A circle fills only ~π/4 of its bounding box, so scale the usable area
1770
+ */function Ht(e,i,s){const a=e;let o=e.schema.text(i,s);if(void 0===o)return null;o=`${o}`.trim();const c=e.schema.fontResize(i,s),h=e.schema.lineHeight(i,s)/e.schema.fontSize(i,s);let l=c?e.schema.fontMax(i,s):e.schema.fontSize(i,s),d=c?l*h:e.schema.lineHeight(i,s),u=1,m=[],f={lines:[],truncated:!1,widths:[]};const g={"font-family":n.fontExists(e.schema.fontFamily(i,s)),"font-size":l,"font-weight":e.schema.fontWeight(i,s),"line-height":d},p=n.parseSides(e.schema.padding(i,s)),y=e.schema.height(i,s)-(p.top+p.bottom),_=e.schema.width(i,s)-(p.left+p.right),x=e.schema.shape(i,s),b=r.textWrap().fontFamily(g["font-family"]).fontSize(l).fontWeight(g["font-weight"]).lineHeight(d).maxLines(e.schema.maxLines(i,s)).height(y).overflow(e.schema.overflow(i,s)).shape(x).width(_).split(e.schema.split),k=e.schema.fontMax(i,s),v=e.schema.fontMin(i,s),C=e.schema.verticalAlign(i,s),S=e.schema.split(o,s);return _>v&&(y>d||c&&y>v*h)&&(c&&(l=function(e,i,s,a,o,r,c){const h=n.textWidth(o,r),l=1.165+i/s*.1,// A circle fills only ~π/4 of its bounding box, so scale the usable area
1719
1771
  // down to keep the initial font-size guess from overshooting.
1720
1772
  d=i*s*("circle"===c?Math.PI/4:1),u=t.max(h),m=t.sum(h,e=>e*a)*l;if(u>i||m>d){const s=Math.sqrt(d/m),n=i/u,a=t.min([s,n]);e=Math.floor(e*a)}const f=Math.floor(.8*s);return e>f&&(e=f),e}(l,_,y,d,S,g,x)),
1721
1773
  /**
@@ -1724,22 +1776,22 @@ d=i*s*("circle"===c?Math.PI/4:1),u=t.max(h),m=t.sum(h,e=>e*a)*l;if(u>i||m>d){con
1724
1776
  */
1725
1777
  function e(){const i=()=>{u<1?m=[a.schema.ellipsis("",u)]:m[u-1]=a.schema.ellipsis(m[u-1],u)};
1726
1778
  // Constraint the font size
1727
- if(l=t.max([l,v]),l=t.min([l,k]),c&&(d=l*h,b.fontSize(l).lineHeight(d),g["font-size"]=l,g["line-height"]=d),f=b(o),m=f.lines.filter(e=>""!==e),u=m.length,f.truncated)if(c){if(l--,l<v)return l=v,void i();e()}else i()}()),m.length?Lt(e,i,s,{lineData:m,line:u,fS:l,lH:d,w:_,h:y,vA:C,style:g,widths:f.widths,padding:p}):null}
1728
- /** TextBox's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const Ft=[{key:"ariaHidden",coerce:"const",default:L("false")},{key:"delay",coerce:"identity",default:0},{key:"duration",coerce:"identity",default:0},{key:"ellipsis",coerce:"const",default:(e,t)=>t?`${e.replace(/\.|,$/g,"")}...`:""},{key:"fontColor",coerce:"const",default:L("black")},{key:"fontFamily",coerce:"const",default:L(r.fontFamily)},{key:"fontMax",coerce:"const",default:L(50)},{key:"fontMin",coerce:"const",default:L(8)},{key:"fontOpacity",coerce:"const",default:L(1)},{key:"fontResize",coerce:"const",default:L(!1)},{key:"fontSize",coerce:"const",default:L(10)},{key:"fontStroke",coerce:"const",default:L("transparent")},{key:"fontStrokeWidth",coerce:"const",default:L(0)},{key:"fontWeight",coerce:"const",default:L(400)},{key:"height",coerce:"const",default:F("height",200)},{key:"id",coerce:"const",default:(e,t)=>e.id||`${t}`},{key:"lineHeight",coerce:"const"},{key:"maxLines",coerce:"const",default:L(null)},{key:"overflow",coerce:"const",default:L(!1)},{key:"padding",coerce:"const",default:L(0)},{key:"pointerEvents",coerce:"const",default:L("auto")},{key:"renderMode",coerce:"identity",default:"full"},{key:"rotate",coerce:"const",default:L(0)},{key:"rotateAnchor",coerce:"const",default:e=>[e.w/2,e.h/2]},
1779
+ if(l=t.max([l,v]),l=t.min([l,k]),c&&(d=l*h,b.fontSize(l).lineHeight(d),g["font-size"]=l,g["line-height"]=d),f=b(o),m=f.lines.filter(e=>""!==e),u=m.length,f.truncated)if(c){if(l--,l<v)return l=v,void i();e()}else i()}()),m.length?Nt(e,i,s,{lineData:m,line:u,fS:l,lH:d,w:_,h:y,vA:C,style:g,widths:f.widths,padding:p}):null}
1780
+ /** TextBox's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const jt=[{key:"ariaHidden",coerce:"const",default:L("false")},{key:"delay",coerce:"identity",default:0},{key:"duration",coerce:"identity",default:0},{key:"ellipsis",coerce:"const",default:(e,t)=>t?`${e.replace(/\.|,$/g,"")}...`:""},{key:"fontColor",coerce:"const",default:L("black")},{key:"fontFamily",coerce:"const",default:L(r.fontFamily)},{key:"fontMax",coerce:"const",default:L(50)},{key:"fontMin",coerce:"const",default:L(8)},{key:"fontOpacity",coerce:"const",default:L(1)},{key:"fontResize",coerce:"const",default:L(!1)},{key:"fontSize",coerce:"const",default:L(10)},{key:"fontStroke",coerce:"const",default:L("transparent")},{key:"fontStrokeWidth",coerce:"const",default:L(0)},{key:"fontWeight",coerce:"const",default:L(400)},{key:"height",coerce:"const",default:F("height",200)},{key:"id",coerce:"const",default:(e,t)=>e.id||`${t}`},{key:"lineHeight",coerce:"const"},{key:"maxLines",coerce:"const",default:L(null)},{key:"overflow",coerce:"const",default:L(!1)},{key:"padding",coerce:"const",default:L(0)},{key:"pointerEvents",coerce:"const",default:L("auto")},{key:"renderMode",coerce:"identity",default:"full"},{key:"rotate",coerce:"const",default:L(0)},{key:"rotateAnchor",coerce:"const",default:e=>[e.w/2,e.h/2]},
1729
1781
  // Bounding shape for wrapping: "square" (default) fills the full width on
1730
1782
  // every line; "circle" treats width/height as the diameter and shortens
1731
1783
  // lines near the top and bottom to keep text inside the circle. Defaults to
1732
1784
  // the label record's namespaced `__d3plusWrapShape__` (stamped from a shape's
1733
1785
  // `labelBounds`) so Circle labels wrap to the circle without callers
1734
1786
  // configuring anything, while a caller's own `shape` data field is ignored.
1735
- {key:"shape",coerce:"const",default:e=>e.__d3plusWrapShape__??"square"},{key:"split",coerce:"identity",default:r.textSplit},{key:"text",coerce:"const",default:F("text")},{key:"textAnchor",coerce:"const",default:L("start")},{key:"verticalAlign",coerce:"const",default:L("top")},{key:"width",coerce:"const",default:F("width",200)},{key:"x",coerce:"const",default:F("x",0)},{key:"y",coerce:"const",default:F("y",0)}];class Wt extends j{
1787
+ {key:"shape",coerce:"const",default:e=>e.__d3plusWrapShape__??"square"},{key:"split",coerce:"identity",default:r.textSplit},{key:"text",coerce:"const",default:F("text")},{key:"textAnchor",coerce:"const",default:L("start")},{key:"verticalAlign",coerce:"const",default:L("top")},{key:"width",coerce:"const",default:F("width",200)},{key:"x",coerce:"const",default:F("x",0)},{key:"y",coerce:"const",default:F("y",0)}];class Gt extends j{
1736
1788
  /**
1737
1789
  Computes the laid-out text boxes (wrapping, font sizing, per-box position)
1738
1790
  for the current data. Shared by render() and toScene() so both produce
1739
1791
  identical layout.
1740
1792
  @private
1741
1793
  */
1742
- _textData(){return this._data.reduce((e,t,i)=>{const s=Et(this,t,i);return s&&e.push(s),e},[])}
1794
+ _textData(){return this._data.reduce((e,t,i)=>{const s=Ht(this,t,i);return s&&e.push(s),e},[])}
1743
1795
  /**
1744
1796
  Produces a backend-agnostic scene graph for the text boxes, reusing the same
1745
1797
  layout (_textData) and per-line positioning render() applies to the DOM.
@@ -1753,11 +1805,11 @@ _textData(){return this._data.reduce((e,t,i)=>{const s=Et(this,t,i);return s&&e.
1753
1805
  return e&&setTimeout(e,0),this;
1754
1806
  // Standalone use: route toScene() through SvgRenderer. Mirrors Shape.render
1755
1807
  // so `new TextBox().render()` works without a d3-selection body.
1756
- if(void 0===this._select&&"undefined"!=typeof document){const e=i.select("body").append("svg").style("width",`${window.innerWidth}px`).style("height",`${window.innerHeight}px`).node();this.select(e)}if(this._select){const e=this._select,t=e&&"function"==typeof e.node?e.node():e;if(t){const e=this.toScene(),i=e.children.reduce((e,t)=>Math.max(e,(t.transform?.x??0)+(t.width??0)),0),s=e.children.reduce((e,t)=>Math.max(e,(t.transform?.y??0)+(t.height??0)),0),n="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():null,a=n&&n.width||Number(t.getAttribute("width"))||t.clientWidth||0,r=n&&n.height||Number(t.getAttribute("height"))||t.clientHeight||0,c=Math.max(a,i)||400,h=Math.max(r,s)||300;for(;t.firstChild;)t.removeChild(t.firstChild);const l={root:e,width:c,height:h},d=new o.SvgRenderer;d.mount({container:t,width:c,height:h}),d.drawScene(l),this._sceneRenderer=d}}return e&&setTimeout(e,0),this}data(e){return arguments.length?(this._data=e,this):this._data}html(e){return arguments.length?(this.schema.html="boolean"==typeof e?!!e&&Tt:e,this):this.schema.html}select(e){return arguments.length?(this._select=i.select(e),this):this._select}
1808
+ if(void 0===this._select&&"undefined"!=typeof document){const e=i.select("body").append("svg").style("width",`${window.innerWidth}px`).style("height",`${window.innerHeight}px`).node();this.select(e)}if(this._select){const e=this._select,t=e&&"function"==typeof e.node?e.node():e;if(t){const e=this.toScene(),i=e.children.reduce((e,t)=>Math.max(e,(t.transform?.x??0)+(t.width??0)),0),s=e.children.reduce((e,t)=>Math.max(e,(t.transform?.y??0)+(t.height??0)),0),n="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():null,a=n&&n.width||Number(t.getAttribute("width"))||t.clientWidth||0,r=n&&n.height||Number(t.getAttribute("height"))||t.clientHeight||0,c=Math.max(a,i)||400,h=Math.max(r,s)||300;for(;t.firstChild;)t.removeChild(t.firstChild);const l={root:e,width:c,height:h},d=new o.SvgRenderer;d.mount({container:t,width:c,height:h}),d.drawScene(l),this._sceneRenderer=d}}return e&&setTimeout(e,0),this}data(e){return arguments.length?(this._data=e,this):this._data}html(e){return arguments.length?(this.schema.html="boolean"==typeof e?!!e&&Et:e,this):this.schema.html}select(e){return arguments.length?(this._select=i.select(e),this):this._select}
1757
1809
  /**
1758
1810
  Invoked when creating a new class instance, and sets any default parameters.
1759
1811
  @private
1760
- */constructor(){super(),re(this,Ft),this.schema.lineHeight=(e,t)=>1.2*this.schema.fontSize(e,t),this.schema.html=Tt}}const Nt="#bbb";
1812
+ */constructor(){super(),re(this,jt),this.schema.lineHeight=(e,t)=>1.2*this.schema.fontSize(e,t),this.schema.html=Et}}const It="#bbb";
1761
1813
  /**
1762
1814
  Builds the play/pause TextBox. The button's visual is composed into the
1763
1815
  scene in compute mode; its click is wired to `Timeline._togglePlay` via a
@@ -1768,8 +1820,8 @@ if(void 0===this._select&&"undefined"!=typeof document){const e=i.select("body")
1768
1820
  Sets the Timeline-specific defaults that override the inherited Axis config,
1769
1821
  mirroring the original constructor body exactly.
1770
1822
  */
1771
- function Ht(e){e.schema.brushFilter=e=>{const t=e;return!t.button&&t.detail<2},e.schema.domain=[2001,2010],e.schema.gridSize=0,e.schema.handleConfig={fill:u.colorDefaults.light,stroke:"#228be6","stroke-width":2,rx:2,ry:2},e.schema.height=100,e.schema.labelOffset=!1,e.schema.on={},e.orient("bottom"),e._playButtonClass=new Wt,e.schema.playButtonConfig={fontColor:u.colorDefaults.dark,fontSize:15,text:()=>e._playTimer?"⏸":"⏵",textAnchor:"middle",verticalAlign:"middle"},e.schema.selectionConfig={fill:"#228be6","fill-opacity":()=>"buttons"===e._buttonBehaviorCurrent?.3:1,"stroke-width":0},e.schema.shape="Rect",e.schema.barConfig=n.assign({},e.schema.barConfig,{stroke:()=>"buttons"===e._buttonBehaviorCurrent?"transparent":Nt,"stroke-width":()=>"buttons"===e._buttonBehaviorCurrent?0:1}),e.schema.shapeConfig=n.assign({},e.schema.shapeConfig,
1772
- /** Assembles the per-tick shapeConfig overrides (button vs. tick mode). */function(e){return{labelBounds:t=>"buttons"===e._buttonBehaviorCurrent?{x:t.labelBounds.x,y:-e.schema.buttonHeight/2+1,width:t.labelBounds.width,height:e.schema.buttonHeight}:t.labelBounds,labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},fontSize:()=>12,verticalAlign:()=>"buttons"===e._buttonBehaviorCurrent?"middle":"top"},fill:()=>"buttons"===e._buttonBehaviorCurrent?"#fff":Nt,stroke:()=>"buttons"===e._buttonBehaviorCurrent?Nt:"transparent",height:t=>"buttons"===e._buttonBehaviorCurrent?e.schema.buttonHeight:t.tick?e.schema.handleSize:0,width:t=>"buttons"===e._buttonBehaviorCurrent?e._ticksWidth/e._availableTicks.length:t.tick?e.schema.domain.map(Number).includes(t.id)?2:1:0,y:t=>"buttons"===e._buttonBehaviorCurrent?"middle"===e.schema.align?e.schema.height/2:"start"===e.schema.align?e._margin.top+e.schema.buttonHeight/2:e.schema.height-e.schema.buttonHeight/2-e._margin.bottom:t.y,rx:t=>"buttons"===e._buttonBehaviorCurrent?0:e.schema.domain.map(Number).includes(t.id)?1:0,ry:t=>"buttons"===e._buttonBehaviorCurrent?0:e.schema.domain.map(Number).includes(t.id)?1:0}}(e)),e._buttonBehaviorCurrent="auto",e._hiddenHandles=!1,e._paddingLeft=0,e._ticksWidth=0}
1823
+ function qt(e){e.schema.brushFilter=e=>{const t=e;return!t.button&&t.detail<2},e.schema.domain=[2001,2010],e.schema.gridSize=0,e.schema.handleConfig={fill:u.colorDefaults.light,stroke:"#228be6","stroke-width":2,rx:2,ry:2},e.schema.height=100,e.schema.labelOffset=!1,e.schema.on={},e.orient("bottom"),e._playButtonClass=new Gt,e.schema.playButtonConfig={fontColor:u.colorDefaults.dark,fontSize:15,text:()=>e._playTimer?"⏸":"⏵",textAnchor:"middle",verticalAlign:"middle"},e.schema.selectionConfig={fill:"#228be6","fill-opacity":()=>"buttons"===e._buttonBehaviorCurrent?.3:1,"stroke-width":0},e.schema.shape="Rect",e.schema.barConfig=n.assign({},e.schema.barConfig,{stroke:()=>"buttons"===e._buttonBehaviorCurrent?"transparent":It,"stroke-width":()=>"buttons"===e._buttonBehaviorCurrent?0:1}),e.schema.shapeConfig=n.assign({},e.schema.shapeConfig,
1824
+ /** Assembles the per-tick shapeConfig overrides (button vs. tick mode). */function(e){return{labelBounds:t=>"buttons"===e._buttonBehaviorCurrent?{x:t.labelBounds.x,y:-e.schema.buttonHeight/2+1,width:t.labelBounds.width,height:e.schema.buttonHeight}:t.labelBounds,labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},fontSize:()=>12,verticalAlign:()=>"buttons"===e._buttonBehaviorCurrent?"middle":"top"},fill:()=>"buttons"===e._buttonBehaviorCurrent?"#fff":It,stroke:()=>"buttons"===e._buttonBehaviorCurrent?It:"transparent",height:t=>"buttons"===e._buttonBehaviorCurrent?e.schema.buttonHeight:t.tick?e.schema.handleSize:0,width:t=>"buttons"===e._buttonBehaviorCurrent?e._ticksWidth/e._availableTicks.length:t.tick?e.schema.domain.map(Number).includes(t.id)?2:1:0,y:t=>"buttons"===e._buttonBehaviorCurrent?"middle"===e.schema.align?e.schema.height/2:"start"===e.schema.align?e._margin.top+e.schema.buttonHeight/2:e.schema.height-e.schema.buttonHeight/2-e._margin.bottom:t.y,rx:t=>"buttons"===e._buttonBehaviorCurrent?0:e.schema.domain.map(Number).includes(t.id)?1:0,ry:t=>"buttons"===e._buttonBehaviorCurrent?0:e.schema.domain.map(Number).includes(t.id)?1:0}}(e)),e._buttonBehaviorCurrent="auto",e._hiddenHandles=!1,e._paddingLeft=0,e._ticksWidth=0}
1773
1825
  /**
1774
1826
  Standalone paint for the Timeline's scene (axis ticks/domain line/labels
1775
1827
  plus the play button's pixels). Inside a Viz the parent composes this via
@@ -1778,7 +1830,7 @@ function Ht(e){e.schema.brushFilter=e=>{const t=e;return!t.button&&t.detail<2},e
1778
1830
  would show. This mounts (or reuses) an SvgRenderer on the Timeline's
1779
1831
  container and draws the passed scene beneath that interactive DOM.
1780
1832
  */
1781
- /** Timeline's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const jt=[{key:"buttonPadding",coerce:"identity",default:10},{key:"brushing",coerce:"identity",default:!0},{key:"brushFilter",coerce:"identity"},{key:"brushMin",coerce:"const",default:L(1)},{key:"buttonAlign",coerce:"identity",default:"middle"},{key:"buttonBehavior",coerce:"identity",default:"auto"},{key:"buttonHeight",coerce:"identity",default:24},{key:"handleSize",coerce:"identity",default:6},{key:"playButton",coerce:"identity",default:!0},{key:"playButtonInterval",coerce:"identity",default:1e3},{key:"selection",coerce:"identity"},{key:"snapping",coerce:"identity",default:!0}];class Gt extends xt{
1833
+ /** Timeline's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const Yt=[{key:"buttonPadding",coerce:"identity",default:10},{key:"brushing",coerce:"identity",default:!0},{key:"brushFilter",coerce:"identity"},{key:"brushMin",coerce:"const",default:L(1)},{key:"buttonAlign",coerce:"identity",default:"middle"},{key:"buttonBehavior",coerce:"identity",default:"auto"},{key:"buttonHeight",coerce:"identity",default:24},{key:"handleSize",coerce:"identity",default:6},{key:"playButton",coerce:"identity",default:!0},{key:"playButtonInterval",coerce:"identity",default:1e3},{key:"selection",coerce:"identity"},{key:"snapping",coerce:"identity",default:!0}];class Kt extends Ct{
1782
1834
  /**
1783
1835
  Triggered on brush "brush".
1784
1836
  @private
@@ -1858,7 +1910,7 @@ if(!this.schema.brushing&&"buttons"!==this._buttonBehaviorCurrent){const e=+i.at
1858
1910
  */_updateDomain(e){const s=i.pointers(e,this._select.node());let a=e.selection&&this.schema.brushing||!s.length?e.selection:[s[0][0],s[0][0]];"ticks"===this._buttonBehaviorCurrent&&(a=a.map(e=>this._d3Scale.invert(e))),a=a.map(Number);const o="ticks"===this._buttonBehaviorCurrent?this._availableTicks.map(Number):this._d3Scale.range();if("ticks"===this._buttonBehaviorCurrent){
1859
1911
  // find closest min and max ticks from data
1860
1912
  // and their indices in the ticks Array
1861
- let e=n.date(y.closest(a[0],o)),i=o.indexOf(+e),s=n.date(y.closest(a[1],o)),r=o.indexOf(+s),c=Math.abs(r-i);const h=this.schema.brushMin()-1;
1913
+ let e=n.date(p.closest(a[0],o)),i=o.indexOf(+e),s=n.date(p.closest(a[1],o)),r=o.indexOf(+s),c=Math.abs(r-i);const h=this.schema.brushMin()-1;
1862
1914
  // if the min and max are not far enough apart to satisfy
1863
1915
  // brushMin, then forcibly extend the domain.
1864
1916
  c<h&&(
@@ -1866,7 +1918,7 @@ c<h&&(
1866
1918
  r=t.min([o.length-1,r+(h-c)]),s=o[r],c=Math.abs(r-i),
1867
1919
  // if the domain is still not far enough apart, extent the minDomain
1868
1920
  // as far as possible to allow for brushMin
1869
- c<h&&(i=t.max([0,i-(h-c)]),e=o[i])),a[0]=e,a[1]=s}else a[0]=y.closest(a[0],o),a[1]=y.closest(a[1],o);
1921
+ c<h&&(i=t.max([0,i-(h-c)]),e=o[i])),a[0]=e,a[1]=s}else a[0]=p.closest(a[0],o),a[1]=p.closest(a[1],o);
1870
1922
  // if the brush event has finished, update the current "selection" value
1871
1923
  const r=+a[0]===+a[1];return"brush"!==e.type&&"end"!==e.type||(this.schema.selection="ticks"===this._buttonBehaviorCurrent?r?a[0]:a:r?n.date(this._availableTicks[o.indexOf(a[0])]):[n.date(this._availableTicks[o.indexOf(a[0])]),n.date(this._availableTicks[o.indexOf(a[1])])]),a}
1872
1924
  /**
@@ -1953,21 +2005,21 @@ const o=n.elem("rect.d3plus-Timeline-play-hit",{parent:i,condition:s.length>0});
1953
2005
  /**
1954
2006
  Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
1955
2007
  @private
1956
- */constructor(){super(),re(this,jt),Ht(this),
2008
+ */constructor(){super(),re(this,Yt),qt(this),
1957
2009
  // Timeline composes its brush/play-button after super.render(); it paints
1958
2010
  // the scene itself at the end of render() so Axis.render() must not paint
1959
2011
  // a half-built scene mid-way through.
1960
2012
  this._managesOwnScenePaint=!0}}
1961
- /** Tooltip's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const It=[{key:"arrow",coerce:"const",default:F("arrow","")},{key:"background",coerce:"const",default:L(u.colorDefaults.light)},{key:"body",coerce:"const",default:F("body","")},{key:"border",coerce:"const",default:L("1px solid rgba(0, 0, 0, 0.25)")},{key:"borderRadius",coerce:"const",default:L("4px")},{key:"className",coerce:"identity",default:"d3plus-tooltip"},{key:"footer",coerce:"const",default:F("footer","")},{key:"height",coerce:"const",default:L("auto")},{key:"id",coerce:"const",default:(e,t)=>`${t}`},{key:"offset",coerce:"const",default:L(5)},{key:"padding",coerce:"const",default:L("10px")},{key:"pointerEvents",coerce:"const",default:L("auto")},{key:"tbody",coerce:"identity",default:[]},{key:"thead",coerce:"identity",default:[]},{key:"title",coerce:"const",default:F("title","")},{key:"maxWidth",coerce:"const",default:L("300px")},{key:"minWidth",coerce:"const",default:L("200px")},{key:"width",coerce:"const",default:L("auto")}];
2013
+ /** Tooltip's fluent accessor schema. Config storage lives on `this.schema.<key>`. */const Xt=[{key:"arrow",coerce:"const",default:F("arrow","")},{key:"background",coerce:"const",default:L(u.colorDefaults.light)},{key:"body",coerce:"const",default:F("body","")},{key:"border",coerce:"const",default:L("1px solid rgba(0, 0, 0, 0.25)")},{key:"borderRadius",coerce:"const",default:L("4px")},{key:"className",coerce:"identity",default:"d3plus-tooltip"},{key:"footer",coerce:"const",default:F("footer","")},{key:"height",coerce:"const",default:L("auto")},{key:"id",coerce:"const",default:(e,t)=>`${t}`},{key:"offset",coerce:"const",default:L(5)},{key:"padding",coerce:"const",default:L("10px")},{key:"pointerEvents",coerce:"const",default:L("auto")},{key:"tbody",coerce:"identity",default:[]},{key:"thead",coerce:"identity",default:[]},{key:"title",coerce:"const",default:F("title","")},{key:"maxWidth",coerce:"const",default:L("300px")},{key:"minWidth",coerce:"const",default:L("200px")},{key:"width",coerce:"const",default:L("auto")}];
1962
2014
  /**
1963
2015
  * Creates a virtual reference element for Floating UI.
1964
2016
  * @param {Number[]} position
1965
2017
  * @private
1966
- */function qt(e=[0,0]){return{getBoundingClientRect:()=>({width:0,height:0,x:e[0],y:e[1],top:e[1],right:e[0],bottom:e[1],left:e[0]})}}
2018
+ */function Vt(e=[0,0]){return{getBoundingClientRect:()=>({width:0,height:0,x:e[0],y:e[1],top:e[1],right:e[0],bottom:e[1],left:e[0]})}}
1967
2019
  /**
1968
2020
  * Positions a tooltip using Floating UI.
1969
2021
  * @private
1970
- */async function Yt(e,t,i,s,n,a){const{x:o,y:r,placement:c,middlewareData:h}=await _.computePosition(e,t,{
2022
+ */async function Ut(e,t,i,s,n,a){const{x:o,y:r,placement:c,middlewareData:h}=await _.computePosition(e,t,{
1971
2023
  // `fixed` positions the tooltip against the viewport, so it can overflow
1972
2024
  // its chart's bounds and `flip`/`shift` keep it inside the viewport
1973
2025
  // (not the chart container). Pairs with the body-level portal in
@@ -1981,15 +2033,15 @@ strategy:"fixed",placement:"top",middleware:[_.offset(s+n),_.flip({fallbackPlace
1981
2033
  Creates DIV elements with a unique class and styles.
1982
2034
  @private
1983
2035
  */
1984
- function Kt(e,t,i,s){t.append("div").attr("class",`d3plus-tooltip-${s}`).attr("id",(t,i)=>`d3plus-tooltip-${s}-${t?e.schema.id(t,i):""}`);const a=i.select(`.d3plus-tooltip-${s}`).html((t,i)=>e.schema[s](t,i)).style("display",(t,i)=>{const n=e.schema[s](t,i);return!1!==n&&null!=n?"block":"none"});n.stylize(a,e.schema[`${s}Style`])}
2036
+ function Jt(e,t,i,s){t.append("div").attr("class",`d3plus-tooltip-${s}`).attr("id",(t,i)=>`d3plus-tooltip-${s}-${t?e.schema.id(t,i):""}`);const a=i.select(`.d3plus-tooltip-${s}`).html((t,i)=>e.schema[s](t,i)).style("display",(t,i)=>{const n=e.schema[s](t,i);return!1!==n&&null!=n?"block":"none"});n.stylize(a,e.schema[`${s}Style`])}
1985
2037
  /**
1986
2038
  Sets styles for both enter and update.
1987
2039
  @private
1988
- */function Xt(e,t){t.style("background",e.schema.background).style("border-radius",e.schema.borderRadius).style("pointer-events",e.schema.pointerEvents).style("padding",e.schema.padding).style("max-width",e.schema.maxWidth).style("min-width",e.schema.minWidth).style("width",e.schema.width).style("height",e.schema.height).style("border",e.schema.border)}
2040
+ */function Qt(e,t){t.style("background",e.schema.background).style("border-radius",e.schema.borderRadius).style("pointer-events",e.schema.pointerEvents).style("padding",e.schema.padding).style("max-width",e.schema.maxWidth).style("min-width",e.schema.minWidth).style("width",e.schema.width).style("height",e.schema.height).style("border",e.schema.border)}
1989
2041
  /**
1990
2042
  Builds the tooltip table (thead + tbody) from the configured columns/rows.
1991
2043
  @private
1992
- */class Vt extends j{
2044
+ */class Zt extends j{
1993
2045
  /**
1994
2046
  The inner return object and draw function that gets assigned the public methods.
1995
2047
  @private
@@ -2004,7 +2056,7 @@ if(!e._parentEl)return n.elem("div#d3plus-portal");
2004
2056
  // styling/clipping from the chart's container (e.g. a docs page reset).
2005
2057
  // `_parentEl` (set via parent()) still scopes ownership so multiple charts
2006
2058
  // on a page each get their own portal rather than fighting over one.
2007
- let t=e._portalEl??null;return t&&t.isConnected||(t=document.createElement("div"),t.setAttribute("class","d3plus-tooltip-portal"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="0",t.style.height="0",t.style.pointerEvents="none",document.body.appendChild(t),e._portalEl=t),i.select(t)}(this),a=s.selectAll(`.${this.schema.className}`).data(this._data,this.schema.id),o=a.enter().append("div").attr("class",this.schema.className),r=a.merge(o);return n.stylize(r,this.schema.tooltipStyle),Kt(this,o,r,"title"),Kt(this,o,r,"body"),function(e,t,i,s){const a=t.append("table").attr("class","d3plus-tooltip-table"),o=i.select(".d3plus-tooltip-table");n.stylize(o,e.schema.tableStyle),a.append("thead").attr("class","d3plus-tooltip-thead");const r=i.select(".d3plus-tooltip-thead");n.stylize(r,e.schema.theadStyle);const c=r.selectAll("tr").data([0]),h=c.enter().append("tr");c.exit().remove();const l=c.merge(h);n.stylize(l,e.schema.trStyle);const d=l.selectAll("th").data(e.schema.thead);d.enter().append("th").merge(d).html(s),d.exit().remove(),a.append("tbody").attr("class","d3plus-tooltip-tbody");const u=i.select(".d3plus-tooltip-tbody");n.stylize(u,e.schema.tbodyStyle);const m=u.selectAll("tr").data(e.schema.tbody),f=m.enter().append("tr");m.exit().remove();const g=m.merge(f);n.stylize(g,e.schema.trStyle);const p=g.selectAll("td").data(e=>e);p.enter().append("td").merge(p).html(s),n.stylize(p,e.schema.tdStyle)}
2059
+ let t=e._portalEl??null;return t&&t.isConnected||(t=document.createElement("div"),t.setAttribute("class","d3plus-tooltip-portal"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="0",t.style.height="0",t.style.pointerEvents="none",document.body.appendChild(t),e._portalEl=t),i.select(t)}(this),a=s.selectAll(`.${this.schema.className}`).data(this._data,this.schema.id),o=a.enter().append("div").attr("class",this.schema.className),r=a.merge(o);return n.stylize(r,this.schema.tooltipStyle),Jt(this,o,r,"title"),Jt(this,o,r,"body"),function(e,t,i,s){const a=t.append("table").attr("class","d3plus-tooltip-table"),o=i.select(".d3plus-tooltip-table");n.stylize(o,e.schema.tableStyle),a.append("thead").attr("class","d3plus-tooltip-thead");const r=i.select(".d3plus-tooltip-thead");n.stylize(r,e.schema.theadStyle);const c=r.selectAll("tr").data([0]),h=c.enter().append("tr");c.exit().remove();const l=c.merge(h);n.stylize(l,e.schema.trStyle);const d=l.selectAll("th").data(e.schema.thead);d.enter().append("th").merge(d).html(s),d.exit().remove(),a.append("tbody").attr("class","d3plus-tooltip-tbody");const u=i.select(".d3plus-tooltip-tbody");n.stylize(u,e.schema.tbodyStyle);const m=u.selectAll("tr").data(e.schema.tbody),f=m.enter().append("tr");m.exit().remove();const g=m.merge(f);n.stylize(g,e.schema.trStyle);const p=g.selectAll("td").data(e=>e);p.enter().append("td").merge(p).html(s),n.stylize(p,e.schema.tdStyle)}
2008
2060
  /**
2009
2061
  Binds enter/update/exit: assigns ids, positions each tooltip via Floating
2010
2062
  UI, refreshes positions on update, and cleans up refs on exit.
@@ -2014,7 +2066,7 @@ let t=e._portalEl??null;return t&&t.isConnected||(t=document.createElement("div"
2014
2066
  Fetches table contents given functions or values.
2015
2067
  @private
2016
2068
  */
2017
- function(e){if("function"==typeof e){const s=i.select(this.parentNode.parentNode).datum();return e(s,t._data.indexOf(s),s)}return e}),Kt(this,o,r,"footer"),Kt(this,o,r,"arrow"),function(e,t,i,s){t.attr("id",(t,i)=>`d3plus-tooltip-${t?e.schema.id(t,i):""}`).style("visibility","hidden").call(t=>Xt(e,t)).each(function(t,i){const s=e.schema.id(t,i),n=document.getElementById(`d3plus-tooltip-${s}`),a=document.getElementById(`d3plus-tooltip-arrow-${s}`),o=a.offsetHeight,r=a.getBoundingClientRect().height/2;a.style.bottom=`-${o/2}px`;const c=e.schema.position(t,i),h=Array.isArray(c)?qt(c):c;e._tooltipRefs[s]={reference:h,arrowEl:a,tooltip:n,arrowHeight:o,arrowDistance:r},Yt(h,n,a,e.schema.offset(t,i),r,o)}),i.each(function(t,i){const s=e.schema.id(t,i),n=e.schema.position(t,i),a=e._tooltipRefs[s];a&&(a.reference=Array.isArray(n)?qt(n):n,Yt(a.reference,a.tooltip,a.arrowEl,e.schema.offset(t,i),a.arrowDistance,a.arrowHeight))}).call(t=>Xt(e,t)),s.exit().each(function(t,i){const s=e.schema.id(t,i);delete e._tooltipRefs[s]}).remove()}(this,o,r,a),e&&setTimeout(e,100),this}arrowStyle(e){return arguments.length?(this.schema.arrowStyle=n.assign(this.schema.arrowStyle,e),this):this.schema.arrowStyle}bodyStyle(e){return arguments.length?(this.schema.bodyStyle=n.assign(this.schema.bodyStyle,e),this):this.schema.bodyStyle}parent(e){if(!arguments.length)return this._parentEl;const t=this._parentEl,i=e||void 0;return t&&t!==i&&this._portalEl&&(
2069
+ function(e){if("function"==typeof e){const s=i.select(this.parentNode.parentNode).datum();return e(s,t._data.indexOf(s),s)}return e}),Jt(this,o,r,"footer"),Jt(this,o,r,"arrow"),function(e,t,i,s){t.attr("id",(t,i)=>`d3plus-tooltip-${t?e.schema.id(t,i):""}`).style("visibility","hidden").call(t=>Qt(e,t)).each(function(t,i){const s=e.schema.id(t,i),n=document.getElementById(`d3plus-tooltip-${s}`),a=document.getElementById(`d3plus-tooltip-arrow-${s}`),o=a.offsetHeight,r=a.getBoundingClientRect().height/2;a.style.bottom=`-${o/2}px`;const c=e.schema.position(t,i),h=Array.isArray(c)?Vt(c):c;e._tooltipRefs[s]={reference:h,arrowEl:a,tooltip:n,arrowHeight:o,arrowDistance:r},Ut(h,n,a,e.schema.offset(t,i),r,o)}),i.each(function(t,i){const s=e.schema.id(t,i),n=e.schema.position(t,i),a=e._tooltipRefs[s];a&&(a.reference=Array.isArray(n)?Vt(n):n,Ut(a.reference,a.tooltip,a.arrowEl,e.schema.offset(t,i),a.arrowDistance,a.arrowHeight))}).call(t=>Qt(e,t)),s.exit().each(function(t,i){const s=e.schema.id(t,i);delete e._tooltipRefs[s]}).remove()}(this,o,r,a),e&&setTimeout(e,100),this}arrowStyle(e){return arguments.length?(this.schema.arrowStyle=n.assign(this.schema.arrowStyle,e),this):this.schema.arrowStyle}bodyStyle(e){return arguments.length?(this.schema.bodyStyle=n.assign(this.schema.bodyStyle,e),this):this.schema.bodyStyle}parent(e){if(!arguments.length)return this._parentEl;const t=this._parentEl,i=e||void 0;return t&&t!==i&&this._portalEl&&(
2018
2070
  // Switching parents: tear down this Tooltip's own (body-level) portal
2019
2071
  // so it doesn't sit orphaned. A re-render against the new parent
2020
2072
  // creates a fresh one. Other Tooltip instances own their own portals.
@@ -2022,7 +2074,7 @@ this._portalEl.remove(),this._portalEl=void 0),this._parentEl=i,this}data(e){ret
2022
2074
  /**
2023
2075
  Invoked when creating a new class instance, and sets any default parameters.
2024
2076
  @private
2025
- */constructor(){super(),re(this,It),this._data=[],this._tooltipRefs={},this.schema.arrowStyle={content:"",background:"inherit",border:"inherit","border-width":"0 1px 1px 0",height:"10px",position:"absolute",transform:"rotate(45deg)",width:"10px"},this.schema.bodyStyle={"font-size":"12px","font-weight":"400","z-index":"1"},this.schema.footerStyle={"font-size":"9px","font-weight":"400","margin-top":"5px","z-index":"1"},this.schema.position=e=>[e.x,e.y],this.schema.tableStyle={"border-collapse":"collapse","border-spacing":"0",width:"100%"},this.schema.tbodyStyle={"font-size":"12px","text-align":"center"},this.schema.theadStyle={"font-size":"12px","font-weight":"600","text-align":"center"},this.schema.titleStyle={"font-size":"14px","font-weight":"600","margin-bottom":"5px","text-align":"center"},this.schema.tooltipStyle={"box-shadow":"0 1px 5px rgba(0, 0, 0, 0.25)",color:(e,t)=>u.colorContrast(this.schema.background(e,t)),"font-family":r.fontFamilyStringify(r.fontFamily)},this.schema.trStyle={"border-top":(e,t)=>t?"1px solid rgba(0, 0, 0, 0.1)":"none"},this.schema.tdStyle={}}}
2077
+ */constructor(){super(),re(this,Xt),this._data=[],this._tooltipRefs={},this.schema.arrowStyle={content:"",background:"inherit",border:"inherit","border-width":"0 1px 1px 0",height:"10px",position:"absolute",transform:"rotate(45deg)",width:"10px"},this.schema.bodyStyle={"font-size":"12px","font-weight":"400","z-index":"1"},this.schema.footerStyle={"font-size":"9px","font-weight":"400","margin-top":"5px","z-index":"1"},this.schema.position=e=>[e.x,e.y],this.schema.tableStyle={"border-collapse":"collapse","border-spacing":"0",width:"100%"},this.schema.tbodyStyle={"font-size":"12px","text-align":"center"},this.schema.theadStyle={"font-size":"12px","font-weight":"600","text-align":"center"},this.schema.titleStyle={"font-size":"14px","font-weight":"600","margin-bottom":"5px","text-align":"center"},this.schema.tooltipStyle={"box-shadow":"0 1px 5px rgba(0, 0, 0, 0.25)",color:(e,t)=>u.colorContrast(this.schema.background(e,t)),"font-family":r.fontFamilyStringify(r.fontFamily)},this.schema.trStyle={"border-top":(e,t)=>t?"1px solid rgba(0, 0, 0, 0.1)":"none"},this.schema.tdStyle={}}}
2026
2078
  /**
2027
2079
  Default label function for the legend. Bound to a Viz instance; forwards
2028
2080
  to `viz._drawLabel` at the legend's group-depth.
@@ -2030,22 +2082,22 @@ this._portalEl.remove(),this._portalEl=void 0),this._parentEl=i,this}data(e){ret
2030
2082
  Lived in drawSteps/drawLegend.ts until the panel drawSteps were retired
2031
2083
  in favor of FeatureModules; this is the only piece of that file with
2032
2084
  surviving call sites (Viz, Tree, events/mousemove.legend).
2033
- */function Ut(e,t){return this._drawLabel(e,t,this._legendDepth)}
2085
+ */function ei(e,t){return this._drawLabel(e,t,this._legendDepth)}
2034
2086
  /**
2035
2087
  @module clickShape
2036
2088
  On click event for all shapes in a Viz.
2037
2089
  @private
2038
- */function Jt(e,t,i,s){if(s.stopPropagation(),this._drawDepth<this.schema.groupBy.length-1){this._select.style("cursor","auto");const i=this.schema.groupBy[this._drawDepth],s=i(e,t);this.hover(!1),this.schema.tooltip(e,t)&&this._tooltipClass.data([]).render();const n=this.schema.filter;this._history.push({depth:this.schema.depth,filter:n}),this.config({depth:this._drawDepth+1,filter:(e,t)=>(!n||n(e,t))&&i(e,t)===s}).render()}}
2090
+ */function ti(e,t,i,s){if(s.stopPropagation(),this._drawDepth<this.schema.groupBy.length-1){this._select.style("cursor","auto");const i=this.schema.groupBy[this._drawDepth],s=i(e,t);this.hover(!1),this.schema.tooltip(e,t)&&this._tooltipClass.data([]).render();const n=this.schema.filter;this._history.push({depth:this.schema.depth,filter:n}),this.config({depth:this._drawDepth+1,filter:(e,t)=>(!n||n(e,t))&&i(e,t)===s}).render()}}
2039
2091
  /**
2040
2092
  @module clickLegend
2041
2093
  On click event for all legend shapes in a Viz.
2042
2094
  @private
2043
- */function Qt(e,i,s,n){this._select.style("cursor","auto"),this.schema.tooltip(e,i)&&this._tooltipClass.data([]).render();let a=this._id(e,i);a instanceof Array||(a=[a]);const o=this._hidden.indexOf(a[0]),r=this._solo.indexOf(a[0]),c=t.merge(this._legendClass.data().map((e,t)=>{let i=this._id(e,t);return i instanceof Array||(i=[i]),i})).length;this.schema.legendFilterInvert.bind(this)(this)?n.shiftKey?o<0&&!this._solo.length?(this._hidden=this._hidden.concat(a),r>=0&&(this._solo=[]),this._hidden.length===c&&(this._hidden=[]),this.render()):r>=0&&(this._solo=[],this._hidden=[],this.render()):(r<0&&this._hidden.length<c-1?(this._solo=a,this._hidden=[]):(this._solo=[],this._hidden=[]),this.render()):n.shiftKey&&r<0?(this._solo=a,this._hidden=[],this.render()):n.shiftKey||(o>=0?this._hidden.splice(o,a.length):r>=0?(this._solo=[],this._hidden=[]):this._solo.length&&r<0?(this._solo=this._solo.concat(a),this._solo.length===c&&(this._solo=[])):(this._hidden=this._hidden.concat(a),this._hidden.length===c&&(this._hidden=[])),this.render())}
2095
+ */function ii(e,i,s,n){this._select.style("cursor","auto"),this.schema.tooltip(e,i)&&this._tooltipClass.data([]).render();let a=this._id(e,i);a instanceof Array||(a=[a]);const o=this._hidden.indexOf(a[0]),r=this._solo.indexOf(a[0]),c=t.merge(this._legendClass.data().map((e,t)=>{let i=this._id(e,t);return i instanceof Array||(i=[i]),i})).length;this.schema.legendFilterInvert.bind(this)(this)?n.shiftKey?o<0&&!this._solo.length?(this._hidden=this._hidden.concat(a),r>=0&&(this._solo=[]),this._hidden.length===c&&(this._hidden=[]),this.render()):r>=0&&(this._solo=[],this._hidden=[],this.render()):(r<0&&this._hidden.length<c-1?(this._solo=a,this._hidden=[]):(this._solo=[],this._hidden=[]),this.render()):n.shiftKey&&r<0?(this._solo=a,this._hidden=[],this.render()):n.shiftKey||(o>=0?this._hidden.splice(o,a.length):r>=0?(this._solo=[],this._hidden=[]):this._solo.length&&r<0?(this._solo=this._solo.concat(a),this._solo.length===c&&(this._solo=[])):(this._hidden=this._hidden.concat(a),this._hidden.length===c&&(this._hidden=[])),this.render())}
2044
2096
  /**
2045
2097
  @module mouseEnter
2046
2098
  On mouseenter event for all shapes in a Viz.
2047
2099
  @private
2048
- */function Zt(e,t){
2100
+ */function si(e,t){
2049
2101
  // ColorScale range swatch: it has no groupBy id, so highlight every datum
2050
2102
  // whose colorScale value falls in this swatch's color range — mirroring the
2051
2103
  // regular legend, which highlights the data shapes by id. `colorScaleBucketOf`
@@ -2059,7 +2111,7 @@ const i=_e(e);if(i){const e=function(e,t){const i=pe(e);return i?(e,s)=>i.colorO
2059
2111
  @module mouseLeave
2060
2112
  On mouseleave event for all shapes in a Viz.
2061
2113
  @private
2062
- */function ei(e,t){setTimeout(()=>{let i=e;for(;i&&i.__d3plus__&&i.data;)i=i.data;
2114
+ */function ni(e,t){setTimeout(()=>{let i=e;for(;i&&i.__d3plus__&&i.data;)i=i.data;
2063
2115
  // A shape and its text label are separate scene nodes over the same datum,
2064
2116
  // so crossing between them fires a leave for one then an enter for the
2065
2117
  // other. `_hoverDatum` is what the pointer rests on once that hand-off
@@ -2077,18 +2129,18 @@ let s=this._hoverDatum;for(;s&&s.__d3plus__&&s.data;)s=s.data;if(s&&this._id(s)=
2077
2129
  Tooltip logic for a specified data point.
2078
2130
  @param config Optional configuration methods for the Tooltip class.
2079
2131
  @private
2080
- */function ti(e,i,s,n){const a=n.touches?[n.touches[0].clientX,n.touches[0].clientY]:[n.clientX,n.clientY],o=t.merge(this._legendClass.data().map((e,t)=>{let i=this._id(e,t);return i instanceof Array||(i=[i]),i})).length;if(e&&this.schema.tooltip(e,i)){let t=this._id(e,i);t instanceof Array&&(t=t[0]);const n=this.schema.translate,r=Qt.bind(this).toString(),c=Object.keys(this.schema.on).some(e=>// all valid click event keys,
2132
+ */function ai(e,i,s,n){const a=n.touches?[n.touches[0].clientX,n.touches[0].clientY]:[n.clientX,n.clientY],o=t.merge(this._legendClass.data().map((e,t)=>{let i=this._id(e,t);return i instanceof Array||(i=[i]),i})).length;if(e&&this.schema.tooltip(e,i)){let t=this._id(e,i);t instanceof Array&&(t=t[0]);const n=this.schema.translate,r=ii.bind(this).toString(),c=Object.keys(this.schema.on).some(e=>// all valid click event keys,
2081
2133
  ["click","click.legend"].includes(e)&&// truthy values (no nulls),
2082
2134
  this.schema.on[e]&&// and it is not our default click.legend function
2083
2135
  this.schema.on[e].toString()!==r),h=this.schema.on["click.legend"]&&this.schema.on["click.legend"].toString()===r,l=this._drawDepth<this.schema.groupBy.length-1;
2084
2136
  // only show the hand cursor when the shape has a click event
2085
- this._select.style("cursor",c||h&&l?"pointer":"auto");const d=this.schema.legendFilterInvert.bind(this)(this),u=this._solo.includes(t),m=this._hidden.includes(t);this._tooltipClass.data([s||e]).footer(!!h&&(d?this._solo.length&&!u||m?n("Click to Highlight"):1===this._solo.length&&u||this._hidden.length===o-1?n("Click to Show All"):`${n("Click to Highlight")}<br />${n("Shift+Click to Hide")}`:this._solo.length&&!u||m?`${n("Click to Show")}<br />${n("Shift+Click to Highlight")}`:1===this._solo.length&&u||this._hidden.length===o-1?n("Click to Show All"):`${n("Click to Hide")}<br />${n("Shift+Click to Highlight")}`)).title(this.schema.legendConfig.label?this._legendClass.label():Ut.bind(this)).position(a).config(G.bind(this)(this.schema.tooltipConfig)).config(G.bind(this)(this.schema.legendTooltip)).render()}}
2137
+ this._select.style("cursor",c||h&&l?"pointer":"auto");const d=this.schema.legendFilterInvert.bind(this)(this),u=this._solo.includes(t),m=this._hidden.includes(t);this._tooltipClass.data([s||e]).footer(!!h&&(d?this._solo.length&&!u||m?n("Click to Highlight"):1===this._solo.length&&u||this._hidden.length===o-1?n("Click to Show All"):`${n("Click to Highlight")}<br />${n("Shift+Click to Hide")}`:this._solo.length&&!u||m?`${n("Click to Show")}<br />${n("Shift+Click to Highlight")}`:1===this._solo.length&&u||this._hidden.length===o-1?n("Click to Show All"):`${n("Click to Hide")}<br />${n("Shift+Click to Highlight")}`)).title(this.schema.legendConfig.label?this._legendClass.label():ei.bind(this)).position(a).config(G.bind(this)(this.schema.tooltipConfig)).config(G.bind(this)(this.schema.legendTooltip)).render()}}
2086
2138
  /**
2087
2139
  @module mouseMoveShape
2088
2140
  Tooltip logic for a specified data point.
2089
2141
  @param config Optional configuration methods for the Tooltip class.
2090
2142
  @private
2091
- */function ii(e,t,i,s){if(e&&this.schema.tooltip(e,t)){const t=Jt.bind(this).toString(),n=Object.keys(this.schema.on).some(e=>// all valid click event keys,
2143
+ */function oi(e,t,i,s){if(e&&this.schema.tooltip(e,t)){const t=ti.bind(this).toString(),n=Object.keys(this.schema.on).some(e=>// all valid click event keys,
2092
2144
  ["click","click.shape"].includes(e)&&// truthy values (no nulls),
2093
2145
  this.schema.on[e]&&// and it is not our default click.shape function
2094
2146
  this.schema.on[e].toString()!==t),a=this.schema.on["click.shape"]&&this.schema.on["click.shape"].toString()===t,o=this._drawDepth<this.schema.groupBy.length-1;
@@ -2104,17 +2156,17 @@ let c=i||e;for(;c&&c.__d3plus__&&c.data;)c=c.data;this._tooltipClass.data([c]).f
2104
2156
  * Default padding logic that will return false if the screen is less than 600 pixels wide.
2105
2157
  * @private
2106
2158
  */
2107
- function si(){return"undefined"==typeof window||window.innerWidth>600}
2159
+ function ri(){return"undefined"==typeof window||window.innerWidth>600}
2108
2160
  /**
2109
2161
  Minimal LRU cache backed by a Map (insertion-order iteration enables O(1) eviction).
2110
2162
  Only .get() and .set() are used by Viz.
2111
2163
  @private
2112
- */class ni{get(e){if(!this._map.has(e))return;const t=this._map.get(e);return this._map.delete(e),this._map.set(e,t),t}set(e,t){this._map.delete(e),this._map.size>=this._cap&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}constructor(e){this._cap=e,this._map=new Map}}
2164
+ */class ci{get(e){if(!this._map.has(e))return;const t=this._map.get(e);return this._map.delete(e),this._map.set(e,t),t}set(e,t){this._map.delete(e),this._map.size>=this._cap&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}constructor(e){this._cap=e,this._map=new Map}}
2113
2165
  // E4: Viz's identity-coerce accessor schema. installFluent installs methods on
2114
2166
  // Viz.prototype (once via WeakSet) so BaseClass.config() reflection picks them
2115
2167
  // up. Constructor assignments below seed defaults (e.g. `this.schema.duration = 600`);
2116
2168
  // installFluent skips slots already set, so constructor values win.
2117
- const ai=[{key:"ariaHidden",coerce:"identity"},{key:"cache",coerce:"identity"},{key:"colorOrdinal",coerce:"identity",default:!1},{key:"dataCutoff",coerce:"identity"},{key:"depth",coerce:"identity"},{key:"discrete",coerce:"identity"},{key:"duration",coerce:"identity"},{key:"filter",coerce:"identity"},{key:"height",coerce:"identity"},{key:"legendSort",coerce:"identity"},{key:"svgDesc",coerce:"identity"},{key:"svgTitle",coerce:"identity"},{key:"timeFilter",coerce:"identity"},{key:"timeline",coerce:"identity"},{key:"width",coerce:"identity"},{key:"zoom",coerce:"identity"},{key:"zoomFactor",coerce:"identity"},{key:"zoomMax",coerce:"identity"},{key:"zoomPan",coerce:"identity"},{key:"zoomScroll",coerce:"identity"}];
2169
+ const hi=[{key:"ariaHidden",coerce:"identity"},{key:"cache",coerce:"identity"},{key:"colorOrdinal",coerce:"identity",default:!1},{key:"dataCutoff",coerce:"identity"},{key:"depth",coerce:"identity"},{key:"discrete",coerce:"identity"},{key:"duration",coerce:"identity"},{key:"filter",coerce:"identity"},{key:"height",coerce:"identity"},{key:"legendSort",coerce:"identity"},{key:"svgDesc",coerce:"identity"},{key:"svgTitle",coerce:"identity"},{key:"timeFilter",coerce:"identity"},{key:"timeline",coerce:"identity"},{key:"width",coerce:"identity"},{key:"zoom",coerce:"identity"},{key:"zoomFactor",coerce:"identity"},{key:"zoomMax",coerce:"identity"},{key:"zoomPan",coerce:"identity"},{key:"zoomScroll",coerce:"identity"}];
2118
2170
  /**
2119
2171
  Renderer backend, accessibility, attribution, and back-button defaults.
2120
2172
  @private
@@ -2123,7 +2175,7 @@ const ai=[{key:"ariaHidden",coerce:"identity"},{key:"cache",coerce:"identity"},{
2123
2175
  Event handler bindings, render queue, resize observer, and scroll container.
2124
2176
  @private
2125
2177
  */
2126
- function oi(e){e.schema.on={"click.shape":Jt.bind(e),"click.legend":Qt.bind(e),mouseenter:Zt.bind(e),mouseleave:ei.bind(e),"mousemove.shape":ii.bind(e),"mousemove.legend":ti.bind(e)},e._queue=[];
2178
+ function li(e){e.schema.on={"click.shape":ti.bind(e),"click.legend":ii.bind(e),mouseenter:si.bind(e),mouseleave:ni.bind(e),"mousemove.shape":oi.bind(e),"mousemove.legend":ai.bind(e)},e._queue=[];
2127
2179
  // Applies a detected container resize: re-sizes the SVG and re-renders when
2128
2180
  // the observed size actually differs from what the chart last drew at.
2129
2181
  const t=t=>{const{width:i,height:s}=t[0].contentRect;(i!==e.schema.width&&e._autoWidth||s!==e.schema.height&&e._autoHeight)&&i&&s&&(e._setSVGSize(i,s),e._callback||e.render())},i=function(e,t){let i;return function(...s){const n=this;clearTimeout(i),i=setTimeout(()=>e.apply(n,s),t)}}(t,e.schema.detectResizeDelay);e._resizeObserver=new ResizeObserver(s=>{
@@ -2149,19 +2201,19 @@ const{width:n,height:a}=s[0].contentRect;if(e._resizeSettled)i(s);else{if(!n||!a
2149
2201
  readable and the constructor stays under the per-function line budget.
2150
2202
  @private
2151
2203
  */
2152
- function ri(e){e.schema.aggs={},
2204
+ function di(e){e.schema.aggs={},
2153
2205
  // E4: install identity-coerce accessors on the prototype. The imperative
2154
2206
  // `viz._x = …` assignments below seed defaults; installFluent's "skip
2155
2207
  // if slot already set" guard respects them. Methods are visible to
2156
2208
  // BaseClass.config()'s `getAllMethods` reflection.
2157
- re(e,ai),function(e){
2209
+ re(e,hi),function(e){
2158
2210
  // `renderer()` selects the @d3plus/render backend. Default
2159
2211
  // `"svg"` (SvgRenderer); `"canvas"` for large N via CanvasRenderer.
2160
- e._renderer="svg",e._renderMode="full",e.schema.ariaHidden=!0,e.schema.attribution=!1;const t="rgba(255, 255, 255, 0.75)";e.schema.attributionStyle={background:t,border:"1px solid rgba(0, 0, 0, 0.25)",color:u.colorContrast(t),display:"block",font:`400 11px/11px ${r.fontFamilyStringify(r.fontFamily)}`,margin:"5px",opacity:.75,padding:"4px 6px 3px"},e._backClass=(new Wt).on("click",()=>{e._history.length?e.config(e._history.pop()).render():e.depth(e._drawDepth-1).filter(!1),e.render()}).on("mousemove",()=>e._backClass.select().style("cursor","pointer")),e.schema.backConfig={fontSize:10,padding:5,resize:!1},e.schema.cache=!0}
2212
+ e._renderer="svg",e._renderMode="full",e.schema.ariaHidden=!0,e.schema.attribution=!1;const t="rgba(255, 255, 255, 0.75)";e.schema.attributionStyle={background:t,border:"1px solid rgba(0, 0, 0, 0.25)",color:u.colorContrast(t),display:"block",font:`400 11px/11px ${r.fontFamilyStringify(r.fontFamily)}`,margin:"5px",opacity:.75,padding:"4px 6px 3px"},e._backClass=(new Gt).on("click",()=>{e._history.length?e.config(e._history.pop()).render():e.depth(e._drawDepth-1).filter(!1),e.render()}).on("mousemove",()=>e._backClass.select().style("cursor","pointer")),e.schema.backConfig={fontSize:10,padding:5,resize:!1},e.schema.cache=!0}
2161
2213
  /**
2162
2214
  Color accessor and color-scale defaults.
2163
2215
  @private
2164
- */(e),function(e){e.schema.color=(t,i)=>e.schema.groupBy[0](t,i),e._colorDefaults={...u.colorDefaults,scale:l.scaleOrdinal().range(u.colorDefaults.scale.range())},e._colorScaleClass=new Bt,e.schema.colorScaleConfig={axisConfig:{rounding:"inside"},scale:"jenks"},e.schema.colorScalePadding=si,e.schema.colorScalePosition=()=>e.schema.width>1.5*e.schema.height?"right":"bottom",e.schema.colorScaleMaxSize=600}
2216
+ */(e),function(e){e.schema.color=(t,i)=>e.schema.groupBy[0](t,i),e._colorDefaults={...u.colorDefaults,scale:l.scaleOrdinal().range(u.colorDefaults.scale.range())},e._colorScaleClass=new Rt,e.schema.colorScaleConfig={axisConfig:{rounding:"inside"},scale:"jenks"},e.schema.colorScalePadding=ri,e.schema.colorScalePosition=()=>e.schema.width>1.5*e.schema.height?"right":"bottom",e.schema.colorScaleMaxSize=600}
2165
2217
  /**
2166
2218
  Data, resize/visibility detection, download, and grouping defaults.
2167
2219
  @private
@@ -2169,11 +2221,11 @@ e._renderer="svg",e._renderMode="full",e.schema.ariaHidden=!0,e.schema.attributi
2169
2221
  /**
2170
2222
  Legend visibility, class instance, and config defaults.
2171
2223
  @private
2172
- */(e),function(e){e.schema.legend=(i,s)=>{const n=t.max(s,(t,i)=>{const s=e.schema.groupBy[e._legendDepth].bind(e)(t,i);return s instanceof Array?s.length:1});return s.length>1&&(n??0)<=2},e._legendClass=new zt,e.schema.legendConfig={label:Ut.bind(e),shapeConfig:{ariaLabel:Ut.bind(e),labelConfig:{fontColor:void 0,fontResize:!1,padding:0}}},e.schema.legendFilterInvert=L(!1),e.schema.legendPadding=si,e.schema.legendPosition=()=>e.schema.width>1.5*e.schema.height?"right":"bottom",e.schema.legendSort=(t,i)=>e._drawLabel(t).localeCompare(e._drawLabel(i)),e.schema.legendTooltip={}}
2224
+ */(e),function(e){e.schema.legend=(i,s)=>{const n=t.max(s,(t,i)=>{const s=e.schema.groupBy[e._legendDepth].bind(e)(t,i);return s instanceof Array?s.length:1});return s.length>1&&(n??0)<=2},e._legendClass=new $t,e.schema.legendConfig={label:ei.bind(e),shapeConfig:{ariaLabel:ei.bind(e),labelConfig:{fontColor:void 0,fontResize:!1,padding:0}}},e.schema.legendFilterInvert=L(!1),e.schema.legendPadding=ri,e.schema.legendPosition=()=>e.schema.width>1.5*e.schema.height?"right":"bottom",e.schema.legendSort=(t,i)=>e._drawLabel(t).localeCompare(e._drawLabel(i)),e.schema.legendTooltip={}}
2173
2225
  /**
2174
2226
  Loading/no-data message HTML, class instances, and mask/style defaults.
2175
2227
  @private
2176
- */(e),function(e){e.schema.loadingHTML=()=>`\n <div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">\n <strong>${e.schema.translate("Loading Visualization")}</strong>\n <sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;"><a href="https://d3plus.org" target="_blank">${e.schema.translate("Powered by D3plus")}</a></sub>\n </div>`,e.schema.loadingMessage=!0,e._lrucache=new ni(10),e._messageClass=new Pt,e.schema.messageMask="rgba(0, 0, 0, 0.05)",e.schema.messageStyle={bottom:"0",left:"0",position:"absolute",right:"0","text-align":"center",top:"0"},e.schema.noDataHTML=()=>`\n <div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">\n <strong>${e.schema.translate("No Data Available")}</strong>\n </div>`,e.schema.noDataMessage=!0}(e),oi(e),function(e){e.schema.shape=L("Rect"),e._shapes=[],e.schema.shapeConfig={ariaLabel:(t,i)=>e._drawLabel(t,i),fill:(t,i)=>{for(;t.__d3plus__&&t.data;)i=(t=t.data).i;if(e.schema.colorScale){const s=e.schema.colorScale(t,i);if(null!=s){const t=e._colorScaleClass._colorScale,i=e._colorScaleClass.color();return t?t.domain().length?t(s):t.range()[t.range().length-1]:i instanceof Array?i[i.length-1]:i}}const s=e.schema.color(t,i);if(c.color(s))return s;const n="string"==typeof s?s:JSON.stringify(s);
2228
+ */(e),function(e){e.schema.loadingHTML=()=>`\n <div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">\n <strong>${e.schema.translate("Loading Visualization")}</strong>\n <sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;"><a href="https://d3plus.org" target="_blank">${e.schema.translate("Powered by D3plus")}</a></sub>\n </div>`,e.schema.loadingMessage=!0,e._lrucache=new ci(10),e._messageClass=new Lt,e.schema.messageMask="rgba(0, 0, 0, 0.05)",e.schema.messageStyle={bottom:"0",left:"0",position:"absolute",right:"0","text-align":"center",top:"0"},e.schema.noDataHTML=()=>`\n <div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">\n <strong>${e.schema.translate("No Data Available")}</strong>\n </div>`,e.schema.noDataMessage=!0}(e),li(e),function(e){e.schema.shape=L("Rect"),e._shapes=[],e.schema.shapeConfig={ariaLabel:(t,i)=>e._drawLabel(t,i),fill:(t,i)=>{for(;t.__d3plus__&&t.data;)i=(t=t.data).i;if(e.schema.colorScale){const s=e.schema.colorScale(t,i);if(null!=s){const t=e._colorScaleClass._colorScale,i=e._colorScaleClass.color();return t?t.domain().length?t(s):t.range()[t.range().length-1]:i instanceof Array?i[i.length-1]:i}}const s=e.schema.color(t,i);if(c.color(s))return s;const n="string"==typeof s?s:JSON.stringify(s);
2177
2229
  // Ordinal color mode: an ordered discrete field takes a single-hue
2178
2230
  // light→dark ramp (built in vizPreDraw) instead of nominal categorical
2179
2231
  // hues, so the color itself carries the ordering.
@@ -2184,7 +2236,7 @@ return n?n.darker(.25):s},role:"presentation",strokeWidth:L(0)},e._solo=[]}
2184
2236
  /**
2185
2237
  Subtitle, title, timeline, threshold, tooltip, and total label defaults.
2186
2238
  @private
2187
- */(e),function(e){e._subtitleClass=new Wt,e.schema.subtitleConfig={ariaHidden:!0,fontSize:12,padding:5,resize:!1,textAnchor:"middle"},e.schema.subtitlePadding=si,e.schema.svgDesc="",e.schema.svgTitle="",e.schema.timeline=!0,e._timelineClass=(new Gt).align("end"),e.schema.timelineConfig={padding:5},e.schema.timelinePadding=si,e.schema.threshold=L(1e-4),e.schema.thresholdKey=void 0,e.schema.thresholdName=()=>e.schema.translate("Values"),e._titleClass=new Wt,e.schema.titleConfig={ariaHidden:!0,fontSize:16,padding:5,resize:!1,textAnchor:"middle"},e.schema.titlePadding=si,e.schema.tooltip=L(!0),e._tooltipClass=new Vt,e.schema.tooltipConfig={pointerEvents:"none",titleStyle:{"max-width":"200px"}},e._totalClass=new Wt,e.schema.totalConfig={fontSize:10,padding:5,resize:!1,textAnchor:"middle"},e.schema.totalFormat=t=>`${e.schema.translate("Total")}: ${m.formatAbbreviate(t,e.schema.locale)}`,e.schema.totalPadding=si}
2239
+ */(e),function(e){e._subtitleClass=new Gt,e.schema.subtitleConfig={ariaHidden:!0,fontSize:12,padding:5,resize:!1,textAnchor:"middle"},e.schema.subtitlePadding=ri,e.schema.svgDesc="",e.schema.svgTitle="",e.schema.timeline=!0,e._timelineClass=(new Kt).align("end"),e.schema.timelineConfig={padding:5},e.schema.timelinePadding=ri,e.schema.threshold=L(1e-4),e.schema.thresholdKey=void 0,e.schema.thresholdName=()=>e.schema.translate("Values"),e._titleClass=new Gt,e.schema.titleConfig={ariaHidden:!0,fontSize:16,padding:5,resize:!1,textAnchor:"middle"},e.schema.titlePadding=ri,e.schema.tooltip=L(!0),e._tooltipClass=new Zt,e.schema.tooltipConfig={pointerEvents:"none",titleStyle:{"max-width":"200px"}},e._totalClass=new Gt,e.schema.totalConfig={fontSize:10,padding:5,resize:!1,textAnchor:"middle"},e.schema.totalFormat=t=>`${e.schema.translate("Total")}: ${m.formatAbbreviate(t,e.schema.locale)}`,e.schema.totalPadding=ri}
2188
2240
  /**
2189
2241
  Zoom behavior, brush, control button styling, and zoom limit defaults.
2190
2242
  @private
@@ -2200,7 +2252,7 @@ return n?n.darker(.25):s},role:"presentation",strokeWidth:L(0)},e._solo=[]}
2200
2252
  HtmlOverlay nodes for the zoom-control buttons, so the d3-selection
2201
2253
  `stylize` helper isn't reachable from the scene-graph escape hook.
2202
2254
  */
2203
- function ci(e,t){if(t)for(const i in t){const s=t[i];null!=s&&!1!==s&&(e.style[i]=String(s))}}
2255
+ function ui(e,t){if(t)for(const i in t){const s=t[i];null!=s&&!1!==s&&(e.style[i]=String(s))}}
2204
2256
  /**
2205
2257
  @name zoomFeature
2206
2258
  Sets up zoom + brush event behaviors and the zoom-control buttons.
@@ -2225,31 +2277,31 @@ function ci(e,t){if(t)for(const i in t){const s=t[i];null!=s&&!1!==s&&(e.style[i
2225
2277
  draw — the html string is constant, so listeners attached here
2226
2278
  survive every subsequent draw (renderers only rewrite innerHTML
2227
2279
  when it differs from the current value).
2228
- */const hi={name:"zoom",layout:({viz:e})=>{if(!e._container||!e._zoomGroup)return{panel:null,margin:{}};const t=le(e),i=e._zoomHeight||t.height,s=e,n=e._zoomWidth||t.width;e._zoomBehavior.extent([[0,0],[n,i]]).scaleExtent([1,e.schema.zoomMax]).translateExtent([[0,0],[n,i]]).on("zoom",t=>di.bind(e)(t.transform)),e._zoomToBounds=mi.bind(e);let a=null;e.schema.zoom&&(a={type:"htmlOverlay",key:"viz-zoom-controls",x:e._margin.left,y:e._margin.top,className:"d3plus-zoom-control",html:'<div class="zoom-control zoom-in">&#65291;</div><div class="zoom-control zoom-out">&#65293;</div><div class="zoom-control zoom-reset">&#8634;</div><div class="zoom-control zoom-brush">&#164;</div>',
2280
+ */const mi={name:"zoom",layout:({viz:e})=>{if(!e._container||!e._zoomGroup)return{panel:null,margin:{}};const t=le(e),i=e._zoomHeight||t.height,s=e,n=e._zoomWidth||t.width;e._zoomBehavior.extent([[0,0],[n,i]]).scaleExtent([1,e.schema.zoomMax]).translateExtent([[0,0],[n,i]]).on("zoom",t=>gi.bind(e)(t.transform)),e._zoomToBounds=yi.bind(e);let a=null;e.schema.zoom&&(a={type:"htmlOverlay",key:"viz-zoom-controls",x:e._margin.left,y:e._margin.top,className:"d3plus-zoom-control",html:'<div class="zoom-control zoom-in">&#65291;</div><div class="zoom-control zoom-out">&#65293;</div><div class="zoom-control zoom-reset">&#8634;</div><div class="zoom-control zoom-brush">&#164;</div>',
2229
2281
  // Declarative click wiring — clicks bubble, so the renderer's
2230
2282
  // delegated dispatcher can route them by selector. The four
2231
2283
  // handlers below are the single source of truth for what each
2232
2284
  // zoom button does. Hover styles can't be delegated (mouseenter
2233
2285
  // / mouseleave don't bubble), so they live in onMount below as
2234
2286
  // a per-button binding.
2235
- events:{".zoom-in":{click:()=>ui.bind(s)(s.schema.zoomFactor)},".zoom-out":{click:()=>ui.bind(s)(1/s.schema.zoomFactor)},".zoom-reset":{click:()=>ui.bind(s)(0)},".zoom-brush":{click:e=>{
2287
+ events:{".zoom-in":{click:()=>pi.bind(s)(s.schema.zoomFactor)},".zoom-out":{click:()=>pi.bind(s)(1/s.schema.zoomFactor)},".zoom-reset":{click:()=>pi.bind(s)(0)},".zoom-brush":{click:e=>{
2236
2288
  // The overlay dispatches clicks via delegation, so `e.currentTarget`
2237
2289
  // is the host wrapper that encloses all four buttons — not the
2238
2290
  // clicked button. Styling/toggling the wrapper would paint the
2239
2291
  // active background around the whole control stack and offset it by
2240
2292
  // the base margin/border. Resolve the actual button from the event
2241
2293
  // target, the same way the dispatcher matches (`target.closest`).
2242
- const t=e.target.closest(".zoom-brush");if(!t)return;const i=!function(e){return Boolean(e._brushing)}(s),n=t.classList.toggle("active",i);ci(t,n?s.schema.zoomControlStyleActive||{}:s.schema.zoomControlStyle||{}),li.bind(s)(i)}}},
2294
+ const t=e.target.closest(".zoom-brush");if(!t)return;const i=!function(e){return Boolean(e._brushing)}(s),n=t.classList.toggle("active",i);ui(t,n?s.schema.zoomControlStyleActive||{}:s.schema.zoomControlStyle||{}),fi.bind(s)(i)}}},
2243
2295
  // onMount fires AFTER innerHTML is written so the querySelectorAll
2244
2296
  // matches. Applies base styles + binds non-delegable hover events
2245
2297
  // per button (mouseenter/mouseleave don't bubble through
2246
2298
  // delegated event listeners).
2247
- onMount:e=>{e.querySelectorAll(".zoom-control").forEach(e=>{ci(e,s.schema.zoomControlStyle||{}),e.addEventListener("mouseenter",()=>{ci(e,s.schema.zoomControlStyleHover||{})}),e.addEventListener("mouseleave",()=>{ci(e,e.classList.contains("active")?s.schema.zoomControlStyleActive||{}:s.schema.zoomControlStyle||{})})})}}),e._zoomBrush.extent([[0,0],[n,i]]).filter(e=>!e.button&&e.detail<2).handleSize(e.schema.zoomBrushHandleSize).on("start",pi.bind(e)).on("brush",fi.bind(e)).on("end",gi.bind(e));const o=e._container.selectAll("g.brush").data([0]);return e._brushGroup=o.enter().append("g").attr("class","brush").merge(o).call(e._zoomBrush),li.bind(e)(),e._renderTiles&&e._renderTiles(d.zoomTransform((e._zoomEventTarget||e._container).node()),0),{panel:a,margin:{}}}};
2299
+ onMount:e=>{e.querySelectorAll(".zoom-control").forEach(e=>{ui(e,s.schema.zoomControlStyle||{}),e.addEventListener("mouseenter",()=>{ui(e,s.schema.zoomControlStyleHover||{})}),e.addEventListener("mouseleave",()=>{ui(e,e.classList.contains("active")?s.schema.zoomControlStyleActive||{}:s.schema.zoomControlStyle||{})})})}}),e._zoomBrush.extent([[0,0],[n,i]]).filter(e=>!e.button&&e.detail<2).handleSize(e.schema.zoomBrushHandleSize).on("start",bi.bind(e)).on("brush",_i.bind(e)).on("end",xi.bind(e));const o=e._container.selectAll("g.brush").data([0]);return e._brushGroup=o.enter().append("g").attr("class","brush").merge(o).call(e._zoomBrush),fi.bind(e)(),e._renderTiles&&e._renderTiles(d.zoomTransform((e._zoomEventTarget||e._container).node()),0),{panel:a,margin:{}}}};
2248
2300
  /**
2249
2301
  @name zoomEvents
2250
2302
  Handles adding/removing zoom event listeners.
2251
2303
  @private
2252
- */function li(e=!1){var t;t=e,this._brushing=t,e?this._brushGroup.style("display","inline"):this._brushGroup.style("display","none");
2304
+ */function fi(e=!1){var t;t=e,this._brushing=t,e?this._brushGroup.style("display","inline"):this._brushGroup.style("display","none");
2253
2305
  // The element d3-zoom binds its pointer listeners to. Defaults to the compute
2254
2306
  // `<svg>` container; on the Canvas backend it's the <canvas> (see
2255
2307
  // `bindCanvasZoom`), because the canvas is the interaction surface there —
@@ -2261,7 +2313,7 @@ const i=this._zoomEventTarget||this._container;!e&&this.schema.zoom?(i.call(this
2261
2313
  Handles events dispatched from this._zoomBehavior
2262
2314
  @param transform
2263
2315
  @private
2264
- */function di(e=!1,t=0){this._zoomGroup&&(t?this._zoomGroup.transition().duration(t).attr("transform",e):this._zoomGroup.attr("transform",e));
2316
+ */function gi(e=!1,t=0){this._zoomGroup&&(t?this._zoomGroup.transition().duration(t).attr("transform",e):this._zoomGroup.attr("transform",e));
2265
2317
  // Thread the zoom transform into the scene graph so Network/Geomap
2266
2318
  // pan/zoom shows up under the scene renderer. The
2267
2319
  // `_zoomGroup.attr("transform", …)` write above remains for tests and
@@ -2284,30 +2336,30 @@ this._drawSceneToTarget&&this._sceneRenderer&&this._drawSceneToTarget(t),this._r
2284
2336
  @name zoomMath
2285
2337
  Zooms in or out based on the provided multiplier.
2286
2338
  @param factor @private
2287
- */function ui(e=0){if(!this._container)return;const t=this._zoomBehavior.extent().bind(document)()[1].map(e=>e/2),i=this._zoomBehavior.scaleExtent(),s=d.zoomTransform((this._zoomEventTarget||this._container).node());if(e){const n=[(t[0]-s.x)/s.k,(t[1]-s.y)/s.k];s.k=Math.min(i[1],s.k*e),s.k<=i[0]?(s.k=i[0],s.x=0,s.y=0):(s.x+=t[0]-(n[0]*s.k+s.x),s.y+=t[1]-(n[1]*s.k+s.y))}else s.k=i[0],s.x=0,s.y=0;di.bind(this)(s,this.schema.duration)}
2339
+ */function pi(e=0){if(!this._container)return;const t=this._zoomBehavior.extent().bind(document)()[1].map(e=>e/2),i=this._zoomBehavior.scaleExtent(),s=d.zoomTransform((this._zoomEventTarget||this._container).node());if(e){const n=[(t[0]-s.x)/s.k,(t[1]-s.y)/s.k];s.k=Math.min(i[1],s.k*e),s.k<=i[0]?(s.k=i[0],s.x=0,s.y=0):(s.x+=t[0]-(n[0]*s.k+s.x),s.y+=t[1]-(n[1]*s.k+s.y))}else s.k=i[0],s.x=0,s.y=0;gi.bind(this)(s,this.schema.duration)}
2288
2340
  /**
2289
2341
  @name zoomToBounds
2290
2342
  Zooms to given bounds.
2291
2343
  @param bounds
2292
2344
  @private
2293
- */function mi(e,t=this.schema.duration){const i=this._zoomBehavior.scaleExtent(),s=d.zoomTransform((this._zoomEventTarget||this._container).node());if(e){const[t,n]=this._zoomBehavior.translateExtent()[1],a=e[1][0]-e[0][0],o=e[1][1]-e[0][1];let r,c,h=Math.min(i[1],1/Math.max(a/t,o/n));a/o<t/n?(h*=(n-2*this.schema.zoomPadding)/n,r=(t-a*h)/2/h,c=this.schema.zoomPadding/h):(h*=(t-2*this.schema.zoomPadding)/t,c=(n-o*h)/2/h,r=this.schema.zoomPadding/h),s.x=(s.x-e[0][0]+r)*(s.k*h/s.k),s.y=(s.y-e[0][1]+c)*(s.k*h/s.k),s.k*=h,s.x>0?s.x=0:s.x<t*-s.k+t&&(s.x=t*-s.k+t),s.y>0?s.y=0:s.y<n*-s.k+n&&(s.y=n*-s.k+n)}else s.k=i[0],s.x=0,s.y=0;di.bind(this)(s,t)}
2345
+ */function yi(e,t=this.schema.duration){const i=this._zoomBehavior.scaleExtent(),s=d.zoomTransform((this._zoomEventTarget||this._container).node());if(e){const[t,n]=this._zoomBehavior.translateExtent()[1],a=e[1][0]-e[0][0],o=e[1][1]-e[0][1];let r,c,h=Math.min(i[1],1/Math.max(a/t,o/n));a/o<t/n?(h*=(n-2*this.schema.zoomPadding)/n,r=(t-a*h)/2/h,c=this.schema.zoomPadding/h):(h*=(t-2*this.schema.zoomPadding)/t,c=(n-o*h)/2/h,r=this.schema.zoomPadding/h),s.x=(s.x-e[0][0]+r)*(s.k*h/s.k),s.y=(s.y-e[0][1]+c)*(s.k*h/s.k),s.k*=h,s.x>0?s.x=0:s.x<t*-s.k+t&&(s.x=t*-s.k+t),s.y>0?s.y=0:s.y<n*-s.k+n&&(s.y=n*-s.k+n)}else s.k=i[0],s.x=0,s.y=0;gi.bind(this)(s,t)}
2294
2346
  /**
2295
2347
  Triggered on brush "brush".
2296
2348
  @private
2297
- */function fi(){yi.bind(this)()}
2349
+ */function _i(){ki.bind(this)()}
2298
2350
  /**
2299
2351
  Triggered on brush "end".
2300
2352
  @private
2301
- */function gi(e){e.selection&&(// Only transition after input.
2302
- this._brushGroup.call(this._zoomBrush.move,null),mi.bind(this)(e.selection))}
2353
+ */function xi(e){e.selection&&(// Only transition after input.
2354
+ this._brushGroup.call(this._zoomBrush.move,null),yi.bind(this)(e.selection))}
2303
2355
  /**
2304
2356
  Triggered on brush "start".
2305
2357
  @private
2306
- */function pi(){yi.bind(this)()}
2358
+ */function bi(){ki.bind(this)()}
2307
2359
  /**
2308
2360
  Overrides the default brush styles.
2309
2361
  @private
2310
- */function yi(){this._brushGroup.selectAll(".selection").call(n.attrize,this.schema.zoomBrushSelectionStyle||{}),this._brushGroup.selectAll(".handle").call(n.attrize,this.schema.zoomBrushHandleStyle||{})}function _i(e){
2362
+ */function ki(){this._brushGroup.selectAll(".selection").call(n.attrize,this.schema.zoomBrushSelectionStyle||{}),this._brushGroup.selectAll(".handle").call(n.attrize,this.schema.zoomBrushHandleStyle||{})}function vi(e){
2311
2363
  // Goes through `viz._preDraw()` / `viz._draw()` (not the free functions
2312
2364
  // directly) so subclass overrides (Plot._preDraw, Treemap._draw, Plot._draw,
2313
2365
  // Pack/Pie/Matrix/…) still run. The free functions `vizPreDraw` / `vizDraw`
@@ -2324,12 +2376,12 @@ e._preDraw(),e._draw();
2324
2376
  // FeatureModule contract). The engine appends the returned panels to
2325
2377
  // the instance buffer that `toScene()` reads — including on later zoom
2326
2378
  // repaints, which re-walk `toScene()` outside this pipeline pass.
2327
- const t=U({viz:e},[hi,se]);t.panels.length&&(e._featurePanels=[...e._featurePanels||[],...t.panels]),e._drawSceneToTarget()}
2379
+ const t=U({viz:e},[mi,se]);t.panels.length&&(e._featurePanels=[...e._featurePanels||[],...t.panels]),e._drawSceneToTarget()}
2328
2380
  /**
2329
2381
  @module touchStartBody
2330
2382
  On touchstart event for the Body element.
2331
2383
  @private
2332
- */function xi(){this._tooltipClass.data([]).render()}
2384
+ */function Ci(){this._tooltipClass.data([]).render()}
2333
2385
  /**
2334
2386
  Appends a fullscreen SVG to the BODY if a container has not been provided
2335
2387
  through `.select()`, then points `_select` at the resolved svg node.
@@ -2340,7 +2392,7 @@ const t=U({viz:e},[hi,se]);t.panels.length&&(e._featurePanels=[...e._featurePane
2340
2392
  (re)attaches the resize observer, and fires the user callback.
2341
2393
  @private
2342
2394
  */
2343
- function bi(e,i){!
2395
+ function Si(e,i){!
2344
2396
  /**
2345
2397
  Builds a data table as DOM elements inside the SVG for accessibility, only
2346
2398
  when `schema.ariaHidden` is false and data is present.
@@ -2352,24 +2404,24 @@ function(e){const i=e._data instanceof Array&&e._data.length>0?Object.keys(e._da
2352
2404
  // Viz instance. Lifecycle (DOM setup, viewport detection, data
2353
2405
  // loading, callback timing) stays on the class because it's
2354
2406
  // inherently instance-bound.
2355
- _i(e),!e._messageClass._isVisible||e.schema.noDataMessage&&!e._filteredData.length||(e._messageClass.hide(),"0"===e._select.attr("opacity")&&e._select.transition().duration(e.schema.duration).attr("opacity",1)),e.schema.detectResize&&(e._autoWidth||e._autoHeight)?e._resizeObserver.observe(e._select.node().parentNode):e._resizeObserver.unobserve(e._select.node().parentNode),i&&setTimeout(()=>{i(),e._callback=void 0},e.schema.duration+100)}
2407
+ vi(e),!e._messageClass._isVisible||e.schema.noDataMessage&&!e._filteredData.length||(e._messageClass.hide(),"0"===e._select.attr("opacity")&&e._select.transition().duration(e.schema.duration).attr("opacity",1)),e.schema.detectResize&&(e._autoWidth||e._autoHeight)?e._resizeObserver.observe(e._select.node().parentNode):e._resizeObserver.unobserve(e._select.node().parentNode),i&&setTimeout(()=>{i(),e._callback=void 0},e.schema.duration+100)}
2356
2408
  /**
2357
2409
  Loads any queued data (showing the loading message while in flight) then
2358
2410
  draws the chart.
2359
2411
  @private
2360
- */function ki(e,t){const i=
2412
+ */function wi(e,t){const i=
2361
2413
  /**
2362
2414
  Drains the data-loading queue, returning the in-flight promises. Cache hits
2363
2415
  are applied synchronously and never produce a promise.
2364
2416
  @private
2365
2417
  */
2366
- function(e){const t=[];return e._queue.forEach(i=>{const s=e.schema.cache?e._lrucache.get(`${i[3]}_${i[1]}`):void 0;if(s){const t=i[2]?i[2](s):s;`_${i[3]}`in e?e[`_${i[3]}`]=t:e.schema[i[3]]=t}else t.push(new Promise(e=>{i[0](i[1],i[2],i[3],t=>{t&&console.error(t),e()})}))}),e._queue=[],t}(e);e.schema.loadingMessage&&i.length&&e._messageClass.render({container:e._select.node().parentNode,html:e.schema.loadingHTML(e),mask:!!e._filteredData&&e.schema.messageMask,style:e.schema.messageStyle}),Promise.all(i).then(()=>bi(e,t))}
2418
+ function(e){const t=[];return e._queue.forEach(i=>{const s=e.schema.cache?e._lrucache.get(`${i[3]}_${i[1]}`):void 0;if(s){const t=i[2]?i[2](s):s;`_${i[3]}`in e?e[`_${i[3]}`]=t:e.schema[i[3]]=t}else t.push(new Promise(e=>{i[0](i[1],i[2],i[3],t=>{t&&console.error(t),e()})}))}),e._queue=[],t}(e);e.schema.loadingMessage&&i.length&&e._messageClass.render({container:e._select.node().parentNode,html:e.schema.loadingHTML(e),mask:!!e._filteredData&&e.schema.messageMask,style:e.schema.messageStyle}),Promise.all(i).then(()=>Si(e,t))}
2367
2419
  /**
2368
2420
  Draws the visualization given the specified configuration.
2369
2421
  @param viz The Viz instance to render.
2370
2422
  @param callback Optional callback invoked after rendering completes.
2371
2423
  @private
2372
- */function vi(e,t){e._callback=t,
2424
+ */function zi(e,t){e._callback=t,
2373
2425
  // Resets margins and padding
2374
2426
  e._margin={bottom:0,left:0,right:0,top:0},e._padding={bottom:0,left:0,right:0,top:0},function(e){if(void 0===e._select||"svg"!==e._select.node().tagName.toLowerCase()){const t=void 0===e._select?i.select("body").insert("div","#d3plus-portal").style("height","100dvh").style("width","100%").style("min-height","150px"):e._select,s=t.select(".d3plus-viz").size()?t.select(".d3plus-viz"):t.append("svg");e.select(s.node())}}
2375
2427
  /**
@@ -2404,9 +2456,9 @@ const n=e._select.selectAll("desc").data([0]),a=n.enter().append("desc").attr("i
2404
2456
  chart is on-screen. Returns true when a detection branch took ownership of
2405
2457
  the render (so the caller skips the immediate draw).
2406
2458
  @private
2407
- */(e),function(e,t){return e.schema.detectVisible&&"hidden"===e._select.style("visibility")?(e._visiblePoll=setInterval(()=>{"hidden"!==e._select.style("visibility")&&(e._visiblePoll=clearInterval(e._visiblePoll),e.render(t))},e.schema.detectVisibleInterval),!0):e.schema.detectVisible&&"none"===e._select.style("display")?(e._visiblePoll=setInterval(()=>{"none"!==e._select.style("display")&&(e._visiblePoll=clearInterval(e._visiblePoll),e.render(t))},e.schema.detectVisibleInterval),!0):!(!e.schema.detectVisible||n.inViewport(e._select.node())||(i.select(e.schema.scrollContainer).on(`scroll.${e._uuid}`,()=>{e._scrollPoll||(e._scrollPoll=setTimeout(()=>{n.inViewport(e._select.node())&&(i.select(e.schema.scrollContainer).on(`scroll.${e._uuid}`,null),e.render(t)),e._scrollPoll=clearTimeout(e._scrollPoll)},e.schema.detectVisibleInterval))}),0))}(e,t)||ki(e,t),
2459
+ */(e),function(e,t){return e.schema.detectVisible&&"hidden"===e._select.style("visibility")?(e._visiblePoll=setInterval(()=>{"hidden"!==e._select.style("visibility")&&(e._visiblePoll=clearInterval(e._visiblePoll),e.render(t))},e.schema.detectVisibleInterval),!0):e.schema.detectVisible&&"none"===e._select.style("display")?(e._visiblePoll=setInterval(()=>{"none"!==e._select.style("display")&&(e._visiblePoll=clearInterval(e._visiblePoll),e.render(t))},e.schema.detectVisibleInterval),!0):!(!e.schema.detectVisible||n.inViewport(e._select.node())||(i.select(e.schema.scrollContainer).on(`scroll.${e._uuid}`,()=>{e._scrollPoll||(e._scrollPoll=setTimeout(()=>{n.inViewport(e._select.node())&&(i.select(e.schema.scrollContainer).on(`scroll.${e._uuid}`,null),e.render(t)),e._scrollPoll=clearTimeout(e._scrollPoll)},e.schema.detectVisibleInterval))}),0))}(e,t)||wi(e,t),
2408
2460
  // Attaches touchstart event listener to the BODY to hide the tooltip when the user touches any element without data
2409
- i.select("body").on(`touchstart.${e._uuid}`,xi.bind(e)),e}function Ci(e,t={}){const i={resetChartScene:!0,resetChartTransform:!0,resetShapes:!0,marginDelta:{top:0,bottom:0,left:0,right:0},featurePanels:[]};
2461
+ i.select("body").on(`touchstart.${e._uuid}`,Ci.bind(e)),e}function Di(e,t={}){const i={resetChartScene:!0,resetChartTransform:!0,resetShapes:!0,marginDelta:{top:0,bottom:0,left:0,right:0},featurePanels:[]};
2410
2462
  // Reset side effects before features run. `viz._featurePanels` is a
2411
2463
  // cross-stage accumulator: seeded here, appended to later by the
2412
2464
  // zoomControls feature, and read by Viz.toScene — so it has to live on
@@ -2436,10 +2488,10 @@ if(i.marginDelta.bottom+=c.margin.bottom,o.bottom+=c.margin.bottom,"left"===n||"
2436
2488
  // Top/bottom legend + colorScale.
2437
2489
  if("top"===n||"bottom"===n){const t=U({viz:e},[K],o);i.marginDelta.top+=t.margin.top,i.marginDelta.bottom+=t.margin.bottom,o.top+=t.margin.top,o.bottom+=t.margin.bottom}if("top"===a||"bottom"===a){const t=U({viz:e},[ie],o);i.marginDelta.top+=t.margin.top,i.marginDelta.bottom+=t.margin.bottom,o.top+=t.margin.top,o.bottom+=t.margin.bottom}
2438
2490
  // Snapshot final featurePanels onto the returned ctx.
2439
- return i.featurePanels=e._featurePanels.slice(),i}function Si(e){const t=Ci(e).marginDelta;t&&(e._margin={top:e._margin.top+t.top,right:e._margin.right+t.right,bottom:e._margin.bottom+t.bottom,left:e._margin.left+t.left})}function wi(e,t,i){for(;t.__d3plus__&&t.data;)i=(t=t.data).i;return e(t,i)}
2491
+ return i.featurePanels=e._featurePanels.slice(),i}function Mi(e){const t=Di(e).marginDelta;t&&(e._margin={top:e._margin.top+t.top,right:e._margin.right+t.right,bottom:e._margin.bottom+t.bottom,left:e._margin.left+t.left})}function Ai(e,t,i){for(;t.__d3plus__&&t.data;)i=(t=t.data).i;return e(t,i)}
2440
2492
  /**
2441
2493
  Builds the id / ids / drawLabel snapshot closures from the viz instance.
2442
- */function zi(e,i={}){
2494
+ */function $i(e,i={}){
2443
2495
  // The pure function reads the live `viz` instance directly. The
2444
2496
  // `resolveSpec(viz)` API exists for callers that want a frozen
2445
2497
  // snapshot, but this body does NOT call it — `BaseClass.config()`
@@ -2467,7 +2519,7 @@ const{id:r,ids:c,drawLabel:h}=function(e,t){
2467
2519
  // `viz._drawDepth` after preDraw are reflected in label/aria output.
2468
2520
  // Treemap's normal `.depth(n).render()` flow still works (render reruns
2469
2521
  // preDraw); the live read covers the intra-render mutation path.
2470
- const i=e.schema.groupBy,s=e.schema.label,n=e.schema.thresholdName,a=e.schema.locale,o=(e,t)=>i.map(i=>`${wi(i,e,t)}`).filter(Boolean);return{id:(e,s)=>{const n=wi(i[t],e,s);
2522
+ const i=e.schema.groupBy,s=e.schema.label,n=e.schema.thresholdName,a=e.schema.locale,o=(e,t)=>i.map(i=>`${Ai(i,e,t)}`).filter(Boolean);return{id:(e,s)=>{const n=Ai(i[t],e,s);
2471
2523
  // groupBy values are string|number for id/keying purposes (numbers are
2472
2524
  // stringified so numeric and string ids never collide).
2473
2525
  return"number"==typeof n?`${n}`:n},ids:o,drawLabel:(i,r,c)=>{
@@ -2534,7 +2586,7 @@ i.filteredData=r,i._thresholdTree=u}else i.filteredData=r;i.legendData=c}(e,a,o,
2534
2586
  // Re-exported so the shim can compute the post-threshold values without
2535
2587
  // duplicating the logic. Takes the final filteredData (after threshold)
2536
2588
  // + relevant config fields and returns the hover-override + no-data flag.
2537
- function Di(e,i,s){const n={noDataMessage:!1};return t.group(i,s).size>e.schema.dataCutoff?n.hoverOverride={hoverOpacity:1,duration:0,stashOriginals:!0}:void 0!==e._userHover&&(n.hoverOverride={hoverOpacity:e._userHover,duration:e._userDuration,restoreOriginals:!0}),n.noDataMessage=!(!e.schema.noDataMessage||i.length),n}
2589
+ function Bi(e,i,s){const n={noDataMessage:!1};return t.group(i,s).size>e.schema.dataCutoff?n.hoverOverride={hoverOpacity:1,duration:0,stashOriginals:!0}:void 0!==e._userHover&&(n.hoverOverride={hoverOpacity:e._userHover,duration:e._userDuration,restoreOriginals:!0}),n.noDataMessage=!(!e.schema.noDataMessage||i.length),n}
2538
2590
  /**
2539
2591
  Stamps `viz._ordinalColorScale` for ordinal color mode.
2540
2592
 
@@ -2546,7 +2598,7 @@ function Di(e,i,s){const n={noDataMessage:!1};return t.group(i,s).size>e.schema.
2546
2598
  (pre-sort your data, or drive it with the existing ordering config, to
2547
2599
  control non-numeric ramps) — then maps them onto an OKLab ramp of the
2548
2600
  default sequential hue. Clears the scale when the mode is off.
2549
- */function Mi(e){const t=zi(e);
2601
+ */function Pi(e){const t=$i(e);
2550
2602
  // 1. Write computed ctx back to viz.
2551
2603
  void 0!==t.drawDepth&&(e._drawDepth=t.drawDepth),t.id&&(e._id=t.id),t.ids&&(e._ids=t.ids),t.drawLabel&&(e._drawLabel=t.drawLabel),void 0!==t.legendData&&(e._legendData=t.legendData),
2552
2604
  // 1b. A persistent trail only stays coherent with fixed axes (so committed
@@ -2570,25 +2622,25 @@ let i=t.filteredData||[];e._data.length&&t._thresholdTree&&(i=e._thresholdFuncti
2570
2622
  function(e){if(!e.schema.colorOrdinal||e.schema.colorScale)return void(e._ordinalColorScale=void 0);const t=e._filteredData??[],i=e.schema.color,s=new Set,n=[];t.forEach((e,t)=>{const a=i(e,t),o="string"==typeof a?a:JSON.stringify(a);s.has(o)||(s.add(o),n.push(a))});const a=(n.every(e=>"number"==typeof e)?[...n].sort((e,t)=>e-t):n).map(e=>"string"==typeof e?e:JSON.stringify(e)),o=u.colorRamp(u.colorDefaults.sequential,a.length||1,{ordinal:!0});e._ordinalColorScale=l.scaleOrdinal().domain(a).range(o)}(e);
2571
2623
  // 4. hover/duration override + noDataMessage flag — computed against
2572
2624
  // the post-threshold filteredData.
2573
- const s=Di(e,i,e._id);s.hoverOverride?.stashOriginals?(void 0===e._userHover&&(e._userHover=e.schema.shapeConfig.hoverOpacity||.5),void 0===e._userDuration&&(e._userDuration=e.schema.shapeConfig.duration||600),e.schema.shapeConfig.hoverOpacity=s.hoverOverride.hoverOpacity,e.schema.shapeConfig.duration=s.hoverOverride.duration):s.hoverOverride?.restoreOriginals&&(e.schema.shapeConfig.hoverOpacity=s.hoverOverride.hoverOpacity,e.schema.shapeConfig.duration=s.hoverOverride.duration),
2625
+ const s=Bi(e,i,e._id);s.hoverOverride?.stashOriginals?(void 0===e._userHover&&(e._userHover=e.schema.shapeConfig.hoverOpacity||.5),void 0===e._userDuration&&(e._userDuration=e.schema.shapeConfig.duration||600),e.schema.shapeConfig.hoverOpacity=s.hoverOverride.hoverOpacity,e.schema.shapeConfig.duration=s.hoverOverride.duration):s.hoverOverride?.restoreOriginals&&(e.schema.shapeConfig.hoverOpacity=s.hoverOverride.hoverOpacity,e.schema.shapeConfig.duration=s.hoverOverride.duration),
2574
2626
  // 5. No-data-message DOM mount + opacity fade.
2575
2627
  s.noDataMessage&&(e._messageClass.render({container:e._select.node().parentNode,html:e.schema.noDataHTML(e),mask:!1,style:e.schema.messageStyle}),e._select.transition().duration(e.schema.duration).attr("opacity",0))}
2576
2628
  /**
2577
2629
  Stamps `interactionGroup` onto a component's scene subtree so the pointer
2578
2630
  bridge can route its nodes to component-scoped handlers (e.g. legend) on
2579
2631
  every backend — including Canvas, where there is no per-shape DOM to walk.
2580
- */function Ai(e,t){e.interactionGroup=t;const i=e.children;if(i)for(const e of i)Ai(e,t)}
2632
+ */function Ti(e,t){e.interactionGroup=t;const i=e.children;if(i)for(const e of i)Ti(e,t)}
2581
2633
  /**
2582
2634
  Resolves the element a renderer mounts into. A `<canvas>` cannot paint inside
2583
2635
  an `<svg>`, so when the scene target is the compute svg, the canvas mounts
2584
2636
  into that svg's parent (the user's element); the emptied, position:absolute
2585
2637
  compute svg overlays the same top-left box. SVG mounts into the target as-is.
2586
- */class $i extends ge{
2638
+ */class Oi extends ge{
2587
2639
  /**
2588
2640
  Called by draw before anything is drawn. Formats the data and performs preparations for draw.
2589
2641
  @private
2590
2642
  */
2591
- _preDraw(){Mi(this)}
2643
+ _preDraw(){Pi(this)}
2592
2644
  /**
2593
2645
  Composes a backend-agnostic scene graph from the shapes/features produced
2594
2646
  by the most recent render. Combines:
@@ -2631,19 +2683,19 @@ const e=a.attr("transform");if("string"==typeof e){const t=e.match(/translate\(\
2631
2683
  const t=[["legend",this._legendClass],["colorScale",this._colorScaleClass],["timeline",this._timelineClass]];for(const[i,s]of t)if(s&&"function"==typeof s.toScene&&s._select&&"function"==typeof s._select.node&&s._select.node()){let t=s.toScene();
2632
2684
  // Tag the legend subtree so its swatches route to legend handlers via
2633
2685
  // the node stamp (renderer-independent), not just SVG DOM ancestry.
2634
- "legend"===i?(Ai(t,"legend"),
2686
+ "legend"===i?(Ti(t,"legend"),
2635
2687
  // Hovering a legend swatch dims the others, like the chart marks:
2636
2688
  // run the legend subtree through the same interaction-opacity pass
2637
2689
  // (a no-op when no hover/active predicate is set).
2638
- t=Se([t],this)[0]):"colorScale"===i?t=Ce([t],this)[0]:"timeline"===i&&Ai(t,"timeline"),e.push({type:"group",key:`viz-${i}`,children:[t]})}
2690
+ t=Se([t],this)[0]):"colorScale"===i?t=Ce([t],this)[0]:"timeline"===i&&Ti(t,"timeline"),e.push({type:"group",key:`viz-${i}`,children:[t]})}
2639
2691
  // E2: FeatureModule.layout() panels (title/subtitle/total/back).
2640
2692
  if(this._featurePanels&&this._featurePanels.length){const t=this._featurePanels.slice();
2641
2693
  // Tag the back-button panel so the pointer bridge can route its click.
2642
- for(const e of t)e&&"string"==typeof e.key&&e.key.toLowerCase().includes("back")&&Ai(e,"back");e.push({type:"group",key:"viz-features",children:t})}return{width:this.schema.width,height:this.schema.height,root:{type:"group",key:"viz-root",children:e}}}
2694
+ for(const e of t)e&&"string"==typeof e.key&&e.key.toLowerCase().includes("back")&&Ti(e,"back");e.push({type:"group",key:"viz-features",children:t})}return{width:this.schema.width,height:this.schema.height,root:{type:"group",key:"viz-root",children:e}}}
2643
2695
  /**
2644
2696
  Called by render once all checks are passed.
2645
2697
  @private
2646
- */_draw(){Si(this)}
2698
+ */_draw(){Mi(this)}
2647
2699
  /**
2648
2700
  * Applies the threshold algorithm according to the type of chart used.
2649
2701
  * @param {Array} data The data to process.
@@ -2656,7 +2708,7 @@ for(const e of t)e&&"string"==typeof e.key&&e.key.toLowerCase().includes("back")
2656
2708
  /**
2657
2709
  Draws the visualization given the specified configuration.
2658
2710
  @param callback Optional callback invoked after rendering completes.
2659
- */render(e){return vi(this,e)}renderer(e){return arguments.length?(this._renderer="canvas"===e?"canvas":"svg",this):this._renderer}renderMode(e){return arguments.length?(this._renderMode=e,this):this._renderMode||"full"}
2711
+ */render(e){return zi(this,e)}renderer(e){return arguments.length?(this._renderer="canvas"===e?"canvas":"svg",this):this._renderer}renderMode(e){return arguments.length?(this._renderMode=e,this):this._renderMode||"full"}
2660
2712
  /**
2661
2713
  Public entry point that renders this chart through the @d3plus/render
2662
2714
  pluggable backends. The compute pass happens via render() (in an svg
@@ -2810,13 +2862,13 @@ this._sceneRenderer&&"function"==typeof this._sceneRenderer.destroy&&(this._scen
2810
2862
  /**
2811
2863
  Invoked when creating a new class instance, and sets any default parameters.
2812
2864
  @private
2813
- */constructor(){super(),ri(this)}}
2865
+ */constructor(){super(),di(this)}}
2814
2866
  /**
2815
2867
  `makeChart(def, Base?)` — produce a chart class from a def value.
2816
2868
 
2817
2869
  `Base` defaults to `Viz`; pass an existing chart class to inherit a
2818
2870
  specialization (e.g. `makeChart(donutDef, Pie)` for Donut).
2819
- */function Bi(e,t=$i){class i extends t{_draw(t){return super._draw(t),e.layoutStage&&function(e,t,i,s){
2871
+ */function Ri(e,t=Oi){class i extends t{_draw(t){return super._draw(t),e.layoutStage&&function(e,t,i,s){
2820
2872
  // Invariant: this helper OWNS `_chartScene` for the current draw — it
2821
2873
  // overwrites with `def.emit(ctx)`. The Plot family takes a different
2822
2874
  // flow: `Plot._paint` populates `_chartScene` directly from `plotPaint`
@@ -2849,14 +2901,14 @@ e._chartScene=[...a,...o],e._chartTransform=s?s(e):function(e){return{x:e._margi
2849
2901
  @module discreteBuffer
2850
2902
  Adds left/right padding to a point or time scale.
2851
2903
  @private
2852
- */const Pi=(e,t,i)=>{if(e.padding)e.padding(.5);else{const s=Array.from(new Set(t.map(e=>+e[i]))).reduce((e,t,i,s)=>{if(!i)return e;const n=s[i-1];return!e||t-n<e?t-n:e},0),n=e.domain().slice();"y"===i&&n.reverse(),n[0]=new Date(+n[0]-s/2),n[1]=new Date(+n[1]+s/2),"y"===i&&n.reverse(),e.domain(n)}},Ti=ct,Oi=e=>new Ti[e];
2904
+ */const Li=(e,t,i)=>{if(e.padding)e.padding(.5);else{const s=Array.from(new Set(t.map(e=>+e[i]))).reduce((e,t,i,s)=>{if(!i)return e;const n=s[i-1];return!e||t-n<e?t-n:e},0),n=e.domain().slice();"y"===i&&n.reverse(),n[0]=new Date(+n[0]-s/2),n[1]=new Date(+n[1]+s/2),"y"===i&&n.reverse(),e.domain(n)}},Ei=ut,Fi=e=>new Ei[e];
2853
2905
  /** The shape registry indexed by key, typed as constructable classes. */
2854
2906
  /**
2855
2907
  Resolve a per-datum accessor — either a function `(d, i) => T` or a bare
2856
2908
  value. The pattern repeats in every flat-data emit (Treemap, Pack, Pie,
2857
2909
  Priestley, …). Centralized here so each emit doesn't need its own copy.
2858
2910
  */
2859
- function Ri(e,t,i){return"function"==typeof e?e(t,i):e}
2911
+ function Wi(e,t,i){return"function"==typeof e?e(t,i):e}
2860
2912
  /**
2861
2913
  Resolve the standard paint properties (`fill`, `stroke`, `strokeWidth`,
2862
2914
  `opacity`) from a shape-config record for a single datum. Returns a
@@ -2864,7 +2916,7 @@ function Ri(e,t,i){return"function"==typeof e?e(t,i):e}
2864
2916
  forced to `string | undefined` to match `Paint.fill` (texture/object
2865
2917
  fills fall through to `undefined`; the existing flat-data emits already
2866
2918
  do this same coercion).
2867
- */function Li(e,t,i){const s=Ri(e.fill,t,i),n=Ri(e.stroke,t,i),a=Ri(e.strokeWidth,t,i),o=Ri(e.opacity,t,i),r=Ri(e.vectorEffect,t,i);return{fill:"string"==typeof s?s:void 0,stroke:n,strokeWidth:a,opacity:o,vectorEffect:"none"===r||"non-scaling-stroke"===r?r:void 0}}
2919
+ */function Ni(e,t,i){const s=Wi(e.fill,t,i),n=Wi(e.stroke,t,i),a=Wi(e.strokeWidth,t,i),o=Wi(e.opacity,t,i),r=Wi(e.vectorEffect,t,i);return{fill:"string"==typeof s?s:void 0,stroke:n,strokeWidth:a,opacity:o,vectorEffect:"none"===r||"non-scaling-stroke"===r?r:void 0}}
2868
2920
  /**
2869
2921
  Apply a shape-config object to a chart-specific shape key, returning the
2870
2922
  configPrep-massaged object suitable for `.config(...)`. Equivalent to
@@ -2876,7 +2928,7 @@ function Ri(e,t,i){return"function"==typeof e?e(t,i):e}
2876
2928
  `kind` is the second `configPrep` argument (the property to filter by).
2877
2929
  Defaults to `"shape"` — the standard call shape. Network's link config
2878
2930
  uses `"edge"` instead.
2879
- */function Ei(e,t,i,s="shape"){
2931
+ */function Hi(e,t,i,s="shape"){
2880
2932
  // configPrep binds its `this` to a VizContext-shaped object; VizLike
2881
2933
  // satisfies that contract at runtime.
2882
2934
  return G.bind(e)(i??e.schema.shapeConfig,s,t)}
@@ -2891,23 +2943,27 @@ return G.bind(e)(i??e.schema.shapeConfig,s,t)}
2891
2943
  @param opts.shape Include `shape.toScene().children` (default true).
2892
2944
  @param opts.labels Include `shape._labelClass.toScene().children`
2893
2945
  (default true).
2894
- */function Fi(e,t={}){if(!e)return[];const i=!1!==t.shape,s=!1!==t.labels;try{e.render();const t=[];if(i&&"function"==typeof e.toScene){const i=e.toScene();i&&Array.isArray(i.children)&&t.push(...i.children)}if(s){const i=e._labelClass;if(i&&"function"==typeof i.toScene){const e=i.toScene();e&&Array.isArray(e.children)&&t.push(...e.children)}}return t}catch{return[]}}
2946
+ */function ji(e,t={}){if(!e)return[];const i=!1!==t.shape,s=!1!==t.labels;try{e.render();const t=[];if(i&&"function"==typeof e.toScene){const i=e.toScene();i&&Array.isArray(i.children)&&t.push(...i.children)}if(s){const i=e._labelClass;if(i&&"function"==typeof i.toScene){const e=i.toScene();e&&Array.isArray(e.children)&&t.push(...e.children)}}return t}catch{return[]}}
2895
2947
  /**
2896
2948
  Pushes zero-value filler points for any Area series missing from a discrete
2897
2949
  group, so the d3-stack has a complete grid. Mutates `data` in place.
2898
2950
  */
2899
- /** Stacked branch: d3-stack + extent-derived domains. */function Wi(e,i){const{data:s,axisData:n,xData:a,yData:o,opp:r,stackGroup:c}=i,h=n.filter(e=>["Area","Bar"].includes(e.shape)),l=t.groups(h,e=>e.group).reduce((e,[i,s])=>(e[i]||(e[i]=0),e[i]+=t.sum(s,e=>e[r]),e),{});n.sort((t,i)=>{if(e.schema[`${e.schema.discrete}Sort`])return e.schema[`${e.schema.discrete}Sort`](t.data,i.data);const s=t[e.schema.discrete],n=i[e.schema.discrete];return s-n!==0?s-n:t.group!==i.group?l[i.group]-l[t.group]:i[r]-t[r]});const d=Array.from(new Set(n.map(e=>e.discrete))),u=Array.from(new Set(n.map(e=>e.id))),m=t.groups(n,e=>e.discrete).map(([,e])=>e);!function(e,t){const{axisData:i,data:s,stackData:n,stackKeys:a,stackGroup:o,opp:r}=t;n.forEach(t=>{const n=Array.from(new Set(t.map(e=>e.id)));n.length<a.length&&a.forEach(a=>{if(!n.includes(a)){const n=i.filter(e=>e.id===a)[0],c=n.shape;if("Area"===c){const i=o(n.data,n.i),h={__d3plus__:!0,data:n.data,discrete:"Bar"===n.shape?`${t[0][e.schema.discrete]}_${i}`:`${t[0][e.schema.discrete]}`,group:i,id:n.id,ids:a,shape:c,[e.schema.discrete]:t[0][e.schema.discrete],[r]:0};s.push(h)}}})})}(e,{axisData:n,data:s,stackData:m,stackKeys:u,stackGroup:c,opp:r}),e.schema[`${e.schema.discrete}Sort`]?s.sort((t,i)=>e.schema[`${e.schema.discrete}Sort`](t.data,i.data)):s.sort((t,i)=>t[e.schema.discrete]-i[e.schema.discrete]);const f=e._stackOrder;Array.isArray(f)?u.sort((e,t)=>f.indexOf(e)-f.indexOf(t)):f===P.stackOrderNone&&u.sort((e,t)=>`${e}`.localeCompare(`${t}`));
2951
+ /** Stacked branch: d3-stack + extent-derived domains. */function Gi(e,i){const{data:s,axisData:n,xData:a,yData:o,opp:r,stackGroup:c}=i,h=n.filter(e=>["Area","Bar"].includes(e.shape)),l=t.groups(h,e=>e.group).reduce((e,[i,s])=>(e[i]||(e[i]=0),e[i]+=t.sum(s,e=>e[r]),e),{});n.sort((t,i)=>{if(e.schema[`${e.schema.discrete}Sort`])return e.schema[`${e.schema.discrete}Sort`](t.data,i.data);const s=t[e.schema.discrete],n=i[e.schema.discrete];return s-n!==0?s-n:t.group!==i.group?l[i.group]-l[t.group]:i[r]-t[r]});const d=Array.from(new Set(n.map(e=>e.discrete))),u=Array.from(new Set(n.map(e=>e.id))),m=t.groups(n,e=>e.discrete).map(([,e])=>e);!function(e,t){const{axisData:i,data:s,stackData:n,stackKeys:a,stackGroup:o,opp:r}=t;n.forEach(t=>{const n=Array.from(new Set(t.map(e=>e.id)));n.length<a.length&&a.forEach(a=>{if(!n.includes(a)){const n=i.filter(e=>e.id===a)[0],c=n.shape;if("Area"===c){const i=o(n.data,n.i),h={__d3plus__:!0,data:n.data,discrete:"Bar"===n.shape?`${t[0][e.schema.discrete]}_${i}`:`${t[0][e.schema.discrete]}`,group:i,id:n.id,ids:a,shape:c,[e.schema.discrete]:t[0][e.schema.discrete],[r]:0};s.push(h)}}})})}(e,{axisData:n,data:s,stackData:m,stackKeys:u,stackGroup:c,opp:r}),e.schema[`${e.schema.discrete}Sort`]?s.sort((t,i)=>e.schema[`${e.schema.discrete}Sort`](t.data,i.data)):s.sort((t,i)=>t[e.schema.discrete]-i[e.schema.discrete]);const f=e._stackOrder;
2952
+ // An explicit key array orders `stackKeys` directly (then d3-stack keeps
2953
+ // that order via `stackOrderNone`); every other order is a comparator that
2954
+ // reranks the series d3-stack builds, so `stackKeys` is left in input order.
2955
+ Array.isArray(f)&&u.sort((e,t)=>f.indexOf(e)-f.indexOf(t));
2900
2956
  // d3-stack's generics don't model d3plus's dynamically-keyed rows; the
2901
2957
  // order/offset/value accessors are cast (`as never`) at the boundary, and
2902
2958
  // the configured stack is invoked as a `Row[][] -> number[][][]` function.
2903
2959
  const g=P.stack().keys(u).offset(e._stackOffset).order(Array.isArray(f)?P.stackOrderNone:f).value((e,t)=>{const i=e.filter(e=>e.id===t);return i.length?i[0][r]:0})(m),p="x"===e.schema.discrete?a:o,y="x"===e.schema.discrete?e._xTime:e._yTime;return{plotInitialDomains:{[e.schema.discrete]:y?t.extent(p):p,[r]:[t.min(g.map(e=>t.min(e.map(e=>e[0])))),t.max(g.map(e=>t.max(e.map(e=>e[1]))))]},plotDiscreteKeys:d,plotStackData:g,plotStackKeys:u}}
2904
- /** Non-stacked branch: data-values-or-extent domains per axis. */const Ni=({viz:e,plotFormattedData:i,plotAxisData:s,xData:n,x2Data:a,yData:o,y2Data:r,plotStackGroup:c})=>{const h=i||[],l=s||[],d=c,u=e.schema.discrete?"x"===e.schema.discrete?"y":"x":void 0;return e.schema.stacked?Wi(e,{data:h,axisData:l,xData:n||[],yData:o||[],opp:u,stackGroup:d}):function(e,i){const{axisData:s,xData:n,x2Data:a,yData:o,y2Data:r}=i,c=e._xTime,h=e._x2Time,l=e._yTime,d=e._y2Time,u=e.schema.discrete||"x";return e.schema[`${e.schema.discrete}Sort`]?s.sort((t,i)=>e.schema[`${e.schema.discrete}Sort`](t.data,i.data)):s.sort((e,t)=>e[u]-t[u]),{plotInitialDomains:{x:!c&&"x"===e.schema.discrete||e.schema.xSort?n:t.extent(n),x2:!h&&"x"===e.schema.discrete||e.schema.x2Sort?a:t.extent(a),y:!l&&"y"===e.schema.discrete||e.schema.ySort?o:t.extent(o),y2:!d&&"y"===e.schema.discrete||e.schema.y2Sort?r:t.extent(r)},plotDiscreteKeys:[],plotStackData:[],plotStackKeys:[]}}(e,{axisData:l,xData:n||[],x2Data:a||[],yData:o||[],y2Data:r||[]})};
2905
- /** Measures one line's label (width, position, overlap coords). */const Hi=({viz:e,plotFormattedData:i,plotScales:s,plotConfigScales:a,plotTestAxes:o,plotLineLabelTest:r,y2Exists:c})=>{const h=i||[];if(!e.schema.lineLabels||c)return{plotLabelWidths:[],plotLargestLabel:void 0,plotXRangeMax:void 0};const l=h.filter(t=>"Line"===t.shape&&("function"!=typeof e.schema.lineLabels||e.schema.lineLabels(t.data,t.i))),d=t.groups(l,e=>e.id);if(!d.length)return{plotLabelWidths:[],plotLargestLabel:void 0,plotXRangeMax:void 0};const{testLineShape:u,testTextBox:m}=r,{xTest:f,yTest:g}=o,p=s.x.domain(),y=s.y.domain(),_=a.xConfigScale,x=a.yConfigScale,b=e.schema.width-e._margin.left-e._margin.right,k=Ei(e,"Line");u.config(k);const v=u.labelConfig(),C=void 0!==v.fontColor?v.fontColor:m.fontColor(),S=void 0!==v.fontSize?v.fontSize:m.fontSize(),w=void 0!==v.fontWeight?v.fontWeight:m.fontWeight(),z=void 0!==v.fontFamily?v.fontFamily:m.fontFamily(),D=void 0!==v.padding?v.padding:m.padding(),M={labelFunction:k.label||e._drawLabel,fontColorAccessor:C,fontSizeAccessor:S,fontWeightAccessor:w,fontFamilyAccessor:z,paddingAccessor:D,xEstimate:e=>("log"===_&&0===e&&(e=p[0]<0?f._d3Scale.domain()[1]:f._d3Scale.domain()[0]),f._getPosition.bind(f)(e)),yEstimate:e=>("log"===x&&0===e&&(e=y[0]<0?g._d3Scale.domain()[1]:g._d3Scale.domain()[0]),g._getPosition.bind(g)(e))},A=d.map(e=>function([e,i],s){const{labelFunction:a,fontColorAccessor:o,fontSizeAccessor:r,fontWeightAccessor:c,fontFamilyAccessor:h,paddingAccessor:l,xEstimate:d,yEstimate:u}=s;let m,f=i[i.length-1];for(;f.__d3plus__&&f.data;)f=f.data,m=f.i;const g="function"==typeof a?a(f,m):a,p="function"==typeof o?o(f,m):o,y="function"==typeof r?r(f,m):r,_="function"==typeof c?c(f,m):c;let x="function"==typeof h?h(f,m):h;Array.isArray(x)&&(x=x.map(e=>`'${e}'`).join(", "));const b="function"==typeof l?l(f,m):l,k=n.textWidth(g,{"font-size":y,"font-family":x,"font-weight":_}),v=i.map(e=>[d(e.x),u(e.y)]),C=t.max(i.map(e=>d(e.x))),S=i.find(e=>d(e.x)===C).y;return{id:e,labelWidth:k+2*b,spaceNeeded:k+4*b,value:S,yEstimate:u(S),padding:b,fontSize:y,fontColor:p,maxX:C,xValue:t.max(i,e=>e.x),coords:v}}(e,M)).sort((e,t)=>y[1]>y[0]?e.value-t.value:t.value-e.value).filter((e,t,i)=>{const{fontSize:s,id:n,labelWidth:a,maxX:o,yEstimate:r}=e;return 0===i.filter(e=>e.id!==n&&e.coords.some(t=>(t[0]>o||t[0]===o&&e.maxX!==o)&&t[0]<=o+a&&t[1]<=r+.75*s&&t[1]>=r-.75*s)).length}),$=t.max(A,e=>e.maxX),B=t.max(A.map(e=>e.labelWidth));
2960
+ /** Non-stacked branch: data-values-or-extent domains per axis. */const Ii=({viz:e,plotFormattedData:i,plotAxisData:s,xData:n,x2Data:a,yData:o,y2Data:r,plotStackGroup:c})=>{const h=i||[],l=s||[],d=c,u=e.schema.discrete?"x"===e.schema.discrete?"y":"x":void 0;return e.schema.stacked?Gi(e,{data:h,axisData:l,xData:n||[],yData:o||[],opp:u,stackGroup:d}):function(e,i){const{axisData:s,xData:n,x2Data:a,yData:o,y2Data:r}=i,c=e._xTime,h=e._x2Time,l=e._yTime,d=e._y2Time,u=e.schema.discrete||"x";return e.schema[`${e.schema.discrete}Sort`]?s.sort((t,i)=>e.schema[`${e.schema.discrete}Sort`](t.data,i.data)):s.sort((e,t)=>e[u]-t[u]),{plotInitialDomains:{x:!c&&"x"===e.schema.discrete||e.schema.xSort?n:t.extent(n),x2:!h&&"x"===e.schema.discrete||e.schema.x2Sort?a:t.extent(a),y:!l&&"y"===e.schema.discrete||e.schema.ySort?o:t.extent(o),y2:!d&&"y"===e.schema.discrete||e.schema.y2Sort?r:t.extent(r)},plotDiscreteKeys:[],plotStackData:[],plotStackKeys:[]}}(e,{axisData:l,xData:n||[],x2Data:a||[],yData:o||[],y2Data:r||[]})};
2961
+ /** Measures one line's label (width, position, overlap coords). */const qi=({viz:e,plotFormattedData:i,plotScales:s,plotConfigScales:a,plotTestAxes:o,plotLineLabelTest:r,y2Exists:c})=>{const h=i||[];if(!e.schema.lineLabels||c)return{plotLabelWidths:[],plotLargestLabel:void 0,plotXRangeMax:void 0};const l=h.filter(t=>"Line"===t.shape&&("function"!=typeof e.schema.lineLabels||e.schema.lineLabels(t.data,t.i))),d=t.groups(l,e=>e.id);if(!d.length)return{plotLabelWidths:[],plotLargestLabel:void 0,plotXRangeMax:void 0};const{testLineShape:u,testTextBox:m}=r,{xTest:f,yTest:g}=o,p=s.x.domain(),y=s.y.domain(),_=a.xConfigScale,x=a.yConfigScale,b=e.schema.width-e._margin.left-e._margin.right,k=Hi(e,"Line");u.config(k);const v=u.labelConfig(),C=void 0!==v.fontColor?v.fontColor:m.fontColor(),S=void 0!==v.fontSize?v.fontSize:m.fontSize(),w=void 0!==v.fontWeight?v.fontWeight:m.fontWeight(),z=void 0!==v.fontFamily?v.fontFamily:m.fontFamily(),D=void 0!==v.padding?v.padding:m.padding(),M={labelFunction:k.label||e._drawLabel,fontColorAccessor:C,fontSizeAccessor:S,fontWeightAccessor:w,fontFamilyAccessor:z,paddingAccessor:D,xEstimate:e=>("log"===_&&0===e&&(e=p[0]<0?f._d3Scale.domain()[1]:f._d3Scale.domain()[0]),f._getPosition.bind(f)(e)),yEstimate:e=>("log"===x&&0===e&&(e=y[0]<0?g._d3Scale.domain()[1]:g._d3Scale.domain()[0]),g._getPosition.bind(g)(e))},A=d.map(e=>function([e,i],s){const{labelFunction:a,fontColorAccessor:o,fontSizeAccessor:r,fontWeightAccessor:c,fontFamilyAccessor:h,paddingAccessor:l,xEstimate:d,yEstimate:u}=s;let m,f=i[i.length-1];for(;f.__d3plus__&&f.data;)f=f.data,m=f.i;const g="function"==typeof a?a(f,m):a,p="function"==typeof o?o(f,m):o,y="function"==typeof r?r(f,m):r,_="function"==typeof c?c(f,m):c;let x="function"==typeof h?h(f,m):h;Array.isArray(x)&&(x=x.map(e=>`'${e}'`).join(", "));const b="function"==typeof l?l(f,m):l,k=n.textWidth(g,{"font-size":y,"font-family":x,"font-weight":_}),v=i.map(e=>[d(e.x),u(e.y)]),C=t.max(i.map(e=>d(e.x))),S=i.find(e=>d(e.x)===C).y;return{id:e,labelWidth:k+2*b,spaceNeeded:k+4*b,value:S,yEstimate:u(S),padding:b,fontSize:y,fontColor:p,maxX:C,xValue:t.max(i,e=>e.x),coords:v}}(e,M)).sort((e,t)=>y[1]>y[0]?e.value-t.value:t.value-e.value).filter((e,t,i)=>{const{fontSize:s,id:n,labelWidth:a,maxX:o,yEstimate:r}=e;return 0===i.filter(e=>e.id!==n&&e.coords.some(t=>(t[0]>o||t[0]===o&&e.maxX!==o)&&t[0]<=o+a&&t[1]<=r+.75*s&&t[1]>=r-.75*s)).length}),$=t.max(A,e=>e.maxX),B=t.max(A.map(e=>e.labelWidth));
2906
2962
  // Each accessor falls back from the Line shape's labelConfig to the test
2907
2963
  // TextBox's getter; both yield a d3plus config value (constant or accessor).
2908
- let P;const T=$===f._getRange.bind(f)()[1]?t.max(A.filter(e=>e.maxX===$),e=>e.spaceNeeded):0;if(T){P=b-t.min([T,b/4])-e._margin.right}return{plotLabelWidths:A,plotLargestLabel:B,plotXRangeMax:P}},ji=B,Gi=({viz:e})=>{if(!e._filteredData||!e._filteredData.length)return{plotFormattedData:[],plotAxisData:[],x2Exists:!1,y2Exists:!1};const i=!!e.schema.time&&e.schema.time(e._filteredData[0],0),s=e._x2Time=i&&e._x2(e._filteredData[0],0)===i,a=e._xTime=i&&e._x(e._filteredData[0],0)===i,o=e._y2Time=i&&e._y2(e._filteredData[0],0)===i,r=e._yTime=i&&e._y(e._filteredData[0],0)===i,c=a||s||r||o,h=(t,i)=>`${!c&&e.schema.time?e.schema.time(t,i):"time"}_${e.schema.stacked?`${e.schema.groupBy.length>1?e._ids(t,i).slice(0,-1).join("_"):"group"}`:`${e._ids(t,i).join("_")}`}`,l=(t,i)=>{const c={__d3plus__:!0,data:t,group:h(t,i),i:i,hci:e._confidence&&e._confidence[1]&&e._confidence[1](t,i),id:e._ids(t,i).slice(0,e._drawDepth+1).join("_"),lci:e._confidence&&e._confidence[0]&&e._confidence[0](t,i),shape:e.schema.shape(t,i),x:a?n.date(e._x(t,i)):e._x(t,i),x2:s?n.date(e._x2(t,i)):e._x2(t,i),y:r?n.date(e._y(t,i)):e._y(t,i),y2:o?n.date(e._y2(t,i)):e._y2(t,i)};return c.discrete="Bar"===c.shape?`${c[e.schema.discrete]}_${c.group}`:`${c[e.schema.discrete]}`,c.id="Bar"===c.shape?`${c.id}_${c[e.schema.discrete]}`:c.id,c},d=e._formattedData=e._filteredData.map(l),u=e._axisPersist?e._data.map(l):d;if(e._size){const i=t.extent(u,t=>e._size(t.data));e._sizeScaleD3=ji[`scale${e.schema.sizeScale.charAt(0).toUpperCase()}${e.schema.sizeScale.slice(1)}`]().domain(i).range([i[0]===i[1]?e.schema.sizeMax:t.min([e.schema.sizeMax/2,e.schema.sizeMin]),e.schema.sizeMax])}else e._sizeScaleD3=()=>e.schema.sizeMin;const m=u.some(e=>void 0!==e.x2),f=u.some(e=>void 0!==e.y2);return{plotFormattedData:d,plotAxisData:u,x2Exists:m,y2Exists:f,plotStackGroup:h}},Ii=({viz:e,plotFormattedData:i,plotAxisData:a})=>{const o=i||[],r=a||[];function c(i){const a=e[`_${i}Time`],c=a?o:r,h=c.filter(e=>![NaN,void 0,!1].includes(e[i]));if(!h.length)return[];const l="number"==typeof h[0][i];let d=e.schema.discrete===i?t.rollups(h,t=>1===t.length?t[0].data:s.merge(t.map(e=>e.data),e.schema.aggs),e=>e[i]).sort((t,s)=>{if(e.schema[`${i}Sort`])return e.schema[`${i}Sort`](t[1],s[1]);return(a||l?parseFloat(t[0]):t[0])-(a||l?parseFloat(s[0]):s[0])}).map(([e])=>a?n.date(e):l?parseFloat(e):e):s.unique(h.sort((t,s)=>e.schema[`${i}Sort`]?e.schema[`${i}Sort`](t.data,s.data):t[i]-s[i]).map(e=>e[i]),e=>`${e}`);return e.schema.discrete!==i.charAt(0)&&e._confidence&&(e._confidence[0]&&(d=d.concat(c.map(e=>e.lci))),e._confidence[1]&&(d=d.concat(c.map(e=>e.hci)))),d}return{xData:c("x"),x2Data:c("x2"),yData:c("y"),y2Data:c("y2")}},qi=({viz:e,plotFormattedData:i,plotAxisData:s,plotScales:n,plotConfigScales:a})=>{const o=i||[],r=s||[];let{x:c,y:h,x2:l,y2:d}=n;const{xConfigScale:u,yConfigScale:m,x2ConfigScale:f,y2ConfigScale:g}=a,p=n.xScale,y=n.yScale;if("Point"!==("x"===e.schema.discrete?y:p)){t.groups(r,e=>e.shape).forEach(([t,i])=>{if(["Bar","Box"].includes(t)&&Pi("x"===e.schema.discrete?c:h,o,e.schema.discrete),e._buffer[t]){const s=e._buffer[t].bind(e)({data:i,x:c,y:h,yScale:m,xScale:u,config:e.schema.shapeConfig[t]});c=s[0],h=s[1];const n=e._buffer[t].bind(e)({data:i,x:l,y:d,yScale:g,xScale:f,x2:!0,y2:!0,config:e.schema.shapeConfig[t]});l=n[0],d=n[1]}})}return{plotScales:{...n,x:c,y:h,x2:l,y2:d}}},Yi=({viz:e,plotAxisData:t,plotScales:i,x2Exists:n,y2Exists:a,x2Data:o,y2Data:r,yData:c})=>{const h=t||[],{x:l,y:d,x2:u,y2:m,xScale:f,yScale:g,x2Scale:p,y2Scale:y}=i,_=l.domain(),x=u.domain(),b=d.domain(),k=m.domain(),v={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},C=n?{data:o}:v,S=a?{data:r}:v,w="x"===e.schema.discrete?e.schema.width>e._discreteCutoff&&e.schema.width>e.schema.xCutoff:e.schema.width>e.schema.xCutoff,z="y"===e.schema.discrete?e.schema.height>e._discreteCutoff&&e.schema.height>e.schema.yCutoff:e.schema.height>e.schema.yCutoff,D={data:c,locale:e.schema.locale,rounding:e.schema.yDomain?"none":"outside",scalePadding:d.padding?d.padding():0};!w&&z&&(D.barConfig={stroke:"transparent"},D.tickSize=0,D.shapeConfig={labelBounds:(t,i)=>{const{width:s,y:n}=t.labelBounds,a=e.schema.height/2;return{x:i?-a:0,y:n,width:s,height:a}},labelConfig:{padding:0,rotate:0},labelRotation:!1});
2964
+ let P;const T=$===f._getRange.bind(f)()[1]?t.max(A.filter(e=>e.maxX===$),e=>e.spaceNeeded):0;if(T){P=b-t.min([T,b/4])-e._margin.right}return{plotLabelWidths:A,plotLargestLabel:B,plotXRangeMax:P}},Yi=B,Ki=({viz:e})=>{if(!e._filteredData||!e._filteredData.length)return{plotFormattedData:[],plotAxisData:[],x2Exists:!1,y2Exists:!1};const i=!!e.schema.time&&e.schema.time(e._filteredData[0],0),s=e._x2Time=i&&e._x2(e._filteredData[0],0)===i,a=e._xTime=i&&e._x(e._filteredData[0],0)===i,o=e._y2Time=i&&e._y2(e._filteredData[0],0)===i,r=e._yTime=i&&e._y(e._filteredData[0],0)===i,c=a||s||r||o,h=(t,i)=>`${!c&&e.schema.time?e.schema.time(t,i):"time"}_${e.schema.stacked?`${e.schema.groupBy.length>1?e._ids(t,i).slice(0,-1).join("_"):"group"}`:`${e._ids(t,i).join("_")}`}`,l=(t,i)=>{const c={__d3plus__:!0,data:t,group:h(t,i),i:i,hci:e._confidence&&e._confidence[1]&&e._confidence[1](t,i),id:e._ids(t,i).slice(0,e._drawDepth+1).join("_"),lci:e._confidence&&e._confidence[0]&&e._confidence[0](t,i),shape:e.schema.shape(t,i),x:a?n.date(e._x(t,i)):e._x(t,i),x2:s?n.date(e._x2(t,i)):e._x2(t,i),y:r?n.date(e._y(t,i)):e._y(t,i),y2:o?n.date(e._y2(t,i)):e._y2(t,i)};return c.discrete="Bar"===c.shape?`${c[e.schema.discrete]}_${c.group}`:`${c[e.schema.discrete]}`,c.id="Bar"===c.shape?`${c.id}_${c[e.schema.discrete]}`:c.id,c},d=e._formattedData=e._filteredData.map(l),u=e._axisPersist?e._data.map(l):d;if(e._size){const i=t.extent(u,t=>e._size(t.data));e._sizeScaleD3=Yi[`scale${e.schema.sizeScale.charAt(0).toUpperCase()}${e.schema.sizeScale.slice(1)}`]().domain(i).range([i[0]===i[1]?e.schema.sizeMax:t.min([e.schema.sizeMax/2,e.schema.sizeMin]),e.schema.sizeMax])}else e._sizeScaleD3=()=>e.schema.sizeMin;const m=u.some(e=>void 0!==e.x2),f=u.some(e=>void 0!==e.y2);return{plotFormattedData:d,plotAxisData:u,x2Exists:m,y2Exists:f,plotStackGroup:h}},Xi=({viz:e,plotFormattedData:i,plotAxisData:a})=>{const o=i||[],r=a||[];function c(i){const a=e[`_${i}Time`],c=a?o:r,h=c.filter(e=>![NaN,void 0,!1].includes(e[i]));if(!h.length)return[];const l="number"==typeof h[0][i];let d=e.schema.discrete===i?t.rollups(h,t=>1===t.length?t[0].data:s.merge(t.map(e=>e.data),e.schema.aggs),e=>e[i]).sort((t,s)=>{if(e.schema[`${i}Sort`])return e.schema[`${i}Sort`](t[1],s[1]);return(a||l?parseFloat(t[0]):t[0])-(a||l?parseFloat(s[0]):s[0])}).map(([e])=>a?n.date(e):l?parseFloat(e):e):s.unique(h.sort((t,s)=>e.schema[`${i}Sort`]?e.schema[`${i}Sort`](t.data,s.data):t[i]-s[i]).map(e=>e[i]),e=>`${e}`);return e.schema.discrete!==i.charAt(0)&&e._confidence&&(e._confidence[0]&&(d=d.concat(c.map(e=>e.lci))),e._confidence[1]&&(d=d.concat(c.map(e=>e.hci)))),d}return{xData:c("x"),x2Data:c("x2"),yData:c("y"),y2Data:c("y2")}},Vi=({viz:e,plotFormattedData:i,plotAxisData:s,plotScales:n,plotConfigScales:a})=>{const o=i||[],r=s||[];let{x:c,y:h,x2:l,y2:d}=n;const{xConfigScale:u,yConfigScale:m,x2ConfigScale:f,y2ConfigScale:g}=a,p=n.xScale,y=n.yScale;if("Point"!==("x"===e.schema.discrete?y:p)){t.groups(r,e=>e.shape).forEach(([t,i])=>{if(["Bar","Box"].includes(t)&&Li("x"===e.schema.discrete?c:h,o,e.schema.discrete),e._buffer[t]){const s=e._buffer[t].bind(e)({data:i,x:c,y:h,yScale:m,xScale:u,config:e.schema.shapeConfig[t]});c=s[0],h=s[1];const n=e._buffer[t].bind(e)({data:i,x:l,y:d,yScale:g,xScale:f,x2:!0,y2:!0,config:e.schema.shapeConfig[t]});l=n[0],d=n[1]}})}return{plotScales:{...n,x:c,y:h,x2:l,y2:d}}},Ui=({viz:e,plotAxisData:t,plotScales:i,x2Exists:n,y2Exists:a,x2Data:o,y2Data:r,yData:c})=>{const h=t||[],{x:l,y:d,x2:u,y2:m,xScale:f,yScale:g,x2Scale:p,y2Scale:y}=i,_=l.domain(),x=u.domain(),b=d.domain(),k=m.domain(),v={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},C=n?{data:o}:v,S=a?{data:r}:v,w="x"===e.schema.discrete?e.schema.width>e._discreteCutoff&&e.schema.width>e.schema.xCutoff:e.schema.width>e.schema.xCutoff,z="y"===e.schema.discrete?e.schema.height>e._discreteCutoff&&e.schema.height>e.schema.yCutoff:e.schema.height>e.schema.yCutoff,D={data:c,locale:e.schema.locale,rounding:e.schema.yDomain?"none":"outside",scalePadding:d.padding?d.padding():0};!w&&z&&(D.barConfig={stroke:"transparent"},D.tickSize=0,D.shapeConfig={labelBounds:(t,i)=>{const{width:s,y:n}=t.labelBounds,a=e.schema.height/2;return{x:i?-a:0,y:n,width:s,height:a}},labelConfig:{padding:0,rotate:0},labelRotation:!1});
2909
2965
  // Bar labels — used to suppress redundant axis ticks.
2910
- const M=Ei(e,"Bar"),A=void 0!==M.label?"function"==typeof M.label?M.label:()=>M.label:e._drawLabel,$=h.map(e=>A(e.data,e.i)).filter(e=>"number"==typeof e||e).map(String),B=(e,t)=>{const i=s.unique(h.map(t=>t[e]));return"Point"===t&&i.every(e=>$.includes(`${e}`))?[]:null};return{plotDefaultConfig:v,plotDefaultX2Config:C,plotDefaultY2Config:S,plotShowX:w,plotShowY:z,plotYC:D,plotBarLabels:$,plotXTicks:B("x",f),plotX2Ticks:B("x2",p),plotYTicks:B("y",g),plotY2Ticks:B("y2",y),plotXDomain:_,plotX2Domain:x,plotYDomain:b,plotY2Domain:k}},Ki=({viz:e,plotFormattedData:i,plotAxisData:s,plotInitialDomains:n})=>{const a=i||[],o=s||[];let r=n;const c=e.schema.width-e._margin.left-e._margin.right,h=e.schema.height-e._margin.top-e._margin.bottom,l=e.schema.discrete?"x"===e.schema.discrete?"y":"x":void 0,d=e.schema.discrete?"x"===e.schema.discrete?"y2":"x2":void 0,u=[l,d].filter(e=>e);function m(t){const i=e[`_${t}Time`]?"Time":e.schema.discrete===t||e.schema[`${t}Sort`]?"Point":"Linear",s=e.schema[`${t}Domain`]?e.schema[`${t}Domain`].slice():r[t],n=e.schema[`${t}2Domain`]?e.schema[`${t}2Domain`].slice():r[`${t}2`];return"Point"!==i&&(s&&void 0===s[0]&&(s[0]=r[t][0]),s&&void 0===s[1]&&(s[1]=r[t][1]),n&&void 0===n[0]&&(n[0]=r[`${t}2`][0]),n&&void 0===n[1]&&(n[1]=r[`${t}2`][1])),[s,i,n,i]}const[f,g,p,y]=m("x"),[_,x,b,k]=m("y"),v=(i,s)=>{const n=e[`_${i}Config`].scale;if("auto"===n){if(e.schema.discrete===i)return s;const n=o.map(e=>e[i]);return t.deviation(n)/t.mean(n)>3?"log":"linear"}return n||s},C=v("y",x).toLowerCase(),S=v("y2",k).toLowerCase(),w=v("x",g).toLowerCase(),z=v("x2",y).toLowerCase();
2966
+ const M=Hi(e,"Bar"),A=void 0!==M.label?"function"==typeof M.label?M.label:()=>M.label:e._drawLabel,$=h.map(e=>A(e.data,e.i)).filter(e=>"number"==typeof e||e).map(String),B=(e,t)=>{const i=s.unique(h.map(t=>t[e]));return"Point"===t&&i.every(e=>$.includes(`${e}`))?[]:null};return{plotDefaultConfig:v,plotDefaultX2Config:C,plotDefaultY2Config:S,plotShowX:w,plotShowY:z,plotYC:D,plotBarLabels:$,plotXTicks:B("x",f),plotX2Ticks:B("x2",p),plotYTicks:B("y",g),plotY2Ticks:B("y2",y),plotXDomain:_,plotX2Domain:x,plotYDomain:b,plotY2Domain:k}},Ji=({viz:e,plotFormattedData:i,plotAxisData:s,plotInitialDomains:n})=>{const a=i||[],o=s||[];let r=n;const c=e.schema.width-e._margin.left-e._margin.right,h=e.schema.height-e._margin.top-e._margin.bottom,l=e.schema.discrete?"x"===e.schema.discrete?"y":"x":void 0,d=e.schema.discrete?"x"===e.schema.discrete?"y2":"x2":void 0,u=[l,d].filter(e=>e);function m(t){const i=e[`_${t}Time`]?"Time":e.schema.discrete===t||e.schema[`${t}Sort`]?"Point":"Linear",s=e.schema[`${t}Domain`]?e.schema[`${t}Domain`].slice():r[t],n=e.schema[`${t}2Domain`]?e.schema[`${t}2Domain`].slice():r[`${t}2`];return"Point"!==i&&(s&&void 0===s[0]&&(s[0]=r[t][0]),s&&void 0===s[1]&&(s[1]=r[t][1]),n&&void 0===n[0]&&(n[0]=r[`${t}2`][0]),n&&void 0===n[1]&&(n[1]=r[`${t}2`][1])),[s,i,n,i]}const[f,g,p,y]=m("x"),[_,x,b,k]=m("y"),v=(i,s)=>{const n=e[`_${i}Config`].scale;if("auto"===n){if(e.schema.discrete===i)return s;const n=o.map(e=>e[i]);return t.deviation(n)/t.mean(n)>3?"log":"linear"}return n||s},C=v("y",x).toLowerCase(),S=v("y2",k).toLowerCase(),w=v("x",g).toLowerCase(),z=v("x2",y).toLowerCase();
2911
2967
  // `.slice()` the fallback so domains.x2 isn't ALIASED to domains.x
2912
2968
  // (and same for y2 ↔ y). Without the slice, later in this function
2913
2969
  // the baseline-extension loop does `domains[o][0] = b` — when `o`
@@ -2917,7 +2973,7 @@ r={x:f,x2:p||f.slice(),y:_,y2:b||_.slice()},Object.keys(r).forEach(i=>{"log"===e
2917
2973
  // `.slice()` first so we never mutate the user's config array in
2918
2974
  // place — on the next render the (already-reversed) array would
2919
2975
  // reverse back, alternating chart correctness across renders.
2920
- const i=e[`_${t}Config`].domain.slice();"x"===e.schema.discrete&&i.reverse(),r[t]=i}else if(t&&void 0!==e.schema.baseline){const i=e.schema.baseline;r[t]&&r[t][0]>i?r[t][0]=i:r[t]&&r[t][1]<i&&(r[t][1]=i)}});const D=ji[`scale${g}`]().domain(r.x).range(t.range(0,c+1,c/(r.x.length-1))),M=ji[`scale${y}`]().domain(r.x2).range(t.range(0,c+1,c/(r.x2.length-1))),A=ji[`scale${x}`]().domain(r.y.slice().reverse()).range(t.range(0,h+1,h/(r.y.length-1))),$=ji[`scale${k}`]().domain(r.y2.slice().reverse()).range(t.range(0,h+1,h/(r.y2.length-1)));return{plotDomains:r,plotScales:{x:D,y:A,x2:M,y2:$,xScale:g,yScale:x,x2Scale:y,y2Scale:k},plotConfigScales:{xConfigScale:w,yConfigScale:C,x2ConfigScale:z,y2ConfigScale:S},plotOpps:{opp:l,opp2:d,opps:u}}},Xi={defaults:{annotations:[],axisPersist:!1,barPadding:0,discreteCutoff:100,groupPadding:5,lineMarkers:!1,shape:L("Circle")}};
2976
+ const i=e[`_${t}Config`].domain.slice();"x"===e.schema.discrete&&i.reverse(),r[t]=i}else if(t&&void 0!==e.schema.baseline){const i=e.schema.baseline;r[t]&&r[t][0]>i?r[t][0]=i:r[t]&&r[t][1]<i&&(r[t][1]=i)}});const D=Yi[`scale${g}`]().domain(r.x).range(t.range(0,c+1,c/(r.x.length-1))),M=Yi[`scale${y}`]().domain(r.x2).range(t.range(0,c+1,c/(r.x2.length-1))),A=Yi[`scale${x}`]().domain(r.y.slice().reverse()).range(t.range(0,h+1,h/(r.y.length-1))),$=Yi[`scale${k}`]().domain(r.y2.slice().reverse()).range(t.range(0,h+1,h/(r.y2.length-1)));return{plotDomains:r,plotScales:{x:D,y:A,x2:M,y2:$,xScale:g,yScale:x,x2Scale:y,y2Scale:k},plotConfigScales:{xConfigScale:w,yConfigScale:C,x2ConfigScale:z,y2ConfigScale:S},plotOpps:{opp:l,opp2:d,opps:u}}},Qi={defaults:{annotations:[],axisPersist:!1,barPadding:0,discreteCutoff:100,groupPadding:5,lineMarkers:!1,shape:L("Circle")}};
2921
2977
  /** d3-scale's scale constructors, indexed by the dynamic `scale<Type>` name. */
2922
2978
  /**
2923
2979
  MEASURE half of the joint axis solve. Configures + measures the four
@@ -2928,7 +2984,7 @@ const i=e[`_${t}Config`].domain.slice();"x"===e.schema.discrete&&i.reverse(),r[t
2928
2984
  `measureLineLabels` is invoked once, after the first x-axis measure and
2929
2985
  before the re-measure, so its `xRangeMax` can re-bound the x range.
2930
2986
  */
2931
- function Vi(e,i,s){const{yBounds:n,yWidth:a,y2Bounds:o,y2Width:r}=
2987
+ function Zi(e,i,s){const{yBounds:n,yWidth:a,y2Bounds:o,y2Width:r}=
2932
2988
  /** Measure the y/y2 test axes and report their bounds + claimed widths. */function(e,t){const{yTest:i,y2Test:s,yDomain:n,y2Domain:a,yTicks:o,y2Ticks:r,yConfigScale:c,y2ConfigScale:h,defaultY2Config:l,yC:d,showY:u,y2Exists:m,height:f,width:g}=t;u&&i.domain(n).height(f).maxSize(g/2).range([void 0,void 0]).ticks(o).width(g).config(d).config(e._yConfig).scale(c).measure();const p=i.outerBounds(),y=p.width?p.width+i.padding():void 0;m&&s.domain(a).height(f).range([void 0,void 0]).ticks(r).width(g).config(d).config(l).config(e._y2Config).scale(h).measure();const _=s.outerBounds();return{yBounds:p,yWidth:y,y2Bounds:_,y2Width:_.width?_.width+s.padding():void 0}}
2933
2989
  /** Build the shared x-axis config object, including the no-y-axis variant. */(e,i),c=function(e,t){const{xTicks:i,showX:s,showY:n,xData:a,xScalePadding:o}=t,r={data:a,locale:e.schema.locale,rounding:e.schema.xDomain?"none":"outside",scalePadding:o};return!n&&s&&(r.barConfig={stroke:"transparent"},r.tickSize=0,r.shapeConfig={labelBounds:(t,i)=>{const{height:s,y:n}=t.labelBounds,a=e.schema.width/2;return{x:i?-a:0,y:n,width:a,height:s}},labelConfig:{padding:0,rotate:0,textAnchor:e=>i&&e.id===i[0]?"start":"end"},labelRotation:!1}),r}
2934
2990
  /**
@@ -2948,7 +3004,7 @@ function Vi(e,i,s){const{yBounds:n,yWidth:a,y2Bounds:o,y2Width:r}=
2948
3004
  bumps the line labels, and queues axis scenes for the emit phase.
2949
3005
  Returns everything `plotEmit` needs to consume.
2950
3006
  */
2951
- function Ui(e,i){let{x:s,y:n}=i;const{labelWidths:a}=i,{xHeight:o,x2Height:r,topOffset:c,height:h,horizontalMargin:l,verticalMargin:d}=i;let u=[r,h-(o+c+d)];const{yBounds:m,yWidth:f,y2Bounds:g,y2Width:p,xOffsetLeft:y,xOffsetRight:_}=function(e,i,s){const{yDomain:n,y2Domain:a,yConfigScale:o,y2ConfigScale:r}=i,{defaultY2Config:c,showY:h,y2Exists:l,yC:d}=i,{yTicks:u,x2TestRange:m,xTestRange:f,height:g,width:p}=i,{yTest:y,y2Test:_}=i;let{xOffsetRight:x}=i;h&&y.domain(n).height(g).maxSize(p/2).range(s).ticks(u).width(p).config(d).config(e._yConfig).scale(o).measure();const b=y.outerBounds(),k=b.width?b.width+y.padding():void 0,v=t.max([k,f[0],m[0]]);l&&_.config(d).domain(a).gridSize(0).height(g).range(s).width(p-t.max([0,x-i.y2Width])).title(!1).config(e._y2Config).config(c).scale(r).measure();const C=_.outerBounds(),S=C.width?C.width+_.padding():void 0;return x=t.max([0,S,p-f[1],p-m[1]]),{yBounds:b,yWidth:k,y2Bounds:C,y2Width:S,xOffsetLeft:v,xOffsetRight:x}}
3007
+ function es(e,i){let{x:s,y:n}=i;const{labelWidths:a}=i,{xHeight:o,x2Height:r,topOffset:c,height:h,horizontalMargin:l,verticalMargin:d}=i;let u=[r,h-(o+c+d)];const{yBounds:m,yWidth:f,y2Bounds:g,y2Width:p,xOffsetLeft:y,xOffsetRight:_}=function(e,i,s){const{yDomain:n,y2Domain:a,yConfigScale:o,y2ConfigScale:r}=i,{defaultY2Config:c,showY:h,y2Exists:l,yC:d}=i,{yTicks:u,x2TestRange:m,xTestRange:f,height:g,width:p}=i,{yTest:y,y2Test:_}=i;let{xOffsetRight:x}=i;h&&y.domain(n).height(g).maxSize(p/2).range(s).ticks(u).width(p).config(d).config(e._yConfig).scale(o).measure();const b=y.outerBounds(),k=b.width?b.width+y.padding():void 0,v=t.max([k,f[0],m[0]]);l&&_.config(d).domain(a).gridSize(0).height(g).range(s).width(p-t.max([0,x-i.y2Width])).title(!1).config(e._y2Config).config(c).scale(r).measure();const C=_.outerBounds(),S=C.width?C.width+_.padding():void 0;return x=t.max([0,S,p-f[1],p-m[1]]),{yBounds:b,yWidth:k,y2Bounds:C,y2Width:S,xOffsetLeft:v,xOffsetRight:x}}
2952
3008
  /**
2953
3009
  Set `viz._chartTransform` and derive the per-axis relative transform
2954
3010
  helper used when absorbing axis scenes into `_chartScene`.
@@ -2987,25 +3043,25 @@ function(e,i,s){let n={};return i&&(t.groups(i,e=>e.xValue).forEach(([,i])=>{con
2987
3043
  position. Returns the compute-mode scene nodes (empty when nothing was
2988
3044
  bumped). Coords are relative to `_chartTransform`, which the chart-cells
2989
3045
  group applies.
2990
- */(e,a,u);let C=e._xAxis.barConfig()["stroke-width"];return C&&(C/=2),{x:s,y:n,xRange:x,yRange:u,xOffsetLeft:y,xOffsetRight:_,yWidth:f,y2Width:p,yBounds:m,y2Bounds:g,axisSceneQueue:k,yOffset:C||0,labelPositions:v}}const Ji=new Je,Qi=new Wt,Zi=(e,t)=>$i.prototype._draw.call(e,t);function es(e,i){if(!e._filteredData.length&&!e._annotations?.length)
3046
+ */(e,a,u);let C=e._xAxis.barConfig()["stroke-width"];return C&&(C/=2),{x:s,y:n,xRange:x,yRange:u,xOffsetLeft:y,xOffsetRight:_,yWidth:f,y2Width:p,yBounds:m,y2Bounds:g,axisSceneQueue:k,yOffset:C||0,labelPositions:v}}const ts=new Ze,is=new Gt,ss=(e,t)=>Oi.prototype._draw.call(e,t);function ns(e,i){if(!e._filteredData.length&&!e._annotations?.length)
2991
3047
  // Empty data: still run super._draw so the chart shell (title /
2992
3048
  // legend / total / timeline / colorScale) refreshes — features
2993
3049
  // tear down their DOM via .data([]) in their layout body, and
2994
3050
  // vizDrawPure resets _chartScene/_featurePanels/_shapes. Without
2995
3051
  // this, the previous render's chart shell (incl. aria-labels)
2996
3052
  // lingers in the DOM and toScene() emits stale nodes.
2997
- return Zi(e,i),e;
3053
+ return ss(e,i),e;
2998
3054
  // Throwaway measure-only axes. Allocated per draw, configured + measured
2999
3055
  // below, then garbage-collected when the function returns. Plot no longer
3000
3056
  // owns long-lived Axis instances just to compute layout. gridSize(0)
3001
3057
  // signals "labels-only" measure: the production axes (`_xAxis`,
3002
3058
  // `_yAxis`, …) handle grid rendering with their default gridSize.
3003
- const s=(new bt).align("end").gridSize(0),n=(new Ct).align("start").gridSize(0),a=(new kt).align("start").gridSize(0),o=(new kt).align("end").gridSize(0),{data:r,axisData:c,x2Exists:h,y2Exists:l,xData:d,x2Data:u,yData:m,y2Data:f,stackGroup:g}=
3004
- /** Runs format + per-axis-value stages; returns formatted data and axis-value bundles. */function(e){const t=he({viz:e},[Gi,Ii]);
3059
+ const s=(new St).align("end").gridSize(0),n=(new Dt).align("start").gridSize(0),a=(new wt).align("start").gridSize(0),o=(new wt).align("end").gridSize(0),{data:r,axisData:c,x2Exists:h,y2Exists:l,xData:d,x2Data:u,yData:m,y2Data:f,stackGroup:g}=
3060
+ /** Runs format + per-axis-value stages; returns formatted data and axis-value bundles. */function(e){const t=he({viz:e},[Ki,Xi]);
3005
3061
  // Time flags (xTime/x2Time/yTime/y2Time) are written onto `viz` by
3006
3062
  // `formatPlotData` and read directly via `viz._xTime` etc. downstream.
3007
3063
  return{data:t.plotFormattedData,axisData:t.plotAxisData,x2Exists:t.x2Exists,y2Exists:t.y2Exists,xData:t.xData,x2Data:t.x2Data,yData:t.yData,y2Data:t.y2Data,stackGroup:t.plotStackGroup}}
3008
- /** Runs domain + scale stages; returns domains, stack data, and scale bundles. */(e),p=e.schema.height-e._margin.top-e._margin.bottom,y=e.schema.discrete?"x"===e.schema.discrete?"y":"x":void 0,_=e.schema.width-e._margin.left-e._margin.right,x=function(e,t,i,s,n){const{xData:a,x2Data:o,yData:r,y2Data:c}=n,h=he({viz:e,plotFormattedData:t,plotAxisData:i,xData:a,x2Data:o,yData:r,y2Data:c,plotStackGroup:s},[Ni,Ki]);
3064
+ /** Runs domain + scale stages; returns domains, stack data, and scale bundles. */(e),p=e.schema.height-e._margin.top-e._margin.bottom,y=e.schema.discrete?"x"===e.schema.discrete?"y":"x":void 0,_=e.schema.width-e._margin.left-e._margin.right,x=function(e,t,i,s,n){const{xData:a,x2Data:o,yData:r,y2Data:c}=n,h=he({viz:e,plotFormattedData:t,plotAxisData:i,xData:a,x2Data:o,yData:r,y2Data:c,plotStackGroup:s},[Ii,Ji]);
3009
3065
  // Stacked/non-stacked domain construction + domain/scale setup are stages
3010
3066
  // on `plotDef`. Run them together and read all the outputs the paint phase
3011
3067
  // below needs.
@@ -3014,9 +3070,9 @@ return{plotInitialDomains:h.plotInitialDomains,plotDiscreteKeys:h.plotDiscreteKe
3014
3070
  // Opposite-axis scale extension via buffers lives in the
3015
3071
  // `extendPlotOppScales` stage. Reassigns x/y/x2/y2 from the stage's
3016
3072
  // returned scales bundle.
3017
- const a=he({viz:e,plotFormattedData:t,plotAxisData:i,plotScales:{...s.plotScales,...n},plotConfigScales:s.plotConfigScales},[qi]).plotScales;return{x:a.x,y:a.y,x2:a.x2,y2:a.y2}}
3018
- /** Runs axis-layout prep; returns domains, default configs, show flags, ticks, and bar labels. */(e,r,c,x,{x:S,y:w,x2:z,y2:D}));const R=function(e,t,i,s,n,a){const{x2Exists:o,y2Exists:r}=n,{x2Data:c,y2Data:h,yData:l}=a,d=he({viz:e,plotAxisData:t,plotScales:{...i.plotScales,...s},x2Exists:o,y2Exists:r,x2Data:c,y2Data:h,yData:l},[Yi]);return{plotDefaultConfig:d.plotDefaultConfig,plotDefaultX2Config:d.plotDefaultX2Config,plotDefaultY2Config:d.plotDefaultY2Config,plotShowX:d.plotShowX,plotShowY:d.plotShowY,plotYC:d.plotYC,plotBarLabels:d.plotBarLabels,plotXTicks:d.plotXTicks,plotX2Ticks:d.plotX2Ticks,plotYTicks:d.plotYTicks,plotY2Ticks:d.plotY2Ticks,plotXDomain:d.plotXDomain,plotX2Domain:d.plotX2Domain,plotYDomain:d.plotYDomain,plotY2Domain:d.plotY2Domain}}
3019
- /** Builds the line-label width measure callback for the four-axis margin solve. */(e,c,x,{x:S,y:w,x2:z,y2:D},{x2Exists:h,y2Exists:l},{x2Data:u,y2Data:f,yData:m}),L=R.plotXDomain,E=R.plotX2Domain,F=R.plotYDomain,W=R.plotY2Domain,N=R.plotDefaultConfig,H=R.plotDefaultX2Config,j=R.plotDefaultY2Config,G=R.plotShowX,I=R.plotShowY,q=R.plotYC,Y=R.plotXTicks,K=R.plotX2Ticks,X=R.plotYTicks,V=R.plotY2Ticks,U=R.plotBarLabels,J=e.schema.lineLabels&&!l,Q=function(e,t,i,s,n){const{xTest:a,yTest:o}=n;return()=>{const n=he({viz:e,plotFormattedData:t,plotScales:i.plotScales,plotConfigScales:i.plotConfigScales,plotTestAxes:{xTest:a,yTest:o},plotLineLabelTest:{testLineShape:Ji,testTextBox:Qi},y2Exists:s},[Hi]);return{labelWidths:n.plotLabelWidths,largestLabel:n.plotLargestLabel,xRangeMax:n.plotXRangeMax}}}(e,r,x,l,{xTest:s,yTest:a}),{yBounds:Z,y2Bounds:ee,yWidth:te,y2Width:ie,xC:se,xRangeMax:ne,labelWidths:ae,largestLabel:oe,xTestRange:re,x2TestRange:ce,x2Height:le,xOffsetLeft:de,xOffsetRight:ue,topOffset:me,xHeight:fe}=Vi(e,{xTest:s,yTest:a,x2Test:n,y2Test:o,xDomain:L,x2Domain:E,yDomain:F,y2Domain:W,xTicks:Y,x2Ticks:K,yTicks:X,y2Ticks:V,xConfigScale:$,x2ConfigScale:P,yConfigScale:B,y2ConfigScale:T,defaultX2Config:H,defaultY2Config:j,yC:q,showX:G,showY:I,x2Exists:h,y2Exists:l,height:p,width:_,xData:d,xScalePadding:S.padding?S.padding():0},Q);Zi(e,i);const ge={domains:b,shapeData:O,axisData:c,data:r,discreteKeys:k,stackData:v,stackKeys:C,x:S,y:w,x2:z,y2:D,xScale:M,yScale:A,xConfigScale:$,yConfigScale:B,x2ConfigScale:P,y2ConfigScale:T,xDomain:L,yDomain:F,x2Domain:E,y2Domain:W,xData:d,yData:m,x2Data:u,y2Data:f,x2Exists:h,y2Exists:l,showX:G,showY:I,defaultConfig:N,defaultX2Config:H,defaultY2Config:j,yC:q,xC:se,xTicks:Y,yTicks:X,x2Ticks:K,y2Ticks:V,labelWidths:ae,largestLabel:oe,xRangeMax:ne,xTest:s,yTest:a,x2Test:n,y2Test:o,yBounds:Z,y2Bounds:ee,yWidth:te,y2Width:ie,xHeight:fe,x2Height:le,xOffsetLeft:de,xOffsetRight:ue,topOffset:me,xTestRange:re,x2TestRange:ce,height:p,width:_,opp:y,barLabels:U,showLineLabels:J,stackGroup:g,horizontalMargin:e._margin.left+e._margin.right,verticalMargin:e._margin.top+e._margin.bottom};return e._paint(ge)}
3073
+ const a=he({viz:e,plotFormattedData:t,plotAxisData:i,plotScales:{...s.plotScales,...n},plotConfigScales:s.plotConfigScales},[Vi]).plotScales;return{x:a.x,y:a.y,x2:a.x2,y2:a.y2}}
3074
+ /** Runs axis-layout prep; returns domains, default configs, show flags, ticks, and bar labels. */(e,r,c,x,{x:S,y:w,x2:z,y2:D}));const R=function(e,t,i,s,n,a){const{x2Exists:o,y2Exists:r}=n,{x2Data:c,y2Data:h,yData:l}=a,d=he({viz:e,plotAxisData:t,plotScales:{...i.plotScales,...s},x2Exists:o,y2Exists:r,x2Data:c,y2Data:h,yData:l},[Ui]);return{plotDefaultConfig:d.plotDefaultConfig,plotDefaultX2Config:d.plotDefaultX2Config,plotDefaultY2Config:d.plotDefaultY2Config,plotShowX:d.plotShowX,plotShowY:d.plotShowY,plotYC:d.plotYC,plotBarLabels:d.plotBarLabels,plotXTicks:d.plotXTicks,plotX2Ticks:d.plotX2Ticks,plotYTicks:d.plotYTicks,plotY2Ticks:d.plotY2Ticks,plotXDomain:d.plotXDomain,plotX2Domain:d.plotX2Domain,plotYDomain:d.plotYDomain,plotY2Domain:d.plotY2Domain}}
3075
+ /** Builds the line-label width measure callback for the four-axis margin solve. */(e,c,x,{x:S,y:w,x2:z,y2:D},{x2Exists:h,y2Exists:l},{x2Data:u,y2Data:f,yData:m}),L=R.plotXDomain,E=R.plotX2Domain,F=R.plotYDomain,W=R.plotY2Domain,N=R.plotDefaultConfig,H=R.plotDefaultX2Config,j=R.plotDefaultY2Config,G=R.plotShowX,I=R.plotShowY,q=R.plotYC,Y=R.plotXTicks,K=R.plotX2Ticks,X=R.plotYTicks,V=R.plotY2Ticks,U=R.plotBarLabels,J=e.schema.lineLabels&&!l,Q=function(e,t,i,s,n){const{xTest:a,yTest:o}=n;return()=>{const n=he({viz:e,plotFormattedData:t,plotScales:i.plotScales,plotConfigScales:i.plotConfigScales,plotTestAxes:{xTest:a,yTest:o},plotLineLabelTest:{testLineShape:ts,testTextBox:is},y2Exists:s},[qi]);return{labelWidths:n.plotLabelWidths,largestLabel:n.plotLargestLabel,xRangeMax:n.plotXRangeMax}}}(e,r,x,l,{xTest:s,yTest:a}),{yBounds:Z,y2Bounds:ee,yWidth:te,y2Width:ie,xC:se,xRangeMax:ne,labelWidths:ae,largestLabel:oe,xTestRange:re,x2TestRange:ce,x2Height:le,xOffsetLeft:de,xOffsetRight:ue,topOffset:me,xHeight:fe}=Zi(e,{xTest:s,yTest:a,x2Test:n,y2Test:o,xDomain:L,x2Domain:E,yDomain:F,y2Domain:W,xTicks:Y,x2Ticks:K,yTicks:X,y2Ticks:V,xConfigScale:$,x2ConfigScale:P,yConfigScale:B,y2ConfigScale:T,defaultX2Config:H,defaultY2Config:j,yC:q,showX:G,showY:I,x2Exists:h,y2Exists:l,height:p,width:_,xData:d,xScalePadding:S.padding?S.padding():0},Q);ss(e,i);const ge={domains:b,shapeData:O,axisData:c,data:r,discreteKeys:k,stackData:v,stackKeys:C,x:S,y:w,x2:z,y2:D,xScale:M,yScale:A,xConfigScale:$,yConfigScale:B,x2ConfigScale:P,y2ConfigScale:T,xDomain:L,yDomain:F,x2Domain:E,y2Domain:W,xData:d,yData:m,x2Data:u,y2Data:f,x2Exists:h,y2Exists:l,showX:G,showY:I,defaultConfig:N,defaultX2Config:H,defaultY2Config:j,yC:q,xC:se,xTicks:Y,yTicks:X,x2Ticks:K,y2Ticks:V,labelWidths:ae,largestLabel:oe,xRangeMax:ne,xTest:s,yTest:a,x2Test:n,y2Test:o,yBounds:Z,y2Bounds:ee,yWidth:te,y2Width:ie,xHeight:fe,x2Height:le,xOffsetLeft:de,xOffsetRight:ue,topOffset:me,xTestRange:re,x2TestRange:ce,height:p,width:_,opp:y,barLabels:U,showLineLabels:J,stackGroup:g,horizontalMargin:e._margin.left+e._margin.right,verticalMargin:e._margin.top+e._margin.bottom};return e._paint(ge)}
3020
3076
  /**
3021
3077
  Plot label/size placement helpers. Both are invoked bound to a Plot
3022
3078
  instance (`fn.bind(this)`), so they read the live axis scales +
@@ -3024,52 +3080,70 @@ const a=he({viz:e,plotFormattedData:t,plotAxisData:i,plotScales:{...s.plotScales
3024
3080
  */
3025
3081
  /**
3026
3082
  Default shape size, routed through the chart's internal sizeScale.
3027
- */function ts(e){
3083
+ */function as(e){
3028
3084
  // When `_size` is unset, `_sizeScaleD3` is the constant `() => sizeMin`,
3029
3085
  // so the `null` argument is ignored (cast to satisfy the scale signature).
3030
3086
  return this._sizeScaleD3(this._size?this._size(e):null)}
3031
3087
  /**
3032
3088
  Determines if a Bar label should be placed outside of the Bar.
3033
- */function is(e,t){
3089
+ */function os(e,t){
3034
3090
  // Force all Stacked Bars to use "inside" labels.
3035
3091
  if(this.schema.stacked)return!1;
3036
3092
  // Detect user "outside" or "inside" override.
3037
3093
  const i=this._labelPosition(e,t);if("outside"===i)return!0;
3038
3094
  // Run "auto" logic based on available space, against the non-discrete axis.
3039
3095
  if("inside"===i)return!1;const s="x"===this.schema.discrete.charAt(0)?"y":"x",n=this.schema.discrete.replace(this.schema.discrete.charAt(0),s),a="y"===n?this._yAxis:this._xAxis,o="y"===n?this._y:this._x,r=a._d3Scale.range(),c=o(e,t),h=c<0,l=a._getPosition(0),d="y"===n?h?r[1]-l:l-r[0]:h?l-r[0]:r[1]-l,u=a._getPosition(c);return Math.abs(h?l-u:u-l)<d/2}
3040
- /** Builds the `Area` shape config; `self` is the Plot instance. */function ss(e){return{label:(t,i)=>!!e.schema.stacked&&e._drawLabel(t,i),labelBounds:(e,i,s)=>{let n=y.largestRect(s.points,{angle:t.range(-20,20,5)});if((!n||n.height<20||n.width<50)&&(n=y.largestRect(s.points,{angle:t.range(-80,80,5)})),!n)return null;const a=t.min(s.points,e=>e[0]),o=t.max(s.points.filter(e=>e[0]===a),e=>e[1]);return{angle:n.angle,width:n.width,height:n.height,x:n.cx-n.width/2-a,y:n.cy-n.height/2-o}},labelConfig:{fontMin:6,fontResize:!0,padding:10}}}
3041
- /** Builds the top-level `ariaLabel` accessor; `self` is the Plot instance. */function ns(e){return(t,i)=>{let s="";return t.nested?s=`${e._drawLabel(t.data,t.i)}`:(s=`${e._drawLabel(t,i)}`,void 0!==e._x(t,i)&&(s+=`, x: ${e._x(t,i)}`),void 0!==e._y(t,i)&&(s+=`, y: ${e._y(t,i)}`),void 0!==e._x2(t,i)&&(s+=`, x2: ${e._x2(t,i)}`),void 0!==e._y2(t,i)&&(s+=`, y2: ${e._y2(t,i)}`)),`${s}.`}}
3096
+ /** Builds the `Area` shape config; `self` is the Plot instance. */function rs(e){return{label:(t,i)=>!!e.schema.stacked&&e._drawLabel(t,i),labelBounds:(e,i,s)=>{let n=p.largestRect(s.points,{angle:t.range(-20,20,5)});if((!n||n.height<20||n.width<50)&&(n=p.largestRect(s.points,{angle:t.range(-80,80,5)})),!n)return null;const a=t.min(s.points,e=>e[0]),o=t.max(s.points.filter(e=>e[0]===a),e=>e[1]);return{angle:n.angle,width:n.width,height:n.height,x:n.cx-n.width/2-a,y:n.cy-n.height/2-o}},labelConfig:{fontMin:6,fontResize:!0,padding:10}}}
3097
+ /** Builds the top-level `ariaLabel` accessor; `self` is the Plot instance. */function cs(e){return(t,i)=>{let s="";return t.nested?s=`${e._drawLabel(t.data,t.i)}`:(s=`${e._drawLabel(t,i)}`,void 0!==e._x(t,i)&&(s+=`, x: ${e._x(t,i)}`),void 0!==e._y(t,i)&&(s+=`, y: ${e._y(t,i)}`),void 0!==e._x2(t,i)&&(s+=`, x2: ${e._x2(t,i)}`),void 0!==e._y2(t,i)&&(s+=`, y2: ${e._y2(t,i)}`)),`${s}.`}}
3042
3098
  /** Builds the `Bar.labelConfig` block (dynamic-`this` accessors preserved). */
3043
- /** Builds the `Line` shape config; `self` is the Plot instance. */function as(e){return{curve:()=>e.schema.discrete?`monotone${e.schema.discrete.charAt(0).toUpperCase()}`:"linear",fill:L("none"),labelConfig:{fontColor:(t,i)=>{const s="function"==typeof e.schema.shapeConfig.Line.stroke?e.schema.shapeConfig.Line.stroke(t,i):e.schema.shapeConfig.Line.stroke;return u.colorLegible(s)},fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:L(2)}}function os(){return{Area:ss(this),ariaLabel:ns(this),Bar:{labelBounds(e,t,i){const s="y"===this.schema.discrete?"width":"height",n="y"===this.schema.discrete?"height":"width",a="x"===this.schema.discrete.charAt(0)?"y":"x",o="y"===a,r=this.schema.discrete.replace(this.schema.discrete.charAt(0),a),c=("y"===r?this._yAxis:this._xAxis)._d3Scale.range(),h=Math.abs(c[1]-c[0]),l=("y"===r?this._y:this._x)(e,t)<0;return is.bind(this)(e,t)?{[s]:h-i[s],[n]:i[n],x:o?-i.width/2:l?-h:i.width+1,y:o?l?i.height+1:-h:-i.height/2+1}:{[s]:i[s],[n]:i[n],x:o?-i.width/2:l?(this.schema.stacked,1-i.width):-1,y:o?l?(this.schema.stacked,1):1-i.height:-i.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(e,t){if(is.bind(this)(e,t)){const e="transparent"===this._backgroundConfig.fill?n.backgroundColor(this._select.node()):this._backgroundConfig.fill;return u.colorContrast(e)}return u.colorContrast("function"==typeof this.schema.shapeConfig.fill?this.schema.shapeConfig.fill(e,t):this.schema.shapeConfig.fill)},fontStroke(e,t){if(is.bind(this)(e,t)){const e="transparent"===this._backgroundConfig.fill?n.backgroundColor(this._select.node()):this._backgroundConfig.fill;return u.colorContrast(e)}return"transparent"},fontStrokeWidth(e,t){return is.bind(this)(e,t)?.1:0},padding:3,textAnchor(e,t){const i="x"===this.schema.discrete.charAt(0)?"y":"x",s="y"===i,a=("y"===this.schema.discrete.replace(this.schema.discrete.charAt(0),i)?this._y:this._x)(e,t)<0,o=s?"middle":is.bind(this)(e,t)?a?"end":"start":a?"start":"end";return n.rtl()?"start"===o?"end":"end"===o?"start":o:o},verticalAlign(e,t){const i="x"===this.schema.discrete.charAt(0)?"y":"x",s="y"===i,n=("y"===this.schema.discrete.replace(this.schema.discrete.charAt(0),i)?this._y:this._x)(e,t)<0;return s?is.bind(this)(e,t)?n?"top":"bottom":n?"bottom":"top":"middle"}}},Circle:{r:ts.bind(this),
3099
+ /** Builds the `Line` shape config; `self` is the Plot instance. */function hs(e){return{curve:()=>e.schema.discrete?`monotone${e.schema.discrete.charAt(0).toUpperCase()}`:"linear",fill:L("none"),labelConfig:{fontColor:(t,i)=>{const s="function"==typeof e.schema.shapeConfig.Line.stroke?e.schema.shapeConfig.Line.stroke(t,i):e.schema.shapeConfig.Line.stroke;return u.colorLegible(s)},fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:L(2)}}function ls(){return{Area:rs(this),ariaLabel:cs(this),Bar:{labelBounds(e,t,i){const s="y"===this.schema.discrete?"width":"height",n="y"===this.schema.discrete?"height":"width",a="x"===this.schema.discrete.charAt(0)?"y":"x",o="y"===a,r=this.schema.discrete.replace(this.schema.discrete.charAt(0),a),c=("y"===r?this._yAxis:this._xAxis)._d3Scale.range(),h=Math.abs(c[1]-c[0]),l=("y"===r?this._y:this._x)(e,t)<0;return os.bind(this)(e,t)?{[s]:h-i[s],[n]:i[n],x:o?-i.width/2:l?-h:i.width+1,y:o?l?i.height+1:-h:-i.height/2+1}:{[s]:i[s],[n]:i[n],x:o?-i.width/2:l?(this.schema.stacked,1-i.width):-1,y:o?l?(this.schema.stacked,1):1-i.height:-i.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(e,t){if(os.bind(this)(e,t)){const e="transparent"===this._backgroundConfig.fill?n.backgroundColor(this._select.node()):this._backgroundConfig.fill;return u.colorContrast(e)}return u.colorContrast("function"==typeof this.schema.shapeConfig.fill?this.schema.shapeConfig.fill(e,t):this.schema.shapeConfig.fill)},fontStroke(e,t){if(os.bind(this)(e,t)){const e="transparent"===this._backgroundConfig.fill?n.backgroundColor(this._select.node()):this._backgroundConfig.fill;return u.colorContrast(e)}return"transparent"},fontStrokeWidth(e,t){return os.bind(this)(e,t)?.1:0},padding:3,textAnchor(e,t){const i="x"===this.schema.discrete.charAt(0)?"y":"x",s="y"===i,a=("y"===this.schema.discrete.replace(this.schema.discrete.charAt(0),i)?this._y:this._x)(e,t)<0,o=s?"middle":os.bind(this)(e,t)?a?"end":"start":a?"start":"end";return n.rtl()?"start"===o?"end":"end"===o?"start":o:o},verticalAlign(e,t){const i="x"===this.schema.discrete.charAt(0)?"y":"x",s="y"===i,n=("y"===this.schema.discrete.replace(this.schema.discrete.charAt(0),i)?this._y:this._x)(e,t)<0;return s?os.bind(this)(e,t)?n?"top":"bottom":n?"bottom":"top":"middle"}}},Circle:{r:as.bind(this),
3044
3100
  // Scatter/bubble points leave a motion trail when they move between
3045
3101
  // frames (Timeline play). Only affects Circle/Rect marks, so Bar/Line/Area
3046
3102
  // plots are unaffected; opt out per chart with shapeConfig.Circle.trail.
3047
- trail:!0},Line:as(this),Rect:{height:e=>2*ts.bind(this)(e),width:e=>2*ts.bind(this)(e),
3103
+ trail:!0},Line:hs(this),Rect:{height:e=>2*as.bind(this)(e),width:e=>2*as.bind(this)(e),
3048
3104
  // Square scatter marks trail like Circle points do; the cone is sized to
3049
3105
  // the square's silhouette perpendicular to travel (corner-to-corner at
3050
3106
  // 45°). Opt out per chart with shapeConfig.Rect.trail: false.
3051
3107
  trail:!0}}}
3108
+ /** Marks a comparator as an already-resolved d3plus stack order. */function ds(e){return e.__d3plusStackOrder=!0,e}
3109
+ // @types/d3-shape types the order accessors' param as a single `Series`,
3110
+ // though d3 passes the full stack array; this cast satisfies the signature.
3052
3111
  /**
3053
3112
  Sums a single stack series, ignoring non-numeric segments.
3054
- */function rs(e){let t,i=-1,s=0;const n=e.length;for(;++i<n;)(t=+e[i][1])&&(s+=t);return s}
3113
+ */
3114
+ function us(e){let t,i=-1,s=0;const n=e.length;for(;++i<n;)(t=+e[i][1])&&(s+=t);return s}
3055
3115
  /**
3056
- Stack order: ascending by series key, tie-broken by summed value.
3057
- */function cs(e){const t=e.map(rs),i=e.map(e=>e.key.split("_")[0]);
3058
- // @types/d3-shape types the order accessors' param as a single `Series`,
3059
- // though d3 passes the full stack array; cast to satisfy the signature.
3060
- return P.stackOrderNone(e).sort((e,s)=>i[s].localeCompare(i[e])||t[e]-t[s])}
3116
+ Stack order: series with the smallest summed value on the bottom of the
3117
+ stack (matches d3's `stackOrderAscending`).
3118
+ */const ms=ds(e=>P.stackOrderAscending(e)),fs=ds(e=>P.stackOrderDescending(e)),gs=ds(e=>{const t=e.map(us),i=e.map(e=>e.key.split("_")[0]);return P.stackOrderNone(e).sort((e,s)=>i[e].localeCompare(i[s])||t[e]-t[s])}),ps=ds(e=>gs(e).reverse());
3119
+ /**
3120
+ Stack order: series with the largest summed value on the bottom of the
3121
+ stack (matches d3's `stackOrderDescending`). Plot's default.
3122
+ */
3061
3123
  /**
3062
- Stack order: the reverse of {@link stackOrderAscending}.
3063
- */function hs(e){return cs(e).reverse()}
3124
+ Builds a stack order that ranks each series by an aggregate (sum) of a
3125
+ data field, letting users order stacks by any value in their data rather
3126
+ than only the plotted one. `value` receives each series' original datum.
3127
+ */
3128
+ function ys(e,t="descending"){return ds(i=>{const s=i.map(t=>{let i=0;for(let s=0;s<t.length;s++){
3129
+ // Each stacked point carries `.data` = the discrete group's rows;
3130
+ // pick the row for this series and read the field off its datum.
3131
+ const n=(t[s].data||[]).find(e=>e.id===t.key);if(n&&n.data){const t=+e(n.data);isNaN(t)||(i+=t)}}return i});return P.stackOrderNone(i).sort((e,i)=>"ascending"===t?s[e]-s[i]:s[i]-s[e])})}
3132
+ /** Named stack orders accepted by `Plot.stackOrder`. */const _s={ascending:ms,descending:fs,key:gs,keyReverse:ps,none:ds(e=>P.stackOrderNone(e)),data:ds(e=>P.stackOrderNone(e)),insideOut:ds(e=>P.stackOrderInsideOut(e)),appearance:ds(e=>P.stackOrderAppearance(e)),reverse:ds(e=>P.stackOrderReverse(e))},xs=Object.keys(_s);
3133
+ /** The named orders accepted by `Plot.stackOrder`, for docs/validation. */
3064
3134
  /**
3065
3135
  Diverging stack offset: positive segments stack upward from zero,
3066
3136
  negative segments stack downward.
3067
- */function ls(e,t){let i,s,n,a,o,r;if(!((i=e.length)>0))return;const c=e[t[0]].length;for(let h=0;h<c;++h)for(r=o=0,a=0;a<i;++a)(n=(s=e[t[a]][h])[1]-s[0])>=0?(s[0]=r,s[1]=r+=n):n<0?(s[1]=o,s[0]=o+=n):s[0]=r}
3137
+ */
3138
+ function bs(e,t){let i,s,n,a,o,r;if(!((i=e.length)>0))return;const c=e[t[0]].length;for(let h=0;h<c;++h)for(r=o=0,a=0;a<i;++a)(n=(s=e[t[a]][h])[1]-s[0])>=0?(s[0]=r,s[1]=r+=n):n<0?(s[1]=o,s[0]=o+=n):s[0]=r}
3139
+ /** Named stack offsets accepted by `Plot.stackOffset`. */const ks={diverging:bs,none:P.stackOffsetNone,expand:P.stackOffsetExpand,silhouette:P.stackOffsetSilhouette,wiggle:P.stackOffsetWiggle},vs=Object.keys(ks);
3140
+ /** The named offsets accepted by `Plot.stackOffset`, for docs/validation. */
3068
3141
  /**
3069
3142
  Clone the base shape config and, for stacked Area/Bar, inject the
3070
3143
  stacking-aware opp/opp0/opp1 accessors that read the precomputed
3071
3144
  `stackData` cube.
3072
- */function ds(e,t){const{viz:i,opp:s,x:n,y:a,stackData:o,domains:r,stackKeyIndex:c,discreteKeyIndex:h}=e,l=Object.assign({},e.shapeConfig);
3145
+ */
3146
+ function Cs(e,t){const{viz:i,opp:s,x:n,y:a,stackData:o,domains:r,stackKeyIndex:c,discreteKeyIndex:h}=e,l=Object.assign({},e.shapeConfig);
3073
3147
  // Bubble plots: when a `size` accessor is set, default to layering circles
3074
3148
  // largest-behind so smaller marks stay visible under bigger ones. This is a
3075
3149
  // default — `finishShape` applies the user's `shapeConfig` afterwards, so an
@@ -3078,10 +3152,10 @@ if("Circle"===t&&i._size){const e=i._size;l.sort=(t,i)=>(Number(e(i))||0)-(Numbe
3078
3152
  /**
3079
3153
  Shared tail: wire shape events, apply the user's shapeConfig, render in
3080
3154
  compute mode, and collect the resulting scene nodes.
3081
- */function us(e,t,i){const{viz:s,events:n}=e;s._wirePlotShapeEvents(i,t,n);const a=Ei(s,t);return void 0===s.schema.shapeConfig.duration&&delete a.duration,i.config(a).render(),Fi(i)}
3082
- /** Generic path — every shape key without a dedicated emitter (incl. stacked Area). */const ms=(e,t)=>us(e,t,Oi(t).renderMode("compute").config(ds(e,t)).data(e.values)),fs={Bar:e=>{const{viz:i,x:s,y:n,xScale:a,yScale:o,xDomain:r,yDomain:c,xRange:h,yRange:l,values:d}=e,u=Oi("Bar").renderMode("compute").config(ds(e,"Bar")).data(d);let m;const f="x"===i.schema.discrete?s:n,g="x"===i.schema.discrete?a:o,p="x"===i.schema.discrete?r:c,y="x"===i.schema.discrete?h:l;if("Point"!==g&&2===p.length){const e=Array.from(new Set(d.map(e=>f(e[i.schema.discrete]))));e.unshift(y[0]-e[0]-y[0]),e.push(y[1]+y[1]-e[e.length-1]),m=e.reduce((e,t,i,s)=>{if(i){const n=Math.abs(t-s[i-1]);n<e&&(e=n)}return e},1/0)}else m=p.length>1?f(p[1])-f(p[0]):y[y.length-1]-y[0];i._groupPadding<m&&(m-=i._groupPadding);let _=m||1;const x=t.groups(d,e=>e[i.schema.discrete],e=>e.group),b=t.merge(x.map(([,e])=>e.map(([e])=>e))),k=Array.from(new Set(b)),v=i.schema.discrete,C=e.shapeConfig[v];if(1===t.max(x.map(([,e])=>e.length)))u[v]((e,t)=>C(e,t));else{_=(_-i.schema.barPadding*k.length-1)/k.length;const e=m/2-_/2,t=B.scaleLinear().domain([0,k.length-1]).range([-e,e]);u[v]((e,i)=>C(e,i)+t(k.indexOf(e.group)))}return u.width(_),u.height(_),us(e,"Bar",u)},Line:e=>{const{viz:t,x:i,y:s,values:a,width:o,showLineLabels:r,labelWidths:c,largestLabel:h,labelPositions:l}=e,d=[],u=Oi("Line").renderMode("compute").config(ds(e,"Line")).data(a);if(u.duration(1.5*o),t._confidence){const o=t._confidence,r=Object.assign({},e.shapeConfig),c=t.schema.discrete||"x",h="x"===c?"y":"x",l="x"===c?s:i;r[`${h}0`]=e=>l(o[0]?e.lci:e[h]),r[`${h}1`]=e=>l(o[1]?e.hci:e[h]);const u=Oi("Area").renderMode("compute").config(r).data(a),m=Object.assign(t.schema.shapeConfig,t._confidenceConfig);u.config(n.assign(Ei(t,"Line",m),Ei(t,"Area",m))).render(),d.push(...Fi(u))}u.config({discrete:e.shapeConfig.discrete||"x",label:!!r&&((e,i)=>{if(!("function"!=typeof t.schema.lineLabels||t.schema.lineLabels(e.data,e.i)))return!1;const s=c.find(t=>t.id===e.id);if(s){const n=s.newY||s.defaultY,a=c.filter(e=>e.newY===n);return a.length>1?a[0].id===e.id&&`+${m.formatAbbreviate(a.length,t.schema.locale)} ${t.schema.translate("more")}`:t._drawLabel(e,i)}return!1}),labelBounds:!!r&&((e,i,s)=>{const[n,a]=s.points[0],[o,r]=s.points[s.points.length-1],c=t.schema.height/4;return{x:o-n,y:r-a-c/2-(l[e.id]?r-l[e.id]:0),width:h,height:c}})}),d.push(...us(e,"Line",u));const f=Oi("Circle").renderMode("compute").data(t._lineMarkers?a:[]).config(e.shapeConfig).config(t._lineMarkerConfig).id(e=>`${e.id}_${e.discrete}`);return t._wirePlotShapeEvents(f,"Circle",e.events),f.render(),d.push(...Fi(f)),d}};
3155
+ */function Ss(e,t,i){const{viz:s,events:n}=e;s._wirePlotShapeEvents(i,t,n);const a=Hi(s,t);return void 0===s.schema.shapeConfig.duration&&delete a.duration,i.config(a).render(),ji(i)}
3156
+ /** Generic path — every shape key without a dedicated emitter (incl. stacked Area). */const ws=(e,t)=>Ss(e,t,Fi(t).renderMode("compute").config(Cs(e,t)).data(e.values)),zs={Bar:e=>{const{viz:i,x:s,y:n,xScale:a,yScale:o,xDomain:r,yDomain:c,xRange:h,yRange:l,values:d}=e,u=Fi("Bar").renderMode("compute").config(Cs(e,"Bar")).data(d);let m;const f="x"===i.schema.discrete?s:n,g="x"===i.schema.discrete?a:o,p="x"===i.schema.discrete?r:c,y="x"===i.schema.discrete?h:l;if("Point"!==g&&2===p.length){const e=Array.from(new Set(d.map(e=>f(e[i.schema.discrete]))));e.unshift(y[0]-e[0]-y[0]),e.push(y[1]+y[1]-e[e.length-1]),m=e.reduce((e,t,i,s)=>{if(i){const n=Math.abs(t-s[i-1]);n<e&&(e=n)}return e},1/0)}else m=p.length>1?f(p[1])-f(p[0]):y[y.length-1]-y[0];i._groupPadding<m&&(m-=i._groupPadding);let _=m||1;const x=t.groups(d,e=>e[i.schema.discrete],e=>e.group),b=t.merge(x.map(([,e])=>e.map(([e])=>e))),k=Array.from(new Set(b)),v=i.schema.discrete,C=e.shapeConfig[v];if(1===t.max(x.map(([,e])=>e.length)))u[v]((e,t)=>C(e,t));else{_=(_-i.schema.barPadding*k.length-1)/k.length;const e=m/2-_/2,t=B.scaleLinear().domain([0,k.length-1]).range([-e,e]);u[v]((e,i)=>C(e,i)+t(k.indexOf(e.group)))}return u.width(_),u.height(_),Ss(e,"Bar",u)},Line:e=>{const{viz:t,x:i,y:s,values:a,width:o,showLineLabels:r,labelWidths:c,largestLabel:h,labelPositions:l}=e,d=[],u=Fi("Line").renderMode("compute").config(Cs(e,"Line")).data(a);if(u.duration(1.5*o),t._confidence){const o=t._confidence,r=Object.assign({},e.shapeConfig),c=t.schema.discrete||"x",h="x"===c?"y":"x",l="x"===c?s:i;r[`${h}0`]=e=>l(o[0]?e.lci:e[h]),r[`${h}1`]=e=>l(o[1]?e.hci:e[h]);const u=Fi("Area").renderMode("compute").config(r).data(a),m=Object.assign(t.schema.shapeConfig,t._confidenceConfig);u.config(n.assign(Hi(t,"Line",m),Hi(t,"Area",m))).render(),d.push(...ji(u))}u.config({discrete:e.shapeConfig.discrete||"x",label:!!r&&((e,i)=>{if(!("function"!=typeof t.schema.lineLabels||t.schema.lineLabels(e.data,e.i)))return!1;const s=c.find(t=>t.id===e.id);if(s){const n=s.newY||s.defaultY,a=c.filter(e=>e.newY===n);return a.length>1?a[0].id===e.id&&`+${m.formatAbbreviate(a.length,t.schema.locale)} ${t.schema.translate("more")}`:t._drawLabel(e,i)}return!1}),labelBounds:!!r&&((e,i,s)=>{const[n,a]=s.points[0],[o,r]=s.points[s.points.length-1],c=t.schema.height/4;return{x:o-n,y:r-a-c/2-(l[e.id]?r-l[e.id]:0),width:h,height:c}})}),d.push(...Ss(e,"Line",u));const f=Fi("Circle").renderMode("compute").data(t._lineMarkers?a:[]).config(e.shapeConfig).config(t._lineMarkerConfig).id(e=>`${e.id}_${e.discrete}`);return t._wirePlotShapeEvents(f,"Circle",e.events),f.render(),d.push(...ji(f)),d}};
3083
3157
  /** Bar — discrete-axis spacing + multi-series grouping offsets. */
3084
- /** Dispatch a shape group to its emitter (falling back to the generic path). */function gs(e,t){return(fs[t]??ms)(e,t)}
3158
+ /** Dispatch a shape group to its emitter (falling back to the generic path). */function Ds(e,t){return(zs[t]??ws)(e,t)}
3085
3159
  /**
3086
3160
  Emits the background Rect into `out` (prepended) when a non-transparent
3087
3161
  `backgroundConfig.fill` is set; no-op otherwise.
@@ -3097,7 +3171,7 @@ if("Circle"===t&&i._size){const e=i._size;l.sort=(t,i)=>(Number(e(i))||0)-(Numbe
3097
3171
  match old→new by id frame-to-frame and TWEEN instead of exit/entering. The
3098
3172
  subtree is marked inert (annotations never show tooltips).
3099
3173
  */
3100
- function ps(e,t){const i=[];try{const t=e.toScene();t&&Array.isArray(t.children)&&t.children.length&&i.push(t);const s=e._labelClass;if(s&&"function"==typeof s.toScene){const e=s.toScene();e&&Array.isArray(e.children)&&e.children.length&&i.push(e)}}catch{return null}if(!i.length)return null;const s={type:"group",key:t,children:i};
3174
+ function Ms(e,t){const i=[];try{const t=e.toScene();t&&Array.isArray(t.children)&&t.children.length&&i.push(t);const s=e._labelClass;if(s&&"function"==typeof s.toScene){const e=s.toScene();e&&Array.isArray(e.children)&&e.children.length&&i.push(e)}}catch{return null}if(!i.length)return null;const s={type:"group",key:t,children:i};
3101
3175
  /**
3102
3176
  Annotations are decorative chrome, not data marks. Stamp their scene nodes
3103
3177
  `interactive: false` so the renderer's hit-test skips them: they fire no
@@ -3108,13 +3182,13 @@ return function(e){const t=e=>{e.interactive=!1;const i=e.children;if(i)for(cons
3108
3182
  /**
3109
3183
  Renders back/front annotations, pushing back-layer scenes onto `out` and
3110
3184
  returning the front-layer shape instances for later absorption.
3111
- */function ys(e,t,i,s,n,a){
3185
+ */function As(e,t,i,s,n,a){
3112
3186
  // Annotations run in `renderMode("compute")` and their scenes are
3113
3187
  // absorbed into `_chartScene`. Layering: "back" annotations absorb here
3114
3188
  // (before the main shape loop below); "front" annotations queue and
3115
3189
  // absorb AFTER the shape loop, giving back → shapes → front.
3116
- const o=[];return Object.keys(e._previousAnnotations).forEach(r=>{const c=e._annotations.filter(e=>"back"===r&&!e.layer||e.layer===r),h=c.map(e=>e.shape);c.forEach((c,h)=>{const l=(t=>{const o=Oi(t.shape).renderMode("compute").duration(e.schema.duration).config(t).config({x:e=>e.x2?i(e.x2,"x2"):i(e.x),x0:"x"===e.schema.discrete?e=>e.x2?i(e.x2,"x2"):i(e.x):i(n.x[0]),x1:"x"===e.schema.discrete?null:e=>e.x2?i(e.x2,"x2"):i(e.x),y:e=>e.y2?s(e.y2,"y2"):s(e.y),y0:"y"===e.schema.discrete?e=>e.y2?s(e.y2,"y2"):s(e.y):s(n.y[1])-a,y1:"y"===e.schema.discrete?null:e=>e.y2?s(e.y2,"y2"):s(e.y)-a});return o.render(),o})(c);if("front"===r)o.push(l);else{const e=ps(l,`annotation-${r}-${h}`);e&&t.push(e)}});e._previousAnnotations[r].filter(e=>!h.includes(e)).forEach(e=>{Oi(e).renderMode("compute").data([]).render()}),e._previousAnnotations[r]=h}),o}
3117
- /** Builds the per-shape `shapeConfig` object shared across the shape loop. */const _s=e=>"string"==typeof e.key&&e.key.startsWith("grid-"),xs=e=>{e.interactionGroup="axis";const t=e.children;if(t)for(const e of t)xs(e)};
3190
+ const o=[];return Object.keys(e._previousAnnotations).forEach(r=>{const c=e._annotations.filter(e=>"back"===r&&!e.layer||e.layer===r),h=c.map(e=>e.shape);c.forEach((c,h)=>{const l=(t=>{const o=Fi(t.shape).renderMode("compute").duration(e.schema.duration).config(t).config({x:e=>e.x2?i(e.x2,"x2"):i(e.x),x0:"x"===e.schema.discrete?e=>e.x2?i(e.x2,"x2"):i(e.x):i(n.x[0]),x1:"x"===e.schema.discrete?null:e=>e.x2?i(e.x2,"x2"):i(e.x),y:e=>e.y2?s(e.y2,"y2"):s(e.y),y0:"y"===e.schema.discrete?e=>e.y2?s(e.y2,"y2"):s(e.y):s(n.y[1])-a,y1:"y"===e.schema.discrete?null:e=>e.y2?s(e.y2,"y2"):s(e.y)-a});return o.render(),o})(c);if("front"===r)o.push(l);else{const e=Ms(l,`annotation-${r}-${h}`);e&&t.push(e)}});e._previousAnnotations[r].filter(e=>!h.includes(e)).forEach(e=>{Fi(e).renderMode("compute").data([]).render()}),e._previousAnnotations[r]=h}),o}
3191
+ /** Builds the per-shape `shapeConfig` object shared across the shape loop. */const $s=e=>"string"==typeof e.key&&e.key.startsWith("grid-"),Bs=e=>{e.interactionGroup="axis";const t=e.children;if(t)for(const e of t)Bs(e)};
3118
3192
  /**
3119
3193
  Stamps `interactionGroup: "axis"` onto an axis scene subtree so the pointer
3120
3194
  bridge can skip shape tooltips on axis ticks, and so the hover/active
@@ -3128,7 +3202,7 @@ const o=[];return Object.keys(e._previousAnnotations).forEach(r=>{const c=e._ann
3128
3202
  Returns the flat `SceneNode[]` array that the caller (`Plot._paint`)
3129
3203
  merges into `_chartScene`.
3130
3204
  */
3131
- function bs(e,t,i){const s=[],{shapeData:a,domains:o}=t,{labelWidths:r}=t,{x:c,y:h,xRange:l,yRange:d,yOffset:u,axisSceneQueue:m}=i,f=
3205
+ function Ps(e,t,i){const s=[],{shapeData:a,domains:o}=t,{labelWidths:r}=t,{x:c,y:h,xRange:l,yRange:d,yOffset:u,axisSceneQueue:m}=i,f=
3132
3206
  /**
3133
3207
  Drains the deferred axis-scene queue, splitting each axis into its
3134
3208
  gridline children (rendered behind the data shapes) and everything else
@@ -3137,7 +3211,7 @@ function bs(e,t,i){const s=[],{shapeData:a,domains:o}=t,{labelWidths:r}=t,{x:c,y
3137
3211
  group's `_chartTransform` composes with this to land at the right
3138
3212
  absolute position.
3139
3213
  */
3140
- function(e){const t=[],i=[];return e.forEach(({key:e,transform:s,axis:n})=>{if(!n||"function"!=typeof n.toScene)return;const a=n.toScene();if(!a)return;const o=a.children||[],r=o.filter(_s),c=o.filter(e=>!_s(e));if(r.length){const i={type:"group",key:`${e}-grid`,transform:s,children:r};xs(i),t.push(i)}if(c.length){const t={type:"group",key:e,transform:s,children:c};xs(t),i.push(t)}}),{grid:t,rest:i}}(m);!function(e,t,i,s){
3214
+ function(e){const t=[],i=[];return e.forEach(({key:e,transform:s,axis:n})=>{if(!n||"function"!=typeof n.toScene)return;const a=n.toScene();if(!a)return;const o=a.children||[],r=o.filter($s),c=o.filter(e=>!$s(e));if(r.length){const i={type:"group",key:`${e}-grid`,transform:s,children:r};Bs(i),t.push(i)}if(c.length){const t={type:"group",key:e,transform:s,children:c};Bs(t),i.push(t)}}),{grid:t,rest:i}}(m);!function(e,t,i,s){
3141
3215
  // Background Rect: skip rendering when transparent (the default) — under
3142
3216
  // the scene path it would emit a 5th `rect.d3plus-render-rect` that
3143
3217
  // confuses bar-counting tests. When a user customizes
@@ -3147,7 +3221,7 @@ const n=e._backgroundConfig;if(n&&n.fill&&"transparent"!==n.fill){
3147
3221
  // x2Height + topOffset), so we subtract the chart-transform offset.
3148
3222
  // yRange[0] = x2Height, so the y simplification is
3149
3223
  // (yRange[1] - yRange[0]) / 2.
3150
- const a=Oi("Rect").renderMode("compute").data([{}]).x(i[0]-e._margin.left+(i[1]-i[0])/2).width(i[1]-i[0]).y((s[1]-s[0])/2).height(s[1]-s[0]).config(n);a.render();
3224
+ const a=Fi("Rect").renderMode("compute").data([{}]).x(i[0]-e._margin.left+(i[1]-i[0])/2).width(i[1]-i[0]).y((s[1]-s[0])/2).height(s[1]-s[0]).config(n);a.render();
3151
3225
  // Background must sit BEHIND chart shapes. Unshift onto `out` so
3152
3226
  // the z-order survives even if a future emit step pushes nodes
3153
3227
  // before this point (i.e. the invariant is enforced at the call
@@ -3155,19 +3229,19 @@ const a=Oi("Rect").renderMode("compute").data([{}]).x(i[0]-e._margin.left+(i[1]-
3155
3229
  // empty here). `unshift(...nodes)` is O(out.length + nodes.length)
3156
3230
  // which is fine — `out` carries axis-queue items, not the full
3157
3231
  // shape scene, so the prepend is a few entries at most.
3158
- const o=Fi(a);t.unshift(...o)}}(e,s,l,d),
3232
+ const o=ji(a);t.unshift(...o)}}(e,s,l,d),
3159
3233
  // Gridlines sit just above the background, behind the data shapes.
3160
- s.push(...f.grid),s.push(...function(e,t){const i=t.filter(e=>void 0!==e.newY);if(!i.length)return[];const s=i.map(t=>n.assign({x:e._xAxis._getPosition.bind(e._xAxis)(t.xValue),y:t.defaultY},t)).concat(i.map(t=>n.assign({x:e._xAxis._getPosition.bind(e._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t))),a=Oi("Line").config({data:s,stroke:e=>e.fontColor,x:e=>e.x,y:e=>e.y}).config(e._labelConnectorConfig).renderMode("compute");return a.render(),Fi(a)}(e,r));const g=ys(e,s,c,h,o,u),p=function(e,t,i,s,n){const a=e.schema.discrete||"x";return{discrete:e.schema.discrete,duration:e.schema.duration,label:t=>e._drawLabel(t.data,t.i),x:e=>void 0!==e.x2?t(e.x2,"x2"):t(e.x),x0:"x"===a?e=>e.x2?t(e.x2,"x2"):t(e.x):t("number"==typeof e.schema.baseline?e.schema.baseline:s.x[0]),x1:"x"===a?null:e=>e.x2?t(e.x2,"x2"):t(e.x),y:e=>void 0!==e.y2?i(e.y2,"y2"):i(e.y),y0:"y"===a?e=>e.y2?i(e.y2,"y2"):i(e.y):i("number"==typeof e.schema.baseline?e.schema.baseline:s.y[1])-n,y1:"y"===a?null:e=>e.y2?i(e.y2,"y2"):i(e.y)-n}}
3161
- /** Runs the main shape loop, pushing each shape's scene nodes onto `out`. */(e,c,h,o,u);return function(e,t,i,s,n){const{shapeData:a,domains:o,discreteKeys:r,stackData:c,stackKeys:h,xDomain:l,yDomain:d}=i,{xScale:u,yScale:m}=i,{labelWidths:f,largestLabel:g}=i,{width:p}=i,{opp:y,showLineLabels:_}=i,{x:x,y:b,xRange:k,yRange:v,labelPositions:C}=s,S=Object.keys(e.schema.on),w=new Map;for(let e=0;e<h.length;e++)w.set(h[e],e);const z=new Map;for(let e=0;e<r.length;e++)z.set(r[e],e);const D={viz:e,shapeConfig:n,events:S,x:x,y:b,xScale:u,yScale:m,xDomain:l,yDomain:d,xRange:k,yRange:v,opp:y,domains:o,stackData:c,stackKeyIndex:w,discreteKeyIndex:z,showLineLabels:_,labelWidths:f,largestLabel:g,labelPositions:C,width:p,values:[]};a.forEach(([e,i])=>{t.push(...gs({...D,values:i},e))})}
3234
+ s.push(...f.grid),s.push(...function(e,t){const i=t.filter(e=>void 0!==e.newY);if(!i.length)return[];const s=i.map(t=>n.assign({x:e._xAxis._getPosition.bind(e._xAxis)(t.xValue),y:t.defaultY},t)).concat(i.map(t=>n.assign({x:e._xAxis._getPosition.bind(e._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t))),a=Fi("Line").config({data:s,stroke:e=>e.fontColor,x:e=>e.x,y:e=>e.y}).config(e._labelConnectorConfig).renderMode("compute");return a.render(),ji(a)}(e,r));const g=As(e,s,c,h,o,u),p=function(e,t,i,s,n){const a=e.schema.discrete||"x";return{discrete:e.schema.discrete,duration:e.schema.duration,label:t=>e._drawLabel(t.data,t.i),x:e=>void 0!==e.x2?t(e.x2,"x2"):t(e.x),x0:"x"===a?e=>e.x2?t(e.x2,"x2"):t(e.x):t("number"==typeof e.schema.baseline?e.schema.baseline:s.x[0]),x1:"x"===a?null:e=>e.x2?t(e.x2,"x2"):t(e.x),y:e=>void 0!==e.y2?i(e.y2,"y2"):i(e.y),y0:"y"===a?e=>e.y2?i(e.y2,"y2"):i(e.y):i("number"==typeof e.schema.baseline?e.schema.baseline:s.y[1])-n,y1:"y"===a?null:e=>e.y2?i(e.y2,"y2"):i(e.y)-n}}
3235
+ /** Runs the main shape loop, pushing each shape's scene nodes onto `out`. */(e,c,h,o,u);return function(e,t,i,s,n){const{shapeData:a,domains:o,discreteKeys:r,stackData:c,stackKeys:h,xDomain:l,yDomain:d}=i,{xScale:u,yScale:m}=i,{labelWidths:f,largestLabel:g}=i,{width:p}=i,{opp:y,showLineLabels:_}=i,{x:x,y:b,xRange:k,yRange:v,labelPositions:C}=s,S=Object.keys(e.schema.on),w=new Map;for(let e=0;e<h.length;e++)w.set(h[e],e);const z=new Map;for(let e=0;e<r.length;e++)z.set(r[e],e);const D={viz:e,shapeConfig:n,events:S,x:x,y:b,xScale:u,yScale:m,xDomain:l,yDomain:d,xRange:k,yRange:v,opp:y,domains:o,stackData:c,stackKeyIndex:w,discreteKeyIndex:z,showLineLabels:_,labelWidths:f,largestLabel:g,labelPositions:C,width:p,values:[]};a.forEach(([e,i])=>{t.push(...Ds({...D,values:i},e))})}
3162
3236
  /** Runs shape exits in compute mode and updates `viz._previousShapes`. */(e,s,t,i,p),function(e,t,i){const s=t.map(([e])=>e);s.includes("Line")&&(e._confidence&&s.push("Area"),e._lineMarkers&&s.push("Circle")),
3163
3237
  // Run exits in compute mode so Box/Whisker/Shape don't fall through
3164
3238
  // to their body-svg / body-div fallback when `_select` is unset.
3165
3239
  // Without `.renderMode("compute")` here, every exited shape would
3166
3240
  // leak a detached <svg> (Box) or <div> (Shape) into <body>.
3167
- e._previousShapes.filter(e=>!s.includes(e)).forEach(e=>{const t=Oi(e);"function"==typeof t.renderMode&&t.renderMode("compute"),"function"==typeof t.select&&t.select(null),t.config(i).data([]).render()}),e._previousShapes=s}(e,a,p),
3241
+ e._previousShapes.filter(e=>!s.includes(e)).forEach(e=>{const t=Fi(e);"function"==typeof t.renderMode&&t.renderMode("compute"),"function"==typeof t.select&&t.select(null),t.config(i).data([]).render()}),e._previousShapes=s}(e,a,p),
3168
3242
  // Absorb queued front annotations AFTER the shape loop so they render
3169
3243
  // above shapes.
3170
- g.forEach((e,t)=>{const i=ps(e,`annotation-front-${t}`);i&&s.push(i)}),
3244
+ g.forEach((e,t)=>{const i=Ms(e,`annotation-front-${t}`);i&&s.push(i)}),
3171
3245
  // Ticks, tick labels, domain bar, and title render on top of the shapes.
3172
3246
  s.push(...f.rest),s}
3173
3247
  /**
@@ -3183,19 +3257,19 @@ s.push(...f.rest),s}
3183
3257
 
3184
3258
  @param viz The Plot instance (or any subclass: BarChart, LinePlot, …).
3185
3259
  @param pCtx Cross-phase locals produced by `Plot._draw`.
3186
- */function ks(e,t){return bs(e,t,Ui(e,t))}
3260
+ */function Ts(e,t){return Ps(e,t,es(e,t))}
3187
3261
  /**
3188
3262
  @module barBuffer
3189
3263
  Adds a buffer to either side of the non-discrete axis.
3190
3264
 
3191
3265
 
3192
3266
  @param buffer @private
3193
- */const vs=e=>Math.pow(10,Math.ceil(Math.log10(Math.abs(e))))*Math.pow(-1,e<0?1:0);
3267
+ */const Os=e=>Math.pow(10,Math.ceil(Math.log10(Math.abs(e))))*Math.pow(-1,e<0?1:0);
3194
3268
  /**
3195
3269
  @module numericBuffer
3196
3270
  @private
3197
3271
  */
3198
- function Cs(e,t,i,s,n,a,o,r){if(void 0===i||isNaN(a[0])||isNaN(a[1]))return a;if(r&&(a=a.slice().reverse(),n=n.slice().reverse()),a[0]===a[1]){if(a=a.slice(),"log"===t)(a=[(c=a[0],Math.pow(10,Math.floor(Math.log10(Math.abs(c))))*Math.pow(-1,c<0?1:0)),vs(a[0])])[1]<a[0]&&a.reverse();else{const e=Math.abs(parseFloat(a[0].toPrecision(1).replace(/[0-9]{1}$/,"1")));a[0]-=e,a[1]+=e}return e.domain(r?a.slice().reverse():a),r?a.reverse():a}var c;const h=a[0]===a[1]?10:Math.abs(Math.log(a[1]-a[0])/100),d=()=>{let n=e.copy(),a=!1;if("log"===t){let t=e.domain().slice(),i=e.range().slice();if(r&&(t=t.reverse(),i=i.reverse()),a=t[0]*t[1]<0,a){const e=l.scaleLog().domain([1e-6,Math.abs(t[o])]).range([0,1])(Math.abs(t[o?0:1])),s=e/(e+1)*(i[1]-i[0]);t=(0===o?[t[0],1e-6]:[1e-6,t[1]]).map(Math.abs),i=0===o?[i[0],i[0]+s]:[i[0]+s,i[1]]}n=l.scaleLog().domain(t).range(i)}let c=!1;const h=n.range();let d;return d=n("log"===t&&a?Math.abs(i):i),r?0===o?c=d+s>h[o]:1===o&&(c=d-s<h[o]):0===o?c=d-s<h[o]:1===o&&(c=d+s>h[o]),c};if(e.invert&&d()){const n=10;if("log"===t){let t=0;for(;t<10&&d();){const i=(0===o?-1:1)*(a[o]<0?-1:1);a[o]+=a[o]*h*i,e.domain(r?a.slice().reverse():a),t++}}else if(0===o){const t=e.invert(e(i)+(s+n)*(r?1:-1));t<a[o]&&(a[o]=t,e.domain(r?a.slice().reverse():a))}else if(1===o){const t=e.invert(e(i)+(s+n)*(r?-1:1));t>a[o]&&(a[o]=t,e.domain(r?a.slice().reverse():a))}}return r?a.reverse():a}
3272
+ function Rs(e,t,i,s,n,a,o,r){if(void 0===i||isNaN(a[0])||isNaN(a[1]))return a;if(r&&(a=a.slice().reverse(),n=n.slice().reverse()),a[0]===a[1]){if(a=a.slice(),"log"===t)(a=[(c=a[0],Math.pow(10,Math.floor(Math.log10(Math.abs(c))))*Math.pow(-1,c<0?1:0)),Os(a[0])])[1]<a[0]&&a.reverse();else{const e=Math.abs(parseFloat(a[0].toPrecision(1).replace(/[0-9]{1}$/,"1")));a[0]-=e,a[1]+=e}return e.domain(r?a.slice().reverse():a),r?a.reverse():a}var c;const h=a[0]===a[1]?10:Math.abs(Math.log(a[1]-a[0])/100),d=()=>{let n=e.copy(),a=!1;if("log"===t){let t=e.domain().slice(),i=e.range().slice();if(r&&(t=t.reverse(),i=i.reverse()),a=t[0]*t[1]<0,a){const e=l.scaleLog().domain([1e-6,Math.abs(t[o])]).range([0,1])(Math.abs(t[o?0:1])),s=e/(e+1)*(i[1]-i[0]);t=(0===o?[t[0],1e-6]:[1e-6,t[1]]).map(Math.abs),i=0===o?[i[0],i[0]+s]:[i[0]+s,i[1]]}n=l.scaleLog().domain(t).range(i)}let c=!1;const h=n.range();let d;return d=n("log"===t&&a?Math.abs(i):i),r?0===o?c=d+s>h[o]:1===o&&(c=d-s<h[o]):0===o?c=d-s<h[o]:1===o&&(c=d+s>h[o]),c};if(e.invert&&d()){const n=10;if("log"===t){let t=0;for(;t<10&&d();){const i=(0===o?-1:1)*(a[o]<0?-1:1);a[o]+=a[o]*h*i,e.domain(r?a.slice().reverse():a),t++}}else if(0===o){const t=e.invert(e(i)+(s+n)*(r?1:-1));t<a[o]&&(a[o]=t,e.domain(r?a.slice().reverse():a))}else if(1===o){const t=e.invert(e(i)+(s+n)*(r?-1:1));t>a[o]&&(a[o]=t,e.domain(r?a.slice().reverse():a))}}return r?a.reverse():a}
3199
3273
  /**
3200
3274
  @module circleBuffer
3201
3275
  Adds a buffer to either side of the non-discrete axis.
@@ -3203,14 +3277,16 @@ function Cs(e,t,i,s,n,a,o,r){if(void 0===i||isNaN(a[0])||isNaN(a[1]))return a;if
3203
3277
 
3204
3278
  @param buffer Defaults to the radius of the largest Circle.
3205
3279
  @private
3206
- */const{theme:Ss}=f,ws=[{key:"barPadding",coerce:"identity"},{key:"baseline",coerce:"identity"},{key:"lineLabels",coerce:"identity"},{key:"shapeSort",coerce:"identity"},{key:"sizeMax",coerce:"identity"},{key:"sizeMin",coerce:"identity"},{key:"sizeScale",coerce:"identity"},{key:"stacked",coerce:"identity"},{key:"xCutoff",coerce:"identity"},{key:"xDomain",coerce:"identity"},{key:"x2Domain",coerce:"identity"},{key:"xSort",coerce:"identity"},{key:"x2Sort",coerce:"identity"},{key:"yCutoff",coerce:"identity"},{key:"yDomain",coerce:"identity"},{key:"y2Domain",coerce:"identity"},{key:"ySort",coerce:"identity"},{key:"y2Sort",coerce:"identity"}],zs={Bar:function({data:e,x:i,y:s,x2:n,y2:a,buffer:o=10}){const r=n?"x2":"x",c=a?"y2":"y",h="x"===this.schema.discrete?s:i,l=h.domain().slice(),d="x"===this.schema.discrete;let u,m;if(d&&l.reverse(),this.schema.stacked){const i=t.groups(e,e=>`${e[this.schema.discrete]}_${e.group}`).map(([,e])=>e.map(e=>e[d?c:r]));m=i.map(e=>t.sum(e.filter(e=>e>0))),u=i.map(e=>t.sum(e.filter(e=>e<0)))}else{const t=e.map(e=>e[d?c:r]);m=t.filter(e=>e>0),u=t.filter(e=>e<0)}let f=h(t.max(m));(d?f<h(0):f>h(0))&&(f+=d?-o:o),f=h.invert(f);let g=h(t.min(u));return(d?g>h(0):g<h(0))&&(g+=d?o:-o),g=h.invert(g),f>l[1]&&(l[1]=f),g<l[0]&&(l[0]=g),d&&l.reverse(),h.domain(l),[i,s]}
3280
+ */
3281
+ /* eslint no-cond-assign: 0*/ // @ts-ignore
3282
+ const{theme:Ls}=f,Es=[{key:"barPadding",coerce:"identity"},{key:"baseline",coerce:"identity"},{key:"lineLabels",coerce:"identity"},{key:"shapeSort",coerce:"identity"},{key:"sizeMax",coerce:"identity"},{key:"sizeMin",coerce:"identity"},{key:"sizeScale",coerce:"identity"},{key:"stacked",coerce:"identity"},{key:"xCutoff",coerce:"identity"},{key:"xDomain",coerce:"identity"},{key:"x2Domain",coerce:"identity"},{key:"xSort",coerce:"identity"},{key:"x2Sort",coerce:"identity"},{key:"yCutoff",coerce:"identity"},{key:"yDomain",coerce:"identity"},{key:"y2Domain",coerce:"identity"},{key:"ySort",coerce:"identity"},{key:"y2Sort",coerce:"identity"}],Fs={Bar:function({data:e,x:i,y:s,x2:n,y2:a,buffer:o=10}){const r=n?"x2":"x",c=a?"y2":"y",h="x"===this.schema.discrete?s:i,l=h.domain().slice(),d="x"===this.schema.discrete;let u,m;if(d&&l.reverse(),this.schema.stacked){const i=t.groups(e,e=>`${e[this.schema.discrete]}_${e.group}`).map(([,e])=>e.map(e=>e[d?c:r]));m=i.map(e=>t.sum(e.filter(e=>e>0))),u=i.map(e=>t.sum(e.filter(e=>e<0)))}else{const t=e.map(e=>e[d?c:r]);m=t.filter(e=>e>0),u=t.filter(e=>e<0)}let f=h(t.max(m));(d?f<h(0):f>h(0))&&(f+=d?-o:o),f=h.invert(f);let g=h(t.min(u));return(d?g>h(0):g<h(0))&&(g+=d?o:-o),g=h.invert(g),f>l[1]&&(l[1]=f),g<l[0]&&(l[0]=g),d&&l.reverse(),h.domain(l),[i,s]}
3207
3283
  /**
3208
3284
  @module boxBuffer
3209
3285
  Adds a buffer to either side of the non-discrete axis.
3210
3286
 
3211
3287
 
3212
3288
  @param buffer @private
3213
- */,Box:function({data:e,x:i,y:s,x2:n,y2:a,buffer:o=10}){const r=n?"x2":"x",c=a?"y2":"y",h="x"===this.schema.discrete?s:i,l=h.domain().slice(),d="x"===this.schema.discrete;let u,m;if(d&&l.reverse(),this.schema.stacked){const i=t.groups(e,e=>e[this.schema.discrete]).map(([,e])=>e.map(e=>e[d?c:r]));m=i.map(e=>t.sum(e.filter(e=>e>0))),u=i.map(e=>t.sum(e.filter(e=>e<0)))}else m=e.map(e=>e[d?c:r]),u=m;let f=h(t.max(m));f+=d?-o:o,f=h.invert(f);let g=h(t.min(u));return g+=d?o:-o,g=h.invert(g),f>l[1]&&(l[1]=f),g<l[0]&&(l[0]=g),d&&l.reverse(),h.domain(l),[i,s]},Circle:function({data:e,x:t,y:i,x2:s,y2:n,yScale:a,xScale:o,config:r,buffer:c}){t=t.copy(),i=i.copy();const h=s?"x2":"x",l=n?"y2":"y";let d=t.domain().slice(),u=i.domain().slice();const m=t.range(),f=i.range();return!t.invert&&t.padding&&Pi(t,e,this.schema.discrete),!i.invert&&i.padding&&Pi(i,e,this.schema.discrete),(t.invert||i.invert)&&e.forEach(e=>{const s=c||2*(r?.r)(e.data,e.i);t.invert&&(d=Cs(t,o??"linear",e[h],s,m,d,0,!1),d=Cs(t,o??"linear",e[h],s,m,d,1,!1)),i.invert&&(u=Cs(i,a??"linear",e[l],s,f,u,0,!0),u=Cs(i,a??"linear",e[l],s,f,u,1,!0))}),[t,i]}
3289
+ */,Box:function({data:e,x:i,y:s,x2:n,y2:a,buffer:o=10}){const r=n?"x2":"x",c=a?"y2":"y",h="x"===this.schema.discrete?s:i,l=h.domain().slice(),d="x"===this.schema.discrete;let u,m;if(d&&l.reverse(),this.schema.stacked){const i=t.groups(e,e=>e[this.schema.discrete]).map(([,e])=>e.map(e=>e[d?c:r]));m=i.map(e=>t.sum(e.filter(e=>e>0))),u=i.map(e=>t.sum(e.filter(e=>e<0)))}else m=e.map(e=>e[d?c:r]),u=m;let f=h(t.max(m));f+=d?-o:o,f=h.invert(f);let g=h(t.min(u));return g+=d?o:-o,g=h.invert(g),f>l[1]&&(l[1]=f),g<l[0]&&(l[0]=g),d&&l.reverse(),h.domain(l),[i,s]},Circle:function({data:e,x:t,y:i,x2:s,y2:n,yScale:a,xScale:o,config:r,buffer:c}){t=t.copy(),i=i.copy();const h=s?"x2":"x",l=n?"y2":"y";let d=t.domain().slice(),u=i.domain().slice();const m=t.range(),f=i.range();return!t.invert&&t.padding&&Li(t,e,this.schema.discrete),!i.invert&&i.padding&&Li(i,e,this.schema.discrete),(t.invert||i.invert)&&e.forEach(e=>{const s=c||2*(r?.r)(e.data,e.i);t.invert&&(d=Rs(t,o??"linear",e[h],s,m,d,0,!1),d=Rs(t,o??"linear",e[h],s,m,d,1,!1)),i.invert&&(u=Rs(i,a??"linear",e[l],s,f,u,0,!0),u=Rs(i,a??"linear",e[l],s,f,u,1,!0))}),[t,i]}
3214
3290
  /**
3215
3291
  @module lineBuffer
3216
3292
  Adds a buffer to either side of the non-discrete axis.
@@ -3226,12 +3302,12 @@ function Cs(e,t,i,s,n,a,o,r){if(void 0===i||isNaN(a[0])||isNaN(a[1]))return a;if
3226
3302
 
3227
3303
  @param buffer Defaults to the width/height of the largest Rect.
3228
3304
  @private
3229
- */,Rect:function({data:e,x:t,y:i,x2:s,y2:n,yScale:a,xScale:o,config:r}){t=t.copy(),i=i.copy();const c=s?"x2":"x",h=n?"y2":"y";let l=t.domain().slice(),d=i.domain().slice();const u=t.range(),m=i.range();return!t.invert&&t.padding&&Pi(t,e,this.schema.discrete),!i.invert&&i.padding&&Pi(i,e,this.schema.discrete),(t.invert||i.invert)&&e.forEach(e=>{if(t.invert){const i=(r?.width)(e.data,e.i);l=Cs(t,o??"linear",e[c],i,u,l,0,!1),l=Cs(t,o??"linear",e[c],i,u,l,1,!1)}if(i.invert){const t=(r?.height)(e.data,e.i);d=Cs(i,a??"linear",e[h],t,m,d,0,!0),d=Cs(i,a??"linear",e[h],t,m,d,1,!0)}}),[t,i]}};
3305
+ */,Rect:function({data:e,x:t,y:i,x2:s,y2:n,yScale:a,xScale:o,config:r}){t=t.copy(),i=i.copy();const c=s?"x2":"x",h=n?"y2":"y";let l=t.domain().slice(),d=i.domain().slice();const u=t.range(),m=i.range();return!t.invert&&t.padding&&Li(t,e,this.schema.discrete),!i.invert&&i.padding&&Li(i,e,this.schema.discrete),(t.invert||i.invert)&&e.forEach(e=>{if(t.invert){const i=(r?.width)(e.data,e.i);l=Rs(t,o??"linear",e[c],i,u,l,0,!1),l=Rs(t,o??"linear",e[c],i,u,l,1,!1)}if(i.invert){const t=(r?.height)(e.data,e.i);d=Rs(i,a??"linear",e[h],t,m,d,0,!0),d=Rs(i,a??"linear",e[h],t,m,d,1,!0)}}),[t,i]}};
3230
3306
  // E4: Plot's identity-coerce accessor schema (18 keys). installFluent's
3231
3307
  // per-key idempotence lets this co-exist with vizSchema on the parent
3232
3308
  // Viz.prototype — installFluent walks the actual prototype (Plot.prototype
3233
3309
  // here) and skips keys already present.
3234
- class Ds extends $i{
3310
+ class Ws extends Oi{
3235
3311
  /**
3236
3312
  Extends the preDraw behavior of the abstract Viz class.
3237
3313
  @private
@@ -3249,7 +3325,7 @@ t!==e&&this[`_${e}Title`]===this[`_${e}Config`].title&&this.schema.discrete!==e&
3249
3325
  Composes the chart's scene graph: the native shape scenes from Viz.toScene
3250
3326
  (bars/lines/areas + labels) plus snapshots of the rendered axes, so a Plot
3251
3327
  renders fully — geometry and axes — through the @d3plus/render backends.
3252
- */toScene(){const e=$i.prototype.toScene.call(this);
3328
+ */toScene(){const e=Oi.prototype.toScene.call(this);
3253
3329
  // Skip the axis walk when an explicit empty-data render just
3254
3330
  // happened. Axes are constructor-allocated and never reset between
3255
3331
  // renders, so a previous-render's axis._select.node() still exists
@@ -3283,7 +3359,7 @@ return e.root.children.unshift(...t),e}
3283
3359
  /**
3284
3360
  Extends the draw behavior of the abstract Viz class.
3285
3361
  @private
3286
- */_draw(e){return es(this,e)}
3362
+ */_draw(e){return ns(this,e)}
3287
3363
  /**
3288
3364
  Paint phase: production axis rendering, shape buffer setup, and shape
3289
3365
  emission with event handlers. Receives all cross-phase locals from
@@ -3295,7 +3371,7 @@ return e.root.children.unshift(...t),e}
3295
3371
  // function of its inputs. `super._draw` resets `_chartScene` to []
3296
3372
  // before the paint phase, so the emit output IS the scene. Viz.toScene
3297
3373
  // wraps the collection in viz-chart-cells + zoom transform.
3298
- return this._chartScene=ks(this,e),this}
3374
+ return this._chartScene=Ts(this,e),this}
3299
3375
  /**
3300
3376
  Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
3301
3377
 
@@ -3309,7 +3385,7 @@ return this._chartScene=ks(this,e),this}
3309
3385
  */backgroundConfig(e){return arguments.length?(this._backgroundConfig=n.assign(this._backgroundConfig,e),this):this._backgroundConfig}
3310
3386
  /**
3311
3387
  Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).
3312
- */buffer(e){if(arguments.length){if(e)if(!0===e)this._buffer=zs;else{this._buffer=n.assign({},this._buffer,e);for(const e in this._buffer){const t=this._buffer;!0===t[e]&&(t[e]=zs[e])}}else this._buffer={};return this}return this._buffer}
3388
+ */buffer(e){if(arguments.length){if(e)if(!0===e)this._buffer=Fs;else{this._buffer=n.assign({},this._buffer,e);for(const e in this._buffer){const t=this._buffer;!0===t[e]&&(t[e]=Fs[e])}}else this._buffer={};return this}return this._buffer}
3313
3389
  /**
3314
3390
  The confidence interval as an array of [lower, upper] bounds.
3315
3391
 
@@ -3347,11 +3423,40 @@ return this._chartScene=ks(this,e),this}
3347
3423
  Sets the size of bubbles to the given Number, data key, or function.
3348
3424
  */size(e){return arguments.length?(this._size="function"!=typeof e&&e?F(e):e,this):this._size}
3349
3425
  /**
3350
- Sets the stack offset. If *value* is not specified, returns the current stack offset function.
3351
- */stackOffset(e){return arguments.length?(this._stackOffset="function"==typeof e?e:P[`stackOffset${e.charAt(0).toUpperCase()+e.slice(1)}`],this):this._stackOffset}
3352
- /**
3353
- Sets the stack order. If *value* is not specified, returns the current stack order function.
3354
- */stackOrder(e){return arguments.length?(this._stackOrder="string"==typeof e?"ascending"===e?cs:"descending"===e?hs:P[`stackOrder${e.charAt(0).toUpperCase()+e.slice(1)}`]:e,this):this._stackOrder}
3426
+ Sets the vertical offset applied to stacked series. Accepts a named
3427
+ offset — `"diverging"` (default), `"none"`, `"expand"`, `"silhouette"`,
3428
+ or `"wiggle"` — or a custom offset function. Unknown names warn and fall
3429
+ back to `"diverging"`. If *value* is not specified, returns the current
3430
+ stack offset function.
3431
+ */stackOffset(e){return arguments.length?(this._stackOffset="function"==typeof(t=e)?t:"string"==typeof t&&t in ks?ks[t]:(console.warn(`[d3plus] Unknown stackOffset "${t}". Expected one of: ${vs.join(", ")}; or an offset function. Falling back to "diverging".`),bs),this):this._stackOffset;
3432
+ /**
3433
+ Normalizes a `stackOffset` input into an offset function. Warns and falls
3434
+ back to the diverging default on an unrecognized name.
3435
+ */
3436
+ var t}
3437
+ /**
3438
+ Sets the order of stacked series, from the bottom of the stack upward.
3439
+ Accepts:
3440
+ - a named order: `"descending"` (default) / `"ascending"` by summed
3441
+ value, `"key"` / `"keyReverse"` alphabetically by series key,
3442
+ `"none"` / `"data"` for input order, or d3's `"insideOut"`,
3443
+ `"appearance"`, `"reverse"`;
3444
+ - an Array of series keys for an explicit order;
3445
+ - a value accessor, or a `{value, order}` config, to rank series by an
3446
+ aggregate of any data field.
3447
+
3448
+ Unknown named strings warn and fall back to `"descending"`. If *value*
3449
+ is not specified, returns the current stack order.
3450
+ */stackOrder(e){return arguments.length?(this._stackOrder=
3451
+ /**
3452
+ Normalizes any `stackOrder` input into a value Plot's pipeline can apply:
3453
+ a tagged comparator, or an explicit array of series keys. Warns and falls
3454
+ back to the default on an unrecognized name.
3455
+ */
3456
+ function(e){if("function"==typeof e)
3457
+ // Already-resolved order (constructor default / config() reset) passes
3458
+ // through; a bare user function is treated as a value accessor.
3459
+ return e.__d3plusStackOrder?e:ys(e);if(Array.isArray(e))return e;if(e&&"object"==typeof e){const{value:t,order:i}=e;return ys("function"==typeof t?t:F(t),i)}return"string"==typeof e?e in _s?_s[e]:(console.warn(`[d3plus] Unknown stackOrder "${e}". Expected one of: ${xs.join(", ")}; an array of series keys; a value accessor; or a {value, order} config. Falling back to "descending".`),fs):fs}(e),this):this._stackOrder}
3355
3460
  /**
3356
3461
  Accessor function or string key for the x-axis value of each data point.
3357
3462
  */x(e){return arguments.length?("function"==typeof e?this._x=e:(this._x=F(e),this._xKey=e),this):this._x}
@@ -3385,62 +3490,62 @@ return this._chartScene=ks(this,e),this}
3385
3490
  // E4: install identity-coerce accessors on Plot.prototype. Defaults
3386
3491
  // are still applied below imperatively from plotDef; installFluent
3387
3492
  // skips slots that are already set, so the constructor wins.
3388
- re(this,ws);
3493
+ re(this,Es);
3389
3494
  // E3: scalar defaults sourced from plotDef.
3390
- const e=Xi.defaults;this._axisPersist=e.axisPersist,this._annotations=e.annotations,this._backgroundConfig={duration:0,fill:"transparent"},this.schema.barPadding=e.barPadding,this._buffer=n.assign({},zs,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(e,t)=>"function"==typeof this.schema.shapeConfig.Line.stroke?this.schema.shapeConfig.Line.stroke(e,t):this.schema.shapeConfig.Line.stroke,fillOpacity:L(.5)},this._discreteCutoff=e.discreteCutoff,this._groupPadding=e.groupPadding,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=L("auto"),this._lineMarkerConfig={fill:(e,t)=>u.colorAssign(this._id(e,t)),r:L(3)},this._lineMarkers=e.lineMarkers,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this.schema.shape=e.shape,this.schema.shapeConfig=n.assign(this.schema.shapeConfig,os.call(this)),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this.schema.shapeSort=(e,t)=>this._shapeOrder.indexOf(e)-this._shapeOrder.indexOf(t),this.schema.sizeMax=20,this.schema.sizeMin=5,this.schema.sizeScale="sqrt",this._stackOffset=ls,this._stackOrder=hs,this.schema.timelineConfig=n.assign(this.schema.timelineConfig,{brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=F("x"),this._xKey="x",this._xAxis=(new bt).align("end"),
3495
+ const e=Qi.defaults;this._axisPersist=e.axisPersist,this._annotations=e.annotations,this._backgroundConfig={duration:0,fill:"transparent"},this.schema.barPadding=e.barPadding,this._buffer=n.assign({},Fs,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(e,t)=>"function"==typeof this.schema.shapeConfig.Line.stroke?this.schema.shapeConfig.Line.stroke(e,t):this.schema.shapeConfig.Line.stroke,fillOpacity:L(.5)},this._discreteCutoff=e.discreteCutoff,this._groupPadding=e.groupPadding,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=L("auto"),this._lineMarkerConfig={fill:(e,t)=>u.colorAssign(this._id(e,t)),r:L(3)},this._lineMarkers=e.lineMarkers,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this.schema.shape=e.shape,this.schema.shapeConfig=n.assign(this.schema.shapeConfig,ls.call(this)),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this.schema.shapeSort=(e,t)=>this._shapeOrder.indexOf(e)-this._shapeOrder.indexOf(t),this.schema.sizeMax=20,this.schema.sizeMin=5,this.schema.sizeScale="sqrt",this._stackOffset=bs,this._stackOrder=fs,this.schema.timelineConfig=n.assign(this.schema.timelineConfig,{brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=F("x"),this._xKey="x",this._xAxis=(new St).align("end"),
3391
3496
  // _xTest/_yTest/_x2Test/_y2Test are NOT persistent fields anymore. The
3392
3497
  // measure-only test axes are allocated as locals inside `_draw` and
3393
3498
  // garbage-collected after each draw — proving Plot doesn't need to
3394
3499
  // own a long-lived Axis instance just for layout. See measureAxis()
3395
3500
  // in axisLayout.ts for the standalone shape.
3396
- this._xConfig={gridConfig:{stroke:e=>{if(this.schema.discrete&&"x"===this.schema.discrete.charAt(0))return"transparent";const t=this._xAxis.range(),i=this._xAxis._getPosition.bind(this._xAxis)(e.id);if(t[0]===i)return"transparent";const s=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(s)===u.colorDefaults.dark?Ss.colors.gray[200]:Ss.colors.gray[600]}}},this.schema.xCutoff=150,this._x2=F("x2"),this._x2Key="x2",this._x2Axis=(new Ct).align("start"),this._x2Config={},this._y=F("y"),this._yKey="y",this._yAxis=(new kt).align("start"),this._yKey="y",this._yConfig={gridConfig:{stroke:e=>{if(this.schema.discrete&&"y"===this.schema.discrete.charAt(0))return"transparent";const t=this._yAxis.range(),i=this._yAxis._getPosition.bind(this._yAxis)(e.id);if(t[t.length-1]===i)return"transparent";const s=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(s)===u.colorDefaults.dark?Ss.colors.gray[200]:Ss.colors.gray[600]}}},this.schema.yCutoff=150,this._y2=F("y2"),this._y2Key="y2",this._y2Axis=(new vt).align("end"),this._y2Config={}}}
3501
+ this._xConfig={gridConfig:{stroke:e=>{if(this.schema.discrete&&"x"===this.schema.discrete.charAt(0))return"transparent";const t=this._xAxis.range(),i=this._xAxis._getPosition.bind(this._xAxis)(e.id);if(t[0]===i)return"transparent";const s=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(s)===u.colorDefaults.dark?Ls.colors.gray[200]:Ls.colors.gray[600]}}},this.schema.xCutoff=150,this._x2=F("x2"),this._x2Key="x2",this._x2Axis=(new Dt).align("start"),this._x2Config={},this._y=F("y"),this._yKey="y",this._yAxis=(new wt).align("start"),this._yKey="y",this._yConfig={gridConfig:{stroke:e=>{if(this.schema.discrete&&"y"===this.schema.discrete.charAt(0))return"transparent";const t=this._yAxis.range(),i=this._yAxis._getPosition.bind(this._yAxis)(e.id);if(t[t.length-1]===i)return"transparent";const s=this._select?n.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return u.colorContrast(s)===u.colorDefaults.dark?Ls.colors.gray[200]:Ls.colors.gray[600]}}},this.schema.yCutoff=150,this._y2=F("y2"),this._y2Key="y2",this._y2Axis=(new zt).align("end"),this._y2Config={}}}
3397
3502
  /**
3398
3503
  Creates an area plot based on an array of data.
3399
3504
  */
3400
- var Ms=Bi({name:"AreaPlot",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"baseline",default:0},{key:"discrete",default:"x"},{key:"shape",default:L("Area")}]},Ds);
3505
+ var Ns=Ri({name:"AreaPlot",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"baseline",default:0},{key:"discrete",default:"x"},{key:"shape",default:L("Area"),coerce:"const"}]},Ws);
3401
3506
  /**
3402
3507
  Creates a bar chart based on an array of data.
3403
3508
  */
3404
- var As=Bi({name:"BarChart",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"baseline",default:0},{key:"discrete",default:"x"},{key:"shape",default:L("Bar")},{key:"legend",factory:e=>{const t=e.schema.legend;return(i,s)=>s.map(e.schema.groupBy[e._legendDepth].bind(e)).sort().join()!==e._filteredData.map(e.schema.groupBy[e._legendDepth].bind(e)).sort().join()&&t.call(e,i,s)}}]},Ds);
3509
+ var Hs=Ri({name:"BarChart",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"baseline",default:0},{key:"discrete",default:"x"},{key:"shape",default:L("Bar"),coerce:"const"},{key:"legend",coerce:"const",factory:e=>{const t=e.schema.legend;return(i,s)=>s.map(e.schema.groupBy[e._legendDepth].bind(e)).sort().join()!==e._filteredData.map(e.schema.groupBy[e._legendDepth].bind(e)).sort().join()&&t.call(e,i,s)}}]},Ws);
3405
3510
  /**
3406
3511
  Creates a simple box and whisker based on an array of data.
3407
3512
  */
3408
- var $s=Bi({name:"BoxWhisker",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"discrete",default:"x"},{key:"shape",default:L("Box")},{key:"tooltipConfig",merge:!0,factory:e=>({title:(t,i)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)i=(t=t.data).i;const s=e.schema.label;if(s)return s(t,i);const n=e._ids(t,i).slice(0,e._drawDepth);return n[n.length-1]}})}]},Ds);const Bs={name:"BumpChart",paintDriven:!0,features:[ee,Q,Z,ne],setup:e=>{const t=e;t.y2((t,i)=>e._y(t,i)),t.yConfig({tickFormat:t=>{const i=e._formattedData??[],s=i[0].x instanceof Date?i[0].x.getTime():i[0].x,n=i.filter(e=>(e.x instanceof Date?e.x.getTime():e.x)===s),a=n.find(e=>e.y===t);return a?e._drawLabel(a,a.i):""}}),t.y2Config({tickFormat:t=>{const i=e._formattedData??[],s=i[i.length-1].x instanceof Date?i[i.length-1].x.getTime():i[i.length-1].x,n=i.filter(e=>(e.x instanceof Date?e.x.getTime():e.x)===s),a=n.find(e=>e.y===t);return a?e._drawLabel(a,a.i):""}}),t.ySort((t,i)=>e._y(i)-e._y(t)),t.y2Sort((t,i)=>e._y(i)-e._y(t))},ctx:{},fields:[{key:"discrete",default:"x"},{key:"shape",default:L("Line")}]};
3513
+ var js=Ri({name:"BoxWhisker",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"discrete",default:"x"},{key:"shape",default:L("Box"),coerce:"const"},{key:"tooltipConfig",merge:!0,factory:e=>({title:(t,i)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)i=(t=t.data).i;const s=e.schema.label;if(s)return s(t,i);const n=e._ids(t,i).slice(0,e._drawDepth);return n[n.length-1]}})}]},Ws);const Gs={name:"BumpChart",paintDriven:!0,features:[ee,Q,Z,ne],setup:e=>{const t=e;t.y2((t,i)=>e._y(t,i)),t.yConfig({tickFormat:t=>{const i=e._formattedData??[],s=i[0].x instanceof Date?i[0].x.getTime():i[0].x,n=i.filter(e=>(e.x instanceof Date?e.x.getTime():e.x)===s),a=n.find(e=>e.y===t);return a?e._drawLabel(a,a.i):""}}),t.y2Config({tickFormat:t=>{const i=e._formattedData??[],s=i[i.length-1].x instanceof Date?i[i.length-1].x.getTime():i[i.length-1].x,n=i.filter(e=>(e.x instanceof Date?e.x.getTime():e.x)===s),a=n.find(e=>e.y===t);return a?e._drawLabel(a,a.i):""}}),t.ySort((t,i)=>e._y(i)-e._y(t)),t.y2Sort((t,i)=>e._y(i)-e._y(t))},ctx:{},fields:[{key:"discrete",default:"x"},{key:"shape",default:L("Line"),coerce:"const"}]};
3409
3514
  /**
3410
3515
  Creates a bump chart based on an array of data.
3411
- */var Ps=Bi(Bs,Ds);const Ts=({viz:e})=>{const{width:t,height:i}=le(e),s=Math.min(t,i)/2,n=e.ctx.pie,a=e.schema.padAngle??0,o=e.schema.padPixel??0,r=e.schema.sort,c=e.schema.value,h=n.padAngle(a||o/s).sort(r).value(c)(e._filteredData),l=h.reduce((e,t)=>e+t.value,0);h.forEach((e,t)=>{e.__d3plus__=!0,e.i=t;
3516
+ */var Is=Ri(Gs,Ws);const qs=({viz:e})=>{const{width:t,height:i}=le(e),s=Math.min(t,i)/2,n=e.ctx.pie,a=e.schema.padAngle??0,o=e.schema.padPixel??0,r=e.schema.sort,c=e.schema.value,h=n.padAngle(a||o/s).sort(r).value(c)(e._filteredData),l=h.reduce((e,t)=>e+t.value,0);h.forEach((e,t)=>{e.__d3plus__=!0,e.i=t;
3412
3517
  // The tooltip binds the unwrapped row, so the slice's share of the total
3413
3518
  // must live on the row for the tooltip accessor to read it. Mirrors
3414
3519
  // Treemap stamping `share` onto `d.data`.
3415
- const i=l?e.value/l:0;e.share=i,e.data.share=i});const d=e.schema.innerRadius;return e.ctx.arcData=P.arc().innerRadius("function"==typeof d?d:()=>d).outerRadius(s),e.ctx.pieData=h,e.ctx.pieWidth=t,e.ctx.pieHeight=i,{shapeData:h}},Os={fontMin:8,fontMax:50,fontResize:!0,padding:5,textAnchor:"start",verticalAlign:"top",
3520
+ const i=l?e.value/l:0;e.share=i,e.data.share=i});const d=e.schema.innerRadius;return e.ctx.arcData=P.arc().innerRadius("function"==typeof d?d:()=>d).outerRadius(s),e.ctx.pieData=h,e.ctx.pieWidth=t,e.ctx.pieHeight=i,{shapeData:h}},Ys={fontMin:8,fontMax:50,fontResize:!0,padding:5,textAnchor:"start",verticalAlign:"top",
3416
3521
  // Honor the rotation/anchor `buildLabelData` precomputes onto each record
3417
3522
  // (`.r` / `.rotateAnchor`). TextBox's `rotate` accessor receives the raw
3418
3523
  // label record; `rotateAnchor` receives the laid-out datum whose `.data`
3419
3524
  // is that record — so both shapes are checked.
3420
3525
  rotate(e){const t=e.r??e.data?.r;return"number"==typeof t?t:0},rotateAnchor(e){const t=e.rotateAnchor??e.data?.rotateAnchor;return Array.isArray(t)?t:[(e.w??0)/2,(e.h??0)/2]},fontColor(e,t){const i="function"==typeof this._fill?this._fill(e,t):this._fill;return"string"==typeof i?u.colorContrast(i):"black"}};
3421
- /** Defaults that match Shape's `_labelConfig` so chart emits look like Shape labels. */function Rs(e){const t=Te(e);if(!t.length)return[];const i=(new Wt).config({...Os,...e.labelConfig??{}}).data(t).renderMode("compute");try{const e=i.toScene();return Array.isArray(e?.children)?e.children:[]}catch{return[]}}function Ls(e,t,i){return"function"==typeof e?e(t,i):e}const Es={name:"Pie",features:[ee,Q,Z,ne],layoutStage:Ts,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.arcData,n=e.schema.shapeConfig??{};return[...i.map(t=>{const i=Ls(n.fill,t.data,t.i??0),a=Ls(n.stroke,t.data,t.i??0),o=Ls(n.strokeWidth,t.data,t.i??0);return{type:"path",key:`pie-${e._ids(t.data,t.i??0).join("-")}`,d:s(t),datum:t.data,paint:{fill:"string"==typeof i?i:void 0,stroke:a,strokeWidth:o}}}),...Rs({data:i,label:(t,s)=>e._drawLabel(i[s].data,i[s].i??s),
3526
+ /** Defaults that match Shape's `_labelConfig` so chart emits look like Shape labels. */function Ks(e){const t=Te(e);if(!t.length)return[];const i=(new Gt).config({...Ys,...e.labelConfig??{}}).data(t).renderMode("compute");try{const e=i.toScene();return Array.isArray(e?.children)?e.children:[]}catch{return[]}}function Xs(e,t,i){return"function"==typeof e?e(t,i):e}const Vs={name:"Pie",features:[ee,Q,Z,ne],layoutStage:qs,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.arcData,n=e.schema.shapeConfig??{};return[...i.map(t=>{const i=Xs(n.fill,t.data,t.i??0),a=Xs(n.stroke,t.data,t.i??0),o=Xs(n.strokeWidth,t.data,t.i??0);return{type:"path",key:`pie-${e._ids(t.data,t.i??0).join("-")}`,d:s(t),datum:t.data,paint:{fill:"string"==typeof i?i:void 0,stroke:a,strokeWidth:o}}}),...Ks({data:i,label:(t,s)=>e._drawLabel(i[s].data,i[s].i??s),
3422
3527
  // The largest inscribed rectangle is in chart-centered path coordinates,
3423
3528
  // so the anchor is the origin and labelBounds carries the absolute box.
3424
- x:()=>0,y:()=>0,aes:()=>({}),rotate:L(0),id:(e,t)=>`pie-label-${t}`,labelBounds:(e,t)=>{const n=y.largestRect(y.path2polygon(s(i[t])),{angle:0});return!!n&&{angle:n.angle,width:n.width,height:n.height,x:n.cx-n.width/2,y:n.cy-n.height/2}},labelConfig:{fontColor:e=>{const t=e.data??e,i=Ls(n.fill,t.data,t.i??0);return u.colorContrast("string"==typeof i?i:"rgb(255, 255, 255)")},fontResize:!0,textAnchor:"middle",verticalAlign:"middle"}})]},chartTransform:e=>de(e,e.ctx.pieWidth,e.ctx.pieHeight),ctx:{pie:p.pie()},fields:[{key:"innerRadius",default:0},{key:"padAngle"},{key:"padPixel",default:0},{key:"value",default:F("value"),coerce:e=>"function"==typeof e?e:F(e)},{key:"sort",factory:e=>{const t=e.schema.value;return(e,i)=>t(i)-t(e)}},{key:"legendSort",factory:e=>{const t=e.schema.value;return(e,i)=>t(i)-t(e)}},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e.ctx.pieData;return s?`${++s[i].index}. ${e._drawLabel(t,i)}, ${e.schema.value(t,i)}.`:""},Path:{labelConfig:{fontResize:!0}}})},{key:"tooltipConfig",merge:!0,factory:e=>({tbody:[[()=>e.schema.translate("Share"),(t,i,s)=>{
3529
+ x:()=>0,y:()=>0,aes:()=>({}),rotate:L(0),id:(e,t)=>`pie-label-${t}`,labelBounds:(e,t)=>{const n=p.largestRect(p.path2polygon(s(i[t])),{angle:0});return!!n&&{angle:n.angle,width:n.width,height:n.height,x:n.cx-n.width/2,y:n.cy-n.height/2}},labelConfig:{fontColor:e=>{const t=e.data??e,i=Xs(n.fill,t.data,t.i??0);return u.colorContrast("string"==typeof i?i:"rgb(255, 255, 255)")},fontResize:!0,textAnchor:"middle",verticalAlign:"middle"}})]},chartTransform:e=>de(e,e.ctx.pieWidth,e.ctx.pieHeight),ctx:{pie:y.pie()},fields:[{key:"innerRadius",default:0},{key:"padAngle"},{key:"padPixel",default:0},{key:"value",default:F("value"),coerce:e=>"function"==typeof e?e:F(e)},{key:"sort",factory:e=>{const t=e.schema.value;return(e,i)=>t(i)-t(e)}},{key:"legendSort",factory:e=>{const t=e.schema.value;return(e,i)=>t(i)-t(e)}},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e.ctx.pieData;return s?`${++s[i].index}. ${e._drawLabel(t,i)}, ${e.schema.value(t,i)}.`:""},Path:{labelConfig:{fontResize:!0}}})},{key:"tooltipConfig",merge:!0,factory:e=>({tbody:[[()=>e.schema.translate("Share"),(t,i,s)=>{
3425
3530
  // A ColorScale range swatch carries no per-row share, so sum the
3426
3531
  // share of every datum that falls in its color range.
3427
3532
  if(s._isColorScaleBucket){const t=ye(e,s.color,e.schema.value);return null==t?"":`${m.formatAbbreviate(100*t,e.schema.locale)}%`}
3428
3533
  // A Legend bucket aggregates multiple rows, so `share` arrives
3429
3534
  // as an array of the members' shares — sum it; a single cell's
3430
3535
  // share is a plain number.
3431
- const n=Array.isArray(s.share)?s.share.reduce((e,t)=>e+t,0):s.share;return Number.isFinite(n)?`${m.formatAbbreviate(100*n,e.schema.locale)}%`:""}]]})},{key:"legend",factory:e=>{const t=e.schema.legend;return(i,s)=>s.length!==e._filteredData.length&&t.call(e,i,s)}}]};
3536
+ const n=Array.isArray(s.share)?s.share.reduce((e,t)=>e+t,0):s.share;return Number.isFinite(n)?`${m.formatAbbreviate(100*n,e.schema.locale)}%`:""}]]})},{key:"legend",coerce:"const",factory:e=>{const t=e.schema.legend;return(i,s)=>s.length!==e._filteredData.length&&t.call(e,i,s)}}]};
3432
3537
  /**
3433
3538
  Uses the d3 pie layout to create SVG arcs based on an array of data.
3434
3539
  */
3435
- var Fs=Bi(Es);
3540
+ var Us=Ri(Vs);
3436
3541
  /**
3437
3542
  Extends the Pie visualization to create a donut chart.
3438
3543
  */
3439
- var Ws=Bi({name:"Donut",
3544
+ var Js=Ri({name:"Donut",
3440
3545
  // Inherits Pie's full pipeline (features + emit). Donut adds no
3441
3546
  // chart-specific layout stage of its own — `super._draw` (Pie's)
3442
3547
  // handles the layout.
3443
- features:Es.features,emit:Es.emit,ctx:{},fields:[{key:"padPixel",default:2},{key:"innerRadius",factory:e=>()=>{const{width:i,height:s}=le(e);return(t.min([i,s])??0)/4}}]},Fs);const Ns=[{matches:["cartodb","cartocdn"],text:"© <a href='http://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors, © <a href='https://carto.com/attribution' target='_blank'>CARTO</a>"},{matches:["opentopomap.org"],text:"© <a href='http://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors"},{matches:["arcgisonline.com"],text:"Powered by <a href='https://developers.arcgis.com/terms/attribution/' target='_blank'>Esri</a>"},{matches:["/watercolor/"],text:"Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://www.openstreetmap.org/copyright' target='_blank'>ODbL</a>."},{matches:["stamen-tiles","stamen.com"],text:"Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0' target='_blank'>CC BY SA</a>."}];
3548
+ features:Vs.features,emit:Vs.emit,ctx:{},fields:[{key:"padPixel",default:2},{key:"innerRadius",factory:e=>()=>{const{width:i,height:s}=le(e);return(t.min([i,s])??0)/4}}]},Us);const Qs=[{matches:["cartodb","cartocdn"],text:"© <a href='http://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors, © <a href='https://carto.com/attribution' target='_blank'>CARTO</a>"},{matches:["opentopomap.org"],text:"© <a href='http://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors"},{matches:["arcgisonline.com"],text:"Powered by <a href='https://developers.arcgis.com/terms/attribution/' target='_blank'>Esri</a>"},{matches:["/watercolor/"],text:"Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://www.openstreetmap.org/copyright' target='_blank'>ODbL</a>."},{matches:["stamen-tiles","stamen.com"],text:"Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0' target='_blank'>CC BY SA</a>."}];
3444
3549
  /**
3445
3550
  `ensureZoomDom(viz, kind)` — sets up the inner `<svg>` + zoom group +
3446
3551
  hitArea that d3-zoom and tile-loading need.
@@ -3463,32 +3568,32 @@ features:Es.features,emit:Es.emit,ctx:{},fields:[{key:"padPixel",default:2},{key
3463
3568
  scene-graph-native interaction path (renderer.on(...) dispatch +
3464
3569
  tile-data → image scene nodes) would let this go away; until then,
3465
3570
  it's the documented home for the imperative half of v4 zoom.
3466
- */function Hs(e,t){const{kind:i,width:s,height:n,duration:a,ocean:o}=t,r="network"===i?"d3plus-network":"d3plus-geomap",c="geomap"===i&&o||"transparent";let h=e._select.selectAll(`svg.${r}`).data([0]);if(h=h.enter().append("svg").attr("class",r).attr("opacity",0).attr("width",s).attr("height",n).attr("x",e._margin.left).attr("y",e._margin.top).style("background-color",c).merge(h),e._container=h,h.transition().duration(a).attr("opacity",1).attr("width",s).attr("height",n).attr("x",e._margin.left).attr("y",e._margin.top),"network"===i){
3571
+ */function Zs(e,t){const{kind:i,width:s,height:n,duration:a,ocean:o}=t,r="network"===i?"d3plus-network":"d3plus-geomap",c="geomap"===i&&o||"transparent";let h=e._select.selectAll(`svg.${r}`).data([0]);if(h=h.enter().append("svg").attr("class",r).attr("opacity",0).attr("width",s).attr("height",n).attr("x",e._margin.left).attr("y",e._margin.top).style("background-color",c).merge(h),e._container=h,h.transition().duration(a).attr("opacity",1).attr("width",s).attr("height",n).attr("x",e._margin.left).attr("y",e._margin.top),"network"===i){
3467
3572
  // Hit-area for "click outside any node" → reset focus + zoom.
3468
3573
  const t=h.selectAll(`rect.${r}-hitArea`).data([0]);t.enter().append("rect").attr("class",`${r}-hitArea`).merge(t).attr("width",s).attr("height",n).attr("fill","transparent").on("click",()=>{e._focus&&(e.active(!1),e._focus=void 0,e._zoomToBounds(null))});let i=h.selectAll(`g.${r}-zoomGroup`).data([0]);i=i.enter().append("g").attr("class",`${r}-zoomGroup`).merge(i),e._zoomGroup=i}else{
3469
3574
  // Geomap also needs an ocean rect (under tiles + paths) and the tile
3470
3575
  // group that `_renderTiles` mutates with map imagery.
3471
- const t=h.selectAll(`rect.${r}-ocean`).data([0]);t.enter().append("rect").attr("class",`${r}-ocean`).merge(t).attr("width",s).attr("height",n).attr("fill",o||"transparent");let i=h.selectAll(`g.${r}-tileGroup`).data([0]);i=i.enter().append("g").attr("class",`${r}-tileGroup`).merge(i),e._tileGroup=i;let a=h.selectAll(`g.${r}-zoomGroup`).data([0]);a=a.enter().append("g").attr("class",`${r}-zoomGroup`).merge(a),e._zoomGroup=a}}function js(e,t){const i=t&&e.objects[t]?t:Object.keys(e.objects)[0];return w.feature(e,i)}
3472
- /** Reduces fit features, trimming far-flung MultiPolygon parts via path geometry. */const Gs=({viz:e})=>{const i=e,s=e.ctx,{width:n,height:a}=le(i),o=i.schema.topojson?js(i.schema.topojson,i.schema.topojsonKey):{type:"FeatureCollection",features:[]};s.coordData=o,i.schema.topojsonFilter&&(o.features=o.features.filter(i.schema.topojsonFilter));const r=T.geoPath().projection(i.schema.projection);s.path=r;const c=i._filteredData.filter((e,t)=>i.schema.point(e,t)instanceof Array),h=i._filteredData.filter((e,t)=>!(i.schema.point(e,t)instanceof Array)).reduce((e,t,s)=>(e[i._id(t,s)]=t,e),{}),l=o.features.reduce((e,t)=>{const s=i.schema.topojsonId(t);return e.push({__d3plus__:!0,data:h[s],feature:t,id:s}),e},[]),d=`scale${i.schema.pointSizeScale.charAt(0).toUpperCase()}${i.schema.pointSizeScale.slice(1)}`,u=B[d]().domain(t.extent(c,(e,t)=>i.schema.pointSize(e,t))).range([i.schema.pointSizeMin,i.schema.pointSizeMax]);if(!i._zoomSet||!s.extentBounds){const e=i.schema.fitObject?js(i.schema.fitObject,i.schema.fitKey):o;s.extentBounds={type:"FeatureCollection",features:i.schema.fitFilter?e.features.filter(i.schema.fitFilter):e.features.slice()},s.extentBounds.features=function(e,i){return e.reduce((e,s)=>{const n=s;if(!n.geometry)return e;const a={type:n.type,id:n.id,geometry:{coordinates:n.geometry.coordinates,type:n.geometry.type}};if("MultiPolygon"===n.geometry.type&&n.geometry.coordinates.length>1){const e=[],s=[];n.geometry.coordinates.forEach(t=>{a.geometry.coordinates=[t],e.push(i.area(a))}),a.geometry.coordinates=[n.geometry.coordinates[e.indexOf(t.max(e))]];const o=i.centroid(a);n.geometry.coordinates.forEach(e=>{a.geometry.coordinates=[e],s.push(y.pointDistance(i.centroid(a),o))});const r=t.quantile(e.reduce((t,i,n)=>(s[n]&&t.push(e[n]/s[n]),t),[]),.9);a.geometry.coordinates=n.geometry.coordinates.filter((t,i)=>{const n=s[i];return 0===n||e[i]/n>=r})}return e.push(a),e},[])}
3473
- /** Builds projected-point extent bounds + padding when no fit features exist. */(s.extentBounds.features,r),!s.extentBounds.features.length&&c.length&&function(e,i,s,n){const a=[[void 0,void 0],[void 0,void 0]];s.forEach((t,i)=>{const s=e.schema.projection(e.schema.point(t,i));(void 0===a[0][0]||s[0]<a[0][0])&&(a[0][0]=s[0]),(void 0===a[1][0]||s[0]>a[1][0])&&(a[1][0]=s[0]),(void 0===a[0][1]||s[1]<a[0][1])&&(a[0][1]=s[1]),(void 0===a[1][1]||s[1]>a[1][1])&&(a[1][1]=s[1])}),i.extentBounds={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"MultiPoint",coordinates:a.map(t=>e.schema.projection.invert(t))}}]};const o=t.max(s,(t,i)=>n(e.schema.pointSize(t,i)));i.effectivePadding={top:e.schema.projectionPadding.top+o,right:e.schema.projectionPadding.right+o,bottom:e.schema.projectionPadding.bottom+o,left:e.schema.projectionPadding.left+o}}(i,s,c,u)}const m=s.effectivePadding||i.schema.projectionPadding;return s.effectivePadding=void 0,i.schema.projection=i.schema.projection.fitExtent(s.extentBounds.features.length?[[m.left,m.top],[n-m.right,a-m.bottom]]:[[0,0],[n,a]],s.extentBounds.features.length?s.extentBounds:{type:"Sphere"}),s.geomapWidth=n,s.geomapHeight=a,s.geomapCtx={topoData:l,pathFn:e=>r(e.feature),pointData:c,pointR:(e,t)=>u(i.schema.pointSize(e,t)),pointSort:(e,t)=>i.schema.pointSize(t)-i.schema.pointSize(e),pointX:(e,t)=>i.schema.projection(i.schema.point(e,t))[0],pointY:(e,t)=>i.schema.projection(i.schema.point(e,t))[1]},{shapeData:l}},Is=Object.assign({},T,O,R);function qs(e){const t=Ns.find(t=>t.matches.some(t=>e.includes(t)));return!!t&&t.text}
3576
+ const t=h.selectAll(`rect.${r}-ocean`).data([0]);t.enter().append("rect").attr("class",`${r}-ocean`).merge(t).attr("width",s).attr("height",n).attr("fill",o||"transparent");let i=h.selectAll(`g.${r}-tileGroup`).data([0]);i=i.enter().append("g").attr("class",`${r}-tileGroup`).merge(i),e._tileGroup=i;let a=h.selectAll(`g.${r}-zoomGroup`).data([0]);a=a.enter().append("g").attr("class",`${r}-zoomGroup`).merge(a),e._zoomGroup=a}}function en(e,t){const i=t&&e.objects[t]?t:Object.keys(e.objects)[0];return w.feature(e,i)}
3577
+ /** Reduces fit features, trimming far-flung MultiPolygon parts via path geometry. */const tn=({viz:e})=>{const i=e,s=e.ctx,{width:n,height:a}=le(i),o=i.schema.topojson?en(i.schema.topojson,i.schema.topojsonKey):{type:"FeatureCollection",features:[]};s.coordData=o,i.schema.topojsonFilter&&(o.features=o.features.filter(i.schema.topojsonFilter));const r=T.geoPath().projection(i.schema.projection);s.path=r;const c=i._filteredData.filter((e,t)=>i.schema.point(e,t)instanceof Array),h=i._filteredData.filter((e,t)=>!(i.schema.point(e,t)instanceof Array)).reduce((e,t,s)=>(e[i._id(t,s)]=t,e),{}),l=o.features.reduce((e,t)=>{const s=i.schema.topojsonId(t);return e.push({__d3plus__:!0,data:h[s],feature:t,id:s}),e},[]),d=`scale${i.schema.pointSizeScale.charAt(0).toUpperCase()}${i.schema.pointSizeScale.slice(1)}`,u=B[d]().domain(t.extent(c,(e,t)=>i.schema.pointSize(e,t))).range([i.schema.pointSizeMin,i.schema.pointSizeMax]);if(!i._zoomSet||!s.extentBounds){const e=i.schema.fitObject?en(i.schema.fitObject,i.schema.fitKey):o;s.extentBounds={type:"FeatureCollection",features:i.schema.fitFilter?e.features.filter(i.schema.fitFilter):e.features.slice()},s.extentBounds.features=function(e,i){return e.reduce((e,s)=>{const n=s;if(!n.geometry)return e;const a={type:n.type,id:n.id,geometry:{coordinates:n.geometry.coordinates,type:n.geometry.type}};if("MultiPolygon"===n.geometry.type&&n.geometry.coordinates.length>1){const e=[],s=[];n.geometry.coordinates.forEach(t=>{a.geometry.coordinates=[t],e.push(i.area(a))}),a.geometry.coordinates=[n.geometry.coordinates[e.indexOf(t.max(e))]];const o=i.centroid(a);n.geometry.coordinates.forEach(e=>{a.geometry.coordinates=[e],s.push(p.pointDistance(i.centroid(a),o))});const r=t.quantile(e.reduce((t,i,n)=>(s[n]&&t.push(e[n]/s[n]),t),[]),.9);a.geometry.coordinates=n.geometry.coordinates.filter((t,i)=>{const n=s[i];return 0===n||e[i]/n>=r})}return e.push(a),e},[])}
3578
+ /** Builds projected-point extent bounds + padding when no fit features exist. */(s.extentBounds.features,r),!s.extentBounds.features.length&&c.length&&function(e,i,s,n){const a=[[void 0,void 0],[void 0,void 0]];s.forEach((t,i)=>{const s=e.schema.projection(e.schema.point(t,i));(void 0===a[0][0]||s[0]<a[0][0])&&(a[0][0]=s[0]),(void 0===a[1][0]||s[0]>a[1][0])&&(a[1][0]=s[0]),(void 0===a[0][1]||s[1]<a[0][1])&&(a[0][1]=s[1]),(void 0===a[1][1]||s[1]>a[1][1])&&(a[1][1]=s[1])}),i.extentBounds={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"MultiPoint",coordinates:a.map(t=>e.schema.projection.invert(t))}}]};const o=t.max(s,(t,i)=>n(e.schema.pointSize(t,i)));i.effectivePadding={top:e.schema.projectionPadding.top+o,right:e.schema.projectionPadding.right+o,bottom:e.schema.projectionPadding.bottom+o,left:e.schema.projectionPadding.left+o}}(i,s,c,u)}const m=s.effectivePadding||i.schema.projectionPadding;return s.effectivePadding=void 0,i.schema.projection=i.schema.projection.fitExtent(s.extentBounds.features.length?[[m.left,m.top],[n-m.right,a-m.bottom]]:[[0,0],[n,a]],s.extentBounds.features.length?s.extentBounds:{type:"Sphere"}),s.geomapWidth=n,s.geomapHeight=a,s.geomapCtx={topoData:l,pathFn:e=>r(e.feature),pointData:c,pointR:(e,t)=>u(i.schema.pointSize(e,t)),pointSort:(e,t)=>i.schema.pointSize(t)-i.schema.pointSize(e),pointX:(e,t)=>i.schema.projection(i.schema.point(e,t))[0],pointY:(e,t)=>i.schema.projection(i.schema.point(e,t))[1]},{shapeData:l}},sn=Object.assign({},T,O,R);function nn(e){const t=Qs.find(t=>t.matches.some(t=>e.includes(t)));return!!t&&t.text}
3474
3579
  /** Installs `_renderTiles`, the per-instance method that mutates the tile group. */
3475
- /** Installs the imperative fluent accessors on the Geomap instance. */function Ys(e){
3580
+ /** Installs the imperative fluent accessors on the Geomap instance. */function an(e){
3476
3581
  // Imperative fluent accessors. Parameter type is `unknown` since each
3477
3582
  // method accepts a function or a value (or for fitFilter/topojsonFilter,
3478
3583
  // also an array of ids). Each branch narrows with typeof / instanceof.
3479
3584
  !
3480
3585
  /** Installs the fit/point fluent accessors. */function(e){const t=e;t.fitFilter=function(e){if(arguments.length){if(this._zoomSet=!1,"function"==typeof e)return this.schema.fitFilter=e,this;const t=e instanceof Array?e:[e];return this.schema.fitFilter=e=>t.includes(e.id),this}return this.schema.fitFilter},t.fitKey=function(e){return arguments.length?(this.schema.fitKey=e,this._zoomSet=!1,this):this.schema.fitKey},t.fitObject=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"fitObject"),this._zoomSet=!1,this):this.schema.fitObject},t.point=function(e){return arguments.length?(this.schema.point="function"==typeof e?e:L(e),this):this.schema.point},t.pointSize=function(e){return arguments.length?(this.schema.pointSize="function"==typeof e?e:L(e),this):this.schema.pointSize}}
3481
- /** Installs the projection fluent accessors. */(e),function(e){const t=e;t.projection=function(e){return arguments.length&&"geoMercator"!==e&&t.tiles(!1),arguments.length?(this.schema.projection="string"==typeof e?Is[e]?Is[e]():Is.geoMercator():e,this):this.schema.projection},t.projectionPadding=function(e){return arguments.length?(this.schema.projectionPadding=n.parseSides(e),this):this.schema.projectionPadding},t.projectionRotate=function(e){return arguments.length?(this.schema.projection.rotate(e),t.tiles(!1),this._zoomSet=!1,this):this.schema.projectionRotate}}
3482
- /** Installs the tile fluent accessors. */(e),function(e){const t=e;t.tiles=function(e){if(arguments.length){this.schema.tiles=e;const t=qs(this.schema.tileUrl);return e&&""===this.schema.attribution?this.schema.attribution=t:e||this.schema.attribution!==t||(this.schema.attribution=""),this}return this.schema.tiles},t.tileUrl=function(e){return arguments.length?(this.schema.tileUrl=e,this.schema.tiles&&(this.schema.attribution=qs(e)),this._tileGroup&&this._renderTiles.bind(this)(),this):this.schema.tileUrl}}
3483
- /** Installs the topojson fluent accessors. */(e),function(e){const t=e;t.topojson=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"topojson"),this._zoomSet=!1,this):this.schema.topojson},t.topojsonFill=function(e){return arguments.length?(this.schema.topojsonFill="function"==typeof e?e:L(e),this):this.schema.topojsonFill},t.topojsonFilter=function(e){if(arguments.length){if(this._zoomSet=!1,"function"==typeof e)return this.schema.topojsonFilter=e,this;const t=e instanceof Array?e:[e];return this.schema.topojsonFilter=e=>t.includes(e.id),this}return this.schema.topojsonFilter},t.topojsonKey=function(e){return arguments.length?(this.schema.topojsonKey=e,this._zoomSet=!1,this):this.schema.topojsonKey},t.topojsonId=function(e){return arguments.length?(this.schema.topojsonId="function"==typeof e?e:F(e),this):this.schema.topojsonId}}(e)}const Ks={name:"Geomap",features:[ee,Q,Z,ne],layoutStage:Gs,emit:({viz:e})=>{const t=e.ctx.geomapCtx;if(!t)return[];const i=[];
3586
+ /** Installs the projection fluent accessors. */(e),function(e){const t=e;t.projection=function(e){return arguments.length&&"geoMercator"!==e&&t.tiles(!1),arguments.length?(this.schema.projection="string"==typeof e?sn[e]?sn[e]():sn.geoMercator():e,this):this.schema.projection},t.projectionPadding=function(e){return arguments.length?(this.schema.projectionPadding=n.parseSides(e),this):this.schema.projectionPadding},t.projectionRotate=function(e){return arguments.length?(this.schema.projection.rotate(e),t.tiles(!1),this._zoomSet=!1,this):this.schema.projectionRotate}}
3587
+ /** Installs the tile fluent accessors. */(e),function(e){const t=e;t.tiles=function(e){if(arguments.length){this.schema.tiles=e;const t=nn(this.schema.tileUrl);return e&&""===this.schema.attribution?this.schema.attribution=t:e||this.schema.attribution!==t||(this.schema.attribution=""),this}return this.schema.tiles},t.tileUrl=function(e){return arguments.length?(this.schema.tileUrl=e,this.schema.tiles&&(this.schema.attribution=nn(e)),this._tileGroup&&this._renderTiles.bind(this)(),this):this.schema.tileUrl}}
3588
+ /** Installs the topojson fluent accessors. */(e),function(e){const t=e;t.topojson=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"topojson"),this._zoomSet=!1,this):this.schema.topojson},t.topojsonFill=function(e){return arguments.length?(this.schema.topojsonFill="function"==typeof e?e:L(e),this):this.schema.topojsonFill},t.topojsonFilter=function(e){if(arguments.length){if(this._zoomSet=!1,"function"==typeof e)return this.schema.topojsonFilter=e,this;const t=e instanceof Array?e:[e];return this.schema.topojsonFilter=e=>t.includes(e.id),this}return this.schema.topojsonFilter},t.topojsonKey=function(e){return arguments.length?(this.schema.topojsonKey=e,this._zoomSet=!1,this):this.schema.topojsonKey},t.topojsonId=function(e){return arguments.length?(this.schema.topojsonId="function"==typeof e?e:F(e),this):this.schema.topojsonId}}(e)}const on={name:"Geomap",features:[ee,Q,Z,ne],layoutStage:tn,emit:({viz:e})=>{const t=e.ctx.geomapCtx;if(!t)return[];const i=[];
3484
3589
  // Canvas backend: ensureZoomDom keeps its imperative ocean rect transparent
3485
3590
  // (it lives in the overlaying compute <svg>), so paint the ocean into the
3486
3591
  // scene here — first, beneath the geography — to match the SVG backend.
3487
- if("canvas"===e._renderer){const t=e.schema.ocean;if(t&&"transparent"!==t){const{width:s,height:n}=le(e);i.push({type:"rect",key:"geomap-ocean",x:e._margin.left,y:e._margin.top,width:s,height:n,paint:{fill:t}})}}if(t.topoData&&t.topoData.length){const s=Ei(e,"Path");for(let e=0;e<t.topoData.length;e++){const n=t.topoData[e],a=n.data??n,o=Li(s,a,e);i.push({type:"path",key:`geomap-path-${n.id}`,d:t.pathFn(n),datum:a,
3592
+ if("canvas"===e._renderer){const t=e.schema.ocean;if(t&&"transparent"!==t){const{width:s,height:n}=le(e);i.push({type:"rect",key:"geomap-ocean",x:e._margin.left,y:e._margin.top,width:s,height:n,paint:{fill:t}})}}if(t.topoData&&t.topoData.length){const s=Hi(e,"Path");for(let e=0;e<t.topoData.length;e++){const n=t.topoData[e],a=n.data??n,o=Ni(s,a,e);i.push({type:"path",key:`geomap-path-${n.id}`,d:t.pathFn(n),datum:a,
3488
3593
  // Topojson geography is a data shape: keep its border stroke a constant
3489
3594
  // screen width as the map zooms (v3 parity), rather than scaling with
3490
3595
  // the zoom transform. Honors an explicit shapeConfig.vectorEffect.
3491
- paint:{...o,vectorEffect:o.vectorEffect??"non-scaling-stroke"}})}}if(t.pointData&&t.pointData.length){const s=Ei(e,"Circle"),n=t.pointSort?[...t.pointData].sort(t.pointSort):t.pointData;for(let a=0;a<n.length;a++){const o=n[a],r=Li(s,o,a);
3596
+ paint:{...o,vectorEffect:o.vectorEffect??"non-scaling-stroke"}})}}if(t.pointData&&t.pointData.length){const s=Hi(e,"Circle"),n=t.pointSort?[...t.pointData].sort(t.pointSort):t.pointData;for(let a=0;a<n.length;a++){const o=n[a],r=Ni(s,o,a);
3492
3597
  // Origin-centered geometry with the projected position in `transform`,
3493
3598
  // matching how Shape-emitted Circle marks are placed (cx/cy = 0, group
3494
3599
  // transform positions the mark). The motion-trail layer reads a mark's
@@ -3522,7 +3627,7 @@ const t=e._draw.bind(e);e._draw=function(i){
3522
3627
  // its zoomScroll/zoomPan disabling); clear any stale handler on the geomap
3523
3628
  // svg so an ocean event isn't zoomed twice. (Canvas keeps its own target —
3524
3629
  // the <canvas>, set in `_drawSceneToTarget`.)
3525
- "canvas"!==e._renderer&&e._select&&(e._zoomEventTarget=e._select,e._container&&e._container.on(".zoom",null));const s=t(i),{width:n,height:a}=le(e);return Hs(e,{kind:"geomap",width:n,height:a,duration:e.schema.duration,
3630
+ "canvas"!==e._renderer&&e._select&&(e._zoomEventTarget=e._select,e._container&&e._container.on(".zoom",null));const s=t(i),{width:n,height:a}=le(e);return Zs(e,{kind:"geomap",width:n,height:a,duration:e.schema.duration,
3526
3631
  // On the canvas backend this imperative ocean rect lives in the compute
3527
3632
  // <svg>, which overlays the <canvas> and would hide the geography. Keep
3528
3633
  // it transparent there; geomapEmit paints the ocean into the scene (and
@@ -3542,24 +3647,24 @@ const s=e._drawSceneToTarget.bind(e);e._drawSceneToTarget=function(t){if(s(t),"c
3542
3647
  // hit-tests its whole box, so even an empty one swallows the canvas's
3543
3648
  // pointer events. The canvas is the sole render + interaction surface in
3544
3649
  // canvas mode, so make the entire compute svg transparent to events.
3545
- e._select&&e._select.style("pointer-events","none"),e._container&&e._container.style("pointer-events","none"),e._zoomEventTarget=i.select(t),e.schema.zoom&&!e._brushing&&e._zoomEventTarget.call(e._zoomBehavior))}}}(e),Ys(e),
3650
+ e._select&&e._select.style("pointer-events","none"),e._container&&e._container.style("pointer-events","none"),e._zoomEventTarget=i.select(t),e.schema.zoom&&!e._brushing&&e._zoomEventTarget.call(e._zoomBehavior))}}}(e),an(e),
3546
3651
  // Seed the default tile URL through the wrapped accessor so attribution is set.
3547
- t.tileUrl("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png")},ctx:{},fields:[{key:"fitObject",default:!1},{key:"noDataMessage",default:!1},{key:"ocean",default:"#d4dadc"},{key:"point",default:F("point")},{key:"pointSize",default:L(1)},{key:"pointSizeMax",default:10},{key:"pointSizeMin",default:5},{key:"pointSizeScale",default:"linear"},{key:"projection",default:Is.geoMercator()},{key:"projectionPadding",default:n.parseSides(20)},{key:"shape",default:L("Circle")},{key:"topojson",default:!1},{key:"topojsonFill",default:L("#f5f5f3")},{key:"topojsonFilter",default:e=>!["010"].includes(e.id)},{key:"topojsonId",default:F("id")},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>`${e._drawLabel(t,i)}, ${e.schema.pointSize(t,i)}`,hoverOpacity:1,Path:{ariaLabel:(t,i)=>{const s=e.schema.colorScale,n=s?`, ${s(t,i)}`:"";return`${e._drawLabel(t,i)}${n}.`},fill:(t,i)=>{const s=e.ctx.coordData?.features??[],n=e.schema.colorScale;if(n&&!s.includes(t)){const i=n(t);if(null!=i){if(e._colorScaleClass._colorScale)return e._colorScaleClass._colorScale(i);let t=e._colorScaleClass.color();return t instanceof Array&&(t=t[t.length-1]),t}}return e.schema.topojsonFill(t,i)},on:{mouseenter:(t,i,s,n)=>(e.ctx.coordData?.features??[]).includes(t)?null:e.schema.on.mouseenter.bind(e)(t,i,s,n),"mousemove.shape":(t,i,s,n)=>(e.ctx.coordData?.features??[]).includes(t)?null:e.schema.on["mousemove.shape"].bind(e)(t,i,s,n),mouseleave:(t,i,s,n)=>(e.ctx.coordData?.features??[]).includes(t)?null:e.schema.on.mouseleave.bind(e)(t,i,s,n)},stroke:(t,i)=>{const s=e.schema.shapeConfig.Path,n="function"==typeof s.fill?s.fill(t,i):s.fill,a=c.color(n);return a?a.darker():n},strokeWidth:1},
3652
+ t.tileUrl("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png")},ctx:{},fields:[{key:"fitObject",default:!1},{key:"noDataMessage",default:!1},{key:"ocean",default:"#d4dadc"},{key:"point",default:F("point")},{key:"pointSize",default:L(1)},{key:"pointSizeMax",default:10},{key:"pointSizeMin",default:5},{key:"pointSizeScale",default:"linear"},{key:"projection",default:sn.geoMercator()},{key:"projectionPadding",default:n.parseSides(20)},{key:"shape",default:L("Circle"),coerce:"const"},{key:"topojson",default:!1},{key:"topojsonFill",default:L("#f5f5f3")},{key:"topojsonFilter",default:e=>!["010"].includes(e.id)},{key:"topojsonId",default:F("id")},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>`${e._drawLabel(t,i)}, ${e.schema.pointSize(t,i)}`,hoverOpacity:1,Path:{ariaLabel:(t,i)=>{const s=e.schema.colorScale,n=s?`, ${s(t,i)}`:"";return`${e._drawLabel(t,i)}${n}.`},fill:(t,i)=>{const s=e.ctx.coordData?.features??[],n=e.schema.colorScale;if(n&&!s.includes(t)){const i=n(t);if(null!=i){if(e._colorScaleClass._colorScale)return e._colorScaleClass._colorScale(i);let t=e._colorScaleClass.color();return t instanceof Array&&(t=t[t.length-1]),t}}return e.schema.topojsonFill(t,i)},on:{mouseenter:(t,i,s,n)=>(e.ctx.coordData?.features??[]).includes(t)?null:e.schema.on.mouseenter.bind(e)(t,i,s,n),"mousemove.shape":(t,i,s,n)=>(e.ctx.coordData?.features??[]).includes(t)?null:e.schema.on["mousemove.shape"].bind(e)(t,i,s,n),mouseleave:(t,i,s,n)=>(e.ctx.coordData?.features??[]).includes(t)?null:e.schema.on.mouseleave.bind(e)(t,i,s,n)},stroke:(t,i)=>{const s=e.schema.shapeConfig.Path,n="function"==typeof s.fill?s.fill(t,i):s.fill,a=c.color(n);return a?a.darker():n},strokeWidth:1},
3548
3653
  // Coordinate points (Circles) leave a motion trail when they move
3549
3654
  // between frames (e.g. Timeline play); opt out with Circle.trail: false.
3550
3655
  Circle:{trail:!0}})}]};
3551
3656
  /**
3552
3657
  Creates a geographical map with zooming, panning, image tiles, and the ability to layer choropleth paths and coordinate points.
3553
- */var Xs=Bi(Ks);
3658
+ */var rn=Ri(on);
3554
3659
  /**
3555
3660
  Creates a line plot based on an array of data.
3556
3661
  */
3557
- var Vs=Bi({name:"LinePlot",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"discrete",default:"x"},{key:"shape",default:L("Line")}]},Ds);
3662
+ var cn=Ri({name:"LinePlot",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"discrete",default:"x"},{key:"shape",default:L("Line"),coerce:"const"}]},Ws);
3558
3663
  /**
3559
3664
  @module matrixData
3560
3665
  @private
3561
3666
  */
3562
- function Us(e){const t=this._filteredData,i=(this.schema.rowList||s.unique(t.map(this.schema.row))).sort(this.schema.rowSort),n=(this.schema.columnList||s.unique(t.map(this.schema.column))).sort(this.schema.columnSort);if(!i.length||!n.length)return{rowValues:[],columnValues:[],shapeData:[]};var a,o;return{rowValues:i,columnValues:n,shapeData:(a=i,o=n,[].concat(...a.map(e=>o.map(t=>[e,t])))).map(([e,i])=>{const s={__d3plusTooltip__:!0,__d3plus__:!0,column:i,row:e},n=t.findIndex((t,s)=>this.schema.row(t,s)===e&&this.schema.column(t,s)===i);return n>=0?(s.i=n,s.data=t[n]):s.data={row:e,column:i},s})}}const Js=({viz:e})=>{const t=Us.bind(e)(e._filteredData),{rowValues:i,columnValues:s,shapeData:n}=t;if(!i.length||!s.length)return{shapeData:[]};const{width:a,height:o}=le(e),r=a/s.length<120||void 0;
3667
+ function hn(e){const t=this._filteredData,i=(this.schema.rowList||s.unique(t.map(this.schema.row))).sort(this.schema.rowSort),n=(this.schema.columnList||s.unique(t.map(this.schema.column))).sort(this.schema.columnSort);if(!i.length||!n.length)return{rowValues:[],columnValues:[],shapeData:[]};var a,o;return{rowValues:i,columnValues:n,shapeData:(a=i,o=n,[].concat(...a.map(e=>o.map(t=>[e,t])))).map(([e,i])=>{const s={__d3plusTooltip__:!0,__d3plus__:!0,column:i,row:e},n=t.findIndex((t,s)=>this.schema.row(t,s)===e&&this.schema.column(t,s)===i);return n>=0?(s.i=n,s.data=t[n]):s.data={row:e,column:i},s})}}const ln=({viz:e})=>{const t=hn.bind(e)(e._filteredData),{rowValues:i,columnValues:s,shapeData:n}=t;if(!i.length||!s.length)return{shapeData:[]};const{width:a,height:o}=le(e),r=a/s.length<120||void 0;
3563
3668
  // Force rotation when columns are too narrow for horizontal labels; otherwise
3564
3669
  // pass `undefined` so the axis auto-rotates whenever its labels would overlap
3565
3670
  // or truncate (forcing `false` here suppressed that and dropped long labels).
@@ -3574,42 +3679,42 @@ c.renderMode("compute").select(void 0).height(o-e._padding.bottom).maxSize(u).ra
3574
3679
  /**
3575
3680
  `matrixEmit` — Rect cells positioned by the row/column scales stashed
3576
3681
  on `viz.ctx`.
3577
- */function Qs(e,t,i){return"function"==typeof e?e(t,i):e}const Zs={align:"start",barConfig:{stroke:0},gridSize:0,padding:5,paddingInner:0,paddingOuter:0,scale:"band",tickSize:0},en=(e,t)=>`${e}`.localeCompare(`${t}`),tn={name:"Matrix",features:[ee,Q,Z,ne],layoutStage:Js,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.columnScale,n=e.ctx.rowScale,a=e.ctx.cellWidth,o=e.ctx.cellHeight,r=e.schema.cellPadding??0,c=e.schema.shapeConfig??{};return i.map((e,t)=>{const i=Qs(c.fill,e,t),h=Qs(c.stroke,e,t),l=Qs(c.strokeWidth,e,t),d=a-r,u=o-r;return{type:"rect",key:`matrix-${t}`,x:s(e.column)+a/2-d/2,y:n(e.row)+o/2-u/2,width:d,height:u,datum:e,paint:{fill:"string"==typeof i?i:void 0,stroke:h,strokeWidth:l}}})},chartTransform:e=>({x:0,y:e._margin.top}),setup:e=>{const t=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(i,s,n,a)=>{
3682
+ */function dn(e,t,i){return"function"==typeof e?e(t,i):e}const un={align:"start",barConfig:{stroke:0},gridSize:0,padding:5,paddingInner:0,paddingOuter:0,scale:"band",tickSize:0},mn=(e,t)=>`${e}`.localeCompare(`${t}`),fn={name:"Matrix",features:[ee,Q,Z,ne],layoutStage:ln,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.columnScale,n=e.ctx.rowScale,a=e.ctx.cellWidth,o=e.ctx.cellHeight,r=e.schema.cellPadding??0,c=e.schema.shapeConfig??{};return i.map((e,t)=>{const i=dn(c.fill,e,t),h=dn(c.stroke,e,t),l=dn(c.strokeWidth,e,t),d=a-r,u=o-r;return{type:"rect",key:`matrix-${t}`,x:s(e.column)+a/2-d/2,y:n(e.row)+o/2-u/2,width:d,height:u,datum:e,paint:{fill:"string"==typeof i?i:void 0,stroke:h,strokeWidth:l}}})},chartTransform:e=>({x:0,y:e._margin.top}),setup:e=>{const t=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(i,s,n,a)=>{
3578
3683
  // A colorScale swatch routes through the shape path but has no row/column,
3579
3684
  // so its row/column hover would match nothing and wipe out the bucket
3580
3685
  // highlight `mouseenter` already set. Leave that highlight in place.
3581
- if(t(i,s,n,a),_e(n)||_e(i))return;const o=I.bind(e)("row",i,s),r=I.bind(e)("column",i,s);e.hover((t,i)=>(I.bind(e)("row",t,i)===o||I.bind(e)("column",t,i)===r)&&"number"==typeof e.schema.colorScale(t,i))}},ctx:{rowAxis:new xt,columnAxis:new xt},fields:[{key:"cellPadding",default:2},{key:"column",default:F("column"),coerce:e=>"function"==typeof e?e:F(e)},{key:"row",default:F("row"),coerce:e=>"function"==typeof e?e:F(e)},{key:"columnList"},{key:"rowList"},{key:"columnSort",default:en},{key:"rowSort",default:en},{key:"rowConfig",merge:!0,default:{orient:"left",...Zs}},{key:"columnConfig",merge:!0,default:{orient:"top",...Zs}},{key:"label",factory:e=>(t,i)=>`${I.bind(e)("row",t,i)} / ${I.bind(e)("column",t,i)}`}]};
3686
+ if(t(i,s,n,a),_e(n)||_e(i))return;const o=I.bind(e)("row",i,s),r=I.bind(e)("column",i,s);e.hover((t,i)=>(I.bind(e)("row",t,i)===o||I.bind(e)("column",t,i)===r)&&"number"==typeof e.schema.colorScale(t,i))}},ctx:{rowAxis:new Ct,columnAxis:new Ct},fields:[{key:"cellPadding",default:2},{key:"column",default:F("column"),coerce:e=>"function"==typeof e?e:F(e)},{key:"row",default:F("row"),coerce:e=>"function"==typeof e?e:F(e)},{key:"columnList"},{key:"rowList"},{key:"columnSort",default:mn},{key:"rowSort",default:mn},{key:"rowConfig",merge:!0,default:{orient:"left",...un}},{key:"columnConfig",merge:!0,default:{orient:"top",...un}},{key:"label",coerce:"const",factory:e=>(t,i)=>`${I.bind(e)("row",t,i)} / ${I.bind(e)("column",t,i)}`}]};
3582
3687
  /**
3583
3688
  Creates a simple rows/columns Matrix view of any dataset.
3584
3689
  */
3585
- var sn=Bi(tn);
3586
- /** Resolves filtered data + schema nodes into laid-out node records (pre-layout). */function nn(e){const i=e._filteredData.reduce((t,i,s)=>(t[e._id(i,s)]=i,t),{});let s=e.schema.nodes.reduce((i,s,n)=>(i[((i,s)=>`${e._id(i,s)||e.schema.nodeGroupBy[t.min([e._drawDepth,e.schema.nodeGroupBy.length-1])](i,s)}`)(s,n)]=s,i),{});const n=Array.from(new Set(Object.keys(i).concat(Object.keys(s)))).map((t,n)=>{const a=i[t],o=s[t];if(void 0===o)return!1;const r=(e,t=e=>void 0!==e)=>void 0!==a&&t(e(a))?e(a):e(o);return{__d3plus__:!0,data:a||o,i:n,id:t,fx:r(e._x,e=>!isNaN(e)),fy:r(e._y,e=>!isNaN(e)),node:o,r:e._size?r(e._size):e.schema.sizeMin,shape:r(e.schema.shape)}}).filter(e=>!!e);
3690
+ var gn=Ri(fn);
3691
+ /** Resolves filtered data + schema nodes into laid-out node records (pre-layout). */function pn(e){const i=e._filteredData.reduce((t,i,s)=>(t[e._id(i,s)]=i,t),{});let s=e.schema.nodes.reduce((i,s,n)=>(i[((i,s)=>`${e._id(i,s)||e.schema.nodeGroupBy[t.min([e._drawDepth,e.schema.nodeGroupBy.length-1])](i,s)}`)(s,n)]=s,i),{});const n=Array.from(new Set(Object.keys(i).concat(Object.keys(s)))).map((t,n)=>{const a=i[t],o=s[t];if(void 0===o)return!1;const r=(e,t=e=>void 0!==e)=>void 0!==a&&t(e(a))?e(a):e(o);return{__d3plus__:!0,data:a||o,i:n,id:t,fx:r(e._x,e=>!isNaN(e)),fy:r(e._y,e=>!isNaN(e)),node:o,r:e._size?r(e._size):e.schema.sizeMin,shape:r(e.schema.shape)}}).filter(e=>!!e);
3587
3692
  // rawNodes was used above; drop to avoid retention.
3588
3693
  return s={},n}
3589
- /** Resolves schema links against nodes, stashing nodeLookup + linkLookup on ctx. */const an=({viz:e})=>{const i=e,{width:s,height:n}=le(i);Array.isArray(i._filteredData)||(i._filteredData=[]),Array.isArray(i.schema.nodes)||(i.schema.nodes=[]),Array.isArray(i.schema.links)||(i.schema.links=[]);const a=nn(i),o=function(e,t){const i=t.reduce((e,t)=>(e[t.id]=t,e),{});e.ctx.nodeLookup=i;const s=new Map;for(const e of t)s.set(e.node,e);const n=e.schema.links.map(t=>{const n=typeof t.source;return{size:e.schema.linkSize(t),source:"number"===n?s.get(e.schema.nodes[t.source]):"string"===n?i[t.source]:i[t.source.id],target:"number"===n?s.get(e.schema.nodes[t.target]):"string"===n?i[t.target]:i[t.target.id]}});return e.ctx.linkLookup=n.reduce((e,t)=>(e[t.source.id]||(e[t.source.id]=[]),e[t.source.id].push(t.target),e[t.target.id]||(e[t.target.id]=[]),e[t.target.id].push(t.source),e),{}),n}
3590
- /** Runs the d3-force simulation, rotating results to the largest fitting rect. */(i,a);a.some(e=>void 0===e.fx||void 0===e.fy)&&function(e,i){const s=B.scaleLinear().domain(t.extent(i,e=>e.size)).range([.1,.5]),n=z.forceSimulation().force("link",z.forceLink(i).id(e=>e.id).distance(1).strength(e=>s(e.size)).iterations(4)).force("charge",z.forceManyBody().strength(-1)).stop(),a=1-Math.pow(.001,.01);n.velocityDecay(0),n.alphaMin(.001),n.alphaDecay(a),n.alphaDecay(0),n.nodes(e),n.tick(100).stop();const o=e.map(e=>[e.vx??0,e.vy??0]);let r=0,c=0,h=0;if(2===o.length)r=100;else if(o.length>2){const e=D.polygonHull(o)||[],t=y.largestRect(e,{verbose:!0});r=t.angle,c=t.cx,h=t.cy}e.forEach(e=>{const t=y.pointRotate([e.vx??0,e.vy??0],Math.PI/180*r*-1,[c,h]);e.fx=t[0],e.fy=t[1]})}
3591
- /** Positions nodes within bounds and assigns final r/width/height via a fitted radius scale. */(a,o);const r=function(e,i,s,n){const a=t.extent(i.map(e=>e.fx)),o=t.extent(i.map(e=>e.fy)),r=B.scaleLinear().domain(a).range([0,s]),c=B.scaleLinear().domain(o).range([0,n]),h=(a[1]-a[0])/(o[1]-o[0])||1,l=s/n;if(h>l){const e=n*l/h;c.range([(n-e)/2,n-(n-e)/2])}else{const e=s*h/l;r.range([(s-e)/2,s-(s-e)/2])}i.forEach(e=>{e.x=r(e.fx),e.y=c(e.fy)});const d=t.extent(i.map(e=>e.r));let u=e.schema.sizeMax||t.max([1,t.min(t.merge(i.map(e=>i.map(t=>e===t?null:y.pointDistance([e.x??0,e.y??0],[t.x??0,t.y??0])))))/2]);const m=B[`scale${e.schema.sizeScale.charAt(0).toUpperCase()}${e.schema.sizeScale.slice(1)}`]().domain(d).range([d[0]===d[1]?u:t.min([u/2,e.schema.sizeMin]),u]),f=r.domain(),g=c.domain(),p=f[1]-f[0],_=g[1]-g[0];i.forEach(e=>{const t=m(e.r)+3,i=e.x??0,s=e.y??0;f[0]>r.invert(i-t)&&(f[0]=r.invert(i-t)),f[1]<r.invert(i+t)&&(f[1]=r.invert(i+t)),g[0]>c.invert(s-t)&&(g[0]=c.invert(s-t)),g[1]<c.invert(s+t)&&(g[1]=c.invert(s+t))});const x=f[1]-f[0],b=g[1]-g[0];u*=t.min([p/x,_/b]),m.range([d[0]===d[1]?u:t.min([u/2,e.schema.sizeMin]),u]),r.domain(f),c.domain(g);const k=(h>l?s:n)/2;return i.forEach(e=>{e.x=r(e.fx),e.fx=e.x,e.y=c(e.fy),e.fy=e.y,e.r=m(e.r)||k,e.width=2*e.r,e.height=2*e.r}),m}
3592
- /** Normalizes link stroke sizes onto the linkSizeScale, mutating each link's size. */(i,a,s,n);!function(e,i,s){const n=t.extent(i,e=>e.size);if(n[0]!==n[1]){const t=B[`scale${e.schema.linkSizeScale.charAt(0).toUpperCase()}${e.schema.linkSizeScale.slice(1)}`]().domain(n).range([e.schema.linkSizeMin,s.range()[0]]);i.forEach(e=>{e.size=t(e.size)})}}(i,o,r);const c=Ei(i,"Path",i.schema.shapeConfig,"edge");delete c.on;const h={label:e=>!!(a.length<=i.schema.dataCutoff||i._hover&&i._hover(e)||i._active&&i._active(e))&&i._drawLabel(e.data||e.node,e.i)},l=Array.from(t.groups(a,e=>e.shape));return i.ctx.networkCtx={links:o,linkConfig:c,linkD:e=>`M${e.source.x},${e.source.y} ${e.target.x},${e.target.y}`,nodeGroups:l,nodeShapeConfig:h},{shapeData:a}};function on(e,i,s){return`${e._id(i,s)||e.schema.nodeGroupBy[t.min([e._drawDepth,e.schema.nodeGroupBy.length-1])](i,s)}`}
3694
+ /** Resolves schema links against nodes, stashing nodeLookup + linkLookup on ctx. */const yn=({viz:e})=>{const i=e,{width:s,height:n}=le(i);Array.isArray(i._filteredData)||(i._filteredData=[]),Array.isArray(i.schema.nodes)||(i.schema.nodes=[]),Array.isArray(i.schema.links)||(i.schema.links=[]);const a=pn(i),o=function(e,t){const i=t.reduce((e,t)=>(e[t.id]=t,e),{});e.ctx.nodeLookup=i;const s=new Map;for(const e of t)s.set(e.node,e);const n=e.schema.links.map(t=>{const n=typeof t.source;return{size:e.schema.linkSize(t),source:"number"===n?s.get(e.schema.nodes[t.source]):"string"===n?i[t.source]:i[t.source.id],target:"number"===n?s.get(e.schema.nodes[t.target]):"string"===n?i[t.target]:i[t.target.id]}});return e.ctx.linkLookup=n.reduce((e,t)=>(e[t.source.id]||(e[t.source.id]=[]),e[t.source.id].push(t.target),e[t.target.id]||(e[t.target.id]=[]),e[t.target.id].push(t.source),e),{}),n}
3695
+ /** Runs the d3-force simulation, rotating results to the largest fitting rect. */(i,a);a.some(e=>void 0===e.fx||void 0===e.fy)&&function(e,i){const s=B.scaleLinear().domain(t.extent(i,e=>e.size)).range([.1,.5]),n=z.forceSimulation().force("link",z.forceLink(i).id(e=>e.id).distance(1).strength(e=>s(e.size)).iterations(4)).force("charge",z.forceManyBody().strength(-1)).stop(),a=1-Math.pow(.001,.01);n.velocityDecay(0),n.alphaMin(.001),n.alphaDecay(a),n.alphaDecay(0),n.nodes(e),n.tick(100).stop();const o=e.map(e=>[e.vx??0,e.vy??0]);let r=0,c=0,h=0;if(2===o.length)r=100;else if(o.length>2){const e=D.polygonHull(o)||[],t=p.largestRect(e,{verbose:!0});r=t.angle,c=t.cx,h=t.cy}e.forEach(e=>{const t=p.pointRotate([e.vx??0,e.vy??0],Math.PI/180*r*-1,[c,h]);e.fx=t[0],e.fy=t[1]})}
3696
+ /** Positions nodes within bounds and assigns final r/width/height via a fitted radius scale. */(a,o);const r=function(e,i,s,n){const a=t.extent(i.map(e=>e.fx)),o=t.extent(i.map(e=>e.fy)),r=B.scaleLinear().domain(a).range([0,s]),c=B.scaleLinear().domain(o).range([0,n]),h=(a[1]-a[0])/(o[1]-o[0])||1,l=s/n;if(h>l){const e=n*l/h;c.range([(n-e)/2,n-(n-e)/2])}else{const e=s*h/l;r.range([(s-e)/2,s-(s-e)/2])}i.forEach(e=>{e.x=r(e.fx),e.y=c(e.fy)});const d=t.extent(i.map(e=>e.r));let u=e.schema.sizeMax||t.max([1,t.min(t.merge(i.map(e=>i.map(t=>e===t?null:p.pointDistance([e.x??0,e.y??0],[t.x??0,t.y??0])))))/2]);const m=B[`scale${e.schema.sizeScale.charAt(0).toUpperCase()}${e.schema.sizeScale.slice(1)}`]().domain(d).range([d[0]===d[1]?u:t.min([u/2,e.schema.sizeMin]),u]),f=r.domain(),g=c.domain(),y=f[1]-f[0],_=g[1]-g[0];i.forEach(e=>{const t=m(e.r)+3,i=e.x??0,s=e.y??0;f[0]>r.invert(i-t)&&(f[0]=r.invert(i-t)),f[1]<r.invert(i+t)&&(f[1]=r.invert(i+t)),g[0]>c.invert(s-t)&&(g[0]=c.invert(s-t)),g[1]<c.invert(s+t)&&(g[1]=c.invert(s+t))});const x=f[1]-f[0],b=g[1]-g[0];u*=t.min([y/x,_/b]),m.range([d[0]===d[1]?u:t.min([u/2,e.schema.sizeMin]),u]),r.domain(f),c.domain(g);const k=(h>l?s:n)/2;return i.forEach(e=>{e.x=r(e.fx),e.fx=e.x,e.y=c(e.fy),e.fy=e.y,e.r=m(e.r)||k,e.width=2*e.r,e.height=2*e.r}),m}
3697
+ /** Normalizes link stroke sizes onto the linkSizeScale, mutating each link's size. */(i,a,s,n);!function(e,i,s){const n=t.extent(i,e=>e.size);if(n[0]!==n[1]){const t=B[`scale${e.schema.linkSizeScale.charAt(0).toUpperCase()}${e.schema.linkSizeScale.slice(1)}`]().domain(n).range([e.schema.linkSizeMin,s.range()[0]]);i.forEach(e=>{e.size=t(e.size)})}}(i,o,r);const c=Hi(i,"Path",i.schema.shapeConfig,"edge");delete c.on;const h={label:e=>!!(a.length<=i.schema.dataCutoff||i._hover&&i._hover(e)||i._active&&i._active(e))&&i._drawLabel(e.data||e.node,e.i)},l=Array.from(t.groups(a,e=>e.shape));return i.ctx.networkCtx={links:o,linkConfig:c,linkD:e=>`M${e.source.x},${e.source.y} ${e.target.x},${e.target.y}`,nodeGroups:l,nodeShapeConfig:h},{shapeData:a}};function _n(e,i,s){return`${e._id(i,s)||e.schema.nodeGroupBy[t.min([e._drawDepth,e.schema.nodeGroupBy.length-1])](i,s)}`}
3593
3698
  /** Installs the `click.shape` handler that focuses/zooms a node + its links. */
3594
- /** Installs the shape/legend/mouse event handlers that drive Network focus + hover. */function rn(e,t){!function(e,t){e.schema.on["click.shape"]=(i,s,n,a)=>{if(e._tooltipClass.data([]).render(),e._drawDepth>=e.schema.groupBy.length-1){const o=on(e,i,s);if(e._focus&&e._focus===o)t.active(!1),e.schema.on.mouseenter.bind(e)(i,s,n,a),e._focus=void 0,e._zoomToBounds(null);else{t.hover(!1);const i=e.ctx.linkLookup[o]??[],s=e.ctx.nodeLookup[o],n=[o];let a=[s.x-s.r,s.x+s.r],r=[s.y-s.r,s.y+s.r];i.forEach(e=>{n.push(e.id),e.x-e.r<a[0]&&(a[0]=e.x-e.r),e.x+e.r>a[1]&&(a[1]=e.x+e.r),e.y-e.r<r[0]&&(r[0]=e.y-e.r),e.y+e.r>r[1]&&(r[1]=e.y+e.r)}),t.active((t,i)=>t.source&&t.target?t.source.id===o||t.target.id===o:n.includes(on(e,t,i))),e._focus=o;const c=d.zoomTransform((e._zoomEventTarget||e._container).node());a=a.map(e=>e*c.k+c.x),r=r.map(e=>e*c.k+c.y),e._zoomToBounds([[a[0],r[0]],[a[1],r[1]]])}}}}
3699
+ /** Installs the shape/legend/mouse event handlers that drive Network focus + hover. */function xn(e,t){!function(e,t){e.schema.on["click.shape"]=(i,s,n,a)=>{if(e._tooltipClass.data([]).render(),e._drawDepth>=e.schema.groupBy.length-1){const o=_n(e,i,s);if(e._focus&&e._focus===o)t.active(!1),e.schema.on.mouseenter.bind(e)(i,s,n,a),e._focus=void 0,e._zoomToBounds(null);else{t.hover(!1);const i=e.ctx.linkLookup[o]??[],s=e.ctx.nodeLookup[o],n=[o];let a=[s.x-s.r,s.x+s.r],r=[s.y-s.r,s.y+s.r];i.forEach(e=>{n.push(e.id),e.x-e.r<a[0]&&(a[0]=e.x-e.r),e.x+e.r>a[1]&&(a[1]=e.x+e.r),e.y-e.r<r[0]&&(r[0]=e.y-e.r),e.y+e.r>r[1]&&(r[1]=e.y+e.r)}),t.active((t,i)=>t.source&&t.target?t.source.id===o||t.target.id===o:n.includes(_n(e,t,i))),e._focus=o;const c=d.zoomTransform((e._zoomEventTarget||e._container).node());a=a.map(e=>e*c.k+c.x),r=r.map(e=>e*c.k+c.y),e._zoomToBounds([[a[0],r[0]],[a[1],r[1]]])}}}}
3595
3700
  /** Installs the `click.legend` handler that focuses/zooms a legend group. */(e,t),function(e,t){e.schema.on["click.legend"]=(i,s,n,a)=>{const o=e._ids(i,s),r=o[o.length-1],c=e._id(i,s);if(e._drawDepth>=e.schema.groupBy.length-1){if(e._focus&&e._focus===c)t.active(!1),e._focus=void 0,e._zoomToBounds(null);else{t.hover(!1);const i=(Array.isArray(c)?c:[c]).map(t=>e.ctx.nodeLookup[String(t)]),s=[`${r}`];let n=[i[0].x-i[0].r,i[0].x+i[0].r],a=[i[0].y-i[0].r,i[0].y+i[0].r];i.forEach(e=>{s.push(e.id),e.x-e.r<n[0]&&(n[0]=e.x-e.r),e.x+e.r>n[1]&&(n[1]=e.x+e.r),e.y-e.r<a[0]&&(a[0]=e.y-e.r),e.y+e.r>a[1]&&(a[1]=e.y+e.r)}),t.active((t,i)=>{if(t.source&&t.target)return s.includes(t.source.id)&&s.includes(t.target.id);const n=e._ids(t,i);return s.includes(`${n[n.length-1]}`)}),e._focus=c;const o=d.zoomTransform((e._zoomEventTarget||e._container).node());n=n.map(e=>e*o.k+o.x),a=a.map(e=>e*o.k+o.y),e._zoomToBounds([[n[0],a[0]],[n[1],a[1]]])}e.schema.on.mouseenter.bind(e)(i,s,n,a),e.schema.on["mousemove.legend"].bind(e)(i,s,n,a)}}}
3596
- /** Installs mouseenter/mouseleave/mousemove handlers that drive hover highlighting. */(e,t),function(e,t){e.schema.on.mouseenter=()=>{},e.schema.on["mouseleave.shape"]=()=>{t.hover(!1)};const i=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(s,n,a,o)=>{i(s,n,a,o);const r=on(e,s,n),c=e.ctx.linkLookup[r]??[],h=e.ctx.nodeLookup[r],l=[r],d=[h.x-h.r,h.x+h.r],u=[h.y-h.r,h.y+h.r];c.forEach(e=>{l.push(e.id),e.x-e.r<d[0]&&(d[0]=e.x-e.r),e.x+e.r>d[1]&&(d[1]=e.x+e.r),e.y-e.r<u[0]&&(u[0]=e.y-e.r),e.y+e.r>u[1]&&(u[1]=e.y+e.r)}),t.hover((t,i)=>t.source&&t.target?t.source.id===r||t.target.id===r:l.includes(`${e._ids(t,i)[e._drawDepth]}`))}}(e,t)}
3597
- /** Installs the per-instance fluent methods (links/nodes/nodeGroupBy/size/x/y/hover). */const cn={name:"Network",features:[ee,Q,Z,ne],layoutStage:an,emit:({viz:e})=>{const t=e.ctx.networkCtx;if(!t)return[];const i=[];if(t.links&&t.links.length)for(let e=0;e<t.links.length;e++){const s=t.links[e],n=s,a=Li(t.linkConfig,n,e);
3701
+ /** Installs mouseenter/mouseleave/mousemove handlers that drive hover highlighting. */(e,t),function(e,t){e.schema.on.mouseenter=()=>{},e.schema.on["mouseleave.shape"]=()=>{t.hover(!1)};const i=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(s,n,a,o)=>{i(s,n,a,o);const r=_n(e,s,n),c=e.ctx.linkLookup[r]??[],h=e.ctx.nodeLookup[r],l=[r],d=[h.x-h.r,h.x+h.r],u=[h.y-h.r,h.y+h.r];c.forEach(e=>{l.push(e.id),e.x-e.r<d[0]&&(d[0]=e.x-e.r),e.x+e.r>d[1]&&(d[1]=e.x+e.r),e.y-e.r<u[0]&&(u[0]=e.y-e.r),e.y+e.r>u[1]&&(u[1]=e.y+e.r)}),t.hover((t,i)=>t.source&&t.target?t.source.id===r||t.target.id===r:l.includes(`${e._ids(t,i)[e._drawDepth]}`))}}(e,t)}
3702
+ /** Installs the per-instance fluent methods (links/nodes/nodeGroupBy/size/x/y/hover). */const bn={name:"Network",features:[ee,Q,Z,ne],layoutStage:yn,emit:({viz:e})=>{const t=e.ctx.networkCtx;if(!t)return[];const i=[];if(t.links&&t.links.length)for(let e=0;e<t.links.length;e++){const s=t.links[e],n=s,a=Ni(t.linkConfig,n,e);
3598
3703
  // Link's strokeWidth comes from the layout-injected `d.size`.
3599
- "number"==typeof s.size&&(a.strokeWidth=s.size),i.push({type:"path",key:`network-link-${s.source.id??""}-${s.target.id??""}-${e}`,d:t.linkD(s),datum:n,paint:a})}if(t.nodeGroups&&t.nodeGroups.length)for(const[s,n]of t.nodeGroups){if(!n.length)continue;const a={...Ei(e,s),...t.nodeShapeConfig};for(let e=0;e<n.length;e++){const t=n[e],o=t.data??t,r=Li(a,o,t.i??e);if(
3704
+ "number"==typeof s.size&&(a.strokeWidth=s.size),i.push({type:"path",key:`network-link-${s.source.id??""}-${s.target.id??""}-${e}`,d:t.linkD(s),datum:n,paint:a})}if(t.nodeGroups&&t.nodeGroups.length)for(const[s,n]of t.nodeGroups){if(!n.length)continue;const a={...Hi(e,s),...t.nodeShapeConfig};for(let e=0;e<n.length;e++){const t=n[e],o=t.data??t,r=Ni(a,o,t.i??e);if(
3600
3705
  // Nodes are data shapes: keep their stroke a constant screen width as the
3601
3706
  // network zooms (the links above deliberately scale with the zoom, so
3602
3707
  // heavier connections read as heavier when zoomed in).
3603
- void 0===r.vectorEffect&&(r.vectorEffect="non-scaling-stroke"),"Circle"===s)i.push({type:"circle",key:`network-${s}-${t.id}`,cx:t.x,cy:t.y,r:t.r,datum:o,paint:r});else if("Rect"===s){const n=Number(t.width??Ri(a.width,o,t.i??e)??0),c=Number(t.height??Ri(a.height,o,t.i??e)??0);i.push({type:"rect",key:`network-${s}-${t.id}`,x:t.x-n/2,y:t.y-c/2,width:n,height:c,datum:o,paint:r})}
3708
+ void 0===r.vectorEffect&&(r.vectorEffect="non-scaling-stroke"),"Circle"===s)i.push({type:"circle",key:`network-${s}-${t.id}`,cx:t.x,cy:t.y,r:t.r,datum:o,paint:r});else if("Rect"===s){const n=Number(t.width??Wi(a.width,o,t.i??e)??0),c=Number(t.height??Wi(a.height,o,t.i??e)??0);i.push({type:"rect",key:`network-${s}-${t.id}`,x:t.x-n/2,y:t.y-c/2,width:n,height:c,datum:o,paint:r})}
3604
3709
  // Other shape kinds: skipped (Network's default is Circle).
3605
3710
  }
3606
3711
  // Labels via the chart-specific label fn. labelBounds is the
3607
3712
  // shape's aes (r for circles, width/height for rects).
3608
- const o=t.nodeShapeConfig.label;if(o){const e=Rs({data:n,label:(e,t)=>o(e,t),x:e=>e.x,y:e=>e.y,aes:e=>{const t=e;return"Circle"===s?{r:t.r,width:2*t.r,height:2*t.r}:{width:t.width??0,height:t.height??0}},rotate:L(0),id:e=>`network-label-${e.id}`,labelBounds:(e,t,i)=>{const n=i;if("Circle"===s){const e=n.r??0;return{width:1.5*e,height:1.5*e,x:.75*-e,y:.75*-e}}const a=n.width??0,o=n.height??0;return{width:a,height:o,x:-a/2,y:-o/2}},labelConfig:{...a.labelConfig??{fontResize:!0},fontColor:e=>{const t=e.data??e,i=Ri(a.fill,t.data??t,t.i??0);return u.colorContrast("string"==typeof i?i:"rgb(255, 255, 255)")}}});i.push(...e)}}return i},
3713
+ const o=t.nodeShapeConfig.label;if(o){const e=Ks({data:n,label:(e,t)=>o(e,t),x:e=>e.x,y:e=>e.y,aes:e=>{const t=e;return"Circle"===s?{r:t.r,width:2*t.r,height:2*t.r}:{width:t.width??0,height:t.height??0}},rotate:L(0),id:e=>`network-label-${e.id}`,labelBounds:(e,t,i)=>{const n=i;if("Circle"===s){const e=n.r??0;return{width:1.5*e,height:1.5*e,x:.75*-e,y:.75*-e}}const a=n.width??0,o=n.height??0;return{width:a,height:o,x:-a/2,y:-o/2}},labelConfig:{...a.labelConfig??{fontResize:!0},fontColor:e=>{const t=e.data??e,i=Wi(a.fill,t.data??t,t.i??0);return u.colorContrast("string"==typeof i?i:"rgb(255, 255, 255)")}}});i.push(...e)}}return i},
3609
3714
  // Network needs a real DOM element for d3-zoom binding; the hitArea click
3610
3715
  // handler closes over class state. `setup` installs the event surface;
3611
3716
  // `chartTransform` (default margin-origin) is fine for the scene.
3612
- setup:e=>{const i=e;e.schema.zoom=!0,rn(e,i),
3717
+ setup:e=>{const i=e;e.schema.zoom=!0,xn(e,i),
3613
3718
  // `links()` / `nodes()` / `nodeGroupBy()` / `size()` / `x()` / `y()` /
3614
3719
  // `hover()` need imperative method bodies (queue loading, aggs side
3615
3720
  // effects). Install them per-instance.
@@ -3633,18 +3738,18 @@ const n=i._draw.bind(e);i._draw=function(t){
3633
3738
  // with its zoomScroll/zoomPan disabling; clear the network svg's handlers
3634
3739
  // so an event over the background isn't zoomed twice. (Canvas keeps the
3635
3740
  // default target.)
3636
- "canvas"!==e._renderer&&e._select&&(e._zoomEventTarget=e._select,e._container&&e._container.on(".zoom",null));const i=n(t),{width:s,height:a}=le(e);return Hs(e,{kind:"network",width:s,height:a,duration:e.schema.duration}),i}},ctx:{},fields:[{key:"links",default:[]},{key:"linkSize",default:L(1),coerce:e=>"function"==typeof e?e:L(e)},{key:"linkSizeMin",default:1},{key:"linkSizeScale",default:"sqrt"},{key:"noDataMessage",default:!1},{key:"nodeGroupBy",default:[F("id")]},{key:"tooltipConfig",merge:!0,factory:e=>({title:t=>t&&t.source&&t.target?`${t.source.id} → ${t.target.id}`:e._drawLabel(t,"number"==typeof t.i?t.i:0)})},{key:"nodes",default:[]},{key:"sizeMax"},{key:"sizeMin",default:5},{key:"sizeScale",default:"sqrt"},{key:"shape",default:L("Circle")},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e._size,n=s?`, ${s(t,i)}`:"";return`${e._drawLabel(t,i)}${n}.`},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee"}})}]};
3741
+ "canvas"!==e._renderer&&e._select&&(e._zoomEventTarget=e._select,e._container&&e._container.on(".zoom",null));const i=n(t),{width:s,height:a}=le(e);return Zs(e,{kind:"network",width:s,height:a,duration:e.schema.duration}),i}},ctx:{},fields:[{key:"links",default:[]},{key:"linkSize",default:L(1),coerce:e=>"function"==typeof e?e:L(e)},{key:"linkSizeMin",default:1},{key:"linkSizeScale",default:"sqrt"},{key:"noDataMessage",default:!1},{key:"nodeGroupBy",default:[F("id")]},{key:"tooltipConfig",merge:!0,factory:e=>({title:t=>t&&t.source&&t.target?`${t.source.id} → ${t.target.id}`:e._drawLabel(t,"number"==typeof t.i?t.i:0)})},{key:"nodes",default:[]},{key:"sizeMax"},{key:"sizeMin",default:5},{key:"sizeScale",default:"sqrt"},{key:"shape",default:L("Circle"),coerce:"const"},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e._size,n=s?`, ${s(t,i)}`:"";return`${e._drawLabel(t,i)}${n}.`},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee"}})}]};
3637
3742
  /**
3638
3743
  Creates a network visualization based on a defined set of nodes and edges.
3639
- */var hn=Bi(cn);const ln=({viz:e})=>{const t=e._filteredData;if(!t||!t.length)return{shapeData:[]};const i=e.schema.height-e._margin.top-e._margin.bottom,n=e.schema.width-e._margin.left-e._margin.right,a=Math.min(i,n),o=s.nestGroups(t,e.schema.groupBy.slice(0,e._drawDepth+1)),r=e.schema.packOpacity,c=e.ctx.pack.padding(e.schema.layoutPadding).size([a,a])(M.hierarchy({key:o.key,values:o},e=>e.values).sum(e.schema.sum).sort(e.schema.sort)).descendants().filter((e,t)=>{const i=e;i.__d3plus__=!0,i.i=t,i.id=i.parent?i.parent.data.key:"root";const s=i.data;return s.__d3plusOpacity__=i.height?r(s,t):1,s.__d3plusTooltip__=!i.height,!i.children||i.children.length>1});return e.ctx.packDiameter=a,e.ctx.packOffsetX=(n-a)/2,e.ctx.packOffsetY=(i-a)/2,{shapeData:c}};function dn(e,t,i){return"function"==typeof e?e(t,i):e}
3744
+ */var kn=Ri(bn);const vn=({viz:e})=>{const t=e._filteredData;if(!t||!t.length)return{shapeData:[]};const i=e.schema.height-e._margin.top-e._margin.bottom,n=e.schema.width-e._margin.left-e._margin.right,a=Math.min(i,n),o=s.nestGroups(t,e.schema.groupBy.slice(0,e._drawDepth+1)),r=e.schema.packOpacity,c=e.ctx.pack.padding(e.schema.layoutPadding).size([a,a])(M.hierarchy({key:o.key,values:o},e=>e.values).sum(e.schema.sum).sort(e.schema.sort)).descendants().filter((e,t)=>{const i=e;i.__d3plus__=!0,i.i=t,i.id=i.parent?i.parent.data.key:"root";const s=i.data;return s.__d3plusOpacity__=i.height?r(s,t):1,s.__d3plusTooltip__=!i.height,!i.children||i.children.length>1});return e.ctx.packDiameter=a,e.ctx.packOffsetX=(n-a)/2,e.ctx.packOffsetY=(i-a)/2,{shapeData:c}};function Cn(e,t,i){return"function"==typeof e?e(t,i):e}
3640
3745
  /**
3641
3746
  Walk a nested hierarchy, collecting every descendant into a flat array.
3642
3747
  Used by Pack's hover handlers to highlight the subtree under a hovered
3643
3748
  node.
3644
3749
  */
3645
- function un(e,t=[]){return e.values?e.values.forEach(e=>{t.push(e),un(e,t)}):t.push(e),t}const mn={name:"Pack",features:[ee,Q,Z,ne],layoutStage:ln,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.schema.shapeConfig??{},n=(s.Circle??{}).label;
3750
+ function Sn(e,t=[]){return e.values?e.values.forEach(e=>{t.push(e),Sn(e,t)}):t.push(e),t}const wn={name:"Pack",features:[ee,Q,Z,ne],layoutStage:vn,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.schema.shapeConfig??{},n=(s.Circle??{}).label;
3646
3751
  // Pack's per-shape config is nested under `Circle`.
3647
- return[...i.map((e,t)=>{const i=e.data,n=dn(s.fill,i,t),a=dn(s.stroke,i,t),o=dn(s.strokeWidth,i,t);return{type:"circle",key:`pack-${e.id}-${e.i}`,cx:e.x,cy:e.y,r:e.r,datum:i,paint:{fill:"string"==typeof n?n:void 0,stroke:a,opacity:i.__d3plusOpacity__,strokeWidth:o}}}),...Rs({data:i,label:(e,t)=>{const i=e;return!i.children&&(n?n(i.data,t):!!i.parent&&(i.data.id??!1))},x:e=>e.x,y:e=>e.y,
3752
+ return[...i.map((e,t)=>{const i=e.data,n=Cn(s.fill,i,t),a=Cn(s.stroke,i,t),o=Cn(s.strokeWidth,i,t);return{type:"circle",key:`pack-${e.id}-${e.i}`,cx:e.x,cy:e.y,r:e.r,datum:i,paint:{fill:"string"==typeof n?n:void 0,stroke:a,opacity:i.__d3plusOpacity__,strokeWidth:o}}}),...Ks({data:i,label:(e,t)=>{const i=e;return!i.children&&(n?n(i.data,t):!!i.parent&&(i.data.id??!1))},x:e=>e.x,y:e=>e.y,
3648
3753
  // Store the leaf's source row (not the d3-hierarchy node) as the label's
3649
3754
  // `.data`, matching the circle node's datum (`d.data` above). Without this
3650
3755
  // the label and its circle unwrap to different objects, so on hover the
@@ -3654,70 +3759,70 @@ datum:e=>e.data,aes:e=>{const t=e.r;return{r:t,width:2*t,height:2*t}},rotate:L(0
3654
3759
  // the legend's hover state. Method shadowing doesn't fit the field
3655
3760
  // model (it's a method, not a value with a default); setup is the
3656
3761
  // right escape hatch for the genuine method-override case.
3657
- setup:e=>{const t=e.hover.bind(e);e.hover=i=>(t(i),e.schema.legend&&e._legendClass.hover(i),e)},ctx:{pack:M.pack()},fields:[{key:"layoutPadding",default:1},{key:"sort",default:(e,t)=>(t.value??0)-(e.value??0)},{key:"sum",default:F("value"),coerce:e=>"function"==typeof e?e:F(e)},{key:"packOpacity",default:L(.25),coerce:e=>"function"==typeof e?e:L(e)},{key:"shape",default:L("Circle"),coerce:e=>"function"==typeof e?e:L(e)},{key:"shapeConfig",merge:!0,factory:()=>({Circle:{label:e=>{const t=e;return!(!t.parent||t.children)&&t.id},labelConfig:{fontResize:!0},opacity:e=>e.__d3plusOpacity__}})},{key:"legend",factory:e=>{const t=e.schema.legend;return(i,s)=>s.length!==e._filteredData.length&&t.call(e,i,s)}},{
3762
+ setup:e=>{const t=e.hover.bind(e);e.hover=i=>(t(i),e.schema.legend&&e._legendClass.hover(i),e)},ctx:{pack:M.pack()},fields:[{key:"layoutPadding",default:1},{key:"sort",default:(e,t)=>(t.value??0)-(e.value??0)},{key:"sum",default:F("value"),coerce:e=>"function"==typeof e?e:F(e)},{key:"packOpacity",default:L(.25),coerce:e=>"function"==typeof e?e:L(e)},{key:"shape",default:L("Circle"),coerce:e=>"function"==typeof e?e:L(e)},{key:"shapeConfig",merge:!0,factory:()=>({Circle:{label:e=>{const t=e;return!(!t.parent||t.children)&&t.id},labelConfig:{fontResize:!0},opacity:e=>e.__d3plusOpacity__}})},{key:"legend",coerce:"const",factory:e=>{const t=e.schema.legend;return(i,s)=>s.length!==e._filteredData.length&&t.call(e,i,s)}},{
3658
3763
  // `on` is the event bus — Viz seeded it with the default handlers,
3659
3764
  // Pack layers wrap-and-extend versions for the events that need
3660
3765
  // pack-specific hover behavior. `merge` keeps Viz's other handlers
3661
3766
  // intact.
3662
- key:"on",merge:!0,factory:e=>{const t=e.schema.on["mousemove.legend"],i=e.schema.on["mousemove.shape"],s=t=>e.hover(t);return{mouseenter:()=>{},"mousemove.legend":(i,n,a,o)=>{t(i,n,a,o);const r=e._ids(i,n),c=un(i);s(e=>(Object.keys(e).filter(e=>"value"!==e).every(t=>{const s=i[t];return null!=s&&s.includes(e[t])})?c.push(e):r.includes(e.key)&&c.push(...un(e,[e])),c.includes(e)))},"mousemove.shape":(e,t,n,a)=>{e.__d3plusTooltip__&&i(e,t,n,a);const o=un(e,[e]);s(e=>o.includes(e))}}}}]};
3767
+ key:"on",merge:!0,factory:e=>{const t=e.schema.on["mousemove.legend"],i=e.schema.on["mousemove.shape"],s=t=>e.hover(t);return{mouseenter:()=>{},"mousemove.legend":(i,n,a,o)=>{t(i,n,a,o);const r=e._ids(i,n),c=Sn(i);s(e=>(Object.keys(e).filter(e=>"value"!==e).every(t=>{const s=i[t];return null!=s&&s.includes(e[t])})?c.push(e):r.includes(e.key)&&c.push(...Sn(e,[e])),c.includes(e)))},"mousemove.shape":(e,t,n,a)=>{e.__d3plusTooltip__&&i(e,t,n,a);const o=Sn(e,[e]);s(e=>o.includes(e))}}}}]};
3663
3768
  /**
3664
3769
  Uses the d3 pack layout to create a Circle Packing chart based on an array of data.
3665
- */var fn=Bi(mn);
3666
- /** Greedy first-fit lane packer; mutates `d.lane` and returns total lane count. */const gn=({viz:e})=>{const i=e._filteredData;if(!i)return{shapeData:[]};const a=e.schema.start,o=e.schema.end,r=e._id,c=e.schema.axisConfig,h="time"===c?.scale,l=i.map((e,t)=>({__d3plus__:!0,data:e,end:h?n.date(o(e,t)):o(e,t),i:t,id:r(e,t),start:h?n.date(a(e,t)):a(e,t)})).filter(e=>Number(e.end)-Number(e.start)>0).sort((e,t)=>Number(e.start)-Number(t.start));let d;if(e.schema.groupBy.length>1&&e._drawDepth>0){const t=[];for(let i=0;i<e._drawDepth;i++)t.push(t=>e.schema.groupBy[i](t.data,t.i));d=s.nestGroups(l,t)}else d=[{values:l}];const u=(e=>{let t=0;return e.forEach(e=>{let i=[];e.values.forEach(e=>{i=i.map(t=>!(!1!==t&&t<=e.start)&&t);const s=i.indexOf(!1);s<0?(e.lane=t+i.length,i.push(e.end)):(i[s]=e.end,e.lane=t+s)}),t+=i.length}),t})(d);return((e,i,s)=>{const n={domain:[t.min(i,e=>Number(e.start))??0,t.max(i,e=>Number(e.end))??0],height:e.schema.height-e._margin.top-e._margin.bottom,width:e.schema.width-e._margin.left-e._margin.right},a=e.ctx.axisTest,o=e.ctx.axis;a.config(n).config(e.schema.axisConfig).measure(),o.config(n).config(e.schema.axisConfig).renderMode("compute").select(void 0).render();const r=o.toScene();var c;r&&((c=e)._chartScene||(c._chartScene=[])).push({type:"group",key:"priestley-axis",transform:{x:e._margin.left,y:e._margin.top},children:r.children??[]});const h=B.scaleBand().domain(t.range(0,s,1).map(String)).paddingInner(e.schema.paddingInner).paddingOuter(e.schema.paddingOuter).rangeRound([e.schema.height-e._margin.bottom-a.outerBounds().height-a.schema.padding,e._margin.top+a.schema.padding]);e.ctx.xScale=o._d3Scale,e.ctx.yScale=h,e.ctx.bandWidth=h.bandwidth()})(e,l,u),{shapeData:l}};
3667
- /** Runs both axes, pushes the axis scene, and stashes scales/bandWidth on `viz.ctx`. */function pn(e,t,i){return"function"==typeof e?e(t,i):e}const yn={name:"Priestley",features:[ee,Q,Z,ne],layoutStage:gn,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.xScale,n=e.ctx.yScale,a=e.ctx.bandWidth,o=e.schema.shapeConfig??{};return[...i.map((e,t)=>{const i=pn(o.fill,e.data,t),r=pn(o.stroke,e.data,t),c=pn(o.strokeWidth,e.data,t),h=Math.abs(s(e.end)-s(e.start)),l=h>2?h-2:h,d=s(e.start)+(s(e.end)-s(e.start))/2-l/2,u=(n(String(e.lane))??0)+a/2;return{type:"rect",shapeType:"Bar",key:`priestley-${e.id}-${t}`,transform:{x:d,y:u},x:0,y:-a/2,width:l,height:a,datum:e.data,paint:{fill:"string"==typeof i?i:void 0,stroke:r,strokeWidth:c}}}),...Rs({data:i,label:(t,s)=>e._drawLabel(i[s].data,s),x:(e,t)=>{const n=i[t];return s(n.start)+(s(n.end)-s(n.start))/2},y:(e,t)=>(n(String(i[t].lane))??0)+a/2,aes:(e,t)=>{const n=i[t],o=Math.abs(s(n.end)-s(n.start));return{width:o>2?o-2:o,height:a}},rotate:L(0),id:(e,t)=>`priestley-label-${i[t].id}-${t}`,labelBounds:(e,t,i)=>{const{width:s,height:n}=i;return{x:-s/2,y:-n/2,width:s,height:n}},labelConfig:{fontColor:e=>{const t=e.data??e,i=pn(o.fill,t.data,t.i);return u.colorContrast("string"==typeof i?i:"rgb(255, 255, 255)")},fontResize:!1,textAnchor:"start",verticalAlign:"top"}})]},
3770
+ */var zn=Ri(wn);
3771
+ /** Greedy first-fit lane packer; mutates `d.lane` and returns total lane count. */const Dn=({viz:e})=>{const i=e._filteredData;if(!i)return{shapeData:[]};const a=e.schema.start,o=e.schema.end,r=e._id,c=e.schema.axisConfig,h="time"===c?.scale,l=i.map((e,t)=>({__d3plus__:!0,data:e,end:h?n.date(o(e,t)):o(e,t),i:t,id:r(e,t),start:h?n.date(a(e,t)):a(e,t)})).filter(e=>Number(e.end)-Number(e.start)>0).sort((e,t)=>Number(e.start)-Number(t.start));let d;if(e.schema.groupBy.length>1&&e._drawDepth>0){const t=[];for(let i=0;i<e._drawDepth;i++)t.push(t=>e.schema.groupBy[i](t.data,t.i));d=s.nestGroups(l,t)}else d=[{values:l}];const u=(e=>{let t=0;return e.forEach(e=>{let i=[];e.values.forEach(e=>{i=i.map(t=>!(!1!==t&&t<=e.start)&&t);const s=i.indexOf(!1);s<0?(e.lane=t+i.length,i.push(e.end)):(i[s]=e.end,e.lane=t+s)}),t+=i.length}),t})(d);return((e,i,s)=>{const n={domain:[t.min(i,e=>Number(e.start))??0,t.max(i,e=>Number(e.end))??0],height:e.schema.height-e._margin.top-e._margin.bottom,width:e.schema.width-e._margin.left-e._margin.right},a=e.ctx.axisTest,o=e.ctx.axis;a.config(n).config(e.schema.axisConfig).measure(),o.config(n).config(e.schema.axisConfig).renderMode("compute").select(void 0).render();const r=o.toScene();var c;r&&((c=e)._chartScene||(c._chartScene=[])).push({type:"group",key:"priestley-axis",transform:{x:e._margin.left,y:e._margin.top},children:r.children??[]});const h=B.scaleBand().domain(t.range(0,s,1).map(String)).paddingInner(e.schema.paddingInner).paddingOuter(e.schema.paddingOuter).rangeRound([e.schema.height-e._margin.bottom-a.outerBounds().height-a.schema.padding,e._margin.top+a.schema.padding]);e.ctx.xScale=o._d3Scale,e.ctx.yScale=h,e.ctx.bandWidth=h.bandwidth()})(e,l,u),{shapeData:l}};
3772
+ /** Runs both axes, pushes the axis scene, and stashes scales/bandWidth on `viz.ctx`. */function Mn(e,t,i){return"function"==typeof e?e(t,i):e}const An={name:"Priestley",features:[ee,Q,Z,ne],layoutStage:Dn,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.xScale,n=e.ctx.yScale,a=e.ctx.bandWidth,o=e.schema.shapeConfig??{};return[...i.map((e,t)=>{const i=Mn(o.fill,e.data,t),r=Mn(o.stroke,e.data,t),c=Mn(o.strokeWidth,e.data,t),h=Math.abs(s(e.end)-s(e.start)),l=h>2?h-2:h,d=s(e.start)+(s(e.end)-s(e.start))/2-l/2,u=(n(String(e.lane))??0)+a/2;return{type:"rect",shapeType:"Bar",key:`priestley-${e.id}-${t}`,transform:{x:d,y:u},x:0,y:-a/2,width:l,height:a,datum:e.data,paint:{fill:"string"==typeof i?i:void 0,stroke:r,strokeWidth:c}}}),...Ks({data:i,label:(t,s)=>e._drawLabel(i[s].data,s),x:(e,t)=>{const n=i[t];return s(n.start)+(s(n.end)-s(n.start))/2},y:(e,t)=>(n(String(i[t].lane))??0)+a/2,aes:(e,t)=>{const n=i[t],o=Math.abs(s(n.end)-s(n.start));return{width:o>2?o-2:o,height:a}},rotate:L(0),id:(e,t)=>`priestley-label-${i[t].id}-${t}`,labelBounds:(e,t,i)=>{const{width:s,height:n}=i;return{x:-s/2,y:-n/2,width:s,height:n}},labelConfig:{fontColor:e=>{const t=e.data??e,i=Mn(o.fill,t.data,t.i);return u.colorContrast("string"==typeof i?i:"rgb(255, 255, 255)")},fontResize:!1,textAnchor:"start",verticalAlign:"top"}})]},
3668
3773
  // Priestley positions in absolute scale coordinates — no chart transform.
3669
3774
  chartTransform:()=>{},
3670
3775
  // The default start/end accessors are functions, so the fields' `onSet`
3671
3776
  // can't infer a data key to register. Seed the band-edge reducers here so
3672
3777
  // the time domain spans min(start)…max(end) instead of summing them.
3673
- setup:e=>{e.schema.aggs.start||(e.schema.aggs.start=t.min),e.schema.aggs.end||(e.schema.aggs.end=t.max)},ctx:{axis:(new xt).align("end").orient("bottom"),axisTest:(new xt).align("end").gridSize(0).orient("bottom")},fields:[{key:"paddingInner",default:.05},{key:"paddingOuter",default:.05},{key:"axisConfig",merge:!0,default:{scale:"time"}},{key:"end",default:F("end"),coerce:e=>"function"==typeof e?e:F(e),onSet:(e,i)=>{
3778
+ setup:e=>{e.schema.aggs.start||(e.schema.aggs.start=t.min),e.schema.aggs.end||(e.schema.aggs.end=t.max)},ctx:{axis:(new Ct).align("end").orient("bottom"),axisTest:(new Ct).align("end").gridSize(0).orient("bottom")},fields:[{key:"paddingInner",default:.05},{key:"paddingOuter",default:.05},{key:"axisConfig",merge:!0,default:{scale:"time"}},{key:"end",default:F("end"),coerce:e=>"function"==typeof e?e:F(e),onSet:(e,i)=>{
3674
3779
  // String accessor → also seed a default aggregation (max) for that key.
3675
3780
  const s="function"==typeof i?null:i;s&&!e.schema.aggs[s]&&(e.schema.aggs[s]=t.max)}},{key:"start",default:F("start"),coerce:e=>"function"==typeof e?e:F(e),onSet:(e,i)=>{const s="function"==typeof i?null:i;s&&!e.schema.aggs[s]&&(e.schema.aggs[s]=t.min)}},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e.schema.start(t,i),n=e.schema.end(t,i);return`${e._drawLabel(t,i)}, ${s} - ${n}.`}})}]};
3676
3781
  /**
3677
3782
  Creates a Priestley timeline based on an array of data.
3678
3783
  */
3679
- var _n=Bi(yn);const xn=2*Math.PI,bn=({viz:e})=>{const{width:n,height:a}=le(e),o=e.schema.outerPadding,r=e.schema.levels,c=e.schema.metric,h=e.schema.value,l=e.schema.axisConfig,d=(t.min([a,n])??0)/2-o,u=Math.max(0,d),m=e._filteredData,f=t.groups(m,c),g=t.groups(m,e._id,c),p=t.max(g.map(([,e])=>e.map(([,e])=>t.sum(e,(e,t)=>h(e,t)))).flat());if(!p)return e.ctx.groupData=[],e.ctx.pathConfig={},{shapeData:[]};
3784
+ var $n=Ri(An);const Bn=2*Math.PI,Pn=({viz:e})=>{const{width:n,height:a}=le(e),o=e.schema.outerPadding,r=e.schema.levels,c=e.schema.metric,h=e.schema.value,l=e.schema.axisConfig,d=(t.min([a,n])??0)/2-o,u=Math.max(0,d),m=e._filteredData,f=t.groups(m,c),g=t.groups(m,e._id,c),p=t.max(g.map(([,e])=>e.map(([,e])=>t.sum(e,(e,t)=>h(e,t)))).flat());if(!p)return e.ctx.groupData=[],e.ctx.pathConfig={},{shapeData:[]};
3680
3785
  // Decorations: emitted as flat SceneNodes onto `_chartScene` (the
3681
3786
  // chart-transformed group). Replaces the old `absorbShapeIntoChartScene`
3682
3787
  // calls that span up transient `Circle`/`Rect`/`Path` instances in
3683
3788
  // compute mode.
3684
- const y=Array.isArray(e._chartScene)?e._chartScene:e._chartScene=[],_=l.shapeConfig??{};((e,t,i,s,n)=>{const a=Ei(e,"Circle",i);delete a.label;
3789
+ const y=Array.isArray(e._chartScene)?e._chartScene:e._chartScene=[],_=l.shapeConfig??{};((e,t,i,s,n)=>{const a=Hi(e,"Circle",i);delete a.label;
3685
3790
  // Background concentric circles, one per level.
3686
- const o=[];for(let e=0;e<s;e++){const t=n*((e+1)/s),i={id:e,r:t},r=Li(a,i,e);o.push({type:"circle",key:`radar-radial-${e}`,cx:0,cy:0,r:t,datum:i,paint:r})}o.length&&t.push({type:"group",key:"radar-radial-circles",children:o})})(e,y,_,r,u);const x=e.schema.shapeConfig?.labelConfig,b=f.length,k=f.map(([t,i],n)=>{const a=2*(1.4*(x?.fontSize?.(i,n)??11)),r=o,c=parseInt(String(360-360/b*n/90),10)%4+1,h=xn/b*n;let l=360/b*n,d="start",m=10;2!==c&&3!==c||(m=-r-10,d="end",l+=180);const f={x:m,y:-a/2,width:r,height:a};return{__d3plus__:!0,data:s.merge(i,e.schema.aggs),i:n,id:t,key:t,angle:l,textAnchor:d,labelBounds:f,rotateAnchor:[-m,a/2],x:u*Math.cos(h),y:u*Math.sin(h)}}).sort((e,t)=>Number(e.key)-Number(t.key));((e,t,i,s,n)=>{
3791
+ const o=[];for(let e=0;e<s;e++){const t=n*((e+1)/s),i={id:e,r:t},r=Ni(a,i,e);o.push({type:"circle",key:`radar-radial-${e}`,cx:0,cy:0,r:t,datum:i,paint:r})}o.length&&t.push({type:"group",key:"radar-radial-circles",children:o})})(e,y,_,r,u);const x=e.schema.shapeConfig?.labelConfig,b=f.length,k=f.map(([t,i],n)=>{const a=2*(1.4*(x?.fontSize?.(i,n)??11)),r=o,c=parseInt(String(360-360/b*n/90),10)%4+1,h=Bn/b*n;let l=360/b*n,d="start",m=10;2!==c&&3!==c||(m=-r-10,d="end",l+=180);const f={x:m,y:-a/2,width:r,height:a};return{__d3plus__:!0,data:s.merge(i,e.schema.aggs),i:n,id:t,key:t,angle:l,textAnchor:d,labelBounds:f,rotateAnchor:[-m,a/2],x:u*Math.cos(h),y:u*Math.sin(h)}}).sort((e,t)=>Number(e.key)-Number(t.key));((e,t,i,s,n)=>{
3687
3792
  // Axis labels: one TextNode per axis, positioned at the axis vertex,
3688
3793
  // rotated to read along the spoke. The original code used a Rect with
3689
3794
  // zero width/height + label; here we emit only labels.
3690
- const a=Rs({data:n,label:e=>e.id,x:e=>e.x,y:e=>e.y,aes:()=>({}),rotate:e=>e.angle||0,id:e=>e.id,labelBounds:e=>e.labelBounds,labelConfig:i.shapeConfig?.labelConfig??{}});a.length&&t.push({type:"group",key:"radar-axis-labels",children:a});
3795
+ const a=Ks({data:n,label:e=>e.id,x:e=>e.x,y:e=>e.y,aes:()=>({}),rotate:e=>e.angle||0,id:e=>e.id,labelBounds:e=>e.labelBounds,labelConfig:i.shapeConfig?.labelConfig??{}});a.length&&t.push({type:"group",key:"radar-axis-labels",children:a});
3691
3796
  // Radial spokes: one Path from center to each axis vertex.
3692
- const o=Ei(e,"Path",s),r=n.map((e,t)=>{const i=Li(o,e,t);return{type:"path",key:`radar-spoke-${e.id}`,d:`M0,0 ${-e.x},${-e.y}`,datum:e,paint:i}});r.length&&t.push({type:"group",key:"radar-axis-spokes",children:r})})(e,y,l,_,k);const v=g.map(([i,n])=>{const a=n.map(([,e],i)=>{const s=t.sum(e,(e,t)=>h(e,t))/p*u,n=xn/b*i;return{x:s*Math.cos(n),y:s*Math.sin(n)}}),o=`M ${a[0].x} ${a[0].y} ${a.map(e=>`L ${e.x} ${e.y}`).join(" ")} L ${a[0].x} ${a[0].y}`,r=e.schema.aggs;return{__d3plus__:!0,arr:n.map(([,e])=>s.merge(e,r)),id:i,points:a,d:o,data:s.merge(n.map(([,e])=>s.merge(e,r)),r)}}),C=((e,s,n)=>{const a=Ei(e,"Path"),o=Object.keys(a.on??{});
3797
+ const o=Hi(e,"Path",s),r=n.map((e,t)=>{const i=Ni(o,e,t);return{type:"path",key:`radar-spoke-${e.id}`,d:`M0,0 ${-e.x},${-e.y}`,datum:e,paint:i}});r.length&&t.push({type:"group",key:"radar-axis-spokes",children:r})})(e,y,l,_,k);const v=g.map(([i,n])=>{const a=n.map(([,e],i)=>{const s=t.sum(e,(e,t)=>h(e,t))/p*u,n=Bn/b*i;return{x:s*Math.cos(n),y:s*Math.sin(n)}}),o=`M ${a[0].x} ${a[0].y} ${a.map(e=>`L ${e.x} ${e.y}`).join(" ")} L ${a[0].x} ${a[0].y}`,r=e.schema.aggs;return{__d3plus__:!0,arr:n.map(([,e])=>s.merge(e,r)),id:i,points:a,d:o,data:s.merge(n.map(([,e])=>s.merge(e,r)),r)}}),C=((e,s,n)=>{const a=Hi(e,"Path"),o=Object.keys(a.on??{});
3693
3798
  // Event-handler wrappers: cursor → nearest polygon vertex resolution.
3694
- a.on={};for(const r of o)a.on[r]=(a,o,c,h)=>{const l=a.points.map(e=>e.x+s/2),d=a.points.map(e=>e.y+n/2),u=i.pointer(h,e._select.node()),m=l.map(e=>Math.abs(e-u[0])),f=d.map(e=>Math.abs(e-u[1])),g=m.map((e,t)=>e+f[t]);e.schema.on[r].call(e,a.arr[g.indexOf(t.min(g))],o,c,h)};return a})(e,n,a);return e.ctx.groupData=v,e.ctx.pathConfig=C,{shapeData:v}},kn={name:"Radar",features:[ee,Q,Z,ne],layoutStage:bn,emit:({viz:e})=>{const t=e.ctx.groupData,i=e.ctx.pathConfig;if(!t||!i||!t.length)return[];const s=[];for(let e=0;e<t.length;e++){const n=t[e],a=n.data??n,o=Li(i,a,e);s.push({type:"path",key:`radar-${n.id}`,d:n.d,datum:a,paint:o})}return s},chartTransform:e=>{const{width:t,height:i}=le(e);return de(e,t,i)},ctx:{},fields:[{key:"discrete",default:"metric"},{key:"levels",default:6},{key:"metric",default:F("metric"),coerce:e=>"function"==typeof e?e:F(e)},{key:"outerPadding",default:100},{key:"shape",default:L("Path")},{key:"value",default:F("value"),coerce:e=>"function"==typeof e?e:F(e)},{key:"axisConfig",merge:!0,factory:e=>({shapeConfig:{fill:L("none"),labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},fontResize:!1,padding:0,textAnchor:e=>e.data?.textAnchor??"middle",verticalAlign:"middle"},stroke:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},strokeWidth:L(1)}})}]};
3799
+ a.on={};for(const r of o)a.on[r]=(a,o,c,h)=>{const l=a.points.map(e=>e.x+s/2),d=a.points.map(e=>e.y+n/2),u=i.pointer(h,e._select.node()),m=l.map(e=>Math.abs(e-u[0])),f=d.map(e=>Math.abs(e-u[1])),g=m.map((e,t)=>e+f[t]);e.schema.on[r].call(e,a.arr[g.indexOf(t.min(g))],o,c,h)};return a})(e,n,a);return e.ctx.groupData=v,e.ctx.pathConfig=C,{shapeData:v}},Tn={name:"Radar",features:[ee,Q,Z,ne],layoutStage:Pn,emit:({viz:e})=>{const t=e.ctx.groupData,i=e.ctx.pathConfig;if(!t||!i||!t.length)return[];const s=[];for(let e=0;e<t.length;e++){const n=t[e],a=n.data??n,o=Ni(i,a,e);s.push({type:"path",key:`radar-${n.id}`,d:n.d,datum:a,paint:o})}return s},chartTransform:e=>{const{width:t,height:i}=le(e);return de(e,t,i)},ctx:{},fields:[{key:"discrete",default:"metric"},{key:"levels",default:6},{key:"metric",default:F("metric"),coerce:e=>"function"==typeof e?e:F(e)},{key:"outerPadding",default:100},{key:"shape",default:L("Path"),coerce:"const"},{key:"value",default:F("value"),coerce:e=>"function"==typeof e?e:F(e)},{key:"axisConfig",merge:!0,factory:e=>({shapeConfig:{fill:L("none"),labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},fontResize:!1,padding:0,textAnchor:e=>e.data?.textAnchor??"middle",verticalAlign:"middle"},stroke:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},strokeWidth:L(1)}})}]};
3695
3800
  /** Emits background concentric circles, one per level, onto `chartScene`. */
3696
3801
  /**
3697
3802
  Creates a radar visualization based on an array of data.
3698
3803
  */
3699
- var vn=Bi(kn);const Cn=2*Math.PI,Sn=({viz:e})=>{const{rowValues:i,columnValues:s,shapeData:n}=Us.bind(e)(e._filteredData),{width:a,height:o}=le(e);if(!i.length||!s.length)return e.ctx.radialMatrixWidth=a,e.ctx.radialMatrixHeight=o,{shapeData:[]};e.ctx.radialMatrixWidth=a,e.ctx.radialMatrixHeight=o;const r=100,c=(t.min([o-100,a-200])??0)/2,h=s.slice().reverse();h.unshift(h.pop());const l=h.length,d=h.map((e,t)=>{const i=t/l*Cn,s=Math.round(180*i/Math.PI),n=Math.floor((s+90)/90%4+1),a=[0,180].includes(s)?-50:[2,3].includes(n)?-100:0,o=[90,270].includes(s)?-25:[2,1].includes(n)?-50:0;return{key:e,angle:s,quadrant:n,radians:i,x:c*Math.sin(i+Math.PI)+a,y:c*Math.cos(i+Math.PI)+o}}),u=e.schema.columnConfig;((e,t,i,s,n)=>{const a=e.ctx.columnLabels;a.renderMode("compute").select(void 0).data(t).x(e=>e.x).y(e=>e.y).text(e=>e.key).width(i).height(s).config(n).render();const o=a.toScene();var r;o&&((r=e)._chartScene||(r._chartScene=[])).push({type:"group",key:"radialmatrix-columns",children:o.children??[]})})(e,u.labels instanceof Array?d.filter(e=>u.labels.includes(e.key)):d,r,50,u.shapeConfig?.labelConfig);const m=(0,e.schema.innerRadius)(c),f=(c-m)/i.length,g=d.length>1?d[1].radians-d[0].radians:Cn,p=i.slice().reverse(),y=new Map;p.forEach((e,t)=>y.set(e,t));const _=new Map;s.forEach((e,t)=>_.set(e,t));const x=e.schema.cellPadding,b=P.arc().padAngle(x/c).innerRadius(e=>m+(y.get(e.row)??0)*f+x/2).outerRadius(e=>m+((y.get(e.row)??0)+1)*f-x/2).startAngle(e=>d[_.get(e.column)??0].radians-g/2).endAngle(e=>d[_.get(e.column)??0].radians+g/2);return e.ctx.arcData=b,{shapeData:n}};
3804
+ var On=Ri(Tn);const Rn=2*Math.PI,Ln=({viz:e})=>{const{rowValues:i,columnValues:s,shapeData:n}=hn.bind(e)(e._filteredData),{width:a,height:o}=le(e);if(!i.length||!s.length)return e.ctx.radialMatrixWidth=a,e.ctx.radialMatrixHeight=o,{shapeData:[]};e.ctx.radialMatrixWidth=a,e.ctx.radialMatrixHeight=o;const r=100,c=(t.min([o-100,a-200])??0)/2,h=s.slice().reverse();h.unshift(h.pop());const l=h.length,d=h.map((e,t)=>{const i=t/l*Rn,s=Math.round(180*i/Math.PI),n=Math.floor((s+90)/90%4+1),a=[0,180].includes(s)?-50:[2,3].includes(n)?-100:0,o=[90,270].includes(s)?-25:[2,1].includes(n)?-50:0;return{key:e,angle:s,quadrant:n,radians:i,x:c*Math.sin(i+Math.PI)+a,y:c*Math.cos(i+Math.PI)+o}}),u=e.schema.columnConfig;((e,t,i,s,n)=>{const a=e.ctx.columnLabels;a.renderMode("compute").select(void 0).data(t).x(e=>e.x).y(e=>e.y).text(e=>e.key).width(i).height(s).config(n).render();const o=a.toScene();var r;o&&((r=e)._chartScene||(r._chartScene=[])).push({type:"group",key:"radialmatrix-columns",children:o.children??[]})})(e,u.labels instanceof Array?d.filter(e=>u.labels.includes(e.key)):d,r,50,u.shapeConfig?.labelConfig);const m=(0,e.schema.innerRadius)(c),f=(c-m)/i.length,g=d.length>1?d[1].radians-d[0].radians:Rn,p=i.slice().reverse(),y=new Map;p.forEach((e,t)=>y.set(e,t));const _=new Map;s.forEach((e,t)=>_.set(e,t));const x=e.schema.cellPadding,b=P.arc().padAngle(x/c).innerRadius(e=>m+(y.get(e.row)??0)*f+x/2).outerRadius(e=>m+((y.get(e.row)??0)+1)*f-x/2).startAngle(e=>d[_.get(e.column)??0].radians-g/2).endAngle(e=>d[_.get(e.column)??0].radians+g/2);return e.ctx.arcData=b,{shapeData:n}};
3700
3805
  /** Renders the column-label TextBox in compute mode and absorbs it into `_chartScene`. */
3701
3806
  /**
3702
3807
  `radialMatrixEmit` — Path SceneNodes for each arc cell, using the
3703
3808
  `arcData` generator stashed on `viz.ctx`.
3704
3809
  */
3705
- function wn(e,t,i){return"function"==typeof e?e(t,i):e}const zn=(e,t)=>`${e}`.localeCompare(`${t}`),Dn={name:"RadialMatrix",features:[ee,Q,Z,ne],layoutStage:Sn,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.arcData,n=e.schema.shapeConfig??{};return i.map((t,i)=>{const a=wn(n.fill,t,i),o=wn(n.stroke,t,i),r=wn(n.strokeWidth,t,i);return{type:"path",key:`rm-${e._ids(t,i).join("-")}`,d:s(t),datum:t,paint:{fill:"string"==typeof a?a:void 0,stroke:o,strokeWidth:r}}})},chartTransform:e=>de(e,e.ctx.radialMatrixWidth,e.ctx.radialMatrixHeight),setup:e=>{const t=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(i,s,n,a)=>{
3810
+ function En(e,t,i){return"function"==typeof e?e(t,i):e}const Fn=(e,t)=>`${e}`.localeCompare(`${t}`),Wn={name:"RadialMatrix",features:[ee,Q,Z,ne],layoutStage:Ln,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.ctx.arcData,n=e.schema.shapeConfig??{};return i.map((t,i)=>{const a=En(n.fill,t,i),o=En(n.stroke,t,i),r=En(n.strokeWidth,t,i);return{type:"path",key:`rm-${e._ids(t,i).join("-")}`,d:s(t),datum:t,paint:{fill:"string"==typeof a?a:void 0,stroke:o,strokeWidth:r}}})},chartTransform:e=>de(e,e.ctx.radialMatrixWidth,e.ctx.radialMatrixHeight),setup:e=>{const t=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(i,s,n,a)=>{
3706
3811
  // A colorScale swatch routes through the shape path but has no row/column,
3707
3812
  // so its row/column hover would match nothing and wipe out the bucket
3708
3813
  // highlight `mouseenter` already set. Leave that highlight in place.
3709
- if(t(i,s,n,a),_e(n)||_e(i))return;const o=I.bind(e)("row",i,s),r=I.bind(e)("column",i,s);e.hover((t,i)=>I.bind(e)("row",t,i)===o||I.bind(e)("column",t,i)===r)}},ctx:{columnLabels:new Wt},fields:[{key:"cellPadding",default:2},{key:"column",default:F("column"),coerce:e=>"function"==typeof e?e:F(e)},{key:"row",default:F("row"),coerce:e=>"function"==typeof e?e:F(e)},{key:"columnList"},{key:"rowList"},{key:"columnSort",default:zn},{key:"rowSort",default:zn},{key:"innerRadius",default:e=>e/5,coerce:e=>"function"==typeof e?e:L(e)},{key:"columnConfig",merge:!0,factory:e=>({shapeConfig:{labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},padding:5,textAnchor:e=>[0,180].includes(e.angle)?"middle":[2,3].includes(e.quadrant)?"end":"start",verticalAlign:e=>[90,270].includes(e.angle)?"middle":[2,1].includes(e.quadrant)?"bottom":"top"}}})},{key:"label",factory:e=>(t,i)=>`${I.bind(e)("row",t,i)} / ${I.bind(e)("column",t,i)}`}]};
3814
+ if(t(i,s,n,a),_e(n)||_e(i))return;const o=I.bind(e)("row",i,s),r=I.bind(e)("column",i,s);e.hover((t,i)=>I.bind(e)("row",t,i)===o||I.bind(e)("column",t,i)===r)}},ctx:{columnLabels:new Gt},fields:[{key:"cellPadding",default:2},{key:"column",default:F("column"),coerce:e=>"function"==typeof e?e:F(e)},{key:"row",default:F("row"),coerce:e=>"function"==typeof e?e:F(e)},{key:"columnList"},{key:"rowList"},{key:"columnSort",default:Fn},{key:"rowSort",default:Fn},{key:"innerRadius",default:e=>e/5,coerce:e=>"function"==typeof e?e:L(e)},{key:"columnConfig",merge:!0,factory:e=>({shapeConfig:{labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)},padding:5,textAnchor:e=>[0,180].includes(e.angle)?"middle":[2,3].includes(e.quadrant)?"end":"start",verticalAlign:e=>[90,270].includes(e.angle)?"middle":[2,1].includes(e.quadrant)?"bottom":"top"}}})},{key:"label",coerce:"const",factory:e=>(t,i)=>`${I.bind(e)("row",t,i)} / ${I.bind(e)("column",t,i)}`}]};
3710
3815
  /**
3711
3816
  Creates a radial layout of a rows/columns Matrix of any dataset.
3712
3817
  */
3713
- var Mn=Bi(Dn);
3818
+ var Nn=Ri(Wn);
3714
3819
  /** Shared empty `ringsCtx` value for the early-return branches. */
3715
3820
  /**
3716
3821
  Claim the center node + two rings, compute each node's angle/position, build
3717
3822
  the radius scale, and size every node. Returns the rebuilt `nodes` array
3718
3823
  plus the `primaries`/`secondaries` rings.
3719
3824
  */
3720
- function An(e,i,s,n,a,o){const{width:r,height:c,primaryRing:h,secondaryRing:l}=a;n.x=r/2,n.y=c/2,n.r=e.schema.sizeMin?t.max([e.schema.sizeMin,.65*h]):e.schema.sizeMax?t.min([e.schema.sizeMax,.65*h]):.65*h;const d=[n],u=[];(s[e.schema.center]||[]).forEach(t=>{const i=t.source.id===e.schema.center?t.target:t.source;i.edges=s[i.id].filter(t=>t.source.id!==e.schema.center||t.target.id!==e.schema.center),i.edge=t,d.push(i),u.push(i)}),u.sort((e,t)=>e.edges.length-t.edges.length);const m=[];let f=0;u.forEach(e=>{const t=e.id;e.edges=e.edges.filter(e=>!d.includes(e.source)&&e.target.id===t||!d.includes(e.target)&&e.source.id===t),f+=e.edges.length||1,e.edges.forEach(e=>{const{source:i,target:s}=e,n=s.id===t?i:s;d.push(n)})});const g=2*Math.PI;let p=0;u.forEach((e,t)=>{const i=e.edges,s=i.length||1,n=g/f*s;0===t&&(p-=n/2);const a=p+n/2-g/4;e.radians=a,e.x=r/2+h*Math.cos(a),e.y=c/2+h*Math.sin(a),p+=n,i.forEach((t,i)=>{const n=t.source.id===e.id?t.target:t.source,o=g/f,h=a-o*s/2+o/2+o*i;n.radians=h,n.x=r/2+l*Math.cos(h),n.y=c/2+l*Math.sin(h),m.push(n)})}),
3825
+ function Hn(e,i,s,n,a,o){const{width:r,height:c,primaryRing:h,secondaryRing:l}=a;n.x=r/2,n.y=c/2,n.r=e.schema.sizeMin?t.max([e.schema.sizeMin,.65*h]):e.schema.sizeMax?t.min([e.schema.sizeMax,.65*h]):.65*h;const d=[n],u=[];(s[e.schema.center]||[]).forEach(t=>{const i=t.source.id===e.schema.center?t.target:t.source;i.edges=s[i.id].filter(t=>t.source.id!==e.schema.center||t.target.id!==e.schema.center),i.edge=t,d.push(i),u.push(i)}),u.sort((e,t)=>e.edges.length-t.edges.length);const m=[];let f=0;u.forEach(e=>{const t=e.id;e.edges=e.edges.filter(e=>!d.includes(e.source)&&e.target.id===t||!d.includes(e.target)&&e.source.id===t),f+=e.edges.length||1,e.edges.forEach(e=>{const{source:i,target:s}=e,n=s.id===t?i:s;d.push(n)})});const g=2*Math.PI;let p=0;u.forEach((e,t)=>{const i=e.edges,s=i.length||1,n=g/f*s;0===t&&(p-=n/2);const a=p+n/2-g/4;e.radians=a,e.x=r/2+h*Math.cos(a),e.y=c/2+h*Math.sin(a),p+=n,i.forEach((t,i)=>{const n=t.source.id===e.id?t.target:t.source,o=g/f,h=a-o*s/2+o/2+o*i;n.radians=h,n.x=r/2+l*Math.cos(h),n.y=c/2+l*Math.sin(h),m.push(n)})}),
3721
3826
  /**
3722
3827
  Build the radius scale from the size extent (or ring defaults) and assign
3723
3828
  each ring node its `ring` + `r`. Mutates `center.r` and every ring node.
@@ -3726,7 +3831,7 @@ function(e,i,s,n,a,o){const{ringWidth:r}=s,c=r/2,h=r/4;let l=c/2-4;c/2-4<8&&(l=t
3726
3831
  /**
3727
3832
  Resolve link endpoints to placed nodes, compute bezier control points for
3728
3833
  spline edges, and push every edge onto `edges` (mutated in place).
3729
- */(e,n,a,o,u,m);return{nodes:[n].concat(u).concat(m),primaries:u,secondaries:m}}const $n=({viz:e})=>{const i=e;if(Array.isArray(i._filteredData)||(i._filteredData=[]),Array.isArray(i.schema.nodes)||(i.schema.nodes=[]),Array.isArray(i.schema.links)||(i.schema.links=[]),!i._filteredData.length&&!i.schema.nodes.length&&!i.schema.links.length)return i.ctx.nodeLookup={},i.ctx.linkLookup={},i.ctx.ringsCtx={edges:[],nodeGroups:[],linkConfig:{},linkD:()=>"",nodeShapeConfig:{}},{viz:e};const s=i._filteredData.reduce((e,t,s)=>(e[i._id(t,s)]=t,e),{}),{nodeLookup:a,links:o,linkMap:r}=
3834
+ */(e,n,a,o,u,m);return{nodes:[n].concat(u).concat(m),primaries:u,secondaries:m}}const jn=({viz:e})=>{const i=e;if(Array.isArray(i._filteredData)||(i._filteredData=[]),Array.isArray(i.schema.nodes)||(i.schema.nodes=[]),Array.isArray(i.schema.links)||(i.schema.links=[]),!i._filteredData.length&&!i.schema.nodes.length&&!i.schema.links.length)return i.ctx.nodeLookup={},i.ctx.linkLookup={},i.ctx.ringsCtx={edges:[],nodeGroups:[],linkConfig:{},linkD:()=>"",nodeShapeConfig:{}},{viz:e};const s=i._filteredData.reduce((e,t,s)=>(e[i._id(t,s)]=t,e),{}),{nodeLookup:a,links:o,linkMap:r}=
3730
3835
  /**
3731
3836
  Build the Rings node set + link descriptors from filtered data and schema
3732
3837
  nodes/links. Stashes `nodeLookup` on `viz.ctx` and returns the working
@@ -3744,17 +3849,17 @@ const n=a[s];if(n)return n;if(!isNaN(s)){const e=a[parseFloat(s)];if(e)return e}
3744
3849
  // the raw value, then its coerced form.
3745
3850
  let f=a[i.schema.center];if(f||null==i.schema.center||isNaN(i.schema.center)||(f=a[parseFloat(i.schema.center)]),!f)return i.ctx.ringsCtx={edges:[],nodeGroups:[],linkConfig:{},linkD:()=>"",nodeShapeConfig:{}},{viz:e};
3746
3851
  // Normalize so downstream comparisons against node ids use the matched id.
3747
- i.schema.center=f.id;const{nodes:g,primaries:p,secondaries:y}=An(i,0,r,f,m,s);return function(e,t,i,s,n,a,o,r){const{width:c,height:h,ringWidth:l,primaryRing:d,secondaryRing:u}=o;i.forEach(e=>{const o=e.edge;["source","target"].forEach(e=>{o[e]=t.find(t=>t.id===o[e].id)}),r.push(o),n[e.id].forEach(n=>{const o=n.source.id===e.id?n.target:n.source;if(o.id===a.id)return;let m=s.find(e=>e.id===o.id);if(m||(m=i.find(e=>e.id===o.id)),!m)return;n.spline=!0;const f=c/2,g=h/2,p=d+.5*(u-d);["source","target"].forEach((i,s)=>{const a=n[i],o=a.radians,r=a.ring,c=a.x,h=a.y,d=a.r,u=2===r?o+Math.PI:o;n[`${i}X`]=c+Math.cos(u)*d,n[`${i}Y`]=h+Math.sin(u)*d,n[`${i}BisectX`]=f+p*Math.cos(o),n[`${i}BisectY`]=g+p*Math.sin(o),n[i]=t.find(e=>e.id===a.id);const y=n[i];void 0===y.edges&&(y.edges={});const _=0===s?n.target.id:n.source.id,x=y.edges;y.id===e.id?x[_]={angle:e.radians+Math.PI,radius:l/2}:x[_]={angle:m.radians,radius:l/2}}),r.push(n)})})}
3852
+ i.schema.center=f.id;const{nodes:g,primaries:p,secondaries:y}=Hn(i,0,r,f,m,s);return function(e,t,i,s,n,a,o,r){const{width:c,height:h,ringWidth:l,primaryRing:d,secondaryRing:u}=o;i.forEach(e=>{const o=e.edge;["source","target"].forEach(e=>{o[e]=t.find(t=>t.id===o[e].id)}),r.push(o),n[e.id].forEach(n=>{const o=n.source.id===e.id?n.target:n.source;if(o.id===a.id)return;let m=s.find(e=>e.id===o.id);if(m||(m=i.find(e=>e.id===o.id)),!m)return;n.spline=!0;const f=c/2,g=h/2,p=d+.5*(u-d);["source","target"].forEach((i,s)=>{const a=n[i],o=a.radians,r=a.ring,c=a.x,h=a.y,d=a.r,u=2===r?o+Math.PI:o;n[`${i}X`]=c+Math.cos(u)*d,n[`${i}Y`]=h+Math.sin(u)*d,n[`${i}BisectX`]=f+p*Math.cos(o),n[`${i}BisectY`]=g+p*Math.sin(o),n[i]=t.find(e=>e.id===a.id);const y=n[i];void 0===y.edges&&(y.edges={});const _=0===s?n.target.id:n.source.id,x=y.edges;y.id===e.id?x[_]={angle:e.radians+Math.PI,radius:l/2}:x[_]={angle:m.radians,radius:l/2}}),r.push(n)})})}
3748
3853
  /** Compute each node's label bounds, rotation, and text anchor (mutated in place). */(0,g,p,y,r,f,m,l),function(e,t,i){const{primaryRing:s,ringWidth:n}=i;t.forEach(t=>{if(t.id===e.schema.center)return void(t.labelBounds={x:-s/2,y:-s/2,width:s,height:s});const i=e.schema.shapeConfig.labelConfig,a=1.4*(i?.fontSize&&i.fontSize(t)||11),o=2*a,r=n-t.r;let c=t.radians*(180/Math.PI),h=t.r+5,l="start";(c<-90||c>90)&&(h=-t.r-r-5,l="end",c+=180),t.labelBounds={x:h,y:-a/2,width:r,height:o},t.rotate=c,t.textAnchor=l})}
3749
3854
  /**
3750
3855
  Build the link/node shape config + `linkD` accessor, scale link strokes, and
3751
3856
  stash `linkLookup` + `ringsCtx` on `viz.ctx`.
3752
- */(i,g,m),function(e,i,s,a,o){e.ctx.linkLookup=a.reduce((e,t)=>(e[t.source.id]||(e[t.source.id]=[]),e[t.source.id].push(t.target),e[t.target.id]||(e[t.target.id]=[]),e[t.target.id].push(t.source),e),{});const r=t.extent(a,e=>e.size);if(r[0]!==r[1]){const s=t.min(i,e=>e.r),n=B[`scale${e.schema.linkSizeScale.charAt(0).toUpperCase()}${e.schema.linkSizeScale.slice(1)}`]().domain(r).range([e.schema.linkSizeMin,s]);a.forEach(e=>{e.size=n(e.size)})}const c=Ei(e,"Path",e.schema.shapeConfig,"edge");delete c.on;const h={label:t=>!!(i.length<=e.schema.dataCutoff||e._hover&&e._hover(t)||e._active&&e._active(t))&&e._drawLabel(t.data||t.node,t.i),labelBounds:e=>e.labelBounds,labelConfig:{fontColor:t=>{const i=t.data??t;if(i.id===e.schema.center){const t=Ri(Ei(e,i.key??i.shape).fill,i.data??i,i.i);return u.colorContrast("string"==typeof t?t:"rgb(255, 255, 255)")}return u.colorContrast(e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)")},fontResize:t=>(t.data??t).id===e.schema.center,padding:0,textAnchor:t=>{const i=t.data??t;return s[i.id]?.textAnchor||Ei(e,i.key??i.shape).labelConfig.textAnchor},verticalAlign:t=>(t.data??t).id===e.schema.center?"middle":"top"},rotate:e=>s[e.id].rotate||0},l=Array.from(t.groups(i,e=>e.shape));e.ctx.ringsCtx={edges:o,nodeGroups:l,linkConfig:c,linkD:e=>e.spline?`M${e.sourceX},${e.sourceY}C${e.sourceBisectX},${e.sourceBisectY} ${e.targetBisectX},${e.targetBisectY} ${e.targetX},${e.targetY}`:`M${e.source.x},${e.source.y} ${e.target.x},${e.target.y}`,nodeShapeConfig:h}}(i,g,a,o,l),{shapeData:g}};const Bn={name:"Rings",features:[ee,Q,Z,ne],layoutStage:$n,emit:({viz:e})=>{const t=e.ctx.ringsCtx;if(!t)return[];const i=[];if(t.edges&&t.edges.length)for(let e=0;e<t.edges.length;e++){const s=t.edges[e],n=s,a=Li(t.linkConfig,n,e);"number"==typeof s.size&&(a.strokeWidth=s.size),i.push({type:"path",key:`rings-link-${s.source.id}-${s.target.id}`,d:t.linkD(s),datum:n,paint:a})}if(t.nodeGroups&&t.nodeGroups.length){const s=t.nodeShapeConfig;for(const[n,a]of t.nodeGroups){if(!a.length)continue;const o={...Ei(e,n),...t.nodeShapeConfig};for(let e=0;e<a.length;e++){const t=a[e],r=t.data??t,c=Li(o,r,t.i??e);
3857
+ */(i,g,m),function(e,i,s,a,o){e.ctx.linkLookup=a.reduce((e,t)=>(e[t.source.id]||(e[t.source.id]=[]),e[t.source.id].push(t.target),e[t.target.id]||(e[t.target.id]=[]),e[t.target.id].push(t.source),e),{});const r=t.extent(a,e=>e.size);if(r[0]!==r[1]){const s=t.min(i,e=>e.r),n=B[`scale${e.schema.linkSizeScale.charAt(0).toUpperCase()}${e.schema.linkSizeScale.slice(1)}`]().domain(r).range([e.schema.linkSizeMin,s]);a.forEach(e=>{e.size=n(e.size)})}const c=Hi(e,"Path",e.schema.shapeConfig,"edge");delete c.on;const h={label:t=>!!(i.length<=e.schema.dataCutoff||e._hover&&e._hover(t)||e._active&&e._active(t))&&e._drawLabel(t.data||t.node,t.i),labelBounds:e=>e.labelBounds,labelConfig:{fontColor:t=>{const i=t.data??t;if(i.id===e.schema.center){const t=Wi(Hi(e,i.key??i.shape).fill,i.data??i,i.i);return u.colorContrast("string"==typeof t?t:"rgb(255, 255, 255)")}return u.colorContrast(e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)")},fontResize:t=>(t.data??t).id===e.schema.center,padding:0,textAnchor:t=>{const i=t.data??t;return s[i.id]?.textAnchor||Hi(e,i.key??i.shape).labelConfig.textAnchor},verticalAlign:t=>(t.data??t).id===e.schema.center?"middle":"top"},rotate:e=>s[e.id].rotate||0},l=Array.from(t.groups(i,e=>e.shape));e.ctx.ringsCtx={edges:o,nodeGroups:l,linkConfig:c,linkD:e=>e.spline?`M${e.sourceX},${e.sourceY}C${e.sourceBisectX},${e.sourceBisectY} ${e.targetBisectX},${e.targetBisectY} ${e.targetX},${e.targetY}`:`M${e.source.x},${e.source.y} ${e.target.x},${e.target.y}`,nodeShapeConfig:h}}(i,g,a,o,l),{shapeData:g}};const Gn={name:"Rings",features:[ee,Q,Z,ne],layoutStage:jn,emit:({viz:e})=>{const t=e.ctx.ringsCtx;if(!t)return[];const i=[];if(t.edges&&t.edges.length)for(let e=0;e<t.edges.length;e++){const s=t.edges[e],n=s,a=Ni(t.linkConfig,n,e);"number"==typeof s.size&&(a.strokeWidth=s.size),i.push({type:"path",key:`rings-link-${s.source.id}-${s.target.id}`,d:t.linkD(s),datum:n,paint:a})}if(t.nodeGroups&&t.nodeGroups.length){const s=t.nodeShapeConfig;for(const[n,a]of t.nodeGroups){if(!a.length)continue;const o={...Hi(e,n),...t.nodeShapeConfig};for(let e=0;e<a.length;e++){const t=a[e],r=t.data??t,c=Ni(o,r,t.i??e);
3753
3858
  // Nodes are data shapes: keep their stroke a constant screen width as the
3754
3859
  // diagram zooms (the edges above deliberately scale with the zoom).
3755
- void 0===c.vectorEffect&&(c.vectorEffect="non-scaling-stroke");const h=s.rotate?s.rotate(t):0,l=h?{x:t.x,y:t.y,rotate:h}:{x:t.x,y:t.y};if("Circle"===n)i.push({type:"circle",key:`rings-${n}-${t.id}`,cx:0,cy:0,r:t.r,datum:r,paint:c,transform:l});else if("Rect"===n){const s=Number(Ri(o.width,r,t.i??e)??2*t.r),a=Number(Ri(o.height,r,t.i??e)??2*t.r);i.push({type:"rect",key:`rings-${n}-${t.id}`,x:-s/2,y:-a/2,width:s,height:a,datum:r,paint:c,transform:l})}
3860
+ void 0===c.vectorEffect&&(c.vectorEffect="non-scaling-stroke");const h=s.rotate?s.rotate(t):0,l=h?{x:t.x,y:t.y,rotate:h}:{x:t.x,y:t.y};if("Circle"===n)i.push({type:"circle",key:`rings-${n}-${t.id}`,cx:0,cy:0,r:t.r,datum:r,paint:c,transform:l});else if("Rect"===n){const s=Number(Wi(o.width,r,t.i??e)??2*t.r),a=Number(Wi(o.height,r,t.i??e)??2*t.r);i.push({type:"rect",key:`rings-${n}-${t.id}`,x:-s/2,y:-a/2,width:s,height:a,datum:r,paint:c,transform:l})}
3756
3861
  // Other shape kinds: skipped (Rings's default is Circle).
3757
- }if(s.label&&s.labelBounds){const e=s.label,t=s.labelBounds,n=Rs({data:a,label:(t,i)=>e(t,i),x:e=>e.x,y:e=>e.y,aes:e=>({r:e.r}),rotate:e=>s.rotate?s.rotate(e):0,id:e=>`rings-label-${e.id}`,labelBounds:(e,i)=>t(e),labelConfig:s.labelConfig??{}});i.push(...n)}}}return i},setup:e=>{!
3862
+ }if(s.label&&s.labelBounds){const e=s.label,t=s.labelBounds,n=Ks({data:a,label:(t,i)=>e(t,i),x:e=>e.x,y:e=>e.y,aes:e=>({r:e.r}),rotate:e=>s.rotate?s.rotate(e):0,id:e=>`rings-label-${e.id}`,labelBounds:(e,i)=>t(e),labelConfig:s.labelConfig??{}});i.push(...n)}}}return i},setup:e=>{!
3758
3863
  /** Installs Rings' nodes/links/size/hover fluent accessors onto the instance. */function(e){const t=e,i=(e,t,i,n)=>s.addToQueue.bind(e)(t,i,n);t.links=function(e,t){return arguments.length?(i(this,e,t,"links"),this):this.schema.links},t.nodes=function(e,t){return arguments.length?(i(this,e,t,"nodes"),this):this.schema.nodes},t.linkSize=function(e){return arguments.length?(this.schema.linkSize="function"==typeof e?e:L(e),this):this.schema.linkSize},t.nodeGroupBy=function(e){if(!arguments.length)return this.schema.nodeGroupBy;const t=e instanceof Array?e:[e];return this.schema.nodeGroupBy=t.map(e=>"function"==typeof e?e:(this.schema.aggs[e]||(this.schema.aggs[e]=(e,t)=>{const i=Array.from(new Set(e.map(t)));return 1===i.length?i[0]:i}),F(e))),this},t.size=function(e){return arguments.length?(this._size="function"!=typeof e&&e?F(e):e,this):this._size},t.hover=function(e){const t=e;return this._hover=e,this._shapes.forEach(e=>e.hover(t)),this.schema.legend&&this._legendClass.hover(t),
3759
3864
  // Scene-emit charts dim via applyInteractionOpacity during toScene(); a
3760
3865
  // hover change only takes effect once a repaint is scheduled.
@@ -3766,34 +3871,34 @@ e.hover?.(!1),e._tooltipClass?.data([]).render(),e.schema.center=t.id,e._margin=
3766
3871
  // _draw() only recomputes layout/scene; paint it with the chart duration
3767
3872
  // so the re-centering animates (a bare _draw leaves the only repaint to
3768
3873
  // the coalesced duration-0 one, which snaps).
3769
- e._sceneRenderer&&e._drawSceneToTarget(e.schema.duration)}},ctx:{},fields:[{key:"center"},{key:"tooltipConfig",merge:!0,factory:e=>({title:t=>{const i=t;return t&&i.source&&i.target?`${i.source.id} → ${i.target.id}`:e._drawLabel(t,"number"==typeof t.i?t.i:0)}})},{key:"links",default:[]},{key:"linkSize",default:L(1)},{key:"linkSizeMin",default:1},{key:"linkSizeScale",default:"sqrt"},{key:"noDataMessage",default:!1},{key:"nodes",default:[]},{key:"sizeMax"},{key:"sizeMin",default:5},{key:"sizeScale",default:"sqrt"},{key:"shape",default:L("Circle")},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e._size,n=s?`, ${s(t,i)}`:"";return`${e._drawLabel(t,i)}${n}.`},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee",strokeWidth:1}})}]};
3874
+ e._sceneRenderer&&e._drawSceneToTarget(e.schema.duration)}},ctx:{},fields:[{key:"center"},{key:"tooltipConfig",merge:!0,factory:e=>({title:t=>{const i=t;return t&&i.source&&i.target?`${i.source.id} → ${i.target.id}`:e._drawLabel(t,"number"==typeof t.i?t.i:0)}})},{key:"links",default:[]},{key:"linkSize",default:L(1)},{key:"linkSizeMin",default:1},{key:"linkSizeScale",default:"sqrt"},{key:"noDataMessage",default:!1},{key:"nodes",default:[]},{key:"sizeMax"},{key:"sizeMin",default:5},{key:"sizeScale",default:"sqrt"},{key:"shape",default:L("Circle"),coerce:"const"},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s=e._size,n=s?`, ${s(t,i)}`:"";return`${e._drawLabel(t,i)}${n}.`},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee",strokeWidth:1}})}]};
3770
3875
  /**
3771
3876
  Creates a ring visualization based on a defined set of nodes and edges.
3772
- */var Pn=Bi(Bn);const Tn=({viz:e})=>{const i=e,{width:s,height:n}=le(i),a=Array.isArray(i.schema.nodes)&&i.schema.nodes.length>0,o=Array.isArray(i.schema.links)&&i.schema.links.length>0;if(!a&&!o)return i.ctx.nodeLookup={},i.ctx.linkLookup={},{viz:e};let r;if(a)r=i.schema.nodes;else{const e=new Set,t=[];for(const s of i.schema.links){const n=s[i.schema.linksSource];e.has(n)||(e.add(n),t.push(n));const a=s[i.schema.linksTarget];e.has(a)||(e.add(a),t.push(a))}r=t.map(e=>({id:e}))}const c=r.map((e,t)=>({__d3plus__:!0,data:e,i:t,id:i.schema.nodeId(e,t),node:e,shape:"Rect"})),h=c.reduce((e,t,i)=>(e[String(t.id)]=i,e),{});i.ctx.nodeLookup=h;const l=o?i.schema.links.map((e,t)=>({source:h[String(e[i.schema.linksSource])],target:h[String(e[i.schema.linksTarget])],value:i.schema.value(e,t)})):[];i.ctx.linkLookup=l.reduce((e,t)=>(e[t.source]||(e[t.source]=[]),e[t.source].push(t.target),e[t.target]||(e[t.target]=[]),e[t.target].push(t.source),e),{}),i.ctx.sankey.nodeAlign(i.schema.nodeAlign).nodePadding(i.schema.nodePadding).nodeWidth(i.schema.nodeWidth).nodes(c).nodeSort(i.schema.nodeSort).links(l).linkSort(i.schema.linkSort).iterations(i.schema.iterations).size([s,n])();const d=Array.from(t.groups(c,e=>e.shape));return i.ctx.sankeyCtx={links:l,nodeGroups:d,pathFn:i.ctx.path},{shapeData:c}},On={center:A.sankeyCenter,justify:A.sankeyJustify,left:A.sankeyLeft,right:A.sankeyRight},Rn={name:"Sankey",features:[ee,Q,Z,ne],layoutStage:Tn,emit:({viz:e})=>{const t=e.ctx.sankeyCtx;if(!t)return[];const i=[],s=e.schema.shapeConfig?.Path??{};
3877
+ */var In=Ri(Gn);const qn=({viz:e})=>{const i=e,{width:s,height:n}=le(i),a=Array.isArray(i.schema.nodes)&&i.schema.nodes.length>0,o=Array.isArray(i.schema.links)&&i.schema.links.length>0;if(!a&&!o)return i.ctx.nodeLookup={},i.ctx.linkLookup={},{viz:e};let r;if(a)r=i.schema.nodes;else{const e=new Set,t=[];for(const s of i.schema.links){const n=s[i.schema.linksSource];e.has(n)||(e.add(n),t.push(n));const a=s[i.schema.linksTarget];e.has(a)||(e.add(a),t.push(a))}r=t.map(e=>({id:e}))}const c=r.map((e,t)=>({__d3plus__:!0,data:e,i:t,id:i.schema.nodeId(e,t),node:e,shape:"Rect"})),h=c.reduce((e,t,i)=>(e[String(t.id)]=i,e),{});i.ctx.nodeLookup=h;const l=o?i.schema.links.map((e,t)=>({source:h[String(e[i.schema.linksSource])],target:h[String(e[i.schema.linksTarget])],value:i.schema.value(e,t)})):[];i.ctx.linkLookup=l.reduce((e,t)=>(e[t.source]||(e[t.source]=[]),e[t.source].push(t.target),e[t.target]||(e[t.target]=[]),e[t.target].push(t.source),e),{}),i.ctx.sankey.nodeAlign(i.schema.nodeAlign).nodePadding(i.schema.nodePadding).nodeWidth(i.schema.nodeWidth).nodes(c).nodeSort(i.schema.nodeSort).links(l).linkSort(i.schema.linkSort).iterations(i.schema.iterations).size([s,n])();const d=Array.from(t.groups(c,e=>e.shape));return i.ctx.sankeyCtx={links:l,nodeGroups:d,pathFn:i.ctx.path},{shapeData:c}},Yn={center:A.sankeyCenter,justify:A.sankeyJustify,left:A.sankeyLeft,right:A.sankeyRight},Kn={name:"Sankey",features:[ee,Q,Z,ne],layoutStage:qn,emit:({viz:e})=>{const t=e.ctx.sankeyCtx;if(!t)return[];const i=[],s=e.schema.shapeConfig?.Path??{};
3773
3878
  // Sankey's link config is the raw `viz.schema.shapeConfig.Path` (no
3774
3879
  // configPrep wrap) because links are raw `{source, target, value}`
3775
3880
  // records — not d3plus-wrapped.
3776
- if(t.links&&t.links.length)for(let e=0;e<t.links.length;e++){const n=t.links[e],a=Li(s,n,e);i.push({type:"path",shapeType:"Link",key:`sankey-link-${n.source.id??""}-${n.target.id??""}`,d:t.pathFn(n),datum:n,paint:a})}if(t.nodeGroups&&t.nodeGroups.length)for(const[s,n]of t.nodeGroups){if(!n.length)continue;const t=Ei(e,s);for(let e=0;e<n.length;e++){const a=n[e],o=a.data??a,r=Li(t,o,a.i??e);if("Rect"===s)i.push({type:"rect",key:`sankey-${s}-${a.id}`,x:a.x0,y:a.y0,width:a.x1-a.x0,height:a.y1-a.y0,datum:o,paint:r});else if("Circle"===s){const n=Number(Ri(t.r,o,a.i??e)??0);i.push({type:"circle",key:`sankey-${s}-${a.id}`,cx:(a.x0+a.x1)/2,cy:(a.y0+a.y1)/2,r:n,datum:o,paint:r})}
3881
+ if(t.links&&t.links.length)for(let e=0;e<t.links.length;e++){const n=t.links[e],a=Ni(s,n,e);i.push({type:"path",shapeType:"Link",key:`sankey-link-${n.source.id??""}-${n.target.id??""}`,d:t.pathFn(n),datum:n,paint:a})}if(t.nodeGroups&&t.nodeGroups.length)for(const[s,n]of t.nodeGroups){if(!n.length)continue;const t=Hi(e,s);for(let e=0;e<n.length;e++){const a=n[e],o=a.data??a,r=Ni(t,o,a.i??e);if("Rect"===s)i.push({type:"rect",key:`sankey-${s}-${a.id}`,x:a.x0,y:a.y0,width:a.x1-a.x0,height:a.y1-a.y0,datum:o,paint:r});else if("Circle"===s){const n=Number(Wi(t.r,o,a.i??e)??0);i.push({type:"circle",key:`sankey-${s}-${a.id}`,cx:(a.x0+a.x1)/2,cy:(a.y0+a.y1)/2,r:n,datum:o,paint:r})}
3777
3882
  // Other shape kinds: skipped (Sankey's default is Rect).
3778
3883
  }}return i},setup:e=>{const t=e;e.schema.on.mouseenter=()=>{},e.schema.on["mouseleave.shape"]=()=>{t.hover(!1)};const i=e.schema.on["mousemove.shape"];e.schema.on["mousemove.shape"]=(s,n,a,o)=>{if(i(s,n,a,o),e._focus&&e._focus===s.id)return t.hover(!1),e.schema.on.mouseenter.bind(e)(s,n,a,o),void(e._focus=void 0);
3779
3884
  // An edge datum is a `{source, target}` link, not a node — highlight the
3780
3885
  // hovered link plus its two endpoint nodes.
3781
- const r=s;if(r.source&&r.target){const i=r.source.id,s=r.target.id;return void t.hover((t,n)=>{if(t.source&&t.target)return t.source.id===i&&t.target.id===s;const a=e.schema.nodeId(t,n);return a===i||a===s})}const c=e.schema.nodeId(s,n),h=e.ctx.nodeLookup[String(c)],l=e.ctx.nodeLookup,d=Object.keys(l).reduce((e,t)=>(e[l[t]]=isNaN(Number(t))?t:parseInt(t,10),e),{}),u=e.ctx.linkLookup[h]??[],m=[c];u.forEach(e=>m.push(d[e])),t.hover((t,i)=>t.source&&t.target?t.source.id===c||t.target.id===c:m.includes(e.schema.nodeId(t,i)))},t.links=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"links"),this):this.schema.links},t.nodes=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"nodes"),this):this.schema.nodes},t.nodeAlign=function(e){return arguments.length?(this.schema.nodeAlign="function"==typeof e?e:On[e],this):this.schema.nodeAlign},t.nodeId=function(e){return arguments.length?(this.schema.nodeId="function"==typeof e?e:F(e),this):this.schema.nodeId},t.value=function(e){return arguments.length?(this.schema.value="function"==typeof e?e:F(e),this):this.schema.value},t.hover=function(e){return this._hover=e,(this._shapes??[]).forEach(t=>t.hover(e)),this.schema.legend&&this._legendClass&&this._legendClass.hover(e),
3886
+ const r=s;if(r.source&&r.target){const i=r.source.id,s=r.target.id;return void t.hover((t,n)=>{if(t.source&&t.target)return t.source.id===i&&t.target.id===s;const a=e.schema.nodeId(t,n);return a===i||a===s})}const c=e.schema.nodeId(s,n),h=e.ctx.nodeLookup[String(c)],l=e.ctx.nodeLookup,d=Object.keys(l).reduce((e,t)=>(e[l[t]]=isNaN(Number(t))?t:parseInt(t,10),e),{}),u=e.ctx.linkLookup[h]??[],m=[c];u.forEach(e=>m.push(d[e])),t.hover((t,i)=>t.source&&t.target?t.source.id===c||t.target.id===c:m.includes(e.schema.nodeId(t,i)))},t.links=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"links"),this):this.schema.links},t.nodes=function(e,t){return arguments.length?(s.addToQueue.bind(this)(e,t,"nodes"),this):this.schema.nodes},t.nodeAlign=function(e){return arguments.length?(this.schema.nodeAlign="function"==typeof e?e:Yn[e],this):this.schema.nodeAlign},t.nodeId=function(e){return arguments.length?(this.schema.nodeId="function"==typeof e?e:F(e),this):this.schema.nodeId},t.value=function(e){return arguments.length?(this.schema.value="function"==typeof e?e:F(e),this):this.schema.value},t.hover=function(e){return this._hover=e,(this._shapes??[]).forEach(t=>t.hover(e)),this.schema.legend&&this._legendClass&&this._legendClass.hover(e),
3782
3887
  // Scene-rendered Sankey emits into `_chartScene`, not `_shapes`, so the
3783
3888
  // forEach above can't dim anything. Repaint so the scene's
3784
3889
  // interaction-opacity pass re-reads `_hover` and dims non-matching nodes.
3785
3890
  // Coalesced to one paint per frame (see Viz._scheduleSceneRepaint).
3786
- this._sceneRenderer&&this._scheduleSceneRepaint(),this}},ctx:{sankey:A.sankey(),path:A.sankeyLinkHorizontal()},fields:[{key:"iterations",default:6},{key:"links",default:F("links")},{key:"linkSort"},{key:"linksSource",default:"source"},{key:"linksTarget",default:"target"},{key:"noDataMessage",default:!1},{key:"nodes",default:F("nodes")},{key:"nodeAlign",default:A.sankeyJustify},{key:"nodeId",default:F("id")},{key:"nodePadding",default:8},{key:"nodeSort"},{key:"nodeWidth",default:30},{key:"value",default:L(1)},{key:"shape",default:L("Rect")},{key:"shapeConfig",merge:!0,factory:()=>{const e=e=>Math.max(1,Math.abs(e.source.y1-e.source.y0)*(e.value/e.source.value)-2);return{Path:{fill:"none",hoverStyle:{"stroke-width":e},label:!1,stroke:"#DBDBDB",strokeOpacity:.5,strokeWidth:e},Rect:{}}}},{key:"tooltipConfig",merge:!0,factory:e=>({title:t=>t&&t.source&&t.target?`${t.source.id} → ${t.target.id}`:e._drawLabel(t,"number"==typeof t.i?t.i:0)})}]};
3891
+ this._sceneRenderer&&this._scheduleSceneRepaint(),this}},ctx:{sankey:A.sankey(),path:A.sankeyLinkHorizontal()},fields:[{key:"iterations",default:6},{key:"links",default:F("links")},{key:"linkSort"},{key:"linksSource",default:"source"},{key:"linksTarget",default:"target"},{key:"noDataMessage",default:!1},{key:"nodes",default:F("nodes")},{key:"nodeAlign",default:A.sankeyJustify},{key:"nodeId",default:F("id")},{key:"nodePadding",default:8},{key:"nodeSort"},{key:"nodeWidth",default:30},{key:"value",default:L(1)},{key:"shape",default:L("Rect"),coerce:"const"},{key:"shapeConfig",merge:!0,factory:()=>{const e=e=>Math.max(1,Math.abs(e.source.y1-e.source.y0)*(e.value/e.source.value)-2);return{Path:{fill:"none",hoverStyle:{"stroke-width":e},label:!1,stroke:"#DBDBDB",strokeOpacity:.5,strokeWidth:e},Rect:{}}}},{key:"tooltipConfig",merge:!0,factory:e=>({title:t=>t&&t.source&&t.target?`${t.source.id} → ${t.target.id}`:e._drawLabel(t,"number"==typeof t.i?t.i:0)})}]};
3787
3892
  /**
3788
3893
  Creates a Sankey visualization based on a defined set of nodes and links.
3789
3894
  */
3790
- var Ln=Bi(Rn);
3895
+ var Xn=Ri(Kn);
3791
3896
  /**
3792
3897
  Creates a stacked area plot based on an array of data.
3793
3898
  */
3794
- var En=Bi({name:"StackedArea",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"stacked",default:!0}]},Ms);
3795
- /** Merge a branch's leaf values (recursively) through the schema aggs. */function Fn(e,t){return s.merge(t.values.map(t=>t.key&&t.values?Fn(e,t):t),e.schema.aggs)}
3796
- /** Run the d3-hierarchy tree layout, flatten branch aggregations, and tag nodes. */function Wn(e,t,i){const n=e.ctx.tree.separation(e.schema.separation).size([t,i])(M.hierarchy({key:"root",values:s.nest(e._filteredData,e.schema.groupBy.slice(0,e._drawDepth+1))},e=>e.key&&e.values?e.values:null).sort(e.schema.sort)).descendants().filter(t=>(t.depth??0)<=e.schema.groupBy.length&&!!t.parent);return n.forEach((t,i)=>{const s=t.data;s.key&&s.values&&(t.data=Fn(e,s)),t.__d3plus__=!0,t.i=i,
3899
+ var Vn=Ri({name:"StackedArea",paintDriven:!0,features:[ee,Q,Z,ne],ctx:{},fields:[{key:"stacked",default:!0}]},Ns);
3900
+ /** Merge a branch's leaf values (recursively) through the schema aggs. */function Un(e,t){return s.merge(t.values.map(t=>t.key&&t.values?Un(e,t):t),e.schema.aggs)}
3901
+ /** Run the d3-hierarchy tree layout, flatten branch aggregations, and tag nodes. */function Jn(e,t,i){const n=e.ctx.tree.separation(e.schema.separation).size([t,i])(M.hierarchy({key:"root",values:s.nest(e._filteredData,e.schema.groupBy.slice(0,e._drawDepth+1))},e=>e.key&&e.values?e.values:null).sort(e.schema.sort)).descendants().filter(t=>(t.depth??0)<=e.schema.groupBy.length&&!!t.parent);return n.forEach((t,i)=>{const s=t.data;s.key&&s.values&&(t.data=Un(e,s)),t.__d3plus__=!0,t.i=i,
3797
3902
  // The tooltip binds the unwrapped row, so the per-node hierarchy depth
3798
3903
  // (needed to label the node at its own level) must live on the row.
3799
3904
  // Mirrors Treemap stamping `share`/`rank` onto `d.data`.
@@ -3801,7 +3906,7 @@ t.data.depth=t.depth}),n}
3801
3906
  /**
3802
3907
  Measure label height + per-depth label widths, then rescale y coordinates.
3803
3908
  Stashes `labelHeight`/`labelWidths` on `viz.ctx`.
3804
- */const Nn=({viz:e})=>{const i=e.schema.orient,a="vertical"===i,o="horizontal"===i,r=a?e.schema.height-e._margin.top-e._margin.bottom:e.schema.width-e._margin.left-e._margin.right,c=o?e.schema.height-e._margin.top-e._margin.bottom:e.schema.width-e._margin.left-e._margin.right,h=a?"left":"top",d=Wn(e,c,r),{labelHeight:u,labelWidths:m}=function(e,i,n,a,o,r,c){let h=e.schema.shapeConfig.r;if("function"!=typeof h){const e=h;h=()=>e}const d=t.max(i,e=>1===e.depth?h(e.data,e.i):0),u=t.max(i,e=>e.children?0:h(e.data,e.i)),m=t.extent(i,e=>e.y),f=t.min([n?50:100,(m[1]-d-u)/(e.schema.groupBy.length+1)]);e.ctx.labelHeight=f;const g=s.nest(i,e=>e.depth).map(i=>{const s=i.values;return s.reduce((i,n,a)=>{const r=a<s.length-1?s[a+1].x:o+e._margin[c],h=a?s[a-1].x:e._margin[c];return t.min([i,r-n.x,n.x-h])},o)});e.ctx.labelWidths=g;const p=l.scaleLinear().domain(m).range([d+f,r-u-f]);return i.forEach(e=>{const t=p(e.y);a?(e.y=e.x,e.x=t):e.y=t}),{labelHeight:f,labelWidths:g}}
3909
+ */const Qn=({viz:e})=>{const i=e.schema.orient,a="vertical"===i,o="horizontal"===i,r=a?e.schema.height-e._margin.top-e._margin.bottom:e.schema.width-e._margin.left-e._margin.right,c=o?e.schema.height-e._margin.top-e._margin.bottom:e.schema.width-e._margin.left-e._margin.right,h=a?"left":"top",d=Jn(e,c,r),{labelHeight:u,labelWidths:m}=function(e,i,n,a,o,r,c){let h=e.schema.shapeConfig.r;if("function"!=typeof h){const e=h;h=()=>e}const d=t.max(i,e=>1===e.depth?h(e.data,e.i):0),u=t.max(i,e=>e.children?0:h(e.data,e.i)),m=t.extent(i,e=>e.y),f=t.min([n?50:100,(m[1]-d-u)/(e.schema.groupBy.length+1)]);e.ctx.labelHeight=f;const g=s.nest(i,e=>e.depth).map(i=>{const s=i.values;return s.reduce((i,n,a)=>{const r=a<s.length-1?s[a+1].x:o+e._margin[c],h=a?s[a-1].x:e._margin[c];return t.min([i,r-n.x,n.x-h])},o)});e.ctx.labelWidths=g;const p=l.scaleLinear().domain(m).range([d+f,r-u-f]);return i.forEach(e=>{const t=p(e.y);a?(e.y=e.x,e.x=t):e.y=t}),{labelHeight:f,labelWidths:g}}
3805
3910
  /** Build the per-shape config object consumed by the Tree's shape emit. */(e,d,a,o,c,r,h);
3806
3911
  /**
3807
3912
  Build link descriptors + per-shape groupings and stash
@@ -3815,54 +3920,54 @@ e.ctx.linksData=h,e.ctx.linkD=e=>{let t=c.r;"function"==typeof t&&(t=t(e.data,e.
3815
3920
  kind (`type`, geometry coords) plus an `aes` record used by
3816
3921
  labelBounds. The position of the shape is taken from the node datum's
3817
3922
  `x` and `y` (Tree layout sets these on every TreeNode).
3818
- */function Hn(e,t,i){const s=t.data??t,n=t.i??0,a=t.x??0,o=t.y??0;switch(e){case"Circle":{const e=Number(Ri(i.r,s,n)??0);return{geom:{type:"circle",cx:a,cy:o,r:e},aes:{r:e}}}case"Rect":{const e=Number(Ri(i.width,s,n)??0),t=Number(Ri(i.height,s,n)??0);return{geom:{type:"rect",x:a-e/2,y:o-t/2,width:e,height:t},aes:{width:e,height:t}}}case"Path":return{geom:{type:"path",d:String(Ri(i.d,s,n)??"")},aes:{}};default:return null}}const jn={name:"Tree",features:[ee,Q,Z,ne],layoutStage:Nn,emit:({viz:e})=>{const t=e.ctx.linksData,i=e.ctx.linkD,s=e.ctx.shapeGroups,n=e.ctx.shapeConfig;if(!s||!n)return[];const a=[];
3923
+ */function Zn(e,t,i){const s=t.data??t,n=t.i??0,a=t.x??0,o=t.y??0;switch(e){case"Circle":{const e=Number(Wi(i.r,s,n)??0);return{geom:{type:"circle",cx:a,cy:o,r:e},aes:{r:e}}}case"Rect":{const e=Number(Wi(i.width,s,n)??0),t=Number(Wi(i.height,s,n)??0);return{geom:{type:"rect",x:a-e/2,y:o-t/2,width:e,height:t},aes:{width:e,height:t}}}case"Path":return{geom:{type:"path",d:String(Wi(i.d,s,n)??"")},aes:{}};default:return null}}const ea={name:"Tree",features:[ee,Q,Z,ne],layoutStage:Qn,emit:({viz:e})=>{const t=e.ctx.linksData,i=e.ctx.linkD,s=e.ctx.shapeGroups,n=e.ctx.shapeConfig;if(!s||!n)return[];const a=[];
3819
3924
  // Links (Path nodes between parent and child).
3820
- if(t&&t.length&&i){const s=Ei(e,"Path");for(let n=0;n<t.length;n++){const o=t[n],r=o.data??o,c=Li(s,r,n),h=e._ids(r,n)[(o.depth??1)-1],l=o.x??0,d=o.y??0;a.push({type:"path",key:`tree-link-${h}`,d:i(o),datum:r,paint:c,transform:{x:l,y:d}})}}
3925
+ if(t&&t.length&&i){const s=Hi(e,"Path");for(let n=0;n<t.length;n++){const o=t[n],r=o.data??o,c=Ni(s,r,n),h=e._ids(r,n)[(o.depth??1)-1],l=o.x??0,d=o.y??0;a.push({type:"path",key:`tree-link-${h}`,d:i(o),datum:r,paint:c,transform:{x:l,y:d}})}}
3821
3926
  // Per-shape-kind node groups.
3822
- for(const{key:t,values:i}of s){if(!i.length)continue;const s={...Ei(e,t),...n},o=i;
3927
+ for(const{key:t,values:i}of s){if(!i.length)continue;const s={...Hi(e,t),...n},o=i;
3823
3928
  // Chart-specific shapeConfig overrides (label, labelBounds, etc.).
3824
- for(let e=0;e<o.length;e++){const i=o[e],r=i.data??i,c=Hn(t,i,s);if(!c)continue;const h=n.id(i,e),l=Li(s,r,e);a.push({...c.geom,key:`tree-${t}-${h}`,datum:r,paint:l})}
3929
+ for(let e=0;e<o.length;e++){const i=o[e],r=i.data??i,c=Zn(t,i,s);if(!c)continue;const h=n.id(i,e),l=Ni(s,r,e);a.push({...c.geom,key:`tree-${t}-${h}`,datum:r,paint:l})}
3825
3930
  // Labels via the chart-specific labelBounds/label/labelConfig.
3826
- const r=Rs({data:o,label:(e,t)=>n.label(e,t),x:e=>e.x??0,y:e=>e.y??0,aes:e=>Hn(t,e,s)?.aes??{},rotate:L(0),id:(e,t)=>n.id(e,t),labelBounds:(e,t,i)=>n.labelBounds(e,t,i),labelConfig:n.labelConfig});a.push(...r)}return a},ctx:{tree:M.tree(),previousShapes:[]},fields:[{key:"orient",default:"vertical"},{key:"separation",default:(e,t)=>e.parent===t.parent?1:2},{key:"shape",default:L("Circle")},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>(e.ctx.linksData&&e._chartScene,e._drawLabel(t,i)),labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)}},Path:{fill:"none",stroke:u.colorDefaults.missing,strokeWidth:2},r:L(7),width:L(12),height:L(12)})},{key:"tooltipConfig",merge:!0,factory:e=>({
3931
+ const r=Ks({data:o,label:(e,t)=>n.label(e,t),x:e=>e.x??0,y:e=>e.y??0,aes:e=>Zn(t,e,s)?.aes??{},rotate:L(0),id:(e,t)=>n.id(e,t),labelBounds:(e,t,i)=>n.labelBounds(e,t,i),labelConfig:n.labelConfig});a.push(...r)}return a},ctx:{tree:M.tree(),previousShapes:[]},fields:[{key:"orient",default:"vertical"},{key:"separation",default:(e,t)=>e.parent===t.parent?1:2},{key:"shape",default:L("Circle"),coerce:"const"},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>(e.ctx.linksData&&e._chartScene,e._drawLabel(t,i)),labelConfig:{fontColor:()=>{const t=e._select?n.backgroundColor(e._select.node()):"rgb(255, 255, 255)";return u.colorContrast(t)}},Path:{fill:"none",stroke:u.colorDefaults.missing,strokeWidth:2},r:L(7),width:L(12),height:L(12)})},{key:"tooltipConfig",merge:!0,factory:e=>({
3827
3932
  // The Tooltip calls `title(d, i)` with the bound row; the node's
3828
3933
  // hierarchy depth is stamped onto that row in applyTreeLayout, so the
3829
3934
  // label resolves at the node's own level rather than the leaf level.
3830
- title:(t,i)=>e._drawLabel(t,i,(t.depth??1)-1)})},{key:"legendTooltip",merge:!0,factory:e=>({title:Ut.bind(e)})}]};
3935
+ title:(t,i)=>e._drawLabel(t,i,(t.depth??1)-1)})},{key:"legendTooltip",merge:!0,factory:e=>({title:ei.bind(e)})}]};
3831
3936
  /**
3832
3937
  Uses d3's tree layout to create a tidy tree chart based on an array of data.
3833
3938
  */
3834
- var Gn=Bi(jn);const In=({viz:e})=>{const t=e._filteredData;if(!t||!t.length)return{shapeData:[]};const{width:i,height:n}=le(e),a=s.nestGroups(t,e.schema.groupBy.slice(0,e._drawDepth+1)),o=M.hierarchy({values:a},e=>e.values).sum(e.schema.sum).sort(e.schema.sort),r=e.ctx.treemap.padding(e.schema.layoutPadding).size([i,n]).tile(e.schema.tile)(o),c=[];r.children&&function i(n){for(const a of n){if(a.depth<=e._drawDepth){i(a.children??[]);continue}const n=a.data,o=n.values??[],r=1===o.length?t.indexOf(o[0]):void 0,h=a;h.__d3plus__=!0,h.id=n.key,h.i=void 0!==r&&r>-1?r:void 0,
3939
+ var ta=Ri(ea);const ia=({viz:e})=>{const t=e._filteredData;if(!t||!t.length)return{shapeData:[]};const{width:i,height:n}=le(e),a=s.nestGroups(t,e.schema.groupBy.slice(0,e._drawDepth+1)),o=M.hierarchy({values:a},e=>e.values).sum(e.schema.sum).sort(e.schema.sort),r=e.ctx.treemap.padding(e.schema.layoutPadding).size([i,n]).tile(e.schema.tile)(o),c=[];r.children&&function i(n){for(const a of n){if(a.depth<=e._drawDepth){i(a.children??[]);continue}const n=a.data,o=n.values??[],r=1===o.length?t.indexOf(o[0]):void 0,h=a;h.__d3plus__=!0,h.id=n.key,h.i=void 0!==r&&r>-1?r:void 0,
3835
3940
  // Replace the wrapper branch with the merged source datum.
3836
3941
  h.data=s.merge(o,e.schema.aggs),h.x=a.x0+(a.x1-a.x0)/2,h.y=a.y0+(a.y1-a.y0)/2,c.push(h)}}(r.children);
3837
3942
  // Per-record rank — attached to the source datum so `ariaLabel` reads
3838
3943
  // `d.rank` directly instead of indexOf'ing a viz-level array.
3839
- const h=e.schema.sort;c.slice().sort(h).forEach((e,t)=>{e.data.rank=t});const l=r.value,d=e.schema.sum;return c.forEach(e=>{const t=d(e.data)/l;e.share=t,e.data.share=t}),{shapeData:c}};function qn(e,t,i){return"function"==typeof e?e(t,i):e}
3944
+ const h=e.schema.sort;c.slice().sort(h).forEach((e,t)=>{e.data.rank=t});const l=r.value,d=e.schema.sum;return c.forEach(e=>{const t=d(e.data)/l;e.share=t,e.data.share=t}),{shapeData:c}};function sa(e,t,i){return"function"==typeof e?e(t,i):e}
3840
3945
  /**
3841
3946
  Walks `data` to `drawDepth` and merges entries whose `thresholdKey`
3842
3947
  value falls below `threshold(branchData) * totalSum` into a single
3843
3948
  aggregated row at that depth. Returns the kept set; original `data`
3844
3949
  is not mutated.
3845
3950
  */
3846
- function Yn(e,i){const{aggs:n,drawDepth:a,groupBy:o,threshold:r,thresholdKey:c}=i,h=t.sum(e,c);if(!r||!c)return e;
3951
+ function na(e,i){const{aggs:n,drawDepth:a,groupBy:o,threshold:r,thresholdKey:c}=i,h=t.sum(e,c);if(!r||!c)return e;
3847
3952
  /**
3848
3953
  Explores the data tree recursively and merges elements under
3849
3954
  the indicated threshold.
3850
3955
  */return function e(i,l){if(l<a)return[...t.group(i,o[l])].reduce((t,[,i])=>{const s=e(i,l+1)??[];return t.concat(s)},[]);if(l===a){const e=Math.min(1,Math.max(0,r(i)));if(!isFinite(e)||isNaN(e))return null;
3851
3956
  // Single-pass O(N) partition into kept + removed bucket.
3852
- const t=[],a=[],o=e*h;for(let e=0;e<i.length;e++){const s=i[e];c(s)<o?t.push(s):a.push(s)}if(t.length>0){const i=s.merge(t,n);i._isAggregation=!0,i._threshold=e,a.push(i)}return a}throw new Error("Depth is higher than the amount of grouping levels.")}(e,0)??e}const Kn={treemapBinary:M.treemapBinary,treemapDice:M.treemapDice,treemapResquarify:M.treemapResquarify,treemapSlice:M.treemapSlice,treemapSliceDice:M.treemapSliceDice,treemapSquarify:M.treemapSquarify},Xn=e=>!!e.children&&1===e.children.length&&!0===e.children[0].data._isAggregation,Vn={name:"Treemap",features:[ee,Q,Z,ne],layoutStage:In,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.schema.locale,n=e._drawLabel,a=e.schema.shapeConfig??{};return[...i.map(t=>{const i=qn(a.fill,t.data,t.i),o=qn(a.stroke,t.data,t.i),r=qn(a.opacity,t.data,t.i),c=qn(a.strokeWidth,t.data,t.i);return{type:"rect",key:`treemap-${t.id}`,x:t.x0,y:t.y0,width:t.x1-t.x0,height:t.y1-t.y0,datum:t.data,paint:{fill:"string"==typeof i?i:void 0,stroke:"string"==typeof o||null==o?o:String(o),opacity:r,strokeWidth:c},aria:{label:`${n(t.data,t.i??0)}, ${e.schema.sum(t.data)}, ${m.formatAbbreviate(100*t.share,s)}%`}}}),...Rs({data:i,label:e=>{const t=e;return[n(t.data,t.i??0),`${m.formatAbbreviate(100*t.share,s)}%`]},x:e=>{const t=e;return t.x0+(t.x1-t.x0)/2},y:e=>{const t=e;return t.y0+(t.y1-t.y0)/2},aes:e=>{const t=e;return{width:t.x1-t.x0,height:t.y1-t.y0}},rotate:L(0),id:e=>e.id,labelBounds:(e,t,i)=>{const{width:s,height:n}=i;let a=Math.min(32,.5*(n-10));return a<8&&(a=0),[{width:s,height:n-a,x:-s/2,y:-n/2},{width:s,height:a+10,x:-s/2,y:n/2-a-10}]},labelConfig:{fontMax:32,textAnchor:e=>e&&0===e.l?"start":"middle",verticalAlign:e=>e&&0===e.l?"top":"bottom",fontColor:e=>{const t=e&&e.data?e.data:e,i=qn(a.fill,t,t.i);return"string"==typeof i?u.colorContrast(i):void 0}}})]},thresholdFunction:(e,t)=>Yn(t,{aggs:e.schema.aggs,drawDepth:e._drawDepth,groupBy:e.schema.groupBy,threshold:e.schema.threshold,thresholdKey:e.schema.thresholdKey}),ctx:{treemap:M.treemap().round(!0)},fields:[{key:"layoutPadding",default:1},{key:"sort",default:(e,t)=>(t.value??0)-(e.value??0),decorate:(e,t)=>{const i=t;return(e,t)=>{const s=Xn(e),n=Xn(t);return s&&!n?1:!s&&n?-1:i(e,t)}}},{key:"sum",default:F("value"),coerce:e=>"function"==typeof e?e:F(e),onSet:(e,t)=>{e.schema.thresholdKey=t}},{key:"tile",default:M.treemapSquarify,coerce:e=>{if("string"!=typeof e)return e;const t=`treemap${e.charAt(0).toUpperCase()}${e.slice(1)}`;return Kn[t]??M.treemapSquarify}},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s="number"==typeof t.rank?`${t.rank+1}. `:"",n=e.schema.sum;return`${s}${e._drawLabel(t,i)}, ${n(t,i)}.`},labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}})},{key:"tooltipConfig",merge:!0,factory:e=>({tbody:[[()=>e.schema.translate("Share"),(t,i,s)=>{
3957
+ const t=[],a=[],o=e*h;for(let e=0;e<i.length;e++){const s=i[e];c(s)<o?t.push(s):a.push(s)}if(t.length>0){const i=s.merge(t,n);i._isAggregation=!0,i._threshold=e,a.push(i)}return a}throw new Error("Depth is higher than the amount of grouping levels.")}(e,0)??e}const aa={treemapBinary:M.treemapBinary,treemapDice:M.treemapDice,treemapResquarify:M.treemapResquarify,treemapSlice:M.treemapSlice,treemapSliceDice:M.treemapSliceDice,treemapSquarify:M.treemapSquarify},oa=e=>!!e.children&&1===e.children.length&&!0===e.children[0].data._isAggregation,ra={name:"Treemap",features:[ee,Q,Z,ne],layoutStage:ia,emit:({viz:e,shapeData:t})=>{const i=t??[];if(!i.length)return[];const s=e.schema.locale,n=e._drawLabel,a=e.schema.shapeConfig??{};return[...i.map(t=>{const i=sa(a.fill,t.data,t.i),o=sa(a.stroke,t.data,t.i),r=sa(a.opacity,t.data,t.i),c=sa(a.strokeWidth,t.data,t.i);return{type:"rect",key:`treemap-${t.id}`,x:t.x0,y:t.y0,width:t.x1-t.x0,height:t.y1-t.y0,datum:t.data,paint:{fill:"string"==typeof i?i:void 0,stroke:"string"==typeof o||null==o?o:String(o),opacity:r,strokeWidth:c},aria:{label:`${n(t.data,t.i??0)}, ${e.schema.sum(t.data)}, ${m.formatAbbreviate(100*t.share,s)}%`}}}),...Ks({data:i,label:e=>{const t=e;return[n(t.data,t.i??0),`${m.formatAbbreviate(100*t.share,s)}%`]},x:e=>{const t=e;return t.x0+(t.x1-t.x0)/2},y:e=>{const t=e;return t.y0+(t.y1-t.y0)/2},aes:e=>{const t=e;return{width:t.x1-t.x0,height:t.y1-t.y0}},rotate:L(0),id:e=>e.id,labelBounds:(e,t,i)=>{const{width:s,height:n}=i;let a=Math.min(32,.5*(n-10));return a<8&&(a=0),[{width:s,height:n-a,x:-s/2,y:-n/2},{width:s,height:a+10,x:-s/2,y:n/2-a-10}]},labelConfig:{fontMax:32,textAnchor:e=>e&&0===e.l?"start":"middle",verticalAlign:e=>e&&0===e.l?"top":"bottom",fontColor:e=>{const t=e&&e.data?e.data:e,i=sa(a.fill,t,t.i);return"string"==typeof i?u.colorContrast(i):void 0}}})]},thresholdFunction:(e,t)=>na(t,{aggs:e.schema.aggs,drawDepth:e._drawDepth,groupBy:e.schema.groupBy,threshold:e.schema.threshold,thresholdKey:e.schema.thresholdKey}),ctx:{treemap:M.treemap().round(!0)},fields:[{key:"layoutPadding",default:1},{key:"sort",default:(e,t)=>(t.value??0)-(e.value??0),decorate:(e,t)=>{const i=t;return(e,t)=>{const s=oa(e),n=oa(t);return s&&!n?1:!s&&n?-1:i(e,t)}}},{key:"sum",default:F("value"),coerce:e=>"function"==typeof e?e:F(e),onSet:(e,t)=>{e.schema.thresholdKey=t}},{key:"tile",default:M.treemapSquarify,coerce:e=>{if("string"!=typeof e)return e;const t=`treemap${e.charAt(0).toUpperCase()}${e.slice(1)}`;return aa[t]??M.treemapSquarify}},{key:"shapeConfig",merge:!0,factory:e=>({ariaLabel:(t,i)=>{const s="number"==typeof t.rank?`${t.rank+1}. `:"",n=e.schema.sum;return`${s}${e._drawLabel(t,i)}, ${n(t,i)}.`},labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}})},{key:"tooltipConfig",merge:!0,factory:e=>({tbody:[[()=>e.schema.translate("Share"),(t,i,s)=>{
3853
3958
  // A ColorScale range swatch carries no per-row share, so sum the
3854
3959
  // share of every datum that falls in its color range.
3855
3960
  if(s._isColorScaleBucket){const t=ye(e,s.color,e.schema.sum);return null==t?"":`${m.formatAbbreviate(100*t,e.schema.locale)}%`}
3856
3961
  // A Legend bucket aggregates multiple rows, so `share` arrives
3857
3962
  // as an array of the members' shares — sum it; a single cell's
3858
3963
  // share is a plain number.
3859
- const n=Array.isArray(s.share)?s.share.reduce((e,t)=>e+t,0):s.share;return Number.isFinite(n)?`${m.formatAbbreviate(100*n,e.schema.locale)}%`:""}]]})},{key:"legendTooltip",merge:!0,factory:()=>({tbody:[]})},{key:"legendSort",factory:e=>{const t=e.schema.sum;return(e,i)=>t(i)-t(e)}},{key:"legend",factory:e=>{const t=e.schema.legend;return(i,s)=>s.length!==e._filteredData.length&&t.call(e,i,s)}}]};
3964
+ const n=Array.isArray(s.share)?s.share.reduce((e,t)=>e+t,0):s.share;return Number.isFinite(n)?`${m.formatAbbreviate(100*n,e.schema.locale)}%`:""}]]})},{key:"legendTooltip",merge:!0,factory:()=>({tbody:[]})},{key:"legendSort",factory:e=>{const t=e.schema.sum;return(e,i)=>t(i)-t(e)}},{key:"legend",coerce:"const",factory:e=>{const t=e.schema.legend;return(i,s)=>s.length!==e._filteredData.length&&t.call(e,i,s)}}]};
3860
3965
  /**
3861
3966
  Uses the d3 treemap layout to create SVG rectangles based on an array of data.
3862
3967
  */
3863
- var Un=Bi(Vn);e.Area=Ge,e.AreaPlot=Ms,e.Axis=xt,e.AxisBottom=bt,e.AxisLeft=kt,e.AxisRight=vt,e.AxisTop=Ct,e.Bar=qe,e.BarChart=As,e.BaseClass=j,e.Box=at,e.BoxWhisker=$s,e.BumpChart=Ps,e.Circle=Ke,e.ColorScale=Bt,e.Donut=Ws,e.Geomap=Xs,e.Image=Re,e.Legend=zt,e.Line=Je,e.LinePlot=Vs,e.Matrix=sn,e.Message=Pt,e.Network=hn,e.Pack=fn,e.Path=rt,e.Pie=Fs,e.Plot=Ds,e.Priestley=_n,e.RESET=W,e.Radar=vn,e.RadialMatrix=Mn,e.Rect=Ve,e.Rings=Pn,e.Sankey=Ln,e.Shape=He,e.StackedArea=En,e.TextBox=Wt,e.Timeline=Gt,e.Tooltip=Vt,e.Tree=Gn,e.Treemap=Un,e.Viz=$i,e.Whisker=et,e.accessor=F,e.applyGeomapLayout=Gs,e.applyMatrixLayout=Js,e.applyNetworkLayout=an,e.applyPackLayout=ln,e.applyPieLayout=Ts,e.applyPriestleyLayout=gn,e.applyRadarLayout=bn,e.applyRadialMatrixLayout=Sn,e.applyRingsLayout=$n,e.applySankeyLayout=Tn,e.applyTreeLayout=Nn,e.applyTreemapLayout=In,e.backFeature=ee,e.colorScaleFeature=ie,e.computeAxisLayout=function(e){
3968
+ var ca=Ri(ra);e.Area=qe,e.AreaPlot=Ns,e.Axis=Ct,e.AxisBottom=St,e.AxisLeft=wt,e.AxisRight=zt,e.AxisTop=Dt,e.Bar=Ke,e.BarChart=Hs,e.BaseClass=j,e.Box=rt,e.BoxWhisker=js,e.BumpChart=Is,e.Circle=Ve,e.ColorScale=Rt,e.Donut=Js,e.Geomap=rn,e.Image=ht,e.Legend=$t,e.Line=Ze,e.LinePlot=cn,e.Matrix=gn,e.Message=Lt,e.Network=kn,e.Pack=zn,e.Path=dt,e.Pie=Us,e.Plot=Ws,e.Priestley=$n,e.RESET=W,e.Radar=On,e.RadialMatrix=Nn,e.Rect=Je,e.Rings=In,e.Sankey=Xn,e.Shape=Ge,e.StackedArea=Vn,e.TextBox=Gt,e.Timeline=Kt,e.Tooltip=Zt,e.Tree=ta,e.Treemap=ca,e.Viz=Oi,e.Whisker=it,e.accessor=F,e.applyGeomapLayout=tn,e.applyMatrixLayout=ln,e.applyNetworkLayout=yn,e.applyPackLayout=vn,e.applyPieLayout=qs,e.applyPriestleyLayout=Dn,e.applyRadarLayout=Pn,e.applyRadialMatrixLayout=Ln,e.applyRingsLayout=jn,e.applySankeyLayout=qn,e.applyTreeLayout=Qn,e.applyTreemapLayout=ia,e.backFeature=ee,e.colorScaleFeature=ie,e.computeAxisLayout=function(e){
3864
3969
  // Free function from axisLayout.ts. Mutates `axis` (so instance-slot
3865
3970
  // readers stay in sync) and returns the layout artifacts; we re-shape
3866
3971
  // its result + the mutated instance fields into the stable `AxisLayout` API.
3867
- return Pe(e),{bounds:e._outerBounds,d3Scale:e._d3Scale,d3ScaleNegative:e._d3ScaleNegative,getPosition:t=>e._getPosition(t),availableTicks:e._availableTicks,visibleTicks:e._visibleTicks,margin:e._margin}},e.configPrep=G,e.constant=L,e.createFluent=function(e,t={}){const i=new Map(e.map(e=>[e.key,e])),s={};for(const i of e)i.key in t&&(s[i.key]=oe(i,t[i.key]));const n={};for(const t of e)n[t.key]=function(...e){return e.length?(s[t.key]=oe(t,e[0]),n):s[t.key]};return n.config=function(...e){if(!e.length)return{...s};const t=e[0];for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;const n=i.get(e);s[e]=n?oe(n,t[e]):t[e]}return n},n},e.geomapDef=Ks,e.installFluent=re,e.legendFeature=K,e.matrixDef=tn,e.measureAxis=Pe,e.networkDef=cn,e.packDef=mn,e.pieDef=Es,e.plotEmit=bs,e.plotPaint=ks,e.priestleyDef=yn,e.radarDef=kn,e.radialMatrixDef=Dn,e.renderAxes=Ui,e.resolveSpec=E,e.ringsDef=Bn,e.runLayout=U,e.runStages=he,e.runVizPipeline=_i,e.sankeyDef=Rn,e.subtitleFeature=Z,e.timelineFeature=te,e.titleFeature=Q,e.totalFeature=ne,e.treeDef=jn,e.treemapDef=Vn,e.vizDraw=Si,e.vizDrawPure=Ci,e.vizPostThresholdCtx=Di,e.vizPreDraw=Mi,e.vizPreDrawPure=zi});
3972
+ return Pe(e),{bounds:e._outerBounds,d3Scale:e._d3Scale,d3ScaleNegative:e._d3ScaleNegative,getPosition:t=>e._getPosition(t),availableTicks:e._availableTicks,visibleTicks:e._visibleTicks,margin:e._margin}},e.configPrep=G,e.constant=L,e.createFluent=function(e,t={}){const i=new Map(e.map(e=>[e.key,e])),s={};for(const i of e)i.key in t&&(s[i.key]=oe(i,t[i.key]));const n={};for(const t of e)n[t.key]=function(...e){return e.length?(s[t.key]=oe(t,e[0]),n):s[t.key]};return n.config=function(...e){if(!e.length)return{...s};const t=e[0];for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;const n=i.get(e);s[e]=n?oe(n,t[e]):t[e]}return n},n},e.geomapDef=on,e.installFluent=re,e.legendFeature=K,e.matrixDef=fn,e.measureAxis=Pe,e.networkDef=bn,e.packDef=wn,e.pieDef=Vs,e.plotEmit=Ps,e.plotPaint=Ts,e.priestleyDef=An,e.radarDef=Tn,e.radialMatrixDef=Wn,e.renderAxes=es,e.resolveSpec=E,e.ringsDef=Gn,e.runLayout=U,e.runStages=he,e.runVizPipeline=vi,e.sankeyDef=Kn,e.subtitleFeature=Z,e.timelineFeature=te,e.titleFeature=Q,e.totalFeature=ne,e.treeDef=ea,e.treemapDef=ra,e.vizDraw=Mi,e.vizDrawPure=Di,e.vizPostThresholdCtx=Bi,e.vizPreDraw=Pi,e.vizPreDrawPure=$i});
3868
3973
  //# sourceMappingURL=d3plus-core.js.map