@bicharts/chart-host 0.5.111 → 0.5.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OSXEQYDB.mjs → chunk-X3HRLEDK.mjs} +259 -241
- package/dist/index.mjs +9 -9
- package/dist/react.mjs +1 -1
- package/dist/types/payload.d.ts +4 -0
- package/package.json +1 -1
|
@@ -211,10 +211,10 @@ var require_papaparse_min = __commonJS({
|
|
|
211
211
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
212
212
|
}
|
|
213
213
|
function E2(C2) {
|
|
214
|
-
var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x3 = C2.comments, I2 = C2.step,
|
|
215
|
-
if (void 0 !== C2.escapeChar && (
|
|
214
|
+
var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x3 = C2.comments, I2 = C2.step, A2 = C2.preview, T3 = C2.fastMode, D4 = null, L2 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar, j2 = F4;
|
|
215
|
+
if (void 0 !== C2.escapeChar && (j2 = C2.escapeChar), ("string" != typeof S || -1 < v2.BAD_DELIMITERS.indexOf(S)) && (S = ","), x3 === S) throw new Error("Comment character same as delimiter");
|
|
216
216
|
true === x3 ? x3 = "#" : ("string" != typeof x3 || -1 < v2.BAD_DELIMITERS.indexOf(x3)) && (x3 = false), "\n" !== O2 && "\r" !== O2 && "\r\n" !== O2 && (O2 = "\n");
|
|
217
|
-
var z3 = 0,
|
|
217
|
+
var z3 = 0, M4 = false;
|
|
218
218
|
this.parse = function(i2, t, r2) {
|
|
219
219
|
if ("string" != typeof i2) throw new Error("Input must be a string");
|
|
220
220
|
var n2 = i2.length, e = S.length, s2 = O2.length, a5 = x3.length, o2 = q4(I2), h4 = [], u4 = [], d3 = [], f5 = z3 = 0;
|
|
@@ -225,18 +225,18 @@ var require_papaparse_min = __commonJS({
|
|
|
225
225
|
else if (r2) return w3();
|
|
226
226
|
if (!x3 || d3.substring(0, a5) !== x3) {
|
|
227
227
|
if (o2) {
|
|
228
|
-
if (h4 = [], k2(d3.split(S)),
|
|
228
|
+
if (h4 = [], k2(d3.split(S)), R2(), M4) return w3();
|
|
229
229
|
} else k2(d3.split(S));
|
|
230
|
-
if (
|
|
230
|
+
if (A2 && A2 <= c4) return h4 = h4.slice(0, A2), w3(true);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
return w3();
|
|
234
234
|
}
|
|
235
|
-
for (var p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O2, z3), _3 = new RegExp(U2(
|
|
235
|
+
for (var p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O2, z3), _3 = new RegExp(U2(j2) + U2(F4), "g"), m4 = i2.indexOf(F4, z3); ; ) if (i2[z3] === F4) for (m4 = z3, z3++; ; ) {
|
|
236
236
|
if (-1 === (m4 = i2.indexOf(F4, m4 + 1))) return r2 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: z3 }), E4();
|
|
237
237
|
if (m4 === n2 - 1) return E4(i2.substring(z3, m4).replace(_3, F4));
|
|
238
|
-
if (F4 ===
|
|
239
|
-
else if (F4 ===
|
|
238
|
+
if (F4 === j2 && i2[m4 + 1] === j2) m4++;
|
|
239
|
+
else if (F4 === j2 || 0 === m4 || i2[m4 - 1] !== j2) {
|
|
240
240
|
-1 !== p4 && p4 < m4 + 1 && (p4 = i2.indexOf(S, m4 + 1));
|
|
241
241
|
var y6 = v3(-1 === (g4 = -1 !== g4 && g4 < m4 + 1 ? i2.indexOf(O2, m4 + 1) : g4) ? p4 : Math.min(p4, g4));
|
|
242
242
|
if (i2.substr(m4 + 1 + y6, e) === S) {
|
|
@@ -245,8 +245,8 @@ var require_papaparse_min = __commonJS({
|
|
|
245
245
|
}
|
|
246
246
|
y6 = v3(g4);
|
|
247
247
|
if (i2.substring(m4 + 1 + y6, m4 + 1 + y6 + s2) === O2) {
|
|
248
|
-
if (d3.push(i2.substring(z3, m4).replace(_3, F4)), b5(m4 + 1 + y6 + s2), p4 = i2.indexOf(S, z3), m4 = i2.indexOf(F4, z3), o2 && (
|
|
249
|
-
if (
|
|
248
|
+
if (d3.push(i2.substring(z3, m4).replace(_3, F4)), b5(m4 + 1 + y6 + s2), p4 = i2.indexOf(S, z3), m4 = i2.indexOf(F4, z3), o2 && (R2(), M4)) return w3();
|
|
249
|
+
if (A2 && h4.length >= A2) return w3(true);
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
252
|
u4.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h4.length, index: z3 }), m4++;
|
|
@@ -258,8 +258,8 @@ var require_papaparse_min = __commonJS({
|
|
|
258
258
|
} else if (-1 !== p4 && (p4 < g4 || -1 === g4)) d3.push(i2.substring(z3, p4)), z3 = p4 + e, p4 = i2.indexOf(S, z3);
|
|
259
259
|
else {
|
|
260
260
|
if (-1 === g4) break;
|
|
261
|
-
if (d3.push(i2.substring(z3, g4)), b5(g4 + s2), o2 && (
|
|
262
|
-
if (
|
|
261
|
+
if (d3.push(i2.substring(z3, g4)), b5(g4 + s2), o2 && (R2(), M4)) return w3();
|
|
262
|
+
if (A2 && h4.length >= A2) return w3(true);
|
|
263
263
|
}
|
|
264
264
|
return E4();
|
|
265
265
|
function k2(e2) {
|
|
@@ -270,7 +270,7 @@ var require_papaparse_min = __commonJS({
|
|
|
270
270
|
return t2 = -1 !== e2 && (e2 = i2.substring(m4 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
|
|
271
271
|
}
|
|
272
272
|
function E4(e2) {
|
|
273
|
-
return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2, k2(d3), o2 &&
|
|
273
|
+
return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2, k2(d3), o2 && R2()), w3();
|
|
274
274
|
}
|
|
275
275
|
function b5(e2) {
|
|
276
276
|
z3 = e2, k2(d3), d3 = [], g4 = i2.indexOf(O2, z3);
|
|
@@ -290,13 +290,13 @@ var require_papaparse_min = __commonJS({
|
|
|
290
290
|
}
|
|
291
291
|
n4 && console.warn("Duplicate headers found and renamed."), L2 = true;
|
|
292
292
|
}
|
|
293
|
-
return { data: h4, errors: u4, meta: { delimiter: S, linebreak: O2, aborted:
|
|
293
|
+
return { data: h4, errors: u4, meta: { delimiter: S, linebreak: O2, aborted: M4, truncated: !!e2, cursor: f5 + (t || 0), renamedHeaders: D4 } };
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function R2() {
|
|
296
296
|
I2(w3()), h4 = [], u4 = [];
|
|
297
297
|
}
|
|
298
298
|
}, this.abort = function() {
|
|
299
|
-
|
|
299
|
+
M4 = true;
|
|
300
300
|
}, this.getCharIndex = function() {
|
|
301
301
|
return z3;
|
|
302
302
|
};
|
|
@@ -499,11 +499,11 @@ function f(t) {
|
|
|
499
499
|
return t > EPS ? Math.cbrt(t) : (KAPPA * t + 16) / 116;
|
|
500
500
|
}
|
|
501
501
|
function rgbToLab(r, g3, b4) {
|
|
502
|
-
const
|
|
503
|
-
const X2 = 0.4124564 *
|
|
504
|
-
const Y2 = 0.2126729 *
|
|
505
|
-
const
|
|
506
|
-
const fx = f(X2 / Xn), fy = f(Y2 / Yn), fz = f(
|
|
502
|
+
const R2 = linearise(r), G3 = linearise(g3), B2 = linearise(b4);
|
|
503
|
+
const X2 = 0.4124564 * R2 + 0.3575761 * G3 + 0.1804375 * B2;
|
|
504
|
+
const Y2 = 0.2126729 * R2 + 0.7151522 * G3 + 0.072175 * B2;
|
|
505
|
+
const Z3 = 0.0193339 * R2 + 0.119192 * G3 + 0.9503041 * B2;
|
|
506
|
+
const fx = f(X2 / Xn), fy = f(Y2 / Yn), fz = f(Z3 / Zn);
|
|
507
507
|
return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
|
|
508
508
|
}
|
|
509
509
|
function hexToLab(hex2) {
|
|
@@ -560,11 +560,11 @@ function labToHex(lab) {
|
|
|
560
560
|
const fy = (lab.L + 16) / 116, fx = fy + lab.a / 500, fz = fy - lab.b / 200;
|
|
561
561
|
const X2 = Xn * finv(fx);
|
|
562
562
|
const Y2 = Yn * (lab.L > KAPPA * EPS ? fy * fy * fy : lab.L / KAPPA);
|
|
563
|
-
const
|
|
563
|
+
const Z3 = Zn * finv(fz);
|
|
564
564
|
const lin = [
|
|
565
|
-
3.2404542 * X2 - 1.5371385 * Y2 - 0.4985314 *
|
|
566
|
-
-0.969266 * X2 + 1.8760108 * Y2 + 0.041556 *
|
|
567
|
-
0.0556434 * X2 - 0.2040259 * Y2 + 1.0572252 *
|
|
565
|
+
3.2404542 * X2 - 1.5371385 * Y2 - 0.4985314 * Z3,
|
|
566
|
+
-0.969266 * X2 + 1.8760108 * Y2 + 0.041556 * Z3,
|
|
567
|
+
0.0556434 * X2 - 0.2040259 * Y2 + 1.0572252 * Z3
|
|
568
568
|
];
|
|
569
569
|
return "#" + lin.map((v2) => {
|
|
570
570
|
const c2 = Math.max(0, Math.min(1, v2));
|
|
@@ -669,14 +669,14 @@ function censusColourSpread(container, doc) {
|
|
|
669
669
|
const d2 = cs.map(() => new Array(cs.length).fill(0));
|
|
670
670
|
let span = 0, lo = 0, hi = 1;
|
|
671
671
|
for (let i = 0; i < cs.length; i++) {
|
|
672
|
-
for (let
|
|
673
|
-
const v2 = deltaE2000(cs[i], cs[
|
|
674
|
-
d2[i][
|
|
675
|
-
d2[
|
|
672
|
+
for (let j2 = i + 1; j2 < cs.length; j2++) {
|
|
673
|
+
const v2 = deltaE2000(cs[i], cs[j2]);
|
|
674
|
+
d2[i][j2] = v2;
|
|
675
|
+
d2[j2][i] = v2;
|
|
676
676
|
if (v2 > span) {
|
|
677
677
|
span = v2;
|
|
678
678
|
lo = i;
|
|
679
|
-
hi =
|
|
679
|
+
hi = j2;
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
}
|
|
@@ -691,8 +691,8 @@ function censusColourSpread(container, doc) {
|
|
|
691
691
|
let crowd = 0;
|
|
692
692
|
for (let i = 0; i < cs.length; i++) {
|
|
693
693
|
let n = 0;
|
|
694
|
-
for (let
|
|
695
|
-
if (i ===
|
|
694
|
+
for (let j2 = 0; j2 < cs.length; j2++) {
|
|
695
|
+
if (i === j2 || d2[i][j2] <= SAME_SHADE_DELTA_E) n += top[j2].n;
|
|
696
696
|
}
|
|
697
697
|
if (n > crowd) crowd = n;
|
|
698
698
|
}
|
|
@@ -764,15 +764,15 @@ function resolveAutoColorScale(p2) {
|
|
|
764
764
|
};
|
|
765
765
|
const candidates = p2.isHighContrast ? [normHex(p2.themeAccent), normHex(p2.themeFg)] : [...palette.map(normHex), normHex(p2.themeAccent), normHex(p2.themeFg)];
|
|
766
766
|
const accent = candidates.find(usable) ?? FALLBACK_ACCENT;
|
|
767
|
-
const
|
|
767
|
+
const A2 = hexToLab(accent);
|
|
768
768
|
let t = 0.1;
|
|
769
|
-
let low = mixLab(bg,
|
|
769
|
+
let low = mixLab(bg, A2, t);
|
|
770
770
|
while (t < 0.6 && deltaE2000(paintedOver(labToHex(low), canvas, AUTO_RAMP_DRAWN_OPACITY), bg) < SAME_SHADE_DELTA_E) {
|
|
771
771
|
t += 0.02;
|
|
772
|
-
low = mixLab(bg,
|
|
772
|
+
low = mixLab(bg, A2, t);
|
|
773
773
|
}
|
|
774
774
|
const lowHex = labToHex(low);
|
|
775
|
-
let high = { ...
|
|
775
|
+
let high = { ...A2 };
|
|
776
776
|
let highHex = labToHex(high);
|
|
777
777
|
for (let step = 0; step < 80 && autoRampMinStep(lowHex, highHex, canvas) < AUTO_RAMP_MIN_STEP_DELTA_E; step++) {
|
|
778
778
|
const L2 = Math.max(4, Math.min(98, high.L + (darkCanvas ? 1 : -1)));
|
|
@@ -1226,14 +1226,14 @@ function A3(n) {
|
|
|
1226
1226
|
if (r && i && c3(r) !== i && (r = null), n.city !== void 0 && n.city !== null) {
|
|
1227
1227
|
let a4 = u(String(n.city)), s = O(a4), f4 = s ? F(s, n.mapKind) : null;
|
|
1228
1228
|
if (f4 && f4.length) {
|
|
1229
|
-
let d2 = n.state === void 0 || n.state === null ? "" : String(n.state).trim(),
|
|
1229
|
+
let d2 = n.state === void 0 || n.state === null ? "" : String(n.state).trim(), R2 = d2 ? u(d2) : "", g3 = d2 ? Y(d2) : null, S = [], m2 = -1;
|
|
1230
1230
|
for (let c2 of f4) {
|
|
1231
|
-
let l = c2.row,
|
|
1232
|
-
if (d2 && l.a1 !== "") if (g3 && l.a1 === g3 || u(l.a1) ===
|
|
1231
|
+
let l = c2.row, A2 = 0;
|
|
1232
|
+
if (d2 && l.a1 !== "") if (g3 && l.a1 === g3 || u(l.a1) === R2) A2++;
|
|
1233
1233
|
else continue;
|
|
1234
|
-
if (i) if (T(l.cc) === i)
|
|
1234
|
+
if (i) if (T(l.cc) === i) A2++;
|
|
1235
1235
|
else continue;
|
|
1236
|
-
|
|
1236
|
+
A2 > m2 ? (m2 = A2, S = [c2]) : A2 === m2 && S.push(c2);
|
|
1237
1237
|
}
|
|
1238
1238
|
S.some((c2) => c2.primary) && (S = S.filter((c2) => c2.primary));
|
|
1239
1239
|
let p2 = /* @__PURE__ */ new Map();
|
|
@@ -1262,26 +1262,26 @@ function A3(n) {
|
|
|
1262
1262
|
var G = { latlon: 0, city: 1, zip3: 2, state: 3, country: 4 };
|
|
1263
1263
|
var x = 8;
|
|
1264
1264
|
function y3(n, e) {
|
|
1265
|
-
let t = new Array(n.length), o = new Array(n.length), i = new Array(n.length), r = /* @__PURE__ */ new Set(), a4 = [], s = /* @__PURE__ */ new Set(), f4 = [], d2 = /* @__PURE__ */ new Set(),
|
|
1265
|
+
let t = new Array(n.length), o = new Array(n.length), i = new Array(n.length), r = /* @__PURE__ */ new Set(), a4 = [], s = /* @__PURE__ */ new Set(), f4 = [], d2 = /* @__PURE__ */ new Set(), R2 = [], g3 = { latlon: 0, city: 0, zip3: 0, state: 0, country: 0 }, S = 0, m2 = 0, p2 = null;
|
|
1266
1266
|
for (let l = 0; l < n.length; ++l) {
|
|
1267
|
-
let
|
|
1267
|
+
let A2 = n[l], C2 = A3({ ...A2, mapKind: e });
|
|
1268
1268
|
if (S3(C2)) {
|
|
1269
1269
|
t[l] = null, o[l] = null, i[l] = null, m2++;
|
|
1270
|
-
let
|
|
1271
|
-
|
|
1270
|
+
let M4 = K(A2);
|
|
1271
|
+
M4 && !d2.has(M4.toLowerCase()) && (d2.add(M4.toLowerCase()), R2.length < x && R2.push(M4));
|
|
1272
1272
|
} else if (C2) {
|
|
1273
1273
|
if (t[l] = C2.lat, o[l] = C2.lon, i[l] = C2.precision, S++, g3[C2.precision]++, (p2 === null || G[C2.precision] > G[p2]) && (p2 = C2.precision), G[C2.precision] > G.city) {
|
|
1274
|
-
let
|
|
1275
|
-
|
|
1274
|
+
let M4 = K(A2);
|
|
1275
|
+
M4 && !s.has(M4.toLowerCase()) && (s.add(M4.toLowerCase()), f4.length < x && f4.push(M4));
|
|
1276
1276
|
}
|
|
1277
1277
|
} else {
|
|
1278
1278
|
t[l] = null, o[l] = null, i[l] = null;
|
|
1279
|
-
let
|
|
1280
|
-
|
|
1279
|
+
let M4 = K(A2);
|
|
1280
|
+
M4 && !r.has(M4.toLowerCase()) && (r.add(M4.toLowerCase()), a4.push(M4));
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
1283
|
let c2 = !n3() && n.some((l) => l.city !== null && l.city !== void 0 && String(l.city).trim() !== "");
|
|
1284
|
-
return { lat: t, lon: o, precisions: i, precision: p2, precisionCounts: g3, coarseExamples: f4, unmatched: a4, ambiguousRows: m2, ambiguousExamples:
|
|
1284
|
+
return { lat: t, lon: o, precisions: i, precision: p2, precisionCounts: g3, coarseExamples: f4, unmatched: a4, ambiguousRows: m2, ambiguousExamples: R2, matchedRows: S, totalRows: n.length, ...c2 ? { cityTableMissing: true } : {} };
|
|
1285
1285
|
}
|
|
1286
1286
|
function K(n) {
|
|
1287
1287
|
let e = [n.city, n.state, n.zip, n.country].filter((t) => t != null && String(t).trim() !== "").map((t) => String(t).trim()).join(", ");
|
|
@@ -1422,107 +1422,109 @@ function It(n, s) {
|
|
|
1422
1422
|
return s === "us-zip5" ? w.has(n.slice(0, 3)) : true;
|
|
1423
1423
|
}
|
|
1424
1424
|
function Wt(n, s) {
|
|
1425
|
-
let i = new Array(n.length), r = /* @__PURE__ */ new Set(),
|
|
1426
|
-
for (let
|
|
1427
|
-
let I2 = Mt(n[
|
|
1428
|
-
if (i[
|
|
1425
|
+
let i = new Array(n.length), r = /* @__PURE__ */ new Set(), M4 = [], h3 = 0;
|
|
1426
|
+
for (let N2 = 0; N2 < n.length; ++N2) {
|
|
1427
|
+
let I2 = Mt(n[N2], s), O2 = I2 !== null && It(I2, s) ? I2 : null;
|
|
1428
|
+
if (i[N2] = O2, O2 !== null) h3++;
|
|
1429
1429
|
else {
|
|
1430
|
-
let d2 = n[
|
|
1430
|
+
let d2 = n[N2];
|
|
1431
1431
|
if (d2 != null) {
|
|
1432
1432
|
let p2 = String(d2).trim();
|
|
1433
1433
|
if (p2.length > 0) {
|
|
1434
1434
|
let m2 = p2.toLowerCase();
|
|
1435
|
-
r.has(m2) || (r.add(m2),
|
|
1435
|
+
r.has(m2) || (r.add(m2), M4.push(p2));
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
return { iso: i, unmatched:
|
|
1440
|
+
return { iso: i, unmatched: M4, matchedRows: h3, totalRows: n.length };
|
|
1441
1441
|
}
|
|
1442
1442
|
|
|
1443
|
-
// ../shape-core/dist/chunk-
|
|
1443
|
+
// ../shape-core/dist/chunk-RS7LNZD7.mjs
|
|
1444
1444
|
var import_papaparse = __toESM(require_papaparse_min(), 1);
|
|
1445
1445
|
/*! @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. */
|
|
1446
|
-
var
|
|
1447
|
-
var
|
|
1446
|
+
var Se = { "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" };
|
|
1447
|
+
var Q2 = (() => {
|
|
1448
1448
|
let n = /* @__PURE__ */ new Map();
|
|
1449
|
-
for (let e of Object.keys(
|
|
1449
|
+
for (let e of Object.keys(Se)) for (let t of Se[e].split(/\s+/)) t && n.set(t, e);
|
|
1450
1450
|
return n;
|
|
1451
1451
|
})();
|
|
1452
|
-
function
|
|
1452
|
+
function $e(n) {
|
|
1453
1453
|
for (let [e, t] of n) {
|
|
1454
|
-
let i =
|
|
1455
|
-
i && !
|
|
1454
|
+
let i = Q2.get(e);
|
|
1455
|
+
i && !Q2.has(t) && Q2.set(t, i);
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
|
-
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1461
|
-
var
|
|
1462
|
-
var
|
|
1463
|
-
function
|
|
1458
|
+
$e(N);
|
|
1459
|
+
var Ke = ["rate", "ratio", "pct", "percent", "percentage", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "utilisation", "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", "ppm", "ppb", "dpmo", "bps", "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"];
|
|
1460
|
+
var Ze = ["pct", "percent", "percentage", "rate", "ratio", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "utilisation", "gpa", "percentile", "quantile", "bmi", "density", "pressure", "humidity", "velocity", "efficiency", "occupancy", "latency", "throughput", "bandwidth", "iops", "ppm", "ppb", "dpmo", "bps"];
|
|
1461
|
+
var je = ["latitude", "longitude"];
|
|
1462
|
+
var Xe = ["latitude", "longitude"];
|
|
1463
|
+
function K2(n) {
|
|
1464
1464
|
return Array.from(n).map((e) => {
|
|
1465
1465
|
let t = e.normalize("NFD").replace(/[̀-ͯ]/g, "");
|
|
1466
1466
|
return t.length === 1 ? t : e;
|
|
1467
1467
|
}).join("");
|
|
1468
1468
|
}
|
|
1469
|
-
var
|
|
1470
|
-
function
|
|
1469
|
+
var se = ["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"];
|
|
1470
|
+
function Qe(n) {
|
|
1471
1471
|
return [...n].sort((e, t) => t.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|");
|
|
1472
1472
|
}
|
|
1473
|
-
var
|
|
1474
|
-
var
|
|
1475
|
-
var
|
|
1476
|
-
var
|
|
1473
|
+
var Ne = new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:" + Qe(se) + ")\\s+)", "i");
|
|
1474
|
+
var qe = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g;
|
|
1475
|
+
var Je = new RegExp("\\b(" + Ke.join("|") + ")\\b|(" + Ze.join("|") + ")$", "i");
|
|
1476
|
+
var et = new RegExp("\\b(" + je.join("|") + ")\\b|(" + Xe.join("|") + ")$", "i");
|
|
1477
1477
|
function Te(n) {
|
|
1478
1478
|
if (!n) return "";
|
|
1479
|
-
let e = String(n), t =
|
|
1479
|
+
let e = String(n), t = Ne.exec(K2(e));
|
|
1480
1480
|
return (t ? e.slice(t[0].length) : e).trim();
|
|
1481
1481
|
}
|
|
1482
|
-
function
|
|
1483
|
-
return !!n &&
|
|
1482
|
+
function tt(n) {
|
|
1483
|
+
return !!n && Ne.test(K2(String(n)));
|
|
1484
1484
|
}
|
|
1485
|
-
var
|
|
1486
|
-
var Me = new RegExp("^\\s*(" + [...
|
|
1487
|
-
|
|
1485
|
+
var nt = ["count (distinct)", "count distinct", "distinct count", "standard deviation", "average", "variance", "median", "product", "stddev", "std dev", "count", "sum", "avg", "min", "minimum", "max", "maximum", "var"];
|
|
1486
|
+
var Me = new RegExp("^\\s*(" + [...nt].sort((n, e) => e.length - n.length).map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
|
|
1487
|
+
var xe = { Sum: ["Sum of "], Avg: ["Average of "], Average: ["Average of "], Count: ["Count of "], CountNonNull: ["Count of "], Min: ["Min of ", "First ", "Earliest "], Max: ["Max of ", "Last ", "Latest "], Median: ["Median of "], StandardDeviation: ["Standard deviation of "], Variance: ["Variance of "] };
|
|
1488
|
+
var it = new RegExp("^(" + Object.keys(xe).join("|") + ")\\((.+)\\)$");
|
|
1489
|
+
function st(n) {
|
|
1488
1490
|
let e = Te(n);
|
|
1489
|
-
return e.length === 0 ? "" : e.replace(
|
|
1491
|
+
return e.length === 0 ? "" : e.replace(qe, " ");
|
|
1490
1492
|
}
|
|
1491
|
-
function
|
|
1493
|
+
function Ie(n, e) {
|
|
1492
1494
|
if (!e) return false;
|
|
1493
1495
|
let t = Te(e);
|
|
1494
|
-
return n.test(
|
|
1496
|
+
return n.test(K2(st(e))) || n.test(K2(t)) || n.test(K2(T2(t).join(" ")));
|
|
1495
1497
|
}
|
|
1496
|
-
function
|
|
1497
|
-
return
|
|
1498
|
+
function Ee(n) {
|
|
1499
|
+
return Ie(et, n);
|
|
1498
1500
|
}
|
|
1499
|
-
function
|
|
1500
|
-
return
|
|
1501
|
+
function rt2(n) {
|
|
1502
|
+
return Ie(Je, n) || Ee(n);
|
|
1501
1503
|
}
|
|
1502
|
-
var
|
|
1503
|
-
function
|
|
1504
|
+
var De = /int|double|decimal|single|float|number|currency|money/i;
|
|
1505
|
+
function ot(n) {
|
|
1504
1506
|
let e = String(n?.valueNature ?? "").trim().toLowerCase();
|
|
1505
|
-
return e === "categorical" ? "Categorical" : e === "ordinal" ? "Ordinal" : e === "continuous" || n?.isMeasure === true ||
|
|
1507
|
+
return e === "categorical" ? "Categorical" : e === "ordinal" ? "Ordinal" : e === "continuous" || n?.isMeasure === true || De.test(String(n?.dataType ?? "")) ? "Continuous" : "Categorical";
|
|
1506
1508
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return n?.isMeasure === true ||
|
|
1509
|
+
function at2(n) {
|
|
1510
|
+
return n?.isMeasure === true || De.test(String(n?.dataType ?? ""));
|
|
1509
1511
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let e = n ?? {}, t =
|
|
1512
|
+
function Oe(n) {
|
|
1513
|
+
let e = n ?? {}, t = ot(e);
|
|
1512
1514
|
if (t !== "Continuous") return { nature: t, additivity: "unknown", basis: "role", suppressed: false };
|
|
1513
|
-
if (
|
|
1515
|
+
if (Ee(e.name)) return { nature: t, additivity: "positional", basis: "name", suppressed: true };
|
|
1514
1516
|
let i = String(e.additivity ?? "").trim().toLowerCase();
|
|
1515
|
-
if (!(i === "additive" &&
|
|
1517
|
+
if (!(i === "additive" && tt(e.name))) {
|
|
1516
1518
|
if (i === "additive") return { nature: t, additivity: "additive", basis: "measured", suppressed: false };
|
|
1517
1519
|
if (i === "part_of_whole") return { nature: t, additivity: "part_of_whole", basis: "measured", suppressed: false };
|
|
1518
1520
|
if (i === "intensive_rate") return { nature: t, additivity: "intensive_rate", basis: "measured", suppressed: false };
|
|
1519
1521
|
}
|
|
1520
|
-
return e.discourageAggregationAcrossGroups === true ? { nature: t, additivity: "intensive_rate", basis: "host-flag", suppressed: false } :
|
|
1522
|
+
return e.discourageAggregationAcrossGroups === true ? { nature: t, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : rt2(e.name) ? { nature: t, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: t, additivity: "additive", basis: "default", suppressed: false };
|
|
1521
1523
|
}
|
|
1522
|
-
function
|
|
1523
|
-
let e =
|
|
1524
|
+
function Le(n) {
|
|
1525
|
+
let e = Oe(n), t = n ?? {};
|
|
1524
1526
|
if (e.nature === "Categorical") return ["first", "distinctcount", "count"];
|
|
1525
|
-
if (e.nature === "Ordinal") return
|
|
1527
|
+
if (e.nature === "Ordinal") return at2(t) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
|
|
1526
1528
|
switch (e.additivity) {
|
|
1527
1529
|
case "positional":
|
|
1528
1530
|
return ["min", "max", "count", "distinctcount", "first"];
|
|
@@ -1532,161 +1534,161 @@ function Ee(n) {
|
|
|
1532
1534
|
return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
|
|
1533
1535
|
}
|
|
1534
1536
|
}
|
|
1535
|
-
function
|
|
1536
|
-
return
|
|
1537
|
+
function Xt(n) {
|
|
1538
|
+
return Le(n)[0];
|
|
1537
1539
|
}
|
|
1538
|
-
function
|
|
1540
|
+
function qt(n, e) {
|
|
1539
1541
|
if (e !== "sum" && e !== "count") return false;
|
|
1540
1542
|
if (e === "count") return true;
|
|
1541
|
-
let t =
|
|
1543
|
+
let t = Oe(n);
|
|
1542
1544
|
return t.additivity === "additive" || t.additivity === "part_of_whole" || t.additivity === "unknown";
|
|
1543
1545
|
}
|
|
1546
|
+
var ct2 = new RegExp([String.raw`\bisMeasure\b`, String.raw`\bdataType\b`, String.raw`\bcolumns\s*\[\s*-?\d`, String.raw`\.iloc\s*\[[^\]]*,`, String.raw`\.iat\s*\[`, String.raw`\bselect_dtypes\b`, String.raw`\b_get_numeric_data\b`, String.raw`\bis_numeric_dtype\b`, String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`, String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`, String.raw`\bdf\.dtypes\b`, String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`, String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));
|
|
1544
1547
|
|
|
1545
1548
|
// ../shape-core/dist/index.mjs
|
|
1546
1549
|
/*! @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. */
|
|
1547
|
-
var
|
|
1548
|
-
var
|
|
1549
|
-
function
|
|
1550
|
-
return !!E(
|
|
1551
|
-
}
|
|
1552
|
-
function
|
|
1553
|
-
let
|
|
1554
|
-
for (let
|
|
1555
|
-
if (
|
|
1556
|
-
let s = u(String(
|
|
1557
|
-
if (!V(s) && !
|
|
1558
|
-
}
|
|
1559
|
-
return Array.from(
|
|
1560
|
-
}
|
|
1561
|
-
function
|
|
1562
|
-
let
|
|
1563
|
-
if (
|
|
1564
|
-
let
|
|
1565
|
-
return
|
|
1566
|
-
}
|
|
1567
|
-
function W2(
|
|
1568
|
-
if (!Y(
|
|
1569
|
-
let
|
|
1570
|
-
return
|
|
1571
|
-
}
|
|
1572
|
-
function
|
|
1573
|
-
let
|
|
1574
|
-
if (
|
|
1575
|
-
let
|
|
1576
|
-
for (let s of
|
|
1577
|
-
return Math.round(
|
|
1550
|
+
var w2 = 2;
|
|
1551
|
+
var Z2 = 400;
|
|
1552
|
+
function z2(r) {
|
|
1553
|
+
return !!E(r);
|
|
1554
|
+
}
|
|
1555
|
+
function A(r) {
|
|
1556
|
+
let n = /* @__PURE__ */ new Set();
|
|
1557
|
+
for (let e of r) {
|
|
1558
|
+
if (e == null) continue;
|
|
1559
|
+
let s = u(String(e));
|
|
1560
|
+
if (!V(s) && !n.has(s) && (n.add(s), n.size >= Z2)) break;
|
|
1561
|
+
}
|
|
1562
|
+
return Array.from(n);
|
|
1563
|
+
}
|
|
1564
|
+
function C(r) {
|
|
1565
|
+
let n = A(r);
|
|
1566
|
+
if (n.length === 0 || G2(r) < 95) return false;
|
|
1567
|
+
let e = n.filter((c2) => z2(c2) && !Y(c2)).length, s = n.filter((c2) => !z2(c2) && !!Y(c2)).length;
|
|
1568
|
+
return e >= 1 && e >= s;
|
|
1569
|
+
}
|
|
1570
|
+
function W2(r, n) {
|
|
1571
|
+
if (!Y(r)) return false;
|
|
1572
|
+
let e = E(r);
|
|
1573
|
+
return e ? n === "world" ? true : s3.has(e) : false;
|
|
1574
|
+
}
|
|
1575
|
+
function G2(r) {
|
|
1576
|
+
let n = A(r);
|
|
1577
|
+
if (n.length === 0) return 0;
|
|
1578
|
+
let e = 0;
|
|
1579
|
+
for (let s of n) z2(s) && e++;
|
|
1580
|
+
return Math.round(e / n.length * 1e3) / 10;
|
|
1578
1581
|
}
|
|
1579
|
-
function
|
|
1580
|
-
let
|
|
1581
|
-
if (
|
|
1582
|
-
let
|
|
1583
|
-
for (let s of
|
|
1584
|
-
return Math.round(
|
|
1582
|
+
function M2(r) {
|
|
1583
|
+
let n = A(r);
|
|
1584
|
+
if (n.length === 0) return 0;
|
|
1585
|
+
let e = 0;
|
|
1586
|
+
for (let s of n) Y(s) && e++;
|
|
1587
|
+
return Math.round(e / n.length * 1e3) / 10;
|
|
1585
1588
|
}
|
|
1586
|
-
function F3(
|
|
1587
|
-
let
|
|
1588
|
-
for (let
|
|
1589
|
-
if (
|
|
1590
|
-
let s = String(
|
|
1591
|
-
if (!V(u(s)) && !
|
|
1589
|
+
function F3(r) {
|
|
1590
|
+
let n = /* @__PURE__ */ new Set();
|
|
1591
|
+
for (let e of r) {
|
|
1592
|
+
if (e == null) continue;
|
|
1593
|
+
let s = String(e).trim();
|
|
1594
|
+
if (!V(u(s)) && !n.has(s) && (n.add(s), n.size >= Z2)) break;
|
|
1592
1595
|
}
|
|
1593
|
-
return Array.from(
|
|
1596
|
+
return Array.from(n);
|
|
1594
1597
|
}
|
|
1595
|
-
function
|
|
1596
|
-
let
|
|
1597
|
-
if (
|
|
1598
|
-
let
|
|
1599
|
-
for (let s of
|
|
1600
|
-
return Math.round(
|
|
1598
|
+
function $2(r) {
|
|
1599
|
+
let n = F3(r);
|
|
1600
|
+
if (n.length === 0) return 0;
|
|
1601
|
+
let e = 0;
|
|
1602
|
+
for (let s of n) Z(s).length > 0 && e++;
|
|
1603
|
+
return Math.round(e / n.length * 1e3) / 10;
|
|
1601
1604
|
}
|
|
1602
|
-
function q3(
|
|
1603
|
-
return y2(
|
|
1605
|
+
function q3(r, n) {
|
|
1606
|
+
return y2(n, rt) ? true : F3(r).some((e) => /^\d{5}(-\d{4})?$/.test(e.replace(/\.0+$/, "")));
|
|
1604
1607
|
}
|
|
1605
|
-
function de(
|
|
1606
|
-
let
|
|
1607
|
-
if (
|
|
1608
|
+
function de(r, n) {
|
|
1609
|
+
let e = A(r);
|
|
1610
|
+
if (e.length === 0) return 0;
|
|
1608
1611
|
let s = 0;
|
|
1609
|
-
for (let
|
|
1610
|
-
return Math.round(s /
|
|
1612
|
+
for (let c2 of e) p3(c2, n) && s++;
|
|
1613
|
+
return Math.round(s / e.length * 1e3) / 10;
|
|
1611
1614
|
}
|
|
1612
|
-
function
|
|
1613
|
-
let
|
|
1614
|
-
for (let s of
|
|
1615
|
-
return
|
|
1615
|
+
function D3(r, n) {
|
|
1616
|
+
let e = 0;
|
|
1617
|
+
for (let s of A(r)) n(s) && e++;
|
|
1618
|
+
return e;
|
|
1616
1619
|
}
|
|
1617
|
-
function
|
|
1618
|
-
let
|
|
1619
|
-
for (let s of F3(
|
|
1620
|
-
return
|
|
1620
|
+
function ge(r, n) {
|
|
1621
|
+
let e = 0;
|
|
1622
|
+
for (let s of F3(r)) n(s) && e++;
|
|
1623
|
+
return e;
|
|
1621
1624
|
}
|
|
1622
|
-
function
|
|
1623
|
-
let
|
|
1625
|
+
function ye(r, n, e, s, c2) {
|
|
1626
|
+
let P2 = [], u2 = [], o = {}, _2 = {}, v2 = new Set(r), l = (t) => n.map((i) => i[t]);
|
|
1624
1627
|
for (let t of ["city", "country"]) {
|
|
1625
|
-
let i =
|
|
1626
|
-
i &&
|
|
1628
|
+
let i = e?.[t];
|
|
1629
|
+
i && v2.has(i) && (o[t] = i);
|
|
1627
1630
|
}
|
|
1628
|
-
let
|
|
1631
|
+
let X2 = new Set(c2 ?? r);
|
|
1629
1632
|
for (let t of ["lat", "lon"]) {
|
|
1630
|
-
let i =
|
|
1631
|
-
i &&
|
|
1633
|
+
let i = e?.[t];
|
|
1634
|
+
i && X2.has(i) && (o[t] = i);
|
|
1632
1635
|
}
|
|
1633
|
-
let
|
|
1634
|
-
if (
|
|
1635
|
-
let t = l(
|
|
1636
|
-
i < 95 ?
|
|
1636
|
+
let d2 = e?.zip;
|
|
1637
|
+
if (d2 && v2.has(d2)) {
|
|
1638
|
+
let t = l(d2), i = $2(t);
|
|
1639
|
+
i < 95 ? u2.push(`zip=${d2} (only ${i}% of values read as ZIPs)`) : q3(t, d2) ? o.zip = d2 : u2.push(`zip=${d2} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1637
1640
|
}
|
|
1638
|
-
let
|
|
1639
|
-
if (
|
|
1640
|
-
let t = l(
|
|
1641
|
-
i.length > 0 && i.every((a4) => W2(a4, s)) ?
|
|
1641
|
+
let m2 = e?.state;
|
|
1642
|
+
if (m2 && v2.has(m2)) {
|
|
1643
|
+
let t = l(m2), i = A(t);
|
|
1644
|
+
i.length > 0 && i.every((a4) => W2(a4, s)) ? u2.push(`state=${m2} (every value is "CA", which is both Canada and California)`) : C(t) ? (u2.push(`state=${m2} (every value is a country, not a state)`), o.country || (o.country = m2)) : M2(t) < 95 ? u2.push(`state=${m2} (only ${M2(t)}% of values are states/provinces)`) : o.state = m2;
|
|
1642
1645
|
}
|
|
1643
|
-
let
|
|
1644
|
-
if (!
|
|
1646
|
+
let g3 = new Set(Object.values(o).filter(Boolean)), T3 = r.filter((t) => !g3.has(t) && !t.startsWith("__"));
|
|
1647
|
+
if (!o.state) {
|
|
1645
1648
|
let t = null;
|
|
1646
|
-
for (let i of
|
|
1649
|
+
for (let i of T3) {
|
|
1647
1650
|
let a4 = l(i);
|
|
1648
|
-
if (
|
|
1649
|
-
let f4 =
|
|
1651
|
+
if (C(a4)) continue;
|
|
1652
|
+
let f4 = M2(a4);
|
|
1650
1653
|
if (f4 < 95) continue;
|
|
1651
|
-
let
|
|
1652
|
-
|
|
1654
|
+
let k2 = D3(a4, (x3) => !!Y(x3)), Y2 = D3(a4, (x3) => !!Y(x3) && !W2(x3, s));
|
|
1655
|
+
k2 < w2 && Y2 < 1 || (!t || f4 > t.pct) && (t = { name: i, pct: f4 });
|
|
1653
1656
|
}
|
|
1654
|
-
t && (
|
|
1657
|
+
t && (o.state = t.name, g3.add(t.name), P2.push(`state=${t.name} (${t.pct}% states/provinces)`));
|
|
1655
1658
|
}
|
|
1656
|
-
if (!
|
|
1657
|
-
if (
|
|
1658
|
-
let i = l(t), a4 =
|
|
1659
|
-
if (!(a4 < 95) && q3(i, t) && !(
|
|
1660
|
-
|
|
1659
|
+
if (!o.zip) for (let t of T3) {
|
|
1660
|
+
if (g3.has(t)) continue;
|
|
1661
|
+
let i = l(t), a4 = $2(i);
|
|
1662
|
+
if (!(a4 < 95) && q3(i, t) && !(ge(i, (f4) => Z(f4).length > 0) < w2)) {
|
|
1663
|
+
o.zip = t, g3.add(t), P2.push(`zip=${t} (${a4}% ZIP codes)`);
|
|
1661
1664
|
break;
|
|
1662
1665
|
}
|
|
1663
1666
|
}
|
|
1664
|
-
let h3 =
|
|
1665
|
-
if (!h3 || !
|
|
1667
|
+
let h3 = o.country;
|
|
1668
|
+
if (!h3 || !C(l(h3))) {
|
|
1666
1669
|
let t = null;
|
|
1667
|
-
for (let i of
|
|
1668
|
-
if (
|
|
1669
|
-
let a4 =
|
|
1670
|
+
for (let i of T3) {
|
|
1671
|
+
if (g3.has(i) || !C(l(i))) continue;
|
|
1672
|
+
let a4 = G2(l(i));
|
|
1670
1673
|
(!t || a4 > t.pct) && (t = { name: i, pct: a4 });
|
|
1671
1674
|
}
|
|
1672
|
-
t && (h3 && (
|
|
1675
|
+
t && (h3 && (u2.push(`country=${h3} (only ${G2(l(h3))}% of values are country identifiers; using ${t.name} instead)`), _2.country = h3), o.country = t.name, g3.add(t.name), P2.push(`country=${t.name}`));
|
|
1673
1676
|
}
|
|
1674
|
-
if (!
|
|
1677
|
+
if (!o.city) {
|
|
1675
1678
|
let t = null;
|
|
1676
|
-
for (let i of
|
|
1677
|
-
if (
|
|
1679
|
+
for (let i of T3) {
|
|
1680
|
+
if (g3.has(i)) continue;
|
|
1678
1681
|
let a4 = l(i), f4 = de(a4, s);
|
|
1679
|
-
f4 < m3 ||
|
|
1682
|
+
f4 < m3 || D3(a4, (k2) => p3(k2, s)) < w2 || (!t || f4 > t.pct) && (t = { name: i, pct: f4 });
|
|
1680
1683
|
}
|
|
1681
|
-
t && (
|
|
1684
|
+
t && (o.city = t.name, P2.push(`city=${t.name} (${t.pct}% known cities)`));
|
|
1682
1685
|
}
|
|
1683
|
-
let
|
|
1684
|
-
let i = +String(t[
|
|
1685
|
-
return isFinite(i) && isFinite(a4) && i >= -90 && i <= 90 && a4 >= -180 && a4 <= 180 && String(t[
|
|
1686
|
+
let B2 = o.country ? l(o.country) : [], L2 = !!o.country && C(B2), j2 = L2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K3 = L2 && j2 >= 2, N2 = !!(o.lat && o.lon) && n.some((t) => {
|
|
1687
|
+
let i = +String(t[o.lat] ?? "").trim(), a4 = +String(t[o.lon] ?? "").trim();
|
|
1688
|
+
return isFinite(i) && isFinite(a4) && i >= -90 && i <= 90 && a4 >= -180 && a4 <= 180 && String(t[o.lat] ?? "").trim() !== "" && String(t[o.lon] ?? "").trim() !== "";
|
|
1686
1689
|
});
|
|
1687
|
-
return
|
|
1690
|
+
return o.lat && o.lon && !N2 && u2.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !K3 && !(o.city || o.state || o.zip || N2) && u2.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 || K3 || N2) ? o : null, backfilled: P2, refused: u2, ...Object.keys(_2).length ? { labelFallback: _2 } : {} };
|
|
1688
1691
|
}
|
|
1689
|
-
var he = new RegExp([String.raw`\bisMeasure\b`, String.raw`\bdataType\b`, String.raw`\bcolumns\s*\[\s*-?\d`, String.raw`\.iloc\s*\[[^\]]*,`, String.raw`\.iat\s*\[`, String.raw`\bselect_dtypes\b`, String.raw`\b_get_numeric_data\b`, String.raw`\bis_numeric_dtype\b`, String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`, String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`, String.raw`\bdf\.dtypes\b`, String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`, String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));
|
|
1690
1692
|
|
|
1691
1693
|
// src/payload.ts
|
|
1692
1694
|
function resolvePointChannel(cols, rowObjs, point) {
|
|
@@ -1700,7 +1702,7 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1700
1702
|
let labelCol;
|
|
1701
1703
|
if (bind) {
|
|
1702
1704
|
const dims = cols.filter((c2) => !c2.isMeasure).map((c2) => c2.name);
|
|
1703
|
-
const res =
|
|
1705
|
+
const res = ye(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.name));
|
|
1704
1706
|
bind = res.bind;
|
|
1705
1707
|
rolesBackfilled = res.backfilled;
|
|
1706
1708
|
rolesRefused = res.refused;
|
|
@@ -1768,7 +1770,21 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
|
|
|
1768
1770
|
geoUnmatched = { count: built.totalRows - built.matchedRows, examples: built.unmatched.slice(0, 8) };
|
|
1769
1771
|
geoUnmatchedDistinct = built.unmatched.length;
|
|
1770
1772
|
}
|
|
1771
|
-
const
|
|
1773
|
+
const hostNames = ["__rowIdx__"];
|
|
1774
|
+
if (geoIso) hostNames.push("__geoIso__");
|
|
1775
|
+
if (pLat) hostNames.push("__geoLat__", "__geoLon__", "__geoPrecision__");
|
|
1776
|
+
if (dLat) hostNames.push("__geoLatD__", "__geoLonD__", "__geoPrecisionD__");
|
|
1777
|
+
const aliasCols = [];
|
|
1778
|
+
if (opts?.aliases && opts.aliases.length > 0) {
|
|
1779
|
+
const claimed = /* @__PURE__ */ new Set([...colNames, ...hostNames]);
|
|
1780
|
+
for (const a4 of opts.aliases) {
|
|
1781
|
+
const from = a4 ? colNames.indexOf(a4.name) : -1;
|
|
1782
|
+
if (from < 0 || !a4.alias || claimed.has(a4.alias)) continue;
|
|
1783
|
+
claimed.add(a4.alias);
|
|
1784
|
+
aliasCols.push({ from, name: a4.alias });
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
const extra = hostNames.length + aliasCols.length;
|
|
1772
1788
|
const out = new Array(rowObjs.length);
|
|
1773
1789
|
for (let r = 0; r < rowObjs.length; r++) {
|
|
1774
1790
|
const row = rowObjs[r];
|
|
@@ -1794,6 +1810,7 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
|
|
|
1794
1810
|
a4[k2++] = dLon[r];
|
|
1795
1811
|
a4[k2++] = dPrec ? dPrec[r] : null;
|
|
1796
1812
|
}
|
|
1813
|
+
for (const ac of aliasCols) a4[k2++] = a4[ac.from];
|
|
1797
1814
|
out[r] = a4;
|
|
1798
1815
|
}
|
|
1799
1816
|
const colsOut = [...cols, { name: "__rowIdx__", dataType: "Integer", isMeasure: false, modelDesc: "" }];
|
|
@@ -1811,6 +1828,7 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
|
|
|
1811
1828
|
{ name: "__geoLonD__", dataType: "Double", isMeasure: false, modelDesc: "" },
|
|
1812
1829
|
{ name: "__geoPrecisionD__", dataType: "String", isMeasure: false, modelDesc: "" }
|
|
1813
1830
|
);
|
|
1831
|
+
for (const ac of aliasCols) colsOut.push({ ...cols[ac.from], name: ac.name, aliasOf: cols[ac.from].name });
|
|
1814
1832
|
return {
|
|
1815
1833
|
columns: colsOut,
|
|
1816
1834
|
rows: out,
|
|
@@ -1857,9 +1875,9 @@ function createMarkResolver(env) {
|
|
|
1857
1875
|
const m2 = el.getScreenCTM();
|
|
1858
1876
|
if (!m2) return Number.MAX_VALUE;
|
|
1859
1877
|
let best = Number.MAX_VALUE;
|
|
1860
|
-
const
|
|
1861
|
-
for (let i = 0; i <=
|
|
1862
|
-
const pt = el.getPointAtLength(L2 * i /
|
|
1878
|
+
const N2 = 64;
|
|
1879
|
+
for (let i = 0; i <= N2; i++) {
|
|
1880
|
+
const pt = el.getPointAtLength(L2 * i / N2);
|
|
1863
1881
|
const dx = m2.a * pt.x + m2.c * pt.y + m2.e - x3;
|
|
1864
1882
|
const dy = m2.b * pt.x + m2.d * pt.y + m2.f - y5;
|
|
1865
1883
|
const d2 = dx * dx + dy * dy;
|
|
@@ -1958,8 +1976,8 @@ function createMarkResolver(env) {
|
|
|
1958
1976
|
for (const n of all) {
|
|
1959
1977
|
const tag = (n.tagName || "").toLowerCase();
|
|
1960
1978
|
if (!SHAPE.test(tag)) continue;
|
|
1961
|
-
const
|
|
1962
|
-
if (
|
|
1979
|
+
const pe = viewStyle(n);
|
|
1980
|
+
if (pe && pe !== "none") return true;
|
|
1963
1981
|
}
|
|
1964
1982
|
return false;
|
|
1965
1983
|
};
|
|
@@ -2266,8 +2284,8 @@ function censusValuePlacement(container, data) {
|
|
|
2266
2284
|
const fit = 1 - ssRes / ssTot;
|
|
2267
2285
|
if (fit >= VALUE_AXIS_MIN_FIT && (!best || fit > best.fit)) {
|
|
2268
2286
|
const full = new Array(dots.length).fill(NaN);
|
|
2269
|
-
keep.forEach((k2,
|
|
2270
|
-
full[k2] = res[
|
|
2287
|
+
keep.forEach((k2, j2) => {
|
|
2288
|
+
full[k2] = res[j2];
|
|
2271
2289
|
});
|
|
2272
2290
|
best = { col: c2, axis, fit, res: full, log };
|
|
2273
2291
|
}
|
|
@@ -2497,14 +2515,14 @@ var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
|
2497
2515
|
var AXIS_PIN_MAX_CARRIED = 12;
|
|
2498
2516
|
function unpinScrolledAxis(container) {
|
|
2499
2517
|
if (!container) return;
|
|
2500
|
-
const
|
|
2501
|
-
if (!
|
|
2518
|
+
const st2 = container[CONTAINER_SLOT_AXIS_PIN];
|
|
2519
|
+
if (!st2) return;
|
|
2502
2520
|
try {
|
|
2503
|
-
container.removeEventListener("scroll",
|
|
2521
|
+
container.removeEventListener("scroll", st2.onScroll);
|
|
2504
2522
|
} catch {
|
|
2505
2523
|
}
|
|
2506
2524
|
try {
|
|
2507
|
-
if (
|
|
2525
|
+
if (st2.overlay.parentNode) st2.overlay.parentNode.removeChild(st2.overlay);
|
|
2508
2526
|
} catch {
|
|
2509
2527
|
}
|
|
2510
2528
|
try {
|
|
@@ -2682,15 +2700,15 @@ function pinScrolledAxis(container, svg) {
|
|
|
2682
2700
|
const svgTop = svgBox.top - cRect.top - container.clientTop + container.scrollTop;
|
|
2683
2701
|
const contentBand = { top: svgTop + band.top, bottom: svgTop + band.bottom };
|
|
2684
2702
|
const place = () => {
|
|
2685
|
-
const
|
|
2686
|
-
const edge2 = axisPinPlacement(contentBand,
|
|
2703
|
+
const st2 = container.scrollTop, vh = container.clientHeight;
|
|
2704
|
+
const edge2 = axisPinPlacement(contentBand, st2, vh);
|
|
2687
2705
|
if (!edge2) {
|
|
2688
2706
|
o.display = "none";
|
|
2689
2707
|
return null;
|
|
2690
2708
|
}
|
|
2691
2709
|
o.display = "block";
|
|
2692
2710
|
o.left = `${svgLeft}px`;
|
|
2693
|
-
o.top = `${edge2 === "top" ?
|
|
2711
|
+
o.top = `${edge2 === "top" ? st2 : st2 + vh - bandPx}px`;
|
|
2694
2712
|
return edge2;
|
|
2695
2713
|
};
|
|
2696
2714
|
const onScroll = () => {
|
|
@@ -2906,10 +2924,10 @@ function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
|
|
|
2906
2924
|
if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
|
|
2907
2925
|
const k2 = Math.floor(n);
|
|
2908
2926
|
for (let i = 0; i < k2; i++) {
|
|
2909
|
-
for (let
|
|
2927
|
+
for (let j2 = 0; j2 < k2; j2++) {
|
|
2910
2928
|
out.push({
|
|
2911
2929
|
x: box.left + box.width * (i + 0.5) / k2,
|
|
2912
|
-
y: box.top + box.height * (
|
|
2930
|
+
y: box.top + box.height * (j2 + 0.5) / k2
|
|
2913
2931
|
});
|
|
2914
2932
|
}
|
|
2915
2933
|
}
|
|
@@ -3251,9 +3269,9 @@ function createChartHost(container, config) {
|
|
|
3251
3269
|
const ensureAffordanceStyles = () => {
|
|
3252
3270
|
try {
|
|
3253
3271
|
if (!doc || doc.getElementById("bic-chart-host-affordances")) return;
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3256
|
-
|
|
3272
|
+
const st2 = doc.createElement("style");
|
|
3273
|
+
st2.id = "bic-chart-host-affordances";
|
|
3274
|
+
st2.textContent = `
|
|
3257
3275
|
/* TYPOGRAPHY FIREWALL. Generated charts set font-size but almost never line-height or
|
|
3258
3276
|
letter-spacing, so they INHERIT whatever the host page cascades in. A page with
|
|
3259
3277
|
\`:root { font: 18px/145% }\` (the stock Vite template does exactly this) hands every
|
|
@@ -3302,7 +3320,7 @@ function createChartHost(container, config) {
|
|
|
3302
3320
|
font-weight: 700 !important;
|
|
3303
3321
|
text-decoration: underline !important;
|
|
3304
3322
|
}`;
|
|
3305
|
-
(doc.head || doc.documentElement)?.appendChild(
|
|
3323
|
+
(doc.head || doc.documentElement)?.appendChild(st2);
|
|
3306
3324
|
} catch {
|
|
3307
3325
|
}
|
|
3308
3326
|
};
|
|
@@ -3612,10 +3630,10 @@ export {
|
|
|
3612
3630
|
L3,
|
|
3613
3631
|
M,
|
|
3614
3632
|
a2 as a,
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3633
|
+
Oe,
|
|
3634
|
+
Le,
|
|
3635
|
+
Xt,
|
|
3636
|
+
qt,
|
|
3619
3637
|
buildRenderPayload,
|
|
3620
3638
|
createMarkResolver,
|
|
3621
3639
|
ensureCrossfilterHitTargets,
|
package/dist/index.mjs
CHANGED
|
@@ -30,20 +30,19 @@ import {
|
|
|
30
30
|
DARK_TEXT,
|
|
31
31
|
DIM_OPACITY_DEFAULT,
|
|
32
32
|
DIM_OPACITY_VAR,
|
|
33
|
-
Ee,
|
|
34
33
|
FIT_CONTENT_SELECTOR,
|
|
35
34
|
FLIP_MODE_DEFAULT,
|
|
36
35
|
GEO_POINT_PRECISIONS,
|
|
37
36
|
GLYPH_SAMPLE_N,
|
|
38
37
|
HOST_CONTAINER_CLASS,
|
|
39
38
|
HOST_CONTRACT_VERSION,
|
|
40
|
-
Ie,
|
|
41
39
|
L3,
|
|
42
40
|
LABEL_CONTRAST_CAP,
|
|
43
41
|
LABEL_CONTRAST_DONE_ATTR,
|
|
44
42
|
LEGEND_MARK_CLASS,
|
|
45
43
|
LIFT_SELECTED_CLASS,
|
|
46
44
|
LIGHT_TEXT,
|
|
45
|
+
Le,
|
|
47
46
|
M,
|
|
48
47
|
MARK_CLASS,
|
|
49
48
|
MARK_SELECTED_CLASS,
|
|
@@ -52,6 +51,7 @@ import {
|
|
|
52
51
|
MIN_CONTRAST,
|
|
53
52
|
MIN_HIT_BAND_PX,
|
|
54
53
|
MIN_RAMP_FILLS,
|
|
54
|
+
Oe,
|
|
55
55
|
PAGE_MATCH_TOLERANCE,
|
|
56
56
|
PHANTOM_FRACTION,
|
|
57
57
|
PILL_MIN_ALPHA,
|
|
@@ -64,10 +64,9 @@ import {
|
|
|
64
64
|
SELECTION_ACTIVE_CLASS,
|
|
65
65
|
VALUE_AXIS_BASELINE_DEFAULT,
|
|
66
66
|
VALUE_AXIS_MIN_FIT,
|
|
67
|
-
Vt,
|
|
68
67
|
WHITE_TEXT_BG_LUM,
|
|
69
68
|
XFILTER_REFRESH_EVENT,
|
|
70
|
-
|
|
69
|
+
Xt,
|
|
71
70
|
a,
|
|
72
71
|
applyLabelContrast,
|
|
73
72
|
autoRampCanvas,
|
|
@@ -117,6 +116,7 @@ import {
|
|
|
117
116
|
pinScrolledAxis,
|
|
118
117
|
planAxisPin,
|
|
119
118
|
planFrameGrow,
|
|
119
|
+
qt,
|
|
120
120
|
registerGeo,
|
|
121
121
|
registerGeoAsset,
|
|
122
122
|
relativeLuminance,
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
toRGBA,
|
|
131
131
|
unpinScrolledAxis,
|
|
132
132
|
valuePlacementFlag
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-X3HRLEDK.mjs";
|
|
134
134
|
import "./chunk-A2GMXZP7.mjs";
|
|
135
135
|
import "./chunk-GHODWOAL.mjs";
|
|
136
136
|
|
|
@@ -1418,15 +1418,15 @@ function displayText(col, raw, opts) {
|
|
|
1418
1418
|
return String(raw);
|
|
1419
1419
|
}
|
|
1420
1420
|
function isSuppressed(col) {
|
|
1421
|
-
return
|
|
1421
|
+
return Oe(col).suppressed;
|
|
1422
1422
|
}
|
|
1423
1423
|
function resolveAgg(col, requested, auto) {
|
|
1424
1424
|
const fallback = () => {
|
|
1425
|
-
const d2 =
|
|
1425
|
+
const d2 = Xt(col);
|
|
1426
1426
|
return d2 === "first" ? "count" : d2;
|
|
1427
1427
|
};
|
|
1428
1428
|
if (auto) return fallback();
|
|
1429
|
-
return
|
|
1429
|
+
return Le(col).indexOf(requested) >= 0 ? requested : fallback();
|
|
1430
1430
|
}
|
|
1431
1431
|
function toNumber(v2) {
|
|
1432
1432
|
if (v2 == null || v2 === "") return null;
|
|
@@ -1529,7 +1529,7 @@ function computeSelectionCard(payload, selectedRowIdxs, opts = {}) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
const value = reduce(selVals, colAgg, selRaw);
|
|
1531
1531
|
let sharePct = null;
|
|
1532
|
-
if (
|
|
1532
|
+
if (qt(col, colAgg) && value != null) {
|
|
1533
1533
|
const allVals = [];
|
|
1534
1534
|
const allRaw = [];
|
|
1535
1535
|
for (let r2 = 0; r2 < rows.length; r2++) {
|
package/dist/react.mjs
CHANGED
package/dist/types/payload.d.ts
CHANGED
|
@@ -78,4 +78,8 @@ export declare function buildRenderPayload(cols: Array<{
|
|
|
78
78
|
kind: string;
|
|
79
79
|
} | null, point?: GeoPointBinding | null, destination?: GeoPointBinding | null, opts?: {
|
|
80
80
|
utcDays?: boolean;
|
|
81
|
+
aliases?: ReadonlyArray<{
|
|
82
|
+
name: string;
|
|
83
|
+
alias: string;
|
|
84
|
+
}> | null;
|
|
81
85
|
} | null): RenderPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.112",
|
|
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",
|