@bicharts/chart-host 0.5.109 → 0.5.110
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-MZNTO42Q.mjs → chunk-UC5KJGR7.mjs} +236 -235
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ var require_papaparse_min = __commonJS({
|
|
|
23
23
|
})(exports, function r() {
|
|
24
24
|
var n = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n ? n : {};
|
|
25
25
|
var d2, s = !n.document && !!n.postMessage, a4 = n.IS_PAPA_WORKER || false, o = {}, h3 = 0, v2 = {};
|
|
26
|
-
function
|
|
26
|
+
function P2(e) {
|
|
27
27
|
return 65279 === e.charCodeAt(0) ? e.slice(1) : e;
|
|
28
28
|
}
|
|
29
29
|
function u2(e) {
|
|
@@ -142,11 +142,11 @@ var require_papaparse_min = __commonJS({
|
|
|
142
142
|
return "greedy" === m4.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
|
|
143
143
|
}
|
|
144
144
|
function g4() {
|
|
145
|
-
if (p4 && a5 && (
|
|
145
|
+
if (p4 && a5 && (k3("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v2.DefaultDelimiter + "'"), a5 = false), m4.skipEmptyLines && (p4.data = p4.data.filter(function(e4) {
|
|
146
146
|
return !y6(e4);
|
|
147
147
|
})), _3()) {
|
|
148
148
|
let t4 = function(e4, t5) {
|
|
149
|
-
e4 =
|
|
149
|
+
e4 = P2(e4), q4(m4.transformHeader) && (e4 = m4.transformHeader(e4, t5)), c4.push(e4);
|
|
150
150
|
};
|
|
151
151
|
var t2 = t4;
|
|
152
152
|
if (p4) if (Array.isArray(p4.data[0])) {
|
|
@@ -164,7 +164,7 @@ var require_papaparse_min = __commonJS({
|
|
|
164
164
|
})(t5) ? parseFloat(t5) : d3.test(t5) ? new Date(t5) : "" === t5 ? null : t5) : t5)(n4 = m4.header ? r5 >= c4.length ? "__parsed_extra" : c4[r5] : n4, s4 = m4.transform ? m4.transform(s4, n4) : s4);
|
|
165
165
|
"__parsed_extra" === n4 ? (i5[n4] = i5[n4] || [], i5[n4].push(s4)) : i5[n4] = s4;
|
|
166
166
|
}
|
|
167
|
-
return m4.header && (r5 > c4.length ?
|
|
167
|
+
return m4.header && (r5 > c4.length ? k3("FieldMismatch", "TooManyFields", "Too many fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4) : r5 < c4.length && k3("FieldMismatch", "TooFewFields", "Too few fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4)), i5;
|
|
168
168
|
}
|
|
169
169
|
var r4;
|
|
170
170
|
p4 && (m4.header || m4.dynamicTyping || m4.transform) && (r4 = 1, !p4.data.length || Array.isArray(p4.data[0]) ? (p4.data = p4.data.map(i4), r4 = p4.data.length) : p4.data = i4(p4.data, 0), m4.header && p4.meta && (p4.meta.fields = c4), f5 += r4);
|
|
@@ -172,7 +172,7 @@ var require_papaparse_min = __commonJS({
|
|
|
172
172
|
function _3() {
|
|
173
173
|
return m4.header && 0 === c4.length;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function k3(e2, t2, i4, r4) {
|
|
176
176
|
e2 = { type: e2, code: t2, message: i4 };
|
|
177
177
|
void 0 !== r4 && (e2.row = r4), p4.errors.push(e2);
|
|
178
178
|
}
|
|
@@ -210,59 +210,59 @@ var require_papaparse_min = __commonJS({
|
|
|
210
210
|
function U2(e) {
|
|
211
211
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
212
212
|
}
|
|
213
|
-
function E2(
|
|
214
|
-
var S = (
|
|
215
|
-
if (void 0 !==
|
|
216
|
-
true === x3 ? x3 = "#" : ("string" != typeof x3 || -1 < v2.BAD_DELIMITERS.indexOf(x3)) && (x3 = false), "\n" !==
|
|
217
|
-
var z3 = 0,
|
|
213
|
+
function E2(C2) {
|
|
214
|
+
var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x3 = C2.comments, I2 = C2.step, A = 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
|
+
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, M2 = false;
|
|
218
218
|
this.parse = function(i2, t, r2) {
|
|
219
219
|
if ("string" != typeof i2) throw new Error("Input must be a string");
|
|
220
|
-
var n2 = i2.length, e = S.length, s2 =
|
|
221
|
-
if (!i2) return
|
|
220
|
+
var n2 = i2.length, e = S.length, s2 = O2.length, a5 = x3.length, o2 = q4(I2), h4 = [], u4 = [], d3 = [], f5 = z3 = 0;
|
|
221
|
+
if (!i2) return w3();
|
|
222
222
|
if (T3 || false !== T3 && -1 === i2.indexOf(F4)) {
|
|
223
|
-
for (var l2 = i2.split(
|
|
224
|
-
if (d3 = l2[c4], z3 += d3.length, c4 !== l2.length - 1) z3 +=
|
|
225
|
-
else if (r2) return
|
|
223
|
+
for (var l2 = i2.split(O2), c4 = 0; c4 < l2.length; c4++) {
|
|
224
|
+
if (d3 = l2[c4], z3 += d3.length, c4 !== l2.length - 1) z3 += O2.length;
|
|
225
|
+
else if (r2) return w3();
|
|
226
226
|
if (!x3 || d3.substring(0, a5) !== x3) {
|
|
227
227
|
if (o2) {
|
|
228
|
-
if (h4 = [],
|
|
229
|
-
} else
|
|
230
|
-
if (
|
|
228
|
+
if (h4 = [], k3(d3.split(S)), R3(), M2) return w3();
|
|
229
|
+
} else k3(d3.split(S));
|
|
230
|
+
if (A && A <= c4) return h4 = h4.slice(0, A), w3(true);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
return
|
|
233
|
+
return w3();
|
|
234
234
|
}
|
|
235
|
-
for (var p4 = i2.indexOf(S, z3), g4 = i2.indexOf(
|
|
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
238
|
if (F4 === j2 && i2[m4 + 1] === j2) m4++;
|
|
239
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
|
-
var y6 = v3(-1 === (g4 = -1 !== g4 && g4 < m4 + 1 ? i2.indexOf(
|
|
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) {
|
|
243
|
-
d3.push(i2.substring(z3, m4).replace(_3, F4)), i2[z3 = m4 + 1 + y6 + e] !== F4 && (m4 = i2.indexOf(F4, z3)), p4 = i2.indexOf(S, z3), g4 = i2.indexOf(
|
|
243
|
+
d3.push(i2.substring(z3, m4).replace(_3, F4)), i2[z3 = m4 + 1 + y6 + e] !== F4 && (m4 = i2.indexOf(F4, z3)), p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O2, z3);
|
|
244
244
|
break;
|
|
245
245
|
}
|
|
246
246
|
y6 = v3(g4);
|
|
247
|
-
if (i2.substring(m4 + 1 + y6, m4 + 1 + y6 + s2) ===
|
|
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 (
|
|
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 && (R3(), M2)) return w3();
|
|
249
|
+
if (A && h4.length >= A) 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++;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
else if (x3 && 0 === d3.length && i2.substring(z3, z3 + a5) === x3) {
|
|
256
|
-
if (-1 === g4) return
|
|
257
|
-
z3 = g4 + s2, g4 = i2.indexOf(
|
|
256
|
+
if (-1 === g4) return w3();
|
|
257
|
+
z3 = g4 + s2, g4 = i2.indexOf(O2, z3), p4 = i2.indexOf(S, z3);
|
|
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 && (R3(), M2)) return w3();
|
|
262
|
+
if (A && h4.length >= A) return w3(true);
|
|
263
263
|
}
|
|
264
264
|
return E4();
|
|
265
|
-
function
|
|
265
|
+
function k3(e2) {
|
|
266
266
|
h4.push(e2), f5 = z3;
|
|
267
267
|
}
|
|
268
268
|
function v3(e2) {
|
|
@@ -270,18 +270,18 @@ 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,
|
|
273
|
+
return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2, k3(d3), o2 && R3()), w3();
|
|
274
274
|
}
|
|
275
275
|
function b5(e2) {
|
|
276
|
-
z3 = e2,
|
|
276
|
+
z3 = e2, k3(d3), d3 = [], g4 = i2.indexOf(O2, z3);
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
if (
|
|
278
|
+
function w3(e2) {
|
|
279
|
+
if (C2.header && !t && h4.length && !L2) {
|
|
280
280
|
var s4 = h4[0], a6 = /* @__PURE__ */ Object.create(null), o4 = new Set(s4);
|
|
281
281
|
let n4 = false;
|
|
282
282
|
for (let r4 = 0; r4 < s4.length; r4++) {
|
|
283
|
-
let i4 =
|
|
284
|
-
if (a6[i4 = q4(
|
|
283
|
+
let i4 = P2(s4[r4]);
|
|
284
|
+
if (a6[i4 = q4(C2.transformHeader) ? C2.transformHeader(i4, r4) : i4]) {
|
|
285
285
|
let e4, t2 = a6[i4];
|
|
286
286
|
for (; e4 = i4 + "_" + t2, t2++, o4.has(e4); ) ;
|
|
287
287
|
o4.add(e4), s4[r4] = e4, a6[i4]++, n4 = true, (D4 = null === D4 ? {} : D4)[e4] = i4;
|
|
@@ -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:
|
|
293
|
+
return { data: h4, errors: u4, meta: { delimiter: S, linebreak: O2, aborted: M2, truncated: !!e2, cursor: f5 + (t || 0), renamedHeaders: D4 } };
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
I2(
|
|
295
|
+
function R3() {
|
|
296
|
+
I2(w3()), h4 = [], u4 = [];
|
|
297
297
|
}
|
|
298
298
|
}, this.abort = function() {
|
|
299
|
-
|
|
299
|
+
M2 = true;
|
|
300
300
|
}, this.getCharIndex = function() {
|
|
301
301
|
return z3;
|
|
302
302
|
};
|
|
@@ -339,7 +339,7 @@ var require_papaparse_min = __commonJS({
|
|
|
339
339
|
return v2.parse = function(e, t) {
|
|
340
340
|
var i2 = (t = t || {}).dynamicTyping || false;
|
|
341
341
|
q4(i2) && (t.dynamicTypingFunction = i2, i2 = {});
|
|
342
|
-
if (t.dynamicTyping = i2, t.transform = !!q4(t.transform) && t.transform, !t.worker || !v2.WORKERS_SUPPORTED) return i2 = null, v2.NODE_STREAM_INPUT, "string" == typeof e ? (e =
|
|
342
|
+
if (t.dynamicTyping = i2, t.transform = !!q4(t.transform) && t.transform, !t.worker || !v2.WORKERS_SUPPORTED) return i2 = null, v2.NODE_STREAM_INPUT, "string" == typeof e ? (e = P2(e), i2 = new (t.download ? f4 : c2)(t)) : true === e.readable && q4(e.read) && q4(e.on) ? i2 = new p2(t) : (n.File && e instanceof File || e instanceof Object) && (i2 = new l(t)), i2.stream(e);
|
|
343
343
|
(i2 = (() => {
|
|
344
344
|
var e2;
|
|
345
345
|
return !!v2.WORKERS_SUPPORTED && (e2 = (() => {
|
|
@@ -368,7 +368,7 @@ var require_papaparse_min = __commonJS({
|
|
|
368
368
|
function n2(e2, t2, i4) {
|
|
369
369
|
var r4 = "", n4 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s4 = !Array.isArray(t2[0]);
|
|
370
370
|
if (n4 && _3) {
|
|
371
|
-
for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m4), r4 +=
|
|
371
|
+
for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m4), r4 += k3(e2[a6], a6);
|
|
372
372
|
0 < t2.length && (r4 += y6);
|
|
373
373
|
}
|
|
374
374
|
for (var o4 = 0; o4 < t2.length; o4++) {
|
|
@@ -384,14 +384,14 @@ var require_papaparse_min = __commonJS({
|
|
|
384
384
|
for (var p4 = 0; p4 < h5; p4++) {
|
|
385
385
|
0 < p4 && !d3 && (r4 += m4);
|
|
386
386
|
var g4 = n4 && s4 ? e2[p4] : p4;
|
|
387
|
-
r4 +=
|
|
387
|
+
r4 += k3(t2[o4][g4], p4);
|
|
388
388
|
}
|
|
389
389
|
o4 < t2.length - 1 && (!i4 || 0 < h5 && !d3) && (r4 += y6);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
return r4;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function k3(e2, t2) {
|
|
395
395
|
var i4, r4, n4;
|
|
396
396
|
return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (n4 = false, h4 && "string" == typeof e2 && h4.test(e2) && (e2 = "'" + e2, n4 = true), r4 = (i4 = e2.toString()).replace(u4, o2), (n4 = n4 || true === s2 || "function" == typeof s2 && s2(e2, t2) || Array.isArray(s2) && s2[t2] || ((e4, t4) => {
|
|
397
397
|
for (var i5 = 0; i5 < t4.length; i5++) if (-1 < e4.indexOf(t4[i5])) return true;
|
|
@@ -499,10 +499,10 @@ 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 Z3 = 0.0193339 *
|
|
502
|
+
const R3 = linearise(r), G3 = linearise(g3), B2 = linearise(b4);
|
|
503
|
+
const X2 = 0.4124564 * R3 + 0.3575761 * G3 + 0.1804375 * B2;
|
|
504
|
+
const Y2 = 0.2126729 * R3 + 0.7151522 * G3 + 0.072175 * B2;
|
|
505
|
+
const Z3 = 0.0193339 * R3 + 0.119192 * G3 + 0.9503041 * B2;
|
|
506
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
|
}
|
|
@@ -657,10 +657,10 @@ function censusColourSpread(container, doc) {
|
|
|
657
657
|
for (const { rgb } of counted) {
|
|
658
658
|
marks++;
|
|
659
659
|
distinct.add(rgb.join(","));
|
|
660
|
-
const
|
|
661
|
-
const cur = cells.get(
|
|
660
|
+
const k3 = cellKey(rgb);
|
|
661
|
+
const cur = cells.get(k3);
|
|
662
662
|
if (cur) cur.n++;
|
|
663
|
-
else cells.set(
|
|
663
|
+
else cells.set(k3, { rgb, n: 1 });
|
|
664
664
|
}
|
|
665
665
|
if (marks < MIN_MARKS || distinct.size < MIN_RAMP_FILLS) return EMPTY;
|
|
666
666
|
const top = [...cells.values()].sort((a4, b4) => b4.n - a4.n).slice(0, MAX_CELLS);
|
|
@@ -739,8 +739,8 @@ function autoRampMinStep(low, high, canvas, classes = AUTO_RAMP_CLASSES, opacity
|
|
|
739
739
|
const bg = normHex(canvas);
|
|
740
740
|
if (!lo || !hi || !bg || classes < 2) return NaN;
|
|
741
741
|
let prev = null, min = Infinity;
|
|
742
|
-
for (let
|
|
743
|
-
const painted = paintedOver(labToHex(mixLab(lo, hi,
|
|
742
|
+
for (let k3 = 0; k3 < classes; k3++) {
|
|
743
|
+
const painted = paintedOver(labToHex(mixLab(lo, hi, k3 / (classes - 1))), bg, opacity);
|
|
744
744
|
if (prev) min = Math.min(min, deltaE2000(prev, painted));
|
|
745
745
|
prev = painted;
|
|
746
746
|
}
|
|
@@ -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 A = hexToLab(accent);
|
|
768
768
|
let t = 0.1;
|
|
769
|
-
let low = mixLab(bg,
|
|
769
|
+
let low = mixLab(bg, A, 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, A, t);
|
|
773
773
|
}
|
|
774
774
|
const lowHex = labToHex(low);
|
|
775
|
-
let high = { ...
|
|
775
|
+
let high = { ...A };
|
|
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)));
|
|
@@ -941,12 +941,12 @@ var byAsset = /* @__PURE__ */ new Map();
|
|
|
941
941
|
var _na;
|
|
942
942
|
function geoAssetFor(geoKind) {
|
|
943
943
|
if (!geoKind) return null;
|
|
944
|
-
const
|
|
945
|
-
if (/^country/.test(
|
|
946
|
-
if (
|
|
947
|
-
if (
|
|
948
|
-
if (
|
|
949
|
-
if (
|
|
944
|
+
const k3 = geoKind.toLowerCase();
|
|
945
|
+
if (/^country/.test(k3)) return "world";
|
|
946
|
+
if (k3 === "north-america") return "world";
|
|
947
|
+
if (k3 === "world") return "world";
|
|
948
|
+
if (k3 === "us-state-code" || k3 === "us-state-name") return "us-states";
|
|
949
|
+
if (k3 === "us-zip5") return "us-zip3";
|
|
950
950
|
return null;
|
|
951
951
|
}
|
|
952
952
|
var _worldBase;
|
|
@@ -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(), R3 = 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, A = 0;
|
|
1232
|
+
if (d2 && l.a1 !== "") if (g3 && l.a1 === g3 || u(l.a1) === R3) A++;
|
|
1233
1233
|
else continue;
|
|
1234
|
-
if (i) if (T(l.cc) === i)
|
|
1234
|
+
if (i) if (T(l.cc) === i) A++;
|
|
1235
1235
|
else continue;
|
|
1236
|
-
|
|
1236
|
+
A > m2 ? (m2 = A, S = [c2]) : A === 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(), R3 = [], 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
|
|
1268
|
-
if (S3(
|
|
1267
|
+
let A = n[l], C2 = A3({ ...A, mapKind: e });
|
|
1268
|
+
if (S3(C2)) {
|
|
1269
1269
|
t[l] = null, o[l] = null, i[l] = null, m2++;
|
|
1270
|
-
let
|
|
1271
|
-
|
|
1272
|
-
} else if (
|
|
1273
|
-
if (t[l] =
|
|
1274
|
-
let
|
|
1275
|
-
|
|
1270
|
+
let M2 = K(A);
|
|
1271
|
+
M2 && !d2.has(M2.toLowerCase()) && (d2.add(M2.toLowerCase()), R3.length < x && R3.push(M2));
|
|
1272
|
+
} else if (C2) {
|
|
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 M2 = K(A);
|
|
1275
|
+
M2 && !s.has(M2.toLowerCase()) && (s.add(M2.toLowerCase()), f4.length < x && f4.push(M2));
|
|
1276
1276
|
}
|
|
1277
1277
|
} else {
|
|
1278
1278
|
t[l] = null, o[l] = null, i[l] = null;
|
|
1279
|
-
let
|
|
1280
|
-
|
|
1279
|
+
let M2 = K(A);
|
|
1280
|
+
M2 && !r.has(M2.toLowerCase()) && (r.add(M2.toLowerCase()), a4.push(M2));
|
|
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: R3, 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,22 +1422,22 @@ 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(),
|
|
1425
|
+
let i = new Array(n.length), r = /* @__PURE__ */ new Set(), M2 = [], h3 = 0;
|
|
1426
1426
|
for (let N2 = 0; N2 < n.length; ++N2) {
|
|
1427
|
-
let I2 = Mt(n[N2], s),
|
|
1428
|
-
if (i[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
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), M2.push(p2));
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
return { iso: i, unmatched:
|
|
1440
|
+
return { iso: i, unmatched: M2, matchedRows: h3, totalRows: n.length };
|
|
1441
1441
|
}
|
|
1442
1442
|
|
|
1443
1443
|
// ../shape-core/dist/chunk-SV3JH46V.mjs
|
|
@@ -1544,148 +1544,149 @@ function Yt(n, e) {
|
|
|
1544
1544
|
|
|
1545
1545
|
// ../shape-core/dist/index.mjs
|
|
1546
1546
|
/*! @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
|
|
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(
|
|
1547
|
+
var k2 = 2;
|
|
1548
|
+
var q3 = 400;
|
|
1549
|
+
function D3(o) {
|
|
1550
|
+
return !!E(o);
|
|
1551
|
+
}
|
|
1552
|
+
function C(o) {
|
|
1553
|
+
let e = /* @__PURE__ */ new Set();
|
|
1554
|
+
for (let n of o) {
|
|
1555
|
+
if (n == null) continue;
|
|
1556
|
+
let s = u(String(n));
|
|
1557
|
+
if (!V(s) && !e.has(s) && (e.add(s), e.size >= q3)) break;
|
|
1558
|
+
}
|
|
1559
|
+
return Array.from(e);
|
|
1560
|
+
}
|
|
1561
|
+
function R2(o) {
|
|
1562
|
+
let e = C(o);
|
|
1563
|
+
if (e.length === 0 || $3(o) < 95) return false;
|
|
1564
|
+
let n = e.filter((u2) => D3(u2) && !Y(u2)).length, s = e.filter((u2) => !D3(u2) && !!Y(u2)).length;
|
|
1565
|
+
return n >= 1 && n >= s;
|
|
1566
|
+
}
|
|
1567
|
+
function Z2(o, e) {
|
|
1568
|
+
if (!Y(o)) return false;
|
|
1569
|
+
let n = E(o);
|
|
1570
|
+
return n ? e === "world" ? true : s3.has(n) : false;
|
|
1571
|
+
}
|
|
1572
|
+
function $3(o) {
|
|
1573
|
+
let e = C(o);
|
|
1574
|
+
if (e.length === 0) return 0;
|
|
1575
|
+
let n = 0;
|
|
1576
|
+
for (let s of e) D3(s) && n++;
|
|
1577
|
+
return Math.round(n / e.length * 1e3) / 10;
|
|
1578
1578
|
}
|
|
1579
|
-
function
|
|
1580
|
-
let
|
|
1581
|
-
if (
|
|
1582
|
-
let
|
|
1583
|
-
for (let s of
|
|
1584
|
-
return Math.round(
|
|
1579
|
+
function w2(o) {
|
|
1580
|
+
let e = C(o);
|
|
1581
|
+
if (e.length === 0) return 0;
|
|
1582
|
+
let n = 0;
|
|
1583
|
+
for (let s of e) Y(s) && n++;
|
|
1584
|
+
return Math.round(n / e.length * 1e3) / 10;
|
|
1585
1585
|
}
|
|
1586
|
-
function F3(
|
|
1587
|
-
let
|
|
1588
|
-
for (let
|
|
1589
|
-
if (
|
|
1590
|
-
let s = String(
|
|
1591
|
-
if (!V(u(s)) && !
|
|
1586
|
+
function F3(o) {
|
|
1587
|
+
let e = /* @__PURE__ */ new Set();
|
|
1588
|
+
for (let n of o) {
|
|
1589
|
+
if (n == null) continue;
|
|
1590
|
+
let s = String(n).trim();
|
|
1591
|
+
if (!V(u(s)) && !e.has(s) && (e.add(s), e.size >= q3)) break;
|
|
1592
1592
|
}
|
|
1593
|
-
return Array.from(
|
|
1593
|
+
return Array.from(e);
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1596
|
-
let
|
|
1597
|
-
if (
|
|
1598
|
-
let
|
|
1599
|
-
for (let s of
|
|
1600
|
-
return Math.round(
|
|
1595
|
+
function G2(o) {
|
|
1596
|
+
let e = F3(o);
|
|
1597
|
+
if (e.length === 0) return 0;
|
|
1598
|
+
let n = 0;
|
|
1599
|
+
for (let s of e) Z(s).length > 0 && n++;
|
|
1600
|
+
return Math.round(n / e.length * 1e3) / 10;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return y2(
|
|
1602
|
+
function W2(o, e) {
|
|
1603
|
+
return y2(e, rt) ? true : F3(o).some((n) => /^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/, "")));
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1606
|
-
let
|
|
1607
|
-
if (
|
|
1605
|
+
function de(o, e) {
|
|
1606
|
+
let n = C(o);
|
|
1607
|
+
if (n.length === 0) return 0;
|
|
1608
1608
|
let s = 0;
|
|
1609
|
-
for (let
|
|
1610
|
-
return Math.round(s /
|
|
1609
|
+
for (let u2 of n) p3(u2, e) && s++;
|
|
1610
|
+
return Math.round(s / n.length * 1e3) / 10;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1613
|
-
let
|
|
1614
|
-
for (let s of
|
|
1615
|
-
return
|
|
1612
|
+
function z2(o, e) {
|
|
1613
|
+
let n = 0;
|
|
1614
|
+
for (let s of C(o)) e(s) && n++;
|
|
1615
|
+
return n;
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1618
|
-
let
|
|
1619
|
-
for (let s of F3(
|
|
1620
|
-
return
|
|
1617
|
+
function ge(o, e) {
|
|
1618
|
+
let n = 0;
|
|
1619
|
+
for (let s of F3(o)) e(s) && n++;
|
|
1620
|
+
return n;
|
|
1621
1621
|
}
|
|
1622
|
-
function pe(
|
|
1623
|
-
let
|
|
1622
|
+
function pe(o, e, n, s, u2) {
|
|
1623
|
+
let b4 = [], c2 = [], r = {}, I2 = {}, M2 = new Set(o), l = (t) => e.map((i) => i[t]);
|
|
1624
1624
|
for (let t of ["city", "country"]) {
|
|
1625
|
-
let i =
|
|
1626
|
-
i &&
|
|
1625
|
+
let i = n?.[t];
|
|
1626
|
+
i && M2.has(i) && (r[t] = i);
|
|
1627
1627
|
}
|
|
1628
|
-
let
|
|
1628
|
+
let Y2 = new Set(u2 ?? o);
|
|
1629
1629
|
for (let t of ["lat", "lon"]) {
|
|
1630
|
-
let i =
|
|
1631
|
-
i &&
|
|
1630
|
+
let i = n?.[t];
|
|
1631
|
+
i && Y2.has(i) && (r[t] = i);
|
|
1632
1632
|
}
|
|
1633
|
-
let
|
|
1634
|
-
if (
|
|
1635
|
-
let t = l(
|
|
1636
|
-
i < 95 ?
|
|
1633
|
+
let p2 = n?.zip;
|
|
1634
|
+
if (p2 && M2.has(p2)) {
|
|
1635
|
+
let t = l(p2), i = G2(t);
|
|
1636
|
+
i < 95 ? c2.push(`zip=${p2} (only ${i}% of values read as ZIPs)`) : W2(t, p2) ? r.zip = p2 : c2.push(`zip=${p2} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1637
1637
|
}
|
|
1638
|
-
let
|
|
1639
|
-
if (
|
|
1640
|
-
let t = l(
|
|
1641
|
-
i.length > 0 && i.every((a4) =>
|
|
1638
|
+
let d2 = n?.state;
|
|
1639
|
+
if (d2 && M2.has(d2)) {
|
|
1640
|
+
let t = l(d2), i = C(t);
|
|
1641
|
+
i.length > 0 && i.every((a4) => Z2(a4, s)) ? c2.push(`state=${d2} (every value is "CA", which is both Canada and California)`) : R2(t) ? (c2.push(`state=${d2} (every value is a country, not a state)`), r.country || (r.country = d2)) : w2(t) < 95 ? c2.push(`state=${d2} (only ${w2(t)}% of values are states/provinces)`) : r.state = d2;
|
|
1642
1642
|
}
|
|
1643
|
-
let
|
|
1644
|
-
if (!
|
|
1643
|
+
let m2 = new Set(Object.values(r).filter(Boolean)), S = o.filter((t) => !m2.has(t) && !t.startsWith("__"));
|
|
1644
|
+
if (!r.state) {
|
|
1645
1645
|
let t = null;
|
|
1646
|
-
for (let i of
|
|
1646
|
+
for (let i of S) {
|
|
1647
1647
|
let a4 = l(i);
|
|
1648
|
-
if (
|
|
1649
|
-
let f4 =
|
|
1648
|
+
if (R2(a4)) continue;
|
|
1649
|
+
let f4 = w2(a4);
|
|
1650
1650
|
if (f4 < 95) continue;
|
|
1651
|
-
let
|
|
1652
|
-
|
|
1651
|
+
let O2 = z2(a4, (A) => !!Y(A)), Q2 = z2(a4, (A) => !!Y(A) && !Z2(A, s));
|
|
1652
|
+
O2 < k2 && Q2 < 1 || (!t || f4 > t.pct) && (t = { name: i, pct: f4 });
|
|
1653
1653
|
}
|
|
1654
|
-
t && (
|
|
1654
|
+
t && (r.state = t.name, m2.add(t.name), b4.push(`state=${t.name} (${t.pct}% states/provinces)`));
|
|
1655
1655
|
}
|
|
1656
|
-
if (!
|
|
1657
|
-
if (
|
|
1658
|
-
let i = l(t), a4 =
|
|
1659
|
-
if (!(a4 < 95) &&
|
|
1660
|
-
|
|
1656
|
+
if (!r.zip) for (let t of S) {
|
|
1657
|
+
if (m2.has(t)) continue;
|
|
1658
|
+
let i = l(t), a4 = G2(i);
|
|
1659
|
+
if (!(a4 < 95) && W2(i, t) && !(ge(i, (f4) => Z(f4).length > 0) < k2)) {
|
|
1660
|
+
r.zip = t, m2.add(t), b4.push(`zip=${t} (${a4}% ZIP codes)`);
|
|
1661
1661
|
break;
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
|
-
let h3 =
|
|
1665
|
-
if (!h3 || !
|
|
1664
|
+
let h3 = r.country;
|
|
1665
|
+
if (!h3 || !R2(l(h3))) {
|
|
1666
1666
|
let t = null;
|
|
1667
|
-
for (let i of
|
|
1668
|
-
if (
|
|
1669
|
-
let a4 =
|
|
1667
|
+
for (let i of S) {
|
|
1668
|
+
if (m2.has(i) || !R2(l(i))) continue;
|
|
1669
|
+
let a4 = $3(l(i));
|
|
1670
1670
|
(!t || a4 > t.pct) && (t = { name: i, pct: a4 });
|
|
1671
1671
|
}
|
|
1672
|
-
t && (h3 && (
|
|
1672
|
+
t && (h3 && (c2.push(`country=${h3} (only ${$3(l(h3))}% of values are country identifiers; using ${t.name} instead)`), I2.country = h3), r.country = t.name, m2.add(t.name), b4.push(`country=${t.name}`));
|
|
1673
1673
|
}
|
|
1674
|
-
if (!
|
|
1674
|
+
if (!r.city) {
|
|
1675
1675
|
let t = null;
|
|
1676
|
-
for (let i of
|
|
1677
|
-
if (
|
|
1678
|
-
let a4 = l(i), f4 =
|
|
1679
|
-
f4 < m3 ||
|
|
1676
|
+
for (let i of S) {
|
|
1677
|
+
if (m2.has(i)) continue;
|
|
1678
|
+
let a4 = l(i), f4 = de(a4, s);
|
|
1679
|
+
f4 < m3 || z2(a4, (O2) => p3(O2, s)) < k2 || (!t || f4 > t.pct) && (t = { name: i, pct: f4 });
|
|
1680
1680
|
}
|
|
1681
|
-
t && (
|
|
1681
|
+
t && (r.city = t.name, b4.push(`city=${t.name} (${t.pct}% known cities)`));
|
|
1682
1682
|
}
|
|
1683
|
-
let B2 =
|
|
1684
|
-
let i = +String(t[
|
|
1685
|
-
return isFinite(i) && isFinite(a4) && i >= -90 && i <= 90 && a4 >= -180 && a4 <= 180 && String(t[
|
|
1683
|
+
let B2 = r.country ? l(r.country) : [], E2 = !!r.country && R2(B2), J2 = E2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K2 = E2 && J2 >= 2, v2 = !!(r.lat && r.lon) && e.some((t) => {
|
|
1684
|
+
let i = +String(t[r.lat] ?? "").trim(), a4 = +String(t[r.lon] ?? "").trim();
|
|
1685
|
+
return isFinite(i) && isFinite(a4) && i >= -90 && i <= 90 && a4 >= -180 && a4 <= 180 && String(t[r.lat] ?? "").trim() !== "" && String(t[r.lon] ?? "").trim() !== "";
|
|
1686
1686
|
});
|
|
1687
|
-
return
|
|
1687
|
+
return r.lat && r.lon && !v2 && c2.push(`lat/lon=${r.lat}/${r.lon} (no row holds a usable coordinate pair)`), r.country && !K2 && !(r.city || r.state || r.zip || v2) && c2.push(E2 ? `country=${r.country} (every row resolves to the same country - nothing to place apart)` : `country=${r.country} (values are not country identifiers)`), { bind: !!(r.city || r.state || r.zip || K2 || v2) ? r : null, backfilled: b4, refused: c2, ...Object.keys(I2).length ? { labelFallback: I2 } : {} };
|
|
1688
1688
|
}
|
|
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("|"));
|
|
1689
1690
|
|
|
1690
1691
|
// src/payload.ts
|
|
1691
1692
|
function resolvePointChannel(cols, rowObjs, point) {
|
|
@@ -1780,18 +1781,18 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
|
|
|
1780
1781
|
a4[c2] = v2 ?? null;
|
|
1781
1782
|
}
|
|
1782
1783
|
}
|
|
1783
|
-
let
|
|
1784
|
-
a4[
|
|
1785
|
-
if (geoIso) a4[
|
|
1784
|
+
let k3 = cols.length;
|
|
1785
|
+
a4[k3++] = r;
|
|
1786
|
+
if (geoIso) a4[k3++] = geoIso[r];
|
|
1786
1787
|
if (pLat && pLon) {
|
|
1787
|
-
a4[
|
|
1788
|
-
a4[
|
|
1789
|
-
a4[
|
|
1788
|
+
a4[k3++] = pLat[r];
|
|
1789
|
+
a4[k3++] = pLon[r];
|
|
1790
|
+
a4[k3++] = pPrec ? pPrec[r] : null;
|
|
1790
1791
|
}
|
|
1791
1792
|
if (dLat && dLon) {
|
|
1792
|
-
a4[
|
|
1793
|
-
a4[
|
|
1794
|
-
a4[
|
|
1793
|
+
a4[k3++] = dLat[r];
|
|
1794
|
+
a4[k3++] = dLon[r];
|
|
1795
|
+
a4[k3++] = dPrec ? dPrec[r] : null;
|
|
1795
1796
|
}
|
|
1796
1797
|
out[r] = a4;
|
|
1797
1798
|
}
|
|
@@ -2140,13 +2141,13 @@ function censusHitBands(container, doc) {
|
|
|
2140
2141
|
if (!OPEN_TAGS.has(tag)) continue;
|
|
2141
2142
|
const cs = styleOf2(el, ownerDoc);
|
|
2142
2143
|
const open = isUnfilled(attrOrComputed(el, "fill", cs));
|
|
2143
|
-
const
|
|
2144
|
+
const w3 = widthPx(attrOrComputed(el, "stroke-width", cs) || "1");
|
|
2144
2145
|
const geom = String(el.getAttribute?.("d") ?? "") || `${tag}#${String(el.getAttribute?.(ROW_IDX_ATTR) ?? "")}`;
|
|
2145
2146
|
const inert = String(cs?.pointerEvents ?? el.style?.pointerEvents ?? "") === "none";
|
|
2146
|
-
rows.push({ el, geom, w:
|
|
2147
|
-
if (isFinite(
|
|
2147
|
+
rows.push({ el, geom, w: w3, open, inert });
|
|
2148
|
+
if (isFinite(w3)) {
|
|
2148
2149
|
const prev = widestByGeom.get(geom);
|
|
2149
|
-
if (prev === void 0 ||
|
|
2150
|
+
if (prev === void 0 || w3 > prev) widestByGeom.set(geom, w3);
|
|
2150
2151
|
}
|
|
2151
2152
|
}
|
|
2152
2153
|
const out = { ...EMPTY3 };
|
|
@@ -2243,10 +2244,10 @@ function censusValuePlacement(container, data) {
|
|
|
2243
2244
|
for (const axis of ["x", "y"]) {
|
|
2244
2245
|
const keep = [];
|
|
2245
2246
|
const v2 = [], pos = [];
|
|
2246
|
-
dots.forEach((d2,
|
|
2247
|
-
if (!Number.isFinite(vals[
|
|
2248
|
-
keep.push(
|
|
2249
|
-
v2.push(log ? Math.log10(vals[
|
|
2247
|
+
dots.forEach((d2, k3) => {
|
|
2248
|
+
if (!Number.isFinite(vals[k3])) return;
|
|
2249
|
+
keep.push(k3);
|
|
2250
|
+
v2.push(log ? Math.log10(vals[k3]) : vals[k3]);
|
|
2250
2251
|
pos.push(axis === "x" ? d2.x : d2.y);
|
|
2251
2252
|
});
|
|
2252
2253
|
const line = robustLine(v2, pos);
|
|
@@ -2255,8 +2256,8 @@ function censusValuePlacement(container, data) {
|
|
|
2255
2256
|
if (hi - lo < MIN_AXIS_SPAN_PX) continue;
|
|
2256
2257
|
const mean = pos.reduce((s, p2) => s + p2, 0) / pos.length;
|
|
2257
2258
|
let ssRes = 0, ssTot = 0;
|
|
2258
|
-
const res = pos.map((p2,
|
|
2259
|
-
const e = p2 - (line.a + line.b * v2[
|
|
2259
|
+
const res = pos.map((p2, k3) => {
|
|
2260
|
+
const e = p2 - (line.a + line.b * v2[k3]);
|
|
2260
2261
|
ssRes += e * e;
|
|
2261
2262
|
ssTot += (p2 - mean) ** 2;
|
|
2262
2263
|
return e;
|
|
@@ -2265,8 +2266,8 @@ function censusValuePlacement(container, data) {
|
|
|
2265
2266
|
const fit = 1 - ssRes / ssTot;
|
|
2266
2267
|
if (fit >= VALUE_AXIS_MIN_FIT && (!best || fit > best.fit)) {
|
|
2267
2268
|
const full = new Array(dots.length).fill(NaN);
|
|
2268
|
-
keep.forEach((
|
|
2269
|
-
full[
|
|
2269
|
+
keep.forEach((k3, j2) => {
|
|
2270
|
+
full[k3] = res[j2];
|
|
2270
2271
|
});
|
|
2271
2272
|
best = { col: c2, axis, fit, res: full, log };
|
|
2272
2273
|
}
|
|
@@ -2276,8 +2277,8 @@ function censusValuePlacement(container, data) {
|
|
|
2276
2277
|
if (!best) return EMPTY4;
|
|
2277
2278
|
let off = 0, measured = 0;
|
|
2278
2279
|
const radii = [];
|
|
2279
|
-
dots.forEach((d2,
|
|
2280
|
-
const e = best.res[
|
|
2280
|
+
dots.forEach((d2, k3) => {
|
|
2281
|
+
const e = best.res[k3];
|
|
2281
2282
|
if (!Number.isFinite(e)) return;
|
|
2282
2283
|
measured++;
|
|
2283
2284
|
const inRadii = Math.abs(e) / Math.max(d2.r, 1);
|
|
@@ -2317,12 +2318,12 @@ function contentExtentOf(boxes) {
|
|
|
2317
2318
|
if (usable.length === 0) return { w: 0, h: 0, source: "none" };
|
|
2318
2319
|
const inFlow = usable.filter((b4) => !b4.floating);
|
|
2319
2320
|
const counted = inFlow.length > 0 ? inFlow : usable;
|
|
2320
|
-
let
|
|
2321
|
+
let w3 = 0, h3 = 0;
|
|
2321
2322
|
for (const b4 of counted) {
|
|
2322
|
-
if (b4.right >
|
|
2323
|
+
if (b4.right > w3) w3 = b4.right;
|
|
2323
2324
|
if (b4.bottom > h3) h3 = b4.bottom;
|
|
2324
2325
|
}
|
|
2325
|
-
return { w:
|
|
2326
|
+
return { w: w3, h: h3, source: inFlow.length > 0 ? "in-flow" : "all-floating" };
|
|
2326
2327
|
}
|
|
2327
2328
|
function scrollFitFor(contentW, contentH, viewportW, viewportH, slackPx = SCROLL_SLACK_PX) {
|
|
2328
2329
|
return {
|
|
@@ -2332,8 +2333,8 @@ function scrollFitFor(contentW, contentH, viewportW, viewportH, slackPx = SCROLL
|
|
|
2332
2333
|
}
|
|
2333
2334
|
var FIT_CONTENT_SELECTOR = "text, .d3-mark, .d3-legend-mark";
|
|
2334
2335
|
var PHANTOM_FRACTION = 0.95;
|
|
2335
|
-
function isPhantomBox(
|
|
2336
|
-
return
|
|
2336
|
+
function isPhantomBox(w3, h3, refW, refH) {
|
|
2337
|
+
return w3 > refW * PHANTOM_FRACTION || h3 > refH * PHANTOM_FRACTION;
|
|
2337
2338
|
}
|
|
2338
2339
|
var MAX_FRAME_GROW_FACTOR = 20;
|
|
2339
2340
|
function planFrameGrow(inkBottomPx, elHeightPx, viewBoxH, ctmScale, slackPx = SCROLL_SLACK_PX, maxFactor = MAX_FRAME_GROW_FACTOR) {
|
|
@@ -2852,8 +2853,8 @@ var NAMED = {
|
|
|
2852
2853
|
};
|
|
2853
2854
|
function toRGBA(c2) {
|
|
2854
2855
|
if (typeof c2 !== "string") return null;
|
|
2855
|
-
const
|
|
2856
|
-
if (
|
|
2856
|
+
const k3 = c2.trim().toLowerCase();
|
|
2857
|
+
if (k3 in NAMED) return NAMED[k3];
|
|
2857
2858
|
return parseRGBA(c2);
|
|
2858
2859
|
}
|
|
2859
2860
|
function compositeOver(fg, bg) {
|
|
@@ -2903,12 +2904,12 @@ var GLYPH_SAMPLE_N = 3;
|
|
|
2903
2904
|
function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
|
|
2904
2905
|
const out = [];
|
|
2905
2906
|
if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
|
|
2906
|
-
const
|
|
2907
|
-
for (let i = 0; i <
|
|
2908
|
-
for (let j2 = 0; j2 <
|
|
2907
|
+
const k3 = Math.floor(n);
|
|
2908
|
+
for (let i = 0; i < k3; i++) {
|
|
2909
|
+
for (let j2 = 0; j2 < k3; j2++) {
|
|
2909
2910
|
out.push({
|
|
2910
|
-
x: box.left + box.width * (i + 0.5) /
|
|
2911
|
-
y: box.top + box.height * (j2 + 0.5) /
|
|
2911
|
+
x: box.left + box.width * (i + 0.5) / k3,
|
|
2912
|
+
y: box.top + box.height * (j2 + 0.5) / k3
|
|
2912
2913
|
});
|
|
2913
2914
|
}
|
|
2914
2915
|
}
|
|
@@ -2929,10 +2930,10 @@ var LABEL_CONTRAST_CAP = 2e3;
|
|
|
2929
2930
|
var EMPTY5 = { rects: 0, scanned: 0, fixed: 0, pillsBoosted: 0, offFill: 0, pageMajority: 0, paintedOver: 0 };
|
|
2930
2931
|
function backedSamples(el, pts) {
|
|
2931
2932
|
try {
|
|
2932
|
-
const
|
|
2933
|
-
if (typeof
|
|
2934
|
-
const m2 =
|
|
2935
|
-
const svg =
|
|
2933
|
+
const ge2 = el;
|
|
2934
|
+
if (typeof ge2.isPointInFill !== "function" || typeof ge2.getScreenCTM !== "function") return null;
|
|
2935
|
+
const m2 = ge2.getScreenCTM();
|
|
2936
|
+
const svg = ge2.ownerSVGElement;
|
|
2936
2937
|
if (!m2 || !svg || typeof svg.createSVGPoint !== "function") return null;
|
|
2937
2938
|
if (pts.length === 0) return null;
|
|
2938
2939
|
const inv = m2.inverse();
|
|
@@ -2941,7 +2942,7 @@ function backedSamples(el, pts) {
|
|
|
2941
2942
|
const p2 = svg.createSVGPoint();
|
|
2942
2943
|
p2.x = pts[i].x;
|
|
2943
2944
|
p2.y = pts[i].y;
|
|
2944
|
-
hit.push(
|
|
2945
|
+
hit.push(ge2.isPointInFill(p2.matrixTransform(inv)));
|
|
2945
2946
|
}
|
|
2946
2947
|
return hit;
|
|
2947
2948
|
} catch {
|
|
@@ -3123,7 +3124,7 @@ function sessionViewStateProvider(container) {
|
|
|
3123
3124
|
load: () => store,
|
|
3124
3125
|
save: (next) => {
|
|
3125
3126
|
if (!next || typeof next !== "object") return;
|
|
3126
|
-
for (const
|
|
3127
|
+
for (const k3 of Object.keys(store)) delete store[k3];
|
|
3127
3128
|
Object.assign(store, next);
|
|
3128
3129
|
}
|
|
3129
3130
|
};
|
package/dist/index.mjs
CHANGED
package/dist/react.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.110",
|
|
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",
|