@bicharts/chart-host 0.5.122 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -142,15 +142,15 @@ 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 && (k3("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v2.DefaultDelimiter + "'"), a5 = false), m4.skipEmptyLines && (p4.data = p4.data.filter(function(e4) {
145
+ if (p4 && a5 && (k2("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
- })), _4()) {
147
+ })), _3()) {
148
148
  let t4 = function(e4, t5) {
149
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])) {
153
- for (var e2 = 0; _4() && e2 < p4.data.length; e2++) p4.data[e2].forEach(t4);
153
+ for (var e2 = 0; _3() && e2 < p4.data.length; e2++) p4.data[e2].forEach(t4);
154
154
  p4.data.splice(0, 1);
155
155
  } else p4.data.forEach(t4);
156
156
  }
@@ -164,26 +164,26 @@ 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 ? 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;
167
+ return m4.header && (r5 > c4.length ? k2("FieldMismatch", "TooManyFields", "Too many fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4) : r5 < c4.length && k2("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);
171
171
  }
172
- function _4() {
172
+ function _3() {
173
173
  return m4.header && 0 === c4.length;
174
174
  }
175
- function k3(e2, t2, i4, r4) {
175
+ function k2(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
  }
179
179
  q4(m4.step) && (t = m4.step, m4.step = function(e2) {
180
- p4 = e2, _4() ? g4() : (g4(), 0 !== p4.data.length && (r2 += e2.data.length, m4.preview && r2 > m4.preview ? s2.abort() : (p4.data = p4.data[0], t(p4, i2))));
180
+ p4 = e2, _3() ? g4() : (g4(), 0 !== p4.data.length && (r2 += e2.data.length, m4.preview && r2 > m4.preview ? s2.abort() : (p4.data = p4.data[0], t(p4, i2))));
181
181
  }), this.parse = function(e2, t2, i4) {
182
182
  var r4 = m4.quoteChar || '"', r4 = (m4.newline || (m4.newline = this.guessLineEndings(e2, r4)), a5 = false, m4.delimiter ? q4(m4.delimiter) && (m4.delimiter = m4.delimiter(e2), p4.meta.delimiter = m4.delimiter) : ((r4 = ((e4, t4, i5, r5, n4) => {
183
183
  var s4, a6, o4, h5;
184
184
  n4 = n4 || [",", " ", "|", ";", v2.RECORD_SEP, v2.UNIT_SEP];
185
185
  for (var u5 = 0; u5 < n4.length; u5++) {
186
- for (var d4, f6 = n4[u5], l3 = 0, c5 = 0, p5 = 0, g5 = (o4 = void 0, new E4({ comments: r5, delimiter: f6, newline: t4, preview: 10 }).parse(e4)), _5 = 0; _5 < g5.data.length; _5++) i5 && y6(g5.data[_5]) ? p5++ : (d4 = g5.data[_5].length, c5 += d4, void 0 === o4 ? o4 = d4 : 0 < d4 && (l3 += Math.abs(d4 - o4), o4 = d4));
186
+ for (var d4, f6 = n4[u5], l3 = 0, c5 = 0, p5 = 0, g5 = (o4 = void 0, new E4({ comments: r5, delimiter: f6, newline: t4, preview: 10 }).parse(e4)), _4 = 0; _4 < g5.data.length; _4++) i5 && y6(g5.data[_4]) ? p5++ : (d4 = g5.data[_4].length, c5 += d4, void 0 === o4 ? o4 = d4 : 0 < d4 && (l3 += Math.abs(d4 - o4), o4 = d4));
187
187
  0 < g5.data.length && (c5 /= g5.data.length - p5), (void 0 === a6 || l3 <= a6) && (void 0 === h5 || h5 < c5) && 1.99 < c5 && (a6 = l3, s4 = f6, h5 = c5);
188
188
  }
189
189
  return { successful: !!(m4.delimiter = s4), bestDelimiter: s4 };
@@ -211,42 +211,42 @@ var require_papaparse_min = __commonJS({
211
211
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
212
212
  }
213
213
  function E4(C) {
214
- var S = (C = C || {}).delimiter, O3 = C.newline, x4 = C.comments, I2 = C.step, A2 = C.preview, T3 = C.fastMode, D3 = null, L2 = false, F3 = null == C.quoteChar ? '"' : C.quoteChar, j3 = F3;
215
- if (void 0 !== C.escapeChar && (j3 = C.escapeChar), ("string" != typeof S || -1 < v2.BAD_DELIMITERS.indexOf(S)) && (S = ","), x4 === S) throw new Error("Comment character same as delimiter");
214
+ var S2 = (C = C || {}).delimiter, O3 = C.newline, x4 = C.comments, I2 = C.step, A = C.preview, T3 = C.fastMode, D4 = null, L2 = false, F4 = null == C.quoteChar ? '"' : C.quoteChar, j3 = F4;
215
+ if (void 0 !== C.escapeChar && (j3 = C.escapeChar), ("string" != typeof S2 || -1 < v2.BAD_DELIMITERS.indexOf(S2)) && (S2 = ","), x4 === S2) throw new Error("Comment character same as delimiter");
216
216
  true === x4 ? x4 = "#" : ("string" != typeof x4 || -1 < v2.BAD_DELIMITERS.indexOf(x4)) && (x4 = false), "\n" !== O3 && "\r" !== O3 && "\r\n" !== O3 && (O3 = "\n");
217
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 = O3.length, a5 = x4.length, o2 = q4(I2), h4 = [], u4 = [], d3 = [], f5 = z3 = 0;
220
+ var n2 = i2.length, e = S2.length, s2 = O3.length, a5 = x4.length, o2 = q4(I2), h4 = [], u4 = [], d3 = [], f5 = z3 = 0;
221
221
  if (!i2) return w2();
222
- if (T3 || false !== T3 && -1 === i2.indexOf(F3)) {
222
+ if (T3 || false !== T3 && -1 === i2.indexOf(F4)) {
223
223
  for (var l2 = i2.split(O3), c4 = 0; c4 < l2.length; c4++) {
224
224
  if (d3 = l2[c4], z3 += d3.length, c4 !== l2.length - 1) z3 += O3.length;
225
225
  else if (r2) return w2();
226
226
  if (!x4 || d3.substring(0, a5) !== x4) {
227
227
  if (o2) {
228
- if (h4 = [], k3(d3.split(S)), R2(), M2) return w2();
229
- } else k3(d3.split(S));
230
- if (A2 && A2 <= c4) return h4 = h4.slice(0, A2), w2(true);
228
+ if (h4 = [], k2(d3.split(S2)), R2(), M2) return w2();
229
+ } else k2(d3.split(S2));
230
+ if (A && A <= c4) return h4 = h4.slice(0, A), w2(true);
231
231
  }
232
232
  }
233
233
  return w2();
234
234
  }
235
- for (var p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O3, z3), _4 = new RegExp(U2(j3) + U2(F3), "g"), m4 = i2.indexOf(F3, z3); ; ) if (i2[z3] === F3) for (m4 = z3, z3++; ; ) {
236
- if (-1 === (m4 = i2.indexOf(F3, m4 + 1))) return r2 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: z3 }), E5();
237
- if (m4 === n2 - 1) return E5(i2.substring(z3, m4).replace(_4, F3));
238
- if (F3 === j3 && i2[m4 + 1] === j3) m4++;
239
- else if (F3 === j3 || 0 === m4 || i2[m4 - 1] !== j3) {
240
- -1 !== p4 && p4 < m4 + 1 && (p4 = i2.indexOf(S, m4 + 1));
235
+ for (var p4 = i2.indexOf(S2, z3), g4 = i2.indexOf(O3, z3), _3 = new RegExp(U2(j3) + U2(F4), "g"), m4 = i2.indexOf(F4, z3); ; ) if (i2[z3] === F4) for (m4 = z3, z3++; ; ) {
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 }), E5();
237
+ if (m4 === n2 - 1) return E5(i2.substring(z3, m4).replace(_3, F4));
238
+ if (F4 === j3 && i2[m4 + 1] === j3) m4++;
239
+ else if (F4 === j3 || 0 === m4 || i2[m4 - 1] !== j3) {
240
+ -1 !== p4 && p4 < m4 + 1 && (p4 = i2.indexOf(S2, m4 + 1));
241
241
  var y6 = v3(-1 === (g4 = -1 !== g4 && g4 < m4 + 1 ? i2.indexOf(O3, m4 + 1) : g4) ? p4 : Math.min(p4, g4));
242
- if (i2.substr(m4 + 1 + y6, e) === S) {
243
- d3.push(i2.substring(z3, m4).replace(_4, F3)), i2[z3 = m4 + 1 + y6 + e] !== F3 && (m4 = i2.indexOf(F3, z3)), p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O3, z3);
242
+ if (i2.substr(m4 + 1 + y6, e) === S2) {
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(S2, z3), g4 = i2.indexOf(O3, z3);
244
244
  break;
245
245
  }
246
246
  y6 = v3(g4);
247
247
  if (i2.substring(m4 + 1 + y6, m4 + 1 + y6 + s2) === O3) {
248
- if (d3.push(i2.substring(z3, m4).replace(_4, F3)), b5(m4 + 1 + y6 + s2), p4 = i2.indexOf(S, z3), m4 = i2.indexOf(F3, z3), o2 && (R2(), M2)) return w2();
249
- if (A2 && h4.length >= A2) return w2(true);
248
+ if (d3.push(i2.substring(z3, m4).replace(_3, F4)), b5(m4 + 1 + y6 + s2), p4 = i2.indexOf(S2, z3), m4 = i2.indexOf(F4, z3), o2 && (R2(), M2)) return w2();
249
+ if (A && h4.length >= A) return w2(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++;
@@ -254,15 +254,15 @@ var require_papaparse_min = __commonJS({
254
254
  }
255
255
  else if (x4 && 0 === d3.length && i2.substring(z3, z3 + a5) === x4) {
256
256
  if (-1 === g4) return w2();
257
- z3 = g4 + s2, g4 = i2.indexOf(O3, z3), p4 = i2.indexOf(S, z3);
258
- } else if (-1 !== p4 && (p4 < g4 || -1 === g4)) d3.push(i2.substring(z3, p4)), z3 = p4 + e, p4 = i2.indexOf(S, z3);
257
+ z3 = g4 + s2, g4 = i2.indexOf(O3, z3), p4 = i2.indexOf(S2, z3);
258
+ } else if (-1 !== p4 && (p4 < g4 || -1 === g4)) d3.push(i2.substring(z3, p4)), z3 = p4 + e, p4 = i2.indexOf(S2, z3);
259
259
  else {
260
260
  if (-1 === g4) break;
261
261
  if (d3.push(i2.substring(z3, g4)), b5(g4 + s2), o2 && (R2(), M2)) return w2();
262
- if (A2 && h4.length >= A2) return w2(true);
262
+ if (A && h4.length >= A) return w2(true);
263
263
  }
264
264
  return E5();
265
- function k3(e2) {
265
+ function k2(e2) {
266
266
  h4.push(e2), f5 = z3;
267
267
  }
268
268
  function v3(e2) {
@@ -270,10 +270,10 @@ 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 E5(e2) {
273
- return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2, k3(d3), o2 && R2()), w2();
273
+ return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2, k2(d3), o2 && R2()), w2();
274
274
  }
275
275
  function b5(e2) {
276
- z3 = e2, k3(d3), d3 = [], g4 = i2.indexOf(O3, z3);
276
+ z3 = e2, k2(d3), d3 = [], g4 = i2.indexOf(O3, z3);
277
277
  }
278
278
  function w2(e2) {
279
279
  if (C.header && !t && h4.length && !L2) {
@@ -284,13 +284,13 @@ var require_papaparse_min = __commonJS({
284
284
  if (a6[i4 = q4(C.transformHeader) ? C.transformHeader(i4, r4) : i4]) {
285
285
  let e4, t2 = a6[i4];
286
286
  for (; e4 = i4 + "_" + t2, t2++, o4.has(e4); ) ;
287
- o4.add(e4), s4[r4] = e4, a6[i4]++, n4 = true, (D3 = null === D3 ? {} : D3)[e4] = i4;
287
+ o4.add(e4), s4[r4] = e4, a6[i4]++, n4 = true, (D4 = null === D4 ? {} : D4)[e4] = i4;
288
288
  } else a6[i4] = 1, s4[r4] = i4;
289
289
  o4.add(i4);
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: O3, aborted: M2, truncated: !!e2, cursor: f5 + (t || 0), renamedHeaders: D3 } };
293
+ return { data: h4, errors: u4, meta: { delimiter: S2, linebreak: O3, aborted: M2, truncated: !!e2, cursor: f5 + (t || 0), renamedHeaders: D4 } };
294
294
  }
295
295
  function R2() {
296
296
  I2(w2()), h4 = [], u4 = [];
@@ -306,16 +306,16 @@ var require_papaparse_min = __commonJS({
306
306
  if (t.error) i2.userError(t.error, t.file);
307
307
  else if (t.results && t.results.data) {
308
308
  var n2 = { abort: function() {
309
- r2 = true, _3(t.workerId, { data: [], errors: [], meta: { aborted: true } });
309
+ r2 = true, _2(t.workerId, { data: [], errors: [], meta: { aborted: true } });
310
310
  }, pause: m2, resume: m2 };
311
311
  if (q4(i2.userStep)) {
312
312
  for (var s2 = 0; s2 < t.results.data.length && (i2.userStep({ data: t.results.data[s2], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s2++) ;
313
313
  delete t.results;
314
314
  } else q4(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results);
315
315
  }
316
- t.finished && !r2 && _3(t.workerId, t.results);
316
+ t.finished && !r2 && _2(t.workerId, t.results);
317
317
  }
318
- function _3(e, t) {
318
+ function _2(e, t) {
319
319
  var i2 = o[e];
320
320
  q4(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o[e];
321
321
  }
@@ -348,11 +348,11 @@ var require_papaparse_min = __commonJS({
348
348
  })(), (e2 = new n.Worker(e2)).onmessage = g3, e2.id = h3++, o[e2.id] = e2);
349
349
  })()).userStep = t.step, i2.userChunk = t.chunk, i2.userComplete = t.complete, i2.userError = t.error, t.step = q4(t.step), t.chunk = q4(t.chunk), t.complete = q4(t.complete), t.error = q4(t.error), delete t.worker, i2.postMessage({ input: e, config: t, workerId: i2.id });
350
350
  }, v2.unparse = function(e, t) {
351
- var s2 = false, _4 = true, m4 = ",", y6 = "\r\n", a5 = '"', o2 = a5 + a5, i2 = false, r2 = null, h4 = false, u4 = ((() => {
351
+ var s2 = false, _3 = true, m4 = ",", y6 = "\r\n", a5 = '"', o2 = a5 + a5, i2 = false, r2 = null, h4 = false, u4 = ((() => {
352
352
  if ("object" == typeof t) {
353
353
  if ("string" != typeof t.delimiter || v2.BAD_DELIMITERS.filter(function(e2) {
354
354
  return -1 !== t.delimiter.indexOf(e2);
355
- }).length || (m4 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (s2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i2 = t.skipEmptyLines), "string" == typeof t.newline && (y6 = t.newline), "string" == typeof t.quoteChar && (a5 = t.quoteChar, o2 = a5 + a5), "boolean" == typeof t.header && (_4 = t.header), Array.isArray(t.columns)) {
355
+ }).length || (m4 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (s2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i2 = t.skipEmptyLines), "string" == typeof t.newline && (y6 = t.newline), "string" == typeof t.quoteChar && (a5 = t.quoteChar, o2 = a5 + a5), "boolean" == typeof t.header && (_3 = t.header), Array.isArray(t.columns)) {
356
356
  if (0 === t.columns.length) throw new Error("Option columns is empty");
357
357
  r2 = t.columns;
358
358
  }
@@ -367,8 +367,8 @@ var require_papaparse_min = __commonJS({
367
367
  throw new Error("Unable to serialize unrecognized input");
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
- if (n4 && _4) {
371
- for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m4), r4 += k3(e2[a6], a6);
370
+ if (n4 && _3) {
371
+ for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m4), r4 += k2(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 += k3(t2[o4][g4], p4);
387
+ r4 += k2(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 k3(e2, t2) {
394
+ function k2(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;
@@ -450,9 +450,9 @@ var CONTAINER_SLOT_UI_STATE = "__lchUiState";
450
450
  var VIEW_ONLY_UI_STATE_KEYS = Object.freeze(["camera", "llmZoom"]);
451
451
  function withoutViewOnlyKeys(bag) {
452
452
  if (!bag || typeof bag !== "object") return bag;
453
- if (!VIEW_ONLY_UI_STATE_KEYS.some((k3) => Object.prototype.hasOwnProperty.call(bag, k3))) return bag;
453
+ if (!VIEW_ONLY_UI_STATE_KEYS.some((k2) => Object.prototype.hasOwnProperty.call(bag, k2))) return bag;
454
454
  const out = { ...bag };
455
- for (const k3 of VIEW_ONLY_UI_STATE_KEYS) delete out[k3];
455
+ for (const k2 of VIEW_ONLY_UI_STATE_KEYS) delete out[k2];
456
456
  return out;
457
457
  }
458
458
  var HOST_CONTAINER_CLASS = "bic-chart-host";
@@ -665,10 +665,10 @@ function censusColourSpread(container, doc) {
665
665
  for (const { rgb } of counted) {
666
666
  marks++;
667
667
  distinct.add(rgb.join(","));
668
- const k3 = cellKey(rgb);
669
- const cur = cells.get(k3);
668
+ const k2 = cellKey(rgb);
669
+ const cur = cells.get(k2);
670
670
  if (cur) cur.n++;
671
- else cells.set(k3, { rgb, n: 1 });
671
+ else cells.set(k2, { rgb, n: 1 });
672
672
  }
673
673
  if (marks < MIN_MARKS || distinct.size < MIN_RAMP_FILLS) return EMPTY;
674
674
  const top = [...cells.values()].sort((a4, b4) => b4.n - a4.n).slice(0, MAX_CELLS);
@@ -747,8 +747,8 @@ function autoRampMinStep(low, high, canvas, classes = AUTO_RAMP_CLASSES, opacity
747
747
  const bg = normHex(canvas);
748
748
  if (!lo || !hi || !bg || classes < 2) return NaN;
749
749
  let prev = null, min = Infinity;
750
- for (let k3 = 0; k3 < classes; k3++) {
751
- const painted = paintedOver(labToHex(mixLab(lo, hi, k3 / (classes - 1))), bg, opacity);
750
+ for (let k2 = 0; k2 < classes; k2++) {
751
+ const painted = paintedOver(labToHex(mixLab(lo, hi, k2 / (classes - 1))), bg, opacity);
752
752
  if (prev) min = Math.min(min, deltaE2000(prev, painted));
753
753
  prev = painted;
754
754
  }
@@ -772,15 +772,15 @@ function resolveAutoColorScale(p2) {
772
772
  };
773
773
  const candidates = p2.isHighContrast ? [normHex(p2.themeAccent), normHex(p2.themeFg)] : [...palette.map(normHex), normHex(p2.themeAccent), normHex(p2.themeFg)];
774
774
  const accent = candidates.find(usable) ?? FALLBACK_ACCENT;
775
- const A2 = hexToLab(accent);
775
+ const A = hexToLab(accent);
776
776
  let t = 0.1;
777
- let low = mixLab(bg, A2, t);
777
+ let low = mixLab(bg, A, t);
778
778
  while (t < 0.6 && deltaE2000(paintedOver(labToHex(low), canvas, AUTO_RAMP_DRAWN_OPACITY), bg) < SAME_SHADE_DELTA_E) {
779
779
  t += 0.02;
780
- low = mixLab(bg, A2, t);
780
+ low = mixLab(bg, A, t);
781
781
  }
782
782
  const lowHex = labToHex(low);
783
- let high = { ...A2 };
783
+ let high = { ...A };
784
784
  let highHex = labToHex(high);
785
785
  for (let step = 0; step < 80 && autoRampMinStep(lowHex, highHex, canvas) < AUTO_RAMP_MIN_STEP_DELTA_E; step++) {
786
786
  const L2 = Math.max(4, Math.min(98, high.L + (darkCanvas ? 1 : -1)));
@@ -952,12 +952,12 @@ var byAsset = /* @__PURE__ */ new Map();
952
952
  var _na;
953
953
  function geoAssetFor(geoKind) {
954
954
  if (!geoKind) return null;
955
- const k3 = geoKind.toLowerCase();
956
- if (/^country/.test(k3)) return "world";
957
- if (k3 === "north-america") return "world";
958
- if (k3 === "world") return "world";
959
- if (k3 === "us-state-code" || k3 === "us-state-name") return "us-states";
960
- if (k3 === "us-zip5") return "us-zip3";
955
+ const k2 = geoKind.toLowerCase();
956
+ if (/^country/.test(k2)) return "world";
957
+ if (k2 === "north-america") return "world";
958
+ if (k2 === "world") return "world";
959
+ if (k2 === "us-state-code" || k2 === "us-state-name") return "us-states";
960
+ if (k2 === "us-zip5") return "us-zip3";
961
961
  return null;
962
962
  }
963
963
  var _worldBase;
@@ -1237,20 +1237,20 @@ function A3(n) {
1237
1237
  if (r && i && c3(r) !== i && (r = null), n.city !== void 0 && n.city !== null) {
1238
1238
  let a4 = u(String(n.city)), s = O(a4), f4 = s ? F(s, n.mapKind) : null;
1239
1239
  if (f4 && f4.length) {
1240
- 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;
1240
+ let d2 = n.state === void 0 || n.state === null ? "" : String(n.state).trim(), R2 = d2 ? u(d2) : "", g3 = d2 ? Y(d2) : null, S2 = [], m2 = -1;
1241
1241
  for (let c2 of f4) {
1242
- let l = c2.row, A2 = 0;
1243
- if (d2 && l.a1 !== "") if (g3 && l.a1 === g3 || u(l.a1) === R2) A2++;
1242
+ let l = c2.row, A = 0;
1243
+ if (d2 && l.a1 !== "") if (g3 && l.a1 === g3 || u(l.a1) === R2) A++;
1244
1244
  else continue;
1245
- if (i) if (T(l.cc) === i) A2++;
1245
+ if (i) if (T(l.cc) === i) A++;
1246
1246
  else continue;
1247
- A2 > m2 ? (m2 = A2, S = [c2]) : A2 === m2 && S.push(c2);
1247
+ A > m2 ? (m2 = A, S2 = [c2]) : A === m2 && S2.push(c2);
1248
1248
  }
1249
- S.some((c2) => c2.primary) && (S = S.filter((c2) => c2.primary));
1249
+ S2.some((c2) => c2.primary) && (S2 = S2.filter((c2) => c2.primary));
1250
1250
  let p2 = /* @__PURE__ */ new Map();
1251
- for (let c2 of S) p2.set(c2.row.lon.toFixed(2) + "," + c2.row.lat.toFixed(2), c2.row);
1251
+ for (let c2 of S2) p2.set(c2.row.lon.toFixed(2) + "," + c2.row.lat.toFixed(2), c2.row);
1252
1252
  if (p2.size === 1) {
1253
- let c2 = S[0].row;
1253
+ let c2 = S2[0].row;
1254
1254
  return { lat: c2.lat, lon: c2.lon, precision: "city" };
1255
1255
  }
1256
1256
  if (p2.size > 1) return { ambiguous: true, matches: p2.size };
@@ -1273,26 +1273,26 @@ function A3(n) {
1273
1273
  var G = { latlon: 0, city: 1, zip3: 2, state: 3, country: 4 };
1274
1274
  var x = 8;
1275
1275
  function y3(n, e) {
1276
- 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;
1276
+ 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 }, S2 = 0, m2 = 0, p2 = null;
1277
1277
  for (let l = 0; l < n.length; ++l) {
1278
- let A2 = n[l], C = A3({ ...A2, mapKind: e });
1278
+ let A = n[l], C = A3({ ...A, mapKind: e });
1279
1279
  if (S3(C)) {
1280
1280
  t[l] = null, o[l] = null, i[l] = null, m2++;
1281
- let M2 = K(A2);
1281
+ let M2 = K(A);
1282
1282
  M2 && !d2.has(M2.toLowerCase()) && (d2.add(M2.toLowerCase()), R2.length < x && R2.push(M2));
1283
1283
  } else if (C) {
1284
- if (t[l] = C.lat, o[l] = C.lon, i[l] = C.precision, S++, g3[C.precision]++, (p2 === null || G[C.precision] > G[p2]) && (p2 = C.precision), G[C.precision] > G.city) {
1285
- let M2 = K(A2);
1284
+ if (t[l] = C.lat, o[l] = C.lon, i[l] = C.precision, S2++, g3[C.precision]++, (p2 === null || G[C.precision] > G[p2]) && (p2 = C.precision), G[C.precision] > G.city) {
1285
+ let M2 = K(A);
1286
1286
  M2 && !s.has(M2.toLowerCase()) && (s.add(M2.toLowerCase()), f4.length < x && f4.push(M2));
1287
1287
  }
1288
1288
  } else {
1289
1289
  t[l] = null, o[l] = null, i[l] = null;
1290
- let M2 = K(A2);
1290
+ let M2 = K(A);
1291
1291
  M2 && !r.has(M2.toLowerCase()) && (r.add(M2.toLowerCase()), a4.push(M2));
1292
1292
  }
1293
1293
  }
1294
1294
  let c2 = !n3() && n.some((l) => l.city !== null && l.city !== void 0 && String(l.city).trim() !== "");
1295
- 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 } : {} };
1295
+ return { lat: t, lon: o, precisions: i, precision: p2, precisionCounts: g3, coarseExamples: f4, unmatched: a4, ambiguousRows: m2, ambiguousExamples: R2, matchedRows: S2, totalRows: n.length, ...c2 ? { cityTableMissing: true } : {} };
1296
1296
  }
1297
1297
  function K(n) {
1298
1298
  let e = [n.city, n.state, n.zip, n.country].filter((t) => t != null && String(t).trim() !== "").map((t) => String(t).trim()).join(", ");
@@ -1558,12 +1558,12 @@ var ct2 = new RegExp([String.raw`\bisMeasure\b`, String.raw`\bdataType\b`, Strin
1558
1558
 
1559
1559
  // ../shape-core/dist/index.mjs
1560
1560
  /*! @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. */
1561
- var G2 = 2;
1561
+ var F3 = 2;
1562
1562
  var q3 = 400;
1563
- function O2(i) {
1563
+ function E2(i) {
1564
1564
  return !!E(i);
1565
1565
  }
1566
- function A(i) {
1566
+ function S(i) {
1567
1567
  let n = /* @__PURE__ */ new Set();
1568
1568
  for (let t of i) {
1569
1569
  if (t == null) continue;
@@ -1573,9 +1573,9 @@ function A(i) {
1573
1573
  return Array.from(n);
1574
1574
  }
1575
1575
  function x3(i) {
1576
- let n = A(i);
1577
- if (n.length === 0 || E2(i) < 95) return false;
1578
- let t = n.filter((c2) => O2(c2) && !Y(c2)).length, r = n.filter((c2) => !O2(c2) && !!Y(c2)).length;
1576
+ let n = S(i);
1577
+ if (n.length === 0 || O2(i) < 95) return false;
1578
+ let t = n.filter((c2) => E2(c2) && !Y(c2)).length, r = n.filter((c2) => !E2(c2) && !!Y(c2)).length;
1579
1579
  return t >= 1 && t >= r;
1580
1580
  }
1581
1581
  function W2(i, n) {
@@ -1583,15 +1583,15 @@ function W2(i, n) {
1583
1583
  let t = E(i);
1584
1584
  return t ? n === "world" ? true : s3.has(t) : false;
1585
1585
  }
1586
- function E2(i) {
1587
- let n = A(i);
1586
+ function O2(i) {
1587
+ let n = S(i);
1588
1588
  if (n.length === 0) return 0;
1589
1589
  let t = 0;
1590
- for (let r of n) O2(r) && t++;
1590
+ for (let r of n) E2(r) && t++;
1591
1591
  return Math.round(t / n.length * 1e3) / 10;
1592
1592
  }
1593
- function _2(i) {
1594
- let n = A(i);
1593
+ function D3(i) {
1594
+ let n = S(i);
1595
1595
  if (n.length === 0) return 0;
1596
1596
  let t = 0;
1597
1597
  for (let r of n) Y(r) && t++;
@@ -1617,15 +1617,15 @@ function j2(i, n) {
1617
1617
  return y2(n, rt) ? true : $2(i).some((t) => /^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/, "")));
1618
1618
  }
1619
1619
  function yt2(i, n) {
1620
- let t = A(i);
1620
+ let t = S(i);
1621
1621
  if (t.length === 0) return 0;
1622
1622
  let r = 0;
1623
1623
  for (let c2 of t) p3(c2, n) && r++;
1624
1624
  return Math.round(r / t.length * 1e3) / 10;
1625
1625
  }
1626
- function k2(i, n) {
1626
+ function G2(i, n) {
1627
1627
  let t = 0;
1628
- for (let r of A(i)) n(r) && t++;
1628
+ for (let r of S(i)) n(r) && t++;
1629
1629
  return t;
1630
1630
  }
1631
1631
  function Ct(i, n) {
@@ -1651,26 +1651,26 @@ function ht(i, n, t, r, c2) {
1651
1651
  }
1652
1652
  let p2 = t?.state;
1653
1653
  if (p2 && h3.has(p2)) {
1654
- let e = f4(p2), s = A(e);
1655
- s.length > 0 && s.every((u2) => W2(u2, r)) ? a4.push(`state=${p2} (every value is "CA", which is both Canada and California)`) : x3(e) ? (a4.push(`state=${p2} (every value is a country, not a state)`), o.country || (o.country = p2)) : _2(e) < 95 ? a4.push(`state=${p2} (only ${_2(e)}% of values are states/provinces)`) : o.state = p2;
1654
+ let e = f4(p2), s = S(e);
1655
+ s.length > 0 && s.every((u2) => W2(u2, r)) ? a4.push(`state=${p2} (every value is "CA", which is both Canada and California)`) : x3(e) ? (a4.push(`state=${p2} (every value is a country, not a state)`), o.country || (o.country = p2)) : D3(e) < 95 ? a4.push(`state=${p2} (only ${D3(e)}% of values are states/provinces)`) : o.state = p2;
1656
1656
  }
1657
- let y5 = new Set(Object.values(o).filter(Boolean)), S = i.filter((e) => !y5.has(e) && !e.startsWith("__"));
1657
+ let y5 = new Set(Object.values(o).filter(Boolean)), A = i.filter((e) => !y5.has(e) && !e.startsWith("__"));
1658
1658
  if (!o.state) {
1659
1659
  let e = null;
1660
- for (let s of S) {
1660
+ for (let s of A) {
1661
1661
  let u2 = f4(s);
1662
1662
  if (x3(u2)) continue;
1663
- let m2 = _2(u2);
1663
+ let m2 = D3(u2);
1664
1664
  if (m2 < 95) continue;
1665
- let w2 = k2(u2, (T3) => !!Y(T3)), Q3 = k2(u2, (T3) => !!Y(T3) && !W2(T3, r));
1666
- w2 < G2 && Q3 < 1 || (!e || m2 > e.pct) && (e = { name: s, pct: m2 });
1665
+ let w2 = G2(u2, (T3) => !!Y(T3)), Q3 = G2(u2, (T3) => !!Y(T3) && !W2(T3, r));
1666
+ w2 < F3 && Q3 < 1 || (!e || m2 > e.pct) && (e = { name: s, pct: m2 });
1667
1667
  }
1668
1668
  e && (o.state = e.name, y5.add(e.name), l.push(`state=${e.name} (${e.pct}% states/provinces)`));
1669
1669
  }
1670
- if (!o.zip) for (let e of S) {
1670
+ if (!o.zip) for (let e of A) {
1671
1671
  if (y5.has(e)) continue;
1672
1672
  let s = f4(e), u2 = z2(s);
1673
- if (!(u2 < 95) && j2(s, e) && !(Ct(s, (m2) => Z(m2).length > 0) < G2)) {
1673
+ if (!(u2 < 95) && j2(s, e) && !(Ct(s, (m2) => Z(m2).length > 0) < F3)) {
1674
1674
  o.zip = e, y5.add(e), l.push(`zip=${e} (${u2}% ZIP codes)`);
1675
1675
  break;
1676
1676
  }
@@ -1678,27 +1678,27 @@ function ht(i, n, t, r, c2) {
1678
1678
  let P2 = o.country;
1679
1679
  if (!P2 || !x3(f4(P2))) {
1680
1680
  let e = null;
1681
- for (let s of S) {
1681
+ for (let s of A) {
1682
1682
  if (y5.has(s) || !x3(f4(s))) continue;
1683
- let u2 = E2(f4(s));
1683
+ let u2 = O2(f4(s));
1684
1684
  (!e || u2 > e.pct) && (e = { name: s, pct: u2 });
1685
1685
  }
1686
- e && (P2 && (a4.push(`country=${P2} (only ${E2(f4(P2))}% of values are country identifiers; using ${e.name} instead)`), R2.country = P2), o.country = e.name, y5.add(e.name), l.push(`country=${e.name}`));
1686
+ e && (P2 && (a4.push(`country=${P2} (only ${O2(f4(P2))}% of values are country identifiers; using ${e.name} instead)`), R2.country = P2), o.country = e.name, y5.add(e.name), l.push(`country=${e.name}`));
1687
1687
  }
1688
1688
  if (!o.city) {
1689
1689
  let e = null;
1690
- for (let s of S) {
1690
+ for (let s of A) {
1691
1691
  if (y5.has(s)) continue;
1692
1692
  let u2 = f4(s), m2 = yt2(u2, r);
1693
- m2 < m3 || k2(u2, (w2) => p3(w2, r)) < G2 || (!e || m2 > e.pct) && (e = { name: s, pct: m2 });
1693
+ m2 < m3 || G2(u2, (w2) => p3(w2, r)) < F3 || (!e || m2 > e.pct) && (e = { name: s, pct: m2 });
1694
1694
  }
1695
1695
  e && (o.city = e.name, l.push(`city=${e.name} (${e.pct}% known cities)`));
1696
1696
  }
1697
- let B2 = o.country ? f4(o.country) : [], D3 = !!o.country && x3(B2), J2 = D3 ? new Set(B2.map((e) => E(e == null ? null : String(e))).filter(Boolean)).size : 0, H2 = D3 && J2 >= 2, L2 = !!(o.lat && o.lon) && n.some((e) => {
1697
+ let B2 = o.country ? f4(o.country) : [], _2 = !!o.country && x3(B2), J2 = _2 ? new Set(B2.map((e) => E(e == null ? null : String(e))).filter(Boolean)).size : 0, H2 = _2 && J2 >= 2, L2 = !!(o.lat && o.lon) && n.some((e) => {
1698
1698
  let s = +String(e[o.lat] ?? "").trim(), u2 = +String(e[o.lon] ?? "").trim();
1699
1699
  return isFinite(s) && isFinite(u2) && s >= -90 && s <= 90 && u2 >= -180 && u2 <= 180 && String(e[o.lat] ?? "").trim() !== "" && String(e[o.lon] ?? "").trim() !== "";
1700
1700
  });
1701
- return o.lat && o.lon && !L2 && a4.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !H2 && !(o.city || o.state || o.zip || L2) && a4.push(D3 ? `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 || H2 || L2) ? o : null, backfilled: l, refused: a4, ...Object.keys(R2).length ? { labelFallback: R2 } : {} };
1701
+ return o.lat && o.lon && !L2 && a4.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !H2 && !(o.city || o.state || o.zip || L2) && a4.push(_2 ? `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 || H2 || L2) ? o : null, backfilled: l, refused: a4, ...Object.keys(R2).length ? { labelFallback: R2 } : {} };
1702
1702
  }
1703
1703
 
1704
1704
  // src/payload.ts
@@ -1808,20 +1808,20 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
1808
1808
  a4[c2] = v2 ?? null;
1809
1809
  }
1810
1810
  }
1811
- let k3 = cols.length;
1812
- a4[k3++] = r;
1813
- if (geoIso) a4[k3++] = geoIso[r];
1811
+ let k2 = cols.length;
1812
+ a4[k2++] = r;
1813
+ if (geoIso) a4[k2++] = geoIso[r];
1814
1814
  if (pLat && pLon) {
1815
- a4[k3++] = pLat[r];
1816
- a4[k3++] = pLon[r];
1817
- a4[k3++] = pPrec ? pPrec[r] : null;
1815
+ a4[k2++] = pLat[r];
1816
+ a4[k2++] = pLon[r];
1817
+ a4[k2++] = pPrec ? pPrec[r] : null;
1818
1818
  }
1819
1819
  if (dLat && dLon) {
1820
- a4[k3++] = dLat[r];
1821
- a4[k3++] = dLon[r];
1822
- a4[k3++] = dPrec ? dPrec[r] : null;
1820
+ a4[k2++] = dLat[r];
1821
+ a4[k2++] = dLon[r];
1822
+ a4[k2++] = dPrec ? dPrec[r] : null;
1823
1823
  }
1824
- for (const ac of aliasCols) a4[k3++] = a4[ac.from];
1824
+ for (const ac of aliasCols) a4[k2++] = a4[ac.from];
1825
1825
  out[r] = a4;
1826
1826
  }
1827
1827
  const colsOut = [...cols, { name: "__rowIdx__", dataType: "Integer", isMeasure: false, modelDesc: "" }];
@@ -2408,10 +2408,10 @@ function censusValuePlacement(container, data) {
2408
2408
  for (const axis of ["x", "y"]) {
2409
2409
  const keep = [];
2410
2410
  const v2 = [], pos = [];
2411
- dots.forEach((d2, k3) => {
2412
- if (!Number.isFinite(vals[k3])) return;
2413
- keep.push(k3);
2414
- v2.push(log ? Math.log10(vals[k3]) : vals[k3]);
2411
+ dots.forEach((d2, k2) => {
2412
+ if (!Number.isFinite(vals[k2])) return;
2413
+ keep.push(k2);
2414
+ v2.push(log ? Math.log10(vals[k2]) : vals[k2]);
2415
2415
  pos.push(axis === "x" ? d2.x : d2.y);
2416
2416
  });
2417
2417
  const line = robustLine(v2, pos);
@@ -2420,8 +2420,8 @@ function censusValuePlacement(container, data) {
2420
2420
  if (hi - lo < MIN_AXIS_SPAN_PX) continue;
2421
2421
  const mean = pos.reduce((s, p2) => s + p2, 0) / pos.length;
2422
2422
  let ssRes = 0, ssTot = 0;
2423
- const res = pos.map((p2, k3) => {
2424
- const e = p2 - (line.a + line.b * v2[k3]);
2423
+ const res = pos.map((p2, k2) => {
2424
+ const e = p2 - (line.a + line.b * v2[k2]);
2425
2425
  ssRes += e * e;
2426
2426
  ssTot += (p2 - mean) ** 2;
2427
2427
  return e;
@@ -2430,8 +2430,8 @@ function censusValuePlacement(container, data) {
2430
2430
  const fit = 1 - ssRes / ssTot;
2431
2431
  if (fit >= VALUE_AXIS_MIN_FIT && (!best || fit > best.fit)) {
2432
2432
  const full = new Array(dots.length).fill(NaN);
2433
- keep.forEach((k3, j3) => {
2434
- full[k3] = res[j3];
2433
+ keep.forEach((k2, j3) => {
2434
+ full[k2] = res[j3];
2435
2435
  });
2436
2436
  best = { col: c2, axis, fit, res: full, log };
2437
2437
  }
@@ -2441,8 +2441,8 @@ function censusValuePlacement(container, data) {
2441
2441
  if (!best) return EMPTY4;
2442
2442
  let off = 0, measured = 0;
2443
2443
  const radii = [];
2444
- dots.forEach((d2, k3) => {
2445
- const e = best.res[k3];
2444
+ dots.forEach((d2, k2) => {
2445
+ const e = best.res[k2];
2446
2446
  if (!Number.isFinite(e)) return;
2447
2447
  measured++;
2448
2448
  const inRadii = Math.abs(e) / Math.max(d2.r, 1);
@@ -3017,8 +3017,8 @@ var NAMED = {
3017
3017
  };
3018
3018
  function toRGBA(c2) {
3019
3019
  if (typeof c2 !== "string") return null;
3020
- const k3 = c2.trim().toLowerCase();
3021
- if (k3 in NAMED) return NAMED[k3];
3020
+ const k2 = c2.trim().toLowerCase();
3021
+ if (k2 in NAMED) return NAMED[k2];
3022
3022
  return parseRGBA(c2);
3023
3023
  }
3024
3024
  function compositeOver(fg, bg) {
@@ -3068,12 +3068,12 @@ var GLYPH_SAMPLE_N = 3;
3068
3068
  function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
3069
3069
  const out = [];
3070
3070
  if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
3071
- const k3 = Math.floor(n);
3072
- for (let i = 0; i < k3; i++) {
3073
- for (let j3 = 0; j3 < k3; j3++) {
3071
+ const k2 = Math.floor(n);
3072
+ for (let i = 0; i < k2; i++) {
3073
+ for (let j3 = 0; j3 < k2; j3++) {
3074
3074
  out.push({
3075
- x: box.left + box.width * (i + 0.5) / k3,
3076
- y: box.top + box.height * (j3 + 0.5) / k3
3075
+ x: box.left + box.width * (i + 0.5) / k2,
3076
+ y: box.top + box.height * (j3 + 0.5) / k2
3077
3077
  });
3078
3078
  }
3079
3079
  }
@@ -3288,7 +3288,7 @@ function sessionViewStateProvider(container) {
3288
3288
  load: () => store,
3289
3289
  save: (next) => {
3290
3290
  if (!next || typeof next !== "object") return;
3291
- for (const k3 of Object.keys(store)) delete store[k3];
3291
+ for (const k2 of Object.keys(store)) delete store[k2];
3292
3292
  Object.assign(store, next);
3293
3293
  }
3294
3294
  };
package/dist/geo.mjs CHANGED
@@ -7,12 +7,12 @@ import {
7
7
  import {
8
8
  WORLD_110M
9
9
  } from "./chunk-ABGDJ3NJ.mjs";
10
- import {
11
- US_STATES
12
- } from "./chunk-75ZJSYIF.mjs";
13
10
  import {
14
11
  US_ZIP3
15
12
  } from "./chunk-D3N3JUMK.mjs";
13
+ import {
14
+ US_STATES
15
+ } from "./chunk-75ZJSYIF.mjs";
16
16
  import "./chunk-GHODWOAL.mjs";
17
17
 
18
18
  // src/geo.ts
package/dist/index.mjs CHANGED
@@ -133,7 +133,7 @@ import {
133
133
  unpinScrolledAxis,
134
134
  valuePlacementFlag,
135
135
  withoutViewOnlyKeys
136
- } from "./chunk-7RLI3VOM.mjs";
136
+ } from "./chunk-DTAYO46G.mjs";
137
137
  import "./chunk-A2GMXZP7.mjs";
138
138
  import "./chunk-GHODWOAL.mjs";
139
139
 
package/dist/react.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createChartHost,
5
5
  geoFromCache,
6
6
  loadGeo
7
- } from "./chunk-7RLI3VOM.mjs";
7
+ } from "./chunk-DTAYO46G.mjs";
8
8
  import "./chunk-A2GMXZP7.mjs";
9
9
  import "./chunk-GHODWOAL.mjs";
10
10
 
@@ -0,0 +1,67 @@
1
+ /*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
+ import "./chunk-GHODWOAL.mjs";
3
+
4
+ // src/testing/index.ts
5
+ var ConformanceError = class extends Error {
6
+ contract;
7
+ failures;
8
+ constructor(contract, failures) {
9
+ super(`${contract} conformance failed:
10
+ - ${failures.join("\n - ")}`);
11
+ this.name = "ConformanceError";
12
+ this.contract = contract;
13
+ this.failures = failures;
14
+ }
15
+ };
16
+ function describeThrow(e) {
17
+ return e instanceof Error ? `${e.name}: ${e.message}` : String(e);
18
+ }
19
+ var PROBE_A = "__bicharts_conformance_marker_a__";
20
+ var PROBE_B = "__bicharts_conformance_marker_b__";
21
+ async function assertMarkerStoreConformance(store) {
22
+ const failures = [];
23
+ const done = () => {
24
+ if (failures.length) throw new ConformanceError("MarkerStore", failures);
25
+ };
26
+ if (!store || typeof store.read !== "function" || typeof store.write !== "function" || typeof store.clear !== "function") {
27
+ failures.push("the store is missing read(), write() or clear()");
28
+ done();
29
+ }
30
+ try {
31
+ store.clear(PROBE_A);
32
+ store.clear(PROBE_B);
33
+ const absent = store.read(PROBE_A);
34
+ if (absent !== null) {
35
+ failures.push(`read() of a key never written returned ${JSON.stringify(absent)}, not null`);
36
+ }
37
+ const v1 = '{"at":1,"corr":"probe-1"}';
38
+ await store.write(PROBE_A, v1);
39
+ const r1 = store.read(PROBE_A);
40
+ if (r1 !== v1) failures.push(`read() after write() returned ${JSON.stringify(r1)}, not the value written`);
41
+ const other = store.read(PROBE_B);
42
+ if (other !== null) failures.push(`writing one key changed another: it reads ${JSON.stringify(other)}`);
43
+ const v2 = '{"at":2,"corr":"probe-2"}';
44
+ await store.write(PROBE_A, v2);
45
+ const r2 = store.read(PROBE_A);
46
+ if (r2 !== v2) failures.push(`a second write() did not replace the first: read ${JSON.stringify(r2)}`);
47
+ await store.write(PROBE_B, v1);
48
+ store.clear(PROBE_A);
49
+ const cleared = store.read(PROBE_A);
50
+ if (cleared !== null) failures.push(`read() after clear() returned ${JSON.stringify(cleared)}, not null`);
51
+ const kept = store.read(PROBE_B);
52
+ if (kept !== v1) failures.push(`clear() of one key disturbed another: it reads ${JSON.stringify(kept)}`);
53
+ } catch (e) {
54
+ failures.push(`the store threw during an ordinary read, write or clear: ${describeThrow(e)}`);
55
+ } finally {
56
+ try {
57
+ store.clear(PROBE_A);
58
+ store.clear(PROBE_B);
59
+ } catch {
60
+ }
61
+ }
62
+ done();
63
+ }
64
+ export {
65
+ ConformanceError,
66
+ assertMarkerStoreConformance
67
+ };
@@ -0,0 +1,144 @@
1
+ import type { RenderOptions } from "../contract";
2
+ /** Signs an encoded request body. See @bicharts/shape-core's host/services.ts. */
3
+ export interface WireSigner {
4
+ sign(encodedBody: string): string;
5
+ }
6
+ /** The response half of a transport. See @bicharts/shape-core's host/services.ts. */
7
+ export interface WireResponse {
8
+ status: number;
9
+ contentType: string | null;
10
+ body: ReadableStream<Uint8Array> | null;
11
+ text(): Promise<string>;
12
+ }
13
+ /** Posts an encoded body. See @bicharts/shape-core's host/services.ts. */
14
+ export interface WireTransport {
15
+ post(url: string, encodedBody: string, headers: Record<string, string>, opts: {
16
+ timeoutMs: number;
17
+ signal?: AbortSignal;
18
+ }): Promise<WireResponse>;
19
+ }
20
+ /** The licence triple as the wire carries it. */
21
+ export interface CredentialTriple {
22
+ licensee: string;
23
+ licenseKey: string;
24
+ secretKey: string;
25
+ }
26
+ /** What a request is entitled by. See @bicharts/shape-core's host/services.ts. */
27
+ export interface CredentialSource {
28
+ triple(): CredentialTriple;
29
+ linkNonce?: (() => string | null) | null;
30
+ freemiumKey?: (() => string | null) | null;
31
+ instanceKey?: (() => string | null) | null;
32
+ }
33
+ /** The drawing area a request should be sized for, in CSS pixels. */
34
+ export interface ViewportSource {
35
+ measure(): {
36
+ width: number;
37
+ height: number;
38
+ };
39
+ }
40
+ /** Milliseconds since the epoch. */
41
+ export interface Clock {
42
+ now(): number;
43
+ }
44
+ /** One diagnostics breadcrumb. */
45
+ export interface DiagnosticEntry {
46
+ event: string;
47
+ detail?: unknown;
48
+ }
49
+ /** Where diagnostics breadcrumbs go. `record` never throws. */
50
+ export interface DiagnosticsSink {
51
+ record(entry: DiagnosticEntry): void;
52
+ }
53
+ /** A chart renderer a host can execute. */
54
+ export type RendererId = "D3" | "PLOTLY" | "VEGA" | "PYTHON";
55
+ /**
56
+ * Small string values that must outlive the page: the pending-generate marker is the first.
57
+ * The visual keeps them in the report, the add-in in the workbook. The MCP server holds a
58
+ * generate only for the length of one call and passes none; a demo page has nothing to
59
+ * recover and passes none.
60
+ *
61
+ * `read` returns null - not undefined, not "" - for a key never written or cleared. `write`
62
+ * replaces; it may complete asynchronously, and a caller that needs the value durable awaits
63
+ * it. `clear` removes the key.
64
+ */
65
+ export interface MarkerStore {
66
+ read(key: string): string | null;
67
+ write(key: string, value: string): void | Promise<void>;
68
+ clear(key: string): void;
69
+ }
70
+ /**
71
+ * The reader's saved settings, read one key at a time. The visual reads its format pane, the
72
+ * add-in its task-pane preferences, a web page whatever its caller configured. The MCP server
73
+ * takes its options as arguments and passes none.
74
+ *
75
+ * Keyed on RenderOptions until the shared options vocabulary lands; `undefined` means the
76
+ * reader has not set the key and the shared default applies.
77
+ */
78
+ export interface PreferenceSource<Vocab extends object = RenderOptions> {
79
+ get<K extends keyof Vocab & string>(key: K): Vocab[K] | undefined;
80
+ }
81
+ /** The surface a chart sits on, as colours a chart can use directly. */
82
+ export interface HostTheme {
83
+ /** Canvas colour, as a CSS colour string. */
84
+ background: string;
85
+ /** Default text colour, as a CSS colour string. */
86
+ foreground: string;
87
+ /** True when the host is in a forced high-contrast mode. */
88
+ isHighContrast: boolean;
89
+ /** The host's own categorical colours, when it has any (a report theme; a workbook's accents). */
90
+ palette?: readonly string[];
91
+ }
92
+ /**
93
+ * Reads the host's current theme. The visual reads the report theme, the add-in the Office
94
+ * theme. The MCP preview is not a product surface and passes none; a demo page that reads the
95
+ * browser's colour scheme passes one.
96
+ */
97
+ export interface ThemeSource {
98
+ read(): HostTheme;
99
+ }
100
+ /**
101
+ * Whether a rendered chart may be captured as a thumbnail. `consented` is the reader's (or
102
+ * their administrator's) answer; `forced` is a host rule that captures regardless (a
103
+ * first-render capture a licence requires). The visual and the add-in provide it; the MCP
104
+ * server has no DOM and a demo page no credentials, so both pass none.
105
+ */
106
+ export interface ThumbnailConsent {
107
+ consented(): boolean;
108
+ forced(): boolean;
109
+ }
110
+ /** The rendered chart's root <svg>, or null when the chart drew none (a canvas, a table). */
111
+ export interface SnapshotTarget {
112
+ svg(): SVGSVGElement | null;
113
+ }
114
+ /**
115
+ * The whole services object a host constructs and passes to shared logic.
116
+ *
117
+ * Required members are the ones every host that sends requests provides today, so their
118
+ * absence is a compile error. An optional member that is absent - or null, which means the
119
+ * same - is the host declaring it cannot do that thing. What a host can do is derived from
120
+ * this object, never declared beside it, so a capability cannot be claimed without the service
121
+ * that backs it.
122
+ *
123
+ * Each optional member's host coverage today:
124
+ * - viewport: visual, add-in, web page; not the MCP server (sizes are arguments).
125
+ * - markers: visual, add-in; not the MCP server (in-call only) or a demo page.
126
+ * - prefs: visual, add-in, web page; not the MCP server (options are arguments).
127
+ * - theme: visual, add-in; a web page when it reads the browser's scheme; not the MCP server.
128
+ * - thumbnails and snapshot: visual, add-in; not the MCP server (no DOM) or a demo page.
129
+ * - diagnostics: visual, add-in; not the MCP server (stdio) or a demo page.
130
+ */
131
+ export interface HostServices {
132
+ signer: WireSigner;
133
+ transport: WireTransport;
134
+ credentials: CredentialSource;
135
+ clock: Clock;
136
+ renderers: ReadonlySet<RendererId>;
137
+ viewport?: ViewportSource | null;
138
+ markers?: MarkerStore | null;
139
+ prefs?: PreferenceSource | null;
140
+ theme?: ThemeSource | null;
141
+ thumbnails?: ThumbnailConsent | null;
142
+ snapshot?: SnapshotTarget | null;
143
+ diagnostics?: DiagnosticsSink | null;
144
+ }
@@ -38,3 +38,4 @@ export { PENDING_RECOVERY_WINDOW_MS, PENDING_RECOVERY_POLL_MS, PENDING_RECOVERY_
38
38
  export { stripJsComments } from "./codeComments";
39
39
  export { reconcileChartPick, type ChartPickReconciliation } from "./chartPick";
40
40
  export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
41
+ export type { HostServices, MarkerStore, PreferenceSource, HostTheme, ThemeSource, ThumbnailConsent, SnapshotTarget, WireSigner, WireTransport, WireResponse, CredentialTriple, CredentialSource, ViewportSource, Clock, DiagnosticEntry, DiagnosticsSink, RendererId, } from "./host/services";
@@ -0,0 +1,14 @@
1
+ import type { MarkerStore } from "../host/services";
2
+ /** Thrown by every conformance check. `failures` names each property the adapter broke. */
3
+ export declare class ConformanceError extends Error {
4
+ readonly contract: string;
5
+ readonly failures: readonly string[];
6
+ constructor(contract: string, failures: readonly string[]);
7
+ }
8
+ /**
9
+ * A MarkerStore reads null for a key it does not hold, returns exactly what was written,
10
+ * replaces on a second write, keeps keys independent, and reads null again after a clear.
11
+ * Awaits every write, since a store may complete one asynchronously. Clears both probe keys
12
+ * before returning, whether or not the check passed.
13
+ */
14
+ export declare function assertMarkerStoreConformance(store: MarkerStore): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.122",
3
+ "version": "0.6.0",
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",
@@ -39,6 +39,11 @@
39
39
  "import": "./dist/geo-us-zip3.mjs",
40
40
  "default": "./dist/geo-us-zip3.mjs"
41
41
  },
42
+ "./testing": {
43
+ "types": "./dist/types/testing/index.d.ts",
44
+ "import": "./dist/testing.mjs",
45
+ "default": "./dist/testing.mjs"
46
+ },
42
47
  "./package.json": "./package.json"
43
48
  },
44
49
  "files": [