@genome-spy/app 0.87.0 → 0.88.1

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.
Files changed (35) hide show
  1. package/dist/{agentApi-BZ1JCo1N.js → agentApi-BIpg3JKh.js} +5365 -5080
  2. package/dist/agentApi.es.js +3160 -2909
  3. package/dist/agentShared.es.js +3 -3
  4. package/dist/{canvas2d-Cafq5v-N.js → canvas2d-BVQ7-2eJ.js} +68 -68
  5. package/dist/{canvas2d-B_PnIof-.js → canvas2d-D7SZK3xv.js} +39 -39
  6. package/dist/{clipOptions-H68pJyEZ.js → clipOptions-BWHr3aTa.js} +822 -768
  7. package/dist/{clipOptions-D6eh9T-_.js → clipOptions-DTMcB_9z.js} +547 -493
  8. package/dist/{debug-BGzgZmyk.js → debug-CVpoEOWx.js} +2 -2
  9. package/dist/{debug-UYKZLNh4.js → debug-DYAMZZKl.js} +2 -2
  10. package/dist/index.es.js +3390 -3410
  11. package/dist/index.js +395 -374
  12. package/dist/{indexer-Di57GyxX.js → indexer-CXjZDo2Q.js} +1 -1
  13. package/dist/{indexer-o6Hpg4nN.js → indexer-DAH_ruVn.js} +1 -1
  14. package/dist/{nativeText-DAjvkrzc.js → order-C5CzA37O.js} +271 -287
  15. package/dist/{nativeText-D9SoxpaD.js → order-DvY7KNcu.js} +271 -287
  16. package/dist/{rasterExport-DzldLv6E.js → rasterExport-BgZ98e6U.js} +1 -1
  17. package/dist/{rasterExport-IAbJwi8F.js → rasterExport-DEr8fOLm.js} +1 -1
  18. package/dist/{renderCanvas2D-yJ1IrDcX.js → renderCanvas2D-DtcJjqpB.js} +57 -50
  19. package/dist/{renderCanvas2D-BJ93Ptqj.js → renderCanvas2D-DxturTEW.js} +62 -55
  20. package/dist/schema.json +756 -96
  21. package/dist/{svg-DJuqHIyc.js → svg-CyrLfa9e.js} +364 -357
  22. package/dist/{svg-BRpl2Xub.js → svg-SDJMzL--.js} +338 -331
  23. package/dist/{svgRasterizer-PAoqLn1j.js → svgRasterizer-f7DJ3UO0.js} +1 -1
  24. package/dist/{svgRasterizer-CGZQ5njV.js → svgRasterizer-mWK7HTkx.js} +1 -1
  25. package/dist/{vega-scale-BGC53c22.js → vega-scale-CypF85iS.js} +801 -801
  26. package/dist/{vega-scale-DdW2NzQ3.js → vega-scale-DLKCwWRs.js} +65 -65
  27. package/dist/{viewIdentityRegistry-Dc2hXYsO.js → viewIdentityRegistry-DIDo44XQ.js} +1 -1
  28. package/dist/{viewIdentityRegistry-D4p067HU.js → viewIdentityRegistry-Dl-vMN9I.js} +1 -1
  29. package/dist/{viewSelectors-DNXnGwEW.js → viewSelectors-CymbZyE6.js} +375 -340
  30. package/dist/{viewSelectors-DYYlOt91.js → viewSelectors-DNiDip5e.js} +370 -335
  31. package/dist/{viewUtils-EdhZTPrJ.js → viewUtils-BrJLIj2o.js} +1750 -1716
  32. package/dist/{webgl-C53DwzVT.js → webgl-CTJt7jQd.js} +1019 -983
  33. package/dist/{webgl-CdgNFlJk.js → webgl-tZfZ8y3q.js} +1200 -1164
  34. package/package.json +5 -5
  35. package/src/embedTypes.d.ts +1 -1
@@ -1,6 +1,6 @@
1
- import { $ as e, Bt as t, E as n, F as r, Ht as i, L as a, Vt as o, Wt as s, X as c, an as l, at as u, b as d, bt as f, ct as p, d as m, dn as h, dt as g, ft as _, mt as v, n as ee, o as y, ot as b, pt as te, rn as ne, rt as x, s as re, sn as ie, tt as ae, ut as S, z as oe, zt as se } from "./clipOptions-H68pJyEZ.js";
2
- import { T as ce, b as C, g as le, it as ue, v as w, x as de, y as fe } from "./vega-scale-BGC53c22.js";
3
- import { i as pe, n as me, p as he, r as ge, t as _e } from "./indexer-o6Hpg4nN.js";
1
+ import { A as e, E as t, Gt as n, H as r, Kt as i, L as a, Tt as o, Wt as s, Yt as c, _t as l, b as u, cn as d, ct as f, d as p, dt as m, et as h, fn as g, gn as _, gt as v, ht as y, it as b, n as x, o as ee, ot as S, pt as te, qt as C, s as ne, un as re, ut as ie, vt as ae, yt as oe, z as se } from "./clipOptions-BWHr3aTa.js";
2
+ import { T as ce, b as w, g as le, it as ue, v as T, x as de, y as fe } from "./vega-scale-CypF85iS.js";
3
+ import { i as pe, n as me, p as he, r as ge, t as _e } from "./indexer-DAH_ruVn.js";
4
4
  import { n as ve, t as ye } from "./viewError-BiR9VCgL.js";
5
5
  import { t as be } from "./rectangle-DKnrAmKs.js";
6
6
  import { n as xe, r as Se } from "./performanceProfiler-CPLEjApa.js";
@@ -61,13 +61,13 @@ function et(e, t) {
61
61
  function tt(e, t) {
62
62
  return typeof WebGLSampler < "u" && t instanceof WebGLSampler;
63
63
  }
64
- var nt = 35044, T = 34962, rt = 34963, it = 34660, at = 5120, ot = 5121, st = 5122, ct = 5123, lt = 5124, ut = 5125, dt = 5126, ft = { attribPrefix: "" };
64
+ var nt = 35044, E = 34962, rt = 34963, it = 34660, at = 5120, ot = 5121, st = 5122, ct = 5123, lt = 5124, ut = 5125, dt = 5126, ft = { attribPrefix: "" };
65
65
  function pt(e, t, n, r, i) {
66
66
  e.bindBuffer(t, n), e.bufferData(t, r, i || nt);
67
67
  }
68
68
  function mt(e, t, n, r) {
69
69
  if (Qe(e, t)) return t;
70
- n ||= T;
70
+ n ||= E;
71
71
  let i = e.createBuffer();
72
72
  return pt(e, n, i, t, r), i;
73
73
  }
@@ -112,7 +112,7 @@ function wt(e, t) {
112
112
  if (i.buffer && i.buffer instanceof WebGLBuffer) t = i.buffer, c = i.numComponents || i.size, o = i.type, s = i.normalize;
113
113
  else if (typeof i == "number" || typeof i.data == "number") {
114
114
  let n = i.data || i, a = i.type || Float32Array, l = n * a.BYTES_PER_ELEMENT;
115
- o = qe(a), s = i.normalize === void 0 ? _t(a) : i.normalize, c = i.numComponents || i.size || xt(r, n), t = e.createBuffer(), e.bindBuffer(T, t), e.bufferData(T, l, i.drawType || nt);
115
+ o = qe(a), s = i.normalize === void 0 ? _t(a) : i.normalize, c = i.numComponents || i.size || xt(r, n), t = e.createBuffer(), e.bindBuffer(E, t), e.bufferData(E, l, i.drawType || nt);
116
116
  } else {
117
117
  let n = Ct(i, r);
118
118
  t = mt(e, n, void 0, i.drawType), o = Ke(n), s = i.normalize === void 0 ? gt(n) : i.normalize, c = St(i, r);
@@ -129,10 +129,10 @@ function wt(e, t) {
129
129
  };
130
130
  }
131
131
  }
132
- }), e.bindBuffer(T, null), n;
132
+ }), e.bindBuffer(E, null), n;
133
133
  }
134
134
  function Tt(e, t, n, r) {
135
- n = Ct(n), r === void 0 ? pt(e, T, t.buffer, n, t.drawType) : (e.bindBuffer(T, t.buffer), e.bufferSubData(T, r, n));
135
+ n = Ct(n), r === void 0 ? pt(e, E, t.buffer, n, t.drawType) : (e.bindBuffer(E, t.buffer), e.bufferSubData(E, r, n));
136
136
  }
137
137
  function Et(e, t) {
138
138
  return t === at || t === ot ? 1 : t === st || t === ct ? 2 : t === lt || t === ut || t === dt ? 4 : 0;
@@ -148,9 +148,9 @@ function Ot(e, t) {
148
148
  r === Dt.length && (n = Object.keys(t)[0]);
149
149
  let i = t[n];
150
150
  if (!i.buffer) return 1;
151
- e.bindBuffer(T, i.buffer);
152
- let a = e.getBufferParameter(T, it);
153
- e.bindBuffer(T, null);
151
+ e.bindBuffer(E, i.buffer);
152
+ let a = e.getBufferParameter(E, it);
153
+ e.bindBuffer(E, null);
154
154
  let o = a / Et(e, i.type), s = i.numComponents || i.size, c = o / s;
155
155
  if (c % 1 != 0) throw Error(`numComponents ${s} not correct for length ${length}`);
156
156
  return c;
@@ -165,10 +165,10 @@ function kt(e, t, n) {
165
165
  } else i.numElements ||= Ot(e, i.attribs);
166
166
  return i;
167
167
  }
168
- function E(e) {
168
+ function At(e) {
169
169
  return !!e.texStorage2D;
170
170
  }
171
- var At = function() {
171
+ var jt = function() {
172
172
  let e = {}, t = {};
173
173
  function n(n) {
174
174
  let r = n.constructor.name;
@@ -192,22 +192,22 @@ var At = function() {
192
192
  ]),
193
193
  textureOptions: {},
194
194
  crossOrigin: void 0
195
- }, jt = Ye, Mt = function() {
195
+ }, Mt = Ye, Nt = function() {
196
196
  let e;
197
197
  return function() {
198
198
  return e ||= typeof document < "u" && document.createElement ? document.createElement("canvas").getContext("2d") : null, e;
199
199
  };
200
- }(), Nt = 6406, O = 6407, k = 6408, Pt = 6409, Ft = 6410, It = 6402, Lt = 34041, Rt = 33071, zt = 9728, Bt = 9729, A = 3553, j = 34067, M = 32879, N = 35866, Vt = 34069, Ht = 34070, Ut = 34071, Wt = 34072, Gt = 34073, Kt = 34074, qt = 10241, Jt = 10240, Yt = 10242, Xt = 10243, Zt = 32882, Qt = 33082, $t = 33083, en = 33084, tn = 33085, nn = 3317, rn = 3314, an = 32878, on = 3316, sn = 3315, cn = 32877, ln = 37443, un = 37441, dn = 37440, fn = 33321, pn = 36756, mn = 33325, hn = 33326, gn = 33330, _n = 33329, vn = 33338, yn = 33337, bn = 33340, xn = 33339, Sn = 33323, Cn = 36757, wn = 33327, Tn = 33328, En = 33336, Dn = 33335, On = 33332, kn = 33331, An = 33334, jn = 33333, Mn = 32849, Nn = 35905, Pn = 36194, Fn = 36758, In = 35898, Ln = 35901, Rn = 34843, zn = 34837, Bn = 36221, Vn = 36239, Hn = 36215, Un = 36233, Wn = 36209, Gn = 36227, Kn = 32856, qn = 35907, Jn = 36759, Yn = 32855, Xn = 32854, Zn = 32857, Qn = 34842, $n = 34836, er = 36220, tr = 36238, nr = 36975, rr = 36214, ir = 36232, ar = 36226, or = 36208, sr = 33189, cr = 33190, lr = 36012, ur = 36013, dr = 35056, P = 5120, F = 5121, fr = 5122, pr = 5123, mr = 5124, I = 5125, L = 5126, hr = 32819, gr = 32820, _r = 33635, R = 5131, vr = 36193, yr = 33640, br = 35899, xr = 35902, Sr = 36269, Cr = 34042, wr = 33319, z = 33320, Tr = 6403, B = 36244, V = 36248, H = 36249, Er = {};
200
+ }(), Pt = 6406, O = 6407, k = 6408, Ft = 6409, It = 6410, Lt = 6402, Rt = 34041, zt = 33071, Bt = 9728, Vt = 9729, A = 3553, j = 34067, M = 32879, N = 35866, Ht = 34069, Ut = 34070, Wt = 34071, Gt = 34072, Kt = 34073, qt = 34074, Jt = 10241, Yt = 10240, Xt = 10242, Zt = 10243, Qt = 32882, $t = 33082, en = 33083, tn = 33084, nn = 33085, rn = 3317, an = 3314, on = 32878, sn = 3316, cn = 3315, ln = 32877, un = 37443, dn = 37441, fn = 37440, pn = 33321, mn = 36756, hn = 33325, gn = 33326, _n = 33330, vn = 33329, yn = 33338, bn = 33337, xn = 33340, Sn = 33339, Cn = 33323, wn = 36757, Tn = 33327, En = 33328, Dn = 33336, On = 33335, kn = 33332, An = 33331, jn = 33334, Mn = 33333, Nn = 32849, Pn = 35905, Fn = 36194, In = 36758, Ln = 35898, Rn = 35901, zn = 34843, Bn = 34837, Vn = 36221, Hn = 36239, Un = 36215, Wn = 36233, Gn = 36209, Kn = 36227, qn = 32856, Jn = 35907, Yn = 36759, Xn = 32855, Zn = 32854, Qn = 32857, $n = 34842, er = 34836, tr = 36220, nr = 36238, rr = 36975, ir = 36214, ar = 36232, or = 36226, sr = 36208, cr = 33189, lr = 33190, ur = 36012, dr = 36013, fr = 35056, P = 5120, F = 5121, pr = 5122, mr = 5123, hr = 5124, I = 5125, L = 5126, gr = 32819, _r = 32820, vr = 33635, R = 5131, yr = 36193, br = 33640, xr = 35899, Sr = 35902, Cr = 36269, wr = 34042, Tr = 33319, z = 33320, Er = 6403, B = 36244, V = 36248, H = 36249, Dr = {};
201
201
  {
202
- let e = Er;
203
- e[Nt] = { numColorComponents: 1 }, e[Pt] = { numColorComponents: 1 }, e[Ft] = { numColorComponents: 2 }, e[O] = { numColorComponents: 3 }, e[k] = { numColorComponents: 4 }, e[Tr] = { numColorComponents: 1 }, e[B] = { numColorComponents: 1 }, e[wr] = { numColorComponents: 2 }, e[z] = { numColorComponents: 2 }, e[O] = { numColorComponents: 3 }, e[V] = { numColorComponents: 3 }, e[k] = { numColorComponents: 4 }, e[H] = { numColorComponents: 4 }, e[It] = { numColorComponents: 1 }, e[Lt] = { numColorComponents: 2 };
202
+ let e = Dr;
203
+ e[Pt] = { numColorComponents: 1 }, e[Ft] = { numColorComponents: 1 }, e[It] = { numColorComponents: 2 }, e[O] = { numColorComponents: 3 }, e[k] = { numColorComponents: 4 }, e[Er] = { numColorComponents: 1 }, e[B] = { numColorComponents: 1 }, e[Tr] = { numColorComponents: 2 }, e[z] = { numColorComponents: 2 }, e[O] = { numColorComponents: 3 }, e[V] = { numColorComponents: 3 }, e[k] = { numColorComponents: 4 }, e[H] = { numColorComponents: 4 }, e[Lt] = { numColorComponents: 1 }, e[Rt] = { numColorComponents: 2 };
204
204
  }
205
- var Dr;
206
- function Or(e) {
207
- if (!Dr) {
205
+ var Or;
206
+ function kr(e) {
207
+ if (!Or) {
208
208
  let e = {};
209
- e[Nt] = {
210
- textureFormat: Nt,
209
+ e[Pt] = {
210
+ textureFormat: Pt,
211
211
  colorRenderable: !0,
212
212
  textureFilterable: !0,
213
213
  bytesPerElement: [
@@ -219,11 +219,11 @@ function Or(e) {
219
219
  type: [
220
220
  F,
221
221
  R,
222
- vr,
222
+ yr,
223
223
  L
224
224
  ]
225
- }, e[Pt] = {
226
- textureFormat: Pt,
225
+ }, e[Ft] = {
226
+ textureFormat: Ft,
227
227
  colorRenderable: !0,
228
228
  textureFilterable: !0,
229
229
  bytesPerElement: [
@@ -235,11 +235,11 @@ function Or(e) {
235
235
  type: [
236
236
  F,
237
237
  R,
238
- vr,
238
+ yr,
239
239
  L
240
240
  ]
241
- }, e[Ft] = {
242
- textureFormat: Ft,
241
+ }, e[It] = {
242
+ textureFormat: It,
243
243
  colorRenderable: !0,
244
244
  textureFilterable: !0,
245
245
  bytesPerElement: [
@@ -251,7 +251,7 @@ function Or(e) {
251
251
  type: [
252
252
  F,
253
253
  R,
254
- vr,
254
+ yr,
255
255
  L
256
256
  ]
257
257
  }, e[O] = {
@@ -268,9 +268,9 @@ function Or(e) {
268
268
  type: [
269
269
  F,
270
270
  R,
271
- vr,
271
+ yr,
272
272
  L,
273
- _r
273
+ vr
274
274
  ]
275
275
  }, e[k] = {
276
276
  textureFormat: k,
@@ -287,162 +287,162 @@ function Or(e) {
287
287
  type: [
288
288
  F,
289
289
  R,
290
- vr,
290
+ yr,
291
291
  L,
292
- hr,
293
- gr
292
+ gr,
293
+ _r
294
294
  ]
295
- }, e[It] = {
296
- textureFormat: It,
295
+ }, e[Lt] = {
296
+ textureFormat: Lt,
297
297
  colorRenderable: !0,
298
298
  textureFilterable: !1,
299
299
  bytesPerElement: [2, 4],
300
- type: [I, pr]
301
- }, e[fn] = {
302
- textureFormat: Tr,
300
+ type: [I, mr]
301
+ }, e[pn] = {
302
+ textureFormat: Er,
303
303
  colorRenderable: !0,
304
304
  textureFilterable: !0,
305
305
  bytesPerElement: [1],
306
306
  type: [F]
307
- }, e[pn] = {
308
- textureFormat: Tr,
307
+ }, e[mn] = {
308
+ textureFormat: Er,
309
309
  colorRenderable: !1,
310
310
  textureFilterable: !0,
311
311
  bytesPerElement: [1],
312
312
  type: [P]
313
- }, e[mn] = {
314
- textureFormat: Tr,
313
+ }, e[hn] = {
314
+ textureFormat: Er,
315
315
  colorRenderable: !1,
316
316
  textureFilterable: !0,
317
317
  bytesPerElement: [4, 2],
318
318
  type: [L, R]
319
- }, e[hn] = {
320
- textureFormat: Tr,
319
+ }, e[gn] = {
320
+ textureFormat: Er,
321
321
  colorRenderable: !1,
322
322
  textureFilterable: !1,
323
323
  bytesPerElement: [4],
324
324
  type: [L]
325
- }, e[gn] = {
325
+ }, e[_n] = {
326
326
  textureFormat: B,
327
327
  colorRenderable: !0,
328
328
  textureFilterable: !1,
329
329
  bytesPerElement: [1],
330
330
  type: [F]
331
- }, e[_n] = {
331
+ }, e[vn] = {
332
332
  textureFormat: B,
333
333
  colorRenderable: !0,
334
334
  textureFilterable: !1,
335
335
  bytesPerElement: [1],
336
336
  type: [P]
337
- }, e[On] = {
337
+ }, e[kn] = {
338
338
  textureFormat: B,
339
339
  colorRenderable: !0,
340
340
  textureFilterable: !1,
341
341
  bytesPerElement: [2],
342
- type: [pr]
343
- }, e[kn] = {
342
+ type: [mr]
343
+ }, e[An] = {
344
344
  textureFormat: B,
345
345
  colorRenderable: !0,
346
346
  textureFilterable: !1,
347
347
  bytesPerElement: [2],
348
- type: [fr]
349
- }, e[An] = {
348
+ type: [pr]
349
+ }, e[jn] = {
350
350
  textureFormat: B,
351
351
  colorRenderable: !0,
352
352
  textureFilterable: !1,
353
353
  bytesPerElement: [4],
354
354
  type: [I]
355
- }, e[jn] = {
355
+ }, e[Mn] = {
356
356
  textureFormat: B,
357
357
  colorRenderable: !0,
358
358
  textureFilterable: !1,
359
359
  bytesPerElement: [4],
360
- type: [mr]
361
- }, e[Sn] = {
362
- textureFormat: wr,
360
+ type: [hr]
361
+ }, e[Cn] = {
362
+ textureFormat: Tr,
363
363
  colorRenderable: !0,
364
364
  textureFilterable: !0,
365
365
  bytesPerElement: [2],
366
366
  type: [F]
367
- }, e[Cn] = {
368
- textureFormat: wr,
367
+ }, e[wn] = {
368
+ textureFormat: Tr,
369
369
  colorRenderable: !1,
370
370
  textureFilterable: !0,
371
371
  bytesPerElement: [2],
372
372
  type: [P]
373
- }, e[wn] = {
374
- textureFormat: wr,
373
+ }, e[Tn] = {
374
+ textureFormat: Tr,
375
375
  colorRenderable: !1,
376
376
  textureFilterable: !0,
377
377
  bytesPerElement: [8, 4],
378
378
  type: [L, R]
379
- }, e[Tn] = {
380
- textureFormat: wr,
379
+ }, e[En] = {
380
+ textureFormat: Tr,
381
381
  colorRenderable: !1,
382
382
  textureFilterable: !1,
383
383
  bytesPerElement: [8],
384
384
  type: [L]
385
- }, e[En] = {
385
+ }, e[Dn] = {
386
386
  textureFormat: z,
387
387
  colorRenderable: !0,
388
388
  textureFilterable: !1,
389
389
  bytesPerElement: [2],
390
390
  type: [F]
391
- }, e[Dn] = {
391
+ }, e[On] = {
392
392
  textureFormat: z,
393
393
  colorRenderable: !0,
394
394
  textureFilterable: !1,
395
395
  bytesPerElement: [2],
396
396
  type: [P]
397
- }, e[vn] = {
397
+ }, e[yn] = {
398
398
  textureFormat: z,
399
399
  colorRenderable: !0,
400
400
  textureFilterable: !1,
401
401
  bytesPerElement: [4],
402
- type: [pr]
403
- }, e[yn] = {
402
+ type: [mr]
403
+ }, e[bn] = {
404
404
  textureFormat: z,
405
405
  colorRenderable: !0,
406
406
  textureFilterable: !1,
407
407
  bytesPerElement: [4],
408
- type: [fr]
409
- }, e[bn] = {
408
+ type: [pr]
409
+ }, e[xn] = {
410
410
  textureFormat: z,
411
411
  colorRenderable: !0,
412
412
  textureFilterable: !1,
413
413
  bytesPerElement: [8],
414
414
  type: [I]
415
- }, e[xn] = {
415
+ }, e[Sn] = {
416
416
  textureFormat: z,
417
417
  colorRenderable: !0,
418
418
  textureFilterable: !1,
419
419
  bytesPerElement: [8],
420
- type: [mr]
421
- }, e[Mn] = {
420
+ type: [hr]
421
+ }, e[Nn] = {
422
422
  textureFormat: O,
423
423
  colorRenderable: !0,
424
424
  textureFilterable: !0,
425
425
  bytesPerElement: [3],
426
426
  type: [F]
427
- }, e[Nn] = {
427
+ }, e[Pn] = {
428
428
  textureFormat: O,
429
429
  colorRenderable: !1,
430
430
  textureFilterable: !0,
431
431
  bytesPerElement: [3],
432
432
  type: [F]
433
- }, e[Pn] = {
433
+ }, e[Fn] = {
434
434
  textureFormat: O,
435
435
  colorRenderable: !0,
436
436
  textureFilterable: !0,
437
437
  bytesPerElement: [3, 2],
438
- type: [F, _r]
439
- }, e[Fn] = {
438
+ type: [F, vr]
439
+ }, e[In] = {
440
440
  textureFormat: O,
441
441
  colorRenderable: !1,
442
442
  textureFilterable: !0,
443
443
  bytesPerElement: [3],
444
444
  type: [P]
445
- }, e[In] = {
445
+ }, e[Ln] = {
446
446
  textureFormat: O,
447
447
  colorRenderable: !1,
448
448
  textureFilterable: !0,
@@ -454,9 +454,9 @@ function Or(e) {
454
454
  type: [
455
455
  L,
456
456
  R,
457
- br
457
+ xr
458
458
  ]
459
- }, e[Ln] = {
459
+ }, e[Rn] = {
460
460
  textureFormat: O,
461
461
  colorRenderable: !1,
462
462
  textureFilterable: !0,
@@ -468,75 +468,75 @@ function Or(e) {
468
468
  type: [
469
469
  L,
470
470
  R,
471
- xr
471
+ Sr
472
472
  ]
473
- }, e[Rn] = {
473
+ }, e[zn] = {
474
474
  textureFormat: O,
475
475
  colorRenderable: !1,
476
476
  textureFilterable: !0,
477
477
  bytesPerElement: [12, 6],
478
478
  type: [L, R]
479
- }, e[zn] = {
479
+ }, e[Bn] = {
480
480
  textureFormat: O,
481
481
  colorRenderable: !1,
482
482
  textureFilterable: !1,
483
483
  bytesPerElement: [12],
484
484
  type: [L]
485
- }, e[Bn] = {
485
+ }, e[Vn] = {
486
486
  textureFormat: V,
487
487
  colorRenderable: !1,
488
488
  textureFilterable: !1,
489
489
  bytesPerElement: [3],
490
490
  type: [F]
491
- }, e[Vn] = {
491
+ }, e[Hn] = {
492
492
  textureFormat: V,
493
493
  colorRenderable: !1,
494
494
  textureFilterable: !1,
495
495
  bytesPerElement: [3],
496
496
  type: [P]
497
- }, e[Hn] = {
497
+ }, e[Un] = {
498
498
  textureFormat: V,
499
499
  colorRenderable: !1,
500
500
  textureFilterable: !1,
501
501
  bytesPerElement: [6],
502
- type: [pr]
503
- }, e[Un] = {
502
+ type: [mr]
503
+ }, e[Wn] = {
504
504
  textureFormat: V,
505
505
  colorRenderable: !1,
506
506
  textureFilterable: !1,
507
507
  bytesPerElement: [6],
508
- type: [fr]
509
- }, e[Wn] = {
508
+ type: [pr]
509
+ }, e[Gn] = {
510
510
  textureFormat: V,
511
511
  colorRenderable: !1,
512
512
  textureFilterable: !1,
513
513
  bytesPerElement: [12],
514
514
  type: [I]
515
- }, e[Gn] = {
515
+ }, e[Kn] = {
516
516
  textureFormat: V,
517
517
  colorRenderable: !1,
518
518
  textureFilterable: !1,
519
519
  bytesPerElement: [12],
520
- type: [mr]
521
- }, e[Kn] = {
520
+ type: [hr]
521
+ }, e[qn] = {
522
522
  textureFormat: k,
523
523
  colorRenderable: !0,
524
524
  textureFilterable: !0,
525
525
  bytesPerElement: [4],
526
526
  type: [F]
527
- }, e[qn] = {
527
+ }, e[Jn] = {
528
528
  textureFormat: k,
529
529
  colorRenderable: !0,
530
530
  textureFilterable: !0,
531
531
  bytesPerElement: [4],
532
532
  type: [F]
533
- }, e[Jn] = {
533
+ }, e[Yn] = {
534
534
  textureFormat: k,
535
535
  colorRenderable: !1,
536
536
  textureFilterable: !0,
537
537
  bytesPerElement: [4],
538
538
  type: [P]
539
- }, e[Yn] = {
539
+ }, e[Xn] = {
540
540
  textureFormat: k,
541
541
  colorRenderable: !0,
542
542
  textureFilterable: !0,
@@ -547,148 +547,148 @@ function Or(e) {
547
547
  ],
548
548
  type: [
549
549
  F,
550
- gr,
551
- yr
550
+ _r,
551
+ br
552
552
  ]
553
- }, e[Xn] = {
553
+ }, e[Zn] = {
554
554
  textureFormat: k,
555
555
  colorRenderable: !0,
556
556
  textureFilterable: !0,
557
557
  bytesPerElement: [4, 2],
558
- type: [F, hr]
559
- }, e[Zn] = {
558
+ type: [F, gr]
559
+ }, e[Qn] = {
560
560
  textureFormat: k,
561
561
  colorRenderable: !0,
562
562
  textureFilterable: !0,
563
563
  bytesPerElement: [4],
564
- type: [yr]
565
- }, e[Qn] = {
564
+ type: [br]
565
+ }, e[$n] = {
566
566
  textureFormat: k,
567
567
  colorRenderable: !1,
568
568
  textureFilterable: !0,
569
569
  bytesPerElement: [16, 8],
570
570
  type: [L, R]
571
- }, e[$n] = {
571
+ }, e[er] = {
572
572
  textureFormat: k,
573
573
  colorRenderable: !1,
574
574
  textureFilterable: !1,
575
575
  bytesPerElement: [16],
576
576
  type: [L]
577
- }, e[er] = {
577
+ }, e[tr] = {
578
578
  textureFormat: H,
579
579
  colorRenderable: !0,
580
580
  textureFilterable: !1,
581
581
  bytesPerElement: [4],
582
582
  type: [F]
583
- }, e[tr] = {
583
+ }, e[nr] = {
584
584
  textureFormat: H,
585
585
  colorRenderable: !0,
586
586
  textureFilterable: !1,
587
587
  bytesPerElement: [4],
588
588
  type: [P]
589
- }, e[nr] = {
589
+ }, e[rr] = {
590
590
  textureFormat: H,
591
591
  colorRenderable: !0,
592
592
  textureFilterable: !1,
593
593
  bytesPerElement: [4],
594
- type: [yr]
595
- }, e[rr] = {
594
+ type: [br]
595
+ }, e[ir] = {
596
596
  textureFormat: H,
597
597
  colorRenderable: !0,
598
598
  textureFilterable: !1,
599
599
  bytesPerElement: [8],
600
- type: [pr]
601
- }, e[ir] = {
600
+ type: [mr]
601
+ }, e[ar] = {
602
602
  textureFormat: H,
603
603
  colorRenderable: !0,
604
604
  textureFilterable: !1,
605
605
  bytesPerElement: [8],
606
- type: [fr]
607
- }, e[ar] = {
606
+ type: [pr]
607
+ }, e[or] = {
608
608
  textureFormat: H,
609
609
  colorRenderable: !0,
610
610
  textureFilterable: !1,
611
611
  bytesPerElement: [16],
612
- type: [mr]
613
- }, e[or] = {
612
+ type: [hr]
613
+ }, e[sr] = {
614
614
  textureFormat: H,
615
615
  colorRenderable: !0,
616
616
  textureFilterable: !1,
617
617
  bytesPerElement: [16],
618
618
  type: [I]
619
- }, e[sr] = {
620
- textureFormat: It,
619
+ }, e[cr] = {
620
+ textureFormat: Lt,
621
621
  colorRenderable: !0,
622
622
  textureFilterable: !1,
623
623
  bytesPerElement: [2, 4],
624
- type: [pr, I]
625
- }, e[cr] = {
626
- textureFormat: It,
624
+ type: [mr, I]
625
+ }, e[lr] = {
626
+ textureFormat: Lt,
627
627
  colorRenderable: !0,
628
628
  textureFilterable: !1,
629
629
  bytesPerElement: [4],
630
630
  type: [I]
631
- }, e[lr] = {
632
- textureFormat: It,
631
+ }, e[ur] = {
632
+ textureFormat: Lt,
633
633
  colorRenderable: !0,
634
634
  textureFilterable: !1,
635
635
  bytesPerElement: [4],
636
636
  type: [L]
637
- }, e[dr] = {
638
- textureFormat: Lt,
637
+ }, e[fr] = {
638
+ textureFormat: Rt,
639
639
  colorRenderable: !0,
640
640
  textureFilterable: !1,
641
641
  bytesPerElement: [4],
642
- type: [Cr]
643
- }, e[ur] = {
644
- textureFormat: Lt,
642
+ type: [wr]
643
+ }, e[dr] = {
644
+ textureFormat: Rt,
645
645
  colorRenderable: !0,
646
646
  textureFilterable: !1,
647
647
  bytesPerElement: [4],
648
- type: [Sr]
648
+ type: [Cr]
649
649
  }, Object.keys(e).forEach(function(t) {
650
650
  let n = e[t];
651
651
  n.bytesPerElementMap = {}, n.bytesPerElement.forEach(function(e, t) {
652
652
  let r = n.type[t];
653
653
  n.bytesPerElementMap[r] = e;
654
654
  });
655
- }), Dr = e;
655
+ }), Or = e;
656
656
  }
657
- return Dr[e];
657
+ return Or[e];
658
658
  }
659
- function kr(e, t) {
660
- let n = Or(e);
659
+ function Ar(e, t) {
660
+ let n = kr(e);
661
661
  if (!n) throw "unknown internal format";
662
662
  let r = n.bytesPerElementMap[t];
663
663
  if (r === void 0) throw "unknown internal format";
664
664
  return r;
665
665
  }
666
- function Ar(e) {
667
- let t = Or(e);
666
+ function jr(e) {
667
+ let t = kr(e);
668
668
  if (!t) throw "unknown internal format";
669
669
  return {
670
670
  format: t.textureFormat,
671
671
  type: t.type[0]
672
672
  };
673
673
  }
674
- function jr(e) {
674
+ function Mr(e) {
675
675
  return (e & e - 1) == 0;
676
676
  }
677
- function Mr(e, t, n, r) {
678
- if (!E(e)) return jr(t) && jr(n);
679
- let i = Or(r);
677
+ function Nr(e, t, n, r) {
678
+ if (!At(e)) return Mr(t) && Mr(n);
679
+ let i = kr(r);
680
680
  if (!i) throw "unknown internal format";
681
681
  return i.colorRenderable && i.textureFilterable;
682
682
  }
683
- function Nr(e) {
684
- let t = Or(e);
683
+ function Pr(e) {
684
+ let t = kr(e);
685
685
  if (!t) throw "unknown internal format";
686
686
  return t.textureFilterable;
687
687
  }
688
- function Pr(e, t, n) {
689
- return jt(t) ? Ke(t) : n || F;
688
+ function Fr(e, t, n) {
689
+ return Mt(t) ? Ke(t) : n || F;
690
690
  }
691
- function Fr(e, t, n, r, i) {
691
+ function Ir(e, t, n, r, i) {
692
692
  if (i % 1 != 0) throw "can't guess dimensions";
693
693
  if (!n && !r) {
694
694
  let e = Math.sqrt(i / (t === j ? 6 : 1));
@@ -701,51 +701,51 @@ function Fr(e, t, n, r, i) {
701
701
  height: r
702
702
  };
703
703
  }
704
- function Ir(e, t) {
705
- t.colorspaceConversion !== void 0 && e.pixelStorei(ln, t.colorspaceConversion), t.premultiplyAlpha !== void 0 && e.pixelStorei(un, t.premultiplyAlpha), t.flipY !== void 0 && e.pixelStorei(dn, t.flipY);
704
+ function Lr(e, t) {
705
+ t.colorspaceConversion !== void 0 && e.pixelStorei(un, t.colorspaceConversion), t.premultiplyAlpha !== void 0 && e.pixelStorei(dn, t.premultiplyAlpha), t.flipY !== void 0 && e.pixelStorei(fn, t.flipY);
706
706
  }
707
- function Lr(e) {
708
- e.pixelStorei(nn, 4), E(e) && (e.pixelStorei(rn, 0), e.pixelStorei(an, 0), e.pixelStorei(on, 0), e.pixelStorei(sn, 0), e.pixelStorei(cn, 0));
707
+ function Rr(e) {
708
+ e.pixelStorei(rn, 4), At(e) && (e.pixelStorei(an, 0), e.pixelStorei(on, 0), e.pixelStorei(sn, 0), e.pixelStorei(cn, 0), e.pixelStorei(ln, 0));
709
709
  }
710
- function Rr(e, t, n, r) {
711
- r.minMag && (n.call(e, t, qt, r.minMag), n.call(e, t, Jt, r.minMag)), r.min && n.call(e, t, qt, r.min), r.mag && n.call(e, t, Jt, r.mag), r.wrap && (n.call(e, t, Yt, r.wrap), n.call(e, t, Xt, r.wrap), (t === M || tt(e, t)) && n.call(e, t, Zt, r.wrap)), r.wrapR && n.call(e, t, Zt, r.wrapR), r.wrapS && n.call(e, t, Yt, r.wrapS), r.wrapT && n.call(e, t, Xt, r.wrapT), r.minLod && n.call(e, t, Qt, r.minLod), r.maxLod && n.call(e, t, $t, r.maxLod), r.baseLevel && n.call(e, t, en, r.baseLevel), r.maxLevel && n.call(e, t, tn, r.maxLevel);
710
+ function zr(e, t, n, r) {
711
+ r.minMag && (n.call(e, t, Jt, r.minMag), n.call(e, t, Yt, r.minMag)), r.min && n.call(e, t, Jt, r.min), r.mag && n.call(e, t, Yt, r.mag), r.wrap && (n.call(e, t, Xt, r.wrap), n.call(e, t, Zt, r.wrap), (t === M || tt(e, t)) && n.call(e, t, Qt, r.wrap)), r.wrapR && n.call(e, t, Qt, r.wrapR), r.wrapS && n.call(e, t, Xt, r.wrapS), r.wrapT && n.call(e, t, Zt, r.wrapT), r.minLod && n.call(e, t, $t, r.minLod), r.maxLod && n.call(e, t, en, r.maxLod), r.baseLevel && n.call(e, t, tn, r.baseLevel), r.maxLevel && n.call(e, t, nn, r.maxLevel);
712
712
  }
713
- function zr(e, t, n) {
713
+ function Br(e, t, n) {
714
714
  let r = n.target || A;
715
- e.bindTexture(r, t), Rr(e, r, e.texParameteri, n);
715
+ e.bindTexture(r, t), zr(e, r, e.texParameteri, n);
716
716
  }
717
- function Br(e) {
718
- return e ||= D.textureColor, jt(e) ? e : new Uint8Array([
717
+ function Vr(e) {
718
+ return e ||= D.textureColor, Mt(e) ? e : new Uint8Array([
719
719
  e[0] * 255,
720
720
  e[1] * 255,
721
721
  e[2] * 255,
722
722
  e[3] * 255
723
723
  ]);
724
724
  }
725
- function Vr(e, t, n, r, i, a) {
725
+ function Hr(e, t, n, r, i, a) {
726
726
  n ||= D.textureOptions, a ||= k;
727
727
  let o = n.target || A;
728
- if (r ||= n.width, i ||= n.height, e.bindTexture(o, t), Mr(e, r, i, a)) e.generateMipmap(o);
728
+ if (r ||= n.width, i ||= n.height, e.bindTexture(o, t), Nr(e, r, i, a)) e.generateMipmap(o);
729
729
  else {
730
- let t = Nr(a) ? Bt : zt;
731
- e.texParameteri(o, qt, t), e.texParameteri(o, Jt, t), e.texParameteri(o, Yt, Rt), e.texParameteri(o, Xt, Rt);
730
+ let t = Pr(a) ? Vt : Bt;
731
+ e.texParameteri(o, Jt, t), e.texParameteri(o, Yt, t), e.texParameteri(o, Xt, zt), e.texParameteri(o, Zt, zt);
732
732
  }
733
733
  }
734
- function Hr(e) {
734
+ function Ur(e) {
735
735
  return e.auto === !0 || e.auto === void 0 && e.level === void 0;
736
736
  }
737
- function Ur(e, t) {
737
+ function Wr(e, t) {
738
738
  return t ||= {}, t.cubeFaceOrder || [
739
- Vt,
740
739
  Ht,
741
740
  Ut,
742
741
  Wt,
743
742
  Gt,
744
- Kt
743
+ Kt,
744
+ qt
745
745
  ];
746
746
  }
747
- function Wr(e, t) {
748
- let n = Ur(e, t).map(function(e, t) {
747
+ function Gr(e, t) {
748
+ let n = Wr(e, t).map(function(e, t) {
749
749
  return {
750
750
  face: e,
751
751
  ndx: t
@@ -755,10 +755,10 @@ function Wr(e, t) {
755
755
  return e.face - t.face;
756
756
  }), n;
757
757
  }
758
- function Gr(e, t, n, r) {
758
+ function Kr(e, t, n, r) {
759
759
  r ||= D.textureOptions;
760
- let i = r.target || A, a = r.level || 0, o = n.width, s = n.height, c = r.internalFormat || r.format || k, l = Ar(c), u = r.format || l.format, d = r.type || l.type;
761
- if (Ir(e, r), e.bindTexture(i, t), i === j) {
760
+ let i = r.target || A, a = r.level || 0, o = n.width, s = n.height, c = r.internalFormat || r.format || k, l = jr(c), u = r.format || l.format, d = r.type || l.type;
761
+ if (Lr(e, r), e.bindTexture(i, t), i === j) {
762
762
  let l = n.width, f = n.height, p, m;
763
763
  if (l / 6 === f) p = f, m = [
764
764
  0,
@@ -817,34 +817,34 @@ function Gr(e, t, n, r) {
817
817
  2
818
818
  ];
819
819
  else throw "can't figure out cube map from element: " + (n.src ? n.src : n.nodeName);
820
- let h = Mt();
821
- h ? (h.canvas.width = p, h.canvas.height = p, o = p, s = p, Wr(e, r).forEach(function(t) {
820
+ let h = Nt();
821
+ h ? (h.canvas.width = p, h.canvas.height = p, o = p, s = p, Gr(e, r).forEach(function(t) {
822
822
  let r = m[t.ndx * 2 + 0] * p, i = m[t.ndx * 2 + 1] * p;
823
823
  h.drawImage(n, r, i, p, p, 0, 0, p, p), e.texImage2D(t.face, a, c, u, d, h.canvas);
824
- }), h.canvas.width = 1, h.canvas.height = 1) : typeof createImageBitmap < "u" && (o = p, s = p, Wr(e, r).forEach(function(l) {
824
+ }), h.canvas.width = 1, h.canvas.height = 1) : typeof createImageBitmap < "u" && (o = p, s = p, Gr(e, r).forEach(function(l) {
825
825
  let f = m[l.ndx * 2 + 0] * p, h = m[l.ndx * 2 + 1] * p;
826
826
  e.texImage2D(l.face, a, c, p, p, 0, u, d, null), createImageBitmap(n, f, h, p, p, {
827
827
  premultiplyAlpha: "none",
828
828
  colorSpaceConversion: "none"
829
829
  }).then(function(n) {
830
- Ir(e, r), e.bindTexture(i, t), e.texImage2D(l.face, a, c, u, d, n), Hr(r) && Vr(e, t, r, o, s, c);
830
+ Lr(e, r), e.bindTexture(i, t), e.texImage2D(l.face, a, c, u, d, n), Ur(r) && Hr(e, t, r, o, s, c);
831
831
  });
832
832
  }));
833
833
  } else if (i === M || i === N) {
834
834
  let t = Math.min(n.width, n.height), r = Math.max(n.width, n.height), o = r / t;
835
835
  if (o % 1 != 0) throw "can not compute 3D dimensions of element";
836
836
  let s = +(n.width === r), l = +(n.height === r);
837
- e.pixelStorei(nn, 1), e.pixelStorei(rn, n.width), e.pixelStorei(an, 0), e.pixelStorei(cn, 0), e.texImage3D(i, a, c, t, t, t, 0, u, d, null);
837
+ e.pixelStorei(rn, 1), e.pixelStorei(an, n.width), e.pixelStorei(on, 0), e.pixelStorei(ln, 0), e.texImage3D(i, a, c, t, t, t, 0, u, d, null);
838
838
  for (let r = 0; r < o; ++r) {
839
839
  let o = r * t * s, c = r * t * l;
840
- e.pixelStorei(on, o), e.pixelStorei(sn, c), e.texSubImage3D(i, a, 0, 0, r, t, t, 1, u, d, n);
840
+ e.pixelStorei(sn, o), e.pixelStorei(cn, c), e.texSubImage3D(i, a, 0, 0, r, t, t, 1, u, d, n);
841
841
  }
842
- Lr(e);
842
+ Rr(e);
843
843
  } else e.texImage2D(i, a, c, u, d, n);
844
- Hr(r) && Vr(e, t, r, o, s, c), zr(e, t, r);
844
+ Ur(r) && Hr(e, t, r, o, s, c), Br(e, t, r);
845
845
  }
846
- function Kr() {}
847
- function qr(e) {
846
+ function qr() {}
847
+ function Jr(e) {
848
848
  if (typeof document < "u") {
849
849
  let t = document.createElement("a");
850
850
  return t.href = e, t.hostname === location.hostname && t.port === location.port && t.protocol === location.protocol;
@@ -853,13 +853,13 @@ function qr(e) {
853
853
  return new URL(e, location.href).origin === t;
854
854
  }
855
855
  }
856
- function Jr(e, t) {
857
- return t === void 0 && !qr(e) ? "anonymous" : t;
856
+ function Yr(e, t) {
857
+ return t === void 0 && !Jr(e) ? "anonymous" : t;
858
858
  }
859
- function Yr(e, t, n) {
860
- n ||= Kr;
859
+ function Xr(e, t, n) {
860
+ n ||= qr;
861
861
  let r;
862
- if (t = t === void 0 ? D.crossOrigin : t, t = Jr(e, t), typeof Image < "u") {
862
+ if (t = t === void 0 ? D.crossOrigin : t, t = Yr(e, t), typeof Image < "u") {
863
863
  r = new Image(), t !== void 0 && (r.crossOrigin = t);
864
864
  let i = function() {
865
865
  r.removeEventListener("error", a), r.removeEventListener("load", o), r = null;
@@ -890,90 +890,90 @@ function Yr(e, t, n) {
890
890
  }
891
891
  return r;
892
892
  }
893
- function Xr(e) {
893
+ function Zr(e) {
894
894
  return typeof ImageBitmap < "u" && e instanceof ImageBitmap || typeof ImageData < "u" && e instanceof ImageData || typeof HTMLElement < "u" && e instanceof HTMLElement;
895
895
  }
896
- function Zr(e, t, n) {
897
- return Xr(e) ? (setTimeout(function() {
896
+ function Qr(e, t, n) {
897
+ return Zr(e) ? (setTimeout(function() {
898
898
  n(null, e);
899
- }), e) : Yr(e, t, n);
899
+ }), e) : Xr(e, t, n);
900
900
  }
901
- function Qr(e, t, n) {
901
+ function $r(e, t, n) {
902
902
  n ||= D.textureOptions;
903
903
  let r = n.target || A;
904
904
  if (e.bindTexture(r, t), n.color === !1) return;
905
- let i = Br(n.color);
906
- if (r === j) for (let t = 0; t < 6; ++t) e.texImage2D(Vt + t, 0, k, 1, 1, 0, k, F, i);
905
+ let i = Vr(n.color);
906
+ if (r === j) for (let t = 0; t < 6; ++t) e.texImage2D(Ht + t, 0, k, 1, 1, 0, k, F, i);
907
907
  else r === M || r === N ? e.texImage3D(r, 0, k, 1, 1, 1, 0, k, F, i) : e.texImage2D(r, 0, k, 1, 1, 0, k, F, i);
908
908
  }
909
- function $r(e, t, n, r) {
910
- return r ||= Kr, n ||= D.textureOptions, Qr(e, t, n), n = Object.assign({}, n), Zr(n.src, n.crossOrigin, function(i, a) {
911
- i ? r(i, t, a) : (Gr(e, t, a, n), r(null, t, a));
909
+ function ei(e, t, n, r) {
910
+ return r ||= qr, n ||= D.textureOptions, $r(e, t, n), n = Object.assign({}, n), Qr(n.src, n.crossOrigin, function(i, a) {
911
+ i ? r(i, t, a) : (Kr(e, t, a, n), r(null, t, a));
912
912
  });
913
913
  }
914
- function ei(e, t, n, r) {
915
- r ||= Kr;
914
+ function ti(e, t, n, r) {
915
+ r ||= qr;
916
916
  let i = n.src;
917
917
  if (i.length !== 6) throw "there must be 6 urls for a cubemap";
918
- let a = n.level || 0, o = n.internalFormat || n.format || k, s = Ar(o), c = n.format || s.format, l = n.type || F, u = n.target || A;
918
+ let a = n.level || 0, o = n.internalFormat || n.format || k, s = jr(o), c = n.format || s.format, l = n.type || F, u = n.target || A;
919
919
  if (u !== j) throw "target must be TEXTURE_CUBE_MAP";
920
- Qr(e, t, n), n = Object.assign({}, n);
921
- let d = 6, f = [], p = Ur(e, n), m;
920
+ $r(e, t, n), n = Object.assign({}, n);
921
+ let d = 6, f = [], p = Wr(e, n), m;
922
922
  function h(i) {
923
923
  return function(s, p) {
924
- --d, s ? f.push(s) : p.width === p.height ? (Ir(e, n), e.bindTexture(u, t), d === 5 ? Ur().forEach(function(t) {
924
+ --d, s ? f.push(s) : p.width === p.height ? (Lr(e, n), e.bindTexture(u, t), d === 5 ? Wr().forEach(function(t) {
925
925
  e.texImage2D(t, a, o, c, l, p);
926
- }) : e.texImage2D(i, a, o, c, l, p), Hr(n) && e.generateMipmap(u)) : f.push("cubemap face img is not a square: " + p.src), d === 0 && r(f.length ? f : void 0, t, m);
926
+ }) : e.texImage2D(i, a, o, c, l, p), Ur(n) && e.generateMipmap(u)) : f.push("cubemap face img is not a square: " + p.src), d === 0 && r(f.length ? f : void 0, t, m);
927
927
  };
928
928
  }
929
929
  m = i.map(function(e, t) {
930
- return Zr(e, n.crossOrigin, h(p[t]));
930
+ return Qr(e, n.crossOrigin, h(p[t]));
931
931
  });
932
932
  }
933
- function ti(e, t, n, r) {
934
- r ||= Kr;
935
- let i = n.src, a = n.internalFormat || n.format || k, o = Ar(a), s = n.format || o.format, c = n.type || F, l = n.target || N;
933
+ function ni(e, t, n, r) {
934
+ r ||= qr;
935
+ let i = n.src, a = n.internalFormat || n.format || k, o = jr(a), s = n.format || o.format, c = n.type || F, l = n.target || N;
936
936
  if (l !== M && l !== N) throw "target must be TEXTURE_3D or TEXTURE_2D_ARRAY";
937
- Qr(e, t, n), n = Object.assign({}, n);
937
+ $r(e, t, n), n = Object.assign({}, n);
938
938
  let u = i.length, d = [], f, p = n.level || 0, m = n.width, h = n.height, g = i.length, _ = !0;
939
939
  function v(i) {
940
940
  return function(o, v) {
941
941
  if (--u, o) d.push(o);
942
942
  else {
943
- if (Ir(e, n), e.bindTexture(l, t), _) {
943
+ if (Lr(e, n), e.bindTexture(l, t), _) {
944
944
  _ = !1, m = n.width || v.width, h = n.height || v.height, e.texImage3D(l, p, a, m, h, g, 0, s, c, null);
945
945
  for (let t = 0; t < g; ++t) e.texSubImage3D(l, p, 0, 0, t, m, h, 1, s, c, v);
946
946
  } else {
947
947
  let t = v, n;
948
- (v.width !== m || v.height !== h) && (n = Mt(), t = n.canvas, n.canvas.width = m, n.canvas.height = h, n.drawImage(v, 0, 0, m, h)), e.texSubImage3D(l, p, 0, 0, i, m, h, 1, s, c, t), n && t === n.canvas && (n.canvas.width = 0, n.canvas.height = 0);
948
+ (v.width !== m || v.height !== h) && (n = Nt(), t = n.canvas, n.canvas.width = m, n.canvas.height = h, n.drawImage(v, 0, 0, m, h)), e.texSubImage3D(l, p, 0, 0, i, m, h, 1, s, c, t), n && t === n.canvas && (n.canvas.width = 0, n.canvas.height = 0);
949
949
  }
950
- Hr(n) && e.generateMipmap(l);
950
+ Ur(n) && e.generateMipmap(l);
951
951
  }
952
952
  u === 0 && r(d.length ? d : void 0, t, f);
953
953
  };
954
954
  }
955
955
  f = i.map(function(e, t) {
956
- return Zr(e, n.crossOrigin, v(t));
956
+ return Qr(e, n.crossOrigin, v(t));
957
957
  });
958
958
  }
959
- function ni(e, t, n, r) {
959
+ function ri(e, t, n, r) {
960
960
  r ||= D.textureOptions;
961
961
  let i = r.target || A;
962
962
  e.bindTexture(i, t);
963
- let a = r.width, o = r.height, s = r.depth, c = r.level || 0, l = r.internalFormat || r.format || k, u = Ar(l), d = r.format || u.format, f = r.type || Pr(e, n, u.type);
964
- jt(n) ? n instanceof Uint8ClampedArray && (n = new Uint8Array(n.buffer)) : n = new (Je(f))(n);
965
- let p = kr(l, f), m = n.byteLength / p;
966
- if (m % 1) throw "length wrong size for format: " + At(e, d);
963
+ let a = r.width, o = r.height, s = r.depth, c = r.level || 0, l = r.internalFormat || r.format || k, u = jr(l), d = r.format || u.format, f = r.type || Fr(e, n, u.type);
964
+ Mt(n) ? n instanceof Uint8ClampedArray && (n = new Uint8Array(n.buffer)) : n = new (Je(f))(n);
965
+ let p = Ar(l, f), m = n.byteLength / p;
966
+ if (m % 1) throw "length wrong size for format: " + jt(e, d);
967
967
  let h;
968
968
  if (i === M || i === N) if (!a && !o && !s) {
969
969
  let e = Math.cbrt(m);
970
970
  if (e % 1 != 0) throw "can't guess cube size of array of numElements: " + m;
971
971
  a = e, o = e, s = e;
972
- } else a && (!o || !s) ? (h = Fr(e, i, o, s, m / a), o = h.width, s = h.height) : o && (!a || !s) ? (h = Fr(e, i, a, s, m / o), a = h.width, s = h.height) : (h = Fr(e, i, a, o, m / s), a = h.width, o = h.height);
973
- else h = Fr(e, i, a, o, m), a = h.width, o = h.height;
974
- if (Lr(e), e.pixelStorei(nn, r.unpackAlignment || 1), Ir(e, r), i === j) {
972
+ } else a && (!o || !s) ? (h = Ir(e, i, o, s, m / a), o = h.width, s = h.height) : o && (!a || !s) ? (h = Ir(e, i, a, s, m / o), a = h.width, s = h.height) : (h = Ir(e, i, a, o, m / s), a = h.width, o = h.height);
973
+ else h = Ir(e, i, a, o, m), a = h.width, o = h.height;
974
+ if (Rr(e), e.pixelStorei(rn, r.unpackAlignment || 1), Lr(e, r), i === j) {
975
975
  let t = p / n.BYTES_PER_ELEMENT, i = m / 6 * t;
976
- Wr(e, r).forEach((t) => {
976
+ Gr(e, r).forEach((t) => {
977
977
  let r = i * t.ndx, s = n.subarray(r, r + i);
978
978
  e.texImage2D(t.face, c, l, a, o, 0, d, f, s);
979
979
  });
@@ -985,322 +985,316 @@ function ni(e, t, n, r) {
985
985
  type: f
986
986
  };
987
987
  }
988
- function ri(e, t, n) {
988
+ function ii(e, t, n) {
989
989
  let r = n.target || A;
990
990
  e.bindTexture(r, t);
991
- let i = n.level || 0, a = n.internalFormat || n.format || k, o = Ar(a), s = n.format || o.format, c = n.type || o.type;
992
- if (Ir(e, n), r === j) for (let t = 0; t < 6; ++t) e.texImage2D(Vt + t, i, a, n.width, n.height, 0, s, c, null);
991
+ let i = n.level || 0, a = n.internalFormat || n.format || k, o = jr(a), s = n.format || o.format, c = n.type || o.type;
992
+ if (Lr(e, n), r === j) for (let t = 0; t < 6; ++t) e.texImage2D(Ht + t, i, a, n.width, n.height, 0, s, c, null);
993
993
  else r === M || r === N ? e.texImage3D(r, i, a, n.width, n.height, n.depth, 0, s, c, null) : e.texImage2D(r, i, a, n.width, n.height, 0, s, c, null);
994
994
  }
995
- function ii(e, t, n) {
996
- n ||= Kr, t ||= D.textureOptions;
995
+ function ai(e, t, n) {
996
+ n ||= qr, t ||= D.textureOptions;
997
997
  let r = e.createTexture(), i = t.target || A, a = t.width || 1, o = t.height || 1, s = t.internalFormat || k;
998
- e.bindTexture(i, r), i === j && (e.texParameteri(i, Yt, Rt), e.texParameteri(i, Xt, Rt));
998
+ e.bindTexture(i, r), i === j && (e.texParameteri(i, Xt, zt), e.texParameteri(i, Zt, zt));
999
999
  let c = t.src;
1000
- if (c) if (typeof c == "function" && (c = c(e, t)), typeof c == "string") $r(e, r, t, n);
1001
- else if (jt(c) || Array.isArray(c) && (typeof c[0] == "number" || Array.isArray(c[0]) || jt(c[0]))) {
1002
- let n = ni(e, r, c, t);
1000
+ if (c) if (typeof c == "function" && (c = c(e, t)), typeof c == "string") ei(e, r, t, n);
1001
+ else if (Mt(c) || Array.isArray(c) && (typeof c[0] == "number" || Array.isArray(c[0]) || Mt(c[0]))) {
1002
+ let n = ri(e, r, c, t);
1003
1003
  a = n.width, o = n.height;
1004
- } else Array.isArray(c) && (typeof c[0] == "string" || Xr(c[0])) ? i === j ? ei(e, r, t, n) : ti(e, r, t, n) : (Gr(e, r, c, t), a = c.width, o = c.height);
1005
- else ri(e, r, t);
1006
- return Hr(t) && Vr(e, r, t, a, o, s), zr(e, r, t), r;
1004
+ } else Array.isArray(c) && (typeof c[0] == "string" || Zr(c[0])) ? i === j ? ti(e, r, t, n) : ni(e, r, t, n) : (Kr(e, r, c, t), a = c.width, o = c.height);
1005
+ else ii(e, r, t);
1006
+ return Ur(t) && Hr(e, r, t, a, o, s), Br(e, r, t), r;
1007
1007
  }
1008
- function ai(e, t, n, r, i, a) {
1008
+ function oi(e, t, n, r, i, a) {
1009
1009
  r ||= n.width, i ||= n.height, a ||= n.depth;
1010
1010
  let o = n.target || A;
1011
1011
  e.bindTexture(o, t);
1012
- let s = n.level || 0, c = n.internalFormat || n.format || k, l = Ar(c), u = n.format || l.format, d, f = n.src;
1013
- if (d = f && (jt(f) || Array.isArray(f) && typeof f[0] == "number") ? n.type || Pr(e, f, l.type) : n.type || l.type, o === j) for (let t = 0; t < 6; ++t) e.texImage2D(Vt + t, s, c, r, i, 0, u, d, null);
1012
+ let s = n.level || 0, c = n.internalFormat || n.format || k, l = jr(c), u = n.format || l.format, d, f = n.src;
1013
+ if (d = f && (Mt(f) || Array.isArray(f) && typeof f[0] == "number") ? n.type || Fr(e, f, l.type) : n.type || l.type, o === j) for (let t = 0; t < 6; ++t) e.texImage2D(Ht + t, s, c, r, i, 0, u, d, null);
1014
1014
  else o === M || o === N ? e.texImage3D(o, s, c, r, i, a, 0, u, d, null) : e.texImage2D(o, s, c, r, i, 0, u, d, null);
1015
1015
  }
1016
- var oi = Ze, si = 33984, ci = 35048, li = 34962, ui = 34963, di = 35345, fi = 35718, pi = 35721, mi = 35971, hi = 35382, gi = 35396, _i = 35398, vi = 35392, yi = 35395, bi = 5126, xi = 35664, Si = 35665, Ci = 35666, wi = 5124, Ti = 35667, Ei = 35668, Di = 35669, Oi = 35670, ki = 35671, Ai = 35672, ji = 35673, Mi = 35674, Ni = 35675, Pi = 35676, Fi = 35678, Ii = 35680, Li = 35679, Ri = 35682, zi = 35685, Bi = 35686, Vi = 35687, Hi = 35688, Ui = 35689, Wi = 35690, Gi = 36289, Ki = 36292, qi = 36293, Ji = 5125, Yi = 36294, Xi = 36295, Zi = 36296, Qi = 36298, $i = 36299, ea = 36300, ta = 36303, na = 36306, ra = 36307, ia = 36308, aa = 36311, oa = 3553, sa = 34067, ca = 32879, la = 35866, U = {};
1017
- function ua(e, t) {
1016
+ var si = Ze, ci = 33984, li = 35048, ui = 34962, di = 34963, fi = 35345, pi = 35718, mi = 35721, hi = 35971, gi = 35382, _i = 35396, vi = 35398, yi = 35392, bi = 35395, xi = 5126, Si = 35664, Ci = 35665, wi = 35666, Ti = 5124, Ei = 35667, Di = 35668, Oi = 35669, ki = 35670, Ai = 35671, ji = 35672, Mi = 35673, Ni = 35674, Pi = 35675, Fi = 35676, Ii = 35678, Li = 35680, Ri = 35679, zi = 35682, Bi = 35685, Vi = 35686, Hi = 35687, Ui = 35688, Wi = 35689, Gi = 35690, Ki = 36289, qi = 36292, Ji = 36293, Yi = 5125, Xi = 36294, Zi = 36295, Qi = 36296, $i = 36298, ea = 36299, ta = 36300, na = 36303, ra = 36306, ia = 36307, aa = 36308, oa = 36311, sa = 3553, ca = 34067, la = 32879, ua = 35866, U = {};
1017
+ function da(e, t) {
1018
1018
  return U[t].bindPoint;
1019
1019
  }
1020
- function da(e, t) {
1020
+ function fa(e, t) {
1021
1021
  return function(n) {
1022
1022
  e.uniform1f(t, n);
1023
1023
  };
1024
1024
  }
1025
- function fa(e, t) {
1025
+ function pa(e, t) {
1026
1026
  return function(n) {
1027
1027
  e.uniform1fv(t, n);
1028
1028
  };
1029
1029
  }
1030
- function pa(e, t) {
1030
+ function ma(e, t) {
1031
1031
  return function(n) {
1032
1032
  e.uniform2fv(t, n);
1033
1033
  };
1034
1034
  }
1035
- function ma(e, t) {
1035
+ function ha(e, t) {
1036
1036
  return function(n) {
1037
1037
  e.uniform3fv(t, n);
1038
1038
  };
1039
1039
  }
1040
- function ha(e, t) {
1040
+ function ga(e, t) {
1041
1041
  return function(n) {
1042
1042
  e.uniform4fv(t, n);
1043
1043
  };
1044
1044
  }
1045
- function ga(e, t) {
1045
+ function _a(e, t) {
1046
1046
  return function(n) {
1047
1047
  e.uniform1i(t, n);
1048
1048
  };
1049
1049
  }
1050
- function _a(e, t) {
1050
+ function va(e, t) {
1051
1051
  return function(n) {
1052
1052
  e.uniform1iv(t, n);
1053
1053
  };
1054
1054
  }
1055
- function va(e, t) {
1055
+ function ya(e, t) {
1056
1056
  return function(n) {
1057
1057
  e.uniform2iv(t, n);
1058
1058
  };
1059
1059
  }
1060
- function ya(e, t) {
1060
+ function ba(e, t) {
1061
1061
  return function(n) {
1062
1062
  e.uniform3iv(t, n);
1063
1063
  };
1064
1064
  }
1065
- function ba(e, t) {
1065
+ function xa(e, t) {
1066
1066
  return function(n) {
1067
1067
  e.uniform4iv(t, n);
1068
1068
  };
1069
1069
  }
1070
- function xa(e, t) {
1070
+ function Sa(e, t) {
1071
1071
  return function(n) {
1072
1072
  e.uniform1ui(t, n);
1073
1073
  };
1074
1074
  }
1075
- function Sa(e, t) {
1075
+ function Ca(e, t) {
1076
1076
  return function(n) {
1077
1077
  e.uniform1uiv(t, n);
1078
1078
  };
1079
1079
  }
1080
- function Ca(e, t) {
1080
+ function wa(e, t) {
1081
1081
  return function(n) {
1082
1082
  e.uniform2uiv(t, n);
1083
1083
  };
1084
1084
  }
1085
- function wa(e, t) {
1085
+ function Ta(e, t) {
1086
1086
  return function(n) {
1087
1087
  e.uniform3uiv(t, n);
1088
1088
  };
1089
1089
  }
1090
- function Ta(e, t) {
1090
+ function Ea(e, t) {
1091
1091
  return function(n) {
1092
1092
  e.uniform4uiv(t, n);
1093
1093
  };
1094
1094
  }
1095
- function Ea(e, t) {
1095
+ function Da(e, t) {
1096
1096
  return function(n) {
1097
1097
  e.uniformMatrix2fv(t, !1, n);
1098
1098
  };
1099
1099
  }
1100
- function Da(e, t) {
1100
+ function Oa(e, t) {
1101
1101
  return function(n) {
1102
1102
  e.uniformMatrix3fv(t, !1, n);
1103
1103
  };
1104
1104
  }
1105
- function Oa(e, t) {
1105
+ function ka(e, t) {
1106
1106
  return function(n) {
1107
1107
  e.uniformMatrix4fv(t, !1, n);
1108
1108
  };
1109
1109
  }
1110
- function ka(e, t) {
1110
+ function Aa(e, t) {
1111
1111
  return function(n) {
1112
1112
  e.uniformMatrix2x3fv(t, !1, n);
1113
1113
  };
1114
1114
  }
1115
- function Aa(e, t) {
1115
+ function ja(e, t) {
1116
1116
  return function(n) {
1117
1117
  e.uniformMatrix3x2fv(t, !1, n);
1118
1118
  };
1119
1119
  }
1120
- function ja(e, t) {
1120
+ function Ma(e, t) {
1121
1121
  return function(n) {
1122
1122
  e.uniformMatrix2x4fv(t, !1, n);
1123
1123
  };
1124
1124
  }
1125
- function Ma(e, t) {
1125
+ function Na(e, t) {
1126
1126
  return function(n) {
1127
1127
  e.uniformMatrix4x2fv(t, !1, n);
1128
1128
  };
1129
1129
  }
1130
- function Na(e, t) {
1130
+ function Pa(e, t) {
1131
1131
  return function(n) {
1132
1132
  e.uniformMatrix3x4fv(t, !1, n);
1133
1133
  };
1134
1134
  }
1135
- function Pa(e, t) {
1135
+ function Fa(e, t) {
1136
1136
  return function(n) {
1137
1137
  e.uniformMatrix4x3fv(t, !1, n);
1138
1138
  };
1139
1139
  }
1140
1140
  function W(e, t, n, r) {
1141
- let i = ua(e, t);
1142
- return E(e) ? function(t) {
1141
+ let i = da(e, t);
1142
+ return At(e) ? function(t) {
1143
1143
  let a, o;
1144
- et(e, t) ? (a = t, o = null) : (a = t.texture, o = t.sampler), e.uniform1i(r, n), e.activeTexture(si + n), e.bindTexture(i, a), e.bindSampler(n, o);
1144
+ et(e, t) ? (a = t, o = null) : (a = t.texture, o = t.sampler), e.uniform1i(r, n), e.activeTexture(ci + n), e.bindTexture(i, a), e.bindSampler(n, o);
1145
1145
  } : function(t) {
1146
- e.uniform1i(r, n), e.activeTexture(si + n), e.bindTexture(i, t);
1146
+ e.uniform1i(r, n), e.activeTexture(ci + n), e.bindTexture(i, t);
1147
1147
  };
1148
1148
  }
1149
1149
  function G(e, t, n, r, i) {
1150
- let a = ua(e, t), o = new Int32Array(i);
1150
+ let a = da(e, t), o = new Int32Array(i);
1151
1151
  for (let e = 0; e < i; ++e) o[e] = n + e;
1152
- return E(e) ? function(t) {
1152
+ return At(e) ? function(t) {
1153
1153
  e.uniform1iv(r, o), t.forEach(function(t, r) {
1154
- e.activeTexture(si + o[r]);
1154
+ e.activeTexture(ci + o[r]);
1155
1155
  let i, s;
1156
1156
  et(e, t) ? (i = t, s = null) : (i = t.texture, s = t.sampler), e.bindSampler(n, s), e.bindTexture(a, i);
1157
1157
  });
1158
1158
  } : function(t) {
1159
1159
  e.uniform1iv(r, o), t.forEach(function(t, n) {
1160
- e.activeTexture(si + o[n]), e.bindTexture(a, t);
1160
+ e.activeTexture(ci + o[n]), e.bindTexture(a, t);
1161
1161
  });
1162
1162
  };
1163
1163
  }
1164
- U[bi] = {
1164
+ U[xi] = {
1165
1165
  Type: Float32Array,
1166
1166
  size: 4,
1167
- setter: da,
1168
- arraySetter: fa
1169
- }, U[xi] = {
1167
+ setter: fa,
1168
+ arraySetter: pa
1169
+ }, U[Si] = {
1170
1170
  Type: Float32Array,
1171
1171
  size: 8,
1172
- setter: pa,
1172
+ setter: ma,
1173
1173
  cols: 2
1174
- }, U[Si] = {
1174
+ }, U[Ci] = {
1175
1175
  Type: Float32Array,
1176
1176
  size: 12,
1177
- setter: ma,
1177
+ setter: ha,
1178
1178
  cols: 3
1179
- }, U[Ci] = {
1179
+ }, U[wi] = {
1180
1180
  Type: Float32Array,
1181
1181
  size: 16,
1182
- setter: ha,
1182
+ setter: ga,
1183
1183
  cols: 4
1184
- }, U[wi] = {
1184
+ }, U[Ti] = {
1185
1185
  Type: Int32Array,
1186
1186
  size: 4,
1187
- setter: ga,
1188
- arraySetter: _a
1189
- }, U[Ti] = {
1187
+ setter: _a,
1188
+ arraySetter: va
1189
+ }, U[Ei] = {
1190
1190
  Type: Int32Array,
1191
1191
  size: 8,
1192
- setter: va,
1192
+ setter: ya,
1193
1193
  cols: 2
1194
- }, U[Ei] = {
1194
+ }, U[Di] = {
1195
1195
  Type: Int32Array,
1196
1196
  size: 12,
1197
- setter: ya,
1197
+ setter: ba,
1198
1198
  cols: 3
1199
- }, U[Di] = {
1199
+ }, U[Oi] = {
1200
1200
  Type: Int32Array,
1201
1201
  size: 16,
1202
- setter: ba,
1202
+ setter: xa,
1203
1203
  cols: 4
1204
- }, U[Ji] = {
1204
+ }, U[Yi] = {
1205
1205
  Type: Uint32Array,
1206
1206
  size: 4,
1207
- setter: xa,
1208
- arraySetter: Sa
1209
- }, U[Yi] = {
1207
+ setter: Sa,
1208
+ arraySetter: Ca
1209
+ }, U[Xi] = {
1210
1210
  Type: Uint32Array,
1211
1211
  size: 8,
1212
- setter: Ca,
1212
+ setter: wa,
1213
1213
  cols: 2
1214
- }, U[Xi] = {
1214
+ }, U[Zi] = {
1215
1215
  Type: Uint32Array,
1216
1216
  size: 12,
1217
- setter: wa,
1217
+ setter: Ta,
1218
1218
  cols: 3
1219
- }, U[Zi] = {
1219
+ }, U[Qi] = {
1220
1220
  Type: Uint32Array,
1221
1221
  size: 16,
1222
- setter: Ta,
1222
+ setter: Ea,
1223
1223
  cols: 4
1224
- }, U[Oi] = {
1224
+ }, U[ki] = {
1225
1225
  Type: Uint32Array,
1226
1226
  size: 4,
1227
- setter: ga,
1228
- arraySetter: _a
1229
- }, U[ki] = {
1227
+ setter: _a,
1228
+ arraySetter: va
1229
+ }, U[Ai] = {
1230
1230
  Type: Uint32Array,
1231
1231
  size: 8,
1232
- setter: va,
1232
+ setter: ya,
1233
1233
  cols: 2
1234
- }, U[Ai] = {
1234
+ }, U[ji] = {
1235
1235
  Type: Uint32Array,
1236
1236
  size: 12,
1237
- setter: ya,
1237
+ setter: ba,
1238
1238
  cols: 3
1239
- }, U[ji] = {
1239
+ }, U[Mi] = {
1240
1240
  Type: Uint32Array,
1241
1241
  size: 16,
1242
- setter: ba,
1242
+ setter: xa,
1243
1243
  cols: 4
1244
- }, U[Mi] = {
1244
+ }, U[Ni] = {
1245
1245
  Type: Float32Array,
1246
1246
  size: 32,
1247
- setter: Ea,
1247
+ setter: Da,
1248
1248
  rows: 2,
1249
1249
  cols: 2
1250
- }, U[Ni] = {
1250
+ }, U[Pi] = {
1251
1251
  Type: Float32Array,
1252
1252
  size: 48,
1253
- setter: Da,
1253
+ setter: Oa,
1254
1254
  rows: 3,
1255
1255
  cols: 3
1256
- }, U[Pi] = {
1256
+ }, U[Fi] = {
1257
1257
  Type: Float32Array,
1258
1258
  size: 64,
1259
- setter: Oa,
1259
+ setter: ka,
1260
1260
  rows: 4,
1261
1261
  cols: 4
1262
- }, U[zi] = {
1262
+ }, U[Bi] = {
1263
1263
  Type: Float32Array,
1264
1264
  size: 32,
1265
- setter: ka,
1265
+ setter: Aa,
1266
1266
  rows: 2,
1267
1267
  cols: 3
1268
- }, U[Bi] = {
1268
+ }, U[Vi] = {
1269
1269
  Type: Float32Array,
1270
1270
  size: 32,
1271
- setter: ja,
1271
+ setter: Ma,
1272
1272
  rows: 2,
1273
1273
  cols: 4
1274
- }, U[Vi] = {
1274
+ }, U[Hi] = {
1275
1275
  Type: Float32Array,
1276
1276
  size: 48,
1277
- setter: Aa,
1277
+ setter: ja,
1278
1278
  rows: 3,
1279
1279
  cols: 2
1280
- }, U[Hi] = {
1280
+ }, U[Ui] = {
1281
1281
  Type: Float32Array,
1282
1282
  size: 48,
1283
- setter: Na,
1283
+ setter: Pa,
1284
1284
  rows: 3,
1285
1285
  cols: 4
1286
- }, U[Ui] = {
1286
+ }, U[Wi] = {
1287
1287
  Type: Float32Array,
1288
1288
  size: 64,
1289
- setter: Ma,
1289
+ setter: Na,
1290
1290
  rows: 4,
1291
1291
  cols: 2
1292
- }, U[Wi] = {
1292
+ }, U[Gi] = {
1293
1293
  Type: Float32Array,
1294
1294
  size: 64,
1295
- setter: Pa,
1295
+ setter: Fa,
1296
1296
  rows: 4,
1297
1297
  cols: 3
1298
- }, U[Fi] = {
1299
- Type: null,
1300
- size: 0,
1301
- setter: W,
1302
- arraySetter: G,
1303
- bindPoint: oa
1304
1298
  }, U[Ii] = {
1305
1299
  Type: null,
1306
1300
  size: 0,
@@ -1318,75 +1312,81 @@ U[bi] = {
1318
1312
  size: 0,
1319
1313
  setter: W,
1320
1314
  arraySetter: G,
1321
- bindPoint: oa
1322
- }, U[Gi] = {
1315
+ bindPoint: la
1316
+ }, U[zi] = {
1323
1317
  Type: null,
1324
1318
  size: 0,
1325
1319
  setter: W,
1326
1320
  arraySetter: G,
1327
- bindPoint: la
1321
+ bindPoint: sa
1328
1322
  }, U[Ki] = {
1329
1323
  Type: null,
1330
1324
  size: 0,
1331
1325
  setter: W,
1332
1326
  arraySetter: G,
1333
- bindPoint: la
1327
+ bindPoint: ua
1334
1328
  }, U[qi] = {
1335
1329
  Type: null,
1336
1330
  size: 0,
1337
1331
  setter: W,
1338
1332
  arraySetter: G,
1339
- bindPoint: sa
1340
- }, U[Qi] = {
1333
+ bindPoint: ua
1334
+ }, U[Ji] = {
1341
1335
  Type: null,
1342
1336
  size: 0,
1343
1337
  setter: W,
1344
1338
  arraySetter: G,
1345
- bindPoint: oa
1339
+ bindPoint: ca
1346
1340
  }, U[$i] = {
1347
1341
  Type: null,
1348
1342
  size: 0,
1349
1343
  setter: W,
1350
1344
  arraySetter: G,
1351
- bindPoint: ca
1345
+ bindPoint: sa
1352
1346
  }, U[ea] = {
1353
1347
  Type: null,
1354
1348
  size: 0,
1355
1349
  setter: W,
1356
1350
  arraySetter: G,
1357
- bindPoint: sa
1351
+ bindPoint: la
1358
1352
  }, U[ta] = {
1359
1353
  Type: null,
1360
1354
  size: 0,
1361
1355
  setter: W,
1362
1356
  arraySetter: G,
1363
- bindPoint: la
1357
+ bindPoint: ca
1364
1358
  }, U[na] = {
1365
1359
  Type: null,
1366
1360
  size: 0,
1367
1361
  setter: W,
1368
1362
  arraySetter: G,
1369
- bindPoint: oa
1363
+ bindPoint: ua
1370
1364
  }, U[ra] = {
1371
1365
  Type: null,
1372
1366
  size: 0,
1373
1367
  setter: W,
1374
1368
  arraySetter: G,
1375
- bindPoint: ca
1369
+ bindPoint: sa
1376
1370
  }, U[ia] = {
1377
1371
  Type: null,
1378
1372
  size: 0,
1379
1373
  setter: W,
1380
1374
  arraySetter: G,
1381
- bindPoint: sa
1375
+ bindPoint: la
1382
1376
  }, U[aa] = {
1383
1377
  Type: null,
1384
1378
  size: 0,
1385
1379
  setter: W,
1386
1380
  arraySetter: G,
1387
- bindPoint: la
1381
+ bindPoint: ca
1382
+ }, U[oa] = {
1383
+ Type: null,
1384
+ size: 0,
1385
+ setter: W,
1386
+ arraySetter: G,
1387
+ bindPoint: ua
1388
1388
  };
1389
- function Fa(e, t) {
1389
+ function Ia(e, t) {
1390
1390
  return function(n) {
1391
1391
  if (n.value) switch (e.disableVertexAttribArray(t), n.value.length) {
1392
1392
  case 4:
@@ -1403,104 +1403,104 @@ function Fa(e, t) {
1403
1403
  break;
1404
1404
  default: throw Error("the length of a float constant value must be between 1 and 4!");
1405
1405
  }
1406
- else e.bindBuffer(li, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribPointer(t, n.numComponents || n.size, n.type || bi, n.normalize || !1, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
1406
+ else e.bindBuffer(ui, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribPointer(t, n.numComponents || n.size, n.type || xi, n.normalize || !1, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
1407
1407
  };
1408
1408
  }
1409
1409
  function K(e, t) {
1410
1410
  return function(n) {
1411
1411
  if (n.value) if (e.disableVertexAttribArray(t), n.value.length === 4) e.vertexAttrib4iv(t, n.value);
1412
1412
  else throw Error("The length of an integer constant value must be 4!");
1413
- else e.bindBuffer(li, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || wi, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
1413
+ else e.bindBuffer(ui, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || Ti, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
1414
1414
  };
1415
1415
  }
1416
- function Ia(e, t) {
1416
+ function La(e, t) {
1417
1417
  return function(n) {
1418
1418
  if (n.value) if (e.disableVertexAttribArray(t), n.value.length === 4) e.vertexAttrib4uiv(t, n.value);
1419
1419
  else throw Error("The length of an unsigned integer constant value must be 4!");
1420
- else e.bindBuffer(li, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || Ji, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
1420
+ else e.bindBuffer(ui, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || Yi, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
1421
1421
  };
1422
1422
  }
1423
- function La(e, t, n) {
1423
+ function Ra(e, t, n) {
1424
1424
  let r = n.size, i = n.count;
1425
1425
  return function(n) {
1426
- e.bindBuffer(li, n.buffer);
1427
- let a = n.size || n.numComponents || r, o = a / i, s = n.type || bi, c = U[s].size * a, l = n.normalize || !1, u = n.offset || 0, d = c / i;
1426
+ e.bindBuffer(ui, n.buffer);
1427
+ let a = n.size || n.numComponents || r, o = a / i, s = n.type || xi, c = U[s].size * a, l = n.normalize || !1, u = n.offset || 0, d = c / i;
1428
1428
  for (let r = 0; r < i; ++r) e.enableVertexAttribArray(t + r), e.vertexAttribPointer(t + r, o, s, l, c, u + d * r), n.divisor !== void 0 && e.vertexAttribDivisor(t + r, n.divisor);
1429
1429
  };
1430
1430
  }
1431
1431
  var q = {};
1432
- q[bi] = {
1432
+ q[xi] = {
1433
1433
  size: 4,
1434
- setter: Fa
1435
- }, q[xi] = {
1436
- size: 8,
1437
- setter: Fa
1434
+ setter: Ia
1438
1435
  }, q[Si] = {
1439
- size: 12,
1440
- setter: Fa
1436
+ size: 8,
1437
+ setter: Ia
1441
1438
  }, q[Ci] = {
1442
- size: 16,
1443
- setter: Fa
1439
+ size: 12,
1440
+ setter: Ia
1444
1441
  }, q[wi] = {
1442
+ size: 16,
1443
+ setter: Ia
1444
+ }, q[Ti] = {
1445
1445
  size: 4,
1446
1446
  setter: K
1447
- }, q[Ti] = {
1447
+ }, q[Ei] = {
1448
1448
  size: 8,
1449
1449
  setter: K
1450
- }, q[Ei] = {
1450
+ }, q[Di] = {
1451
1451
  size: 12,
1452
1452
  setter: K
1453
- }, q[Di] = {
1453
+ }, q[Oi] = {
1454
1454
  size: 16,
1455
1455
  setter: K
1456
- }, q[Ji] = {
1457
- size: 4,
1458
- setter: Ia
1459
1456
  }, q[Yi] = {
1460
- size: 8,
1461
- setter: Ia
1457
+ size: 4,
1458
+ setter: La
1462
1459
  }, q[Xi] = {
1463
- size: 12,
1464
- setter: Ia
1460
+ size: 8,
1461
+ setter: La
1465
1462
  }, q[Zi] = {
1463
+ size: 12,
1464
+ setter: La
1465
+ }, q[Qi] = {
1466
1466
  size: 16,
1467
- setter: Ia
1468
- }, q[Oi] = {
1467
+ setter: La
1468
+ }, q[ki] = {
1469
1469
  size: 4,
1470
1470
  setter: K
1471
- }, q[ki] = {
1471
+ }, q[Ai] = {
1472
1472
  size: 8,
1473
1473
  setter: K
1474
- }, q[Ai] = {
1474
+ }, q[ji] = {
1475
1475
  size: 12,
1476
1476
  setter: K
1477
- }, q[ji] = {
1477
+ }, q[Mi] = {
1478
1478
  size: 16,
1479
1479
  setter: K
1480
- }, q[Mi] = {
1480
+ }, q[Ni] = {
1481
1481
  size: 4,
1482
- setter: La,
1482
+ setter: Ra,
1483
1483
  count: 2
1484
- }, q[Ni] = {
1484
+ }, q[Pi] = {
1485
1485
  size: 9,
1486
- setter: La,
1486
+ setter: Ra,
1487
1487
  count: 3
1488
- }, q[Pi] = {
1488
+ }, q[Fi] = {
1489
1489
  size: 16,
1490
- setter: La,
1490
+ setter: Ra,
1491
1491
  count: 4
1492
1492
  };
1493
- function Ra(e) {
1493
+ function za(e) {
1494
1494
  let t = e.name;
1495
1495
  return t.startsWith("gl_") || t.startsWith("webgl_");
1496
1496
  }
1497
- var za = /(\.|\[|]|\w+)/g, Ba = (e) => e >= "0" && e <= "9";
1498
- function Va(e, t, n, r) {
1499
- let i = e.split(za).filter((e) => e !== ""), a = 0, o = "";
1497
+ var Ba = /(\.|\[|]|\w+)/g, Va = (e) => e >= "0" && e <= "9";
1498
+ function Ha(e, t, n, r) {
1499
+ let i = e.split(Ba).filter((e) => e !== ""), a = 0, o = "";
1500
1500
  for (;;) {
1501
1501
  let e = i[a++];
1502
1502
  o += e;
1503
- let s = Ba(e[0]), c = s ? parseInt(e) : e;
1503
+ let s = Va(e[0]), c = s ? parseInt(e) : e;
1504
1504
  if (s && (o += i[a++]), a === i.length) {
1505
1505
  n[c] = t;
1506
1506
  break;
@@ -1508,13 +1508,13 @@ function Va(e, t, n, r) {
1508
1508
  let e = i[a++], t = e === "[", s = n[c] || (t ? [] : {});
1509
1509
  n[c] = s, n = s, r[o] = r[o] || function(e) {
1510
1510
  return function(t) {
1511
- $a(e, t);
1511
+ eo(e, t);
1512
1512
  };
1513
1513
  }(s), o += e;
1514
1514
  }
1515
1515
  }
1516
1516
  }
1517
- function Ha(e, t) {
1517
+ function Ua(e, t) {
1518
1518
  let n = 0;
1519
1519
  function r(t, r, i) {
1520
1520
  let a = r.name.endsWith("[0]"), o = r.type, s = U[o];
@@ -1526,22 +1526,22 @@ function Ha(e, t) {
1526
1526
  } else c = s.arraySetter && a ? s.arraySetter(e, i) : s.setter(e, i);
1527
1527
  return c.location = i, c;
1528
1528
  }
1529
- let i = {}, a = {}, o = e.getProgramParameter(t, fi);
1529
+ let i = {}, a = {}, o = e.getProgramParameter(t, pi);
1530
1530
  for (let n = 0; n < o; ++n) {
1531
1531
  let o = e.getActiveUniform(t, n);
1532
- if (Ra(o)) continue;
1532
+ if (za(o)) continue;
1533
1533
  let s = o.name;
1534
1534
  s.endsWith("[0]") && (s = s.substr(0, s.length - 3));
1535
1535
  let c = e.getUniformLocation(t, o.name);
1536
1536
  if (c) {
1537
1537
  let e = r(t, o, c);
1538
- i[s] = e, Va(s, e, a, i);
1538
+ i[s] = e, Ha(s, e, a, i);
1539
1539
  }
1540
1540
  }
1541
1541
  return i;
1542
1542
  }
1543
- function Ua(e, t) {
1544
- let n = {}, r = e.getProgramParameter(t, mi);
1543
+ function Wa(e, t) {
1544
+ let n = {}, r = e.getProgramParameter(t, hi);
1545
1545
  for (let i = 0; i < r; ++i) {
1546
1546
  let r = e.getTransformFeedbackVarying(t, i);
1547
1547
  n[r.name] = {
@@ -1552,8 +1552,8 @@ function Ua(e, t) {
1552
1552
  }
1553
1553
  return n;
1554
1554
  }
1555
- function Wa(e, t) {
1556
- let n = e.getProgramParameter(t, fi), r = [], i = [];
1555
+ function Ga(e, t) {
1556
+ let n = e.getProgramParameter(t, pi), r = [], i = [];
1557
1557
  for (let a = 0; a < n; ++a) {
1558
1558
  i.push(a), r.push({});
1559
1559
  let n = e.getActiveUniform(t, a);
@@ -1570,14 +1570,14 @@ function Wa(e, t) {
1570
1570
  r[t][o] = e;
1571
1571
  });
1572
1572
  });
1573
- let a = {}, o = e.getProgramParameter(t, hi);
1573
+ let a = {}, o = e.getProgramParameter(t, gi);
1574
1574
  for (let n = 0; n < o; ++n) {
1575
1575
  let r = e.getActiveUniformBlockName(t, n), i = {
1576
1576
  index: e.getUniformBlockIndex(t, r),
1577
- usedByVertexShader: e.getActiveUniformBlockParameter(t, n, gi),
1578
- usedByFragmentShader: e.getActiveUniformBlockParameter(t, n, _i),
1579
- size: e.getActiveUniformBlockParameter(t, n, vi),
1580
- uniformIndices: e.getActiveUniformBlockParameter(t, n, yi)
1577
+ usedByVertexShader: e.getActiveUniformBlockParameter(t, n, _i),
1578
+ usedByFragmentShader: e.getActiveUniformBlockParameter(t, n, vi),
1579
+ size: e.getActiveUniformBlockParameter(t, n, yi),
1580
+ uniformIndices: e.getActiveUniformBlockParameter(t, n, bi)
1581
1581
  };
1582
1582
  i.used = i.usedByVertexShader || i.usedByFragmentShader, a[r] = i;
1583
1583
  }
@@ -1586,8 +1586,8 @@ function Wa(e, t) {
1586
1586
  uniformData: r
1587
1587
  };
1588
1588
  }
1589
- var Ga = /\[\d+\]\.$/, Ka = (e, t) => ((e + (t - 1)) / t | 0) * t;
1590
- function qa(e, t, n, r) {
1589
+ var Ka = /\[\d+\]\.$/, qa = (e, t) => ((e + (t - 1)) / t | 0) * t;
1590
+ function Ja(e, t, n, r) {
1591
1591
  if (t || n) {
1592
1592
  r ||= 1;
1593
1593
  let t = e.length / 4;
@@ -1602,26 +1602,26 @@ function qa(e, t, n, r) {
1602
1602
  t.length ? e.set(t) : e[0] = t;
1603
1603
  };
1604
1604
  }
1605
- function Ja(e, t, n, r) {
1605
+ function Ya(e, t, n, r) {
1606
1606
  let i = n.blockSpecs, a = n.uniformData, o = i[r];
1607
- if (!o) return oi("no uniform block object named:", r), {
1607
+ if (!o) return si("no uniform block object named:", r), {
1608
1608
  name: r,
1609
1609
  uniforms: {}
1610
1610
  };
1611
1611
  let s = new ArrayBuffer(o.size), c = e.createBuffer(), l = o.index;
1612
- e.bindBuffer(di, c), e.uniformBlockBinding(t, o.index, l);
1612
+ e.bindBuffer(fi, c), e.uniformBlockBinding(t, o.index, l);
1613
1613
  let u = r + ".";
1614
- Ga.test(u) && (u = u.replace(Ga, "."));
1614
+ Ka.test(u) && (u = u.replace(Ka, "."));
1615
1615
  let d = {}, f = {}, p = {};
1616
1616
  return o.uniformIndices.forEach(function(e) {
1617
1617
  let t = a[e], n = t.name;
1618
1618
  n.startsWith(u) && (n = n.substr(u.length));
1619
1619
  let r = n.endsWith("[0]");
1620
1620
  r && (n = n.substr(0, n.length - 3));
1621
- let i = U[t.type], o = i.Type, c = r ? Ka(i.size, 16) * t.size : i.size * t.size, l = new o(s, t.offset, c / o.BYTES_PER_ELEMENT);
1621
+ let i = U[t.type], o = i.Type, c = r ? qa(i.size, 16) * t.size : i.size * t.size, l = new o(s, t.offset, c / o.BYTES_PER_ELEMENT);
1622
1622
  d[n] = l;
1623
- let m = qa(l, r, i.rows, i.cols);
1624
- f[n] = m, Va(n, m, p, f);
1623
+ let m = Ja(l, r, i.rows, i.cols);
1624
+ f[n] = m, Ha(n, m, p, f);
1625
1625
  }), {
1626
1626
  name: r,
1627
1627
  array: s,
@@ -1631,21 +1631,21 @@ function Ja(e, t, n, r) {
1631
1631
  setters: f
1632
1632
  };
1633
1633
  }
1634
- function Ya(e, t, n) {
1635
- return Ja(e, t.program, t.uniformBlockSpec, n);
1636
- }
1637
1634
  function Xa(e, t, n) {
1635
+ return Ya(e, t.program, t.uniformBlockSpec, n);
1636
+ }
1637
+ function Za(e, t, n) {
1638
1638
  let r = (t.uniformBlockSpec || t).blockSpecs[n.name];
1639
1639
  if (r) {
1640
1640
  let t = r.index;
1641
- return e.bindBufferRange(di, t, n.buffer, n.offset || 0, n.array.byteLength), !0;
1641
+ return e.bindBufferRange(fi, t, n.buffer, n.offset || 0, n.array.byteLength), !0;
1642
1642
  }
1643
1643
  return !1;
1644
1644
  }
1645
- function Za(e, t, n) {
1646
- Xa(e, t, n) && e.bufferData(di, n.array, ci);
1645
+ function Qa(e, t, n) {
1646
+ Za(e, t, n) && e.bufferData(fi, n.array, li);
1647
1647
  }
1648
- function Qa(e, t) {
1648
+ function $a(e, t) {
1649
1649
  let n = e.setters;
1650
1650
  for (let e in t) {
1651
1651
  let r = n[e];
@@ -1655,10 +1655,10 @@ function Qa(e, t) {
1655
1655
  }
1656
1656
  }
1657
1657
  }
1658
- function $a(e, t) {
1658
+ function eo(e, t) {
1659
1659
  for (let n in t) {
1660
1660
  let r = e[n];
1661
- typeof r == "function" ? r(t[n]) : $a(e[n], t[n]);
1661
+ typeof r == "function" ? r(t[n]) : eo(e[n], t[n]);
1662
1662
  }
1663
1663
  }
1664
1664
  function J(e, ...t) {
@@ -1674,60 +1674,60 @@ function J(e, ...t) {
1674
1674
  }
1675
1675
  }
1676
1676
  }
1677
- function eo(e, t) {
1678
- let n = {}, r = e.getProgramParameter(t, pi);
1677
+ function to(e, t) {
1678
+ let n = {}, r = e.getProgramParameter(t, mi);
1679
1679
  for (let i = 0; i < r; ++i) {
1680
1680
  let r = e.getActiveAttrib(t, i);
1681
- if (Ra(r)) continue;
1681
+ if (za(r)) continue;
1682
1682
  let a = e.getAttribLocation(t, r.name), o = q[r.type], s = o.setter(e, a, o);
1683
1683
  s.location = a, n[r.name] = s;
1684
1684
  }
1685
1685
  return n;
1686
1686
  }
1687
- function to(e, t) {
1687
+ function no(e, t) {
1688
1688
  for (let n in t) {
1689
1689
  let r = e[n];
1690
1690
  r && r(t[n]);
1691
1691
  }
1692
1692
  }
1693
1693
  function Y(e, t, n) {
1694
- n.vertexArrayObject ? e.bindVertexArray(n.vertexArrayObject) : (to(t.attribSetters || t, n.attribs), n.indices && e.bindBuffer(ui, n.indices));
1694
+ n.vertexArrayObject ? e.bindVertexArray(n.vertexArrayObject) : (no(t.attribSetters || t, n.attribs), n.indices && e.bindBuffer(di, n.indices));
1695
1695
  }
1696
- function no(e, t) {
1696
+ function ro(e, t) {
1697
1697
  let n = {
1698
1698
  program: t,
1699
- uniformSetters: Ha(e, t),
1700
- attribSetters: eo(e, t)
1699
+ uniformSetters: Ua(e, t),
1700
+ attribSetters: to(e, t)
1701
1701
  };
1702
- return E(e) && (n.uniformBlockSpec = Wa(e, t), n.transformFeedbackInfo = Ua(e, t)), n;
1702
+ return At(e) && (n.uniformBlockSpec = Ga(e, t), n.transformFeedbackInfo = Wa(e, t)), n;
1703
1703
  }
1704
- var ro = 4, io = 5123;
1705
- function ao(e, t, n, r, i, a) {
1706
- n = n === void 0 ? ro : n;
1704
+ var io = 4, ao = 5123;
1705
+ function oo(e, t, n, r, i, a) {
1706
+ n = n === void 0 ? io : n;
1707
1707
  let o = t.indices, s = t.elementType, c = r === void 0 ? t.numElements : r;
1708
- i = i === void 0 ? 0 : i, s || o ? a === void 0 ? e.drawElements(n, c, s === void 0 ? io : t.elementType, i) : e.drawElementsInstanced(n, c, s === void 0 ? io : t.elementType, i, a) : a === void 0 ? e.drawArrays(n, i, c) : e.drawArraysInstanced(n, i, c, a);
1709
- }
1710
- var oo = 36160, X = 36161, so = 3553, co = 5121, lo = 6402, uo = 6408, fo = 33190, po = 36012, mo = 35056, ho = 36013, go = 32854, _o = 32855, vo = 36194, yo = 33189, bo = 6401, xo = 36168, So = 34041, Co = 36064, wo = 36096, To = 36128, Eo = 33306, Do = 33071, Oo = 9729, ko = [{
1711
- format: uo,
1712
- type: co,
1713
- min: Oo,
1714
- wrap: Do
1715
- }, { format: So }], Z = {};
1716
- Z[So] = Eo, Z[bo] = To, Z[xo] = To, Z[lo] = wo, Z[yo] = wo, Z[fo] = wo, Z[po] = wo, Z[mo] = Eo, Z[ho] = Eo;
1717
- function Ao(e, t) {
1708
+ i = i === void 0 ? 0 : i, s || o ? a === void 0 ? e.drawElements(n, c, s === void 0 ? ao : t.elementType, i) : e.drawElementsInstanced(n, c, s === void 0 ? ao : t.elementType, i, a) : a === void 0 ? e.drawArrays(n, i, c) : e.drawArraysInstanced(n, i, c, a);
1709
+ }
1710
+ var so = 36160, X = 36161, co = 3553, lo = 5121, uo = 6402, fo = 6408, po = 33190, mo = 36012, ho = 35056, go = 36013, _o = 32854, vo = 32855, yo = 36194, bo = 33189, xo = 6401, So = 36168, Co = 34041, wo = 36064, To = 36096, Eo = 36128, Do = 33306, Oo = 33071, ko = 9729, Ao = [{
1711
+ format: fo,
1712
+ type: lo,
1713
+ min: ko,
1714
+ wrap: Oo
1715
+ }, { format: Co }], Z = {};
1716
+ Z[Co] = Do, Z[xo] = Eo, Z[So] = Eo, Z[uo] = To, Z[bo] = To, Z[po] = To, Z[mo] = To, Z[ho] = Do, Z[go] = Do;
1717
+ function jo(e, t) {
1718
1718
  return Z[e] || Z[t];
1719
1719
  }
1720
1720
  var Q = {};
1721
- Q[go] = !0, Q[_o] = !0, Q[vo] = !0, Q[So] = !0, Q[yo] = !0, Q[bo] = !0, Q[xo] = !0;
1722
- function jo(e) {
1721
+ Q[_o] = !0, Q[vo] = !0, Q[yo] = !0, Q[Co] = !0, Q[bo] = !0, Q[xo] = !0, Q[So] = !0;
1722
+ function Mo(e) {
1723
1723
  return Q[e];
1724
1724
  }
1725
- function Mo(e) {
1726
- return e >= Co && e < 36096;
1725
+ function No(e) {
1726
+ return e >= wo && e < 36096;
1727
1727
  }
1728
- function No(e, t, n, r) {
1729
- let i = oo, a = e.createFramebuffer();
1730
- e.bindFramebuffer(i, a), n ||= e.drawingBufferWidth, r ||= e.drawingBufferHeight, t ||= ko;
1728
+ function Po(e, t, n, r) {
1729
+ let i = so, a = e.createFramebuffer();
1730
+ e.bindFramebuffer(i, a), n ||= e.drawingBufferWidth, r ||= e.drawingBufferHeight, t ||= Ao;
1731
1731
  let o = [], s = {
1732
1732
  framebuffer: a,
1733
1733
  attachments: [],
@@ -1735,27 +1735,27 @@ function No(e, t, n, r) {
1735
1735
  height: r
1736
1736
  };
1737
1737
  return t.forEach(function(t, a) {
1738
- let c = t.attachment, l = t.samples, u = t.format, d = t.attachmentPoint || Ao(u, t.internalFormat);
1739
- if (d ||= Co + a, Mo(d) && o.push(d), !c) if (l !== void 0 || jo(u)) c = e.createRenderbuffer(), e.bindRenderbuffer(X, c), l > 1 ? e.renderbufferStorageMultisample(X, l, u, n, r) : e.renderbufferStorage(X, u, n, r);
1738
+ let c = t.attachment, l = t.samples, u = t.format, d = t.attachmentPoint || jo(u, t.internalFormat);
1739
+ if (d ||= wo + a, No(d) && o.push(d), !c) if (l !== void 0 || Mo(u)) c = e.createRenderbuffer(), e.bindRenderbuffer(X, c), l > 1 ? e.renderbufferStorageMultisample(X, l, u, n, r) : e.renderbufferStorage(X, u, n, r);
1740
1740
  else {
1741
1741
  let i = Object.assign({}, t);
1742
- i.width = n, i.height = r, i.auto === void 0 && (i.auto = !1, i.min = i.min || i.minMag || Oo, i.mag = i.mag || i.minMag || Oo, i.wrapS = i.wrapS || i.wrap || Do, i.wrapT = i.wrapT || i.wrap || Do), c = ii(e, i);
1742
+ i.width = n, i.height = r, i.auto === void 0 && (i.auto = !1, i.min = i.min || i.minMag || ko, i.mag = i.mag || i.minMag || ko, i.wrapS = i.wrapS || i.wrap || Oo, i.wrapT = i.wrapT || i.wrap || Oo), c = ai(e, i);
1743
1743
  }
1744
1744
  if ($e(e, c)) e.framebufferRenderbuffer(i, d, X, c);
1745
- else if (et(e, c)) t.layer === void 0 ? e.framebufferTexture2D(i, d, t.target || so, c, t.level || 0) : e.framebufferTextureLayer(i, d, c, t.level || 0, t.layer);
1745
+ else if (et(e, c)) t.layer === void 0 ? e.framebufferTexture2D(i, d, t.target || co, c, t.level || 0) : e.framebufferTextureLayer(i, d, c, t.level || 0, t.layer);
1746
1746
  else throw Error("unknown attachment type");
1747
1747
  s.attachments.push(c);
1748
1748
  }), e.drawBuffers && e.drawBuffers(o), s;
1749
1749
  }
1750
- function Po(e, t, n, r, i) {
1751
- r ||= e.drawingBufferWidth, i ||= e.drawingBufferHeight, t.width = r, t.height = i, n ||= ko, n.forEach(function(n, a) {
1750
+ function Fo(e, t, n, r, i) {
1751
+ r ||= e.drawingBufferWidth, i ||= e.drawingBufferHeight, t.width = r, t.height = i, n ||= Ao, n.forEach(function(n, a) {
1752
1752
  let o = t.attachments[a], s = n.format, c = n.samples;
1753
1753
  if (c !== void 0 || $e(e, o)) e.bindRenderbuffer(X, o), c > 1 ? e.renderbufferStorageMultisample(X, c, s, r, i) : e.renderbufferStorage(X, s, r, i);
1754
- else if (et(e, o)) ai(e, o, n, r, i);
1754
+ else if (et(e, o)) oi(e, o, n, r, i);
1755
1755
  else throw Error("unknown attachment type");
1756
1756
  });
1757
1757
  }
1758
- function Fo(e, t, n) {
1758
+ function Io(e, t, n) {
1759
1759
  let r = e.createVertexArray();
1760
1760
  return e.bindVertexArray(r), t.length || (t = [t]), t.forEach(function(t) {
1761
1761
  Y(e, t, n);
@@ -1765,12 +1765,12 @@ function Fo(e, t, n) {
1765
1765
  vertexArrayObject: r
1766
1766
  };
1767
1767
  }
1768
- var Io = { addExtensionsToContext: !0 }, Lo = /^(.*?)_/;
1769
- function Ro(e, t) {
1770
- At(e, 0);
1768
+ var Lo = { addExtensionsToContext: !0 }, Ro = /^(.*?)_/;
1769
+ function zo(e, t) {
1770
+ jt(e, 0);
1771
1771
  let n = e.getExtension(t);
1772
1772
  if (n) {
1773
- let r = {}, i = Lo.exec(t)[1], a = "_" + i;
1773
+ let r = {}, i = Ro.exec(t)[1], a = "_" + i;
1774
1774
  for (let t in n) {
1775
1775
  let o = n[t], s = typeof o == "function", c = s ? i : a, l = t;
1776
1776
  t.endsWith(c) && (l = t.substring(0, t.length - c.length)), e[l] === void 0 ? s ? e[l] = function(e) {
@@ -1779,11 +1779,11 @@ function Ro(e, t) {
1779
1779
  };
1780
1780
  }(o) : (e[l] = o, r[l] = o) : !s && e[l] !== o && Ze(l, e[l], o, t);
1781
1781
  }
1782
- r.constructor = { name: n.constructor.name }, At(r, 0);
1782
+ r.constructor = { name: n.constructor.name }, jt(r, 0);
1783
1783
  }
1784
1784
  return n;
1785
1785
  }
1786
- var zo = [
1786
+ var Bo = [
1787
1787
  "ANGLE_instanced_arrays",
1788
1788
  "EXT_blend_minmax",
1789
1789
  "EXT_color_buffer_float",
@@ -1810,89 +1810,89 @@ var zo = [
1810
1810
  "WEBGL_depth_texture",
1811
1811
  "WEBGL_draw_buffers"
1812
1812
  ];
1813
- function Bo(e) {
1814
- for (let t = 0; t < zo.length; ++t) Ro(e, zo[t]);
1813
+ function Vo(e) {
1814
+ for (let t = 0; t < Bo.length; ++t) zo(e, Bo[t]);
1815
1815
  }
1816
- function Vo(e, t) {
1816
+ function Ho(e, t) {
1817
1817
  let n = [
1818
1818
  "webgl2",
1819
1819
  "webgl",
1820
1820
  "experimental-webgl"
1821
1821
  ], r = null;
1822
1822
  for (let i = 0; i < n.length; ++i) if (r = e.getContext(n[i], t), r) {
1823
- Io.addExtensionsToContext && Bo(r);
1823
+ Lo.addExtensionsToContext && Vo(r);
1824
1824
  break;
1825
1825
  }
1826
1826
  return r;
1827
1827
  }
1828
- function Ho(e, t) {
1829
- return Vo(e, t);
1828
+ function Uo(e, t) {
1829
+ return Ho(e, t);
1830
1830
  }
1831
1831
  //#endregion
1832
1832
  //#region ../core/src/rendering/webgl/gl/colorUtils.js
1833
- function Uo(e, t, n, r, i = !1) {
1834
- let a = s(e) ? e : e.name, c = !s(e) && e.extent || [0, 1];
1835
- if (n === void 0 && !s(e) && (n = e.count), a) {
1836
- let e = ce(a);
1837
- if (o(e)) {
1838
- let a = qo(e, {
1839
- extent: c,
1833
+ function Wo(e, t, n, r, a = !1) {
1834
+ let o = c(e) ? e : e.name, l = !c(e) && e.extent || [0, 1];
1835
+ if (n === void 0 && !c(e) && (n = e.count), o) {
1836
+ let e = ce(o);
1837
+ if (i(e)) {
1838
+ let i = Jo(e, {
1839
+ extent: l,
1840
1840
  count: n,
1841
- reverse: i
1841
+ reverse: a
1842
1842
  });
1843
- return Vs(t, {
1843
+ return Ws(t, {
1844
1844
  minMag: t.LINEAR,
1845
1845
  format: t.RGB,
1846
1846
  height: 1,
1847
1847
  wrap: t.CLAMP_TO_EDGE
1848
- }, a, r);
1849
- } else if (se(e)) return Ko(i ? Array.from(e).reverse() : e, t, n, r);
1850
- else throw Error("Unknown scheme: " + a);
1848
+ }, i, r);
1849
+ } else if (s(e)) return qo(a ? Array.from(e).reverse() : e, t, n, r);
1850
+ else throw Error("Unknown scheme: " + o);
1851
1851
  }
1852
1852
  }
1853
- function Wo(e, t = "rgb", n, r) {
1854
- let i = qo(le(e, s(t) ? t : t.type, s(t) ? void 0 : t.gamma));
1855
- return Vs(n, {
1853
+ function Go(e, t = "rgb", n, r) {
1854
+ let i = Jo(le(e, c(t) ? t : t.type, c(t) ? void 0 : t.gamma));
1855
+ return Ws(n, {
1856
1856
  minMag: n.LINEAR,
1857
1857
  format: n.RGB,
1858
1858
  height: 1,
1859
1859
  wrap: n.CLAMP_TO_EDGE
1860
1860
  }, i, r);
1861
1861
  }
1862
- function Go(e, t, n, r) {
1862
+ function Ko(e, t, n, r) {
1863
1863
  let i = Math.max(e.length, n || 0), a = new Float32Array(i);
1864
1864
  for (let t = 0; t < i; t++) a[t] = e[t % e.length];
1865
- return Vs(t, {
1865
+ return Ws(t, {
1866
1866
  minMag: t.NEAREST,
1867
1867
  format: t.RED,
1868
1868
  internalFormat: t.R32F,
1869
1869
  height: 1
1870
1870
  }, a, r);
1871
1871
  }
1872
- function Ko(e, t, n, r) {
1873
- let i = Jo(e, n);
1874
- return Vs(t, {
1872
+ function qo(e, t, n, r) {
1873
+ let i = Yo(e, n);
1874
+ return Ws(t, {
1875
1875
  minMag: t.NEAREST,
1876
1876
  format: t.RGB,
1877
1877
  height: 1
1878
1878
  }, i, r);
1879
1879
  }
1880
- function qo(e, { extent: t = [0, 1], reverse: n = !1, count: r = 256 } = {}) {
1881
- let i = t[0], a = l(t) - i, o = h(r).map((e) => e / (r - 1)).map((e) => i + e / a).map(e);
1882
- return n && o.reverse(), Jo(o);
1880
+ function Jo(e, { extent: t = [0, 1], reverse: n = !1, count: r = 256 } = {}) {
1881
+ let i = t[0], a = re(t) - i, o = _(r).map((e) => e / (r - 1)).map((e) => i + e / a).map(e);
1882
+ return n && o.reverse(), Yo(o);
1883
1883
  }
1884
- function Jo(e, t) {
1884
+ function Yo(e, t) {
1885
1885
  let n = Math.max(e.length, t || 0), r = new Uint8Array(n * 3);
1886
1886
  for (let t = 0; t < n; t++) {
1887
- let n = e[t % e.length], i = m(n);
1887
+ let n = e[t % e.length], i = p(n);
1888
1888
  if (!i) throw Error(`Invalid color "${n}" in the scheme ${JSON.stringify(e)}!`);
1889
1889
  let a = i.rgb();
1890
1890
  r[t * 3 + 0] = a.r, r[t * 3 + 1] = a.g, r[t * 3 + 2] = a.b;
1891
1891
  }
1892
1892
  return r;
1893
1893
  }
1894
- function Yo(e) {
1895
- let t = m(e).rgb();
1894
+ function Xo(e) {
1895
+ let t = p(e).rgb();
1896
1896
  return [
1897
1897
  t.r,
1898
1898
  t.g,
@@ -1901,8 +1901,8 @@ function Yo(e) {
1901
1901
  }
1902
1902
  //#endregion
1903
1903
  //#region ../core/src/rendering/webgl/gl/glslScaleGenerator.js
1904
- var Xo = "attr_", Zo = "uDomain_", Qo = "range_", $o = "accessor_", es = "scale_", ts = "getScaled_", ns = "uRangeTexture_", rs = "uParam_", is = "checkSelection_";
1905
- function as(e) {
1904
+ var Zo = "attr_", Qo = "uDomain_", $o = "range_", es = "accessor_", ts = "scale_", ns = "getScaled_", rs = "uRangeTexture_", $ = "uParam_", is = "checkSelection_", as = "isSelectionMember_", os = "isSelectionEmpty_";
1905
+ function ss(e) {
1906
1906
  let t = e.match(/^(?:(\w+)-)?(\w+)$/);
1907
1907
  if (!t) throw Error("Not a scale type: " + e);
1908
1908
  return {
@@ -1910,29 +1910,29 @@ function as(e) {
1910
1910
  transform: t[2]
1911
1911
  };
1912
1912
  }
1913
- function os(e) {
1913
+ function cs(e) {
1914
1914
  return e.type === "quantize" ? e.thresholds() : e.domain();
1915
1915
  }
1916
- function ss(e) {
1916
+ function ls(e) {
1917
1917
  return e.type === "quantize" ? e.range().length : e.type === "threshold" ? e.domain().length + 1 : e.domain().length;
1918
1918
  }
1919
- function cs(e, t) {
1920
- return `${$o}${e}_${t}`;
1919
+ function us(e, t) {
1920
+ return `${es}${e}_${t}`;
1921
1921
  }
1922
- function ls(e, n, r) {
1922
+ function ds(e, t, r) {
1923
1923
  let i;
1924
- if (_(e)) i = $(ae(e)(r));
1925
- else if (s(r)) if (S(e)) i = vs(r);
1924
+ if (l(e)) i = vs(S(e)(r));
1925
+ else if (c(r)) if (y(e)) i = xs(r);
1926
1926
  else throw Error(`String values are not supported on the "${e}" channel: ${r}`);
1927
- else if (t(r)) i = $(+!!r);
1928
- else if (r === null) if (S(e)) i = $([
1927
+ else if (n(r)) i = vs(+!!r);
1928
+ else if (r === null) if (y(e)) i = vs([
1929
1929
  0,
1930
1930
  0,
1931
1931
  0
1932
1932
  ]);
1933
1933
  else throw Error(`null value is not supported on the "${e}" chanel.`);
1934
- else i = $(r);
1935
- let a = cs(e, n);
1934
+ else i = vs(r);
1935
+ let a = us(e, t);
1936
1936
  return {
1937
1937
  channel: e,
1938
1938
  accessorGlsl: `
@@ -1943,10 +1943,10 @@ ${i.type} ${a}() {
1943
1943
  accessorFunctionName: a
1944
1944
  };
1945
1945
  }
1946
- function us(e, t) {
1946
+ function fs(e, t) {
1947
1947
  let n = "float", r = (e) => e;
1948
- S(e) ? (n = "vec3", r = (e) => Yo(e)) : _(e) && (r = ae(e));
1949
- let i = `u${Os(e)}_${t}`, a = ` // Dynamic value\n uniform ${n} ${i};`, o = cs(e, t);
1948
+ y(e) ? (n = "vec3", r = (e) => Xo(e)) : l(e) && (r = S(e));
1949
+ let i = `u${js(e)}_${t}`, a = ` // Dynamic value\n uniform ${n} ${i};`, o = us(e, t);
1950
1950
  return {
1951
1951
  channel: e,
1952
1952
  uniformName: i,
@@ -1960,8 +1960,8 @@ ${n} ${o}() {
1960
1960
  adjuster: r
1961
1961
  };
1962
1962
  }
1963
- function ds(e, t, n, r = [e]) {
1964
- let { attributeType: i } = xs(t, e), a = Ds(r), o = `in highp ${i} ${a};`, s = cs(e, n);
1963
+ function ps(e, t, n, r = [e]) {
1964
+ let { attributeType: i } = ws(t, e), a = As(r), o = `in highp ${i} ${a};`, s = us(e, n);
1965
1965
  return {
1966
1966
  channel: e,
1967
1967
  attributeName: a,
@@ -1973,8 +1973,8 @@ ${i} ${s}() {
1973
1973
  accessorFunctionName: s
1974
1974
  };
1975
1975
  }
1976
- function fs(e, t, n) {
1977
- let { attributeType: r } = xs(t, e), i = Ds(e), a = ` uniform highp ${r} ${i};`, o = cs(e, n);
1976
+ function ms(e, t, n) {
1977
+ let { attributeType: r } = ws(t, e), i = As(e), a = ` uniform highp ${r} ${i};`, o = us(e, n);
1978
1978
  return {
1979
1979
  channel: e,
1980
1980
  uniformName: i,
@@ -1986,108 +1986,112 @@ ${r} ${o}() {
1986
1986
  accessorFunctionName: o
1987
1987
  };
1988
1988
  }
1989
- function ps(e, t, n) {
1989
+ function hs(e, t, n) {
1990
1990
  t ??= me();
1991
- let r = u(e), a = Zo + r, o = Qo + r, { hp: s, attributeType: c } = xs(t, e), l = t.domain ? C(t.type) ? os(t).length : t.domain().length : void 0, f, p = [];
1992
- p.push(""), p.push("/".repeat(70)), p.push(`// Channel: ${e}`), p.push("");
1993
- let { transform: m } = as(t.type), h = (e, ...t) => bs.apply(null, [
1991
+ let r = ie(e), i = Qo + r, a = $o + r, { hp: o, attributeType: s } = ws(t, e), c = t.domain ? w(t.type) ? cs(t).length : t.domain().length : void 0, l, d = [];
1992
+ d.push(""), d.push("/".repeat(70)), d.push(`// Channel: ${e}`), d.push("");
1993
+ let { transform: f } = ss(t.type), p = (e, ...t) => Cs.apply(null, [
1994
1994
  e,
1995
1995
  "value",
1996
1996
  ...t
1997
- ]), g;
1998
- switch (m) {
1997
+ ]), m;
1998
+ switch (f) {
1999
1999
  case "linear":
2000
- g = h("scaleLinear", "domain", o);
2000
+ m = p("scaleLinear", "domain", a);
2001
2001
  break;
2002
2002
  case "log":
2003
- g = h("scaleLog", "domain", o, t.base());
2003
+ m = p("scaleLog", "domain", a, t.base());
2004
2004
  break;
2005
2005
  case "symlog":
2006
- g = h("scaleSymlog", "domain", o, t.constant());
2006
+ m = p("scaleSymlog", "domain", a, t.constant());
2007
2007
  break;
2008
2008
  case "pow":
2009
2009
  case "sqrt":
2010
- g = h("scalePow", "domain", o, t.exponent());
2010
+ m = p("scalePow", "domain", a, t.exponent());
2011
2011
  break;
2012
2012
  case "index":
2013
2013
  case "locus":
2014
- g = h("scaleBandHp", "domain", o, t.paddingInner(), t.paddingOuter(), t.align(), n.band ?? .5);
2014
+ m = p("scaleBandHp", "domain", a, t.paddingInner(), t.paddingOuter(), t.align(), n.band ?? .5);
2015
2015
  break;
2016
2016
  case "point":
2017
2017
  case "band":
2018
- g = h("scaleBand", "domain", o, t.paddingInner(), t.paddingOuter(), t.align(), n.band ?? .5);
2018
+ m = p("scaleBand", "domain", a, t.paddingInner(), t.paddingOuter(), t.align(), n.band ?? .5);
2019
2019
  break;
2020
2020
  case "ordinal":
2021
2021
  case "null":
2022
2022
  case "identity":
2023
- g = h("scaleIdentity");
2023
+ m = p("scaleIdentity");
2024
2024
  break;
2025
2025
  case "threshold":
2026
2026
  case "quantize": break;
2027
2027
  default: throw Error(`Unsupported scale type: ${t.type}! ${e}: ${JSON.stringify(n)}`);
2028
2028
  }
2029
- let _ = ks(t, e), v;
2030
- if (_ && e == r) {
2029
+ let h = Ms(t, e), g;
2030
+ if (h && e == r) {
2031
2031
  let e = t.props.range ?? [];
2032
- if (d(e) || e.some(d)) {
2033
- if (_.length < 1 || _.length > 4) throw Error(`A range with ExprRefs must have 1-4 elements, not ${_.length}! Range: ${JSON.stringify(_)}`);
2034
- v = ` uniform ${gs(_.length)} ${o};`;
2035
- } else if (_.length && _.every(i)) {
2036
- let e = ys(_);
2037
- p.push(`const ${e.type} ${o} = ${e};`);
2032
+ if (u(e) || e.some(u)) {
2033
+ if (h.length < 1 || h.length > 4) throw Error(`A range with ExprRefs must have 1-4 elements, not ${h.length}! Range: ${JSON.stringify(h)}`);
2034
+ g = ` uniform ${ys(h.length)} ${a};`;
2035
+ } else if (h.length && h.every(C)) {
2036
+ let e = Ss(h);
2037
+ d.push(`const ${e.type} ${a} = ${e};`);
2038
2038
  }
2039
2039
  }
2040
- let ee = _s(e), y;
2041
- if (S(e)) {
2042
- let n = ns + r;
2043
- if (e == r && p.push(`uniform sampler2D ${n};`), w(t.type)) y = `getInterpolatedColor(${n}, transformed)`;
2044
- else if (fe(t.type) || C(t.type)) y = `getDiscreteColor(${n}, int(transformed))`;
2040
+ let _ = bs(e), v;
2041
+ if (y(e)) {
2042
+ let n = rs + r;
2043
+ if (e == r && d.push(`uniform sampler2D ${n};`), T(t.type)) v = `getInterpolatedColor(${n}, transformed)`;
2044
+ else if (fe(t.type) || w(t.type)) v = `getDiscreteColor(${n}, int(transformed))`;
2045
2045
  else throw Error("Problem with color scale!");
2046
- } else if (t.type === "ordinal" || C(t.type)) {
2047
- let t = ns + r;
2048
- e == r && p.push(`uniform sampler2D ${t};`), y = `getDiscreteColor(${t}, int(transformed)).r`;
2049
- }
2050
- let b = [], te = w(t.type) && l > 2, ne = C(t.type) || te;
2051
- if (b.push("int slot = 0;"), ne) {
2052
- let e = a;
2053
- b.push(te ? `while (slot < ${e}.length() - 2 && value >= ${e}[slot + 1]) { slot++; }` : `while (slot < ${e}.length() && value >= ${e}[slot]) { slot++; }`);
2054
- }
2055
- let x = w(t.type) || C(t.type) || ["band", "point"].includes(t.type);
2056
- if (g) {
2057
- let e = a;
2058
- x && (s ? b.push(`vec3 domain = ${e};`) : b.push(`vec2 domain = vec2(${e}[slot], ${e}[slot + 1]);`)), b.push(`float transformed = ${g};`), te && b.push(`transformed = (float(slot) + transformed) / (float(${e}.length() - 1));`);
2046
+ } else if (t.type === "ordinal" || w(t.type)) {
2047
+ let t = rs + r;
2048
+ e == r && d.push(`uniform sampler2D ${t};`), v = `getDiscreteColor(${t}, int(transformed)).r`;
2049
+ }
2050
+ let b = [], x = T(t.type) && c > 2, ee = w(t.type) || x;
2051
+ if (b.push("int slot = 0;"), ee) {
2052
+ let e = i;
2053
+ b.push(x ? `while (slot < ${e}.length() - 2 && value >= ${e}[slot + 1]) { slot++; }` : `while (slot < ${e}.length() && value >= ${e}[slot]) { slot++; }`);
2054
+ }
2055
+ let S = T(t.type) || w(t.type) || ["band", "point"].includes(t.type);
2056
+ if (m) {
2057
+ let e = i;
2058
+ S && (o ? b.push(`vec3 domain = ${e};`) : b.push(`vec2 domain = vec2(${e}[slot], ${e}[slot + 1]);`)), b.push(`float transformed = ${m};`), x && b.push(`transformed = (float(slot) + transformed) / (float(${e}.length() - 1));`);
2059
2059
  } else b.push("float transformed = float(slot);");
2060
- "clamp" in t && t.clamp() && b.push(`transformed = clampToRange(transformed, ${ys(_)});`), b.push(`return ${y ?? "transformed"};`), p.push(`
2061
- ${ee} ${es}${e}(${c} value) {
2060
+ "clamp" in t && t.clamp() && b.push(`transformed = clampToRange(transformed, ${Ss(h)});`), b.push(`return ${v ?? "transformed"};`), d.push(`
2061
+ ${_} ${ts}${e}(${s} value) {
2062
2062
  ${b.map((e) => ` ${e}\n`).join("")}
2063
2063
  }`);
2064
- let re = p.join("\n");
2065
- if (x && e == r) {
2066
- let e = w(t.type) || C(t.type) ? l : 2;
2067
- f = s ? ` highp vec3 ${a};` : ` mediump float ${a}[${e}];`;
2064
+ let te = d.join("\n");
2065
+ if (S && e == r) {
2066
+ let e = T(t.type) || w(t.type) ? c : 2;
2067
+ l = o ? ` highp vec3 ${i};` : ` mediump float ${i}[${e}];`;
2068
2068
  }
2069
2069
  return {
2070
- glsl: re,
2071
- domainUniformName: a,
2072
- domainUniform: f,
2073
- rangeUniformName: o,
2074
- rangeUniform: v
2070
+ glsl: te,
2071
+ domainUniformName: i,
2072
+ domainUniform: l,
2073
+ rangeUniformName: a,
2074
+ rangeUniform: g
2075
2075
  };
2076
2076
  }
2077
- function ms(e, t) {
2078
- let n = _s(e), r = [], i = [];
2077
+ function gs(e, t) {
2078
+ let n = bs(e), r = [], i = [];
2079
2079
  for (let n = 0; n < t.length; n++) {
2080
- let { accessor: a, predicate: o } = t[n], s = cs(e, n), { param: c, empty: l } = o;
2081
- r.push(c ? `${is}${c}(${!!l})` : null), i.push(a.scaleChannel ? `return ${es}${e}(${s}());` : `return ${s}();`);
2080
+ let { accessor: a, predicate: o } = t[n], s = us(e, n), { selection: c } = o;
2081
+ if (c && !c.singleParam) {
2082
+ let e = c.empty, t = c.params.map((e) => `${as}${e}()`), n = c.params.map((e) => `${os}${e}()`);
2083
+ r.push(`(${t.join(" || ")}${e ? ` || (${n.join(" && ")})` : ""})`);
2084
+ } else r.push(c ? `${is}${c.params[0]}(${c.empty})` : null);
2085
+ i.push(a.scaleChannel ? `return ${ts}${e}(${s}());` : `return ${s}();`);
2082
2086
  }
2083
- return `${n} ${ts}${e}() {
2084
- ${As(r, i)}
2087
+ return `${n} ${ns}${e}() {
2088
+ ${Ns(r, i)}
2085
2089
  }
2086
2090
 
2087
2091
  #define ${e}_DEFINED`;
2088
2092
  }
2089
- function hs(e) {
2090
- if (!i(e)) throw Error(`Not a number: ${e}`);
2093
+ function _s(e) {
2094
+ if (!C(e)) throw Error(`Not a number: ${e}`);
2091
2095
  if (e == Infinity) return "3.402823466e+38";
2092
2096
  if (e == -Infinity) return "-3.402823466e+38";
2093
2097
  {
@@ -2095,17 +2099,17 @@ function hs(e) {
2095
2099
  return /^(-)?\d+$/.test(t) && (t += ".0"), t;
2096
2100
  }
2097
2101
  }
2098
- function $(e) {
2102
+ function vs(e) {
2099
2103
  typeof e == "number" && (e = [e]);
2100
2104
  let t = e.length;
2101
2105
  if (t < 1 || t > 4) throw Error("Invalid number of components: " + t);
2102
- let n = gs(t), r = `${n}(${e.map(hs).join(", ")})`;
2106
+ let n = ys(t), r = `${n}(${e.map(_s).join(", ")})`;
2103
2107
  return Object.assign(r, {
2104
2108
  type: n,
2105
2109
  numComponents: t
2106
2110
  });
2107
2111
  }
2108
- function gs(e) {
2112
+ function ys(e) {
2109
2113
  switch (e) {
2110
2114
  case 1: return "float";
2111
2115
  case 2: return "vec2";
@@ -2114,21 +2118,21 @@ function gs(e) {
2114
2118
  default: throw Error("Invalid number of components: " + e);
2115
2119
  }
2116
2120
  }
2117
- function _s(e) {
2118
- return S(e) ? "vec3" : e == "uniqueId" ? "uint" : "float";
2121
+ function bs(e) {
2122
+ return y(e) ? "vec3" : e == "uniqueId" ? "uint" : "float";
2119
2123
  }
2120
- function vs(e) {
2121
- return $(Yo(e));
2124
+ function xs(e) {
2125
+ return vs(Xo(e));
2122
2126
  }
2123
- function ys(e) {
2124
- return $([e[0], l(e)]);
2127
+ function Ss(e) {
2128
+ return vs([e[0], re(e)]);
2125
2129
  }
2126
- function bs(e, ...t) {
2130
+ function Cs(e, ...t) {
2127
2131
  let n = [];
2128
- for (let e of t) i(e) ? n.push(hs(e)) : se(e) ? n.push($(e)) : n.push(e);
2132
+ for (let e of t) C(e) ? n.push(_s(e)) : s(e) ? n.push(vs(e)) : n.push(e);
2129
2133
  return `${e}(${n.join(", ")})`;
2130
2134
  }
2131
- function xs(e, t) {
2135
+ function ws(e, t) {
2132
2136
  let n = e && fe(e.type), r = e && ge(e.type), i = r && pe(e.domain()), a = i ? {
2133
2137
  attributeType: "uvec2",
2134
2138
  arrayConstructor: Uint32Array
@@ -2152,38 +2156,38 @@ function xs(e, t) {
2152
2156
  largeHp: i
2153
2157
  });
2154
2158
  }
2155
- var Ss = 2 ** 12;
2156
- Ss - 1;
2157
- function Cs(e, t = []) {
2158
- let n = e % Ss;
2159
- return t[0] = (e - n) / Ss, t[1] = n, t;
2159
+ var Ts = 2 ** 12;
2160
+ Ts - 1;
2161
+ function Es(e, t = []) {
2162
+ let n = e % Ts;
2163
+ return t[0] = (e - n) / Ts, t[1] = n, t;
2160
2164
  }
2161
- function ws(e) {
2162
- let t = e % Ss;
2165
+ function Ds(e) {
2166
+ let t = e % Ts;
2163
2167
  return [e - t, t];
2164
2168
  }
2165
- function Ts(e) {
2166
- return [...ws(e[0]), e[1] - e[0]];
2169
+ function Os(e) {
2170
+ return [...Ds(e[0]), e[1] - e[0]];
2167
2171
  }
2168
- function Es(e) {
2172
+ function ks(e) {
2169
2173
  let t = new ue([], JSON.stringify);
2170
2174
  for (let [n, r] of Object.entries(e)) {
2171
2175
  let e = r.channelDef;
2172
- if (v(e)) {
2173
- let i = [e.field, r.scale ? (w(r.scale.type) || C(r.scale.type)) ?? !1 : !1];
2176
+ if (oe(e)) {
2177
+ let i = [e.field, r.scale ? (T(r.scale.type) || w(r.scale.type)) ?? !1 : !1];
2174
2178
  t.set(i, [...t.get(i) ?? [], n]);
2175
2179
  }
2176
2180
  }
2177
2181
  return t;
2178
2182
  }
2179
- function Ds(e) {
2180
- return Xo + ne(e).toSorted().join("_");
2183
+ function As(e) {
2184
+ return Zo + d(e).toSorted().join("_");
2181
2185
  }
2182
- function Os(e) {
2186
+ function js(e) {
2183
2187
  return e[0].toUpperCase() + e.slice(1);
2184
2188
  }
2185
- var ks = (e, t) => de(e.type) || w(e.type) && S(t) ? [0, 1] : e.range ? e.range() : void 0;
2186
- function As(e, t) {
2189
+ var Ms = (e, t) => de(e.type) || T(e.type) && y(t) ? [0, 1] : e.range ? e.range() : void 0;
2190
+ function Ns(e, t) {
2187
2191
  if (e.length != t.length) throw Error("Unequal array lengths");
2188
2192
  let n = e.length;
2189
2193
  if (n == 0) return "";
@@ -2199,23 +2203,23 @@ function As(e, t) {
2199
2203
  }
2200
2204
  //#endregion
2201
2205
  //#region ../core/src/rendering/webgl/gl/hashTable.js
2202
- var js = 4294967295, Ms = 4294967295;
2203
- function Ns(e) {
2206
+ var Ps = 4294967295, Fs = 4294967295;
2207
+ function Is(e) {
2204
2208
  let t = e >>> 0;
2205
2209
  return t ^= t >>> 16, t = Math.imul(t, 2146121005), t ^= t >>> 15, t = Math.imul(t, 2221713035), t ^= t >>> 16, t >>> 0;
2206
2210
  }
2207
- function Ps(e, t = {}) {
2208
- let n = Array.from(e, (e) => Is(e, "key")), r = n.length, i = t.maxLoadFactor ?? .6;
2211
+ function Ls(e, t = {}) {
2212
+ let n = Array.from(e, (e) => zs(e, "key")), r = n.length, i = t.maxLoadFactor ?? .6;
2209
2213
  if (!(i > 0 && i < 1)) throw Error("maxLoadFactor must be between 0 and 1.");
2210
- let a = t.capacity ?? Ls(Math.ceil(r / i));
2214
+ let a = t.capacity ?? Bs(Math.ceil(r / i));
2211
2215
  if (!Number.isSafeInteger(a) || a < 1) throw Error("capacity must be a positive power of two.");
2212
2216
  if (a & a - 1) throw Error("capacity must be a power of two.");
2213
2217
  let o = new Uint32Array(a);
2214
- o.fill(js);
2218
+ o.fill(Ps);
2215
2219
  let s = a - 1;
2216
2220
  for (let e of n) {
2217
2221
  if (e === 4294967295) throw Error("Hash table keys must not equal the empty sentinel (0xffffffff).");
2218
- let t = Ns(e) & s, n = !1;
2222
+ let t = Is(e) & s, n = !1;
2219
2223
  for (let r = 0; r < a; r += 1) {
2220
2224
  let r = o[t];
2221
2225
  if (r === 4294967295 || r === e) {
@@ -2232,7 +2236,7 @@ function Ps(e, t = {}) {
2232
2236
  size: r
2233
2237
  };
2234
2238
  }
2235
- function Fs(e, t) {
2239
+ function Rs(e, t) {
2236
2240
  if (!Number.isSafeInteger(e) || e < 1) throw Error("capacity must be a positive integer.");
2237
2241
  if (e & e - 1) throw Error("capacity must be a power of two.");
2238
2242
  if (!Number.isSafeInteger(t) || t < 1) throw Error("maxTextureSize must be a positive integer.");
@@ -2244,17 +2248,17 @@ function Fs(e, t) {
2244
2248
  height: i
2245
2249
  };
2246
2250
  }
2247
- function Is(e, t) {
2248
- if (!Number.isSafeInteger(e) || e < 0 || e > Ms) throw Error(t + " must be a non-negative u32.");
2251
+ function zs(e, t) {
2252
+ if (!Number.isSafeInteger(e) || e < 0 || e > Fs) throw Error(t + " must be a non-negative u32.");
2249
2253
  return e >>> 0;
2250
2254
  }
2251
- function Ls(e) {
2255
+ function Bs(e) {
2252
2256
  let t = Math.max(1, e);
2253
2257
  return --t, t |= t >>> 1, t |= t >>> 2, t |= t >>> 4, t |= t >>> 8, t |= t >>> 16, t + 1;
2254
2258
  }
2255
2259
  //#endregion
2256
2260
  //#region ../core/src/rendering/webgl/gl/webGLHelper.js
2257
- var Rs = class {
2261
+ var Vs = class {
2258
2262
  #e = !1;
2259
2263
  #t = () => {};
2260
2264
  _ownedTextures = /* @__PURE__ */ new Set();
@@ -2265,22 +2269,22 @@ var Rs = class {
2265
2269
  height: void 0
2266
2270
  }));
2267
2271
  this._canvasSizeHelper = void 0, this._appliedCanvasSize = void 0, this._onCanvasResize = r ?? (() => {}), this._shaderCache = /* @__PURE__ */ new Map(), this.rangeTextures = /* @__PURE__ */ new WeakMap(), this.placementTextures = /* @__PURE__ */ new WeakMap(), this.selectionTextures = /* @__PURE__ */ new WeakMap();
2268
- let a = document.createElement("canvas"), o = Ho(a, {
2272
+ let a = document.createElement("canvas"), o = Uo(a, {
2269
2273
  antialias: !0,
2270
2274
  depth: !1,
2271
2275
  premultipliedAlpha: !0,
2272
2276
  ...n
2273
2277
  });
2274
2278
  if (!o) throw Error("Unable to initialize WebGL. Your browser or machine may not support it.");
2275
- if (!E(o)) throw Error("Your web browser does not support WebGL 2.0. Chrome, Firefox, and Safari Tech Preview should work.");
2276
- Bo(o);
2279
+ if (!At(o)) throw Error("Your web browser does not support WebGL 2.0. Chrome, Firefox, and Safari Tech Preview should work.");
2280
+ Vo(o);
2277
2281
  let s = o.getExtension("WEBGL_provoking_vertex");
2278
2282
  s && s.provokingVertexWEBGL(s.FIRST_VERTEX_CONVENTION_WEBGL), o.blendFunc(o.ONE, o.ONE_MINUS_SRC_ALPHA), this.canvas = a, this.gl = o, this._pickingAttachmentOptions = [{
2279
2283
  format: o.RGBA,
2280
2284
  type: o.UNSIGNED_BYTE,
2281
2285
  minMag: o.LINEAR,
2282
2286
  wrap: o.CLAMP_TO_EDGE
2283
- }], this._pickingBufferInfo = No(o, this._pickingAttachmentOptions), o.bindFramebuffer(o.FRAMEBUFFER, null), e.appendChild(a);
2287
+ }], this._pickingBufferInfo = Po(o, this._pickingAttachmentOptions), o.bindFramebuffer(o.FRAMEBUFFER, null), e.appendChild(a);
2284
2288
  try {
2285
2289
  this._canvasSizeHelper = new Te(e, a, i, () => {
2286
2290
  this.adjustGl() && this._onCanvasResize();
@@ -2294,7 +2298,7 @@ var Rs = class {
2294
2298
  if (n?.geometryRevision === t.geometryRevision) return n.texture;
2295
2299
  let r = n?.data.length === t.rectangles.length / 2 ? n.data : new Float32Array(t.rectangles.length / 2);
2296
2300
  for (let e = 0; e < t.rectangles.length / 4; e++) r[e * 2] = t.rectangles[e * 4 + 1], r[e * 2 + 1] = t.rectangles[e * 4 + 3];
2297
- let i = Vs(this.gl, {
2301
+ let i = Ws(this.gl, {
2298
2302
  internalFormat: this.gl.RG32F,
2299
2303
  format: this.gl.RG,
2300
2304
  height: 1
@@ -2317,7 +2321,7 @@ var Rs = class {
2317
2321
  return this._canvasSizeHelper.invalidate(), this.adjustGl();
2318
2322
  }
2319
2323
  compileShader(e, t) {
2320
- se(t) && (t = t.join("\n\n"));
2324
+ s(t) && (t = t.join("\n\n"));
2321
2325
  let n = this.gl, r = t.replaceAll(/ {2,}|^\s*\/\/.*$/gm, ""), i = this._shaderCache.get(r);
2322
2326
  if (!i) {
2323
2327
  let a = [
@@ -2331,7 +2335,7 @@ var Rs = class {
2331
2335
  }
2332
2336
  adjustGl() {
2333
2337
  let e = this.getLogicalCanvasSize(), t = this.getPhysicalCanvasSize(e);
2334
- return this._appliedCanvasSize && this._appliedCanvasSize.logicalWidth == e.width && this._appliedCanvasSize.logicalHeight == e.height && this._appliedCanvasSize.physicalWidth == t.width && this._appliedCanvasSize.physicalHeight == t.height ? !1 : (this.canvas.style.width = `${e.width}px`, this.canvas.style.height = `${e.height}px`, this.canvas.width = t.width, this.canvas.height = t.height, Po(this.gl, this._pickingBufferInfo, this._pickingAttachmentOptions), this._appliedCanvasSize = {
2338
+ return this._appliedCanvasSize && this._appliedCanvasSize.logicalWidth == e.width && this._appliedCanvasSize.logicalHeight == e.height && this._appliedCanvasSize.physicalWidth == t.width && this._appliedCanvasSize.physicalHeight == t.height ? !1 : (this.canvas.style.width = `${e.width}px`, this.canvas.style.height = `${e.height}px`, this.canvas.width = t.width, this.canvas.height = t.height, Fo(this.gl, this._pickingBufferInfo, this._pickingAttachmentOptions), this._appliedCanvasSize = {
2335
2339
  logicalWidth: e.width,
2336
2340
  logicalHeight: e.height,
2337
2341
  physicalWidth: t.width,
@@ -2367,42 +2371,42 @@ var Rs = class {
2367
2371
  let n = this.rangeTextures.get(e.getScale());
2368
2372
  if (!t && n) return;
2369
2373
  function r(e, t) {
2370
- return fe(t.type) ? t.domain().length : t.type == "threshold" || t.type == "quantize" ? ss(t) : t.type == "quantile" ? e ?? 4 : e;
2374
+ return fe(t.type) ? t.domain().length : t.type == "threshold" || t.type == "quantize" ? ls(t) : t.type == "quantile" ? e ?? 4 : e;
2371
2375
  }
2372
2376
  let i = e.channel;
2373
- if (S(i)) {
2377
+ if (y(i)) {
2374
2378
  let t = e.getScale(), i = t.props, a = t.range(), o;
2375
- if (i.scheme) if (fe(t.type) || C(t.type)) o = Ko(a, this.gl, ss(t), n);
2379
+ if (i.scheme) if (fe(t.type) || w(t.type)) o = qo(a, this.gl, ls(t), n);
2376
2380
  else {
2377
- let e = s(i.scheme) ? void 0 : i.scheme.count;
2378
- e = r(e, t), o = Uo(i.scheme, this.gl, e, n, !!i.reverse);
2381
+ let e = c(i.scheme) ? void 0 : i.scheme.count;
2382
+ e = r(e, t), o = Wo(i.scheme, this.gl, e, n, !!i.reverse);
2379
2383
  }
2380
- else o = de(t.type) || w(t.type) && a.length > 1 ? Wo(a, i.interpolate, this.gl, n) : Ko(a, this.gl, C(t.type) ? ss(t) : t.domain().length, n);
2384
+ else o = de(t.type) || T(t.type) && a.length > 1 ? Go(a, i.interpolate, this.gl, n) : qo(a, this.gl, w(t.type) ? ls(t) : t.domain().length, n);
2381
2385
  this.rangeTextures.set(t, o), this._ownedTextures.add(o);
2382
2386
  } else {
2383
2387
  let t = e.getScale();
2384
- if (t.type === "ordinal" || C(t.type)) {
2385
- let e = _(i) ? ae(i) : (e) => e, r = Go(t.range().map(e), this.gl, C(t.type) ? ss(t) : t.domain().length, n);
2388
+ if (t.type === "ordinal" || w(t.type)) {
2389
+ let e = l(i) ? S(i) : (e) => e, r = Ko(t.range().map(e), this.gl, w(t.type) ? ls(t) : t.domain().length, n);
2386
2390
  this.rangeTextures.set(t, r), this._ownedTextures.add(r);
2387
2391
  }
2388
2392
  }
2389
2393
  }
2390
2394
  createSelectionTexture(e, t = !0) {
2391
- if (!a(e)) throw Error("Not a multi-point selection, cannot create texture");
2392
- let { table: n, capacity: r } = Ps(e.data.keys()), { width: i, height: o } = Fs(r, this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE)), s = this.selectionTextures.get(e), c = this.gl, l = Vs(this.gl, {
2395
+ if (!se(e)) throw Error("Not a multi-point selection, cannot create texture");
2396
+ let { table: n, capacity: r } = Ls(e.data.keys()), { width: i, height: a } = Rs(r, this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE)), o = this.selectionTextures.get(e), s = this.gl, c = Ws(this.gl, {
2393
2397
  auto: !1,
2394
2398
  level: 0,
2395
- min: c.NEAREST,
2396
- mag: c.NEAREST,
2397
- format: c.RED_INTEGER,
2398
- internalFormat: c.R32UI,
2399
+ min: s.NEAREST,
2400
+ mag: s.NEAREST,
2401
+ format: s.RED_INTEGER,
2402
+ internalFormat: s.R32UI,
2399
2403
  width: i,
2400
- height: o
2401
- }, n, t ? s : !1);
2402
- c.bindTexture(c.TEXTURE_2D, l), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_BASE_LEVEL, 0), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MAX_LEVEL, 0), c.bindTexture(c.TEXTURE_2D, null), this.selectionTextures.set(e, l), this._ownedTextures.add(l);
2404
+ height: a
2405
+ }, n, t ? o : !1);
2406
+ s.bindTexture(s.TEXTURE_2D, c), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_BASE_LEVEL, 0), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAX_LEVEL, 0), s.bindTexture(s.TEXTURE_2D, null), this.selectionTextures.set(e, c), this._ownedTextures.add(c);
2403
2407
  }
2404
2408
  };
2405
- function zs(e, t = "", n = 0) {
2409
+ function Hs(e, t = "", n = 0) {
2406
2410
  let r = [...t.matchAll(/ERROR:\s*\d+:(\d+)/gi)], i = new Map(r.map((e, n) => {
2407
2411
  let i = parseInt(e[1]), a = r[n + 1], o = a ? a.index : t.length, s = t.substring(e.index, o);
2408
2412
  return [i - 1, s];
@@ -2412,14 +2416,14 @@ function zs(e, t = "", n = 0) {
2412
2416
  return `${t + 1 + n}: ${e}${r ? `\n\n^^^ ${r}` : ""}`;
2413
2417
  }).join("\n");
2414
2418
  }
2415
- function Bs(e, t, n) {
2419
+ function Us(e, t, n) {
2416
2420
  let r = e.createProgram();
2417
2421
  e.attachShader(r, t), e.attachShader(r, n), e.linkProgram(r);
2418
2422
  function i() {
2419
2423
  let i, a;
2420
2424
  if (!e.getProgramParameter(r, e.LINK_STATUS)) {
2421
2425
  i = e.getProgramInfoLog(r);
2422
- for (let r of [t, n]) e.getShaderParameter(r, e.COMPILE_STATUS) || (i = e.getShaderInfoLog(r), a = zs(e.getShaderSource(r), i, 0) + `\nError compiling: ${i}`, e.deleteShader(r));
2426
+ for (let r of [t, n]) e.getShaderParameter(r, e.COMPILE_STATUS) || (i = e.getShaderInfoLog(r), a = Hs(e.getShaderSource(r), i, 0) + `\nError compiling: ${i}`, e.deleteShader(r));
2423
2427
  e.deleteProgram(r);
2424
2428
  }
2425
2429
  if (i) return {
@@ -2432,19 +2436,19 @@ function Bs(e, t, n) {
2432
2436
  getProgramErrors: i
2433
2437
  };
2434
2438
  }
2435
- function Vs(e, t, n, r) {
2436
- return r ? ni(e, r, n, t) : r = ii(e, {
2439
+ function Ws(e, t, n, r) {
2440
+ return r ? ri(e, r, n, t) : r = ai(e, {
2437
2441
  ...t,
2438
2442
  src: n
2439
2443
  }), r;
2440
2444
  }
2441
- function Hs(e, t, n, r) {
2445
+ function Gs(e, t, n, r) {
2442
2446
  let { height: i, framebuffer: a } = t, o = /* @__PURE__ */ new Uint8Array(4);
2443
2447
  return e.bindFramebuffer(e.FRAMEBUFFER, a), e.readPixels(n, i - r - 1, 1, 1, e.RGBA, e.UNSIGNED_BYTE, o), e.bindFramebuffer(e.FRAMEBUFFER, null), o;
2444
2448
  }
2445
2449
  //#endregion
2446
2450
  //#region ../core/src/rendering/webgl/bufferedViewRenderingContext.js
2447
- var Us = class extends Ce {
2451
+ var Ks = class extends Ce {
2448
2452
  #e = [
2449
2453
  0,
2450
2454
  0,
@@ -2468,7 +2472,7 @@ var Us = class extends Ce {
2468
2472
  #f;
2469
2473
  constructor(e, t) {
2470
2474
  if (super(e), this.#i = t.webGLHelper, this.#a = t.markAdapter, this.#r = t.framebufferInfo, this.#u = t.devicePixelRatio, this.#d = t.canvasSize, this.#c = t.markPredicate ?? (() => !0), this.#f = t.pixelOffset, t.clearColor) {
2471
- let e = m(t.clearColor).rgb();
2475
+ let e = p(t.clearColor).rgb();
2472
2476
  this.#e = [
2473
2477
  e.r / 255,
2474
2478
  e.g / 255,
@@ -2485,13 +2489,13 @@ var Us = class extends Ce {
2485
2489
  }
2486
2490
  renderMark(e, t) {
2487
2491
  if (!this.#c(e) || this.globalOptions.picking && !e.isPickingParticipant()) return;
2488
- let n = y(t);
2492
+ let n = ee(t);
2489
2493
  this.#n.push({
2490
2494
  mark: e,
2491
2495
  options: t,
2492
2496
  coords: this.#l,
2493
2497
  placement: t.placement,
2494
- clip: re(n, e.properties.clip, this.#l),
2498
+ clip: ne(n, e.properties.clip, this.#l),
2495
2499
  cullClip: n
2496
2500
  });
2497
2501
  }
@@ -2511,40 +2515,52 @@ var Us = class extends Ce {
2511
2515
  }
2512
2516
  #p() {
2513
2517
  this.#t = [];
2514
- let e = !0, t = !0, n = (t) => () => {
2518
+ let e = !0, t = !0, n = !1, r = (t) => () => {
2515
2519
  e && t();
2516
- }, r = (n) => () => {
2520
+ }, i = (n) => () => {
2517
2521
  e && t && n();
2518
- }, i = he(this.#n.reverse(), (e) => e.mark);
2519
- for (let [a, o] of [...i.entries()].reverse()) {
2520
- let i = this.#a.getMarkEntry(a);
2521
- if (!i) continue;
2522
- let s = i.graphics;
2523
- if (!this.#a.isEntryDrawable(i)) continue;
2524
- this.#o.add(i);
2525
- let c = o.map((e) => ({
2522
+ }, a = he(this.#n.reverse(), (e) => e.mark);
2523
+ for (let [o, s] of [...a.entries()].reverse()) {
2524
+ let a = this.#a.getMarkEntry(o);
2525
+ if (!a) continue;
2526
+ let c = a.graphics;
2527
+ if (!this.#a.isEntryDrawable(a)) continue;
2528
+ this.#o.add(a);
2529
+ let l = o.getOrder?.(), u = s.map((e) => ({
2526
2530
  ...e,
2527
- callback: s.render(e.options)
2531
+ callback: c.render(l ? {
2532
+ ...e.options,
2533
+ orderPass: "all"
2534
+ } : e.options),
2535
+ orderCallbacks: l && !this.globalOptions.picking ? l.passes.map((t, n) => c.render({
2536
+ ...e.options,
2537
+ orderPass: t,
2538
+ secondOrderPass: n === 1
2539
+ })) : void 0
2528
2540
  })).filter((e) => e.callback);
2529
- if (c.length == 0) continue;
2530
- this.#t.push(() => {
2531
- e = this.#a.isEntryDrawable(i) && a.unitView.getEffectiveOpacity() > 0;
2532
- });
2533
- let l = c[0].placement, u = l ? {
2541
+ if (u.length == 0) continue;
2542
+ let d = u[0].placement, f = d ? {
2534
2543
  ...this.globalOptions,
2535
- placement: l
2536
- } : this.globalOptions;
2537
- this.#t.push(...s.prepareRender(u).map((e) => n(e)));
2538
- let d, f, p;
2539
- for (let e of c) {
2540
- let i = e.coords;
2541
- (!i.equals(d) || !ee(e.clip, f) || !ee(e.cullClip, p)) && this.#t.push(n(() => {
2542
- t = s.setViewport(this.#d, this.#u, i, e.clip, e.cullClip, this.#f);
2543
- })), this.#t.push(r(e.callback)), d = e.coords, f = e.clip, p = e.cullClip;
2544
+ placement: d
2545
+ } : this.globalOptions, p = c.prepareRender(f).map((e) => r(e));
2546
+ this.#t.push(() => {
2547
+ e = this.#a.isEntryDrawable(a) && o.unitView.getEffectiveOpacity() > 0, t = !0, n = !!l && !this.globalOptions.picking && l.isActive();
2548
+ }), this.#t.push(...p);
2549
+ let m, h, g;
2550
+ for (let e of u) {
2551
+ let a = e.coords;
2552
+ (!a.equals(m) || !x(e.clip, h) || !x(e.cullClip, g)) && this.#t.push(r(() => {
2553
+ t = c.setViewport(this.#d, this.#u, a, e.clip, e.cullClip, this.#f);
2554
+ }));
2555
+ let { callback: o, orderCallbacks: s } = e, l = s ? () => {
2556
+ if (n) for (let e of s) e();
2557
+ else o();
2558
+ } : o;
2559
+ this.#t.push(i(l)), m = e.coords, h = e.clip, g = e.cullClip;
2544
2560
  }
2545
2561
  }
2546
2562
  }
2547
- }, Ws = class extends Ce {
2563
+ }, qs = class extends Ce {
2548
2564
  constructor(...e) {
2549
2565
  super({}), this.contexts = e;
2550
2566
  }
@@ -2563,7 +2579,7 @@ var Us = class extends Ce {
2563
2579
  renderMark(e, t) {
2564
2580
  for (let n of this.contexts) n.renderMark(e, t);
2565
2581
  }
2566
- }, Gs = class {
2582
+ }, Js = class {
2567
2583
  #e;
2568
2584
  #t;
2569
2585
  #n;
@@ -2606,14 +2622,14 @@ var Us = class extends Ce {
2606
2622
  markAdapter: this.#n,
2607
2623
  canvasSize: t,
2608
2624
  devicePixelRatio: n
2609
- }, i = new Us({ picking: !1 }, {
2625
+ }, i = new Ks({ picking: !1 }, {
2610
2626
  ...r,
2611
2627
  clearColor: this.#r()
2612
- }), a = new Us({ picking: !0 }, {
2628
+ }), a = new Ks({ picking: !0 }, {
2613
2629
  ...r,
2614
2630
  framebufferInfo: this.#t._pickingBufferInfo
2615
2631
  });
2616
- Se("layoutReplay", () => e.collectRenderCommands(new Ws(i, a))), i.finish(), a.finish(), this.#o = i, this.#s = a;
2632
+ Se("layoutReplay", () => e.collectRenderCommands(new qs(i, a))), i.finish(), a.finish(), this.#o = i, this.#s = a;
2617
2633
  }
2618
2634
  renderAll() {
2619
2635
  let e = xe();
@@ -2627,9 +2643,9 @@ var Us = class extends Ce {
2627
2643
  };
2628
2644
  //#endregion
2629
2645
  //#region ../core/src/rendering/webgl/gl/framebufferReadback.js
2630
- function Ks(e, t, n = {}) {
2646
+ function Ys(e, t, n = {}) {
2631
2647
  let r = n.x ?? 0, i = n.y ?? 0, a = n.width ?? t.width, o = n.height ?? t.height;
2632
- Zs(t, r, i, a, o);
2648
+ ec(t, r, i, a, o);
2633
2649
  let s = new Uint8Array(a * o * 4);
2634
2650
  e.bindFramebuffer(e.FRAMEBUFFER, t.framebuffer);
2635
2651
  try {
@@ -2638,29 +2654,29 @@ function Ks(e, t, n = {}) {
2638
2654
  e.bindFramebuffer(e.FRAMEBUFFER, null);
2639
2655
  }
2640
2656
  return {
2641
- pixels: Xs(s, a, o, n.unpremultiplyAlpha ?? !1),
2657
+ pixels: $s(s, a, o, n.unpremultiplyAlpha ?? !1),
2642
2658
  width: a,
2643
2659
  height: o
2644
2660
  };
2645
2661
  }
2646
- function qs(e, t, n = "image/png", r = {}) {
2647
- return Ys(e, t, r).toDataURL(n);
2662
+ function Xs(e, t, n = "image/png", r = {}) {
2663
+ return Qs(e, t, r).toDataURL(n);
2648
2664
  }
2649
- function Js(e, t, n = "image/png", r = {}) {
2650
- let i = Ys(e, t, r);
2665
+ function Zs(e, t, n = "image/png", r = {}) {
2666
+ let i = Qs(e, t, r);
2651
2667
  return new Promise((e, t) => {
2652
2668
  i.toBlob((r) => {
2653
2669
  r ? e(r) : t(/* @__PURE__ */ Error(`Could not encode framebuffer as ${n}.`));
2654
2670
  }, n);
2655
2671
  });
2656
2672
  }
2657
- function Ys(e, t, n) {
2658
- let { pixels: r, width: i, height: a } = Ks(e, t, n), o = document.createElement("canvas");
2673
+ function Qs(e, t, n) {
2674
+ let { pixels: r, width: i, height: a } = Ys(e, t, n), o = document.createElement("canvas");
2659
2675
  o.width = i, o.height = a;
2660
2676
  let s = o.getContext("2d"), c = s.createImageData(i, a);
2661
2677
  return c.data.set(r), s.putImageData(c, 0, 0), o;
2662
2678
  }
2663
- function Xs(e, t, n, r) {
2679
+ function $s(e, t, n, r) {
2664
2680
  let i = new Uint8ClampedArray(e.length), a = t * 4;
2665
2681
  for (let t = 0; t < n; t++) {
2666
2682
  let r = (n - t - 1) * a, o = t * a;
@@ -2676,7 +2692,7 @@ function Xs(e, t, n, r) {
2676
2692
  }
2677
2693
  return i;
2678
2694
  }
2679
- function Zs(e, t, n, r, i) {
2695
+ function ec(e, t, n, r, i) {
2680
2696
  if (![
2681
2697
  t,
2682
2698
  n,
@@ -2687,8 +2703,8 @@ function Zs(e, t, n, r, i) {
2687
2703
  }
2688
2704
  //#endregion
2689
2705
  //#region ../core/src/rendering/webgl/canvasExport.js
2690
- function Qs({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, devicePixelRatio: a, clearColor: o = "white" }) {
2691
- let { gl: s, framebufferInfo: c } = ec({
2706
+ function tc({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, devicePixelRatio: a, clearColor: o = "white" }) {
2707
+ let { gl: s, framebufferInfo: c } = rc({
2692
2708
  glHelper: e,
2693
2709
  markAdapter: t,
2694
2710
  viewRoot: n,
@@ -2698,14 +2714,14 @@ function Qs({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logical
2698
2714
  clearColor: o
2699
2715
  });
2700
2716
  try {
2701
- return qs(s, c, "image/png");
2717
+ return Xs(s, c, "image/png");
2702
2718
  } finally {
2703
- tc(s, c);
2719
+ ic(s, c);
2704
2720
  }
2705
2721
  }
2706
- async function $s({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, pixelRatio: a, clearColor: o = "white", mimeType: s = "image/png" }) {
2722
+ async function nc({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, pixelRatio: a, clearColor: o = "white", mimeType: s = "image/png" }) {
2707
2723
  if (s != "image/png") throw Error(`Unsupported raster export MIME type: ${s}`);
2708
- let { gl: c, framebufferInfo: l } = ec({
2724
+ let { gl: c, framebufferInfo: l } = rc({
2709
2725
  glHelper: e,
2710
2726
  markAdapter: t,
2711
2727
  viewRoot: n,
@@ -2715,25 +2731,25 @@ async function $s({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, l
2715
2731
  clearColor: o
2716
2732
  });
2717
2733
  try {
2718
- return await Js(c, l, s);
2734
+ return await Zs(c, l, s);
2719
2735
  } finally {
2720
- tc(c, l);
2736
+ ic(c, l);
2721
2737
  }
2722
2738
  }
2723
- function ec({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, pixelRatio: a, clearColor: o }) {
2739
+ function rc({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, pixelRatio: a, clearColor: o }) {
2724
2740
  r ??= e.getLogicalCanvasSize().width, i ??= e.getLogicalCanvasSize().height, a ??= window.devicePixelRatio ?? 1;
2725
- let s = e.gl, c = Math.floor(r * a), l = Math.floor(i * a), u = No(s, [{
2741
+ let s = e.gl, c = Math.floor(r * a), l = Math.floor(i * a), u = Po(s, [{
2726
2742
  format: s.RGBA,
2727
2743
  type: s.UNSIGNED_BYTE,
2728
2744
  minMag: s.LINEAR,
2729
2745
  wrap: s.CLAMP_TO_EDGE
2730
2746
  }], c, l), d;
2731
2747
  try {
2732
- d = No(s, [{
2748
+ d = Po(s, [{
2733
2749
  format: s.RGBA8,
2734
2750
  samples: Math.min(4, s.getParameter(s.MAX_SAMPLES))
2735
2751
  }], c, l);
2736
- let f = new Us({ picking: !1 }, {
2752
+ let f = new Ks({ picking: !1 }, {
2737
2753
  webGLHelper: e,
2738
2754
  markAdapter: t,
2739
2755
  canvasSize: {
@@ -2749,17 +2765,17 @@ function ec({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logical
2749
2765
  framebufferInfo: u
2750
2766
  };
2751
2767
  } catch (e) {
2752
- throw tc(s, u), e;
2768
+ throw ic(s, u), e;
2753
2769
  } finally {
2754
2770
  d && (s.deleteRenderbuffer(d.attachments[0]), s.deleteFramebuffer(d.framebuffer));
2755
2771
  }
2756
2772
  }
2757
- function tc(e, t) {
2773
+ function ic(e, t) {
2758
2774
  e.deleteTexture(t.attachments[0]), e.deleteFramebuffer(t.framebuffer);
2759
2775
  }
2760
2776
  //#endregion
2761
2777
  //#region ../core/src/rendering/webgl/marks/arrow.vertex.glsl
2762
- var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out float vArrowHalfLengthInPixels;\nflat out float vHeadHalfWidth;\nflat out float vStemHalfWidth;\nflat out float vHeadStrokeWidth;\nflat out float vRHeadSlope;\nflat out float vRHeadNotchSlope;\nflat out float vRStartNotchSlope;\nflat out float vHeadRepeatFootprintLength;\nflat out float vHeadSpacing;\nflat out float vDirection;\n\nout vec2 vPosInPixels;\n\n/** Position along the arrow centerline. */\nin float pos;\n\n/** Which side of the extruded strip: -0.5 or 0.5. */\nin float side;\n\nfloat resolveStemHalfWidth(float arrowSize) {\n if (uStem) {\n return arrowSize * 0.5;\n } else {\n // The negative sign hides stem geometry; the magnitude remains\n // available for open-head thickness.\n return -arrowSize * 0.5;\n }\n}\n\nfloat resolveHeadHalfWidth(float arrowSize) {\n float headWidth = uHeadWidth * arrowSize;\n return max(headWidth, 0.0) * 0.5;\n}\n\n// Width along the arrow axis needed by one repeated head, including stroke.\nfloat headRepeatFootprintLength(\n float halfWidth,\n float rHeadSlope,\n float headStrokeWidth,\n float halfStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n float headStrokeLength = headStrokeWidth / length(vec2(rHeadSlope, 1.0));\n return headAxisLength + headStrokeLength + halfStrokeWidth * 2.0;\n}\n\n// Distance from the head tip to its centerline notch/join point.\nfloat headNotchOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (headHalfWidth <= 0.0) {\n return 0.0;\n }\n\n float headAxisLength = headHalfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, headHalfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(headHalfWidth, -headAxisLength));\n vec2 topInner = topOuter + normalOffset;\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\n// Distance from the arrow tip to where the stem outer edge meets a filled\n// triangle head's notch edge. This is the effective occupied head length for\n// deciding when a short inside arrow needs to blunt its head angle.\nfloat triangleHeadStemJoinLength(\n float stemHalfWidth,\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope\n) {\n float clampedRHeadNotchSlope = min(rHeadNotchSlope, rHeadSlope);\n return headHalfWidth * rHeadSlope\n - (headHalfWidth - stemHalfWidth) * clampedRHeadNotchSlope;\n}\n\n// Blunt non-repeated heads toward 90 degrees to preserve visible stem length.\nfloat effectiveHeadSlope(\n float halfLength,\n float headHalfWidth,\n float stemHalfWidth,\n float configuredRHeadSlope,\n float configuredRHeadNotchSlope,\n bool headRepeat\n) {\n if (\n headRepeat ||\n stemHalfWidth < 0.0\n ) {\n return configuredRHeadSlope;\n }\n\n if (uHeadPlacement == HEAD_PLACEMENT_OUTSIDE) {\n if (!uStartNotch || stemHalfWidth <= 0.0) {\n return configuredRHeadSlope;\n }\n\n // Outside heads start at the encoded endpoint. The preserved length is\n // therefore the encoded arrow length minus the start notch depth.\n float maxStartNotchLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n return min(\n configuredRHeadSlope,\n maxStartNotchLength / stemHalfWidth\n );\n }\n\n if (uHeadShape != HEAD_SHAPE_TRIANGLE) {\n return configuredRHeadSlope;\n }\n\n float maxJoinLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n float configuredJoinLength = triangleHeadStemJoinLength(\n stemHalfWidth,\n headHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope\n );\n\n if (configuredJoinLength <= maxJoinLength) {\n return configuredRHeadSlope;\n }\n\n float boundaryJoinLength = stemHalfWidth * configuredRHeadNotchSlope;\n if (maxJoinLength < boundaryJoinLength) {\n return stemHalfWidth > 0.0\n ? clamp(maxJoinLength / stemHalfWidth, 0.0, configuredRHeadSlope)\n : 0.0;\n } else {\n return clamp(\n (\n maxJoinLength +\n (headHalfWidth - stemHalfWidth) * configuredRHeadNotchSlope\n ) / headHalfWidth,\n 0.0,\n configuredRHeadSlope\n );\n }\n}\n\n// Outside placement extends the vertex quad so the head can protrude past the\n// encoded interval while its notch/join point stays on the endpoint.\nfloat getOutsideHeadOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (uHeadPlacement != HEAD_PLACEMENT_OUTSIDE) {\n return 0.0;\n }\n\n return headNotchOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n}\n\nvec2 getOutsideHeadExpansion(float outsideHeadOffset, float direction) {\n // Expansion is stored as negative/positive arrow-axis growth. In the\n // canonical reverse direction, the head is on the negative side.\n return direction == DIRECTION_REVERSE\n ? vec2(outsideHeadOffset, 0.0)\n : vec2(0.0, outsideHeadOffset);\n}\n\nvoid main(void) {\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n float direction = getScaled_direction();\n\n vec2 segmentInPixels = (b - a) * uViewportSize;\n float segmentLength = length(segmentInPixels);\n if (segmentLength <= 0.0) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * uViewOpacity;\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n float arrowSize = max(getScaled_size(), uMinSize);\n float headHalfWidth = resolveHeadHalfWidth(arrowSize);\n float stemHalfWidth = resolveStemHalfWidth(arrowSize);\n float physicalStemHalfWidth = abs(stemHalfWidth);\n float headStrokeWidth = uHeadShape == HEAD_SHAPE_OPEN\n ? physicalStemHalfWidth * 2.0\n : 0.0;\n float configuredRHeadSlope = 1.0 / uHeadSlope;\n float configuredRHeadNotchSlope = 1.0 / uHeadNotchSlope;\n float rHeadSlope = effectiveHeadSlope(\n segmentLength * 0.5,\n headHalfWidth,\n stemHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope,\n uHeadSpacing >= 0.0\n );\n float rHeadNotchSlope = uHeadShape == HEAD_SHAPE_OPEN\n ? rHeadSlope\n : min(configuredRHeadNotchSlope, rHeadSlope);\n\n // Grow only the head side of the vertex quad for outside placement.\n float outsideHeadOffset = getOutsideHeadOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n vec2 outsideHeadExpansion = getOutsideHeadExpansion(\n outsideHeadOffset,\n direction\n );\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float stripHalfWidth = max(headHalfWidth, physicalStemHalfWidth)\n + vHalfStrokeWidth\n + aaPadding;\n\n float reverseExpansion = outsideHeadExpansion.x;\n float forwardExpansion = outsideHeadExpansion.y;\n float geometryStart = -segmentLength * 0.5 - reverseExpansion;\n float geometryEnd = segmentLength * 0.5 + forwardExpansion;\n float geometryCenter = (geometryStart + geometryEnd) * 0.5;\n float geometryHalfLength = (geometryEnd - geometryStart) * 0.5;\n\n // The SDF geometry still uses the encoded arrow length, but the vertex\n // strip needs room for stroke and antialiasing beyond both endpoints.\n float axisPadding = vHalfStrokeWidth + aaPadding;\n float drawStart = geometryStart - axisPadding;\n float drawEnd = geometryEnd + axisPadding;\n float localAxisPosition = mix(drawStart, drawEnd, pos);\n float localX = localAxisPosition - geometryCenter;\n float localY = side * stripHalfWidth * 2.0;\n\n vec2 tangentInPixels = segmentInPixels / segmentLength;\n vec2 normalInPixels = vec2(-tangentInPixels.y, tangentInPixels.x);\n vec2 segmentCenter = (a + b) * 0.5;\n vec2 p = segmentCenter\n + (tangentInPixels * localAxisPosition + normalInPixels * localY)\n / uViewportSize;\n\n vPosInPixels = vec2(localX, localY);\n vArrowHalfLengthInPixels = geometryHalfLength;\n\n // These flat varyings are per-arrow geometry constants used by the fragment\n // SDF. Keeping them here avoids repeating this math per fragment.\n vHeadHalfWidth = headHalfWidth;\n vStemHalfWidth = stemHalfWidth;\n vHeadStrokeWidth = headStrokeWidth;\n vRHeadSlope = rHeadSlope;\n vRHeadNotchSlope = rHeadNotchSlope;\n vRStartNotchSlope = uStartNotch ? vRHeadSlope : 0.0;\n vDirection = direction;\n vHeadRepeatFootprintLength = headRepeatFootprintLength(\n vHeadHalfWidth,\n vRHeadSlope,\n vHeadStrokeWidth,\n vHalfStrokeWidth\n );\n vHeadSpacing = uHeadSpacing >= 0.0 ? uHeadSpacing * arrowSize : -1.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n\n gl_Position = unitToNdc(p);\n\n float fillOpacity = getScaled_fillOpacity() * uViewOpacity;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", rc = "in vec2 vPosInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in float vArrowHalfLengthInPixels;\nflat in float vHeadHalfWidth;\nflat in float vStemHalfWidth;\nflat in float vHeadStrokeWidth;\nflat in float vRHeadSlope;\nflat in float vRHeadNotchSlope;\nflat in float vRStartNotchSlope;\nflat in float vHeadRepeatFootprintLength;\nflat in float vHeadSpacing;\nflat in float vDirection;\n\nout lowp vec4 fragColor;\n\nconst int N = 6;\nconst float FAR_OUTSIDE = 1e20;\n\n// Adapted from: https://iquilezles.org/articles/distfunctions2d/\nfloat sdPolygon(vec2[N] v, vec2 p) {\n float d = dot(p-v[0],p-v[0]);\n float s = 1.0;\n for( int i=0, j=N-1; i<N; j=i, i++ ) {\n vec2 e = v[j] - v[i];\n vec2 w = p - v[i];\n vec2 b = w - e*clamp( dot(w,e)/dot(e,e), 0.0, 1.0 );\n d = min( d, dot(b,b) );\n bvec3 c = bvec3(p.y>=v[i].y,p.y<v[j].y,e.x*w.y>e.y*w.x);\n if( all(c) || all(not(c)) ) s*=-1.0; \n }\n return s*sqrt(d);\n}\n\nfloat sdStem(\n vec2 p,\n float halfLength,\n float halfWidth,\n float rHeadSlope,\n float rStartNotchSlope\n) {\n if (halfWidth < 0.0) {\n return FAR_OUTSIDE;\n }\n\n float headSideLength = halfWidth * rHeadSlope;\n float startNotchLength = halfWidth * rStartNotchSlope;\n vec2 vertices[6] = vec2[6](\n vec2(-halfLength, 0.0),\n vec2(-halfLength + headSideLength, halfWidth),\n vec2(halfLength, halfWidth),\n vec2(halfLength - startNotchLength, 0.0),\n vec2(halfLength, -halfWidth),\n vec2(-halfLength + headSideLength, -halfWidth)\n );\n\n return sdPolygon(vertices, p);\n}\n\n// Inner corner of an open head, offset perpendicular to the outer edge.\nvec2 headInnerCorner(float halfWidth, float rHeadSlope, float headStrokeWidth) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(halfWidth, -headAxisLength));\n return topOuter + normalOffset;\n}\n\n// X coordinate where the arrowhead notch edge crosses the centerline.\nfloat headNotchX(\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\nfloat sdArrowHead(\n vec2 p,\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 bottomOuter = vec2(headAxisLength, -halfWidth);\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n vec2 normalOffset = topInner - topOuter;\n vec2 bottomInner = bottomOuter + vec2(normalOffset.x, -normalOffset.y);\n float notchX = headNotchX(\n halfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n\n vec2 vertices[6] = vec2[6](\n vec2(0.0, 0.0),\n topOuter,\n topInner,\n vec2(notchX, 0.0),\n bottomInner,\n bottomOuter\n );\n\n return sdPolygon(vertices, p);\n}\n\nfloat repeat(float x, float spacing) {\n return x >= spacing ? x - floor(x / spacing) * spacing : x;\n}\n\nfloat sdArrow(vec2 arrowPos, float arrowHalfLength) {\n float stemDistance = sdStem(\n arrowPos,\n arrowHalfLength,\n vStemHalfWidth,\n vRHeadSlope,\n vRStartNotchSlope\n );\n\n bool headRepeat = vHeadSpacing >= 0.0;\n float spacing = headRepeat\n ? max(vHeadSpacing, vHeadRepeatFootprintLength)\n : 1.0 / 0.0;\n float distanceFromStart = arrowPos.x + arrowHalfLength;\n\n // Keep the stroked tip inside the repeated head's local window.\n float arrowHeadX = repeat(\n distanceFromStart + vHalfStrokeWidth,\n spacing\n ) - vHalfStrokeWidth;\n\n float headDistance = sdArrowHead(\n vec2(arrowHeadX, arrowPos.y),\n vHeadHalfWidth,\n vRHeadSlope,\n vRHeadNotchSlope,\n vHeadStrokeWidth\n );\n\n if (headRepeat) {\n // Cull heads that would be partially clipped.\n float headTipDistance = distanceFromStart - arrowHeadX;\n float headEndDistance = headTipDistance\n + vHeadRepeatFootprintLength\n - vHalfStrokeWidth;\n\n if (headTipDistance > 0.0 && headEndDistance > arrowHalfLength * 2.0) {\n headDistance = FAR_OUTSIDE;\n }\n }\n\n return min(stemDistance, headDistance);\n}\n\nvoid main(void) {\n vec2 arrowPos = vPosInPixels;\n if (vDirection == DIRECTION_FORWARD) {\n arrowPos.x = -arrowPos.x;\n }\n float d = sdArrow(arrowPos, vArrowHalfLengthInPixels);\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n vec4(0.0),\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n}\n", ic = "layout(std140) uniform Mark {\n uniform int uHeadShape;\n\n uniform float uHeadSlope;\n uniform float uHeadNotchSlope;\n\n uniform float uMinSize;\n uniform float uHeadWidth;\n uniform bool uStartNotch;\n uniform float uMinStemLength;\n uniform float uHeadSpacing;\n uniform bool uStem;\n\n uniform int uHeadPlacement;\n\n#pragma markUniforms\n};\n\nconst float DIRECTION_FORWARD = 0.0;\nconst float DIRECTION_REVERSE = 1.0;\n\nconst int HEAD_SHAPE_TRIANGLE = 0;\nconst int HEAD_SHAPE_OPEN = 1;\n\nconst int HEAD_PLACEMENT_INSIDE = 0;\nconst int HEAD_PLACEMENT_OUTSIDE = 1;\n\n// Arrow space uses x for arrow length and y for width perpendicular to it.\n// Negative x points toward the arrowhead in the canonical \"reverse\" direction.\n", ac = 1e4, oc = class {
2778
+ var ac = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out float vArrowHalfLengthInPixels;\nflat out float vHeadHalfWidth;\nflat out float vStemHalfWidth;\nflat out float vHeadStrokeWidth;\nflat out float vRHeadSlope;\nflat out float vRHeadNotchSlope;\nflat out float vRStartNotchSlope;\nflat out float vHeadRepeatFootprintLength;\nflat out float vHeadSpacing;\nflat out float vDirection;\n\nout vec2 vPosInPixels;\n\n/** Position along the arrow centerline. */\nin float pos;\n\n/** Which side of the extruded strip: -0.5 or 0.5. */\nin float side;\n\nfloat resolveStemHalfWidth(float arrowSize) {\n if (uStem) {\n return arrowSize * 0.5;\n } else {\n // The negative sign hides stem geometry; the magnitude remains\n // available for open-head thickness.\n return -arrowSize * 0.5;\n }\n}\n\nfloat resolveHeadHalfWidth(float arrowSize) {\n float headWidth = uHeadWidth * arrowSize;\n return max(headWidth, 0.0) * 0.5;\n}\n\n// Width along the arrow axis needed by one repeated head, including stroke.\nfloat headRepeatFootprintLength(\n float halfWidth,\n float rHeadSlope,\n float headStrokeWidth,\n float halfStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n float headStrokeLength = headStrokeWidth / length(vec2(rHeadSlope, 1.0));\n return headAxisLength + headStrokeLength + halfStrokeWidth * 2.0;\n}\n\n// Distance from the head tip to its centerline notch/join point.\nfloat headNotchOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (headHalfWidth <= 0.0) {\n return 0.0;\n }\n\n float headAxisLength = headHalfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, headHalfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(headHalfWidth, -headAxisLength));\n vec2 topInner = topOuter + normalOffset;\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\n// Distance from the arrow tip to where the stem outer edge meets a filled\n// triangle head's notch edge. This is the effective occupied head length for\n// deciding when a short inside arrow needs to blunt its head angle.\nfloat triangleHeadStemJoinLength(\n float stemHalfWidth,\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope\n) {\n float clampedRHeadNotchSlope = min(rHeadNotchSlope, rHeadSlope);\n return headHalfWidth * rHeadSlope\n - (headHalfWidth - stemHalfWidth) * clampedRHeadNotchSlope;\n}\n\n// Blunt non-repeated heads toward 90 degrees to preserve visible stem length.\nfloat effectiveHeadSlope(\n float halfLength,\n float headHalfWidth,\n float stemHalfWidth,\n float configuredRHeadSlope,\n float configuredRHeadNotchSlope,\n bool headRepeat\n) {\n if (\n headRepeat ||\n stemHalfWidth < 0.0\n ) {\n return configuredRHeadSlope;\n }\n\n if (uHeadPlacement == HEAD_PLACEMENT_OUTSIDE) {\n if (!uStartNotch || stemHalfWidth <= 0.0) {\n return configuredRHeadSlope;\n }\n\n // Outside heads start at the encoded endpoint. The preserved length is\n // therefore the encoded arrow length minus the start notch depth.\n float maxStartNotchLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n return min(\n configuredRHeadSlope,\n maxStartNotchLength / stemHalfWidth\n );\n }\n\n if (uHeadShape != HEAD_SHAPE_TRIANGLE) {\n return configuredRHeadSlope;\n }\n\n float maxJoinLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n float configuredJoinLength = triangleHeadStemJoinLength(\n stemHalfWidth,\n headHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope\n );\n\n if (configuredJoinLength <= maxJoinLength) {\n return configuredRHeadSlope;\n }\n\n float boundaryJoinLength = stemHalfWidth * configuredRHeadNotchSlope;\n if (maxJoinLength < boundaryJoinLength) {\n return stemHalfWidth > 0.0\n ? clamp(maxJoinLength / stemHalfWidth, 0.0, configuredRHeadSlope)\n : 0.0;\n } else {\n return clamp(\n (\n maxJoinLength +\n (headHalfWidth - stemHalfWidth) * configuredRHeadNotchSlope\n ) / headHalfWidth,\n 0.0,\n configuredRHeadSlope\n );\n }\n}\n\n// Outside placement extends the vertex quad so the head can protrude past the\n// encoded interval while its notch/join point stays on the endpoint.\nfloat getOutsideHeadOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (uHeadPlacement != HEAD_PLACEMENT_OUTSIDE) {\n return 0.0;\n }\n\n return headNotchOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n}\n\nvec2 getOutsideHeadExpansion(float outsideHeadOffset, float direction) {\n // Expansion is stored as negative/positive arrow-axis growth. In the\n // canonical reverse direction, the head is on the negative side.\n return direction == DIRECTION_REVERSE\n ? vec2(outsideHeadOffset, 0.0)\n : vec2(0.0, outsideHeadOffset);\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n float direction = getScaled_direction();\n\n vec2 segmentInPixels = (b - a) * uViewportSize;\n float segmentLength = length(segmentInPixels);\n if (segmentLength <= 0.0) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * uViewOpacity;\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n float arrowSize = max(getScaled_size(), uMinSize);\n float headHalfWidth = resolveHeadHalfWidth(arrowSize);\n float stemHalfWidth = resolveStemHalfWidth(arrowSize);\n float physicalStemHalfWidth = abs(stemHalfWidth);\n float headStrokeWidth = uHeadShape == HEAD_SHAPE_OPEN\n ? physicalStemHalfWidth * 2.0\n : 0.0;\n float configuredRHeadSlope = 1.0 / uHeadSlope;\n float configuredRHeadNotchSlope = 1.0 / uHeadNotchSlope;\n float rHeadSlope = effectiveHeadSlope(\n segmentLength * 0.5,\n headHalfWidth,\n stemHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope,\n uHeadSpacing >= 0.0\n );\n float rHeadNotchSlope = uHeadShape == HEAD_SHAPE_OPEN\n ? rHeadSlope\n : min(configuredRHeadNotchSlope, rHeadSlope);\n\n // Grow only the head side of the vertex quad for outside placement.\n float outsideHeadOffset = getOutsideHeadOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n vec2 outsideHeadExpansion = getOutsideHeadExpansion(\n outsideHeadOffset,\n direction\n );\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float stripHalfWidth = max(headHalfWidth, physicalStemHalfWidth)\n + vHalfStrokeWidth\n + aaPadding;\n\n float reverseExpansion = outsideHeadExpansion.x;\n float forwardExpansion = outsideHeadExpansion.y;\n float geometryStart = -segmentLength * 0.5 - reverseExpansion;\n float geometryEnd = segmentLength * 0.5 + forwardExpansion;\n float geometryCenter = (geometryStart + geometryEnd) * 0.5;\n float geometryHalfLength = (geometryEnd - geometryStart) * 0.5;\n\n // The SDF geometry still uses the encoded arrow length, but the vertex\n // strip needs room for stroke and antialiasing beyond both endpoints.\n float axisPadding = vHalfStrokeWidth + aaPadding;\n float drawStart = geometryStart - axisPadding;\n float drawEnd = geometryEnd + axisPadding;\n float localAxisPosition = mix(drawStart, drawEnd, pos);\n float localX = localAxisPosition - geometryCenter;\n float localY = side * stripHalfWidth * 2.0;\n\n vec2 tangentInPixels = segmentInPixels / segmentLength;\n vec2 normalInPixels = vec2(-tangentInPixels.y, tangentInPixels.x);\n vec2 segmentCenter = (a + b) * 0.5;\n vec2 p = segmentCenter\n + (tangentInPixels * localAxisPosition + normalInPixels * localY)\n / uViewportSize;\n\n vPosInPixels = vec2(localX, localY);\n vArrowHalfLengthInPixels = geometryHalfLength;\n\n // These flat varyings are per-arrow geometry constants used by the fragment\n // SDF. Keeping them here avoids repeating this math per fragment.\n vHeadHalfWidth = headHalfWidth;\n vStemHalfWidth = stemHalfWidth;\n vHeadStrokeWidth = headStrokeWidth;\n vRHeadSlope = rHeadSlope;\n vRHeadNotchSlope = rHeadNotchSlope;\n vRStartNotchSlope = uStartNotch ? vRHeadSlope : 0.0;\n vDirection = direction;\n vHeadRepeatFootprintLength = headRepeatFootprintLength(\n vHeadHalfWidth,\n vRHeadSlope,\n vHeadStrokeWidth,\n vHalfStrokeWidth\n );\n vHeadSpacing = uHeadSpacing >= 0.0 ? uHeadSpacing * arrowSize : -1.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n\n gl_Position = unitToNdc(p);\n\n float fillOpacity = getScaled_fillOpacity() * uViewOpacity;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", oc = "in vec2 vPosInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in float vArrowHalfLengthInPixels;\nflat in float vHeadHalfWidth;\nflat in float vStemHalfWidth;\nflat in float vHeadStrokeWidth;\nflat in float vRHeadSlope;\nflat in float vRHeadNotchSlope;\nflat in float vRStartNotchSlope;\nflat in float vHeadRepeatFootprintLength;\nflat in float vHeadSpacing;\nflat in float vDirection;\n\nout lowp vec4 fragColor;\n\nconst int N = 6;\nconst float FAR_OUTSIDE = 1e20;\n\n// Adapted from: https://iquilezles.org/articles/distfunctions2d/\nfloat sdPolygon(vec2[N] v, vec2 p) {\n float d = dot(p-v[0],p-v[0]);\n float s = 1.0;\n for( int i=0, j=N-1; i<N; j=i, i++ ) {\n vec2 e = v[j] - v[i];\n vec2 w = p - v[i];\n vec2 b = w - e*clamp( dot(w,e)/dot(e,e), 0.0, 1.0 );\n d = min( d, dot(b,b) );\n bvec3 c = bvec3(p.y>=v[i].y,p.y<v[j].y,e.x*w.y>e.y*w.x);\n if( all(c) || all(not(c)) ) s*=-1.0; \n }\n return s*sqrt(d);\n}\n\nfloat sdStem(\n vec2 p,\n float halfLength,\n float halfWidth,\n float rHeadSlope,\n float rStartNotchSlope\n) {\n if (halfWidth < 0.0) {\n return FAR_OUTSIDE;\n }\n\n float headSideLength = halfWidth * rHeadSlope;\n float startNotchLength = halfWidth * rStartNotchSlope;\n vec2 vertices[6] = vec2[6](\n vec2(-halfLength, 0.0),\n vec2(-halfLength + headSideLength, halfWidth),\n vec2(halfLength, halfWidth),\n vec2(halfLength - startNotchLength, 0.0),\n vec2(halfLength, -halfWidth),\n vec2(-halfLength + headSideLength, -halfWidth)\n );\n\n return sdPolygon(vertices, p);\n}\n\n// Inner corner of an open head, offset perpendicular to the outer edge.\nvec2 headInnerCorner(float halfWidth, float rHeadSlope, float headStrokeWidth) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(halfWidth, -headAxisLength));\n return topOuter + normalOffset;\n}\n\n// X coordinate where the arrowhead notch edge crosses the centerline.\nfloat headNotchX(\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\nfloat sdArrowHead(\n vec2 p,\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 bottomOuter = vec2(headAxisLength, -halfWidth);\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n vec2 normalOffset = topInner - topOuter;\n vec2 bottomInner = bottomOuter + vec2(normalOffset.x, -normalOffset.y);\n float notchX = headNotchX(\n halfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n\n vec2 vertices[6] = vec2[6](\n vec2(0.0, 0.0),\n topOuter,\n topInner,\n vec2(notchX, 0.0),\n bottomInner,\n bottomOuter\n );\n\n return sdPolygon(vertices, p);\n}\n\nfloat repeat(float x, float spacing) {\n return x >= spacing ? x - floor(x / spacing) * spacing : x;\n}\n\nfloat sdArrow(vec2 arrowPos, float arrowHalfLength) {\n float stemDistance = sdStem(\n arrowPos,\n arrowHalfLength,\n vStemHalfWidth,\n vRHeadSlope,\n vRStartNotchSlope\n );\n\n bool headRepeat = vHeadSpacing >= 0.0;\n float spacing = headRepeat\n ? max(vHeadSpacing, vHeadRepeatFootprintLength)\n : 1.0 / 0.0;\n float distanceFromStart = arrowPos.x + arrowHalfLength;\n\n // Keep the stroked tip inside the repeated head's local window.\n float arrowHeadX = repeat(\n distanceFromStart + vHalfStrokeWidth,\n spacing\n ) - vHalfStrokeWidth;\n\n float headDistance = sdArrowHead(\n vec2(arrowHeadX, arrowPos.y),\n vHeadHalfWidth,\n vRHeadSlope,\n vRHeadNotchSlope,\n vHeadStrokeWidth\n );\n\n if (headRepeat) {\n // Cull heads that would be partially clipped.\n float headTipDistance = distanceFromStart - arrowHeadX;\n float headEndDistance = headTipDistance\n + vHeadRepeatFootprintLength\n - vHalfStrokeWidth;\n\n if (headTipDistance > 0.0 && headEndDistance > arrowHalfLength * 2.0) {\n headDistance = FAR_OUTSIDE;\n }\n }\n\n return min(stemDistance, headDistance);\n}\n\nvoid main(void) {\n vec2 arrowPos = vPosInPixels;\n if (vDirection == DIRECTION_FORWARD) {\n arrowPos.x = -arrowPos.x;\n }\n float d = sdArrow(arrowPos, vArrowHalfLengthInPixels);\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n vec4(0.0),\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n}\n", sc = "layout(std140) uniform Mark {\n uniform int uHeadShape;\n\n uniform float uHeadSlope;\n uniform float uHeadNotchSlope;\n\n uniform float uMinSize;\n uniform float uHeadWidth;\n uniform bool uStartNotch;\n uniform float uMinStemLength;\n uniform float uHeadSpacing;\n uniform bool uStem;\n\n uniform int uHeadPlacement;\n\n#pragma markUniforms\n};\n\nconst float DIRECTION_FORWARD = 0.0;\nconst float DIRECTION_REVERSE = 1.0;\n\nconst int HEAD_SHAPE_TRIANGLE = 0;\nconst int HEAD_SHAPE_OPEN = 1;\n\nconst int HEAD_PLACEMENT_INSIDE = 0;\nconst int HEAD_PLACEMENT_OUTSIDE = 1;\n\n// Arrow space uses x for arrow length and y for width perpendicular to it.\n// Negative x points toward the arrowhead in the canonical \"reverse\" direction.\n", cc = 1e4, lc = class {
2763
2779
  #e = !1;
2764
2780
  constructor(e) {
2765
2781
  this.size = e, this.arrays = {}, this.pushers = [], this.dataUpdaters = [], this.vertexCount = 0;
@@ -2773,16 +2789,16 @@ var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat
2773
2789
  this.dataUpdaters.push((t.arrayReference, (e) => n(r(e))));
2774
2790
  }
2775
2791
  createUpdater(e, t, n = Float32Array, r = void 0) {
2776
- if (!i(this.size)) throw Error("The number of vertices must be defined!");
2777
- let a, o, s = 0, c = new n(this.size * t);
2792
+ if (!C(this.size)) throw Error("The number of vertices must be defined!");
2793
+ let i, a, o = 0, s = new n(this.size * t);
2778
2794
  if (this.arrays[e] = {
2779
- data: c,
2795
+ data: s,
2780
2796
  numComponents: t
2781
2797
  }, t == 1) {
2782
2798
  let e = 0;
2783
- a = () => {
2784
- c[s++] = e;
2785
- }, o = (t) => {
2799
+ i = () => {
2800
+ s[o++] = e;
2801
+ }, a = (t) => {
2786
2802
  e = +t;
2787
2803
  };
2788
2804
  } else {
@@ -2792,24 +2808,24 @@ var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat
2792
2808
  switch (t) {
2793
2809
  case 1: break;
2794
2810
  case 2:
2795
- a = () => {
2796
- c[s++] = e[0], c[s++] = e[1];
2797
- }, o = n;
2811
+ i = () => {
2812
+ s[o++] = e[0], s[o++] = e[1];
2813
+ }, a = n;
2798
2814
  break;
2799
2815
  case 3:
2800
- a = () => {
2801
- c[s++] = e[0], c[s++] = e[1], c[s++] = e[2];
2802
- }, o = n;
2816
+ i = () => {
2817
+ s[o++] = e[0], s[o++] = e[1], s[o++] = e[2];
2818
+ }, a = n;
2803
2819
  break;
2804
2820
  case 4:
2805
- a = () => {
2806
- c[s++] = e[0], c[s++] = e[1], c[s++] = e[2], c[s++] = e[3];
2807
- }, o = n;
2821
+ i = () => {
2822
+ s[o++] = e[0], s[o++] = e[1], s[o++] = e[2], s[o++] = e[3];
2823
+ }, a = n;
2808
2824
  break;
2809
2825
  default: throw Error("Invalid numComponents: " + t);
2810
2826
  }
2811
2827
  }
2812
- return this.pushers.push(a), o;
2828
+ return this.pushers.push(i), a;
2813
2829
  }
2814
2830
  pushAll() {
2815
2831
  throw Error("Call configure() first!");
@@ -2818,7 +2834,7 @@ var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat
2818
2834
  throw Error("Call configure() first!");
2819
2835
  }
2820
2836
  #t() {
2821
- if (this.size > ac) {
2837
+ if (this.size > cc) {
2822
2838
  let e = this.pushers.map((e, t) => `const p${t} = that.pushers[${t}];`).join("\n"), t = this.pushers.map((e, t) => ` p${t}();`).join("\n");
2823
2839
  this.pushAll = Function("that", `${e}
2824
2840
  return function unrolledPushAll() {
@@ -2831,7 +2847,7 @@ ${t}
2831
2847
  };
2832
2848
  }
2833
2849
  #n() {
2834
- if (this.size > ac) {
2850
+ if (this.size > cc) {
2835
2851
  let e = this.dataUpdaters.map((e, t) => `const u${t} = that.dataUpdaters[${t}];`).join("\n"), t = this.dataUpdaters.map((e, t) => ` u${t}(datum);`).join("\n");
2836
2852
  this.updateFromDatum = Function("that", "datum", `${e}
2837
2853
  return function unrolledUpdateFromDatum(datum) {
@@ -2844,70 +2860,70 @@ ${t}
2844
2860
  pushFromDatum(e) {
2845
2861
  this.updateFromDatum(e), this.pushAll();
2846
2862
  }
2847
- }, sc = 2 ** 31 - 1, cc = -(2 ** 31);
2848
- function lc(e, t, n, r = n, i = 0, a = i) {
2863
+ }, uc = 2 ** 31 - 1, dc = -(2 ** 31);
2864
+ function fc(e, t, n, r = n, i = 0, a = i) {
2849
2865
  if (a <= i || t[1] <= t[0]) return;
2850
2866
  let o = n === r, s = Array(e);
2851
- s.fill(sc);
2852
- let l = Array(e);
2853
- l.fill(0);
2854
- let u = t[0], d = (t[1] - t[0]) / e, f = (t, n) => {
2855
- let r = (t - u) / d, i = Math.floor(r);
2856
- return c(n && i == r ? i - 1 : i, 0, e - 1);
2857
- }, p = cc, m = -Infinity, h = !1, g = (e, t, n = [0, 0]) => {
2858
- let r = f(e, !1), i = f(t, !0), a = s[r], o = Math.max(l[i], a);
2867
+ s.fill(uc);
2868
+ let c = Array(e);
2869
+ c.fill(0);
2870
+ let l = t[0], u = (t[1] - t[0]) / e, d = (t, n) => {
2871
+ let r = (t - l) / u, i = Math.floor(r);
2872
+ return h(n && i == r ? i - 1 : i, 0, e - 1);
2873
+ }, f = dc, p = -Infinity, m = !1, g = (e, t, n = [0, 0]) => {
2874
+ let r = d(e, !1), i = d(t, !0), a = s[r], o = Math.max(c[i], a);
2859
2875
  return n[0] = a, n[1] = o, n;
2860
2876
  };
2861
2877
  for (let e = i; e < a;) {
2862
- let t = e, i = n(e), c = r(e);
2863
- for (e += 1; e < a && n(e) === i && r(e) === c;) e += 1;
2864
- if (t > p) p = t;
2878
+ let t = e, i = n(e), l = r(e);
2879
+ for (e += 1; e < a && n(e) === i && r(e) === l;) e += 1;
2880
+ if (t > f) f = t;
2865
2881
  else {
2866
- h = !0;
2882
+ m = !0;
2867
2883
  break;
2868
2884
  }
2869
- if (i < m || !o && c < i) {
2870
- h = !0;
2885
+ if (i < p || !o && l < i) {
2886
+ m = !0;
2871
2887
  break;
2872
2888
  }
2873
- m = i;
2874
- let u = f(i, !1), d = o ? u : f(c, !0);
2875
- for (let n = u; n <= d; n++) s[n] > t && (s[n] = t), l[n] < e && (l[n] = e);
2889
+ p = i;
2890
+ let u = d(i, !1), h = o ? u : d(l, !0);
2891
+ for (let n = u; n <= h; n++) s[n] > t && (s[n] = t), c[n] < e && (c[n] = e);
2876
2892
  }
2877
- if (h) return;
2878
- for (let e = 1; e < l.length; e++) l[e] < l[e - 1] && (l[e] = l[e - 1]);
2893
+ if (m) return;
2894
+ for (let e = 1; e < c.length; e++) c[e] < c[e - 1] && (c[e] = c[e - 1]);
2879
2895
  let _ = !0;
2880
- for (let e = s.length - 1; e > 0; e--) _ && s[e] == sc ? (s[e] = l[e], _ = !1) : s[e - 1] > s[e] && (s[e - 1] = s[e]);
2896
+ for (let e = s.length - 1; e > 0; e--) _ && s[e] == uc ? (s[e] = c[e], _ = !1) : s[e - 1] > s[e] && (s[e - 1] = s[e]);
2881
2897
  return g;
2882
2898
  }
2883
2899
  //#endregion
2884
2900
  //#region ../core/src/rendering/webgl/gl/dataToVertices.js
2885
- var uc = class {
2901
+ var pc = class {
2886
2902
  constructor({ encoders: e, numVertices: t = void 0, attributes: n = [] }) {
2887
2903
  this.encoders = e, this.variableEncoders = Object.fromEntries(Object.entries(e).filter(([e, t]) => n.includes(e) && t && !t.constant));
2888
- let r = [...Es(e).entries()].filter(([e, t]) => e[1] && t.length > 1).map(([e, t]) => t);
2889
- this.allocatedVertices = t, this.variableBuilder = new oc(t), this.attributeNames = {};
2904
+ let r = [...ks(e).entries()].filter(([e, t]) => e[1] && t.length > 1).map(([e, t]) => t);
2905
+ this.allocatedVertices = t, this.variableBuilder = new lc(t), this.attributeNames = {};
2890
2906
  for (let [e, t] of Object.entries(this.variableEncoders)) {
2891
- let n = x(t);
2907
+ let n = f(t);
2892
2908
  if (!n) continue;
2893
- let i = r.find((t) => t.find((t) => t == e)), a = n.asNumberAccessor(), o = t.scale, { largeHp: s, arrayConstructor: c, discrete: l, numComponents: u } = xs(o, e), d = [0, 0], f;
2894
- if (o && l) if ("props" in o && o.props.domainIndexer) f = o.props.domainIndexer;
2895
- else if ("domain" in o) f = _e(), f.addAll(o.domain());
2909
+ let i = r.find((t) => t.find((t) => t == e)), a = n.asNumberAccessor(), o = t.scale, { largeHp: s, arrayConstructor: c, discrete: l, numComponents: u } = ws(o, e), d = [0, 0], p;
2910
+ if (o && l) if ("props" in o && o.props.domainIndexer) p = o.props.domainIndexer;
2911
+ else if ("domain" in o) p = _e(), p.addAll(o.domain());
2896
2912
  else throw Error("Missing domain indexer for discrete scale.");
2897
- let p = f ? (e) => f(n(e)) : s ? (e) => Cs(a(e), d) : a, m = Ds(i ?? e);
2898
- for (let t of i ?? [e]) this.attributeNames[t] = m;
2899
- i && e != i[0] || this.variableBuilder.addConverter(m, {
2900
- f: p,
2913
+ let m = p ? (e) => p(n(e)) : s ? (e) => Es(a(e), d) : a, h = As(i ?? e);
2914
+ for (let t of i ?? [e]) this.attributeNames[t] = h;
2915
+ i && e != i[0] || this.variableBuilder.addConverter(h, {
2916
+ f: m,
2901
2917
  numComponents: u,
2902
2918
  arrayReference: s ? d : void 0,
2903
2919
  targetArrayType: c
2904
2920
  });
2905
2921
  }
2906
2922
  let i = this.variableEncoders.x, a = this.variableEncoders.x2, o = this.encoders.x?.channelDef, s = i?.scale;
2907
- if (o?.buildIndex && i && s && w(s.type)) {
2923
+ if (o?.buildIndex && i && s && T(s.type)) {
2908
2924
  let e = this.attributeNames.x;
2909
2925
  if (!e) throw Error("Missing x attribute for x indexing.");
2910
- let t = a?.scale && w(a.scale.type) ? this.attributeNames.x2 ?? e : e;
2926
+ let t = a?.scale && T(a.scale.type) ? this.attributeNames.x2 ?? e : e;
2911
2927
  this.xIndexConfig = {
2912
2928
  domain: [s.domain()[0], s.domain()[1]],
2913
2929
  xAttributeName: e,
@@ -2941,10 +2957,10 @@ var uc = class {
2941
2957
  let { data: t, numComponents: n } = this.variableBuilder.arrays[e];
2942
2958
  return n == 2 ? (e) => {
2943
2959
  let r = e * n;
2944
- return t[r] * Ss + t[r + 1];
2960
+ return t[r] * Ts + t[r + 1];
2945
2961
  } : (e) => t[e * n];
2946
2962
  }, i = r(n.xAttributeName), a = n.x2AttributeName == n.xAttributeName ? i : r(n.x2AttributeName);
2947
- return lc(50, n.domain, i, a, e, t);
2963
+ return fc(50, n.domain, i, a, e, t);
2948
2964
  }
2949
2965
  toArrays() {
2950
2966
  return {
@@ -2954,7 +2970,7 @@ var uc = class {
2954
2970
  rangeMap: this.rangeMap
2955
2971
  };
2956
2972
  }
2957
- }, dc = class extends uc {
2973
+ }, mc = class extends pc {
2958
2974
  constructor({ encoders: e, attributes: t, numItems: n }) {
2959
2975
  super({
2960
2976
  encoders: e,
@@ -2975,7 +2991,7 @@ var uc = class {
2975
2991
  this.registerBatch(e);
2976
2992
  }
2977
2993
  }
2978
- }, fc = class extends uc {
2994
+ }, hc = class extends pc {
2979
2995
  constructor({ encoders: e, attributes: t, tessellationThreshold: n = Infinity, visibleRange: r = [-Infinity, Infinity], numItems: i }) {
2980
2996
  super({
2981
2997
  encoders: e,
@@ -2992,7 +3008,7 @@ var uc = class {
2992
3008
  }
2993
3009
  this.registerBatch(e);
2994
3010
  }
2995
- }, pc = class extends uc {
3011
+ }, gc = class extends pc {
2996
3012
  constructor({ encoders: e, attributes: t, numItems: n = void 0 }) {
2997
3013
  super({
2998
3014
  encoders: e,
@@ -3007,7 +3023,7 @@ var uc = class {
3007
3023
  }
3008
3024
  this.registerBatch(e);
3009
3025
  }
3010
- }, mc = class extends uc {
3026
+ }, _c = class extends pc {
3011
3027
  constructor({ encoders: e, attributes: t, numItems: n = void 0 }) {
3012
3028
  super({
3013
3029
  encoders: e,
@@ -3027,7 +3043,7 @@ var uc = class {
3027
3043
  for (let t of Object.values(e)) t.divisor = 1;
3028
3044
  return super.toArrays();
3029
3045
  }
3030
- }, hc = class extends uc {
3046
+ }, vc = class extends pc {
3031
3047
  constructor({ encoders: e, attributes: t, fontMetrics: n, properties: r, numCharacters: i = void 0 }) {
3032
3048
  super({
3033
3049
  encoders: e,
@@ -3035,10 +3051,10 @@ var uc = class {
3035
3051
  numVertices: i * 6
3036
3052
  }), this.metadata = n, this.metrics = n, this.properties = r;
3037
3053
  let a = e.text.channelDef;
3038
- this.numberFormat = !f(a) && "format" in a && a.format ? ie(a.format) : (e) => e, this.updateVertexCoord = this.variableBuilder.createUpdater("vertexCoord", 2), this.updateTextureCoord = this.variableBuilder.createUpdater("textureCoord", 2), this.updateWidth = this.variableBuilder.createUpdater("width", 1), this.variableBuilder.configure();
3054
+ this.numberFormat = !o(a) && "format" in a && a.format ? g(a.format) : (e) => e, this.updateVertexCoord = this.variableBuilder.createUpdater("vertexCoord", 2), this.updateTextureCoord = this.variableBuilder.createUpdater("textureCoord", 2), this.updateWidth = this.variableBuilder.createUpdater("width", 1), this.variableBuilder.configure();
3039
3055
  }
3040
3056
  addBatch(e, t, n = 0, r = t.length) {
3041
- let i = this.properties.align || "left", a = this.properties.logoLetters ?? !1, o = this.metadata.common.base, c = this.metadata.common.scaleH, l = -5;
3057
+ let i = this.properties.align || "left", a = this.properties.logoLetters ?? !1, o = this.metadata.common.base, s = this.metadata.common.scaleH, l = -5;
3042
3058
  switch (this.properties.baseline) {
3043
3059
  case "top":
3044
3060
  l += this.metrics.capHeight;
@@ -3056,7 +3072,7 @@ var uc = class {
3056
3072
  let f = [0, 0];
3057
3073
  this.updateTextureCoord(f);
3058
3074
  for (let e = n; e < r; e++) {
3059
- let n = t[e], r = this.numberFormat(u(n)), p = s(r) ? r : r === null ? "" : "" + r;
3075
+ let n = t[e], r = this.numberFormat(u(n)), p = c(r) ? r : r === null ? "" : "" + r;
3060
3076
  if (p.length == 0) continue;
3061
3077
  this.variableBuilder.updateFromDatum(n);
3062
3078
  let m = a ? p.length : this.metrics.measureWidth(p);
@@ -3075,16 +3091,24 @@ var uc = class {
3075
3091
  }
3076
3092
  a ? (v = (t.width + 10) / t.width, h = -v / 2, _ = (t.height + 10) / t.height, g = -.5 - 5 / t.height) : (_ = t.height / o, g = -(t.height + t.yoffset + l) / o, v = t.width / o);
3077
3093
  let r = t.x, i = t.y;
3078
- d[0] = h, d[1] = g + _, f[0] = r / c, f[1] = i / c, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g + _, f[0] = (r + t.width) / c, f[1] = i / c, this.variableBuilder.pushAll(), d[0] = h, d[1] = g, f[0] = r / c, f[1] = (i + t.height) / c, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g + _, f[0] = (r + t.width) / c, f[1] = i / c, this.variableBuilder.pushAll(), d[0] = h, d[1] = g, f[0] = r / c, f[1] = (i + t.height) / c, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g, f[0] = (r + t.width) / c, f[1] = (i + t.height) / c, this.variableBuilder.pushAll(), h += n;
3094
+ d[0] = h, d[1] = g + _, f[0] = r / s, f[1] = i / s, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g + _, f[0] = (r + t.width) / s, f[1] = i / s, this.variableBuilder.pushAll(), d[0] = h, d[1] = g, f[0] = r / s, f[1] = (i + t.height) / s, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g + _, f[0] = (r + t.width) / s, f[1] = i / s, this.variableBuilder.pushAll(), d[0] = h, d[1] = g, f[0] = r / s, f[1] = (i + t.height) / s, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g, f[0] = (r + t.width) / s, f[1] = (i + t.height) / s, this.variableBuilder.pushAll(), h += n;
3079
3095
  }
3080
3096
  }
3081
3097
  this.registerBatch(e);
3082
3098
  }
3083
- }, gc = "#define PI 3.141593\n\nuniform View {\n /** Offset in \"unit\" units */\n mediump vec2 uViewOffset;\n mediump vec2 uViewScale;\n /** Size of the logical viewport in pixels, i.e., the view */\n mediump vec2 uViewportSize;\n mediump vec4 uLogicalVisibleRect;\n lowp vec2 uCullByVisibleRange;\n lowp float uDevicePixelRatio;\n // TODO: Views with opacity less than 1.0 should be rendered into a texture\n // that is rendered with the specified opacity.\n lowp float uViewOpacity;\n bool uPickingEnabled;\n};\n\n\n/**\n * Maps a coordinate on the unit scale to a normalized device coordinate.\n * (0, 0) is at the bottom left corner.\n */\nvec4 unitToNdc(vec2 coord) {\n return vec4((coord * uViewScale + uViewOffset) * 2.0 - 1.0, 0.0, 1.0);\n}\n\nvec4 unitToNdc(float x, float y) {\n return unitToNdc(vec2(x, y));\n}\n\nvec4 pixelsToNdc(vec2 coord) {\n return unitToNdc(coord / uViewportSize);\n}\n\nvec4 pixelsToNdc(float x, float y) {\n return pixelsToNdc(vec2(x, y));\n}\n\n/** Applies logical pixel offsets to a position in unit coordinates. */\nvec2 applyOffset(vec2 pos, vec2 offset) {\n return pos + vec2(offset.x, -offset.y) / uViewportSize;\n}\n\nbool isOutsideVisibleRange(vec2 pos) {\n return (uCullByVisibleRange.x > 0.5 &&\n (pos.x < uLogicalVisibleRect.x ||\n pos.x > uLogicalVisibleRect.z)) ||\n (uCullByVisibleRange.y > 0.5 &&\n (pos.y < uLogicalVisibleRect.y ||\n pos.y > uLogicalVisibleRect.w));\n}\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nconst highp uint HASH_EMPTY_KEY = 0xffffffffu;\n\nhighp uint hash32(highp uint key) {\n highp uint v = key;\n v ^= v >> 16u;\n v *= 0x7feb352du;\n v ^= v >> 15u;\n v *= 0x846ca68bu;\n v ^= v >> 16u;\n return v;\n}\n\nbool isEmptyHashTexture(highp usampler2D s) {\n // Empty selections are encoded as a single empty hash slot.\n ivec2 texSize = textureSize(s, 0);\n return texSize.x == 1 && texSize.y == 1 && texelFetch(s, ivec2(0, 0), 0).r == HASH_EMPTY_KEY;\n}\n\nbool hashContainsTexture(highp usampler2D s, highp uint value) {\n ivec2 texSize = textureSize(s, 0);\n highp uint width = uint(texSize.x);\n highp uint size = width * uint(texSize.y);\n highp uint mask = size - 1u;\n highp uint index = hash32(value) & mask;\n\n for (highp uint probe = 0u; probe < size; probe += 1u) {\n ivec2 coord = ivec2(int(index % width), int(index / width));\n highp uint entry = texelFetch(s, coord, 0).r;\n if (entry == value) {\n return true;\n }\n if (entry == HASH_EMPTY_KEY) {\n return false;\n }\n index = (index + 1u) & mask;\n }\n\n return false;\n}\n\n/**\n * Calculates a gamma for antialiasing opacity based on the color.\n */\nfloat getGammaForColor(vec3 rgb) {\n return mix(\n 1.25,\n 0.75,\n // RGB should be linearized but this is good enough for now\n smoothstep(0.0, 1.0, dot(rgb, vec3(0.299, 0.587, 0.114))));\n}\n\n// Fragment shader stuff ////////////////////////////////////////////////////////\n\n// TODO: include the following only in fragment shaders\n\n/**\n * Specialized linearstep for doing antialiasing\n */\nfloat distanceToRatio(float d) {\n return clamp(d * uDevicePixelRatio + 0.5, 0.0, 1.0);\n}\n\nvec4 distanceToColor(float d, vec4 fill, vec4 stroke, vec4 background, float halfStrokeWidth) {\n if (halfStrokeWidth > 0.0) {\n // Distance to stroke's edge. Negative inside the stroke.\n float sd = abs(d) - halfStrokeWidth;\n return mix(\n stroke,\n d <= 0.0 ? fill : background,\n distanceToRatio(sd));\n } else {\n return mix(background, fill, distanceToRatio(-d));\n }\n}\n", _c = "uniform highp float uZero;\n\n// Utils ------------\n\nvec3 getDiscreteColor(sampler2D s, int index) {\n return texelFetch(s, ivec2(index % textureSize(s, 0).x, 0), 0).rgb;\n}\n\nvec3 getInterpolatedColor(sampler2D s, float unitValue) {\n return texture(s, vec2(unitValue, 0.0)).rgb;\n}\n\nfloat clampToRange(float value, vec2 range) {\n return clamp(value, min(range[0], range[1]), max(range[0], range[1]));\n}\n\n// Scales ------------\n// Based on d3 scales: https://github.com/d3/d3-scale\n\nfloat scaleIdentity(float value) {\n return value;\n}\n\nfloat scaleIdentity(uint value) {\n return float(value);\n}\n\nfloat scaleLinear(float value, vec2 domain, vec2 range) {\n float domainSpan = domain[1] - domain[0];\n float rangeSpan = range[1] - range[0];\n return (value - domain[0]) / domainSpan * rangeSpan + range[0];\n}\n\nfloat scaleLog(float value, vec2 domain, vec2 range, float base) {\n // y = m log(x) + b \n // TODO: Perf optimization: precalculate log domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(log(value) / log(base), log(domain) / log(base), range);\n}\n\nfloat symlog(float value, float constant) {\n // WARNING: emulating log1p with log(x + 1). Small numbers are likely to\n // have significant precision problems.\n return sign(value) * log(abs(value / constant) + 1.0);\n}\n\nfloat scaleSymlog(float value, vec2 domain, vec2 range, float constant) {\n return scaleLinear(\n symlog(value, constant),\n vec2(symlog(domain[0], constant), symlog(domain[1], constant)),\n range\n );\n}\n\nfloat scalePow(float value, vec2 domain, vec2 range, float exponent) {\n // y = mx^k + b\n // TODO: Perf optimization: precalculate pow domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(\n pow(abs(value), exponent) * sign(value),\n pow(abs(domain), vec2(exponent)) * sign(domain),\n range\n );\n}\n\n// TODO: scaleThreshold\n// TODO: scaleQuantile (special case of threshold scale)\n\n// TODO: domainExtent should be uint\nfloat scaleBand(uint value, vec2 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n float n = domainExtent[1] - domainExtent[0];\n\n // This fix departs from Vega and d3: https://github.com/vega/vega/issues/3357#issuecomment-1063253596\n paddingInner = int(n) > 1 ? paddingInner : 0.0;\n\n // Adapted from: https://github.com/d3/d3-scale/blob/master/src/band.js\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n return start + (float(value) - domainExtent[0]) * step + bandwidth * band;\n}\n\nconst int lowBits = 12;\nconst float lowDivisor = pow(2.0, float(lowBits));\nconst uint lowMask = uint(lowDivisor - 1.0);\n\nvec2 splitUint(uint value) {\n uint valueLo = value & lowMask;\n uint valueHi = value - valueLo;\n return vec2(float(valueHi), float(valueLo));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales\n */\nfloat scaleBandHp(uint value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = splitUint(value);\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales for large\n * domains where 32bit uints are not sufficient to represent the domain.\n */\nfloat scaleBandHp(uvec2 value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = vec2(float(value[0]) * lowDivisor, float(value[1]));\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n", vc = "\n/** Describes where a sample facet should be shown. */\nstruct SampleFacetPosition {\n float pos;\n float height;\n};\n\n// ----------------------------------------------------------------------------\n\n#if !defined(SAMPLE_FACET_UNIFORM) && !defined(SAMPLE_FACET_TEXTURE)\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(0.0, 1.0);\n}\n\n#elif defined(SAMPLE_FACET_UNIFORM)\n\n/**\n * Location and height of the band on the Y axis on a normalized [0, 1] scale.\n * Elements: position, height\n */\nuniform vec2 uSampleFacet;\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(\n 1.0 - uSampleFacet.x - uSampleFacet.y,\n uSampleFacet.y\n );\n}\n\n#elif defined(SAMPLE_FACET_TEXTURE)\n\nuniform sampler2D uSampleFacetTexture;\n\nSampleFacetPosition getSampleFacetPos() {\n vec2 texel = texelFetch(\n uSampleFacetTexture,\n ivec2(int(attr_facetIndex), 0),\n 0\n ).rg;\n return SampleFacetPosition(\n 1.0 - texel.x - texel.y,\n texel.y\n );\n}\n\n#endif\n\nvec2 applySampleFacet(vec2 pos) {\n SampleFacetPosition facetPos = getSampleFacetPos();\n return vec2(pos.x, facetPos.pos + pos.y * facetPos.height);\n}\n", yc = "/*\n * Based on concepts presented at:\n * https://webglfundamentals.org/webgl/lessons/webgl-picking.html\n * https://deck.gl/docs/developer-guide/custom-layers/picking\n */\n\nout highp vec4 vPickingColor;\n\n/**\n * Passes the unique id to the fragment shader as a color if picking is enabled.\n * Returns true if picking is enabled.\n */\nbool setupPicking() {\n if (uPickingEnabled) {\n#ifdef uniqueId_DEFINED\n uint id = attr_uniqueId;\n vPickingColor = vec4(\n ivec4(id >> 0, id >> 8, id >> 16, id >> 24) & 0xFF\n ) / float(0xFF);\n#else\n vPickingColor = vec4(1.0);\n#endif\n return true;\n }\n return false;\n}\n", bc = "in highp vec4 vPickingColor;\n", xc = .5, Sc = "SAMPLE_FACET_UNIFORM", Cc = "SAMPLE_FACET_TEXTURE", wc = "uSelectionTexture_", Tc = class {
3099
+ }, yc = "#define PI 3.141593\n\nuniform View {\n /** Offset in \"unit\" units */\n mediump vec2 uViewOffset;\n mediump vec2 uViewScale;\n /** Size of the logical viewport in pixels, i.e., the view */\n mediump vec2 uViewportSize;\n mediump vec4 uLogicalVisibleRect;\n lowp vec2 uCullByVisibleRange;\n lowp float uDevicePixelRatio;\n // TODO: Views with opacity less than 1.0 should be rendered into a texture\n // that is rendered with the specified opacity.\n lowp float uViewOpacity;\n bool uPickingEnabled;\n};\n\n\n/**\n * Maps a coordinate on the unit scale to a normalized device coordinate.\n * (0, 0) is at the bottom left corner.\n */\nvec4 unitToNdc(vec2 coord) {\n return vec4((coord * uViewScale + uViewOffset) * 2.0 - 1.0, 0.0, 1.0);\n}\n\nvec4 unitToNdc(float x, float y) {\n return unitToNdc(vec2(x, y));\n}\n\nvec4 pixelsToNdc(vec2 coord) {\n return unitToNdc(coord / uViewportSize);\n}\n\nvec4 pixelsToNdc(float x, float y) {\n return pixelsToNdc(vec2(x, y));\n}\n\n/** Applies logical pixel offsets to a position in unit coordinates. */\nvec2 applyOffset(vec2 pos, vec2 offset) {\n return pos + vec2(offset.x, -offset.y) / uViewportSize;\n}\n\nbool isOutsideVisibleRange(vec2 pos) {\n return (uCullByVisibleRange.x > 0.5 &&\n (pos.x < uLogicalVisibleRect.x ||\n pos.x > uLogicalVisibleRect.z)) ||\n (uCullByVisibleRange.y > 0.5 &&\n (pos.y < uLogicalVisibleRect.y ||\n pos.y > uLogicalVisibleRect.w));\n}\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nconst highp uint HASH_EMPTY_KEY = 0xffffffffu;\n\nhighp uint hash32(highp uint key) {\n highp uint v = key;\n v ^= v >> 16u;\n v *= 0x7feb352du;\n v ^= v >> 15u;\n v *= 0x846ca68bu;\n v ^= v >> 16u;\n return v;\n}\n\nbool isEmptyHashTexture(highp usampler2D s) {\n // Empty selections are encoded as a single empty hash slot.\n ivec2 texSize = textureSize(s, 0);\n return texSize.x == 1 && texSize.y == 1 && texelFetch(s, ivec2(0, 0), 0).r == HASH_EMPTY_KEY;\n}\n\nbool hashContainsTexture(highp usampler2D s, highp uint value) {\n ivec2 texSize = textureSize(s, 0);\n highp uint width = uint(texSize.x);\n highp uint size = width * uint(texSize.y);\n highp uint mask = size - 1u;\n highp uint index = hash32(value) & mask;\n\n for (highp uint probe = 0u; probe < size; probe += 1u) {\n ivec2 coord = ivec2(int(index % width), int(index / width));\n highp uint entry = texelFetch(s, coord, 0).r;\n if (entry == value) {\n return true;\n }\n if (entry == HASH_EMPTY_KEY) {\n return false;\n }\n index = (index + 1u) & mask;\n }\n\n return false;\n}\n\n/**\n * Calculates a gamma for antialiasing opacity based on the color.\n */\nfloat getGammaForColor(vec3 rgb) {\n return mix(\n 1.25,\n 0.75,\n // RGB should be linearized but this is good enough for now\n smoothstep(0.0, 1.0, dot(rgb, vec3(0.299, 0.587, 0.114))));\n}\n\n// Fragment shader stuff ////////////////////////////////////////////////////////\n\n// TODO: include the following only in fragment shaders\n\n/**\n * Specialized linearstep for doing antialiasing\n */\nfloat distanceToRatio(float d) {\n return clamp(d * uDevicePixelRatio + 0.5, 0.0, 1.0);\n}\n\nvec4 distanceToColor(float d, vec4 fill, vec4 stroke, vec4 background, float halfStrokeWidth) {\n if (halfStrokeWidth > 0.0) {\n // Distance to stroke's edge. Negative inside the stroke.\n float sd = abs(d) - halfStrokeWidth;\n return mix(\n stroke,\n d <= 0.0 ? fill : background,\n distanceToRatio(sd));\n } else {\n return mix(background, fill, distanceToRatio(-d));\n }\n}\n", bc = "uniform highp float uZero;\n\n// Utils ------------\n\nvec3 getDiscreteColor(sampler2D s, int index) {\n return texelFetch(s, ivec2(index % textureSize(s, 0).x, 0), 0).rgb;\n}\n\nvec3 getInterpolatedColor(sampler2D s, float unitValue) {\n return texture(s, vec2(unitValue, 0.0)).rgb;\n}\n\nfloat clampToRange(float value, vec2 range) {\n return clamp(value, min(range[0], range[1]), max(range[0], range[1]));\n}\n\n// Scales ------------\n// Based on d3 scales: https://github.com/d3/d3-scale\n\nfloat scaleIdentity(float value) {\n return value;\n}\n\nfloat scaleIdentity(uint value) {\n return float(value);\n}\n\nfloat scaleLinear(float value, vec2 domain, vec2 range) {\n float domainSpan = domain[1] - domain[0];\n float rangeSpan = range[1] - range[0];\n return (value - domain[0]) / domainSpan * rangeSpan + range[0];\n}\n\nfloat scaleLog(float value, vec2 domain, vec2 range, float base) {\n // y = m log(x) + b \n // TODO: Perf optimization: precalculate log domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(log(value) / log(base), log(domain) / log(base), range);\n}\n\nfloat symlog(float value, float constant) {\n // WARNING: emulating log1p with log(x + 1). Small numbers are likely to\n // have significant precision problems.\n return sign(value) * log(abs(value / constant) + 1.0);\n}\n\nfloat scaleSymlog(float value, vec2 domain, vec2 range, float constant) {\n return scaleLinear(\n symlog(value, constant),\n vec2(symlog(domain[0], constant), symlog(domain[1], constant)),\n range\n );\n}\n\nfloat scalePow(float value, vec2 domain, vec2 range, float exponent) {\n // y = mx^k + b\n // TODO: Perf optimization: precalculate pow domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(\n pow(abs(value), exponent) * sign(value),\n pow(abs(domain), vec2(exponent)) * sign(domain),\n range\n );\n}\n\n// TODO: scaleThreshold\n// TODO: scaleQuantile (special case of threshold scale)\n\n// TODO: domainExtent should be uint\nfloat scaleBand(uint value, vec2 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n float n = domainExtent[1] - domainExtent[0];\n\n // This fix departs from Vega and d3: https://github.com/vega/vega/issues/3357#issuecomment-1063253596\n paddingInner = int(n) > 1 ? paddingInner : 0.0;\n\n // Adapted from: https://github.com/d3/d3-scale/blob/master/src/band.js\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n return start + (float(value) - domainExtent[0]) * step + bandwidth * band;\n}\n\nconst int lowBits = 12;\nconst float lowDivisor = pow(2.0, float(lowBits));\nconst uint lowMask = uint(lowDivisor - 1.0);\n\nvec2 splitUint(uint value) {\n uint valueLo = value & lowMask;\n uint valueHi = value - valueLo;\n return vec2(float(valueHi), float(valueLo));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales\n */\nfloat scaleBandHp(uint value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = splitUint(value);\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales for large\n * domains where 32bit uints are not sufficient to represent the domain.\n */\nfloat scaleBandHp(uvec2 value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = vec2(float(value[0]) * lowDivisor, float(value[1]));\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n", xc = "\n/** Describes where a sample facet should be shown. */\nstruct SampleFacetPosition {\n float pos;\n float height;\n};\n\n// ----------------------------------------------------------------------------\n\n#if !defined(SAMPLE_FACET_UNIFORM) && !defined(SAMPLE_FACET_TEXTURE)\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(0.0, 1.0);\n}\n\n#elif defined(SAMPLE_FACET_UNIFORM)\n\n/**\n * Location and height of the band on the Y axis on a normalized [0, 1] scale.\n * Elements: position, height\n */\nuniform vec2 uSampleFacet;\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(\n 1.0 - uSampleFacet.x - uSampleFacet.y,\n uSampleFacet.y\n );\n}\n\n#elif defined(SAMPLE_FACET_TEXTURE)\n\nuniform sampler2D uSampleFacetTexture;\n\nSampleFacetPosition getSampleFacetPos() {\n vec2 texel = texelFetch(\n uSampleFacetTexture,\n ivec2(int(attr_facetIndex), 0),\n 0\n ).rg;\n return SampleFacetPosition(\n 1.0 - texel.x - texel.y,\n texel.y\n );\n}\n\n#endif\n\nvec2 applySampleFacet(vec2 pos) {\n SampleFacetPosition facetPos = getSampleFacetPos();\n return vec2(pos.x, facetPos.pos + pos.y * facetPos.height);\n}\n", Sc = "/*\n * Based on concepts presented at:\n * https://webglfundamentals.org/webgl/lessons/webgl-picking.html\n * https://deck.gl/docs/developer-guide/custom-layers/picking\n */\n\nout highp vec4 vPickingColor;\n\n/**\n * Passes the unique id to the fragment shader as a color if picking is enabled.\n * Returns true if picking is enabled.\n */\nbool setupPicking() {\n if (uPickingEnabled) {\n#ifdef uniqueId_DEFINED\n uint id = attr_uniqueId;\n vPickingColor = vec4(\n ivec4(id >> 0, id >> 8, id >> 16, id >> 24) & 0xFF\n ) / float(0xFF);\n#else\n vPickingColor = vec4(1.0);\n#endif\n return true;\n }\n return false;\n}\n", Cc = "in highp vec4 vPickingColor;\n", wc = .5, Tc = "SAMPLE_FACET_UNIFORM", Ec = "SAMPLE_FACET_TEXTURE", Dc = "uSelectionTexture_", Oc = {
3100
+ all: 0,
3101
+ matching: 1,
3102
+ nonmatching: 2
3103
+ };
3104
+ function kc(e, t) {
3105
+ return e.replace(/#pragma orderGuard(?:[ \t]*\r?\n){0,2}/, t);
3106
+ }
3107
+ var Ac = class {
3084
3108
  #e = [];
3085
3109
  #t = !1;
3086
3110
  constructor(e, t, n) {
3087
- this.mark = e, this._glHelper = t, this._rendererResources = n, this.bufferInfo = void 0, this.bytesPerElement = /* @__PURE__ */ new Map(), this.programInfo = void 0, this.vertexArrayInfo = void 0, this.viewUniformInfo = void 0, this.markUniformInfo = void 0, this.markUniformsAltered = !0, this.selectionTextureOps = [], this.scaleResolutionDisposers = [], this.rangeMap = new Ec();
3111
+ this.mark = e, this._glHelper = t, this._rendererResources = n, this.bufferInfo = void 0, this.bytesPerElement = /* @__PURE__ */ new Map(), this.programInfo = void 0, this.vertexArrayInfo = void 0, this.viewUniformInfo = void 0, this.markUniformInfo = void 0, this.markUniformsAltered = !0, this.selectionTextureOps = [], this.scaleResolutionDisposers = [], this.rangeMap = new jc();
3088
3112
  }
3089
3113
  get unitView() {
3090
3114
  return this.mark.unitView;
@@ -3117,133 +3141,140 @@ var uc = class {
3117
3141
  this.#n();
3118
3142
  }
3119
3143
  getSampleFacetMode() {
3120
- if (this.encoders.facetIndex) return Cc;
3121
- if (this.unitView.usesSampleFacetRendering()) return Sc;
3122
- }
3123
- createAndLinkShaders(t, i, o = []) {
3124
- let s = this.getAttributes(), c = this.encoders, l = this.getSampleFacetMode(), u = !!this.properties.cullByVisibleRange;
3125
- l && o.push(`#define ${l}`), u && o.push("#define VISIBLE_RANGE_CULLING");
3126
- let m = "// view: " + this.unitView.getPathString(), h = [], _ = /* @__PURE__ */ new Set(), ee = Es(c), y = [], ne = Object.values(c).flatMap((e) => e.branches ?? []).map((e) => e.predicate).filter((e) => e.param), x = /* @__PURE__ */ new Map();
3127
- for (let e of ne) {
3128
- let t = e.param, i = this.unitView.paramRuntime, o = i.findValue(t);
3129
- if (!o) throw Error(`Cannot infer selection type as the parameter "${t}" has no value. Please ensure that the parameter is properly defined!`);
3130
- let s = Ds("uniqueId");
3131
- if (oe(o)) {
3132
- if (!x.has(t)) {
3133
- x.set(t, "single");
3134
- let e = rs + n(t);
3135
- y.push(" // Selection parameter"), y.push(` uniform highp uint ${e};`), this.#e.push(() => {
3136
- this.registerMarkUniformValue(e, { expr: t }, (e) => e.uniqueId ?? 0);
3137
- }), h.push(`bool ${is}${t}(bool empty) {\n return ${rs}${t} == ${s} || (empty && ${rs}${t} == 0u);\n}`);
3138
- }
3139
- } else if (a(o)) {
3140
- if (!x.has(t)) {
3141
- x.set(t, "multi");
3142
- let e = wc + n(t);
3143
- h.push(`// Selection texture\nuniform highp usampler2D ${e};`);
3144
- let r = this.glHelper, a = r.selectionTextures;
3145
- this.selectionTextureOps.push(() => {
3146
- let n = i.getValue(t), r = a.get(n);
3147
- if (!r) throw Error(`Bug: no selection texture found for "${t}"!`);
3148
- J(this.programInfo, { [e]: r });
3149
- });
3150
- let c = wc + t;
3151
- h.push(`bool ${is}${t}(bool empty) {\n return hashContainsTexture(${c}, ${s}) || (empty && isEmptyHashTexture(${c}));\n}`), r.createSelectionTexture(o), i.watchExpression(t, () => {
3152
- let e = i.getValue(t);
3153
- r.createSelectionTexture(e), this.unitView.context.animator.requestRender();
3154
- });
3155
- }
3156
- } else if (r(o) && !x.has(t)) {
3157
- x.set(t, "interval");
3158
- let e = [], r = [];
3159
- for (let i of Object.keys(o.intervals)) {
3160
- if (!["x", "y"].includes(i)) continue;
3161
- let a = rs + n(t) + `_${i}`, { attributeType: o } = xs(this.unitView.getScaleResolution(i).getScale(), i);
3162
- y.push(" // Selection parameter"), y.push(` uniform highp ${o}[2] ${a};`), this.#e.push(() => {
3163
- this.registerMarkUniformValue(a, { expr: t }, (e) => e.intervals[i] ?? [1, 0]);
3144
+ if (this.encoders.facetIndex) return Ec;
3145
+ if (this.unitView.usesSampleFacetRendering()) return Tc;
3146
+ }
3147
+ createAndLinkShaders(n, i, s = []) {
3148
+ let c = this.getAttributes(), l = this.encoders, d = this.mark.getOrder(), f = this.getSampleFacetMode(), p = !!this.properties.cullByVisibleRange;
3149
+ f && s.push(`#define ${f}`), p && s.push("#define VISIBLE_RANGE_CULLING");
3150
+ let h = "// view: " + this.unitView.getPathString(), g = [], _ = /* @__PURE__ */ new Set(), y = ks(l), x = [], ee = e(l), S = new Set(ee.keys());
3151
+ for (let e of d?.params ?? []) S.add(e);
3152
+ let C = new Set(ee.keys().filter((e) => ee.get(e)));
3153
+ if (d && !d.predicate.selection.singleParam) for (let e of d.params) C.add(e);
3154
+ d && (s.push("#define CONDITIONAL_ORDER"), x.push(" // Conditional order pass"), x.push(" uniform int uOrderMode;"));
3155
+ for (let e of S) {
3156
+ let n = this.unitView.paramRuntime, i = n.findValue(e);
3157
+ if (!i) throw Error(`Cannot infer selection type as the parameter "${e}" has no value. Please ensure that the parameter is properly defined!`);
3158
+ let o = As("uniqueId");
3159
+ if (r(i)) {
3160
+ let n = $ + t(e);
3161
+ x.push(" // Selection parameter"), x.push(` uniform highp uint ${n};`), this.#e.push(() => {
3162
+ this.registerMarkUniformValue(n, { expr: e }, (e) => e.uniqueId ?? 0);
3163
+ }), g.push(`bool ${is}${e}(bool empty) {\n return ${$}${e} == ${o} || (empty && ${$}${e} == 0u);\n}`), C.has(e) && (g.push(`bool ${as}${e}() {\n return ${$}${e} != 0u && ${$}${e} == ${o};\n}`), g.push(`bool ${os}${e}() {\n return ${$}${e} == 0u;\n}`));
3164
+ } else if (se(i)) {
3165
+ let r = Dc + t(e);
3166
+ g.push(`// Selection texture\nuniform highp usampler2D ${r};`);
3167
+ let a = this.glHelper, s = a.selectionTextures;
3168
+ this.selectionTextureOps.push(() => {
3169
+ let t = n.getValue(e), i = s.get(t);
3170
+ if (!i) throw Error(`Bug: no selection texture found for "${e}"!`);
3171
+ J(this.programInfo, { [r]: i });
3172
+ });
3173
+ let c = Dc + e;
3174
+ g.push(`bool ${is}${e}(bool empty) {\n return hashContainsTexture(${c}, ${o}) || (empty && isEmptyHashTexture(${c}));\n}`), C.has(e) && (g.push(`bool ${as}${e}() {\n return hashContainsTexture(${c}, ${o});\n}`), g.push(`bool ${os}${e}() {\n return isEmptyHashTexture(${c});\n}`)), a.createSelectionTexture(i), n.watchExpression(e, () => {
3175
+ let t = n.getValue(e);
3176
+ a.createSelectionTexture(t), this.unitView.context.animator.requestRender();
3177
+ });
3178
+ } else if (a(i)) {
3179
+ let n = Object.keys(i.intervals).filter((e) => ["x", "y"].includes(e));
3180
+ if (n.length == 0) throw new ye(`Interval selection "${e}" has no supported x or y targets.`, this.unitView);
3181
+ let r = [], a = [];
3182
+ for (let i of n) {
3183
+ let n = $ + t(e) + `_${i}`, { attributeType: o } = ws(this.unitView.getScaleResolution(i).getScale(), i);
3184
+ x.push(" // Selection parameter"), x.push(` uniform highp ${o}[2] ${n};`), this.#e.push(() => {
3185
+ this.registerMarkUniformValue(n, { expr: e }, (e) => e.intervals[i] ?? [1, 0]);
3164
3186
  });
3165
3187
  let s = (e) => {
3166
- for (let [t, n] of ee.entries()) if (t[1] && n.includes(e)) return Ds(n);
3167
- return Ds(e);
3168
- }, c = s(i), l = a + "[0]", u = a + "[1]", d = b(i);
3188
+ for (let [t, n] of y.entries()) if (t[1] && n.includes(e)) return As(n);
3189
+ return As(e);
3190
+ }, c = s(i), l = n + "[0]", u = n + "[1]", d = m(i);
3169
3191
  if (this.encoding[d]) {
3170
- let t = s(d), n = this.defaultHitTestMode;
3171
- if (n == "endpoints") e.push(`((${l} <= ${c} && ${c} <= ${u}) || (${l} <= ${t} && ${t} <= ${u}))`);
3172
- else if (n == "encloses") e.push(`(${l} <= ${c} && ${t} <= ${u})`);
3173
- else if (n == "intersects") e.push(`(${l} <= ${t} && ${c} <= ${u})`);
3174
- else throw new ye(`Unsupported hit test mode "${n}" for interval selection!`, this.unitView);
3175
- } else e.push(`(${l} <= ${c} && ${c} <= ${u})`);
3176
- r.push(`${l} > ${u}`);
3192
+ let e = s(d), t = this.defaultHitTestMode;
3193
+ if (t == "endpoints") r.push(`((${l} <= ${c} && ${c} <= ${u}) || (${l} <= ${e} && ${e} <= ${u}))`);
3194
+ else if (t == "encloses") r.push(`(${l} <= ${c} && ${e} <= ${u})`);
3195
+ else if (t == "intersects") r.push(`(${l} <= ${e} && ${c} <= ${u})`);
3196
+ else throw new ye(`Unsupported hit test mode "${t}" for interval selection!`, this.unitView);
3197
+ } else r.push(`(${l} <= ${c} && ${c} <= ${u})`);
3198
+ a.push(`${l} > ${u}`);
3177
3199
  }
3178
- h.push(`bool ${is}${t}(bool empty) {\n return ${e.join(" && ")} || (empty && (${r.join(" || ")}));\n}`);
3179
- }
3200
+ if (g.push(`bool ${is}${e}(bool empty) {\n return ${r.join(" && ")} || (empty && (${a.join(" || ")}));\n}`), !C.has(e)) continue;
3201
+ let o = r.map((e, t) => `(${a[t]} || ${e})`);
3202
+ g.push(`bool ${as}${e}() {\n return (!(${a.join(" && ")})) && (${o.join(" && ")});\n}`), g.push(`bool ${os}${e}() {\n return ${a.join(" && ")};\n}`);
3203
+ } else throw new ye(`Unsupported selection type "${i.type}" for WebGL conditional encoding.`, this.unitView);
3180
3204
  }
3181
- let re = (e, t, n, r) => {
3205
+ let ne = (e, t, n, r) => {
3182
3206
  let i = t.channelDef;
3183
- if (f(i)) if (d(i.value)) {
3184
- let { uniformName: t, uniformGlsl: r, accessorGlsl: a, adjuster: o } = us(e, n);
3185
- h.push(a), y.push(r), this.#e.push(() => {
3207
+ if (o(i)) if (u(i.value)) {
3208
+ let { uniformName: t, uniformGlsl: r, accessorGlsl: a, adjuster: o } = fs(e, n);
3209
+ g.push(a), x.push(r), this.#e.push(() => {
3186
3210
  this.registerMarkUniformValue(t, i.value, o);
3187
3211
  });
3188
- } else h.push(ls(e, n, i.value).accessorGlsl);
3189
- else if (g(i)) {
3190
- let { uniformName: t, uniformGlsl: a, accessorGlsl: o } = fs(e, r, n);
3191
- y.push(a), h.push(o);
3192
- let { largeHp: s, discrete: c } = xs(r, e), l = c && "domain" in r ? (e) => r.domain().indexOf(e) : s ? Cs : (e) => +e;
3212
+ } else g.push(ds(e, n, i.value).accessorGlsl);
3213
+ else if (v(i)) {
3214
+ let { uniformName: t, uniformGlsl: a, accessorGlsl: o } = ms(e, r, n);
3215
+ x.push(a), g.push(o);
3216
+ let { largeHp: s, discrete: c } = ws(r, e), l = c && "domain" in r ? (e) => r.domain().indexOf(e) : s ? Es : (e) => +e;
3193
3217
  this.#e.push(() => {
3194
3218
  this.registerMarkUniformValue(t, i.datum, l);
3195
3219
  });
3196
- } else if (v(i)) {
3197
- let t = ee.get([i.field, !0]), { attributeGlsl: a, accessorGlsl: o } = ds(e, r, n, t?.includes(e) ? t : void 0);
3198
- _.add(a), h.push(o);
3199
- } else if (te(i)) {
3200
- let { attributeGlsl: t, accessorGlsl: i } = ds(e, r, n);
3201
- _.add(t), h.push(i);
3220
+ } else if (oe(i)) {
3221
+ let t = y.get([i.field, !0]), { attributeGlsl: a, accessorGlsl: o } = ps(e, r, n, t?.includes(e) ? t : void 0);
3222
+ _.add(a), g.push(o);
3223
+ } else if (ae(i)) {
3224
+ let { attributeGlsl: t, accessorGlsl: i } = ps(e, r, n);
3225
+ _.add(t), g.push(i);
3202
3226
  } else throw new ye(`Unsupported channel definition: ${JSON.stringify(i)}`, this.unitView);
3203
3227
  };
3204
- for (let [t, n] of Object.entries(c)) {
3205
- if (!s.includes(t)) continue;
3206
- let { branches: r, channelDef: i, scale: a } = n;
3207
- for (let e = 0; e < r.length; e++) re(t, r[e].accessor, e, a);
3208
- if (a) {
3209
- let n = e(i), r = n && n.resolutionChannel || t, o = p(r) ? this.unitView.getScaleResolution(r) : null, { glsl: s, domainUniform: c, domainUniformName: l, rangeUniform: u, rangeUniformName: d } = ps(t, a, i);
3210
- h.push(s), y.push(c), y.push(u), u && this.#e.push(() => {
3211
- let e = this.createMarkUniformSetter(d), n = () => e(ks(a, t));
3212
- this.registerScaleResolutionListener(o, "range", n), n();
3213
- }), c && this.#e.push(() => {
3214
- let e = this.createMarkUniformSetter(l), t = () => {
3228
+ for (let [e, t] of Object.entries(l)) {
3229
+ if (!c.includes(e)) continue;
3230
+ let { branches: n, channelDef: r, scale: i } = t;
3231
+ for (let t = 0; t < n.length; t++) ne(e, n[t].accessor, t, i);
3232
+ if (i) {
3233
+ let t = b(r), n = t && t.resolutionChannel || e, a = te(n) ? this.unitView.getScaleResolution(n) : null, { glsl: o, domainUniform: s, domainUniformName: c, rangeUniform: l, rangeUniformName: u } = hs(e, i, r);
3234
+ g.push(o), x.push(s), x.push(l), l && this.#e.push(() => {
3235
+ let t = this.createMarkUniformSetter(u), n = () => t(Ms(i, e));
3236
+ this.registerScaleResolutionListener(a, "range", n), n();
3237
+ }), s && this.#e.push(() => {
3238
+ let e = this.createMarkUniformSetter(c), t = () => {
3215
3239
  let t;
3216
- t = fe(a.type) ? [0, a.domain().length] : C(a.type) ? os(a) : a.domain(), e(ge(a.type) ? Ts(t) : t);
3240
+ t = fe(i.type) ? [0, i.domain().length] : w(i.type) ? cs(i) : i.domain(), e(ge(i.type) ? Os(t) : t);
3217
3241
  };
3218
- this.registerScaleResolutionListener(o, "domain", t), t();
3242
+ this.registerScaleResolutionListener(a, "domain", t), t();
3219
3243
  });
3220
3244
  }
3221
- h.push(ms(t, r));
3245
+ g.push(gs(e, n));
3222
3246
  }
3223
- let ie = [...x.keys()].map((e) => `${is}${e}(false)`);
3224
- h.push("bool isDatumSelected() {\n" + (this.encoders.uniqueId && ie.length > 0 ? ` return ${ie.join(" || ")};` : " return false;") + "\n}");
3225
- let ae = "precision highp float;\nprecision highp int;", S = (e) => e.replace("#pragma markUniforms", y.join("\n"));
3226
- o = o.map(S), t = S(t), i = S(i);
3227
- let se = [
3228
- ae,
3229
- m,
3230
- ...o,
3231
- gc,
3232
- _c,
3233
- [..._].join("\n"),
3234
- ...h,
3235
- vc,
3247
+ let re = Array.from(ee, ([e, t]) => `${t ? as : is}${e}(${t ? "" : "false"})`);
3248
+ if (g.push("bool isDatumSelected() {\n" + (this.encoders.uniqueId && re.length > 0 ? ` return ${re.join(" || ")};` : " return false;") + "\n}"), d) {
3249
+ let e = d.params.map((e) => {
3250
+ let t = !d.predicate.selection.singleParam;
3251
+ return `${t ? as : is}${e}(${t ? "" : String(d.predicate.selection.empty)})`;
3252
+ });
3253
+ g.push(`bool isOrderMatch() {
3254
+ return ${e.join(" || ")};\n}`);
3255
+ }
3256
+ let ie = "precision highp float;\nprecision highp int;", ce = (e) => e.replace("#pragma markUniforms", x.join("\n"));
3257
+ s = s.map(ce), n = ce(n), i = ce(i), n = ((e) => kc(e, d ? " if (uOrderMode != 0 &&\n (((uOrderMode & 3) == 1) != isOrderMatch())) {\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }" : ""))(n);
3258
+ let le = [
3259
+ ie,
3260
+ h,
3261
+ ...s,
3236
3262
  yc,
3237
- t
3238
- ], ce = [
3239
- ae,
3240
- m,
3241
- ...o,
3242
- gc,
3243
3263
  bc,
3264
+ [..._].join("\n"),
3265
+ ...g,
3266
+ xc,
3267
+ Sc,
3268
+ n
3269
+ ], ue = [
3270
+ ie,
3271
+ h,
3272
+ ...s,
3273
+ yc,
3274
+ Cc,
3244
3275
  i
3245
- ], le = this.gl;
3246
- this.programStatus = Bs(le, this.glHelper.compileShader(le.VERTEX_SHADER, se), this.glHelper.compileShader(le.FRAGMENT_SHADER, ce));
3276
+ ], T = this.gl;
3277
+ this.programStatus = Us(T, this.glHelper.compileShader(T.VERTEX_SHADER, le), this.glHelper.compileShader(T.FRAGMENT_SHADER, ue));
3247
3278
  }
3248
3279
  finalizeGraphicsInitialization() {
3249
3280
  if (this.#n(), this.programInfo) return;
@@ -3254,7 +3285,7 @@ var uc = class {
3254
3285
  let t = /* @__PURE__ */ Error("Cannot create shader program: " + e.message);
3255
3286
  throw t.view = this.unitView, t;
3256
3287
  }
3257
- this.programInfo = no(this.gl, this.programStatus.program), delete this.programStatus, this.viewUniformInfo = Ya(this.gl, this.programInfo, "View"), this.markUniformInfo = Ya(this.gl, this.programInfo, "Mark"), this.gl.useProgram(this.programInfo.program), J(this.programInfo, {
3288
+ this.programInfo = ro(this.gl, this.programStatus.program), delete this.programStatus, this.viewUniformInfo = Xa(this.gl, this.programInfo, "View"), this.markUniformInfo = Xa(this.gl, this.programInfo, "Mark"), this.gl.useProgram(this.programInfo.program), J(this.programInfo, {
3258
3289
  uSampleFacet: [0, 1],
3259
3290
  uZero: 0
3260
3291
  });
@@ -3270,10 +3301,10 @@ var uc = class {
3270
3301
  }
3271
3302
  registerMarkUniformValue(e, t, n = (e) => e) {
3272
3303
  let r = this.createMarkUniformSetter(e), i = (n) => {
3273
- if (n == null) throw Error(`Trying to set null/undefined value for uniform: ${e}${d(t) ? `Expr: ${t.expr}` : ""}`);
3304
+ if (n == null) throw Error(`Trying to set null/undefined value for uniform: ${e}${u(t) ? `Expr: ${t.expr}` : ""}`);
3274
3305
  r(n);
3275
3306
  };
3276
- if (d(t)) {
3307
+ if (u(t)) {
3277
3308
  let e, r = () => i(n(e(null)));
3278
3309
  e = this.unitView.paramRuntime.watchExpression(t.expr, r), r();
3279
3310
  } else i(n(t));
@@ -3328,24 +3359,27 @@ var uc = class {
3328
3359
  };
3329
3360
  }
3330
3361
  bindOrSetMarkUniformBlock() {
3331
- this.markUniformsAltered ? (Za(this.gl, this.programInfo, this.markUniformInfo), this.markUniformsAltered = !1) : Xa(this.gl, this.programInfo, this.markUniformInfo);
3362
+ this.markUniformsAltered ? (Qa(this.gl, this.programInfo, this.markUniformInfo), this.markUniformsAltered = !1) : Za(this.gl, this.programInfo, this.markUniformInfo);
3363
+ }
3364
+ setOrderPass(e, t = !1) {
3365
+ $a(this.markUniformInfo, { uOrderMode: Oc[e] | (t ? 4 : 0) }), this.markUniformsAltered = !0;
3332
3366
  }
3333
3367
  prepareRender(e) {
3334
3368
  let t = this.glHelper, n = this.gl, r = [];
3335
3369
  r.push(() => {
3336
- this.vertexArrayInfo ||= Fo(this.gl, this.programInfo, this.bufferInfo), n.useProgram(this.programInfo.program);
3370
+ this.vertexArrayInfo ||= Io(this.gl, this.programInfo, this.bufferInfo), n.useProgram(this.programInfo.program);
3337
3371
  });
3338
3372
  for (let [e, n] of Object.entries(this.encoders)) {
3339
3373
  let i = t.rangeTextures.get(n.scale);
3340
- i && r.push(() => J(this.programInfo, { [ns + e]: i }));
3374
+ i && r.push(() => J(this.programInfo, { [rs + e]: i }));
3341
3375
  }
3342
- r.push(...this.selectionTextureOps), this.getSampleFacetMode() == Cc && r.push(() => {
3376
+ r.push(...this.selectionTextureOps), this.getSampleFacetMode() == Ec && r.push(() => {
3343
3377
  let t = e.placement?.source;
3344
3378
  if (!t) throw Error("No placement source available.");
3345
3379
  J(this.programInfo, { uSampleFacetTexture: this.glHelper.getPlacementTexture(t) });
3346
3380
  });
3347
3381
  let i = (e.picking ?? !1) && this.isPickingParticipant();
3348
- return r.push(() => Qa(this.viewUniformInfo, {
3382
+ return r.push(() => $a(this.viewUniformInfo, {
3349
3383
  uViewOpacity: this.unitView.getEffectiveOpacity(),
3350
3384
  uPickingEnabled: i
3351
3385
  })), this.opaque || e.picking ? r.push(() => n.disable(n.BLEND)) : r.push(() => n.enable(n.BLEND)), r;
@@ -3362,23 +3396,25 @@ var uc = class {
3362
3396
  render(e) {}
3363
3397
  createRenderCallback(e, t) {
3364
3398
  if (!this.bufferInfo) return () => void 0;
3365
- let n = this, r, i = this.unitView.getScaleResolution("x")?.getScale(), a = i && w(i.type), o = ["index", "locus"].includes(i?.type) ? -1 : 0, s = [0, 0];
3366
- r = (t) => {
3367
- if (a && t.xIndex) {
3368
- let n = i.domain(), r = Math.abs(n[1] - n[0]), a = t.xIndex(n[0] + o - r, n[1] + r, s), c = a[0], l = a[1] - c;
3369
- l > 0 && e(c, l);
3370
- } else e(t.offset, t.count);
3399
+ let n = this, r = t.orderPass, i = r ? (i, a) => {
3400
+ n.setOrderPass(r, t.secondOrderPass), n.bindOrSetMarkUniformBlock(), e(i, a);
3401
+ } : e, a, o = this.unitView.getScaleResolution("x")?.getScale(), s = o && T(o.type), c = ["index", "locus"].includes(o?.type) ? -1 : 0, l = [0, 0];
3402
+ a = (e) => {
3403
+ if (s && e.xIndex) {
3404
+ let t = o.domain(), n = Math.abs(t[1] - t[0]), r = e.xIndex(t[0] + c - n, t[1] + n, l), a = r[0], s = r[1] - a;
3405
+ s > 0 && i(a, s);
3406
+ } else i(e.offset, e.count);
3371
3407
  };
3372
- let c = this.rangeMap.get(void 0).count == 0 ? t.facetId : void 0, l = this.rangeMap.get(c);
3408
+ let u = this.rangeMap.get(void 0).count == 0 ? t.facetId : void 0, d = this.rangeMap.get(u);
3373
3409
  return t.sampleFacetRenderingOptions ? function() {
3374
- l.count && n.prepareSampleFacetRendering(t) && r(l);
3410
+ d.count && n.prepareSampleFacetRendering(t) && a(d);
3375
3411
  } : function() {
3376
- l.count && r(l);
3412
+ d.count && a(d);
3377
3413
  };
3378
3414
  }
3379
- setViewport(e, t, n, r, i, a = xc) {
3415
+ setViewport(e, t, n, r, i, a = wc) {
3380
3416
  n = n.flatten();
3381
- let o = this.gl, s = this.properties, c = a, l = a, u, d = Dc(e, n, s.clip === "never" ? void 0 : r, !1), f = d.coords;
3417
+ let o = this.gl, s = this.properties, c = a, l = a, u, d = Mc(e, n, s.clip === "never" ? void 0 : r, !1), f = d.coords;
3382
3418
  if (d.requiresScissor) {
3383
3419
  if (!f.isDefined()) return !1;
3384
3420
  let r = [
@@ -3398,15 +3434,15 @@ var uc = class {
3398
3434
  uViewScale: [n.width / e.width, n.height / e.height]
3399
3435
  };
3400
3436
  }
3401
- return Qa(this.viewUniformInfo, {
3437
+ return $a(this.viewUniformInfo, {
3402
3438
  ...u,
3403
3439
  uViewportSize: [n.width, n.height],
3404
- uLogicalVisibleRect: Oc(n, i),
3440
+ uLogicalVisibleRect: Nc(n, i),
3405
3441
  uCullByVisibleRange: [+(s.cullByVisibleRange === !0 || s.cullByVisibleRange === "x"), +(s.cullByVisibleRange === !0 || s.cullByVisibleRange === "y")],
3406
3442
  uDevicePixelRatio: t
3407
- }), Za(this.gl, this.programInfo, this.viewUniformInfo), !0;
3443
+ }), Qa(this.gl, this.programInfo, this.viewUniformInfo), !0;
3408
3444
  }
3409
- }, Ec = class extends ue {
3445
+ }, jc = class extends ue {
3410
3446
  constructor() {
3411
3447
  super([], JSON.stringify);
3412
3448
  }
@@ -3423,7 +3459,7 @@ var uc = class {
3423
3459
  for (let [t, n] of e.entries()) Object.assign(this.get(t), n);
3424
3460
  }
3425
3461
  };
3426
- function Dc(e, t, n, r = !0) {
3462
+ function Mc(e, t, n, r = !0) {
3427
3463
  if (!n || !n.clipX && !n.clipY) return {
3428
3464
  requiresScissor: !1,
3429
3465
  coords: t
@@ -3440,7 +3476,7 @@ function Dc(e, t, n, r = !0) {
3440
3476
  coords: i.flatten()
3441
3477
  };
3442
3478
  }
3443
- function Oc(e, t) {
3479
+ function Nc(e, t) {
3444
3480
  let n = t?.clipX ? (t.rect.x - e.x) / e.width : 0, r = t?.clipX ? (t.rect.x2 - e.x) / e.width : 1;
3445
3481
  return [
3446
3482
  n,
@@ -3451,7 +3487,7 @@ function Oc(e, t) {
3451
3487
  }
3452
3488
  //#endregion
3453
3489
  //#region ../core/src/rendering/webgl/marks/arrow.js
3454
- var kc = Math.PI / 180, Ac = 1e-6, jc = 1, Mc = 90, Nc = ["triangle", "open"], Pc = ["inside", "outside"], Fc = class extends Tc {
3490
+ var Pc = Math.PI / 180, Fc = 1e-6, Ic = 1, Lc = 90, Rc = ["triangle", "open"], zc = ["inside", "outside"], Bc = class extends Ac {
3455
3491
  getAttributes() {
3456
3492
  return [
3457
3493
  "uniqueId",
@@ -3474,15 +3510,15 @@ var kc = Math.PI / 180, Ac = 1e-6, jc = 1, Mc = 90, Nc = ["triangle", "open"], P
3474
3510
  ];
3475
3511
  }
3476
3512
  initializeGraphics() {
3477
- super.initializeGraphics(), this.createAndLinkShaders(nc, rc, [ic]);
3513
+ super.initializeGraphics(), this.createAndLinkShaders(ac, oc, [sc]);
3478
3514
  }
3479
3515
  finalizeGraphicsInitialization() {
3480
3516
  super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
3481
3517
  let e = this.properties;
3482
- this.registerMarkUniformValue("uHeadSlope", e.headAngle, Lc), this.registerMarkUniformValue("uHeadNotchSlope", e.headNotchAngle, Lc), this.registerMarkUniformValue("uHeadShape", e.headShape, (e) => Ic(Nc, e)), this.registerMarkUniformValue("uMinSize", e.minSize), this.registerMarkUniformValue("uHeadWidth", e.headWidth), this.registerMarkUniformValue("uStartNotch", e.startNotch), this.registerMarkUniformValue("uMinStemLength", e.minStemLength), this.registerMarkUniformValue("uHeadSpacing", e.headSpacing ?? -1, Rc), this.registerMarkUniformValue("uStem", e.stem), this.registerMarkUniformValue("uHeadPlacement", e.headPlacement, (e) => Ic(Pc, e));
3518
+ this.registerMarkUniformValue("uHeadSlope", e.headAngle, Hc), this.registerMarkUniformValue("uHeadNotchSlope", e.headNotchAngle, Hc), this.registerMarkUniformValue("uHeadShape", e.headShape, (e) => Vc(Rc, e)), this.registerMarkUniformValue("uMinSize", e.minSize), this.registerMarkUniformValue("uHeadWidth", e.headWidth), this.registerMarkUniformValue("uStartNotch", e.startNotch), this.registerMarkUniformValue("uMinStemLength", e.minStemLength), this.registerMarkUniformValue("uHeadSpacing", e.headSpacing ?? -1, Uc), this.registerMarkUniformValue("uStem", e.stem), this.registerMarkUniformValue("uHeadPlacement", e.headPlacement, (e) => Vc(zc, e));
3483
3519
  }
3484
3520
  updateGraphicsData(e) {
3485
- let t = e.getItemCount(), n = new fc({
3521
+ let t = e.getItemCount(), n = new hc({
3486
3522
  encoders: this.encoders,
3487
3523
  attributes: this.getAttributes(),
3488
3524
  numItems: t
@@ -3498,29 +3534,29 @@ var kc = Math.PI / 180, Ac = 1e-6, jc = 1, Mc = 90, Nc = ["triangle", "open"], P
3498
3534
  render(e) {
3499
3535
  let t = this.gl;
3500
3536
  return this.createRenderCallback((e, n) => {
3501
- ao(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e);
3537
+ oo(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e);
3502
3538
  }, e);
3503
3539
  }
3504
3540
  };
3505
- function Ic(e, t) {
3541
+ function Vc(e, t) {
3506
3542
  let n = e.indexOf(t);
3507
3543
  if (n < 0) throw Error(`Unsupported arrow mark value: ${t}`);
3508
3544
  return n;
3509
3545
  }
3510
- function Lc(e) {
3511
- return Math.max(Math.tan(Math.min(Math.max(e, jc), Mc) * kc), Ac);
3546
+ function Hc(e) {
3547
+ return Math.max(Math.tan(Math.min(Math.max(e, Ic), Lc) * Pc), Fc);
3512
3548
  }
3513
- function Rc(e) {
3549
+ function Uc(e) {
3514
3550
  return e ?? -1;
3515
3551
  }
3516
3552
  //#endregion
3517
3553
  //#region ../core/src/rendering/webgl/marks/link.vertex.glsl
3518
- var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\nflat out float vGamma;\n\n// Centerline distance from the rendered endpoint baseline; negative disables fading.\nout float vFadeDistance;\n\nconst int SHAPE_ARC = 0;\nconst int SHAPE_DOME = 1;\nconst int SHAPE_DIAGONAL = 2;\nconst int SHAPE_LINE = 3;\nconst int ORIENT_VERTICAL = 0;\nconst int ORIENT_HORIZONTAL = 1;\n\nfloat distanceFromLine(vec2 pointOnLine1, vec2 pointOnLine2, vec2 point) {\n vec2 a = point - pointOnLine1;\n vec2 b = pointOnLine2 - pointOnLine1;\n vec2 proj = dot(a, b) / dot(b, b) * b;\n return length(a - proj);\n}\n\nbool isInsideViewport(vec2 point, float marginFactor) {\n vec2 margin = uViewportSize * vec2(marginFactor);\n return point.x >= -margin.x\n && point.x <= uViewportSize.x + margin.x\n && point.y >= -margin.y\n && point.y <= uViewportSize.y + margin.y;\n}\n\nfloat inverseSmoothstep(float t) {\n t = clamp(t, 0.0, 1.0);\n // The chord-axis coordinate of ARC/DOME follows the smoothstep curve.\n return 0.5 - sin(asin(1.0 - 2.0 * t) / 3.0);\n}\n\n/**\n * Remaps the parameter t to concentrate vertices to the part that is visible in the viewport.\n * This keeps the tightly bent endpoints smooth even when zooming in very close.\n */\nfloat remapVisibleChordParameter(\n float stripT,\n float chordStart,\n float chordEnd,\n float viewportLength\n) {\n // Concentrate samples in the viewport-visible chord interval without dropping the rest.\n float chordMin = min(chordStart, chordEnd);\n float chordMax = max(chordStart, chordEnd);\n float chordSpan = chordMax - chordMin;\n\n if (chordSpan <= 0.0) {\n return 0.0;\n }\n\n float visibleChordMin = max(chordMin, 0.0);\n float visibleChordMax = min(chordMax, viewportLength);\n\n if (visibleChordMax <= visibleChordMin) {\n return stripT;\n }\n\n float visibleTMin = inverseSmoothstep((visibleChordMin - chordMin) / chordSpan);\n float visibleTMax = inverseSmoothstep((visibleChordMax - chordMin) / chordSpan);\n float visibleTSpan = visibleTMax - visibleTMin;\n float offscreenTSpan = visibleTMin + (1.0 - visibleTMax);\n\n if (offscreenTSpan <= 0.0) {\n return stripT;\n }\n\n float visibleShare = clamp(0.75 + (1.0 - visibleTSpan) * 0.2, 0.75, 0.95);\n float offscreenShare = 1.0 - visibleShare;\n float leftShare = offscreenShare * visibleTMin / offscreenTSpan;\n float rightShare = offscreenShare * (1.0 - visibleTMax) / offscreenTSpan;\n\n if (stripT <= leftShare) {\n return leftShare > 0.0 ? mix(0.0, visibleTMin, stripT / leftShare) : visibleTMin;\n }\n\n float visibleStart = leftShare;\n float visibleEnd = visibleStart + visibleShare;\n\n if (stripT <= visibleEnd) {\n return visibleShare > 0.0\n ? mix(visibleTMin, visibleTMax, (stripT - visibleStart) / visibleShare)\n : visibleTMin;\n }\n\n return rightShare > 0.0\n ? mix(visibleTMax, 1.0, (stripT - visibleEnd) / rightShare)\n : visibleTMax;\n}\n\nvoid clampChordToViewport(inout vec2 p1, inout vec2 p4, inout float chordLength) {\n if (chordLength > uMaxChordLength) {\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n\n if (isInsideViewport(p1, 2.0)) {\n chordLength = uMaxChordLength;\n p4 = p1 + unitChordVector * uMaxChordLength;\n } else if (isInsideViewport(p4, 2.0)) {\n chordLength = uMaxChordLength;\n p1 = p4 - unitChordVector * uMaxChordLength;\n }\n }\n}\n\nvoid clampDomeApex(inout vec2 p1, inout vec2 p4, int orient) {\n if (orient == ORIENT_VERTICAL) {\n if (p4.x > 0.0) {\n p1.x = max(p1.x, -p4.x);\n }\n if (p1.x < uViewportSize.x) {\n p4.x = min(p4.x, 2.0 * uViewportSize.x - p1.x);\n }\n } else {\n if (p4.y > 0.0) {\n p1.y = max(p1.y, -p4.y);\n }\n if (p1.y < uViewportSize.y) {\n p4.y = min(p4.y, 2.0 * uViewportSize.y - p1.y);\n }\n }\n}\n\nvoid main(void) {\n float pixelSize = 1.0 / uDevicePixelRatio;\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // The bezier's control points\n vec2 p1, p2, p3, p4;\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n ) * uViewportSize;\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n ) * uViewportSize;\n\n if (uShape <= SHAPE_DOME) {\n if (uShape == SHAPE_DOME) {\n vec2 height = vec2(0.0);\n if (uOrient == ORIENT_VERTICAL) {\n p1 = vec2(min(a.x, b.x), b.y);\n p4 = vec2(max(a.x, b.x), b.y);\n height = vec2(0.0, a.y - b.y);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_VERTICAL);\n }\n\n } else {\n p1 = vec2(b.x, min(a.y, b.y));\n p4 = vec2(b.x, max(a.y, b.y));\n height = vec2(a.x - b.x, 0.0);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_HORIZONTAL);\n }\n }\n\n vec2 controlOffset = height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n\n } if (uShape == SHAPE_ARC) {\n p1 = a;\n p4 = b;\n\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n vec2 chordNormal = vec2(-unitChordVector.y, unitChordVector.x);\n float chordLength = length(chordVector);\n clampChordToViewport(p1, p4, chordLength);\n\n float height = max(\n chordLength / 2.0 * uArcHeightFactor,\n uMinArcHeight\n );\n\n // This is a bit poor approximation of a circular arc, but it's probably enough for most purposes.\n // TODO: Consider a more sophisticated approach: https://stackoverflow.com/a/44829356/1547896\n vec2 controlOffset = chordNormal * height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n }\n\n } else if (uShape == SHAPE_DIAGONAL) {\n if (uOrient == ORIENT_VERTICAL) {\n p1 = a;\n p2 = vec2(a.x, (a.y + b.y) / 2.0);\n p3 = vec2(b.x, (a.y + b.y) / 2.0);\n p4 = b;\n } else {\n p1 = a;\n p2 = vec2((a.x + b.x) / 2.0, a.y);\n p3 = vec2((a.x + b.x) / 2.0, b.y);\n p4 = b;\n }\n } else if (uShape == SHAPE_LINE) {\n p1 = a;\n p2 = (a + b) / 2.0;\n p3 = p2;\n p4 = b;\n }\n\n vec2 strip = vec2(\n float(gl_VertexID / 2) / float(uSegmentBreaks),\n float(gl_VertexID % 2) - 0.5\n );\n\n float t = strip.x;\n\n if (uShape == SHAPE_DOME) {\n if (uOrient == ORIENT_VERTICAL) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n } else if (uShape == SHAPE_ARC) {\n if (a.y == b.y) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else if (a.x == b.x) {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n }\n\n vec2 p;\n vec2 tangent;\n\n // de Casteljau evaluation keeps the cubic stable for long chords.\n vec2 q1 = mix(p1, p2, t);\n vec2 q2 = mix(p2, p3, t);\n vec2 q3 = mix(p3, p4, t);\n\n vec2 r1 = mix(q1, q2, t);\n vec2 r2 = mix(q2, q3, t);\n\n p = mix(r1, r2, t);\n tangent = 3.0 * (r2 - r1);\n\n tangent = normalize(tangent);\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float size = getScaled_size();\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n // Handle minimum picking size or add an extra pixel to the stroke width to accommodate edge antialiasing\n float paddedSize = uPickingEnabled\n ? max(size, uMinPickingSize)\n : size + pixelSize;\n\n vNormalLengthInPixels = strip.y * paddedSize;\n \n vFadeDistance = -1.0;\n if ((uShape == SHAPE_ARC || uShape == SHAPE_DOME) &&\n uArcFadingDistance[0] > 0.0 &&\n uArcFadingDistance[1] > 0.0 &&\n (!uNoFadingOnPointSelection || !isDatumSelected()))\n {\n vFadeDistance = distanceFromLine(p1, p4, p);\n // Keep fully faded triangles collapsed to avoid fragment processing.\n if (1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance) <= 0.0) {\n vNormalLengthInPixels = 0.0;\n }\n }\n\n // Extrude\n p += normal * vNormalLengthInPixels;\n\n gl_Position = pixelsToNdc(p);\n\n vec3 color = getScaled_color();\n\n vColor = vec4(color * opacity, opacity);\n\n vGamma = getGammaForColor(color);\n\n vSize = paddedSize;\n\n setupPicking();\n}\n", Bc = "flat in vec4 vColor;\nflat in float vSize;\nin float vNormalLengthInPixels;\nflat in float vGamma;\nin float vFadeDistance;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distance = abs(vNormalLengthInPixels);\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), 0.0, 1.0);\n\n opacity = pow(opacity, vGamma);\n\n if (vFadeDistance >= 0.0) {\n opacity *= 1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance);\n }\n if (opacity <= 0.0) {\n discard;\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", Vc = "layout(std140) uniform Mark {\n uniform float uArcHeightFactor;\n\n /** Make very small arcs visible */\n uniform float uMinArcHeight;\n\n /** The minimum stroke width in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n uniform int uShape;\n uniform int uOrient;\n uniform bool uClampApex;\n\n // In pixels\n uniform float uMaxChordLength;\n // In pixels\n uniform vec2 uArcFadingDistance;\n uniform bool uNoFadingOnPointSelection;\n\n uniform int uSegmentBreaks;\n\n#pragma markUniforms\n};\n", Hc = [
3554
+ var Wc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\nflat out float vGamma;\n\n// Centerline distance from the rendered endpoint baseline; negative disables fading.\nout float vFadeDistance;\n\nconst int SHAPE_ARC = 0;\nconst int SHAPE_DOME = 1;\nconst int SHAPE_DIAGONAL = 2;\nconst int SHAPE_LINE = 3;\nconst int ORIENT_VERTICAL = 0;\nconst int ORIENT_HORIZONTAL = 1;\n\nfloat distanceFromLine(vec2 pointOnLine1, vec2 pointOnLine2, vec2 point) {\n vec2 a = point - pointOnLine1;\n vec2 b = pointOnLine2 - pointOnLine1;\n vec2 proj = dot(a, b) / dot(b, b) * b;\n return length(a - proj);\n}\n\nbool isInsideViewport(vec2 point, float marginFactor) {\n vec2 margin = uViewportSize * vec2(marginFactor);\n return point.x >= -margin.x\n && point.x <= uViewportSize.x + margin.x\n && point.y >= -margin.y\n && point.y <= uViewportSize.y + margin.y;\n}\n\nfloat inverseSmoothstep(float t) {\n t = clamp(t, 0.0, 1.0);\n // The chord-axis coordinate of ARC/DOME follows the smoothstep curve.\n return 0.5 - sin(asin(1.0 - 2.0 * t) / 3.0);\n}\n\n/**\n * Remaps the parameter t to concentrate vertices to the part that is visible in the viewport.\n * This keeps the tightly bent endpoints smooth even when zooming in very close.\n */\nfloat remapVisibleChordParameter(\n float stripT,\n float chordStart,\n float chordEnd,\n float viewportLength\n) {\n // Concentrate samples in the viewport-visible chord interval without dropping the rest.\n float chordMin = min(chordStart, chordEnd);\n float chordMax = max(chordStart, chordEnd);\n float chordSpan = chordMax - chordMin;\n\n if (chordSpan <= 0.0) {\n return 0.0;\n }\n\n float visibleChordMin = max(chordMin, 0.0);\n float visibleChordMax = min(chordMax, viewportLength);\n\n if (visibleChordMax <= visibleChordMin) {\n return stripT;\n }\n\n float visibleTMin = inverseSmoothstep((visibleChordMin - chordMin) / chordSpan);\n float visibleTMax = inverseSmoothstep((visibleChordMax - chordMin) / chordSpan);\n float visibleTSpan = visibleTMax - visibleTMin;\n float offscreenTSpan = visibleTMin + (1.0 - visibleTMax);\n\n if (offscreenTSpan <= 0.0) {\n return stripT;\n }\n\n float visibleShare = clamp(0.75 + (1.0 - visibleTSpan) * 0.2, 0.75, 0.95);\n float offscreenShare = 1.0 - visibleShare;\n float leftShare = offscreenShare * visibleTMin / offscreenTSpan;\n float rightShare = offscreenShare * (1.0 - visibleTMax) / offscreenTSpan;\n\n if (stripT <= leftShare) {\n return leftShare > 0.0 ? mix(0.0, visibleTMin, stripT / leftShare) : visibleTMin;\n }\n\n float visibleStart = leftShare;\n float visibleEnd = visibleStart + visibleShare;\n\n if (stripT <= visibleEnd) {\n return visibleShare > 0.0\n ? mix(visibleTMin, visibleTMax, (stripT - visibleStart) / visibleShare)\n : visibleTMin;\n }\n\n return rightShare > 0.0\n ? mix(visibleTMax, 1.0, (stripT - visibleEnd) / rightShare)\n : visibleTMax;\n}\n\nvoid clampChordToViewport(inout vec2 p1, inout vec2 p4, inout float chordLength) {\n if (chordLength > uMaxChordLength) {\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n\n if (isInsideViewport(p1, 2.0)) {\n chordLength = uMaxChordLength;\n p4 = p1 + unitChordVector * uMaxChordLength;\n } else if (isInsideViewport(p4, 2.0)) {\n chordLength = uMaxChordLength;\n p1 = p4 - unitChordVector * uMaxChordLength;\n }\n }\n}\n\nvoid clampDomeApex(inout vec2 p1, inout vec2 p4, int orient) {\n if (orient == ORIENT_VERTICAL) {\n if (p4.x > 0.0) {\n p1.x = max(p1.x, -p4.x);\n }\n if (p1.x < uViewportSize.x) {\n p4.x = min(p4.x, 2.0 * uViewportSize.x - p1.x);\n }\n } else {\n if (p4.y > 0.0) {\n p1.y = max(p1.y, -p4.y);\n }\n if (p1.y < uViewportSize.y) {\n p4.y = min(p4.y, 2.0 * uViewportSize.y - p1.y);\n }\n }\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n float pixelSize = 1.0 / uDevicePixelRatio;\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // The bezier's control points\n vec2 p1, p2, p3, p4;\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n ) * uViewportSize;\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n ) * uViewportSize;\n\n if (uShape <= SHAPE_DOME) {\n if (uShape == SHAPE_DOME) {\n vec2 height = vec2(0.0);\n if (uOrient == ORIENT_VERTICAL) {\n p1 = vec2(min(a.x, b.x), b.y);\n p4 = vec2(max(a.x, b.x), b.y);\n height = vec2(0.0, a.y - b.y);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_VERTICAL);\n }\n\n } else {\n p1 = vec2(b.x, min(a.y, b.y));\n p4 = vec2(b.x, max(a.y, b.y));\n height = vec2(a.x - b.x, 0.0);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_HORIZONTAL);\n }\n }\n\n vec2 controlOffset = height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n\n } if (uShape == SHAPE_ARC) {\n p1 = a;\n p4 = b;\n\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n vec2 chordNormal = vec2(-unitChordVector.y, unitChordVector.x);\n float chordLength = length(chordVector);\n clampChordToViewport(p1, p4, chordLength);\n\n float height = max(\n chordLength / 2.0 * uArcHeightFactor,\n uMinArcHeight\n );\n\n // This is a bit poor approximation of a circular arc, but it's probably enough for most purposes.\n // TODO: Consider a more sophisticated approach: https://stackoverflow.com/a/44829356/1547896\n vec2 controlOffset = chordNormal * height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n }\n\n } else if (uShape == SHAPE_DIAGONAL) {\n if (uOrient == ORIENT_VERTICAL) {\n p1 = a;\n p2 = vec2(a.x, (a.y + b.y) / 2.0);\n p3 = vec2(b.x, (a.y + b.y) / 2.0);\n p4 = b;\n } else {\n p1 = a;\n p2 = vec2((a.x + b.x) / 2.0, a.y);\n p3 = vec2((a.x + b.x) / 2.0, b.y);\n p4 = b;\n }\n } else if (uShape == SHAPE_LINE) {\n p1 = a;\n p2 = (a + b) / 2.0;\n p3 = p2;\n p4 = b;\n }\n\n vec2 strip = vec2(\n float(gl_VertexID / 2) / float(uSegmentBreaks),\n float(gl_VertexID % 2) - 0.5\n );\n\n float t = strip.x;\n\n if (uShape == SHAPE_DOME) {\n if (uOrient == ORIENT_VERTICAL) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n } else if (uShape == SHAPE_ARC) {\n if (a.y == b.y) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else if (a.x == b.x) {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n }\n\n vec2 p;\n vec2 tangent;\n\n // de Casteljau evaluation keeps the cubic stable for long chords.\n vec2 q1 = mix(p1, p2, t);\n vec2 q2 = mix(p2, p3, t);\n vec2 q3 = mix(p3, p4, t);\n\n vec2 r1 = mix(q1, q2, t);\n vec2 r2 = mix(q2, q3, t);\n\n p = mix(r1, r2, t);\n tangent = 3.0 * (r2 - r1);\n\n tangent = normalize(tangent);\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float size = getScaled_size();\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n // Handle minimum picking size or add an extra pixel to the stroke width to accommodate edge antialiasing\n float paddedSize = uPickingEnabled\n ? max(size, uMinPickingSize)\n : size + pixelSize;\n\n vNormalLengthInPixels = strip.y * paddedSize;\n \n vFadeDistance = -1.0;\n if ((uShape == SHAPE_ARC || uShape == SHAPE_DOME) &&\n uArcFadingDistance[0] > 0.0 &&\n uArcFadingDistance[1] > 0.0\n#ifdef CONDITIONAL_ORDER\n && (!uNoFadingOnSecondPass || (uOrderMode & 4) == 0)\n#endif\n )\n {\n vFadeDistance = distanceFromLine(p1, p4, p);\n // Keep fully faded triangles collapsed to avoid fragment processing.\n if (1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance) <= 0.0) {\n vNormalLengthInPixels = 0.0;\n }\n }\n\n // Extrude\n p += normal * vNormalLengthInPixels;\n\n gl_Position = pixelsToNdc(p);\n\n vec3 color = getScaled_color();\n\n vColor = vec4(color * opacity, opacity);\n\n vGamma = getGammaForColor(color);\n\n vSize = paddedSize;\n\n setupPicking();\n}\n", Gc = "flat in vec4 vColor;\nflat in float vSize;\nin float vNormalLengthInPixels;\nflat in float vGamma;\nin float vFadeDistance;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distance = abs(vNormalLengthInPixels);\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), 0.0, 1.0);\n\n opacity = pow(opacity, vGamma);\n\n if (vFadeDistance >= 0.0) {\n opacity *= 1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance);\n }\n if (opacity <= 0.0) {\n discard;\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", Kc = "layout(std140) uniform Mark {\n uniform float uArcHeightFactor;\n\n /** Make very small arcs visible */\n uniform float uMinArcHeight;\n\n /** The minimum stroke width in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n uniform int uShape;\n uniform int uOrient;\n uniform bool uClampApex;\n\n // In pixels\n uniform float uMaxChordLength;\n // In pixels\n uniform vec2 uArcFadingDistance;\n uniform bool uNoFadingOnSecondPass;\n\n uniform int uSegmentBreaks;\n\n#pragma markUniforms\n};\n", qc = [
3519
3555
  "arc",
3520
3556
  "dome",
3521
3557
  "diagonal",
3522
3558
  "line"
3523
- ], Uc = ["vertical", "horizontal"], Wc = class extends Tc {
3559
+ ], Jc = ["vertical", "horizontal"], Yc = class extends Ac {
3524
3560
  constructor(e, t, n) {
3525
3561
  super(e, t, n), this._baseInstanceExt = void 0;
3526
3562
  }
@@ -3542,15 +3578,15 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3542
3578
  ];
3543
3579
  }
3544
3580
  initializeGraphics() {
3545
- super.initializeGraphics(), this._baseInstanceExt = this.gl.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"), this.createAndLinkShaders(zc, Bc, [Vc]);
3581
+ super.initializeGraphics(), this._baseInstanceExt = this.gl.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"), this.createAndLinkShaders(Wc, Gc, [Kc]);
3546
3582
  }
3547
3583
  finalizeGraphicsInitialization() {
3548
3584
  super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
3549
3585
  let e = this.properties;
3550
- this.registerMarkUniformValue("uArcFadingDistance", e.arcFadingDistance, (e) => e || [0, 0]), this.registerMarkUniformValue("uArcHeightFactor", e.arcHeightFactor), this.registerMarkUniformValue("uMinArcHeight", e.minArcHeight), this.registerMarkUniformValue("uMinPickingSize", e.minPickingSize), this.registerMarkUniformValue("uShape", e.linkShape, (e) => Hc.indexOf(e)), this.registerMarkUniformValue("uOrient", e.orient, (e) => Uc.indexOf(e)), this.registerMarkUniformValue("uClampApex", e.clampApex, (e) => !!e), this.registerMarkUniformValue("uMaxChordLength", e.maxChordLength), this.registerMarkUniformValue("uSegmentBreaks", e.segments, (e) => e), this.registerMarkUniformValue("uNoFadingOnPointSelection", e.noFadingOnPointSelection, (e) => !!e);
3586
+ this.registerMarkUniformValue("uArcFadingDistance", e.arcFadingDistance, (e) => e || [0, 0]), this.registerMarkUniformValue("uArcHeightFactor", e.arcHeightFactor), this.registerMarkUniformValue("uMinArcHeight", e.minArcHeight), this.registerMarkUniformValue("uMinPickingSize", e.minPickingSize), this.registerMarkUniformValue("uShape", e.linkShape, (e) => qc.indexOf(e)), this.registerMarkUniformValue("uOrient", e.orient, (e) => Jc.indexOf(e)), this.registerMarkUniformValue("uClampApex", e.clampApex, (e) => !!e), this.registerMarkUniformValue("uMaxChordLength", e.maxChordLength), this.registerMarkUniformValue("uSegmentBreaks", e.segments, (e) => e), this.registerMarkUniformValue("uNoFadingOnSecondPass", e.noFadingOnSecondPass, (e) => !!e);
3551
3587
  }
3552
3588
  updateGraphicsData(e) {
3553
- let t = e.getItemCount(), n = new mc({
3589
+ let t = e.getItemCount(), n = new _c({
3554
3590
  encoders: this.encoders,
3555
3591
  attributes: this.getAttributes(),
3556
3592
  numItems: t
@@ -3578,7 +3614,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3578
3614
  Y(t, this.programInfo, this.bufferInfo), t.drawArraysInstanced(t.TRIANGLE_STRIP, 0, n(), r);
3579
3615
  }, e);
3580
3616
  }
3581
- }, Gc = "flat out float vRadius;\nflat out float vRadiusWithPadding;\nflat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out lowp float vShape;\nflat out lowp float vHalfStrokeWidth;\nflat out mat2 vRotationMatrix;\n\n// Copypaste from fragment shader\nconst float CIRCLE = 0.0;\nconst float SQUARE = 1.0;\nconst float CROSS = 2.0;\nconst float DIAMOND = 3.0;\nconst float TRIANGLE_UP = 4.0;\nconst float TRIANGLE_RIGHT = 5.0;\nconst float TRIANGLE_DOWN = 6.0;\nconst float TRIANGLE_LEFT = 7.0;\nconst float TICK_UP = 8.0;\nconst float TICK_RIGHT = 9.0;\nconst float TICK_DOWN = 10.0;\nconst float TICK_LEFT = 11.0;\nconst float X = 12.0;\nconst float PLUS = 13.0;\n\nfloat computeSemanticThresholdFactor() {\n // TODO: add smooth transition\n return getScaled_semanticScore() >= uSemanticThreshold ? 1.0 : 0.0;\n}\n\n// TODO: Move this into common.glsl or something\nvec2 getDxDy() {\n#if defined(dx_DEFINED) || defined(dy_DEFINED)\n return vec2(getScaled_dx(), getScaled_dy()) / uViewportSize;\n#else\n return vec2(0.0, 0.0);\n#endif\n}\n\nvoid main(void) {\n float shapeAngle = 0.0;\n\n // Selected points should always be visible\n float semanticThresholdFactor = isDatumSelected()\n ? 1.0\n : computeSemanticThresholdFactor();\n\n if (semanticThresholdFactor <= 0.0) {\n gl_PointSize = 0.0;\n // Place the vertex outside the viewport. The default (0, 0) makes this super-slow\n // on Apple Silicon. Probably related to the tile-based GPU architecture.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n // Exit early. MAY prevent some unnecessary calculations.\n return;\n }\n\n float size = getScaled_size();\n vec2 pos = vec2(getScaled_x(), getScaled_y()) + getDxDy();\n vec2 facetedPos = applyOffset(\n applySampleFacet(pos),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n\n#ifdef VISIBLE_RANGE_CULLING\n if (isOutsideVisibleRange(facetedPos)) {\n gl_PointSize = 0.0;\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n#endif\n\n gl_Position = unitToNdc(facetedPos);\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity();\n vShape = getScaled_shape();\n\n // Line-only shapes use their width even when the stroke falls back to the\n // fill color. An invisible stroke must not inset other filled shapes.\n if (strokeOpacity <= 0.0 && vShape != X && vShape != PLUS) {\n strokeWidth = 0.0;\n }\n\n float diameter = sqrt(size) *\n uScaleFactor *\n semanticThresholdFactor;\n\n // Clamp minimum size and adjust opacity instead. Yields more pleasing result,\n // no flickering etc.\n float opacity = uViewOpacity;\n if (strokeWidth <= 0.0 || uInwardStroke) {\n float minDiameter = 1.0 / uDevicePixelRatio;\n if (diameter < minDiameter) {\n // We do some \"cheap\" gamma correction here. It breaks on dark background, though.\n // First we take a square of the size and then apply \"gamma\" of 1.5.\n opacity *= pow(diameter / minDiameter, 2.5);\n diameter = minDiameter;\n }\n }\n\n float fillOpa = getScaled_fillOpacity() * opacity;\n float strokeOpa = strokeOpacity * opacity;\n\n // Circle doesn't have sharp corners. Do some special optimizations to minimize the point size.\n bool circle = vShape == 0.0;\n\n if (vShape > TICK_UP && vShape <= TICK_LEFT) {\n shapeAngle = (vShape - TICK_UP) * 90.0;\n vShape = TICK_UP;\n } else if (vShape > TRIANGLE_UP && vShape <= TRIANGLE_LEFT) {\n shapeAngle = (vShape - TRIANGLE_UP) * 90.0;\n vShape = TRIANGLE_UP;\n } else if (vShape == X) {\n // The x shape reuses the perpendicular stroke geometry of plus.\n shapeAngle = -45.0;\n }\n\n float angleInDegrees = getScaled_angle();\n float angle = -(shapeAngle + angleInDegrees) * PI / 180.0;\n float sinTheta = sin(angle);\n float cosTheta = cos(angle);\n vRotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\n // Not needed if we would draw rotated quads instead of gl.POINTS\n float roomForRotation = circle ? 1.0 : sin(mod(angle, PI / 2.0) + PI / 4.0) / sin(PI / 4.0);\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float rotationPadding = (diameter * roomForRotation) - diameter;\n // sqrt(3.0) ensures that the angles of equilateral triangles have enough room\n float strokePadding = uInwardStroke ? 0.0 : strokeWidth * (circle ? 1.0 : sqrt(3.0));\n float padding = rotationPadding + strokePadding + aaPadding;\n\n gl_PointSize = max(\n (diameter + padding),\n uPickingEnabled ? uMinPickingSize : 0.0\n ) * uDevicePixelRatio;\n\n vRadius = diameter / 2.0;\n vRadiusWithPadding = vRadius + padding / 2.0;\n\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n vFillColor = vec4(getScaled_fill() * fillOpa, fillOpa);\n vStrokeColor = vec4(getScaled_stroke() * strokeOpa, strokeOpa);\n\n setupPicking();\n}\n", Kc = "const lowp vec4 white = vec4(1.0);\nconst lowp vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n\nflat in float vRadius;\nflat in float vRadiusWithPadding;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in lowp float vShape;\nflat in lowp float vHalfStrokeWidth;\n\nflat in mat2 vRotationMatrix;\n\nout lowp vec4 fragColor;\n\n// Copypaste from vertex shader\nconst float CIRCLE = 0.0;\nconst float SQUARE = 1.0;\nconst float CROSS = 2.0;\nconst float DIAMOND = 3.0;\nconst float TRIANGLE_UP = 4.0;\nconst float TICK_UP = 8.0;\nconst float X = 12.0;\nconst float PLUS = 13.0;\n\n// The distance functions are inspired by:\n// http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n// However, these are not true distance functions, because the corners need to be sharp.\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat square(vec2 p, float r) {\n p = abs(p);\n return max(p.x, p.y) - r;\n}\n\nfloat tickUp(vec2 p, float r) {\n float halfR = r * 0.5;\n p.y += halfR;\n p = abs(p);\n return max(p.x - r * 0.15, p.y - halfR);\n}\n\nfloat equilateralTriangle(vec2 p, float r) {\n p.y = -p.y;\n float k = sqrt(3.0);\n float kr = k * r;\n p.y -= kr / 2.0;\n return max((abs(p.x) * k + p.y) / 2.0, -p.y - kr);\n}\n\nfloat crossShape(vec2 p, float r, float armHalfWidth) {\n p = abs(p);\n\n vec2 b = vec2(armHalfWidth, r);\n vec2 v = abs(p) - b.xy;\n vec2 h = abs(p) - b.yx;\n return min(max(v.x, v.y), max(h.x, h.y));\n}\n\nfloat diamond(vec2 p, float r) {\n p = abs(p);\n return (max(abs(p.x - p.y), abs(p.x + p.y)) - r) / sqrt(2.0);\n}\n\nvoid main() {\n float d;\n bool lineShape = false;\n\n /** Normalized point coord */\n vec2 p = vRotationMatrix * (2.0 * gl_PointCoord - 1.0) * vRadiusWithPadding;\n float r = vRadius;\n\n // We could also use textures here. Could even be faster, because we have plenty of branching here.\n if (vShape == CIRCLE) {\n d = circle(p, r);\n\n } else if (vShape == SQUARE) {\n d = square(p, r);\n\n } else if (vShape == CROSS) {\n d = crossShape(p, r, r * 0.4);\n\n } else if (vShape == DIAMOND) {\n d = diamond(p, r);\n\n } else if (vShape == TRIANGLE_UP) {\n d = equilateralTriangle(p, r);\n\n } else if (vShape == TICK_UP) {\n d = tickUp(p, r);\n\n } else if (vShape == X || vShape == PLUS) {\n float lineLength = vShape == X ? r * sqrt(2.0) : r;\n d = crossShape(p, lineLength, vHalfStrokeWidth);\n lineShape = true;\n\n } else {\n d = 0.0;\n }\n\n if (!uPickingEnabled) {\n lowp vec4 fillColor = lineShape\n ? (vStrokeColor.a > 0.0 ? vStrokeColor : vFillColor)\n : mix(vFillColor, white, -d * uGradientStrength / vRadius);\n\n fragColor = distanceToColor(\n d + (!lineShape && uInwardStroke ? vHalfStrokeWidth : 0.0),\n fillColor,\n vStrokeColor,\n vec4(0.0),\n lineShape ? 0.0 : vHalfStrokeWidth);\n\n } else if (d - (lineShape ? 0.0 : vHalfStrokeWidth) <= 0.0) {\n fragColor = vPickingColor;\n\n } else {\n discard;\n }\n}\n", qc = "layout(std140) uniform Mark {\n /**\n * The stroke should only grow inwards, e.g, the diameter/outline is not affected by the stroke width.\n * Thus, a point that has a zero size has no visible stroke. This allows strokes to be used with\n * geometric zoom, etc.\n */\n uniform bool uInwardStroke;\n\n /** The minimum point size in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n /** Scale factor for geometric zoom */\n uniform mediump float uScaleFactor;\n\n uniform mediump float uZoomLevel;\n uniform highp float uSemanticThreshold;\n\n uniform mediump float uGradientStrength;\n\n#pragma markUniforms\n};\n", Jc = class extends Tc {
3617
+ }, Xc = "flat out float vRadius;\nflat out float vRadiusWithPadding;\nflat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out lowp float vShape;\nflat out lowp float vHalfStrokeWidth;\nflat out mat2 vRotationMatrix;\n\n// Copypaste from fragment shader\nconst float CIRCLE = 0.0;\nconst float SQUARE = 1.0;\nconst float CROSS = 2.0;\nconst float DIAMOND = 3.0;\nconst float TRIANGLE_UP = 4.0;\nconst float TRIANGLE_RIGHT = 5.0;\nconst float TRIANGLE_DOWN = 6.0;\nconst float TRIANGLE_LEFT = 7.0;\nconst float TICK_UP = 8.0;\nconst float TICK_RIGHT = 9.0;\nconst float TICK_DOWN = 10.0;\nconst float TICK_LEFT = 11.0;\nconst float X = 12.0;\nconst float PLUS = 13.0;\n\nfloat computeSemanticThresholdFactor() {\n // TODO: add smooth transition\n return getScaled_semanticScore() >= uSemanticThreshold ? 1.0 : 0.0;\n}\n\n// TODO: Move this into common.glsl or something\nvec2 getDxDy() {\n#if defined(dx_DEFINED) || defined(dy_DEFINED)\n return vec2(getScaled_dx(), getScaled_dy()) / uViewportSize;\n#else\n return vec2(0.0, 0.0);\n#endif\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n float shapeAngle = 0.0;\n\n // Selected points should always be visible\n float semanticThresholdFactor = isDatumSelected()\n ? 1.0\n : computeSemanticThresholdFactor();\n\n if (semanticThresholdFactor <= 0.0) {\n gl_PointSize = 0.0;\n // Place the vertex outside the viewport. The default (0, 0) makes this super-slow\n // on Apple Silicon. Probably related to the tile-based GPU architecture.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n // Exit early. MAY prevent some unnecessary calculations.\n return;\n }\n\n float size = getScaled_size();\n vec2 pos = vec2(getScaled_x(), getScaled_y()) + getDxDy();\n vec2 facetedPos = applyOffset(\n applySampleFacet(pos),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n\n#ifdef VISIBLE_RANGE_CULLING\n if (isOutsideVisibleRange(facetedPos)) {\n gl_PointSize = 0.0;\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n#endif\n\n gl_Position = unitToNdc(facetedPos);\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity();\n vShape = getScaled_shape();\n\n // Line-only shapes use their width even when the stroke falls back to the\n // fill color. An invisible stroke must not inset other filled shapes.\n if (strokeOpacity <= 0.0 && vShape != X && vShape != PLUS) {\n strokeWidth = 0.0;\n }\n\n float diameter = sqrt(size) *\n uScaleFactor *\n semanticThresholdFactor;\n\n // Clamp minimum size and adjust opacity instead. Yields more pleasing result,\n // no flickering etc.\n float opacity = uViewOpacity;\n if (strokeWidth <= 0.0 || uInwardStroke) {\n float minDiameter = 1.0 / uDevicePixelRatio;\n if (diameter < minDiameter) {\n // We do some \"cheap\" gamma correction here. It breaks on dark background, though.\n // First we take a square of the size and then apply \"gamma\" of 1.5.\n opacity *= pow(diameter / minDiameter, 2.5);\n diameter = minDiameter;\n }\n }\n\n float fillOpa = getScaled_fillOpacity() * opacity;\n float strokeOpa = strokeOpacity * opacity;\n\n // Circle doesn't have sharp corners. Do some special optimizations to minimize the point size.\n bool circle = vShape == 0.0;\n\n if (vShape > TICK_UP && vShape <= TICK_LEFT) {\n shapeAngle = (vShape - TICK_UP) * 90.0;\n vShape = TICK_UP;\n } else if (vShape > TRIANGLE_UP && vShape <= TRIANGLE_LEFT) {\n shapeAngle = (vShape - TRIANGLE_UP) * 90.0;\n vShape = TRIANGLE_UP;\n } else if (vShape == X) {\n // The x shape reuses the perpendicular stroke geometry of plus.\n shapeAngle = -45.0;\n }\n\n float angleInDegrees = getScaled_angle();\n float angle = -(shapeAngle + angleInDegrees) * PI / 180.0;\n float sinTheta = sin(angle);\n float cosTheta = cos(angle);\n vRotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\n // Not needed if we would draw rotated quads instead of gl.POINTS\n float roomForRotation = circle ? 1.0 : sin(mod(angle, PI / 2.0) + PI / 4.0) / sin(PI / 4.0);\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float rotationPadding = (diameter * roomForRotation) - diameter;\n // sqrt(3.0) ensures that the angles of equilateral triangles have enough room\n float strokePadding = uInwardStroke ? 0.0 : strokeWidth * (circle ? 1.0 : sqrt(3.0));\n float padding = rotationPadding + strokePadding + aaPadding;\n\n gl_PointSize = max(\n (diameter + padding),\n uPickingEnabled ? uMinPickingSize : 0.0\n ) * uDevicePixelRatio;\n\n vRadius = diameter / 2.0;\n vRadiusWithPadding = vRadius + padding / 2.0;\n\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n vFillColor = vec4(getScaled_fill() * fillOpa, fillOpa);\n vStrokeColor = vec4(getScaled_stroke() * strokeOpa, strokeOpa);\n\n setupPicking();\n}\n", Zc = "const lowp vec4 white = vec4(1.0);\nconst lowp vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n\nflat in float vRadius;\nflat in float vRadiusWithPadding;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in lowp float vShape;\nflat in lowp float vHalfStrokeWidth;\n\nflat in mat2 vRotationMatrix;\n\nout lowp vec4 fragColor;\n\n// Copypaste from vertex shader\nconst float CIRCLE = 0.0;\nconst float SQUARE = 1.0;\nconst float CROSS = 2.0;\nconst float DIAMOND = 3.0;\nconst float TRIANGLE_UP = 4.0;\nconst float TICK_UP = 8.0;\nconst float X = 12.0;\nconst float PLUS = 13.0;\n\n// The distance functions are inspired by:\n// http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n// However, these are not true distance functions, because the corners need to be sharp.\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat square(vec2 p, float r) {\n p = abs(p);\n return max(p.x, p.y) - r;\n}\n\nfloat tickUp(vec2 p, float r) {\n float halfR = r * 0.5;\n p.y += halfR;\n p = abs(p);\n return max(p.x - r * 0.15, p.y - halfR);\n}\n\nfloat equilateralTriangle(vec2 p, float r) {\n p.y = -p.y;\n float k = sqrt(3.0);\n float kr = k * r;\n p.y -= kr / 2.0;\n return max((abs(p.x) * k + p.y) / 2.0, -p.y - kr);\n}\n\nfloat crossShape(vec2 p, float r, float armHalfWidth) {\n p = abs(p);\n\n vec2 b = vec2(armHalfWidth, r);\n vec2 v = abs(p) - b.xy;\n vec2 h = abs(p) - b.yx;\n return min(max(v.x, v.y), max(h.x, h.y));\n}\n\nfloat diamond(vec2 p, float r) {\n p = abs(p);\n return (max(abs(p.x - p.y), abs(p.x + p.y)) - r) / sqrt(2.0);\n}\n\nvoid main() {\n float d;\n bool lineShape = false;\n\n /** Normalized point coord */\n vec2 p = vRotationMatrix * (2.0 * gl_PointCoord - 1.0) * vRadiusWithPadding;\n float r = vRadius;\n\n // We could also use textures here. Could even be faster, because we have plenty of branching here.\n if (vShape == CIRCLE) {\n d = circle(p, r);\n\n } else if (vShape == SQUARE) {\n d = square(p, r);\n\n } else if (vShape == CROSS) {\n d = crossShape(p, r, r * 0.4);\n\n } else if (vShape == DIAMOND) {\n d = diamond(p, r);\n\n } else if (vShape == TRIANGLE_UP) {\n d = equilateralTriangle(p, r);\n\n } else if (vShape == TICK_UP) {\n d = tickUp(p, r);\n\n } else if (vShape == X || vShape == PLUS) {\n float lineLength = vShape == X ? r * sqrt(2.0) : r;\n d = crossShape(p, lineLength, vHalfStrokeWidth);\n lineShape = true;\n\n } else {\n d = 0.0;\n }\n\n if (!uPickingEnabled) {\n lowp vec4 fillColor = lineShape\n ? (vStrokeColor.a > 0.0 ? vStrokeColor : vFillColor)\n : mix(vFillColor, white, -d * uGradientStrength / vRadius);\n\n fragColor = distanceToColor(\n d + (!lineShape && uInwardStroke ? vHalfStrokeWidth : 0.0),\n fillColor,\n vStrokeColor,\n vec4(0.0),\n lineShape ? 0.0 : vHalfStrokeWidth);\n\n } else if (d - (lineShape ? 0.0 : vHalfStrokeWidth) <= 0.0) {\n fragColor = vPickingColor;\n\n } else {\n discard;\n }\n}\n", Qc = "layout(std140) uniform Mark {\n /**\n * The stroke should only grow inwards, e.g, the diameter/outline is not affected by the stroke width.\n * Thus, a point that has a zero size has no visible stroke. This allows strokes to be used with\n * geometric zoom, etc.\n */\n uniform bool uInwardStroke;\n\n /** The minimum point size in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n /** Scale factor for geometric zoom */\n uniform mediump float uScaleFactor;\n\n uniform mediump float uZoomLevel;\n uniform highp float uSemanticThreshold;\n\n uniform mediump float uGradientStrength;\n\n#pragma markUniforms\n};\n", $c = class extends Ac {
3582
3618
  getAttributes() {
3583
3619
  return [
3584
3620
  "uniqueId",
@@ -3601,7 +3637,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3601
3637
  ];
3602
3638
  }
3603
3639
  initializeGraphics() {
3604
- super.initializeGraphics(), this.createAndLinkShaders(Gc, Kc, [qc]);
3640
+ super.initializeGraphics(), this.createAndLinkShaders(Xc, Zc, [Qc]);
3605
3641
  }
3606
3642
  finalizeGraphicsInitialization() {
3607
3643
  super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
@@ -3609,7 +3645,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3609
3645
  this.registerMarkUniformValue("uInwardStroke", e.inwardStroke, (e) => !!e), this.registerMarkUniformValue("uGradientStrength", e.fillGradientStrength), this.registerMarkUniformValue("uMinPickingSize", e.minPickingSize);
3610
3646
  }
3611
3647
  updateGraphicsData(e) {
3612
- let t = e.getItemCount(), n = new pc({
3648
+ let t = e.getItemCount(), n = new gc({
3613
3649
  encoders: this.encoders,
3614
3650
  attributes: this.getAttributes(),
3615
3651
  numItems: t
@@ -3625,7 +3661,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3625
3661
  prepareRender(e) {
3626
3662
  let t = super.prepareRender(e);
3627
3663
  return t.push(() => {
3628
- Qa(this.markUniformInfo, {
3664
+ $a(this.markUniformInfo, {
3629
3665
  uScaleFactor: this.#e(),
3630
3666
  uSemanticThreshold: this.mark.getSemanticThreshold()
3631
3667
  }), this.markUniformsAltered = !0;
@@ -3634,10 +3670,10 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3634
3670
  render(e) {
3635
3671
  let t = this.gl;
3636
3672
  return this.createRenderCallback((e, n) => {
3637
- n && ao(t, this.vertexArrayInfo, t.POINTS, n, e);
3673
+ n && oo(t, this.vertexArrayInfo, t.POINTS, n, e);
3638
3674
  }, e);
3639
3675
  }
3640
- }, Yc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out vec4 vCornerRadii;\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n/** Position for SDF-strokes */\nout vec2 vPosInPixels;\n#endif\n\n/** Size of the rect in pixels */\nflat out vec2 vHalfSizeInPixels;\n\n/**\n * Adjusts the vertex position to ensure that the rectangle is at least `minSpan`\n * wide or high. Returns a value that reflects the amount of clamping and can be\n * used to adjust the opacity of the rectangle.\n *\n * pos: vertex position\n * frac: vertex position within the rectangle, [0, 1]\n * size: width or height of the rectangle\n * minSize: minimum width or height of the rectangle\n */\nfloat clampMinSize(inout float pos, float frac, float size, float minSize) {\n if (minSize > 0.0 && size < minSize) {\n pos += (frac - 0.5) * (minSize - size);\n return size / minSize;\n }\n\n return 1.0;\n}\n\nvoid sort(inout float a, inout float b) {\n if (a > b) {\n float tmp = b;\n b = a;\n a = tmp;\n }\n}\n\n/**\n * The vertex position wrt the rectangle specified by (x, x2, y, y2).\n * [0, 0] = [x, y], [1, 1] = [x2, y2]. \n * The x or y component may contain fractional values if the rectangle \n * have been tessellated.\n */\nvec2 getVertexPos() {\n int index = gl_VertexID % 6;\n return vec2(\n index == 0 || index == 1 || index == 3 ? 0.0 : 1.0,\n index == 0 || index == 1 || index == 2 ? 0.0 : 1.0\n );\n \n}\n\nvoid main(void) {\n vec2 frac = getVertexPos();\n\n vec2 normalizedMinSize = vec2(uMinWidth, uMinHeight) / uViewportSize;\n vec4 cornerRadii = vec4(\n uCornerRadiusTopRight,\n uCornerRadiusBottomRight,\n uCornerRadiusTopLeft,\n uCornerRadiusBottomLeft\n );\n\n SampleFacetPosition sampleFacetPos = getSampleFacetPos();\n if (sampleFacetPos.height == 0.0) {\n // Filtered samples have no facet height. Cull them before minimum-size\n // clamping can expand their rectangles at the viewport boundary.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n\n vec2 pos1 = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n sort(pos1.x, pos2.x);\n sort(pos1.y, pos2.y);\n\n // Clamp x to prevent precision artifacts when the scale is zoomed very close.\n // TODO: clamp y as well\n float clampMargin = 1.0;\n pos1.x = clamp(pos1.x, 0.0 - clampMargin, 1.0 + clampMargin);\n pos2.x = clamp(pos2.x, 0.0 - clampMargin, 1.0 + clampMargin);\n\n vec2 size = pos2 - pos1;\n\n if (size.x < 0.0 || size.y < 0.0) {\n // Keep zero-sized rects alive so min-size clamping can stabilize them.\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n vec2 pos = pos1 + frac * size;\n\n // Clamp to minimum size, optionally compensate with opacity\n float opaFactor = uViewOpacity * max(uMinOpacity,\n clampMinSize(pos.x, frac.x, size.x, normalizedMinSize.x) *\n clampMinSize(pos.y, frac.y, size.y, normalizedMinSize.y));\n\n size = max(size, normalizedMinSize);\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n // Add an extra pixel to the stroke width to accommodate edge antialiasing\n float aaPadding = 1.0 / uDevicePixelRatio;\n\n // TODO: Only expand to the offset direction. Now high offsets result in\n // a large expansion in all directions.\n float shadowPadding = uShadowBlur + max(abs(uShadowOffsetX), abs(uShadowOffsetY));\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * opaFactor;\n\n vec2 centeredFrac = frac - 0.5;\n vec2 expand = centeredFrac * (strokeWidth + aaPadding + shadowPadding * 2.0) / uViewportSize;\n pos += expand;\n\n vec2 sizeInPixels = size * uViewportSize;\n vPosInPixels = (centeredFrac + expand / size) * sizeInPixels;\n\n vHalfSizeInPixels = sizeInPixels / 2.0;\n\n vCornerRadii = min(cornerRadii, min(vHalfSizeInPixels.x, vHalfSizeInPixels.y));\n vHalfStrokeWidth = strokeWidth / 2.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n#endif\n\n gl_Position = unitToNdc(pos);\n\n float fillOpacity = getScaled_fillOpacity() * opaFactor;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", Xc = "#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\nin vec2 vPosInPixels;\n#endif\n\nflat in vec2 vHalfSizeInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in vec4 vCornerRadii;\n\nout lowp vec4 fragColor;\n\n// ----------------------------------------------------------------------------\n// Shadow source: https://madebyevan.com/shaders/fast-rounded-rectangle-shadows/\n// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)\n\n#ifdef SHADOW\n\n// A standard gaussian function, used for weighting samples\nfloat gaussian(float x, float sigma) {\n const float pi = 3.141592653589793;\n return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma);\n}\n\n// This approximates the error function, needed for the gaussian integral\nvec2 erf(vec2 x) {\n vec2 s = sign(x), a = abs(x);\n x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a;\n x *= x;\n return s - s / (x * x);\n}\n\n// Return the blurred mask along the x dimension\nfloat roundedBoxShadowX(float x, float y, float sigma, float corner, vec2 halfSize) {\n float delta = min(halfSize.y - corner - abs(y), 0.0);\n float curved = halfSize.x - corner + sqrt(max(0.0, corner * corner - delta * delta));\n vec2 integral = 0.5 + 0.5 * erf((x + vec2(-curved, curved)) * (sqrt(0.5) / sigma));\n return integral.y - integral.x;\n}\n\n// Return the mask for the shadow of a box from lower to upper\nfloat roundedBoxShadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) {\n // Center everything to make the math easier\n vec2 center = (lower + upper) * 0.5;\n vec2 halfSize = (upper - lower) * 0.5;\n point -= center;\n\n // The signal is only non-zero in a limited range, so don't waste samples\n float low = point.y - halfSize.y;\n float high = point.y + halfSize.y;\n float start = clamp(-3.0 * sigma, low, high);\n float end = clamp(3.0 * sigma, low, high);\n\n // Accumulate samples (we can get away with surprisingly few samples)\n float step = (end - start) / 4.0;\n float y = start + step * 0.5;\n float value = 0.0;\n for (int i = 0; i < 4; i++) {\n value += roundedBoxShadowX(point.x, point.y - y, sigma, corner, halfSize) * gaussian(y, sigma) * step;\n y += step;\n }\n\n return value;\n}\n\n// ----------------------------------------------------------------------------\n\n#endif\n\n// Source: https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\nfloat sdRoundedBox(vec2 p, vec2 b, vec4 r) {\n r.xy = p.x > 0.0 ? r.xy : r.zw;\n r.x = p.y > 0.0 ? r.x : r.y;\n vec2 q = abs(p) - b + r.x;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\n// Not a true SDF. Makes the corners of strokes sharp and is faster.\nfloat sdSharpBox(vec2 p, vec2 b) {\n vec2 q = abs(p) - b;\n return max(q.x, q.y);\n}\n\nfloat diagonalPattern(vec2 uv, float spacing) {\n // Using 1.5 to approximate sqrt(2.0) to reduce aliasing artifacts.\n float divisor = spacing * vHalfStrokeWidth * 2.0 * 1.5;\n return abs(mod(uv.x - uv.y, divisor) - 0.5 * divisor) / 1.5;\n}\n\nfloat verticalPattern(float x, float spacing) {\n float divisor = spacing * vHalfStrokeWidth * 2.0;\n return abs(mod(x, divisor)) / 2.0;\n}\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat masonryCirclePattern(vec2 uv, float spacing, float radius) {\n float halfSpacing = 0.5 * spacing;\n\n float row = floor(uv.y / spacing);\n float shift = mod(row, 2.0) * halfSpacing;\n\n vec2 shifted = vec2(uv.x + shift, uv.y + halfSpacing);\n vec2 cell = mod(shifted + 0.5 * spacing, spacing) - halfSpacing;\n\n return abs(circle(cell, radius));\n}\n\n/**\n * Patterns:\n * 0 none\n * 1 diagonal (/)\n * 2 antiDiagonal (\\)\n * 3 cross (X)\n * 4 vertical (|)\n * 5 horizontal (-)\n * 6 grid (+)\n * 7 dots (.)\n * 8 rings (o)\n * 9 ringsLarge (O)\n */\nfloat pattern() {\n#ifdef STROKED\n int patternType = uHatchPattern;\n vec2 uv = vPosInPixels;\n float spacing = 4.0;\n\n switch (patternType) {\n case 1:\n return diagonalPattern(vec2(uv.x, -uv.y), spacing);\n case 2:\n return diagonalPattern(uv, spacing);\n case 3:\n return min(\n diagonalPattern(uv, spacing),\n diagonalPattern(vec2(uv.x, -uv.y), spacing)\n );\n case 4:\n return verticalPattern(uv.x, spacing);\n case 5:\n return verticalPattern(uv.y, spacing);\n case 6:\n return min(\n verticalPattern(uv.x, spacing),\n verticalPattern(uv.y, spacing)\n );\n case 7:\n case 8:\n case 9: {\n float spacing = vHalfStrokeWidth * 14.0;\n float radius = spacing * (\n patternType == 8 ? 0.2 :\n patternType == 9 ? 0.35 :\n 0.07\n );\n return masonryCirclePattern(uv, spacing, radius);\n }\n default:\n break;\n }\n#endif\n return 1.0 / 0.0; // Infinity\n}\n\nvoid main(void) {\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n#ifdef ROUNDED_CORNERS\n // Distance from rectangle's edge in pixels. Negative inside the rectangle.\n float d = sdRoundedBox(vPosInPixels, vHalfSizeInPixels, vCornerRadii);\n#else\n float d = sdSharpBox(vPosInPixels, vHalfSizeInPixels);\n#endif\n\n vec4 backgroundColor = vec4(0.0, 0.0, 0.0, 0.0);\n\n#ifdef SHADOW\n float maxCornerRadius = max(vCornerRadii.x, max(vCornerRadii.y, max(vCornerRadii.z, vCornerRadii.w)));\n\n float shadow = 0.0;\n // Only calculate shadow for the region outside the stroke.\n if (d >= vHalfStrokeWidth - 1.0 && uShadowOpacity > 0.0) {\n shadow = roundedBoxShadow(\n -vHalfSizeInPixels - vHalfStrokeWidth,\n vHalfSizeInPixels + vHalfStrokeWidth,\n vPosInPixels - vec2(uShadowOffsetX, -uShadowOffsetY),\n max(uShadowBlur / 2.5, 0.25),\n maxCornerRadius + vHalfStrokeWidth\n ) * uShadowOpacity * uViewOpacity;\n }\n backgroundColor = vec4(uShadowColor * shadow, shadow);\n#endif\n\n if (vHalfStrokeWidth > 0.0 && uHatchPattern > 0) {\n d = max(d, -pattern());\n }\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n backgroundColor,\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n#else\n // The trivial, non-decorated case\n fragColor = vFillColor;\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n#endif\n}\n", Zc = "layout(std140) uniform Mark {\n /** Minimum size (width, height) of the displayed rectangle in pixels */\n uniform float uMinWidth;\n uniform float uMinHeight;\n\n /** Minimum opacity for the size clamping */\n uniform float uMinOpacity;\n\n uniform float uCornerRadiusTopRight;\n uniform float uCornerRadiusBottomRight;\n uniform float uCornerRadiusTopLeft;\n uniform float uCornerRadiusBottomLeft;\n\n uniform int uHatchPattern;\n\n uniform vec3 uShadowColor;\n uniform float uShadowOpacity;\n uniform float uShadowBlur;\n uniform float uShadowOffsetX;\n uniform float uShadowOffsetY;\n\n#pragma markUniforms\n};\n", Qc = [
3676
+ }, el = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out vec4 vCornerRadii;\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n/** Position for SDF-strokes */\nout vec2 vPosInPixels;\n#endif\n\n/** Size of the rect in pixels */\nflat out vec2 vHalfSizeInPixels;\n\n/**\n * Adjusts the vertex position to ensure that the rectangle is at least `minSpan`\n * wide or high. Returns a value that reflects the amount of clamping and can be\n * used to adjust the opacity of the rectangle.\n *\n * pos: vertex position\n * frac: vertex position within the rectangle, [0, 1]\n * size: width or height of the rectangle\n * minSize: minimum width or height of the rectangle\n */\nfloat clampMinSize(inout float pos, float frac, float size, float minSize) {\n if (minSize > 0.0 && size < minSize) {\n pos += (frac - 0.5) * (minSize - size);\n return size / minSize;\n }\n\n return 1.0;\n}\n\nvoid sort(inout float a, inout float b) {\n if (a > b) {\n float tmp = b;\n b = a;\n a = tmp;\n }\n}\n\n/**\n * The vertex position wrt the rectangle specified by (x, x2, y, y2).\n * [0, 0] = [x, y], [1, 1] = [x2, y2]. \n * The x or y component may contain fractional values if the rectangle \n * have been tessellated.\n */\nvec2 getVertexPos() {\n int index = gl_VertexID % 6;\n return vec2(\n index == 0 || index == 1 || index == 3 ? 0.0 : 1.0,\n index == 0 || index == 1 || index == 2 ? 0.0 : 1.0\n );\n \n}\n\nvoid main(void) {\n#pragma orderGuard\n\n vec2 frac = getVertexPos();\n\n vec2 normalizedMinSize = vec2(uMinWidth, uMinHeight) / uViewportSize;\n vec4 cornerRadii = vec4(\n uCornerRadiusTopRight,\n uCornerRadiusBottomRight,\n uCornerRadiusTopLeft,\n uCornerRadiusBottomLeft\n );\n\n SampleFacetPosition sampleFacetPos = getSampleFacetPos();\n if (sampleFacetPos.height == 0.0) {\n // Filtered samples have no facet height. Cull them before minimum-size\n // clamping can expand their rectangles at the viewport boundary.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n\n vec2 pos1 = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n sort(pos1.x, pos2.x);\n sort(pos1.y, pos2.y);\n\n // Clamp x to prevent precision artifacts when the scale is zoomed very close.\n // TODO: clamp y as well\n float clampMargin = 1.0;\n pos1.x = clamp(pos1.x, 0.0 - clampMargin, 1.0 + clampMargin);\n pos2.x = clamp(pos2.x, 0.0 - clampMargin, 1.0 + clampMargin);\n\n vec2 size = pos2 - pos1;\n\n if (size.x < 0.0 || size.y < 0.0) {\n // Keep zero-sized rects alive so min-size clamping can stabilize them.\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n vec2 pos = pos1 + frac * size;\n\n // Clamp to minimum size, optionally compensate with opacity\n float opaFactor = uViewOpacity * max(uMinOpacity,\n clampMinSize(pos.x, frac.x, size.x, normalizedMinSize.x) *\n clampMinSize(pos.y, frac.y, size.y, normalizedMinSize.y));\n\n size = max(size, normalizedMinSize);\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n // Add an extra pixel to the stroke width to accommodate edge antialiasing\n float aaPadding = 1.0 / uDevicePixelRatio;\n\n // TODO: Only expand to the offset direction. Now high offsets result in\n // a large expansion in all directions.\n float shadowPadding = uShadowBlur + max(abs(uShadowOffsetX), abs(uShadowOffsetY));\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * opaFactor;\n\n vec2 centeredFrac = frac - 0.5;\n vec2 expand = centeredFrac * (strokeWidth + aaPadding + shadowPadding * 2.0) / uViewportSize;\n pos += expand;\n\n vec2 sizeInPixels = size * uViewportSize;\n vPosInPixels = (centeredFrac + expand / size) * sizeInPixels;\n\n vHalfSizeInPixels = sizeInPixels / 2.0;\n\n vCornerRadii = min(cornerRadii, min(vHalfSizeInPixels.x, vHalfSizeInPixels.y));\n vHalfStrokeWidth = strokeWidth / 2.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n#endif\n\n gl_Position = unitToNdc(pos);\n\n float fillOpacity = getScaled_fillOpacity() * opaFactor;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", tl = "#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\nin vec2 vPosInPixels;\n#endif\n\nflat in vec2 vHalfSizeInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in vec4 vCornerRadii;\n\nout lowp vec4 fragColor;\n\n// ----------------------------------------------------------------------------\n// Shadow source: https://madebyevan.com/shaders/fast-rounded-rectangle-shadows/\n// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)\n\n#ifdef SHADOW\n\n// A standard gaussian function, used for weighting samples\nfloat gaussian(float x, float sigma) {\n const float pi = 3.141592653589793;\n return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma);\n}\n\n// This approximates the error function, needed for the gaussian integral\nvec2 erf(vec2 x) {\n vec2 s = sign(x), a = abs(x);\n x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a;\n x *= x;\n return s - s / (x * x);\n}\n\n// Return the blurred mask along the x dimension\nfloat roundedBoxShadowX(float x, float y, float sigma, float corner, vec2 halfSize) {\n float delta = min(halfSize.y - corner - abs(y), 0.0);\n float curved = halfSize.x - corner + sqrt(max(0.0, corner * corner - delta * delta));\n vec2 integral = 0.5 + 0.5 * erf((x + vec2(-curved, curved)) * (sqrt(0.5) / sigma));\n return integral.y - integral.x;\n}\n\n// Return the mask for the shadow of a box from lower to upper\nfloat roundedBoxShadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) {\n // Center everything to make the math easier\n vec2 center = (lower + upper) * 0.5;\n vec2 halfSize = (upper - lower) * 0.5;\n point -= center;\n\n // The signal is only non-zero in a limited range, so don't waste samples\n float low = point.y - halfSize.y;\n float high = point.y + halfSize.y;\n float start = clamp(-3.0 * sigma, low, high);\n float end = clamp(3.0 * sigma, low, high);\n\n // Accumulate samples (we can get away with surprisingly few samples)\n float step = (end - start) / 4.0;\n float y = start + step * 0.5;\n float value = 0.0;\n for (int i = 0; i < 4; i++) {\n value += roundedBoxShadowX(point.x, point.y - y, sigma, corner, halfSize) * gaussian(y, sigma) * step;\n y += step;\n }\n\n return value;\n}\n\n// ----------------------------------------------------------------------------\n\n#endif\n\n// Source: https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\nfloat sdRoundedBox(vec2 p, vec2 b, vec4 r) {\n r.xy = p.x > 0.0 ? r.xy : r.zw;\n r.x = p.y > 0.0 ? r.x : r.y;\n vec2 q = abs(p) - b + r.x;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\n// Not a true SDF. Makes the corners of strokes sharp and is faster.\nfloat sdSharpBox(vec2 p, vec2 b) {\n vec2 q = abs(p) - b;\n return max(q.x, q.y);\n}\n\nfloat diagonalPattern(vec2 uv, float spacing) {\n // Using 1.5 to approximate sqrt(2.0) to reduce aliasing artifacts.\n float divisor = spacing * vHalfStrokeWidth * 2.0 * 1.5;\n return abs(mod(uv.x - uv.y, divisor) - 0.5 * divisor) / 1.5;\n}\n\nfloat verticalPattern(float x, float spacing) {\n float divisor = spacing * vHalfStrokeWidth * 2.0;\n return abs(mod(x, divisor)) / 2.0;\n}\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat masonryCirclePattern(vec2 uv, float spacing, float radius) {\n float halfSpacing = 0.5 * spacing;\n\n float row = floor(uv.y / spacing);\n float shift = mod(row, 2.0) * halfSpacing;\n\n vec2 shifted = vec2(uv.x + shift, uv.y + halfSpacing);\n vec2 cell = mod(shifted + 0.5 * spacing, spacing) - halfSpacing;\n\n return abs(circle(cell, radius));\n}\n\n/**\n * Patterns:\n * 0 none\n * 1 diagonal (/)\n * 2 antiDiagonal (\\)\n * 3 cross (X)\n * 4 vertical (|)\n * 5 horizontal (-)\n * 6 grid (+)\n * 7 dots (.)\n * 8 rings (o)\n * 9 ringsLarge (O)\n */\nfloat pattern() {\n#ifdef STROKED\n int patternType = uHatchPattern;\n vec2 uv = vPosInPixels;\n float spacing = 4.0;\n\n switch (patternType) {\n case 1:\n return diagonalPattern(vec2(uv.x, -uv.y), spacing);\n case 2:\n return diagonalPattern(uv, spacing);\n case 3:\n return min(\n diagonalPattern(uv, spacing),\n diagonalPattern(vec2(uv.x, -uv.y), spacing)\n );\n case 4:\n return verticalPattern(uv.x, spacing);\n case 5:\n return verticalPattern(uv.y, spacing);\n case 6:\n return min(\n verticalPattern(uv.x, spacing),\n verticalPattern(uv.y, spacing)\n );\n case 7:\n case 8:\n case 9: {\n float spacing = vHalfStrokeWidth * 14.0;\n float radius = spacing * (\n patternType == 8 ? 0.2 :\n patternType == 9 ? 0.35 :\n 0.07\n );\n return masonryCirclePattern(uv, spacing, radius);\n }\n default:\n break;\n }\n#endif\n return 1.0 / 0.0; // Infinity\n}\n\nvoid main(void) {\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n#ifdef ROUNDED_CORNERS\n // Distance from rectangle's edge in pixels. Negative inside the rectangle.\n float d = sdRoundedBox(vPosInPixels, vHalfSizeInPixels, vCornerRadii);\n#else\n float d = sdSharpBox(vPosInPixels, vHalfSizeInPixels);\n#endif\n\n vec4 backgroundColor = vec4(0.0, 0.0, 0.0, 0.0);\n\n#ifdef SHADOW\n float maxCornerRadius = max(vCornerRadii.x, max(vCornerRadii.y, max(vCornerRadii.z, vCornerRadii.w)));\n\n float shadow = 0.0;\n // Only calculate shadow for the region outside the stroke.\n if (d >= vHalfStrokeWidth - 1.0 && uShadowOpacity > 0.0) {\n shadow = roundedBoxShadow(\n -vHalfSizeInPixels - vHalfStrokeWidth,\n vHalfSizeInPixels + vHalfStrokeWidth,\n vPosInPixels - vec2(uShadowOffsetX, -uShadowOffsetY),\n max(uShadowBlur / 2.5, 0.25),\n maxCornerRadius + vHalfStrokeWidth\n ) * uShadowOpacity * uViewOpacity;\n }\n backgroundColor = vec4(uShadowColor * shadow, shadow);\n#endif\n\n if (vHalfStrokeWidth > 0.0 && uHatchPattern > 0) {\n d = max(d, -pattern());\n }\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n backgroundColor,\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n#else\n // The trivial, non-decorated case\n fragColor = vFillColor;\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n#endif\n}\n", nl = "layout(std140) uniform Mark {\n /** Minimum size (width, height) of the displayed rectangle in pixels */\n uniform float uMinWidth;\n uniform float uMinHeight;\n\n /** Minimum opacity for the size clamping */\n uniform float uMinOpacity;\n\n uniform float uCornerRadiusTopRight;\n uniform float uCornerRadiusBottomRight;\n uniform float uCornerRadiusTopLeft;\n uniform float uCornerRadiusBottomLeft;\n\n uniform int uHatchPattern;\n\n uniform vec3 uShadowColor;\n uniform float uShadowOpacity;\n uniform float uShadowBlur;\n uniform float uShadowOffsetX;\n uniform float uShadowOffsetY;\n\n#pragma markUniforms\n};\n", rl = [
3641
3677
  "none",
3642
3678
  "diagonal",
3643
3679
  "antiDiagonal",
@@ -3648,9 +3684,9 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3648
3684
  "dots",
3649
3685
  "rings",
3650
3686
  "ringsLarge"
3651
- ], $c = class extends Tc {
3687
+ ], il = class extends Ac {
3652
3688
  get opaque() {
3653
- return ve(this, "opaque", () => !this.#e() && !this.#t() && !this.properties.shadowOpacity && f(this.encoding.fillOpacity) && this.encoding.fillOpacity.value == 1 && this.properties.minOpacity == 1) && this.unitView.getEffectiveOpacity() == 1;
3689
+ return ve(this, "opaque", () => !this.#e() && !this.#t() && !this.properties.shadowOpacity && o(this.encoding.fillOpacity) && this.encoding.fillOpacity.value == 1 && this.properties.minOpacity == 1) && this.unitView.getEffectiveOpacity() == 1;
3654
3690
  }
3655
3691
  getAttributes() {
3656
3692
  return [
@@ -3677,20 +3713,20 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3677
3713
  }
3678
3714
  #t() {
3679
3715
  let e = this.encoding.strokeWidth;
3680
- return !(f(e) && !e.value) || "condition" in e;
3716
+ return !(o(e) && !e.value) || "condition" in e;
3681
3717
  }
3682
3718
  initializeGraphics() {
3683
3719
  super.initializeGraphics();
3684
3720
  let e = [];
3685
- this.#e() && e.push("ROUNDED_CORNERS"), this.#t() && e.push("STROKED"), this.properties.shadowOpacity && e.push("SHADOW"), this.createAndLinkShaders(Yc, Xc, [Zc, ...e.map((e) => "#define " + e)]);
3721
+ this.#e() && e.push("ROUNDED_CORNERS"), this.#t() && e.push("STROKED"), this.properties.shadowOpacity && e.push("SHADOW"), this.createAndLinkShaders(el, tl, [nl, ...e.map((e) => "#define " + e)]);
3686
3722
  }
3687
3723
  finalizeGraphicsInitialization() {
3688
3724
  super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
3689
3725
  let e = this.properties;
3690
- this.registerMarkUniformValue("uMinWidth", e.minWidth), this.registerMarkUniformValue("uMinHeight", e.minHeight), this.registerMarkUniformValue("uMinOpacity", e.minOpacity), this.registerMarkUniformValue("uCornerRadiusTopRight", e.cornerRadiusTopRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomRight", e.cornerRadiusBottomRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusTopLeft", e.cornerRadiusTopLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomLeft", e.cornerRadiusBottomLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uHatchPattern", e.hatch, (e) => Math.max(0, Qc.indexOf(e ?? "none"))), this.registerMarkUniformValue("uShadowBlur", e.shadowBlur ?? 0), this.registerMarkUniformValue("uShadowOpacity", e.shadowOpacity ?? 0), this.registerMarkUniformValue("uShadowOffsetX", e.shadowOffsetX ?? 0), this.registerMarkUniformValue("uShadowOffsetY", e.shadowOffsetY ?? 0), this.registerMarkUniformValue("uShadowColor", e.shadowColor ?? "black", Yo);
3726
+ this.registerMarkUniformValue("uMinWidth", e.minWidth), this.registerMarkUniformValue("uMinHeight", e.minHeight), this.registerMarkUniformValue("uMinOpacity", e.minOpacity), this.registerMarkUniformValue("uCornerRadiusTopRight", e.cornerRadiusTopRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomRight", e.cornerRadiusBottomRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusTopLeft", e.cornerRadiusTopLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomLeft", e.cornerRadiusBottomLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uHatchPattern", e.hatch, (e) => Math.max(0, rl.indexOf(e ?? "none"))), this.registerMarkUniformValue("uShadowBlur", e.shadowBlur ?? 0), this.registerMarkUniformValue("uShadowOpacity", e.shadowOpacity ?? 0), this.registerMarkUniformValue("uShadowOffsetX", e.shadowOffsetX ?? 0), this.registerMarkUniformValue("uShadowOffsetY", e.shadowOffsetY ?? 0), this.registerMarkUniformValue("uShadowColor", e.shadowColor ?? "black", Xo);
3691
3727
  }
3692
3728
  updateGraphicsData(e) {
3693
- let t = e.getItemCount(), n = new dc({
3729
+ let t = e.getItemCount(), n = new mc({
3694
3730
  encoders: this.encoders,
3695
3731
  attributes: this.getAttributes(),
3696
3732
  numItems: t
@@ -3706,10 +3742,10 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3706
3742
  render(e) {
3707
3743
  let t = this.gl;
3708
3744
  return this.createRenderCallback((e, n) => {
3709
- ao(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e);
3745
+ oo(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e);
3710
3746
  }, e);
3711
3747
  }
3712
- }, el = "// Line caps\nconst int BUTT = 0;\nconst int SQUARE = 1;\nconst int ROUND = 2;\n\n/** Position along the rule */\nin float pos;\n\n/** Which side of the stroke: -0.5 or 0.5 */\nin float side;\n\nflat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\n/** Distances from the line endings. Used for rendering the round caps and dashes */\nout highp vec2 vPosInPixels;\n\n\nvoid main(void) {\n float pixelSize = 1.0 / uDevicePixelRatio;\n\n // Stroke width in pixels\n float size = getScaled_size();\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n vec2 tangent = b - a;\n\n float offset = 0.0;\n float relativeDiff = 0.0;\n if (uMinLength > 0.0 || uStrokeCap != BUTT) {\n float len = length(tangent * uViewportSize);\n\n // Elongate to reach the minimum length.\n // The length difference in pixels\n float diff = max(0.0, uMinLength - len);\n\n // Add line caps\n if (uStrokeCap != BUTT) {\n diff += size;\n }\n\n relativeDiff = diff / len;\n offset = relativeDiff * (pos - 0.5);\n }\n\n // Apply caps and minimum length by spreading the vertices along the tangent\n vec2 p = pos < 1.0\n ? a + tangent * (pos + offset)\n : b + tangent * offset;\n\n // Add an extra pixel to stroke width to accommodate edge antialiasing\n float aaPadding = pixelSize;\n\n // Extrude\n vec2 normal = normalize(vec2(-tangent.y, tangent.x) / uViewportSize);\n p += normal * side * (size + aaPadding) / uViewportSize;\n\n gl_Position = unitToNdc(p);\n\n vColor = vec4(getScaled_color() * opacity, opacity);\n vSize = size;\n vNormalLengthInPixels = side * (size + aaPadding);\n\n // TODO: Here's a precision problem that breaks round caps when zoomed in enough\n vPosInPixels = vec2(pos, (1.0 - pos)) * (1.0 + relativeDiff) * length(tangent * uViewportSize) -\n vec2(uStrokeCap != BUTT ? size / 2.0 : 0.0);\n \n setupPicking();\n}\n", tl = "// Line ending\nconst int BUTT = 0;\nconst int SQUARE = 1;\nconst int ROUND = 2;\n\nuniform sampler2D uDashTexture;\n\nflat in vec4 vColor;\nflat in float vSize;\n\n/** Position on the rule along its length in pixels */\nin vec2 vPosInPixels;\nin float vNormalLengthInPixels;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distanceFromEnd = -min(vPosInPixels[0], vPosInPixels[1]);\n float distance; // from the rule centerline or end\n if (distanceFromEnd > 0.0 && uStrokeCap == ROUND) {\n // round cap\n distance = length(vec2(distanceFromEnd, vNormalLengthInPixels));\n } else {\n distance = abs(vNormalLengthInPixels);\n }\n\n // Use a signed distance field to implement edge antialiasing\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), -0.5, 0.5) + 0.5;\n\n if (uDashTextureSize > 0.0) {\n float pos = (vPosInPixels[0] + uStrokeDashOffset) * dpr;\n float floored = floor(pos);\n vec2 texelPositions = (floored + vec2(0.5, 1.5)) / dpr / uDashTextureSize;\n \n // Do antialiasing\n opacity *= mix(\n texture(uDashTexture, vec2(texelPositions[0], 0)).r,\n texture(uDashTexture, vec2(texelPositions[1], 0)).r,\n clamp((pos - floored), 0.0, 1.0));\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", nl = "layout(std140) uniform Mark {\n /** Minimum rule length in pixels */\n uniform mediump float uMinLength;\n\n uniform mediump float uDashTextureSize;\n uniform lowp int uStrokeCap;\n uniform mediump float uStrokeDashOffset;\n\n#pragma markUniforms\n};\n", rl = class extends Tc {
3748
+ }, al = "// Line caps\nconst int BUTT = 0;\nconst int SQUARE = 1;\nconst int ROUND = 2;\n\n/** Position along the rule */\nin float pos;\n\n/** Which side of the stroke: -0.5 or 0.5 */\nin float side;\n\nflat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\n/** Distances from the line endings. Used for rendering the round caps and dashes */\nout highp vec2 vPosInPixels;\n\n\nvoid main(void) {\n#pragma orderGuard\n\n float pixelSize = 1.0 / uDevicePixelRatio;\n\n // Stroke width in pixels\n float size = getScaled_size();\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n vec2 tangent = b - a;\n\n float offset = 0.0;\n float relativeDiff = 0.0;\n if (uMinLength > 0.0 || uStrokeCap != BUTT) {\n float len = length(tangent * uViewportSize);\n\n // Elongate to reach the minimum length.\n // The length difference in pixels\n float diff = max(0.0, uMinLength - len);\n\n // Add line caps\n if (uStrokeCap != BUTT) {\n diff += size;\n }\n\n relativeDiff = diff / len;\n offset = relativeDiff * (pos - 0.5);\n }\n\n // Apply caps and minimum length by spreading the vertices along the tangent\n vec2 p = pos < 1.0\n ? a + tangent * (pos + offset)\n : b + tangent * offset;\n\n // Add an extra pixel to stroke width to accommodate edge antialiasing\n float aaPadding = pixelSize;\n\n // Extrude\n vec2 normal = normalize(vec2(-tangent.y, tangent.x) / uViewportSize);\n p += normal * side * (size + aaPadding) / uViewportSize;\n\n gl_Position = unitToNdc(p);\n\n vColor = vec4(getScaled_color() * opacity, opacity);\n vSize = size;\n vNormalLengthInPixels = side * (size + aaPadding);\n\n // TODO: Here's a precision problem that breaks round caps when zoomed in enough\n vPosInPixels = vec2(pos, (1.0 - pos)) * (1.0 + relativeDiff) * length(tangent * uViewportSize) -\n vec2(uStrokeCap != BUTT ? size / 2.0 : 0.0);\n \n setupPicking();\n}\n", ol = "// Line ending\nconst int BUTT = 0;\nconst int SQUARE = 1;\nconst int ROUND = 2;\n\nuniform sampler2D uDashTexture;\n\nflat in vec4 vColor;\nflat in float vSize;\n\n/** Position on the rule along its length in pixels */\nin vec2 vPosInPixels;\nin float vNormalLengthInPixels;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distanceFromEnd = -min(vPosInPixels[0], vPosInPixels[1]);\n float distance; // from the rule centerline or end\n if (distanceFromEnd > 0.0 && uStrokeCap == ROUND) {\n // round cap\n distance = length(vec2(distanceFromEnd, vNormalLengthInPixels));\n } else {\n distance = abs(vNormalLengthInPixels);\n }\n\n // Use a signed distance field to implement edge antialiasing\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), -0.5, 0.5) + 0.5;\n\n if (uDashTextureSize > 0.0) {\n float pos = (vPosInPixels[0] + uStrokeDashOffset) * dpr;\n float floored = floor(pos);\n vec2 texelPositions = (floored + vec2(0.5, 1.5)) / dpr / uDashTextureSize;\n \n // Do antialiasing\n opacity *= mix(\n texture(uDashTexture, vec2(texelPositions[0], 0)).r,\n texture(uDashTexture, vec2(texelPositions[1], 0)).r,\n clamp((pos - floored), 0.0, 1.0));\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", sl = "layout(std140) uniform Mark {\n /** Minimum rule length in pixels */\n uniform mediump float uMinLength;\n\n uniform mediump float uDashTextureSize;\n uniform lowp int uStrokeCap;\n uniform mediump float uStrokeDashOffset;\n\n#pragma markUniforms\n};\n", cl = class extends Ac {
3713
3749
  constructor(e, t, n) {
3714
3750
  super(e, t, n), this.dashTexture = void 0, this.dashTextureSize = 0;
3715
3751
  }
@@ -3732,8 +3768,8 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3732
3768
  }
3733
3769
  initializeGraphics() {
3734
3770
  super.initializeGraphics();
3735
- let e = this.gl, t = il(this.properties.strokeDash);
3736
- this.dashTexture = ii(e, {
3771
+ let e = this.gl, t = ll(this.properties.strokeDash);
3772
+ this.dashTexture = ai(e, {
3737
3773
  level: 0,
3738
3774
  mag: e.NEAREST,
3739
3775
  min: e.NEAREST,
@@ -3741,7 +3777,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3741
3777
  format: e.RED,
3742
3778
  src: t,
3743
3779
  height: 1
3744
- }), this.dashTextureSize = t.length, this.createAndLinkShaders(el, tl, [nl]);
3780
+ }), this.dashTextureSize = t.length, this.createAndLinkShaders(al, ol, [sl]);
3745
3781
  }
3746
3782
  finalizeGraphicsInitialization() {
3747
3783
  super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
@@ -3750,10 +3786,10 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3750
3786
  "butt",
3751
3787
  "square",
3752
3788
  "round"
3753
- ].indexOf(e)), Qa(this.markUniformInfo, { uDashTextureSize: +this.dashTextureSize }), this.markUniformsAltered = !0;
3789
+ ].indexOf(e)), $a(this.markUniformInfo, { uDashTextureSize: +this.dashTextureSize }), this.markUniformsAltered = !0;
3754
3790
  }
3755
3791
  updateGraphicsData(e) {
3756
- let t = e.getItemCount(), n = new fc({
3792
+ let t = e.getItemCount(), n = new hc({
3757
3793
  encoders: this.encoders,
3758
3794
  attributes: this.getAttributes(),
3759
3795
  numItems: t
@@ -3768,13 +3804,13 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
3768
3804
  }
3769
3805
  render(e) {
3770
3806
  let t = this.gl;
3771
- return this.createRenderCallback((e, n) => ao(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e), e);
3807
+ return this.createRenderCallback((e, n) => oo(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e), e);
3772
3808
  }
3773
3809
  dispose() {
3774
3810
  this.dashTexture &&= (this.gl.deleteTexture(this.dashTexture), void 0), super.dispose();
3775
3811
  }
3776
3812
  };
3777
- function il(e) {
3813
+ function ll(e) {
3778
3814
  if (!e) return /* @__PURE__ */ new Uint8Array();
3779
3815
  if (e.length == 0 || e.length % 2 || e.findIndex((e) => Math.round(e) != e || e < 1 || e > 1e3) >= 0) throw Error("Invalid stroke dash pattern: " + JSON.stringify(e));
3780
3816
  let t = e.reduce((e, t) => e + t), n = new Uint8Array(t), r = !0, i = 0;
@@ -3786,24 +3822,24 @@ function il(e) {
3786
3822
  }
3787
3823
  //#endregion
3788
3824
  //#region ../core/src/rendering/webgl/marks/text.vertex.glsl
3789
- var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width of the text (all letters)\nin float width;\n\nout vec2 vTexCoord;\nout float vEdgeFadeOpacity;\nflat out vec4 vColor;\nflat out float vSlope;\nflat out float vGamma;\n\nstruct RangeResult {\n float pos;\n float scale;\n};\n\nfloat minValue(vec4 v) {\n return min(min(v.x, v.y), min(v.z, v.w));\n}\n\nfloat maxValue(vec4 v) {\n return max(max(v.x, v.y), max(v.z, v.w));\n}\n\n/**\n * All measures are in [0, 1]\n */\nRangeResult positionInsideRange(float a, float b, float width, float padding,\n int align, bool flush) {\n float span = b - a;\n float paddedWidth = width + 2.0 * padding;\n\n // Is the text clearly outside the viewport\n if (a > 1.0 || b < 0.0) {\n return RangeResult(0.0, 0.0);\n }\n\n // How much extra space we have for adjusting the position so that the\n // text stays inside the range.\n float extra = max(0.0, span - paddedWidth);\n\n float pos;\n\n // Align the text and try to keep it inside the range and the viewport\n if (align == 0) {\n float centre = a + b;\n\n if (flush) {\n float leftOver = max(0.0, paddedWidth - centre);\n centre += min(leftOver, extra);\n\n float rightOver = max(0.0, paddedWidth + centre - 2.0);\n centre -= min(rightOver, extra);\n }\n\n pos = centre / 2.0;\n\n } else if (align < 0) {\n float edge = a;\n\n if (flush) {\n float over = max(0.0, -edge);\n edge += min(over, extra);\n }\n\n pos = edge + padding;\n\n } else {\n float edge = b;\n\n if (flush) {\n float over = max(0.0, edge - 1.0);\n edge -= min(over, extra);\n }\n\n // TODO: If the text spans the whole viewport, try to keep it centered if possible.\n\n pos = edge - padding;\n }\n\n // How the text should be scaled to make it fit inside the range (if it didn't fit).\n float scale = clamp((span - padding) / paddedWidth, 0.0, 1.0);\n\n // TODO: Fix padding in scale factor. Padding should stay constant\n return RangeResult(pos, scale);\n}\n\nvec2 calculateRotatedDimensions(float width, mat2 rotationMatrix) {\n vec2 a = abs(rotationMatrix * vec2(width / 2.0, 0.5));\n vec2 b = abs(rotationMatrix * vec2(width / 2.0, -0.5));\n return vec2(max(a.x, b.x), max(a.y, b.y)) * 2.0;\n}\n\n/** Needed when using ranged text */\nivec2 fixAlignForAngle(ivec2 align, float angleInDegrees) {\n float a = mod(angleInDegrees + 45.0, 360.0);\n int x = align.x;\n int y = -align.y;\n\n // TODO: Optimize by avoiding branching\n if (a < 90.0) {\n return ivec2(x, y);\n } else if (a < 180.0) {\n return ivec2(y, -x);\n } else if (a < 270.0) {\n return ivec2(-x, y);\n } else {\n return ivec2(-y, x);\n }\n}\n\nvoid main(void) {\n float opacity = getScaled_opacity() * uViewOpacity;\n vec2 size = vec2(getScaled_size());\n float x = getScaled_x() + getScaled_xOffset() / uViewportSize.x;\n float y = getScaled_y();\n\n float scale = 1.0;\n\n float angleInDegrees = getScaled_angle();\n float angle = -angleInDegrees * PI / 180.0;\n \n float sinTheta = sin(angle);\n float cosTheta = cos(angle);\n mat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\n vec2 flushSize = calculateRotatedDimensions(width, rotationMatrix);\n\n#if defined(x2_DEFINED) || defined(y2_DEFINED)\n ivec2 align = fixAlignForAngle(uAlign, angleInDegrees);\n#else\n ivec2 align = uAlign;\n#endif\n\n#ifdef x2_DEFINED\n float x2 = getScaled_x2() + getScaled_x2Offset() / uViewportSize.x;\n\n if (uLogoLetter) {\n size.x = (x2 - x) * uViewportSize.x;\n x += (x2 - x) / 2.0;\n\n } else {\n RangeResult result = positionInsideRange(\n min(x, x2), max(x, x2),\n size.x * scale * flushSize.x / uViewportSize.x, uPaddingX / uViewportSize.x,\n align.x, uFlushX);\n \n x = result.pos;\n scale *= result.scale;\n }\n#endif\n\n // Position of the text origo \n vec2 pos = applyOffset(\n applySampleFacet(vec2(x, y)),\n vec2(0.0, getScaled_yOffset())\n );\n\n#ifdef y2_DEFINED\n float y2 = getScaled_y2();\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(x, y2)),\n vec2(0.0, getScaled_y2Offset())\n );\n\n if (uLogoLetter) {\n size.y = (pos2.y - pos.y) * uViewportSize.y;\n pos.y += (pos2.y - pos.y) / 2.0;\n\n } else {\n RangeResult result = positionInsideRange(\n min(pos.y, pos2.y), max(pos.y, pos2.y),\n size.y * scale * flushSize.y / uViewportSize.y, uPaddingY / uViewportSize.y,\n align.y, uFlushY);\n \n pos.y = result.pos;\n scale *= result.scale;\n }\n#endif\n\n#ifdef VISIBLE_RANGE_CULLING\n if (isOutsideVisibleRange(pos)) {\n gl_Position = vec4(0.0);\n return;\n }\n#endif\n\n if (scale < 1.0) {\n if (uSqueeze) {\n vec2 scaleFadeExtent = vec2(3.0, 6.0) / size;\n\n if (scale < scaleFadeExtent[0]) {\n gl_Position = vec4(0.0);\n return;\n }\n\n size *= scale;\n opacity *= linearstep(scaleFadeExtent[0], scaleFadeExtent[1], scale);\n\n } else if (scale < 1.0) {\n // Eliminate the text\n gl_Position = vec4(0.0);\n return;\n }\n }\n\n // Position of the character vertex in relation to the text origo\n vec2 charPos = rotationMatrix * (vertexCoord * size + uD);\n\n // Position of the character vertex inside the unit viewport\n vec2 unitPos = pos + charPos / uViewportSize;\n\n gl_Position = unitToNdc(unitPos);\n\n // Controls antialiasing of the SDF\n vSlope = max(1.0, min(size.x, size.y) / uSdfNumerator * uDevicePixelRatio);\n\n vec3 color = getScaled_color();\n\n // Premultiply alpha\n vColor = vec4(color * opacity, opacity);\n\n // Do something like gamma correction for text when the color is close to black or white.\n vGamma = getGammaForColor(color);\n\n vTexCoord = textureCoord;\n\n // Edge fading. The implementation is simplistic and fails with primitives that\n // span the whole viewport. However, it works just fine with reasonable font sizes.\n // x: top, y: right, z: bottom, w: left\n if (maxValue(uViewportEdgeFadeDistance) > -pow(10.0, 10.0)) { // -Infinity would be nice\n vEdgeFadeOpacity = minValue(\n ((vec4(1.0, 1.0, 0.0, 0.0) + vec4(-1.0, -1.0, 1.0, 1.0) * unitPos.yxyx) *\n uViewportSize.yxyx - uViewportEdgeFadeDistance) / uViewportEdgeFadeWidth);\n } else {\n vEdgeFadeOpacity = 1.0;\n }\n\n setupPicking();\n}\n", ol = "uniform sampler2D uTexture;\n\nin vec2 vTexCoord;\nin float vEdgeFadeOpacity;\nflat in vec4 vColor;\nflat in float vSlope;\nflat in float vGamma;\n\nout lowp vec4 fragColor;\n\nfloat median(float r, float g, float b) {\n return max(min(r, g), min(max(r, g), b));\n}\n\nfloat getDist(vec2 uv) {\n vec3 c = texture(uTexture, uv).rgb;\n return 1.0 - median(c.r, c.g, c.b);\n}\n\n/**\n * Calculates the super-sampled distance to the edge.\n * This is used to avoid aliasing when rendering small text,\n * as mip-mapping cannot be used here.\n * The distance is averaged over a grid of n x n samples.\n */\nfloat getSuperDist(vec2 uv) {\n vec2 dx = dFdx(uv);\n vec2 dy = dFdy(uv);\n\n float n = 2.0;\n\n float sum = 0.0;\n for (float x = 0.5; x < n; x++){\n for (float y = 0.5; y < n; y++) {\n sum += getDist(\n uv +\n x / n * dx +\n y / n * dy\n ); \n }\n }\n\n return sum / (n * n);\n}\n\nvoid main() {\n float sigDist = getSuperDist(vTexCoord);\n\n float slope = vSlope;\n if (uLogoLetter) {\n // Using screen-space derivatives for logo letters because skewed aspect ratios\n // result in blurry edges otherwise. However, use of screen-space derivatives\n // results in crappy looking text with regular letters text.\n slope = 0.7 / length(vec2(dFdy(sigDist), dFdx(sigDist)));\n }\n\n float opa = clamp((sigDist - 0.5) * slope + 0.5, 0.0, 1.0);\n opa *= clamp(vEdgeFadeOpacity, 0.0, 1.0);\n\n opa = pow(opa, vGamma);\n\n fragColor = vColor * opa;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", sl = "layout(std140) uniform Mark {\n uniform mediump float uSdfNumerator;\n\n uniform mediump vec2 uD; // dx & dy\n\n uniform mediump vec4 uViewportEdgeFadeWidth;\n uniform mediump vec4 uViewportEdgeFadeDistance;\n \n uniform bool uSqueeze;\n uniform bool uLogoLetter;\n\n // x: -1, 0, 1 = left, center, right\n // y: -1, 0, 1 = top, middle, bottom \n uniform lowp ivec2 uAlign;\n\n uniform mediump float uPaddingX;\n uniform bool uFlushX;\n uniform mediump float uPaddingY;\n uniform bool uFlushY;\n\n#pragma markUniforms\n};\n", cl = 1024, ll = {
3825
+ var ul = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width of the text (all letters)\nin float width;\n\nout vec2 vTexCoord;\nout float vEdgeFadeOpacity;\nflat out vec4 vColor;\nflat out float vSlope;\nflat out float vGamma;\n\nstruct RangeResult {\n float pos;\n float scale;\n};\n\nfloat minValue(vec4 v) {\n return min(min(v.x, v.y), min(v.z, v.w));\n}\n\nfloat maxValue(vec4 v) {\n return max(max(v.x, v.y), max(v.z, v.w));\n}\n\n/**\n * All measures are in [0, 1]\n */\nRangeResult positionInsideRange(float a, float b, float width, float padding,\n int align, bool flush) {\n float span = b - a;\n float paddedWidth = width + 2.0 * padding;\n\n // Is the text clearly outside the viewport\n if (a > 1.0 || b < 0.0) {\n return RangeResult(0.0, 0.0);\n }\n\n // How much extra space we have for adjusting the position so that the\n // text stays inside the range.\n float extra = max(0.0, span - paddedWidth);\n\n float pos;\n\n // Align the text and try to keep it inside the range and the viewport\n if (align == 0) {\n float centre = a + b;\n\n if (flush) {\n float leftOver = max(0.0, paddedWidth - centre);\n centre += min(leftOver, extra);\n\n float rightOver = max(0.0, paddedWidth + centre - 2.0);\n centre -= min(rightOver, extra);\n }\n\n pos = centre / 2.0;\n\n } else if (align < 0) {\n float edge = a;\n\n if (flush) {\n float over = max(0.0, -edge);\n edge += min(over, extra);\n }\n\n pos = edge + padding;\n\n } else {\n float edge = b;\n\n if (flush) {\n float over = max(0.0, edge - 1.0);\n edge -= min(over, extra);\n }\n\n // TODO: If the text spans the whole viewport, try to keep it centered if possible.\n\n pos = edge - padding;\n }\n\n // How the text should be scaled to make it fit inside the range (if it didn't fit).\n float scale = clamp((span - padding) / paddedWidth, 0.0, 1.0);\n\n // TODO: Fix padding in scale factor. Padding should stay constant\n return RangeResult(pos, scale);\n}\n\nvec2 calculateRotatedDimensions(float width, mat2 rotationMatrix) {\n vec2 a = abs(rotationMatrix * vec2(width / 2.0, 0.5));\n vec2 b = abs(rotationMatrix * vec2(width / 2.0, -0.5));\n return vec2(max(a.x, b.x), max(a.y, b.y)) * 2.0;\n}\n\n/** Needed when using ranged text */\nivec2 fixAlignForAngle(ivec2 align, float angleInDegrees) {\n float a = mod(angleInDegrees + 45.0, 360.0);\n int x = align.x;\n int y = -align.y;\n\n // TODO: Optimize by avoiding branching\n if (a < 90.0) {\n return ivec2(x, y);\n } else if (a < 180.0) {\n return ivec2(y, -x);\n } else if (a < 270.0) {\n return ivec2(-x, y);\n } else {\n return ivec2(-y, x);\n }\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n float opacity = getScaled_opacity() * uViewOpacity;\n vec2 size = vec2(getScaled_size());\n float x = getScaled_x() + getScaled_xOffset() / uViewportSize.x;\n float y = getScaled_y();\n\n float scale = 1.0;\n\n float angleInDegrees = getScaled_angle();\n float angle = -angleInDegrees * PI / 180.0;\n \n float sinTheta = sin(angle);\n float cosTheta = cos(angle);\n mat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\n vec2 flushSize = calculateRotatedDimensions(width, rotationMatrix);\n\n#if defined(x2_DEFINED) || defined(y2_DEFINED)\n ivec2 align = fixAlignForAngle(uAlign, angleInDegrees);\n#else\n ivec2 align = uAlign;\n#endif\n\n#ifdef x2_DEFINED\n float x2 = getScaled_x2() + getScaled_x2Offset() / uViewportSize.x;\n\n if (uLogoLetter) {\n size.x = (x2 - x) * uViewportSize.x;\n x += (x2 - x) / 2.0;\n\n } else {\n RangeResult result = positionInsideRange(\n min(x, x2), max(x, x2),\n size.x * scale * flushSize.x / uViewportSize.x, uPaddingX / uViewportSize.x,\n align.x, uFlushX);\n \n x = result.pos;\n scale *= result.scale;\n }\n#endif\n\n // Position of the text origo \n vec2 pos = applyOffset(\n applySampleFacet(vec2(x, y)),\n vec2(0.0, getScaled_yOffset())\n );\n\n#ifdef y2_DEFINED\n float y2 = getScaled_y2();\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(x, y2)),\n vec2(0.0, getScaled_y2Offset())\n );\n\n if (uLogoLetter) {\n size.y = (pos2.y - pos.y) * uViewportSize.y;\n pos.y += (pos2.y - pos.y) / 2.0;\n\n } else {\n RangeResult result = positionInsideRange(\n min(pos.y, pos2.y), max(pos.y, pos2.y),\n size.y * scale * flushSize.y / uViewportSize.y, uPaddingY / uViewportSize.y,\n align.y, uFlushY);\n \n pos.y = result.pos;\n scale *= result.scale;\n }\n#endif\n\n#ifdef VISIBLE_RANGE_CULLING\n if (isOutsideVisibleRange(pos)) {\n gl_Position = vec4(0.0);\n return;\n }\n#endif\n\n if (scale < 1.0) {\n if (uSqueeze) {\n vec2 scaleFadeExtent = vec2(3.0, 6.0) / size;\n\n if (scale < scaleFadeExtent[0]) {\n gl_Position = vec4(0.0);\n return;\n }\n\n size *= scale;\n opacity *= linearstep(scaleFadeExtent[0], scaleFadeExtent[1], scale);\n\n } else if (scale < 1.0) {\n // Eliminate the text\n gl_Position = vec4(0.0);\n return;\n }\n }\n\n // Position of the character vertex in relation to the text origo\n vec2 charPos = rotationMatrix * (vertexCoord * size + uD);\n\n // Position of the character vertex inside the unit viewport\n vec2 unitPos = pos + charPos / uViewportSize;\n\n gl_Position = unitToNdc(unitPos);\n\n // Controls antialiasing of the SDF\n vSlope = max(1.0, min(size.x, size.y) / uSdfNumerator * uDevicePixelRatio);\n\n vec3 color = getScaled_color();\n\n // Premultiply alpha\n vColor = vec4(color * opacity, opacity);\n\n // Do something like gamma correction for text when the color is close to black or white.\n vGamma = getGammaForColor(color);\n\n vTexCoord = textureCoord;\n\n // Edge fading. The implementation is simplistic and fails with primitives that\n // span the whole viewport. However, it works just fine with reasonable font sizes.\n // x: top, y: right, z: bottom, w: left\n if (maxValue(uViewportEdgeFadeDistance) > -pow(10.0, 10.0)) { // -Infinity would be nice\n vEdgeFadeOpacity = minValue(\n ((vec4(1.0, 1.0, 0.0, 0.0) + vec4(-1.0, -1.0, 1.0, 1.0) * unitPos.yxyx) *\n uViewportSize.yxyx - uViewportEdgeFadeDistance) / uViewportEdgeFadeWidth);\n } else {\n vEdgeFadeOpacity = 1.0;\n }\n\n setupPicking();\n}\n", dl = "uniform sampler2D uTexture;\n\nin vec2 vTexCoord;\nin float vEdgeFadeOpacity;\nflat in vec4 vColor;\nflat in float vSlope;\nflat in float vGamma;\n\nout lowp vec4 fragColor;\n\nfloat median(float r, float g, float b) {\n return max(min(r, g), min(max(r, g), b));\n}\n\nfloat getDist(vec2 uv) {\n vec3 c = texture(uTexture, uv).rgb;\n return 1.0 - median(c.r, c.g, c.b);\n}\n\n/**\n * Calculates the super-sampled distance to the edge.\n * This is used to avoid aliasing when rendering small text,\n * as mip-mapping cannot be used here.\n * The distance is averaged over a grid of n x n samples.\n */\nfloat getSuperDist(vec2 uv) {\n vec2 dx = dFdx(uv);\n vec2 dy = dFdy(uv);\n\n float n = 2.0;\n\n float sum = 0.0;\n for (float x = 0.5; x < n; x++){\n for (float y = 0.5; y < n; y++) {\n sum += getDist(\n uv +\n x / n * dx +\n y / n * dy\n ); \n }\n }\n\n return sum / (n * n);\n}\n\nvoid main() {\n float sigDist = getSuperDist(vTexCoord);\n\n float slope = vSlope;\n if (uLogoLetter) {\n // Using screen-space derivatives for logo letters because skewed aspect ratios\n // result in blurry edges otherwise. However, use of screen-space derivatives\n // results in crappy looking text with regular letters text.\n slope = 0.7 / length(vec2(dFdy(sigDist), dFdx(sigDist)));\n }\n\n float opa = clamp((sigDist - 0.5) * slope + 0.5, 0.0, 1.0);\n opa *= clamp(vEdgeFadeOpacity, 0.0, 1.0);\n\n opa = pow(opa, vGamma);\n\n fragColor = vColor * opa;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", fl = "layout(std140) uniform Mark {\n uniform mediump float uSdfNumerator;\n\n uniform mediump vec2 uD; // dx & dy\n\n uniform mediump vec4 uViewportEdgeFadeWidth;\n uniform mediump vec4 uViewportEdgeFadeDistance;\n \n uniform bool uSqueeze;\n uniform bool uLogoLetter;\n\n // x: -1, 0, 1 = left, center, right\n // y: -1, 0, 1 = top, middle, bottom \n uniform lowp ivec2 uAlign;\n\n uniform mediump float uPaddingX;\n uniform bool uFlushX;\n uniform mediump float uPaddingY;\n uniform bool uFlushY;\n\n#pragma markUniforms\n};\n", pl = 1024, ml = {
3790
3826
  left: -1,
3791
3827
  center: 0,
3792
3828
  right: 1
3793
- }, ul = {
3829
+ }, hl = {
3794
3830
  top: -1,
3795
3831
  middle: 0,
3796
3832
  bottom: 1,
3797
3833
  alphabetic: 1,
3798
3834
  baseline: 1
3799
- }, dl = {
3800
- point: Jc,
3801
- rect: $c,
3802
- arrow: Fc,
3803
- rule: rl,
3804
- tick: rl,
3805
- link: Wc,
3806
- text: class extends Tc {
3835
+ }, gl = {
3836
+ point: $c,
3837
+ rect: il,
3838
+ arrow: Bc,
3839
+ rule: cl,
3840
+ tick: cl,
3841
+ link: Yc,
3842
+ text: class extends Ac {
3807
3843
  getAttributes() {
3808
3844
  return [
3809
3845
  "uniqueId",
@@ -3823,7 +3859,7 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
3823
3859
  ];
3824
3860
  }
3825
3861
  initializeGraphics() {
3826
- super.initializeGraphics(), this.createAndLinkShaders(al, ol, [sl]);
3862
+ super.initializeGraphics(), this.createAndLinkShaders(ul, dl, [fl]);
3827
3863
  }
3828
3864
  finalizeGraphicsInitialization() {
3829
3865
  super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
@@ -3838,23 +3874,23 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
3838
3874
  e.viewportEdgeFadeDistanceRight,
3839
3875
  e.viewportEdgeFadeDistanceBottom,
3840
3876
  e.viewportEdgeFadeDistanceLeft
3841
- ]), Qa(this.markUniformInfo, {
3842
- uAlign: [ll[e.align], ul[e.baseline]],
3877
+ ]), $a(this.markUniformInfo, {
3878
+ uAlign: [ml[e.align], hl[e.baseline]],
3843
3879
  uD: [e.dx, -e.dy]
3844
3880
  });
3845
3881
  }
3846
3882
  registerMarkUniformVector(e, t) {
3847
3883
  let n = this.createMarkUniformSetter(e), r = [], i = () => n(r.map((e) => e()));
3848
- for (let e of t) r.push(d(e) ? this.unitView.paramRuntime.watchExpression(e.expr, i) : () => e);
3884
+ for (let e of t) r.push(u(e) ? this.unitView.paramRuntime.watchExpression(e.expr, i) : () => e);
3849
3885
  i();
3850
3886
  }
3851
3887
  updateGraphicsData(e) {
3852
- let t = e.getData(), n = this.encoding, r = this.properties, i = d(r.logoLetters) ? this.unitView.paramRuntime.evaluateAndGet(r.logoLetters.expr) : r.logoLetters, a = this.encoders.text, o = 0, c = "format" in n.text ? ie(n.text.format) : (e) => e;
3888
+ let t = e.getData(), n = this.encoding, r = this.properties, i = u(r.logoLetters) ? this.unitView.paramRuntime.evaluateAndGet(r.logoLetters.expr) : r.logoLetters, a = this.encoders.text, o = 0, s = "format" in n.text ? g(n.text.format) : (e) => e;
3853
3889
  for (let e of t) {
3854
- let t = c(a(e)), n = s(t) ? t : t === null ? "" : "" + t;
3890
+ let t = s(a(e)), n = c(t) ? t : t === null ? "" : "" + t;
3855
3891
  o += n && n.length || 0;
3856
3892
  }
3857
- let l = new hc({
3893
+ let l = new vc({
3858
3894
  encoders: this.encoders,
3859
3895
  attributes: this.getAttributes(),
3860
3896
  properties: {
@@ -3863,11 +3899,11 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
3863
3899
  logoLetters: i
3864
3900
  },
3865
3901
  fontMetrics: this.font.metrics,
3866
- numCharacters: Math.max(o, cl)
3902
+ numCharacters: Math.max(o, pl)
3867
3903
  });
3868
3904
  l.addBatches(e.facetBatches);
3869
- let u = l.toArrays();
3870
- this.rangeMap.migrateEntries(u.rangeMap), this.updateBufferInfo(u);
3905
+ let d = l.toArrays();
3906
+ this.rangeMap.migrateEntries(d.rangeMap), this.updateBufferInfo(d);
3871
3907
  }
3872
3908
  prepareRender(e) {
3873
3909
  let t = super.prepareRender(e);
@@ -3877,16 +3913,16 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
3877
3913
  }
3878
3914
  render(e) {
3879
3915
  let t = this.gl;
3880
- return this.createRenderCallback((e, n) => ao(t, this.vertexArrayInfo, t.TRIANGLES, n, e), e);
3916
+ return this.createRenderCallback((e, n) => oo(t, this.vertexArrayInfo, t.TRIANGLES, n, e), e);
3881
3917
  }
3882
3918
  }
3883
3919
  };
3884
- function fl(e, t, n) {
3885
- let r = dl[e.getType()];
3920
+ function _l(e, t, n) {
3921
+ let r = gl[e.getType()];
3886
3922
  if (!r) throw Error("Unsupported WebGL mark type: " + e.getType());
3887
3923
  return new r(e, t, n);
3888
3924
  }
3889
- var pl = class {
3925
+ var vl = class {
3890
3926
  #e = !1;
3891
3927
  #t = /* @__PURE__ */ new Map();
3892
3928
  #n = /* @__PURE__ */ new Map();
@@ -3896,7 +3932,7 @@ var pl = class {
3896
3932
  }
3897
3933
  #i(e) {
3898
3934
  this.#s();
3899
- let t = fl(e, this.glHelper, this), n = {
3935
+ let t = _l(e, this.glHelper, this), n = {
3900
3936
  mark: e,
3901
3937
  graphics: t,
3902
3938
  state: "compiling",
@@ -3983,7 +4019,7 @@ var pl = class {
3983
4019
  let t = this.#r.get(e);
3984
4020
  if (t) return t.ready;
3985
4021
  let n = this.glHelper.gl, r, i = new Promise((t, i) => {
3986
- r = ii(n, {
4022
+ r = ai(n, {
3987
4023
  src: e,
3988
4024
  min: n.LINEAR
3989
4025
  }, (a) => {
@@ -4018,22 +4054,22 @@ var pl = class {
4018
4054
  let n = t.unitView.getCollector();
4019
4055
  e.collector = n, e.dataRevision = n?.dataRevision ?? -1, e.configurationRevision = t.getRenderingRevision("configuration") ?? -1, e.encodedDataRevision = t.getEncodedDataRevision();
4020
4056
  }
4021
- #l(t) {
4022
- for (let [n, r] of Object.entries(t.mark.encoders)) {
4023
- if (!r.scale) continue;
4024
- let i = e(r.channelDef)?.resolutionChannel ?? n;
4025
- if (!p(i)) continue;
4026
- let a = t.mark.unitView.getScaleResolution(i);
4027
- if (!a || t.scaleResolutions.has(a)) continue;
4028
- t.scaleResolutions.add(a);
4029
- let o = this.#n.get(a);
4030
- if (o) {
4031
- o.count++;
4057
+ #l(e) {
4058
+ for (let [t, n] of Object.entries(e.mark.encoders)) {
4059
+ if (!n.scale) continue;
4060
+ let r = b(n.channelDef)?.resolutionChannel ?? t;
4061
+ if (!te(r)) continue;
4062
+ let i = e.mark.unitView.getScaleResolution(r);
4063
+ if (!i || e.scaleResolutions.has(i)) continue;
4064
+ e.scaleResolutions.add(i);
4065
+ let a = this.#n.get(i);
4066
+ if (a) {
4067
+ a.count++;
4032
4068
  continue;
4033
4069
  }
4034
- this.glHelper.createRangeTexture(a), this.#n.set(a, {
4070
+ this.glHelper.createRangeTexture(i), this.#n.set(i, {
4035
4071
  count: 1,
4036
- dispose: a.observeMapping(() => this.glHelper.createRangeTexture(a, !0))
4072
+ dispose: i.observeMapping(() => this.glHelper.createRangeTexture(i, !0))
4037
4073
  });
4038
4074
  }
4039
4075
  }
@@ -4047,13 +4083,13 @@ var pl = class {
4047
4083
  };
4048
4084
  //#endregion
4049
4085
  //#region ../core/src/rendering/webgl/svgRasterizer.js
4050
- function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter: i, logicalWidth: a, logicalHeight: o, pixelRatio: s }) {
4086
+ function yl({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter: i, logicalWidth: a, logicalHeight: o, pixelRatio: s }) {
4051
4087
  let c = r.gl, l = Math.ceil(a * s), u = Math.ceil(o * s);
4052
- hl(c, l, u);
4088
+ bl(c, l, u);
4053
4089
  let d = s == 1 && n ? n : we(t, be.create(0, 0, a, o), {
4054
4090
  devicePixelRatio: s,
4055
4091
  renderingOptions: { firstFacet: !0 }
4056
- }), f = No(c, [{
4092
+ }), f = Po(c, [{
4057
4093
  format: c.RGBA,
4058
4094
  type: c.UNSIGNED_BYTE,
4059
4095
  minMag: c.LINEAR,
@@ -4061,7 +4097,7 @@ function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter
4061
4097
  }], l, u);
4062
4098
  try {
4063
4099
  for (let t of e) {
4064
- let e = new Us({ picking: !1 }, {
4100
+ let e = new Ks({ picking: !1 }, {
4065
4101
  webGLHelper: r,
4066
4102
  markAdapter: i,
4067
4103
  canvasSize: {
@@ -4075,7 +4111,7 @@ function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter
4075
4111
  });
4076
4112
  d.collectRenderCommands(e), e.finish(), e.render();
4077
4113
  let n = De(t.bounds, s, l, u);
4078
- Ee(t, n, s, qs(c, f, "image/png", {
4114
+ Ee(t, n, s, Xs(c, f, "image/png", {
4079
4115
  ...n,
4080
4116
  unpremultiplyAlpha: !0
4081
4117
  }));
@@ -4084,44 +4120,44 @@ function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter
4084
4120
  c.bindFramebuffer(c.FRAMEBUFFER, null), c.deleteTexture(f.attachments[0]), c.deleteFramebuffer(f.framebuffer);
4085
4121
  }
4086
4122
  }
4087
- function hl(e, t, n) {
4123
+ function bl(e, t, n) {
4088
4124
  let r = e.getParameter(e.MAX_RENDERBUFFER_SIZE), i = e.getParameter(e.MAX_TEXTURE_SIZE), a = Math.min(r, i);
4089
4125
  if (t <= 0 || n <= 0 || t > a || n > a) throw RangeError(`SVG raster dimensions ${t} x ${n} exceed the WebGL limit ${a}.`);
4090
4126
  }
4091
4127
  //#endregion
4092
4128
  //#region ../core/src/rendering/webgl/index.js
4093
- function gl(e) {
4094
- let t = new Rs(e.container, e.sizeSource, { powerPreference: e.powerPreference }, e.onCanvasResize), n = new pl(t);
4129
+ function xl(e) {
4130
+ let t = new Vs(e.container, e.sizeSource, { powerPreference: e.powerPreference }, e.onCanvasResize), n = new vl(t);
4095
4131
  return {
4096
4132
  surface: t,
4097
4133
  defaultFontBitmapUrl: Oe,
4098
4134
  prepareFontBitmap: (e) => n.prepareFontBitmap(e),
4099
4135
  getMarkRenderingDebugState: (e) => n.getMarkRenderingDebugState(e),
4100
- createRenderCoordinator: (e) => new Gs({
4136
+ createRenderCoordinator: (e) => new Js({
4101
4137
  ...e,
4102
4138
  glHelper: t,
4103
4139
  markAdapter: n
4104
4140
  }),
4105
- exportCanvas: (e) => Qs({
4141
+ exportCanvas: (e) => tc({
4106
4142
  ...e,
4107
4143
  glHelper: t,
4108
4144
  markAdapter: n
4109
4145
  }),
4110
- exportRaster: (e) => $s({
4146
+ exportRaster: (e) => nc({
4111
4147
  ...e,
4112
4148
  glHelper: t,
4113
4149
  markAdapter: n
4114
4150
  }),
4115
- rasterizeSvgRuns: (e) => ml({
4151
+ rasterizeSvgRuns: (e) => yl({
4116
4152
  ...e,
4117
4153
  webGLHelper: t,
4118
4154
  markAdapter: n
4119
4155
  }),
4120
4156
  readPickingId: (e, n) => {
4121
- let r = t.getDevicePixelRatio(), i = Hs(t.gl, t._pickingBufferInfo, e * r, n * r);
4157
+ let r = t.getDevicePixelRatio(), i = Gs(t.gl, t._pickingBufferInfo, e * r, n * r);
4122
4158
  return i[0] | i[1] << 8 | i[2] << 16 | i[3] << 24;
4123
4159
  }
4124
4160
  };
4125
4161
  }
4126
4162
  //#endregion
4127
- export { gl as createWebGLRenderingBackend };
4163
+ export { xl as createWebGLRenderingBackend };