@bicharts/chart-host 0.5.92 → 0.5.94

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.
@@ -201,18 +201,18 @@ var require_papaparse_min = __commonJS({
201
201
  e = true, s4.abort(), p4.meta.aborted = true, q3(m2.complete) && m2.complete(p4), n2 = "";
202
202
  }, this.guessLineEndings = function(e2, t2) {
203
203
  e2 = e2.substring(0, 1048576);
204
- var t2 = new RegExp(U3(t2) + "([^]*?)" + U3(t2), "gm"), i5 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i5[0].length;
204
+ var t2 = new RegExp(U2(t2) + "([^]*?)" + U2(t2), "gm"), i5 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i5[0].length;
205
205
  if (1 === i5.length || e2) return "\n";
206
206
  for (var r4 = 0, n4 = 0; n4 < i5.length; n4++) "\n" === i5[n4][0] && r4++;
207
207
  return r4 >= i5.length / 2 ? "\r\n" : "\r";
208
208
  };
209
209
  }
210
- function U3(e) {
210
+ function U2(e) {
211
211
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
212
212
  }
213
213
  function E4(C2) {
214
- var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x2 = C2.comments, I2 = C2.step, A = C2.preview, T3 = C2.fastMode, D3 = null, L2 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar, j3 = F4;
215
- if (void 0 !== C2.escapeChar && (j3 = C2.escapeChar), ("string" != typeof S || -1 < v3.BAD_DELIMITERS.indexOf(S)) && (S = ","), x2 === S) throw new Error("Comment character same as delimiter");
214
+ var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x2 = C2.comments, I2 = C2.step, A = C2.preview, T3 = C2.fastMode, D3 = null, L2 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar, j2 = F4;
215
+ if (void 0 !== C2.escapeChar && (j2 = C2.escapeChar), ("string" != typeof S || -1 < v3.BAD_DELIMITERS.indexOf(S)) && (S = ","), x2 === S) throw new Error("Comment character same as delimiter");
216
216
  true === x2 ? x2 = "#" : ("string" != typeof x2 || -1 < v3.BAD_DELIMITERS.indexOf(x2)) && (x2 = false), "\n" !== O2 && "\r" !== O2 && "\r\n" !== O2 && (O2 = "\n");
217
217
  var z3 = 0, M = false;
218
218
  this.parse = function(i4, t, r2) {
@@ -232,11 +232,11 @@ var require_papaparse_min = __commonJS({
232
232
  }
233
233
  return w2();
234
234
  }
235
- for (var p4 = i4.indexOf(S, z3), g4 = i4.indexOf(O2, z3), _3 = new RegExp(U3(j3) + U3(F4), "g"), m2 = i4.indexOf(F4, z3); ; ) if (i4[z3] === F4) for (m2 = z3, z3++; ; ) {
235
+ for (var p4 = i4.indexOf(S, z3), g4 = i4.indexOf(O2, z3), _3 = new RegExp(U2(j2) + U2(F4), "g"), m2 = i4.indexOf(F4, z3); ; ) if (i4[z3] === F4) for (m2 = z3, z3++; ; ) {
236
236
  if (-1 === (m2 = i4.indexOf(F4, m2 + 1))) return r2 || u5.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h3.length, index: z3 }), E5();
237
237
  if (m2 === n2 - 1) return E5(i4.substring(z3, m2).replace(_3, F4));
238
- if (F4 === j3 && i4[m2 + 1] === j3) m2++;
239
- else if (F4 === j3 || 0 === m2 || i4[m2 - 1] !== j3) {
238
+ if (F4 === j2 && i4[m2 + 1] === j2) m2++;
239
+ else if (F4 === j2 || 0 === m2 || i4[m2 - 1] !== j2) {
240
240
  -1 !== p4 && p4 < m2 + 1 && (p4 = i4.indexOf(S, m2 + 1));
241
241
  var y5 = v4(-1 === (g4 = -1 !== g4 && g4 < m2 + 1 ? i4.indexOf(O2, m2 + 1) : g4) ? p4 : Math.min(p4, g4));
242
242
  if (i4.substr(m2 + 1 + y5, e) === S) {
@@ -358,7 +358,7 @@ var require_papaparse_min = __commonJS({
358
358
  }
359
359
  void 0 !== t.escapeChar && (o2 = t.escapeChar + a5), t.escapeFormulae instanceof RegExp ? h3 = t.escapeFormulae : "boolean" == typeof t.escapeFormulae && t.escapeFormulae && (h3 = /^[=+\-@\t\r].*$/);
360
360
  }
361
- })(), new RegExp(U3(a5), "g"));
361
+ })(), new RegExp(U2(a5), "g"));
362
362
  "string" == typeof e && (e = JSON.parse(e));
