@urban-toolkit/autk-grammar 4.2.0 → 4.3.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.
@@ -1,7 +1,7 @@
1
- import { AutkDb as K, DEFAULT_WORKSPACE_COORDINATE_FORMAT as V } from "@urban-toolkit/autk-db";
2
- import { AutkMap as q, MapEvent as P } from "@urban-toolkit/autk-map";
1
+ import { AutkDb as J, DEFAULT_WORKSPACE_COORDINATE_FORMAT as V } from "@urban-toolkit/autk-db";
2
+ import { AutkMap as K, MapEvent as N } from "@urban-toolkit/autk-map";
3
3
  import { AutkPlot as z, PlotEvent as I } from "@urban-toolkit/autk-plot";
4
- import { ColorMapInterpolator as Z, ColorMapDomainStrategy as M, ColorMap as N } from "@urban-toolkit/autk-core";
4
+ import { ColorMapInterpolator as Z, ColorMapDomainStrategy as S, ColorMap as P } from "@urban-toolkit/autk-core";
5
5
  import { AutkComputeEngine as tt } from "@urban-toolkit/autk-compute";
6
6
  function et(t) {
7
7
  const { spec: e, adapters: r } = t;
@@ -44,10 +44,30 @@ function et(t) {
44
44
  }
45
45
  var rt = /* @__PURE__ */ ((t) => (t.CAT_ACCENT = "schemeAccent", t.CAT_DARK2 = "schemeDark2", t.CAT_CATEGORY10 = "schemeCategory10", t.CAT_OBSERVABLE10 = "schemeObservable10", t.CAT_PAIRED = "schemePaired", t.CAT_PASTEL1 = "schemePastel1", t.CAT_PASTEL2 = "schemePastel2", t.CAT_SET1 = "schemeSet1", t.CAT_SET2 = "schemeSet2", t.CAT_SET3 = "schemeSet3", t.CAT_TABLEAU10 = "schemeTableau10", t.SEQ_REDS = "interpolateReds", t.SEQ_BLUES = "interpolateBlues", t.SEQ_GREENS = "interpolateGreens", t.SEQ_GREYS = "interpolateGreys", t.SEQ_ORANGES = "interpolateOranges", t.SEQ_PURPLES = "interpolatePurples", t.SEQ_TURBO = "interpolateTurbo", t.SEQ_VIRIDIS = "interpolateViridis", t.SEQ_INFERNO = "interpolateInferno", t.SEQ_MAGMA = "interpolateMagma", t.SEQ_PLASMA = "interpolatePlasma", t.SEQ_CIVIDIS = "interpolateCividis", t.SEQ_WARM = "interpolateWarm", t.SEQ_COOL = "interpolateCool", t.SEQ_CUBEHELIX_DEFAULT = "interpolateCubehelixDefault", t.SEQ_BU_GN = "interpolateBuGn", t.SEQ_BU_PU = "interpolateBuPu", t.SEQ_GN_BU = "interpolateGnBu", t.SEQ_OR_RD = "interpolateOrRd", t.SEQ_PU_BU_GN = "interpolatePuBuGn", t.SEQ_PU_BU = "interpolatePuBu", t.SEQ_PU_RD = "interpolatePuRd", t.SEQ_RD_PU = "interpolateRdPu", t.SEQ_YL_GN_BU = "interpolateYlGnBu", t.SEQ_YL_GN = "interpolateYlGn", t.SEQ_YL_OR_BR = "interpolateYlOrBr", t.SEQ_YL_OR_RD = "interpolateYlOrRd", t.DIV_BR_BG = "interpolateBrBG", t.DIV_PR_GN = "interpolatePRGn", t.DIV_PI_YG = "interpolatePiYG", t.DIV_PU_OR = "interpolatePuOr", t.DIV_RED_BLUE = "interpolateRdBu", t.DIV_RED_GREY = "interpolateRdGy", t.DIV_RED_YELLOW_BLUE = "interpolateRdYlBu", t.DIV_RED_YELLOW_GREEN = "interpolateRdYlGn", t.DIV_SPECTRAL = "interpolateSpectral", t))(rt || {}), Y = /* @__PURE__ */ ((t) => (t.MIN_MAX = "minMax", t.PERCENTILE = "percentile", t))(Y || {});
46
46
  function ot(t) {
47
+ const { queryArea: e } = t;
48
+ if (e.bbox === void 0) return { geocodeArea: e.geocodeArea, areas: e.areas };
49
+ const r = (s) => new Error(`OSM source "${t.outputTableName}": ${s}`);
50
+ if (e.geocodeArea !== void 0 || e.areas !== void 0)
51
+ throw r("queryArea takes either bbox or geocodeArea with areas, not both.");
52
+ const o = e.bbox;
53
+ if (!Array.isArray(o) || o.length !== 4 || !o.every((s) => typeof s == "number" && Number.isFinite(s)))
54
+ throw r("queryArea.bbox must hold four numbers, [west, south, east, north] in degrees.");
55
+ const [i, a, l, n] = e.bbox;
56
+ if (Math.abs(i) > 180 || Math.abs(l) > 180)
57
+ throw r("queryArea.bbox west and east must be longitudes from -180 to 180.");
58
+ if (Math.abs(a) > 90 || Math.abs(n) > 90)
59
+ throw r("queryArea.bbox south and north must be latitudes from -90 to 90.");
60
+ if (i >= l)
61
+ throw r(`queryArea.bbox west (${i}) must be less than east (${l}); a box across the antimeridian is not supported.`);
62
+ if (a >= n)
63
+ throw r(`queryArea.bbox south (${a}) must be less than north (${n}).`);
64
+ return { bbox: [i, a, l, n] };
65
+ }
66
+ function at(t) {
47
67
  const { autoLoadLayers: e, ...r } = t;
48
- return { ...r, autoLoadLayers: { layers: e?.layers ?? [] } };
68
+ return { ...r, queryArea: ot(t), autoLoadLayers: { layers: e?.layers ?? [] } };
49
69
  }
50
- function at(t, e) {
70
+ function nt(t, e) {
51
71
  function r(o, i) {
52
72
  if (!i || !i.db)
53
73
  return;
@@ -63,11 +83,11 @@ function at(t, e) {
63
83
  return {
64
84
  async resolveSource(o, i) {
65
85
  let a = o;
66
- a || (a = new K(), await a.init());
86
+ a || (a = new J(), await a.init());
67
87
  let { type: l, ...n } = i;
68
88
  switch (l) {
69
89
  case "osm":
70
- return await a.loadOsm(ot(n)), r(a, t), a;
90
+ return await a.loadOsm(at(n)), r(a, t), a;
71
91
  case "csv":
72
92
  return await a.loadCsv(n), r(a, t), a;
73
93
  case "json":
@@ -131,7 +151,7 @@ function at(t, e) {
131
151
  function B(t) {
132
152
  return typeof t.title == "string" && t.title !== "" ? t.title : t.dataRef;
133
153
  }
134
- function nt(t, e) {
154
+ function it(t, e) {
135
155
  const r = /* @__PURE__ */ new Set();
136
156
  for (const o of t.layerRefs) {
137
157
  const i = B(o);
@@ -140,25 +160,25 @@ function nt(t, e) {
140
160
  r.add(i);
141
161
  }
142
162
  }
143
- const it = /^#[0-9a-fA-F]{6}$/;
144
- function G(t, e, r) {
145
- if (!it.test(t))
163
+ const st = /^#[0-9a-fA-F]{6}$/;
164
+ function D(t, e, r) {
165
+ if (!st.test(t))
146
166
  throw new Error(`Layer "${r}": ${e} must be a color written #rrggbb, not "${t}".`);
147
- return N.hexToRgb(t);
167
+ return P.hexToRgb(t);
148
168
  }
149
- function st(t, e) {
169
+ function lt(t, e) {
150
170
  const r = {};
151
- return t.color != null && (r.color = G(t.color, "color", e)), t.stroke === !1 ? r.showBorders = !1 : t.stroke != null && (r.strokeColor = G(t.stroke, "stroke", e)), t.width != null && (r.polylinesWidth = t.width), r;
171
+ return t.color != null && (r.color = D(t.color, "color", e)), t.stroke === !1 ? r.showBorders = !1 : t.stroke != null && (r.strokeColor = D(t.stroke, "stroke", e)), t.width != null && (r.polylinesWidth = t.width), r;
152
172
  }
153
- function lt(t, e) {
173
+ function ut(t, e) {
154
174
  return t.isColorMap != null ? t.isColorMap : e === "raster" ? t.colorMapInterpolator != null || t.colorMapCenter != null || t.colorMapReverse === !0 : t.color != null ? !1 : t.colorMapInterpolator != null || t.getFnv != null;
155
175
  }
156
- function ut(t, e) {
176
+ function ct(t, e) {
157
177
  const r = t.features?.[0]?.properties?.[e];
158
178
  return r instanceof Float32Array ? r : ArrayBuffer.isView(r) && !(r instanceof DataView) || Array.isArray(r) ? Float32Array.from(r, (o) => Number.isFinite(Number(o)) ? Number(o) : NaN) : null;
159
179
  }
160
- function ct(t, e, r, o) {
161
- if (N.isCategorical(e.interpolator)) return;
180
+ function ft(t, e, r, o) {
181
+ if (P.isCategorical(e.interpolator)) return;
162
182
  let i = 0, a = 0;
163
183
  for (let s = 0; s < t.length; s++) {
164
184
  const c = t[s];
@@ -166,33 +186,33 @@ function ct(t, e, r, o) {
166
186
  }
167
187
  const l = r != null && i > 0;
168
188
  if (a === 0 || !l && o !== !0) return;
169
- const n = l && r != null ? [r - i, r, r + i] : N.resolveDomainFromData(t, e);
189
+ const n = l && r != null ? [r - i, r, r + i] : P.resolveDomainFromData(t, e);
170
190
  return o === !0 ? [...n].reverse() : n;
171
191
  }
172
- function ft(t, e) {
173
- return e && e.length > 0 ? { type: M.USER, params: e } : t?.mode === Y.PERCENTILE ? t.lowerPercentile !== void 0 || t.upperPercentile !== void 0 ? {
174
- type: M.PERCENTILE,
192
+ function pt(t, e) {
193
+ return e && e.length > 0 ? { type: S.USER, params: e } : t?.mode === Y.PERCENTILE ? t.lowerPercentile !== void 0 || t.upperPercentile !== void 0 ? {
194
+ type: S.PERCENTILE,
175
195
  params: [t.lowerPercentile ?? 0, t.upperPercentile ?? 100]
176
- } : { type: M.PERCENTILE } : { type: M.MIN_MAX };
196
+ } : { type: S.PERCENTILE } : { type: S.MIN_MAX };
177
197
  }
178
- function pt(t, e) {
198
+ function mt(t, e) {
179
199
  return e.split(".").reduce((r, o) => {
180
200
  if (!(r == null || typeof r != "object"))
181
201
  return r[o];
182
202
  }, t);
183
203
  }
184
- function mt(t, e, r) {
204
+ function dt(t, e, r) {
185
205
  const o = e.split("."), i = { ...t };
186
206
  let a = i;
187
207
  for (let l = 0; l < o.length - 1; l++)
188
208
  a[o[l]] = { ...a[o[l]] ?? {} }, a = a[o[l]];
189
209
  return a[o[o.length - 1]] = r, i;
190
210
  }
191
- function dt(t, e) {
211
+ function ht(t, e) {
192
212
  const o = t.features?.[0]?.properties?.bands ?? [];
193
213
  return o.find((a) => a.id === e || a.label === e?.replace(/\./g, "_"))?.id ?? o[0]?.id ?? e ?? "";
194
214
  }
195
- function ht(t, e, r, o, i) {
215
+ function yt(t, e, r, o, i) {
196
216
  async function a(l, n, s) {
197
217
  let c = {};
198
218
  for (const u of n.getTablesMetadata())
@@ -201,33 +221,33 @@ function ht(t, e, r, o, i) {
201
221
  const f = u.dataRef, p = B(u), m = c[f], d = u.getFnv, h = r?.get(f) ?? await n.getLayer(f), y = m === "raster" ? h : {
202
222
  ...h,
203
223
  features: (h.features ?? []).filter((g) => g.geometry != null)
204
- }, b = m === "raster" ? dt(y, d) : "";
205
- m === "raster" ? l.loadCollection(p, { collection: y, type: "raster", property: b }) : l.loadCollection(p, { collection: y, type: m }), u.opacity != null && l.updateRenderInfo(p, { opacity: u.opacity });
206
- const w = st(u, p);
207
- Object.keys(w).length > 0 && l.updateRenderInfo(p, w), lt(u, m) && l.updateRenderInfo(p, { isColorMap: !0 }), u.isPick && l.updateRenderInfo(p, { isPick: !0 }), u.isSkip && l.updateRenderInfo(p, { isSkip: !0 });
208
- const { catchAllCategory: _, colorMapDomain: R } = u;
224
+ }, E = m === "raster" ? ht(y, d) : "";
225
+ m === "raster" ? l.loadCollection(p, { collection: y, type: "raster", property: E }) : l.loadCollection(p, { collection: y, type: m }), u.opacity != null && l.updateRenderInfo(p, { opacity: u.opacity });
226
+ const A = lt(u, p);
227
+ Object.keys(A).length > 0 && l.updateRenderInfo(p, A), ut(u, m) && l.updateRenderInfo(p, { isColorMap: !0 }), u.isPick && l.updateRenderInfo(p, { isPick: !0 }), u.isSkip && l.updateRenderInfo(p, { isSkip: !0 });
228
+ const { catchAllCategory: b, colorMapDomain: R } = u;
209
229
  let F = y, T = R;
210
- if (d && _ && R?.length) {
230
+ if (d && b && R?.length) {
211
231
  const g = new Set(R);
212
232
  F = {
213
233
  ...y,
214
- features: y.features.map((A) => {
215
- const S = A.properties, v = pt(S, d);
216
- return v == null || !g.has(String(v)) ? { ...A, properties: mt(S, d, _) } : A;
234
+ features: y.features.map((w) => {
235
+ const M = w.properties, v = mt(M, d);
236
+ return v == null || !g.has(String(v)) ? { ...w, properties: dt(M, d, b) } : w;
217
237
  })
218
- }, T = g.has(_) ? R : [...R, _];
238
+ }, T = g.has(b) ? R : [...R, b];
219
239
  }
220
240
  const O = m === "raster" && u.transferFunction != null;
221
241
  O && l.layerManager.searchByLayerId(p)?.setTransferFunction?.(u.transferFunction);
222
- const D = m === "raster" && (u.colorMapCenter != null || u.colorMapReverse === !0);
223
- if (u.colorMapInterpolator || D) {
242
+ const x = m === "raster" && (u.colorMapCenter != null || u.colorMapReverse === !0);
243
+ if (u.colorMapInterpolator || x) {
224
244
  const g = {
225
245
  // urban-grammar ColorMapInterpolator values are string-compatible
226
246
  // with autk-core ColorMapInterpolator at runtime
227
247
  interpolator: u.colorMapInterpolator ?? l.layerManager.searchByLayerId(p)?.layerRenderInfo.colormap.config.interpolator ?? Z.SEQ_REDS,
228
- domainSpec: ft(u.normalization, T)
229
- }, A = D ? ut(y, b) : null, S = A ? ct(A, g, u.colorMapCenter, u.colorMapReverse) : void 0;
230
- S && (g.domainSpec = { type: M.USER, params: S }), l.updateColorMap(p, { colorMap: g });
248
+ domainSpec: pt(u.normalization, T)
249
+ }, w = x ? ct(y, E) : null, M = w ? ft(w, g, u.colorMapCenter, u.colorMapReverse) : void 0;
250
+ M && (g.domainSpec = { type: S.USER, params: M }), l.updateColorMap(p, { colorMap: g });
231
251
  } else O && l.updateColorMap(p, { colorMap: {} });
232
252
  if (d && m !== "raster") {
233
253
  const g = d.startsWith("properties.") ? d : `properties.${d}`;
@@ -238,13 +258,13 @@ function ht(t, e, r, o, i) {
238
258
  return {
239
259
  async resolveMap(l, n, s = 0) {
240
260
  if (t && t.map && l) {
241
- nt(n, s);
261
+ it(n, s);
242
262
  let c;
243
263
  if (Array.isArray(t.map) ? c = document.getElementById(t.map[s]) : c = document.getElementById(t.map), !c)
244
264
  throw new Error("Could not find rendering target for map: " + t.map);
245
265
  if (!(c instanceof HTMLCanvasElement))
246
266
  throw new Error("Target for map is not a canvas: " + t.map);
247
- const u = new q(c);
267
+ const u = new K(c);
248
268
  n.style && u.style.setPredefinedStyle(n.style), await u.init(), await a(u, l, n);
249
269
  for (const f of n.layerRefs)
250
270
  e?.set(f.dataRef, u), i?.set(f.dataRef, B(f));
@@ -253,7 +273,7 @@ function ht(t, e, r, o, i) {
253
273
  }
254
274
  };
255
275
  }
256
- function yt(t) {
276
+ function gt(t) {
257
277
  return {
258
278
  scatter: "scatterplot",
259
279
  bar: "barchart",
@@ -264,7 +284,7 @@ function yt(t) {
264
284
  heatmatrix: "heatmatrix"
265
285
  }[t];
266
286
  }
267
- function gt(t, e, r, o, i, a) {
287
+ function bt(t, e, r, o, i, a) {
268
288
  return {
269
289
  async resolvePlot(l, n) {
270
290
  if (!t || !t.plot) return;
@@ -273,7 +293,7 @@ function gt(t, e, r, o, i, a) {
273
293
  const c = l;
274
294
  if (!c) throw new Error("No data context available for plot.");
275
295
  const u = i?.get(n.dataRef) ?? await c.getLayer(n.dataRef), f = n.events ?? [], p = new z(s, {
276
- type: yt(n.mark),
296
+ type: gt(n.mark),
277
297
  collection: u,
278
298
  attributes: { axis: n.axis, ...n.color && { color: n.color } },
279
299
  labels: { axis: n.axis, title: n.title },
@@ -286,7 +306,7 @@ function gt(t, e, r, o, i, a) {
286
306
  if (r?.set(n.dataRef, p), n.mapRef && o?.set(n.dataRef, n.mapRef), n.mapRef && e) {
287
307
  const m = e.get(n.mapRef), d = a?.get(n.mapRef) ?? n.mapRef;
288
308
  if (m) {
289
- m.updateRenderInfo(d, { isPick: !0 }), m.events.on(P.PICKING, ({ selection: h }) => {
309
+ m.updateRenderInfo(d, { isPick: !0 }), m.events.on(N.PICKING, ({ selection: h }) => {
290
310
  p.setSelection(h);
291
311
  });
292
312
  for (const h of f)
@@ -299,11 +319,11 @@ function gt(t, e, r, o, i, a) {
299
319
  };
300
320
  }
301
321
  const H = 134217728, _t = 4, Et = 32;
302
- function bt(t) {
322
+ function At(t) {
303
323
  return Array.isArray(t) ? t.join(`
304
324
  `) : t;
305
325
  }
306
- function E(t) {
326
+ function _(t) {
307
327
  return !!t && typeof t == "object" && !Array.isArray(t) && typeof t.fromFeature == "object" && t.fromFeature !== null;
308
328
  }
309
329
  function C(t, e) {
@@ -319,79 +339,79 @@ function k(t) {
319
339
  const e = [];
320
340
  for (const r of [t.uniforms, t.uniformMatrices])
321
341
  for (const o of Object.values(r ?? {}))
322
- E(o) && e.push(o);
342
+ _(o) && e.push(o);
323
343
  return e;
324
344
  }
325
345
  function wt(t) {
326
346
  return [.../* @__PURE__ */ new Set([t.dataRef, ...k(t).map((e) => e.fromFeature.layer)])];
327
347
  }
328
- function W(t) {
348
+ function q(t) {
329
349
  for (const e of k(t)) {
330
350
  const { iterate: r, layer: o } = e.fromFeature;
331
351
  if (r === "all" || r === "batched") return { mode: r, layer: o };
332
352
  }
333
353
  return null;
334
354
  }
335
- function X(t, e, r) {
355
+ function W(t, e, r) {
336
356
  const o = t.fromFeature, i = r !== void 0 && o.iterate === "all" ? r : o.index ?? 0, a = C(e, o.layer)?.features?.[i];
337
357
  return a ? L(a, o.path) : void 0;
338
358
  }
339
- function j(t, e, r) {
359
+ function G(t, e, r) {
340
360
  if (!t) return;
341
361
  const o = {};
342
362
  for (const [i, a] of Object.entries(t)) {
343
- if (!E(a)) {
363
+ if (!_(a)) {
344
364
  o[i] = a;
345
365
  continue;
346
366
  }
347
- const l = Number(X(a, e, r) ?? NaN);
367
+ const l = Number(W(a, e, r) ?? NaN);
348
368
  Number.isFinite(l) ? o[i] = l : typeof a.default == "number" && (o[i] = a.default);
349
369
  }
350
370
  return o;
351
371
  }
352
- function x(t, e, r) {
372
+ function $(t, e, r) {
353
373
  if (!t) return;
354
374
  const o = {};
355
375
  for (const [i, a] of Object.entries(t)) {
356
- if (!E(a)) {
376
+ if (!_(a)) {
357
377
  o[i] = a;
358
378
  continue;
359
379
  }
360
- const l = X(a, e, r), n = Array.isArray(l) ? l : Array.isArray(a.default) ? a.default : void 0;
380
+ const l = W(a, e, r), n = Array.isArray(l) ? l : Array.isArray(a.default) ? a.default : void 0;
361
381
  if (!n) continue;
362
382
  const s = a.cols ?? (Array.isArray(n[0]) ? n[0].length : 0);
363
383
  s > 0 ? o[i] = { data: n, cols: s } : console.warn(`[autk-grammar] uniform matrix "${i}" has no column count; entry dropped`);
364
384
  }
365
385
  return o;
366
386
  }
367
- function At(t) {
387
+ function Rt(t) {
368
388
  return t != null && !(typeof t == "number" && !Number.isFinite(t));
369
389
  }
370
- function U(t) {
371
- return E(t) && t.fromFeature.iterate === "batched";
390
+ function j(t) {
391
+ return _(t) && t.fromFeature.iterate === "batched";
372
392
  }
373
- function J(t, e) {
374
- return Object.values(e ?? {}).some(U) ? Et : Object.values(t ?? {}).some(U) ? _t : 0;
393
+ function X(t, e) {
394
+ return Object.values(e ?? {}).some(j) ? Et : Object.values(t ?? {}).some(j) ? _t : 0;
375
395
  }
376
- function Rt(t, e, r = H) {
377
- const o = J(t, e);
396
+ function Mt(t, e, r = H) {
397
+ const o = X(t, e);
378
398
  return o > 0 ? Math.floor(r / o) : Number.POSITIVE_INFINITY;
379
399
  }
380
400
  function St(t, e, r, o = H) {
381
401
  const i = {}, a = {}, l = [];
382
402
  for (const s of [t, e])
383
403
  for (const c of Object.values(s ?? {}))
384
- E(c) && c.fromFeature.iterate === "batched" && c.fromFeature.required && l.push(c.fromFeature.path);
404
+ _(c) && c.fromFeature.iterate === "batched" && c.fromFeature.required && l.push(c.fromFeature.path);
385
405
  if (l.length > 0) {
386
406
  const s = r.length;
387
- r = r.filter((c) => l.every((u) => At(L(c, u)))), r.length < s && console.info(`[autk-grammar] batched compute dropped ${s - r.length} feature(s) missing ${l.join(", ")}`);
407
+ r = r.filter((c) => l.every((u) => Rt(L(c, u)))), r.length < s && console.info(`[autk-grammar] batched compute dropped ${s - r.length} feature(s) missing ${l.join(", ")}`);
388
408
  }
389
- const n = Rt(t, e, o);
409
+ const n = Mt(t, e, o);
390
410
  r.length > n && (console.warn(
391
- `[autk-grammar] batched compute capped at ${n} features (got ${r.length}): its largest packed array takes ${J(t, e)} B per feature, and a storage buffer binding holds ${o} B`
411
+ `[autk-grammar] batched compute capped at ${n} features (got ${r.length}): its largest packed array takes ${X(t, e)} B per feature, and a storage buffer binding holds ${o} B`
392
412
  ), r = r.slice(0, n));
393
413
  for (const [s, c] of Object.entries(t ?? {}))
394
- if (E(c) && c.fromFeature.iterate === "batched") {
414
+ if (_(c) && c.fromFeature.iterate === "batched") {
395
415
  const u = typeof c.default == "number" ? c.default : void 0;
396
416
  a[s] = r.map((f) => {
397
417
  const p = Number(L(f, c.fromFeature.path) ?? u);
@@ -399,16 +419,16 @@ function St(t, e, r, o = H) {
399
419
  });
400
420
  } else typeof c == "number" && (i[s] = c);
401
421
  for (const [s, c] of Object.entries(e ?? {})) {
402
- if (!E(c) || c.fromFeature.iterate !== "batched") continue;
422
+ if (!_(c) || c.fromFeature.iterate !== "batched") continue;
403
423
  const u = [];
404
424
  for (const f of r) {
405
425
  const p = L(f, c.fromFeature.path);
406
426
  let m = 1 / 0, d = 1 / 0, h = -1 / 0, y = -1 / 0;
407
427
  if (Array.isArray(p))
408
- for (const b of p) {
409
- if (!Array.isArray(b) || b.length < 2) continue;
410
- const w = Number(b[0]), _ = Number(b[1]);
411
- !Number.isFinite(w) || !Number.isFinite(_) || (m = Math.min(m, w), d = Math.min(d, _), h = Math.max(h, w), y = Math.max(y, _));
428
+ for (const E of p) {
429
+ if (!Array.isArray(E) || E.length < 2) continue;
430
+ const A = Number(E[0]), b = Number(E[1]);
431
+ !Number.isFinite(A) || !Number.isFinite(b) || (m = Math.min(m, A), d = Math.min(d, b), h = Math.max(h, A), y = Math.max(y, b));
412
432
  }
413
433
  Number.isFinite(m) || (m = 0, d = 0, h = 0, y = 0), u.push(m, d, h, d, h, y, m, y);
414
434
  }
@@ -416,43 +436,43 @@ function St(t, e, r, o = H) {
416
436
  }
417
437
  return i.num_features = r.length, { uniforms: i, uniformArrays: a };
418
438
  }
419
- function $(t, e, r) {
439
+ function U(t, e, r) {
420
440
  const o = C(e, t.dataRef);
421
441
  if (!o) throw new Error(`compute: table "${t.dataRef}" is not loaded`);
422
442
  const i = {
423
443
  collection: o,
424
444
  variableMapping: t.attributes,
425
- wgslBody: bt(t.wglsFunction)
445
+ wgslBody: At(t.wglsFunction)
426
446
  };
427
447
  t.attributeArrays && (i.attributeArrays = t.attributeArrays), t.attributeMatrices && (i.attributeMatrices = t.attributeMatrices), t.uniformArrays && (i.uniformArrays = t.uniformArrays), t.outputColumnName && (i.resultField = t.outputColumnName), t.outputColumns && (i.outputColumns = t.outputColumns);
428
- const a = W(t);
448
+ const a = q(t);
429
449
  if (a?.mode === "batched") {
430
- const c = C(e, a.layer)?.features ?? [], u = St(t.uniforms, t.uniformMatrices, c), f = j(Q(t.uniforms), e) ?? {}, p = x(Q(t.uniformMatrices), e);
450
+ const c = C(e, a.layer)?.features ?? [], u = St(t.uniforms, t.uniformMatrices, c), f = G(Q(t.uniforms), e) ?? {}, p = $(Q(t.uniformMatrices), e);
431
451
  return i.uniforms = { ...f, ...u.uniforms }, i.uniformArrays = { ...i.uniformArrays ?? {}, ...u.uniformArrays }, p && Object.keys(p).length > 0 && (i.uniformMatrices = p), i;
432
452
  }
433
- const l = a?.mode === "all" ? r : void 0, n = j(t.uniforms, e, l), s = x(t.uniformMatrices, e, l);
453
+ const l = a?.mode === "all" ? r : void 0, n = G(t.uniforms, e, l), s = $(t.uniformMatrices, e, l);
434
454
  return n && (i.uniforms = n), s && (i.uniformMatrices = s), i;
435
455
  }
436
456
  function Q(t) {
437
457
  if (t)
438
- return Object.fromEntries(Object.entries(t).filter(([, e]) => !(E(e) && e.fromFeature.iterate === "batched")));
458
+ return Object.fromEntries(Object.entries(t).filter(([, e]) => !(_(e) && e.fromFeature.iterate === "batched")));
439
459
  }
440
- function Mt(t) {
460
+ function Ct(t) {
441
461
  return t.outputColumns ?? (t.outputColumnName ? [t.outputColumnName] : []);
442
462
  }
443
- async function Ct(t, e, r) {
444
- const o = W(t);
445
- if (o?.mode !== "all") return r($(t, e));
463
+ async function It(t, e, r) {
464
+ const o = q(t);
465
+ if (o?.mode !== "all") return r(U(t, e));
446
466
  const i = C(e, t.dataRef);
447
467
  if (!i) throw new Error(`compute: table "${t.dataRef}" is not loaded`);
448
- const a = Mt(t), l = structuredClone(i);
468
+ const a = Ct(t), l = structuredClone(i);
449
469
  for (const s of l.features) {
450
470
  const c = s.properties ??= {}, u = c.compute ??= {};
451
471
  for (const f of a) u[f] = 0;
452
472
  }
453
473
  const n = C(e, o.layer)?.features?.length ?? 0;
454
474
  for (let s = 0; s < n; s++) {
455
- const c = await r({ ...$(t, e, s), collection: l });
475
+ const c = await r({ ...U(t, e, s), collection: l });
456
476
  l.features.forEach((u, f) => {
457
477
  const p = u.properties?.compute, m = c.features[f]?.properties?.compute;
458
478
  if (!(!p || !m))
@@ -464,7 +484,7 @@ async function Ct(t, e, r) {
464
484
  }
465
485
  return l;
466
486
  }
467
- function It(t) {
487
+ function Lt(t) {
468
488
  return {
469
489
  async resolveCompute(e, r) {
470
490
  if (e) {
@@ -480,13 +500,13 @@ function It(t) {
480
500
  o[l] = void 0;
481
501
  }
482
502
  }
483
- const i = new tt(), a = await Ct(r, o, (l) => i.gpgpuPipeline(l));
503
+ const i = new tt(), a = await It(r, o, (l) => i.gpgpuPipeline(l));
484
504
  return t && t.set(r.dataRef, a), e;
485
505
  }
486
506
  }
487
507
  };
488
508
  }
489
- class Lt {
509
+ class vt {
490
510
  _listeners = /* @__PURE__ */ new Map();
491
511
  on(e, r) {
492
512
  this._listeners.has(e) || this._listeners.set(e, /* @__PURE__ */ new Set());
@@ -498,7 +518,7 @@ class Lt {
498
518
  this._listeners.get(e)?.forEach((o) => o(r));
499
519
  }
500
520
  }
501
- class Tt {
521
+ class Ot {
502
522
  dataAdapter;
503
523
  mapAdapter;
504
524
  plotAdapter;
@@ -512,10 +532,10 @@ class Tt {
512
532
  _plotRegistry = /* @__PURE__ */ new Map();
513
533
  _fwdCleanups = [];
514
534
  _plotMapLinks = /* @__PURE__ */ new Map();
515
- interactions = new Lt();
535
+ interactions = new vt();
516
536
  constructor(e) {
517
537
  const r = /* @__PURE__ */ new Map();
518
- this.dataAdapter = at(e, r), this.mapAdapter = ht(e, this._mapRegistry, this._computeCache, this._maps, this._mapLayerIds), this.plotAdapter = gt(e, this._mapRegistry, this._plotRegistry, this._plotMapLinks, r, this._mapLayerIds), this.computeAdapter = It(this._computeCache);
538
+ this.dataAdapter = nt(e, r), this.mapAdapter = yt(e, this._mapRegistry, this._computeCache, this._maps, this._mapLayerIds), this.plotAdapter = bt(e, this._mapRegistry, this._plotRegistry, this._plotMapLinks, r, this._mapLayerIds), this.computeAdapter = Lt(this._computeCache);
519
539
  }
520
540
  /**
521
541
  * The coordinate reference system used internally by the autk workspace.
@@ -638,7 +658,7 @@ class Tt {
638
658
  const i = ({ selection: a }) => {
639
659
  this.interactions.emit("map:picking", { layerId: r, selection: a });
640
660
  };
641
- o.events.on(P.PICKING, i), this._fwdCleanups.push(() => o.events.off(P.PICKING, i));
661
+ o.events.on(N.PICKING, i), this._fwdCleanups.push(() => o.events.off(N.PICKING, i));
642
662
  }
643
663
  for (const [r, o] of this._plotRegistry)
644
664
  for (const i of [I.CLICK, I.BRUSH, I.BRUSH_X, I.BRUSH_Y]) {
@@ -654,21 +674,21 @@ class Tt {
654
674
  }
655
675
  }
656
676
  export {
657
- Tt as AutkGrammar,
677
+ Ot as AutkGrammar,
658
678
  rt as ColorMapInterpolator,
659
- Lt as GrammarEventEmitter,
679
+ vt as GrammarEventEmitter,
660
680
  Y as NormalizationMode,
661
681
  H as STORAGE_BUFFER_BINDING_SIZE,
662
682
  St as buildBatchedUniforms,
663
683
  wt as computeLayerNames,
664
684
  et as createEngine,
665
- W as findIterateSource,
666
- E as isFromFeature,
667
- bt as joinWgsl,
668
- Rt as maxBatchedFeatures,
669
- $ as resolveComputeParams,
670
- x as resolveUniformMatrices,
671
- j as resolveUniforms,
672
- Ct as runCompute
685
+ q as findIterateSource,
686
+ _ as isFromFeature,
687
+ At as joinWgsl,
688
+ Mt as maxBatchedFeatures,
689
+ U as resolveComputeParams,
690
+ $ as resolveUniformMatrices,
691
+ G as resolveUniforms,
692
+ It as runCompute
673
693
  };
674
694
  //# sourceMappingURL=autk-grammar.js.map