363
363
  if (Array.isArray(e)) {
364
364
  if (!e.length || Array.isArray(e[0])) return n2(null, e, i4);
@@ -1077,78 +1077,90 @@ function Wt(n, s2) {
1077
1077
  return { iso: i2, unmatched: M, matchedRows: h2, totalRows: n.length };
1078
1078
  }
1079
1079
 
1080
- // ../shape-core/dist/chunk-6W2GOB6U.mjs
1080
+ // ../shape-core/dist/chunk-5MZ6HMKL.mjs
1081
1081
  var import_papaparse = __toESM(require_papaparse_min(), 1);
1082
1082
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
1083
- var yt2 = { "north-america": "AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI", "south-america": "AR BO BR CL CO EC FK GF GY PE PY SR UY VE", europe: "AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA", africa: "AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW", asia: "AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE", oceania: "AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS", antarctica: "AQ BV GS HM TF" };
1084
- var j2 = (() => {
1083
+ var Ce = { "north-america": "AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI", "south-america": "AR BO BR CL CO EC FK GF GY PE PY SR UY VE", europe: "AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA", africa: "AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW", asia: "AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE", oceania: "AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS", antarctica: "AQ BV GS HM TF" };
1084
+ var Q2 = (() => {
1085
1085
  let n = /* @__PURE__ */ new Map();
1086
- for (let t of Object.keys(yt2)) for (let e of yt2[t].split(/\s+/)) e && n.set(e, t);
1086
+ for (let e of Object.keys(Ce)) for (let t of Ce[e].split(/\s+/)) t && n.set(t, e);
1087
1087
  return n;
1088
1088
  })();
1089
- function Pt(n) {
1090
- for (let [t, e] of n) {
1091
- let r = j2.get(t);
1092
- r && !j2.has(e) && j2.set(e, r);
1093
- }
1094
- }
1095
- Pt(N);
1096
- var Gt2 = ["rate", "ratio", "pct", "percent", "percentage", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "z[_-]?score", "average", "avg", "mean", "median", "stddev", "variance", "gpa", "percentile", "quantile", "efficiency", "accuracy", "probability", "multiplier", "coefficient", "correlation", "occupancy", "age", "bmi", "temperature", "density", "pressure", "humidity", "ph", "velocity", "speed", "elevation", "altitude", "latency", "throughput", "bandwidth", "iops"];
1097
- var Wt2 = ["pct", "percent", "percentage", "rate", "ratio", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "gpa", "percentile", "quantile", "bmi", "density", "pressure", "humidity", "velocity", "efficiency", "occupancy", "latency", "throughput", "bandwidth", "iops"];
1098
- var Ft = ["latitude", "longitude"];
1099
- var Vt = ["latitude", "longitude"];
1100
- var Ct = /^\s*(sum|count|count\s+distinct|distinct\s+count)\s+of\s+/i;
1101
- var kt = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g;
1102
- var Bt = new RegExp("\\b(" + Gt2.join("|") + ")\\b|(" + Wt2.join("|") + ")$", "i");
1103
- var zt = new RegExp("\\b(" + Ft.join("|") + ")\\b|(" + Vt.join("|") + ")$", "i");
1104
- function Mt2(n) {
1105
- return n ? String(n).replace(Ct, "").trim() : "";
1106
- }
1107
- function Ut(n) {
1108
- return !!n && Ct.test(String(n));
1109
- }
1110
- var Kt = ["count (distinct)", "count distinct", "distinct count", "standard deviation", "average", "variance", "median", "product", "stddev", "std dev", "count", "sum", "avg", "min", "minimum", "max", "maximum", "var"];
1111
- var St2 = new RegExp("^\\s*(" + [...Kt].sort((n, t) => t.length - n.length).map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
1112
- function Ht(n) {
1113
- let t = Mt2(n);
1114
- return t.length === 0 ? "" : t.replace(kt, " ");
1115
- }
1116
- function Tt(n, t) {
1117
- if (!t) return false;
1118
- let e = Mt2(t);
1119
- return n.test(Ht(t)) || n.test(e) || n.test(s(e).join(" "));
1120
- }
1121
- function Nt(n) {
1122
- return Tt(zt, n);
1123
- }
1124
- function Yt(n) {
1125
- return Tt(Bt, n) || Nt(n);
1126
- }
1127
- var Rt = /int|double|decimal|single|float|number|currency|money/i;
1128
- function Zt(n) {
1129
- let t = String(n?.valueNature ?? "").trim().toLowerCase();
1130
- return t === "categorical" ? "Categorical" : t === "ordinal" ? "Ordinal" : t === "continuous" || n?.isMeasure === true || Rt.test(String(n?.dataType ?? "")) ? "Continuous" : "Categorical";
1131
- }
1132
- function Xt(n) {
1133
- return n?.isMeasure === true || Rt.test(String(n?.dataType ?? ""));
1134
- }
1135
- function vt(n) {
1136
- let t = n ?? {}, e = Zt(t);
1137
- if (e !== "Continuous") return { nature: e, additivity: "unknown", basis: "role", suppressed: false };
1138
- if (Nt(t.name)) return { nature: e, additivity: "positional", basis: "name", suppressed: true };
1139
- let r = String(t.additivity ?? "").trim().toLowerCase();
1140
- if (!(r === "additive" && Ut(t.name))) {
1141
- if (r === "additive") return { nature: e, additivity: "additive", basis: "measured", suppressed: false };
1142
- if (r === "part_of_whole") return { nature: e, additivity: "part_of_whole", basis: "measured", suppressed: false };
1143
- if (r === "intensive_rate") return { nature: e, additivity: "intensive_rate", basis: "measured", suppressed: false };
1144
- }
1145
- return t.discourageAggregationAcrossGroups === true ? { nature: e, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : Yt(t.name) ? { nature: e, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: e, additivity: "additive", basis: "default", suppressed: false };
1146
- }
1147
- function It2(n) {
1148
- let t = vt(n), e = n ?? {};
1149
- if (t.nature === "Categorical") return ["first", "distinctcount", "count"];
1150
- if (t.nature === "Ordinal") return Xt(e) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
1151
- switch (t.additivity) {
1089
+ function Ve(n) {
1090
+ for (let [e, t] of n) {
1091
+ let i2 = Q2.get(e);
1092
+ i2 && !Q2.has(t) && Q2.set(t, i2);
1093
+ }
1094
+ }
1095
+ Ve(N);
1096
+ var Ye = ["rate", "ratio", "pct", "percent", "percentage", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "z[_-]?score", "average", "avg", "mean", "median", "stddev", "variance", "gpa", "percentile", "quantile", "efficiency", "accuracy", "probability", "multiplier", "coefficient", "correlation", "occupancy", "age", "bmi", "temperature", "density", "pressure", "humidity", "ph", "velocity", "speed", "elevation", "altitude", "latency", "throughput", "bandwidth", "iops", "temperatuur", "temperatur", "temperatura", "teplota", "lampotila", "homerseklet", "sicaklik", "pression", "presion", "pressao", "pressione", "druck", "tryck", "tlak", "paine", "nyomas", "presiune", "humidite", "humedad", "umidade", "umidita", "feuchtigkeit", "vochtigheid", "kosteus", "vlhkost", "vitesse", "velocidad", "velocidade", "velocita", "geschwindigkeit", "snelheid", "hastighet", "hastighed", "rychlost", "nopeus", "sebesseg", "brzina", "predkosc", "densite", "densidad", "densidade", "densita", "dichte", "dichtheid", "hustota", "tiheys", "gustoca", "moyenne", "mediane", "promedio", "mediana", "gemiddelde", "durchschnitt", "mittelwert", "genomsnitt", "gennemsnit", "gjennomsnitt", "keskiarvo", "atlag", "ortalama", "prosjek", "srednia", "prumer", "priemer", "medie", "taux", "tasa", "taxa", "tasso", "verhaltnis", "verhouding", "aandeel", "anteil", "andel", "osuus", "podil", "udzial", "udio", "pourcentage", "porcentaje", "percentual", "prozent", "procent", "prosentti", "szazalek", "yuzde", "participacion", "participacao", "pondere", "omjer", "arany", "oran", "rata", "leeftijd", "edad", "idade", "wiek", "eletkor", "varsta", "puntuacion", "pontuacao", "punteggio", "betyg", "ocena", "indice", "indeks", "wskaznik", "puan"];
1097
+ var He = ["pct", "percent", "percentage", "rate", "ratio", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "gpa", "percentile", "quantile", "bmi", "density", "pressure", "humidity", "velocity", "efficiency", "occupancy", "latency", "throughput", "bandwidth", "iops"];
1098
+ var Ke = ["latitude", "longitude"];
1099
+ var $e = ["latitude", "longitude"];
1100
+ function Z2(n) {
1101
+ return Array.from(n).map((e) => {
1102
+ let t = e.normalize("NFD").replace(/[̀-ͯ]/g, "");
1103
+ return t.length === 1 ? t : e;
1104
+ }).join("");
1105
+ }
1106
+ var re = ["somme de", "suma de", "soma de", "summe von", "som van", "somma di", "summa av", "sum av", "sum af", "soucet z", "suma z", "totaal van", "total de", "toplam", "osszeg", "nombre de", "recuento de", "contagem de", "anzahl von", "aantal van", "conteggio di", "antal av", "lukumaara", "pocet z"];
1107
+ function Ze(n) {
1108
+ return [...n].sort((e, t) => t.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|");
1109
+ }
1110
+ var Re = new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:" + Ze(re) + ")\\s+)", "i");
1111
+ var Xe = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g;
1112
+ var je = new RegExp("\\b(" + Ye.join("|") + ")\\b|(" + He.join("|") + ")$", "i");
1113
+ var qe = new RegExp("\\b(" + Ke.join("|") + ")\\b|(" + $e.join("|") + ")$", "i");
1114
+ function ve(n) {
1115
+ if (!n) return "";
1116
+ let e = String(n), t = Re.exec(Z2(e));
1117
+ return (t ? e.slice(t[0].length) : e).trim();
1118
+ }
1119
+ function Qe(n) {
1120
+ return !!n && Re.test(Z2(String(n)));
1121
+ }
1122
+ var Je = ["count (distinct)", "count distinct", "distinct count", "standard deviation", "average", "variance", "median", "product", "stddev", "std dev", "count", "sum", "avg", "min", "minimum", "max", "maximum", "var"];
1123
+ var Ae = new RegExp("^\\s*(" + [...Je].sort((n, e) => e.length - n.length).map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
1124
+ function et(n) {
1125
+ let e = ve(n);
1126
+ return e.length === 0 ? "" : e.replace(Xe, " ");
1127
+ }
1128
+ function xe(n, e) {
1129
+ if (!e) return false;
1130
+ let t = ve(e);
1131
+ return n.test(Z2(et(e))) || n.test(Z2(t)) || n.test(Z2(s(t).join(" ")));
1132
+ }
1133
+ function Ie(n) {
1134
+ return xe(qe, n);
1135
+ }
1136
+ function tt(n) {
1137
+ return xe(je, n) || Ie(n);
1138
+ }
1139
+ var we = /int|double|decimal|single|float|number|currency|money/i;
1140
+ function nt(n) {
1141
+ let e = String(n?.valueNature ?? "").trim().toLowerCase();
1142
+ return e === "categorical" ? "Categorical" : e === "ordinal" ? "Ordinal" : e === "continuous" || n?.isMeasure === true || we.test(String(n?.dataType ?? "")) ? "Continuous" : "Categorical";
1143
+ }
1144
+ function it(n) {
1145
+ return n?.isMeasure === true || we.test(String(n?.dataType ?? ""));
1146
+ }
1147
+ function Ee(n) {
1148
+ let e = n ?? {}, t = nt(e);
1149
+ if (t !== "Continuous") return { nature: t, additivity: "unknown", basis: "role", suppressed: false };
1150
+ if (Ie(e.name)) return { nature: t, additivity: "positional", basis: "name", suppressed: true };
1151
+ let i2 = String(e.additivity ?? "").trim().toLowerCase();
1152
+ if (!(i2 === "additive" && Qe(e.name))) {
1153
+ if (i2 === "additive") return { nature: t, additivity: "additive", basis: "measured", suppressed: false };
1154
+ if (i2 === "part_of_whole") return { nature: t, additivity: "part_of_whole", basis: "measured", suppressed: false };
1155
+ if (i2 === "intensive_rate") return { nature: t, additivity: "intensive_rate", basis: "measured", suppressed: false };
1156
+ }
1157
+ return e.discourageAggregationAcrossGroups === true ? { nature: t, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : tt(e.name) ? { nature: t, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: t, additivity: "additive", basis: "default", suppressed: false };
1158
+ }
1159
+ function De(n) {
1160
+ let e = Ee(n), t = n ?? {};
1161
+ if (e.nature === "Categorical") return ["first", "distinctcount", "count"];
1162
+ if (e.nature === "Ordinal") return it(t) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
1163
+ switch (e.additivity) {
1152
1164
  case "positional":
1153
1165
  return ["min", "max", "count", "distinctcount", "first"];
1154
1166
  case "intensive_rate":
@@ -1157,20 +1169,20 @@ function It2(n) {
1157
1169
  return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
1158
1170
  }
1159
1171
  }
1160
- function Me(n) {
1161
- return It2(n)[0];
1172
+ function Bt(n) {
1173
+ return De(n)[0];
1162
1174
  }
1163
- function Te(n, t) {
1164
- if (t !== "sum" && t !== "count") return false;
1165
- if (t === "count") return true;
1166
- let e = vt(n);
1167
- return e.additivity === "additive" || e.additivity === "part_of_whole" || e.additivity === "unknown";
1175
+ function Yt(n, e) {
1176
+ if (e !== "sum" && e !== "count") return false;
1177
+ if (e === "count") return true;
1178
+ let t = Ee(n);
1179
+ return t.additivity === "additive" || t.additivity === "part_of_whole" || t.additivity === "unknown";
1168
1180
  }
1169
1181
 
1170
1182
  // ../shape-core/dist/index.mjs
1171
1183
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
1172
1184
  var E2 = 2;
1173
- var U2 = 400;
1185
+ var Z3 = 400;
1174
1186
  function G2(r) {
1175
1187
  return !!E(r);
1176
1188
  }
@@ -1179,22 +1191,22 @@ function C(r) {
1179
1191
  for (let e of r) {
1180
1192
  if (e == null) continue;
1181
1193
  let s2 = u(String(e));
1182
- if (!V(s2) && !n.has(s2) && (n.add(s2), n.size >= U2)) break;
1194
+ if (!V(s2) && !n.has(s2) && (n.add(s2), n.size >= Z3)) break;
1183
1195
  }
1184
1196
  return Array.from(n);
1185
1197
  }
1186
1198
  function P2(r) {
1187
1199
  let n = C(r);
1188
- if (n.length === 0 || $2(r) < 95) return false;
1200
+ if (n.length === 0 || D2(r) < 95) return false;
1189
1201
  let e = n.filter((c2) => G2(c2) && !Y(c2)).length, s2 = n.filter((c2) => !G2(c2) && !!Y(c2)).length;
1190
1202
  return e >= 1 && e >= s2;
1191
1203
  }
1192
- function q2(r, n) {
1204
+ function W2(r, n) {
1193
1205
  if (!Y(r)) return false;
1194
1206
  let e = E(r);
1195
1207
  return e ? n === "world" ? true : s3.has(e) : false;
1196
1208
  }
1197
- function $2(r) {
1209
+ function D2(r) {
1198
1210
  let n = C(r);
1199
1211
  if (n.length === 0) return 0;
1200
1212
  let e = 0;
@@ -1213,21 +1225,21 @@ function F3(r) {
1213
1225
  for (let e of r) {
1214
1226
  if (e == null) continue;
1215
1227
  let s2 = String(e).trim();
1216
- if (!V(u(s2)) && !n.has(s2) && (n.add(s2), n.size >= U2)) break;
1228
+ if (!V(u(s2)) && !n.has(s2) && (n.add(s2), n.size >= Z3)) break;
1217
1229
  }
1218
1230
  return Array.from(n);
1219
1231
  }
1220
- function D2(r) {
1232
+ function $2(r) {
1221
1233
  let n = F3(r);
1222
1234
  if (n.length === 0) return 0;
1223
1235
  let e = 0;
1224
1236
  for (let s2 of n) Z(s2).length > 0 && e++;
1225
1237
  return Math.round(e / n.length * 1e3) / 10;
1226
1238
  }
1227
- function Z2(r, n) {
1239
+ function q2(r, n) {
1228
1240
  return y2(n, rt) ? true : F3(r).some((e) => /^\d{5}(-\d{4})?$/.test(e.replace(/\.0+$/, "")));
1229
1241
  }
1230
- function ne(r, n) {
1242
+ function se(r, n) {
1231
1243
  let e = C(r);
1232
1244
  if (e.length === 0) return 0;
1233
1245
  let s2 = 0;
@@ -1239,12 +1251,12 @@ function z2(r, n) {
1239
1251
  for (let s2 of C(r)) n(s2) && e++;
1240
1252
  return e;
1241
1253
  }
1242
- function oe(r, n) {
1254
+ function ae(r, n) {
1243
1255
  let e = 0;
1244
1256
  for (let s2 of F3(r)) n(s2) && e++;
1245
1257
  return e;
1246
1258
  }
1247
- function ie(r, n, e, s2, c2) {
1259
+ function le(r, n, e, s2, c2) {
1248
1260
  let A = [], u4 = [], o = {}, M = {}, _2 = new Set(r), l2 = (t) => n.map((i2) => i2[t]);
1249
1261
  for (let t of ["city", "country"]) {
1250
1262
  let i2 = e?.[t];
@@ -1255,17 +1267,17 @@ function ie(r, n, e, s2, c2) {
1255
1267
  let i2 = e?.[t];
1256
1268
  i2 && X2.has(i2) && (o[t] = i2);
1257
1269
  }
1258
- let g3 = e?.zip;
1259
- if (g3 && _2.has(g3)) {
1260
- let t = l2(g3), i2 = D2(t);
1261
- i2 < 95 ? u4.push(`zip=${g3} (only ${i2}% of values read as ZIPs)`) : Z2(t, g3) ? o.zip = g3 : u4.push(`zip=${g3} (all values are 3-4 digits with nothing to say they are postal)`);
1270
+ let d = e?.zip;
1271
+ if (d && _2.has(d)) {
1272
+ let t = l2(d), i2 = $2(t);
1273
+ i2 < 95 ? u4.push(`zip=${d} (only ${i2}% of values read as ZIPs)`) : q2(t, d) ? o.zip = d : u4.push(`zip=${d} (all values are 3-4 digits with nothing to say they are postal)`);
1262
1274
  }
1263
1275
  let p2 = e?.state;
1264
1276
  if (p2 && _2.has(p2)) {
1265
1277
  let t = l2(p2), i2 = C(t);
1266
- i2.length > 0 && i2.every((a4) => q2(a4, s2)) ? u4.push(`state=${p2} (every value is "CA", which is both Canada and California)`) : P2(t) ? (u4.push(`state=${p2} (every value is a country, not a state)`), o.country || (o.country = p2)) : v2(t) < 95 ? u4.push(`state=${p2} (only ${v2(t)}% of values are states/provinces)`) : o.state = p2;
1278
+ i2.length > 0 && i2.every((a4) => W2(a4, s2)) ? u4.push(`state=${p2} (every value is "CA", which is both Canada and California)`) : P2(t) ? (u4.push(`state=${p2} (every value is a country, not a state)`), o.country || (o.country = p2)) : v2(t) < 95 ? u4.push(`state=${p2} (only ${v2(t)}% of values are states/provinces)`) : o.state = p2;
1267
1279
  }
1268
- let d = new Set(Object.values(o).filter(Boolean)), x2 = r.filter((t) => !d.has(t) && !t.startsWith("__"));
1280
+ let g3 = new Set(Object.values(o).filter(Boolean)), x2 = r.filter((t) => !g3.has(t) && !t.startsWith("__"));
1269
1281
  if (!o.state) {
1270
1282
  let t = null;
1271
1283
  for (let i2 of x2) {
@@ -1273,16 +1285,16 @@ function ie(r, n, e, s2, c2) {
1273
1285
  if (P2(a4)) continue;
1274
1286
  let f4 = v2(a4);
1275
1287
  if (f4 < 95) continue;
1276
- let N2 = z2(a4, (S) => !!Y(S)), Y2 = z2(a4, (S) => !!Y(S) && !q2(S, s2));
1277
- N2 < E2 && Y2 < 1 || (!t || f4 > t.pct) && (t = { name: i2, pct: f4 });
1288
+ let k2 = z2(a4, (T3) => !!Y(T3)), Y2 = z2(a4, (T3) => !!Y(T3) && !W2(T3, s2));
1289
+ k2 < E2 && Y2 < 1 || (!t || f4 > t.pct) && (t = { name: i2, pct: f4 });
1278
1290
  }
1279
- t && (o.state = t.name, d.add(t.name), A.push(`state=${t.name} (${t.pct}% states/provinces)`));
1291
+ t && (o.state = t.name, g3.add(t.name), A.push(`state=${t.name} (${t.pct}% states/provinces)`));
1280
1292
  }
1281
1293
  if (!o.zip) for (let t of x2) {
1282
- if (d.has(t)) continue;
1283
- let i2 = l2(t), a4 = D2(i2);
1284
- if (!(a4 < 95) && Z2(i2, t) && !(oe(i2, (f4) => Z(f4).length > 0) < E2)) {
1285
- o.zip = t, d.add(t), A.push(`zip=${t} (${a4}% ZIP codes)`);
1294
+ if (g3.has(t)) continue;
1295
+ let i2 = l2(t), a4 = $2(i2);
1296
+ if (!(a4 < 95) && q2(i2, t) && !(ae(i2, (f4) => Z(f4).length > 0) < E2)) {
1297
+ o.zip = t, g3.add(t), A.push(`zip=${t} (${a4}% ZIP codes)`);
1286
1298
  break;
1287
1299
  }
1288
1300
  }
@@ -1290,26 +1302,26 @@ function ie(r, n, e, s2, c2) {
1290
1302
  if (!h2 || !P2(l2(h2))) {
1291
1303
  let t = null;
1292
1304
  for (let i2 of x2) {
1293
- if (d.has(i2) || !P2(l2(i2))) continue;
1294
- let a4 = $2(l2(i2));
1305
+ if (g3.has(i2) || !P2(l2(i2))) continue;
1306
+ let a4 = D2(l2(i2));
1295
1307
  (!t || a4 > t.pct) && (t = { name: i2, pct: a4 });
1296
1308
  }
1297
- t && (h2 && (u4.push(`country=${h2} (only ${$2(l2(h2))}% of values are country identifiers; using ${t.name} instead)`), M.country = h2), o.country = t.name, d.add(t.name), A.push(`country=${t.name}`));
1309
+ t && (h2 && (u4.push(`country=${h2} (only ${D2(l2(h2))}% of values are country identifiers; using ${t.name} instead)`), M.country = h2), o.country = t.name, g3.add(t.name), A.push(`country=${t.name}`));
1298
1310
  }
1299
1311
  if (!o.city) {
1300
1312
  let t = null;
1301
1313
  for (let i2 of x2) {
1302
- if (d.has(i2)) continue;
1303
- let a4 = l2(i2), f4 = ne(a4, s2);
1304
- f4 < m3 || z2(a4, (N2) => p3(N2, s2)) < E2 || (!t || f4 > t.pct) && (t = { name: i2, pct: f4 });
1314
+ if (g3.has(i2)) continue;
1315
+ let a4 = l2(i2), f4 = se(a4, s2);
1316
+ f4 < m3 || z2(a4, (k2) => p3(k2, s2)) < E2 || (!t || f4 > t.pct) && (t = { name: i2, pct: f4 });
1305
1317
  }
1306
1318
  t && (o.city = t.name, A.push(`city=${t.name} (${t.pct}% known cities)`));
1307
1319
  }
1308
- let B2 = o.country ? l2(o.country) : [], k2 = !!o.country && P2(B2), j3 = k2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K2 = k2 && j3 >= 2, L2 = !!(o.lat && o.lon) && n.some((t) => {
1320
+ let B2 = o.country ? l2(o.country) : [], L2 = !!o.country && P2(B2), j2 = L2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K2 = L2 && j2 >= 2, N2 = !!(o.lat && o.lon) && n.some((t) => {
1309
1321
  let i2 = +String(t[o.lat] ?? "").trim(), a4 = +String(t[o.lon] ?? "").trim();
1310
1322
  return isFinite(i2) && isFinite(a4) && i2 >= -90 && i2 <= 90 && a4 >= -180 && a4 <= 180 && String(t[o.lat] ?? "").trim() !== "" && String(t[o.lon] ?? "").trim() !== "";
1311
1323
  });
1312
- return o.lat && o.lon && !L2 && u4.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !K2 && !(o.city || o.state || o.zip || L2) && u4.push(k2 ? `country=${o.country} (every row resolves to the same country - nothing to place apart)` : `country=${o.country} (values are not country identifiers)`), { bind: !!(o.city || o.state || o.zip || K2 || L2) ? o : null, backfilled: A, refused: u4, ...Object.keys(M).length ? { labelFallback: M } : {} };
1324
+ return o.lat && o.lon && !N2 && u4.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !K2 && !(o.city || o.state || o.zip || N2) && u4.push(L2 ? `country=${o.country} (every row resolves to the same country - nothing to place apart)` : `country=${o.country} (values are not country identifiers)`), { bind: !!(o.city || o.state || o.zip || K2 || N2) ? o : null, backfilled: A, refused: u4, ...Object.keys(M).length ? { labelFallback: M } : {} };
1313
1325
  }
1314
1326
 
1315
1327
  // src/payload.ts
@@ -1324,7 +1336,7 @@ function resolvePointChannel(cols, rowObjs, point) {
1324
1336
  let labelCol;
1325
1337
  if (bind) {
1326
1338
  const dims = cols.filter((c2) => !c2.isMeasure).map((c2) => c2.name);
1327
- const res = ie(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.name));
1339
+ const res = le(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.name));
1328
1340
  bind = res.bind;
1329
1341
  rolesBackfilled = res.backfilled;
1330
1342
  rolesRefused = res.refused;
@@ -1575,8 +1587,8 @@ function createMarkResolver(env) {
1575
1587
  for (const n of all) {
1576
1588
  const tag = (n.tagName || "").toLowerCase();
1577
1589
  if (!SHAPE.test(tag)) continue;
1578
- const pe2 = viewStyle(n);
1579
- if (pe2 && pe2 !== "none") return true;
1590
+ const pe = viewStyle(n);
1591
+ if (pe && pe !== "none") return true;
1580
1592
  }
1581
1593
  return false;
1582
1594
  };
@@ -1806,8 +1818,8 @@ function rgbToLab(r, g3, b2) {
1806
1818
  const R = linearise(r), G3 = linearise(g3), B2 = linearise(b2);
1807
1819
  const X2 = 0.4124564 * R + 0.3575761 * G3 + 0.1804375 * B2;
1808
1820
  const Y2 = 0.2126729 * R + 0.7151522 * G3 + 0.072175 * B2;
1809
- const Z3 = 0.0193339 * R + 0.119192 * G3 + 0.9503041 * B2;
1810
- const fx = f2(X2 / Xn), fy = f2(Y2 / Yn), fz = f2(Z3 / Zn);
1821
+ const Z4 = 0.0193339 * R + 0.119192 * G3 + 0.9503041 * B2;
1822
+ const fx = f2(X2 / Xn), fy = f2(Y2 / Yn), fz = f2(Z4 / Zn);
1811
1823
  return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
1812
1824
  }
1813
1825
  function hexToLab(hex2) {
@@ -1856,6 +1868,10 @@ function deltaE2000(c1, c2) {
1856
1868
  const tL = dLp / SL, tC = dCp / SC, tH = dHp / SH;
1857
1869
  return Math.sqrt(tL * tL + tC * tC + tH * tH + RT * tC * tH);
1858
1870
  }
1871
+ function deltaEHex(a4, b2) {
1872
+ const la = hexToLab(a4), lb = hexToLab(b2);
1873
+ return la && lb ? deltaE2000(la, lb) : NaN;
1874
+ }
1859
1875
 
1860
1876
  // src/colourSpread.ts
1861
1877
  var SAME_SHADE_DELTA_E = 5;
@@ -1936,14 +1952,14 @@ function censusColourSpread(container, doc) {
1936
1952
  const d = cs.map(() => new Array(cs.length).fill(0));
1937
1953
  let span = 0, lo = 0, hi = 1;
1938
1954
  for (let i2 = 0; i2 < cs.length; i2++) {
1939
- for (let j3 = i2 + 1; j3 < cs.length; j3++) {
1940
- const v3 = deltaE2000(cs[i2], cs[j3]);
1941
- d[i2][j3] = v3;
1942
- d[j3][i2] = v3;
1955
+ for (let j2 = i2 + 1; j2 < cs.length; j2++) {
1956
+ const v3 = deltaE2000(cs[i2], cs[j2]);
1957
+ d[i2][j2] = v3;
1958
+ d[j2][i2] = v3;
1943
1959
  if (v3 > span) {
1944
1960
  span = v3;
1945
1961
  lo = i2;
1946
- hi = j3;
1962
+ hi = j2;
1947
1963
  }
1948
1964
  }
1949
1965
  }
@@ -1958,8 +1974,8 @@ function censusColourSpread(container, doc) {
1958
1974
  let crowd = 0;
1959
1975
  for (let i2 = 0; i2 < cs.length; i2++) {
1960
1976
  let n = 0;
1961
- for (let j3 = 0; j3 < cs.length; j3++) {
1962
- if (i2 === j3 || d[i2][j3] <= SAME_SHADE_DELTA_E) n += top[j3].n;
1977
+ for (let j2 = 0; j2 < cs.length; j2++) {
1978
+ if (i2 === j2 || d[i2][j2] <= SAME_SHADE_DELTA_E) n += top[j2].n;
1963
1979
  }
1964
1980
  if (n > crowd) crowd = n;
1965
1981
  }
@@ -2579,10 +2595,10 @@ function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
2579
2595
  if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
2580
2596
  const k2 = Math.floor(n);
2581
2597
  for (let i2 = 0; i2 < k2; i2++) {
2582
- for (let j3 = 0; j3 < k2; j3++) {
2598
+ for (let j2 = 0; j2 < k2; j2++) {
2583
2599
  out.push({
2584
2600
  x: box.left + box.width * (i2 + 0.5) / k2,
2585
- y: box.top + box.height * (j3 + 0.5) / k2
2601
+ y: box.top + box.height * (j2 + 0.5) / k2
2586
2602
  });
2587
2603
  }
2588
2604
  }
@@ -2603,10 +2619,10 @@ var LABEL_CONTRAST_CAP = 2e3;
2603
2619
  var EMPTY4 = { rects: 0, scanned: 0, fixed: 0, pillsBoosted: 0, offFill: 0, pageMajority: 0 };
2604
2620
  function backedSamples(el, pts) {
2605
2621
  try {
2606
- const ge2 = el;
2607
- if (typeof ge2.isPointInFill !== "function" || typeof ge2.getScreenCTM !== "function") return null;
2608
- const m = ge2.getScreenCTM();
2609
- const svg = ge2.ownerSVGElement;
2622
+ const ge = el;
2623
+ if (typeof ge.isPointInFill !== "function" || typeof ge.getScreenCTM !== "function") return null;
2624
+ const m = ge.getScreenCTM();
2625
+ const svg = ge.ownerSVGElement;
2610
2626
  if (!m || !svg || typeof svg.createSVGPoint !== "function") return null;
2611
2627
  if (pts.length === 0) return null;
2612
2628
  const inv = m.inverse();
@@ -2615,7 +2631,7 @@ function backedSamples(el, pts) {
2615
2631
  const p2 = svg.createSVGPoint();
2616
2632
  p2.x = pts[i2].x;
2617
2633
  p2.y = pts[i2].y;
2618
- hit.push(ge2.isPointInFill(p2.matrixTransform(inv)));
2634
+ hit.push(ge.isPointInFill(p2.matrixTransform(inv)));
2619
2635
  }
2620
2636
  return hit;
2621
2637
  } catch {
@@ -3198,10 +3214,10 @@ export {
3198
3214
  L3,
3199
3215
  p,
3200
3216
  u2 as u,
3201
- vt,
3202
- It2 as It,
3203
- Me,
3204
- Te,
3217
+ Ee,
3218
+ De,
3219
+ Bt,
3220
+ Yt,
3205
3221
  buildRenderPayload,
3206
3222
  createMarkResolver,
3207
3223
  ensureCrossfilterHitTargets,
@@ -3211,6 +3227,7 @@ export {
3211
3227
  MIN_HIT_BAND_PX,
3212
3228
  censusHitBands,
3213
3229
  hitBandFlag,
3230
+ deltaEHex,
3214
3231
  SAME_SHADE_DELTA_E,
3215
3232
  MIN_RAMP_FILLS,
3216
3233
  censusColourSpread,
package/dist/index.mjs CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  AXIS_PIN_MIN_LABELS,
17
17
  AXIS_PIN_TRACK_REACH_PX,
18
18
  BACKING_MAJORITY,
19
+ Bt,
19
20
  COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT,
20
21
  COLOR_SCALE_SELF_CLAMP_PCT_MAX,
21
22
  COLOR_SCALE_SELF_CLAMP_PCT_MIN,
@@ -26,13 +27,14 @@ import {
26
27
  DARK_TEXT,
27
28
  DIM_OPACITY_DEFAULT,
28
29
  DIM_OPACITY_VAR,
30
+ De,
31
+ Ee,
29
32
  FIT_CONTENT_SELECTOR,
30
33
  FLIP_MODE_DEFAULT,
31
34
  GEO_POINT_PRECISIONS,
32
35
  GLYPH_SAMPLE_N,
33
36
  HOST_CONTAINER_CLASS,
34
37
  HOST_CONTRACT_VERSION,
35
- It,
36
38
  L3,
37
39
  LABEL_CONTRAST_CAP,
38
40
  LABEL_CONTRAST_DONE_ATTR,
@@ -45,7 +47,6 @@ import {
45
47
  MIN_CONTRAST,
46
48
  MIN_HIT_BAND_PX,
47
49
  MIN_RAMP_FILLS,
48
- Me,
49
50
  PAGE_MATCH_TOLERANCE,
50
51
  PHANTOM_FRACTION,
51
52
  PILL_MIN_ALPHA,
@@ -56,10 +57,10 @@ import {
56
57
  SCROLL_SLACK_PX,
57
58
  SEASONAL_MARKERS_DEFAULT,
58
59
  SELECTION_ACTIVE_CLASS,
59
- Te,
60
60
  VALUE_AXIS_BASELINE_DEFAULT,
61
61
  WHITE_TEXT_BG_LUM,
62
62
  XFILTER_REFRESH_EVENT,
63
+ Yt,
63
64
  applyLabelContrast,
64
65
  axisPinPlacement,
65
66
  backingHoldsGlyph,
@@ -80,6 +81,7 @@ import {
80
81
  createMarkResolver,
81
82
  ctmScaleOf,
82
83
  decideLabelColor,
84
+ deltaEHex,
83
85
  ensureCrossfilterHitTargets,
84
86
  explainRenderFailure,
85
87
  fitReadingFor,
@@ -114,9 +116,8 @@ import {
114
116
  svgInkReach,
115
117
  toRGBA,
116
118
  u,
117
- unpinScrolledAxis,
118
- vt
119
- } from "./chunk-YIRWZUKN.mjs";
119
+ unpinScrolledAxis
120
+ } from "./chunk-IIBDCQJM.mjs";
120
121
  import "./chunk-A2GMXZP7.mjs";
121
122
  import "./chunk-GHODWOAL.mjs";
122
123
 
@@ -1236,15 +1237,15 @@ function displayText(col, raw, opts) {
1236
1237
  return String(raw);
1237
1238
  }
1238
1239
  function isSuppressed(col) {
1239
- return vt(col).suppressed;
1240
+ return Ee(col).suppressed;
1240
1241
  }
1241
1242
  function resolveAgg(col, requested, auto) {
1242
1243
  const fallback = () => {
1243
- const d2 = Me(col);
1244
+ const d2 = Bt(col);
1244
1245
  return d2 === "first" ? "count" : d2;
1245
1246
  };
1246
1247
  if (auto) return fallback();
1247
- return It(col).indexOf(requested) >= 0 ? requested : fallback();
1248
+ return De(col).indexOf(requested) >= 0 ? requested : fallback();
1248
1249
  }
1249
1250
  function toNumber(v2) {
1250
1251
  if (v2 == null || v2 === "") return null;
@@ -1347,7 +1348,7 @@ function computeSelectionCard(payload, selectedRowIdxs, opts = {}) {
1347
1348
  }
1348
1349
  const value = reduce(selVals, colAgg, selRaw);
1349
1350
  let sharePct = null;
1350
- if (Te(col, colAgg) && value != null) {
1351
+ if (Yt(col, colAgg) && value != null) {
1351
1352
  const allVals = [];
1352
1353
  const allRaw = [];
1353
1354
  for (let r2 = 0; r2 < rows.length; r2++) {
@@ -1896,7 +1897,7 @@ var ft = (function() {
1896
1897
  var st = function(t2, r2, n2, e2) {
1897
1898
  return new ft([t2, r2, n2], e2);
1898
1899
  };
1899
- var vt2 = function(t2, r2, n2, e2) {
1900
+ var vt = function(t2, r2, n2, e2) {
1900
1901
  return new ft(s(t2, r2, n2), e2);
1901
1902
  };
1902
1903
  var bt = function(t2, r2, n2, e2) {
@@ -1925,7 +1926,7 @@ Mt.config = function(t2) {
1925
1926
  }, Mt.random = function() {
1926
1927
  var t2 = a(0, 255), r2 = a(0, 255), n2 = a(0, 255);
1927
1928
  return new ft([t2, r2, n2]);
1928
- }, Mt.convertor = Y, Mt.Color = ft, Mt.rgb = st, Mt.hsl = vt2, Mt.hsv = bt, Mt.hsi = yt, Mt.hwb = dt, Mt.xyz = gt, Mt.lab = wt, Mt.lch = mt, Mt.mix = D, Mt.deltaE = et, Mt.utils = { roundDecimal: i, randomRange: a }, Mt.useNames = function(t2, r2) {
1929
+ }, Mt.convertor = Y, Mt.Color = ft, Mt.rgb = st, Mt.hsl = vt, Mt.hsv = bt, Mt.hsi = yt, Mt.hwb = dt, Mt.xyz = gt, Mt.lab = wt, Mt.lch = mt, Mt.mix = D, Mt.deltaE = et, Mt.utils = { roundDecimal: i, randomRange: a }, Mt.useNames = function(t2, r2) {
1929
1930
  return (function(t3, r3) {
1930
1931
  if (void 0 !== r3 && "function" == typeof r3) {
1931
1932
  var n2 = {};
@@ -2027,6 +2028,33 @@ function buildPalette(seedFor, count, minDistance = MIN_DELTA_E) {
2027
2028
  }
2028
2029
  return out;
2029
2030
  }
2031
+ function orderMostDistinct(lead, pool) {
2032
+ const seen = /* @__PURE__ */ new Set();
2033
+ const valid = [];
2034
+ const take = (c2) => {
2035
+ const s2 = typeof c2 === "string" ? c2.trim() : "";
2036
+ if (!s2 || !Number.isFinite(deltaEHex(s2, s2))) return;
2037
+ const key = s2.toLowerCase();
2038
+ if (seen.has(key)) return;
2039
+ seen.add(key);
2040
+ valid.push(s2);
2041
+ };
2042
+ take(lead);
2043
+ for (const c2 of pool ?? []) take(c2);
2044
+ if (!valid.length) return [];
2045
+ const out = [valid[0]];
2046
+ const rest = valid.slice(1);
2047
+ const nearest = rest.map((c2) => deltaEHex(c2, out[0]));
2048
+ while (rest.length) {
2049
+ let best = 0;
2050
+ for (let i2 = 1; i2 < rest.length; i2++) if (nearest[i2] > nearest[best]) best = i2;
2051
+ const picked = rest.splice(best, 1)[0];
2052
+ nearest.splice(best, 1);
2053
+ out.push(picked);
2054
+ for (let i2 = 0; i2 < rest.length; i2++) nearest[i2] = Math.min(nearest[i2], deltaEHex(rest[i2], picked));
2055
+ }
2056
+ return out;
2057
+ }
2030
2058
  function normalise(seed) {
2031
2059
  return typeof seed === "string" ? seed.trim() : "";
2032
2060
  }
@@ -2149,6 +2177,7 @@ export {
2149
2177
  createMarkResolver,
2150
2178
  ctmScaleOf,
2151
2179
  decideLabelColor,
2180
+ deltaEHex,
2152
2181
  ensureCrossfilterHitTargets,
2153
2182
  explainRenderFailure,
2154
2183
  filterFitsChooser,
@@ -2179,6 +2208,7 @@ export {
2179
2208
  noopViewStateProvider,
2180
2209
  normaliseAggregation,
2181
2210
  normalizeFilterTerm,
2211
+ orderMostDistinct,
2182
2212
  orderRefusalsForDisplay,
2183
2213
  periodTickSuppressesFeedback,
2184
2214
  pickDistinctColorFromSeed,
package/dist/react.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createChartHost,
5
5
  geoFromCache,
6
6
  loadGeo
7
- } from "./chunk-YIRWZUKN.mjs";
7
+ } from "./chunk-IIBDCQJM.mjs";
8
8
  import "./chunk-A2GMXZP7.mjs";
9
9
  import "./chunk-GHODWOAL.mjs";
10
10
 
@@ -27,4 +27,5 @@ export { SCROLL_SLACK_PX, MAX_FRAME_GROW_FACTOR, PHANTOM_FRACTION, FIT_CONTENT_S
27
27
  export { fitRenderedChart, fitReadingFor, measureContainerBoxes, svgInkReach, ctmScaleOf, type FitReading, type InkReach, type FitRenderedChartOptions, type FitRenderedChartResult, } from "./fitDom";
28
28
  export { AXIS_PIN_MIN_LABELS, AXIS_PIN_BAND_PAD_PX, AXIS_PIN_MAX_BAND_FRACTION, AXIS_PIN_TRACK_REACH_PX, isHorizontalLabelRow, labelBand, planAxisPin, axisPinPlacement, type LabelRowBox, type AxisBand, type AxisPinCandidate, type AxisPinPlan, type AxisPinEdge, } from "./fit";
29
29
  export { pinScrolledAxis, unpinScrolledAxis, type AxisPinReport } from "./fitDom";
30
- export { MIN_DELTA_E, pickDistinctColorFromSeed, buildPalette, buildPaletteFromSeed, type PaletteResult, type SeedForSlot, } from "./palette";
30
+ export { MIN_DELTA_E, pickDistinctColorFromSeed, buildPalette, buildPaletteFromSeed, orderMostDistinct, type PaletteResult, type SeedForSlot, } from "./palette";
31
+ export { deltaEHex } from "./deltaE";
@@ -76,3 +76,31 @@ export type SeedForSlot = (slot: number) => string | null | undefined;
76
76
  * constant provider and the walk does the spreading. That is a fallback, not the design.
77
77
  */
78
78
  export declare function buildPalette(seedFor: SeedForSlot, count: number, minDistance?: number): string[];
79
+ /**
80
+ * A POOL OF ACCEPTABLE COLOURS, ORDERED SO THE MOST DISTINCT COME FIRST.
81
+ *
82
+ * For a host that knows WHICH colours belong to the surface but not in what ORDER to use them.
83
+ * Excel is the case that needed it: a workbook's theme offers a grid of accents and their tints,
84
+ * none of which is ranked, and the order a host invents decides what a two- or five-series chart
85
+ * looks like. The order Office itself lists its accents in puts two blues four slots apart, so a
86
+ * five-series chart following that list gives two of its series nearly the same colour - which
87
+ * reads as one series.
88
+ *
89
+ * NEVER USE THIS ON AN AUTHORED ORDER. A report theme's slot order is somebody's decision, and
90
+ * `buildPalette` exists to honour it verbatim; re-sorting it here would override the author with
91
+ * arithmetic. This is only for a pool a host assembled itself.
92
+ *
93
+ * The method is greedy max-min (the farthest-point walk used for categorical colour sets): keep
94
+ * the lead, then repeatedly take the pool colour whose NEAREST already-chosen colour is farthest
95
+ * away, by CIEDE2000. Two properties follow and the tests pin both. The distance each pick adds is
96
+ * never larger than the one before it, so the early slots, which every chart uses, are the best
97
+ * separated. And every input colour is returned unchanged, so the palette is still the surface's
98
+ * own colours, only re-ordered.
99
+ *
100
+ * Deterministic: ties go to the colour listed earlier in the pool. Duplicates (case-insensitive)
101
+ * and anything that is not `#rgb` / `#rrggbb` are dropped, because a colour that cannot be
102
+ * measured cannot be placed. A blank or unmeasurable lead means "start from the pool's first
103
+ * colour". Feed the result to `buildPalette`, which still guarantees the minimum separation when
104
+ * two pool colours are too close to share a legend.
105
+ */
106
+ export declare function orderMostDistinct(lead: string | null | undefined, pool: readonly string[]): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.92",
3
+ "version": "0.5.94",
4
4
  "description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",