@genome-spy/app 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +28 -0
  2. package/dist/{agentApi-Cz0hCnVp.js → agentApi-BZ1JCo1N.js} +7174 -8484
  3. package/dist/agentApi.es.js +3312 -3575
  4. package/dist/agentShared.es.js +14 -13
  5. package/dist/canvas2d-B_PnIof-.js +620 -0
  6. package/dist/canvas2d-Cafq5v-N.js +620 -0
  7. package/dist/{arrayUtils-LJpQOu-U.js → clipOptions-D6eh9T-_.js} +1060 -634
  8. package/dist/{paramUtils-BYI4rwyL.js → clipOptions-H68pJyEZ.js} +940 -514
  9. package/dist/{debug-CgDtmspT.js → debug-BGzgZmyk.js} +8 -8
  10. package/dist/{debug-BvCZWumf.js → debug-UYKZLNh4.js} +8 -8
  11. package/dist/index.es.js +2983 -2916
  12. package/dist/index.js +2006 -1997
  13. package/dist/indexer-Di57GyxX.js +72 -0
  14. package/dist/indexer-o6Hpg4nN.js +72 -0
  15. package/dist/layoutResult-D50MSHXR.js +97 -0
  16. package/dist/nativeText-D9SoxpaD.js +934 -0
  17. package/dist/nativeText-DAjvkrzc.js +934 -0
  18. package/dist/performanceProfiler-CPLEjApa.js +20 -0
  19. package/dist/rasterExport-DzldLv6E.js +44 -0
  20. package/dist/rasterExport-IAbJwi8F.js +44 -0
  21. package/dist/rasterImage-B4rPLaW9.js +18 -0
  22. package/dist/rasterization-CFogVB3B.js +50 -0
  23. package/dist/rectangle-DKnrAmKs.js +142 -0
  24. package/dist/renderCanvas2D-BJ93Ptqj.js +277 -0
  25. package/dist/renderCanvas2D-yJ1IrDcX.js +277 -0
  26. package/dist/schema.json +11685 -4428
  27. package/dist/{svg-yFj875aX.js → svg-BRpl2Xub.js} +412 -449
  28. package/dist/{svg-CCu8kYy2.js → svg-DJuqHIyc.js} +399 -436
  29. package/dist/svgRasterizer-CGZQ5njV.js +40 -0
  30. package/dist/svgRasterizer-PAoqLn1j.js +40 -0
  31. package/dist/vega-scale-BGC53c22.js +2403 -0
  32. package/dist/vega-scale-DdW2NzQ3.js +2403 -0
  33. package/dist/viewError-BiR9VCgL.js +29 -0
  34. package/dist/{viewIdentityRegistry-BUdkK9zT.js → viewIdentityRegistry-D4p067HU.js} +1 -1
  35. package/dist/{viewIdentityRegistry-D3oPbN4O.js → viewIdentityRegistry-Dc2hXYsO.js} +1 -1
  36. package/dist/viewSelectors-DNXnGwEW.js +2015 -0
  37. package/dist/viewSelectors-DYYlOt91.js +2015 -0
  38. package/dist/viewUtils-EdhZTPrJ.js +6448 -0
  39. package/dist/webgl-C53DwzVT.js +4127 -0
  40. package/dist/webgl-CdgNFlJk.js +4127 -0
  41. package/package.json +7 -6
  42. package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
  43. package/dist/canvas2d-DoAXEiF9.js +0 -309
  44. package/dist/canvas2d-f5jl4A5D.js +0 -310
  45. package/dist/clipOptions-gqdb3fvW.js +0 -43
  46. package/dist/color-W5zffv-z.js +0 -335
  47. package/dist/framebufferReadback-CCLOjStu.js +0 -148
  48. package/dist/framebufferReadback-THWwFqs8.js +0 -1994
  49. package/dist/nativeText-DMO8gLt7.js +0 -806
  50. package/dist/nativeText-m5AUINMq.js +0 -806
  51. package/dist/twgl-full.module-DB2UdP1k.js +0 -1849
  52. package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
  53. package/dist/viewSelectors-DGCspRN3.js +0 -4198
  54. package/dist/viewSelectors-U5oLCLHV.js +0 -4195
  55. package/dist/viewUtils-Dg4RA40Q.js +0 -7503
  56. package/dist/warning-DRGdb6BF.js +0 -59
  57. package/dist/webgl-Ci6ZhCCf.js +0 -54
  58. package/dist/webgl-Dpz8a3TI.js +0 -53
@@ -0,0 +1,2015 @@
1
+ import { Ct as e, Et as t, O as n, St as r, Tt as i, an as a, kt as o, nn as s, nt as c, o as l, on as u, pn as d, rt as f, sn as p, t as m, u as ee, y as h } from "./clipOptions-D6eh9T-_.js";
2
+ import { a as g, n as te, r as ne, t as _ } from "./viewError-BiR9VCgL.js";
3
+ import { U as re, m as ie, rt as ae, y as v } from "./vega-scale-DdW2NzQ3.js";
4
+ //#region ../core/src/view/layout/flexLayout.js
5
+ function oe(e, t, { spacing: n, devicePixelRatio: r, offset: i, reverse: a } = {}) {
6
+ n ||= 0, i ||= 0;
7
+ let o = me(e, t, n), s = 0, c = 0;
8
+ for (let t = 0; t < e.length; t++) s += o[t], x(e[t]) || c++;
9
+ let l = s + Math.max(0, c - 1) * n, u = r === void 0 ? (e) => e : (e) => Math.round(e * r) / r, d = 0, f = [], p = (e) => {
10
+ let t = d;
11
+ if (!t) return;
12
+ let r = (e ? n : 0) * (a ? -1 : 1);
13
+ m -= r;
14
+ for (let e = 0; e < t; e++) f.push({
15
+ location: m + (e + 1) / (t + 1) * r,
16
+ size: 0
17
+ });
18
+ m += r, d = 0;
19
+ }, m = a ? Math.max(t, l) : 0 + i;
20
+ if (e.length == 1 && x(e[0])) return [{
21
+ location: m,
22
+ size: 0
23
+ }];
24
+ for (let t = 0; t < e.length; t++) {
25
+ let r = e[t];
26
+ if (x(r)) d++;
27
+ else {
28
+ p(f.length > 0);
29
+ let e = o[t];
30
+ a && (m -= e), f.push({
31
+ location: u(m),
32
+ size: u(e)
33
+ }), a ? m -= n : m += e + n;
34
+ }
35
+ }
36
+ return m += a ? n : -n, p(!1), f;
37
+ }
38
+ function se(e, { spacing: t } = { spacing: 0 }) {
39
+ let n = 0;
40
+ for (let r of e) n += E(r) + (x(r) ? 0 : t);
41
+ return Math.max(0, n - t);
42
+ }
43
+ function ce(e, t, { spacing: n = 0 } = {}) {
44
+ let r = [], i = [], a = 0, o = 0;
45
+ for (let [s, c] of e.entries()) {
46
+ let e = E(c), l = !x(c), u = o && l ? n : 0;
47
+ i.length && a + u + e > t && (r.push(i), i = [], a = 0, o = 0), i.push(s), a += (o && l ? n : 0) + e, o += +!!l;
48
+ }
49
+ return i.length && r.push(i), r;
50
+ }
51
+ function le(e) {
52
+ let t = 0, n = 0, r = 0, i, a = !0;
53
+ for (let o of e) {
54
+ t = Math.max(t, o.px ?? 0), n = Math.max(n, o.grow ?? 0), r = Math.max(r, E(o));
55
+ let e = D(o);
56
+ e === void 0 ? a = !1 : i = i === void 0 ? e : Math.max(i, e);
57
+ }
58
+ return O({
59
+ px: t,
60
+ grow: n,
61
+ minPx: r,
62
+ maxPx: a ? i : void 0
63
+ });
64
+ }
65
+ function ue(e) {
66
+ let t = {
67
+ px: 0,
68
+ grow: 0,
69
+ minPx: 0,
70
+ maxPx: 0
71
+ }, n = !0;
72
+ for (let r of e) {
73
+ t.px += S(r.px), t.grow += S(r.grow), t.minPx += E(r);
74
+ let e = D(r);
75
+ e === void 0 ? n = !1 : t.maxPx += e;
76
+ }
77
+ return n || delete t.maxPx, O(t);
78
+ }
79
+ var y = class e {
80
+ constructor(e, t) {
81
+ this.width = e, this.height = t;
82
+ }
83
+ addPadding(e) {
84
+ return this.#e(e.width, e.height);
85
+ }
86
+ subtractPadding(e) {
87
+ return this.#e(-e.width, -e.height);
88
+ }
89
+ #e(t, n) {
90
+ return new e(_e(this.width, t), _e(this.height, n));
91
+ }
92
+ isGrowing() {
93
+ return !!(this.width.grow || this.height.grow);
94
+ }
95
+ }, b = Object.freeze({
96
+ px: 0,
97
+ grow: 0
98
+ }), de = new y(b, b);
99
+ function x(e) {
100
+ return !e.px && !e.grow && !e.minPx;
101
+ }
102
+ function fe(e, t) {
103
+ return !e || !t ? !1 : e.px === t.px && e.grow === t.grow && e.minPx === t.minPx && e.maxPx === t.maxPx;
104
+ }
105
+ function S(e) {
106
+ return e || 0;
107
+ }
108
+ function pe(e) {
109
+ return e && (a(e.px) || a(e.grow) || a(e.minPx) || a(e.maxPx));
110
+ }
111
+ function C(e) {
112
+ if (J(e)) throw Error("parseSizeDef does not accept step-based sizes.");
113
+ if (pe(e)) return w(e), O(e);
114
+ if (a(e)) return {
115
+ px: e,
116
+ grow: 0
117
+ };
118
+ if (e === "container" || !e) return {
119
+ px: 0,
120
+ grow: 1
121
+ };
122
+ throw Error(`Invalid sizeDef: ${e}`);
123
+ }
124
+ function me(e, t, n) {
125
+ let r = !1;
126
+ for (let t of e) w(t), r ||= ge(t);
127
+ if (!r) return he(e, t, n);
128
+ let i = Array(e.length).fill(0), a = [];
129
+ for (let t = 0; t < e.length; t++) x(e[t]) || a.push(t);
130
+ let o = Math.max(0, a.length - 1) * n, s = Math.max(0, t - o), c = /* @__PURE__ */ new Set();
131
+ for (let t of a) {
132
+ let n = e[t];
133
+ S(n.grow) || (i[t] = T(S(n.px), n), c.add(t));
134
+ }
135
+ for (;;) {
136
+ let t = 0, n = 0, r = 0;
137
+ for (let o of a) c.has(o) ? r += i[o] : (t += S(e[o].px), n += S(e[o].grow));
138
+ if (!n) {
139
+ for (let t of a) c.has(t) || (i[t] = T(S(e[t].px), e[t]), c.add(t));
140
+ break;
141
+ }
142
+ let o = Math.max(0, s - r - t), l = 0, u = [], d = [];
143
+ for (let t of a) {
144
+ if (c.has(t)) continue;
145
+ let r = e[t], a = S(r.px) + S(r.grow) / n * o, s = T(a, r);
146
+ i[t] = s;
147
+ let f = s - a;
148
+ l += f, f > 0 ? u.push(t) : f < 0 && d.push(t);
149
+ }
150
+ if (!u.length && !d.length) break;
151
+ if (l > 0) for (let e of u) c.add(e);
152
+ else if (l < 0) for (let e of d) c.add(e);
153
+ else for (let e of a) c.add(e);
154
+ }
155
+ return i;
156
+ }
157
+ function he(e, t, n) {
158
+ let r = 0, i = 0;
159
+ for (let t of e) r += S(t.px) + (x(t) ? 0 : n), i += S(t.grow);
160
+ r -= n;
161
+ let a = Math.max(0, t - r), o = Array(e.length);
162
+ for (let t = 0; t < e.length; t++) {
163
+ let n = e[t];
164
+ o[t] = x(n) ? 0 : S(n.px) + (i ? S(n.grow) / i * a : 0);
165
+ }
166
+ return o;
167
+ }
168
+ function w(e) {
169
+ if (e.minPx !== void 0 && e.maxPx !== void 0 && e.minPx > e.maxPx) throw Error("SizeDef minPx cannot be greater than maxPx.");
170
+ }
171
+ function T(e, t) {
172
+ return Math.min(Math.max(e, t.minPx ?? 0), t.maxPx ?? Infinity);
173
+ }
174
+ function E(e) {
175
+ return T(S(e.px), e);
176
+ }
177
+ function D(e) {
178
+ return e.maxPx ?? (S(e.grow) ? void 0 : E(e));
179
+ }
180
+ function ge(e) {
181
+ return e.minPx !== void 0 || e.maxPx !== void 0;
182
+ }
183
+ function _e(e, t) {
184
+ return O({
185
+ px: (e.px ?? 0) + t,
186
+ grow: e.grow,
187
+ minPx: e.minPx === void 0 ? void 0 : Math.max(0, e.minPx + t),
188
+ maxPx: e.maxPx === void 0 ? void 0 : Math.max(0, e.maxPx + t)
189
+ });
190
+ }
191
+ function O(e) {
192
+ let t = {}, n = e.px !== void 0, r = e.grow !== void 0, i = ge(e);
193
+ return e.px ? t.px = e.px : e.px === 0 && (t.px = 0), e.grow ? t.grow = e.grow : e.grow === 0 ? t.grow = 0 : !n && !r && i && (t.grow = 1), e.minPx && e.minPx > S(e.px) && (t.minPx = e.minPx), e.maxPx !== void 0 && (S(t.grow) || e.maxPx < S(e.px)) && (t.maxPx = e.maxPx), t;
194
+ }
195
+ //#endregion
196
+ //#region ../core/src/view/layout/padding.js
197
+ var k = class e {
198
+ constructor(e, t, n, r) {
199
+ this.top = e || 0, this.right = t || 0, this.bottom = n || 0, this.left = r || 0;
200
+ }
201
+ get width() {
202
+ return this.left + this.right;
203
+ }
204
+ get height() {
205
+ return this.top + this.bottom;
206
+ }
207
+ expand(t) {
208
+ return t <= 0 ? this : new e(this.top + t, this.right + t, this.bottom + t, this.left + t);
209
+ }
210
+ add(t) {
211
+ return new e(this.top + t.top, this.right + t.right, this.bottom + t.bottom, this.left + t.left);
212
+ }
213
+ subtract(t) {
214
+ return new e(this.top - t.top, this.right - t.right, this.bottom - t.bottom, this.left - t.left);
215
+ }
216
+ union(t) {
217
+ return new e(Math.max(this.top, t.top), Math.max(this.right, t.right), Math.max(this.bottom, t.bottom), Math.max(this.left, t.left));
218
+ }
219
+ getHorizontal() {
220
+ return new e(0, this.right, 0, this.left);
221
+ }
222
+ getVertical() {
223
+ return new e(this.top, 0, this.bottom, 0);
224
+ }
225
+ get horizontalTotal() {
226
+ return this.left + this.right;
227
+ }
228
+ get verticalTotal() {
229
+ return this.top + this.bottom;
230
+ }
231
+ static createFromConfig(e) {
232
+ return typeof e == "number" ? this.createUniformPadding(e) : e ? this.createFromRecord(e) : A;
233
+ }
234
+ static createFromRecord(t) {
235
+ return new e(t.top, t.right, t.bottom, t.left);
236
+ }
237
+ static zero() {
238
+ return A;
239
+ }
240
+ static createUniformPadding(t) {
241
+ return new e(t, t, t, t);
242
+ }
243
+ };
244
+ function ve(e, t) {
245
+ return t ? new k(t.top === !1 ? 0 : e.top, t.right === !1 ? 0 : e.right, t.bottom === !1 ? 0 : e.bottom, t.left === !1 ? 0 : e.left) : e;
246
+ }
247
+ var A = k.createUniformPadding(0);
248
+ Object.freeze(A);
249
+ //#endregion
250
+ //#region ../core/src/utils/url.js
251
+ var ye = /^([A-Za-z]+:)?\/\//;
252
+ function j(e, t) {
253
+ if (t && ye.test(t)) return t;
254
+ let n = typeof e == "function" ? e() : e;
255
+ if (!n) return t;
256
+ if (!t) return n;
257
+ if (/[#?]/.test(n)) throw Error(`Cannot append to a url with query or hash. Append: ${t}, base: ${n}`);
258
+ return M(n) + t;
259
+ }
260
+ function be(e, t, n = xe()) {
261
+ let r = typeof e == "function" ? e() : e;
262
+ if (!t) return r;
263
+ try {
264
+ if (r) {
265
+ let e = n ? new URL(r, n).href : new URL(r).href;
266
+ return new URL(t, e).href;
267
+ } else if (n) return new URL(t, n).href;
268
+ } catch {}
269
+ return j(r, t);
270
+ }
271
+ function M(e) {
272
+ let t = e.replace(/[^/]*$/, "");
273
+ return t === "" ? void 0 : t.endsWith("://") ? e + "/" : t;
274
+ }
275
+ function xe() {
276
+ if (typeof document < "u" && document.baseURI) return document.baseURI;
277
+ if (typeof window < "u" && window.location?.href) return window.location.href;
278
+ }
279
+ //#endregion
280
+ //#region ../../node_modules/flatqueue/index.js
281
+ var N = class {
282
+ constructor(e = Infinity, t = Float64Array, n = Uint32Array) {
283
+ let r = e !== Infinity;
284
+ this.ids = r ? new n(e) : [], this.values = r ? new t(e) : [], this.capacity = e, this.length = 0;
285
+ }
286
+ clear() {
287
+ this.length = 0;
288
+ }
289
+ push(e, t) {
290
+ if (this.length === this.capacity) throw RangeError("Queue is at capacity.");
291
+ let n = this.length++;
292
+ for (; n > 0;) {
293
+ let e = n - 1 >> 1, r = this.values[e];
294
+ if (t >= r) break;
295
+ this.ids[n] = this.ids[e], this.values[n] = r, n = e;
296
+ }
297
+ this.ids[n] = e, this.values[n] = t;
298
+ }
299
+ pop() {
300
+ if (this.length === 0) return;
301
+ let e = this.ids, t = this.values, n = e[0], r = --this.length;
302
+ if (r > 0) {
303
+ let n = e[r], i = t[r], a = 0, o = r >> 1;
304
+ for (; a < o;) {
305
+ let n = (a << 1) + 1, o = n + 1, s = n + (o < r & +(t[o] < t[n]));
306
+ if (t[s] >= i) break;
307
+ e[a] = e[s], t[a] = t[s], a = s;
308
+ }
309
+ e[a] = n, t[a] = i;
310
+ }
311
+ return n;
312
+ }
313
+ peek() {
314
+ return this.length > 0 ? this.ids[0] : void 0;
315
+ }
316
+ peekValue() {
317
+ return this.length > 0 ? this.values[0] : void 0;
318
+ }
319
+ shrink() {
320
+ Array.isArray(this.ids) && (this.ids.length = this.length), Array.isArray(this.values) && (this.values.length = this.length);
321
+ }
322
+ }, P = Symbol("runtimeNode"), Se = 1e6;
323
+ function Ce(e) {
324
+ return e ? (t, n) => e.addDisposer(t, n) : () => () => void 0;
325
+ }
326
+ function we(e, t) {
327
+ let n = {
328
+ id: e.id,
329
+ name: e.name,
330
+ kind: e.kind,
331
+ get() {
332
+ return e.value;
333
+ },
334
+ subscribe(t) {
335
+ return e.listeners.add(t), () => {
336
+ e.listeners.delete(t);
337
+ };
338
+ }
339
+ };
340
+ return Object.defineProperty(n, P, {
341
+ enumerable: !1,
342
+ configurable: !1,
343
+ writable: !1,
344
+ value: e
345
+ }), t ? Object.assign(n, { set(e) {
346
+ t(e);
347
+ } }) : n;
348
+ }
349
+ function Te(e) {
350
+ let t = e[P];
351
+ if (!t) throw Error("ParamRef is not bound to this graph runtime. Expected runtime-created ref.");
352
+ return t;
353
+ }
354
+ function Ee(e) {
355
+ return typeof e.rank == "number" ? e.rank : Te(e).rank;
356
+ }
357
+ function De(e) {
358
+ for (let t of e) t();
359
+ }
360
+ var Oe = class {
361
+ #e = 1;
362
+ #t = 1;
363
+ #n = 0;
364
+ #r = 0;
365
+ #i = !1;
366
+ #a = !1;
367
+ #o = !1;
368
+ #s = 0;
369
+ #c = !1;
370
+ #l = /* @__PURE__ */ new Map();
371
+ #u = /* @__PURE__ */ new Map();
372
+ #d = /* @__PURE__ */ new Set();
373
+ #f = /* @__PURE__ */ new Set();
374
+ #p = new N();
375
+ #m = new N();
376
+ #h = /* @__PURE__ */ new Set();
377
+ #g;
378
+ constructor(e = {}) {
379
+ this.#g = Ce(e.lifecycleRegistry);
380
+ }
381
+ createWritable(e, t, n, r, i = {}) {
382
+ let a = "n" + this.#e++, o = i.notify ?? !0, s = {
383
+ id: a,
384
+ name: t,
385
+ kind: n,
386
+ value: r,
387
+ rank: 0,
388
+ disposed: !1,
389
+ listeners: /* @__PURE__ */ new Set(),
390
+ subscribe(e) {
391
+ return s.listeners.add(e), () => {
392
+ s.listeners.delete(e);
393
+ };
394
+ }
395
+ }, c = (e) => {
396
+ if (s.disposed) throw Error("Cannot set disposed parameter \"" + t + "\" (" + a + ").");
397
+ e !== s.value && (s.value = e, o && this.#v(s.listeners));
398
+ }, l = () => {
399
+ s.disposed = !0, s.listeners.clear(), u();
400
+ }, u = this.#g(e, l);
401
+ return Object.assign(we(s, c), { dispose: l });
402
+ }
403
+ computed(e, t, n, r, i = {}) {
404
+ return this.#_(e, t, n, r, i);
405
+ }
406
+ operation(e, t, n, r, i, a = {}) {
407
+ return this.#_(e, t, n, r, a, i);
408
+ }
409
+ #_(e, t, n, r, i, a) {
410
+ let o = this.#b(() => s.dependencies), s = {
411
+ id: "n" + this.#e++,
412
+ name: t,
413
+ kind: "derived",
414
+ get rank() {
415
+ return o();
416
+ },
417
+ dependencies: n,
418
+ value: r(),
419
+ disposed: !1,
420
+ listeners: /* @__PURE__ */ new Set(),
421
+ fn: r,
422
+ apply: a,
423
+ equals: i.equals ?? ((e, t) => e === t),
424
+ subscribe(e) {
425
+ return s.listeners.add(e), () => {
426
+ s.listeners.delete(e);
427
+ };
428
+ }
429
+ };
430
+ a?.(s.value);
431
+ let c = () => s.dependencies.map((e) => e.subscribe(() => {
432
+ s.disposed || (this.#x(s), e.propagation === "sync" && this.flushNow());
433
+ })), l = c(), u = () => {
434
+ s.disposed || (s.disposed = !0, d(), l.forEach((e) => e()), s.listeners.clear(), this.#d.delete(s));
435
+ }, d = this.#g(e, u);
436
+ return Object.assign(we(s), {
437
+ dispose: u,
438
+ rebind: (e, n) => {
439
+ if (s.disposed) throw Error("Cannot rebind disposed operation: " + t);
440
+ let r = /* @__PURE__ */ new Set(), i = (e) => {
441
+ let n = e[P];
442
+ if (n === s) throw Error("Reactive dependency cycle: " + t);
443
+ if (!r.has(n)) {
444
+ r.add(n);
445
+ for (let e of n?.dependencies ?? []) i(e);
446
+ }
447
+ };
448
+ e.forEach(i), l.forEach((e) => e()), s.dependencies = e, s.fn = n, this.#n++, l = c(), this.#x(s), this.#p.clear();
449
+ for (let e of this.#d) this.#p.push(e, this.#C(e.rank));
450
+ this.#m.clear();
451
+ for (let e of this.#f) this.#m.push(e, this.#C(e.rank));
452
+ }
453
+ });
454
+ }
455
+ effect(e, t, n) {
456
+ let r = this.#b(() => t), i = {
457
+ id: "n" + this.#e++,
458
+ get rank() {
459
+ return r();
460
+ },
461
+ disposed: !1,
462
+ fn: n
463
+ }, a = t.map((e) => e.subscribe(() => {
464
+ i.disposed || (this.#S(i), e.propagation === "sync" && this.flushNow());
465
+ })), o = () => {
466
+ i.disposed || (i.disposed = !0, s(), a.forEach((e) => e()), this.#f.delete(i));
467
+ }, s = this.#g(e, o);
468
+ return o;
469
+ }
470
+ runInTransaction(e) {
471
+ this.#r += 1;
472
+ try {
473
+ return e();
474
+ } finally {
475
+ --this.#r, this.#r === 0 && (this.#i ? (this.#i = !1, this.flushNow()) : this.#w());
476
+ }
477
+ }
478
+ flushNow({ afterTransaction: e = !1 } = {}) {
479
+ if (e && this.#r > 0 && (this.#i = !0), this.#s > 0) {
480
+ this.#c = !0;
481
+ return;
482
+ }
483
+ if (this.#r > 0 || this.#o) return;
484
+ this.#a = !1, this.#o = !0;
485
+ let t;
486
+ try {
487
+ for (; this.#p.length || this.#l.size || this.#m.length;) {
488
+ for (; this.#p.length;) {
489
+ let e = this.#p.pop();
490
+ if (this.#d.delete(e), e.disposed) continue;
491
+ this.#y(e, e.name);
492
+ let t, n;
493
+ try {
494
+ t = e.fn(), n = !e.equals(t, e.value), n && e.apply?.(t);
495
+ } catch (t) {
496
+ throw this.#x(e), t;
497
+ }
498
+ n && (e.value = t, this.#v(e.listeners));
499
+ }
500
+ if (this.#l.size) {
501
+ let e = Infinity, n;
502
+ for (let [t, { rank: r }] of this.#l) r < e && (n = t, e = r);
503
+ let r = /* @__PURE__ */ new Set();
504
+ for (;;) {
505
+ if (r.has(n)) throw Error("Cyclic streaming publication dependencies");
506
+ r.add(n);
507
+ let e;
508
+ for (let t of this.#l.get(n).prerequisites?.() ?? []) if (this.#l.has(t)) {
509
+ e = t;
510
+ break;
511
+ }
512
+ if (!e) break;
513
+ n = e;
514
+ }
515
+ t = this.#l.get(n).onError, this.#l.delete(n), this.#y(n, "streaming update"), n(), t = void 0;
516
+ } else if (this.#m.length) {
517
+ let e = this.#m.pop();
518
+ this.#f.delete(e), e.disposed || (this.#y(e, "effect " + e.id), e.fn());
519
+ }
520
+ }
521
+ } catch (e) {
522
+ let n = Array.from(this.#l.values());
523
+ this.#l.clear(), t?.(e);
524
+ for (let t of n) t.onError?.(e);
525
+ for (let t of this.#h) t.reject(e);
526
+ throw this.#h.clear(), e;
527
+ } finally {
528
+ this.#u.clear(), this.#o = !1, this.#E();
529
+ }
530
+ }
531
+ requestUpdate(e, t = 0, n, r) {
532
+ this.#l.set(e, {
533
+ rank: t,
534
+ onError: n,
535
+ prerequisites: r
536
+ }), this.#w();
537
+ }
538
+ cancelUpdate(e) {
539
+ this.#l.delete(e);
540
+ }
541
+ #v(e) {
542
+ this.#s++;
543
+ try {
544
+ De(e);
545
+ } finally {
546
+ this.#s--, !this.#s && this.#c && (this.#c = !1, this.flushNow());
547
+ }
548
+ }
549
+ #y(e, t) {
550
+ let n = (this.#u.get(e) ?? 0) + 1;
551
+ if (n > 100) throw Error("Reactive propagation did not settle: " + t);
552
+ this.#u.set(e, n);
553
+ }
554
+ whenPropagated(e = {}) {
555
+ if (this.#T()) return Promise.resolve();
556
+ let { signal: t, timeoutMs: n } = e;
557
+ return t?.aborted ? Promise.reject(/* @__PURE__ */ Error("whenPropagated aborted")) : new Promise((e, r) => {
558
+ let i, a = () => {
559
+ this.#h.delete(o), t?.removeEventListener("abort", s), i !== void 0 && clearTimeout(i);
560
+ }, o = {
561
+ resolve: () => {
562
+ a(), e();
563
+ },
564
+ reject: (e) => {
565
+ a(), r(e);
566
+ }
567
+ }, s = () => o.reject(/* @__PURE__ */ Error("whenPropagated aborted"));
568
+ t?.addEventListener("abort", s, { once: !0 }), n != null && (i = setTimeout(() => o.reject(/* @__PURE__ */ Error("whenPropagated timeout after " + n + " ms")), n)), this.#h.add(o);
569
+ });
570
+ }
571
+ #b(e) {
572
+ let t = -1, n = 0;
573
+ return () => (t !== this.#n && (n = 1 + e().reduce((e, t) => Math.max(e, Ee(t)), 0), t = this.#n), n);
574
+ }
575
+ #x(e) {
576
+ if (this.#d.has(e)) {
577
+ this.#w();
578
+ return;
579
+ }
580
+ this.#d.add(e), this.#p.push(e, this.#C(e.rank)), this.#w();
581
+ }
582
+ #S(e) {
583
+ if (this.#f.has(e)) {
584
+ this.#w();
585
+ return;
586
+ }
587
+ this.#f.add(e), this.#m.push(e, this.#C(e.rank)), this.#w();
588
+ }
589
+ #C(e) {
590
+ let t = this.#t % Se;
591
+ return this.#t += 1, e * Se + t;
592
+ }
593
+ #w() {
594
+ this.#r > 0 || this.#a || this.#o || (this.#a = !0, queueMicrotask(() => {
595
+ this.#a && this.flushNow();
596
+ }));
597
+ }
598
+ #T() {
599
+ return this.#r === 0 && !this.#a && !this.#o && this.#p.length === 0 && this.#m.length === 0 && this.#d.size === 0 && this.#f.size === 0 && this.#l.size === 0;
600
+ }
601
+ #E() {
602
+ if (this.#T()) {
603
+ for (let e of this.#h) e.resolve();
604
+ this.#h.clear();
605
+ }
606
+ }
607
+ }, ke = class {
608
+ #e = 1;
609
+ #t = /* @__PURE__ */ new Map();
610
+ createOwner(e, t) {
611
+ let n = e + ":" + t + ":" + this.#e++;
612
+ return this.#t.set(n, /* @__PURE__ */ new Set()), n;
613
+ }
614
+ addDisposer(e, t) {
615
+ let n = this.#t.get(e);
616
+ if (!n) throw Error("Unknown owner: " + e);
617
+ return n.add(t), () => {
618
+ n.delete(t);
619
+ };
620
+ }
621
+ disposeOwner(e) {
622
+ let t = this.#t.get(e);
623
+ if (t) {
624
+ for (let e of t) e();
625
+ t.clear(), this.#t.delete(e);
626
+ }
627
+ }
628
+ }, Ae = class {
629
+ #e = 1;
630
+ #t = /* @__PURE__ */ new Map();
631
+ createRootScope(e) {
632
+ let t = "scope:" + this.#e++;
633
+ return this.#t.set(t, {
634
+ params: /* @__PURE__ */ new Map(),
635
+ initializers: /* @__PURE__ */ new Map(),
636
+ ownerId: e
637
+ }), t;
638
+ }
639
+ createChildScope(e, t) {
640
+ if (!this.#t.has(t)) throw Error("Unknown parent scope: " + t);
641
+ let n = "scope:" + this.#e++;
642
+ return this.#t.set(n, {
643
+ parentScope: t,
644
+ params: /* @__PURE__ */ new Map(),
645
+ initializers: /* @__PURE__ */ new Map(),
646
+ ownerId: e
647
+ }), n;
648
+ }
649
+ getOwnerId(e) {
650
+ let t = this.#t.get(e);
651
+ if (!t) throw Error("Unknown scope: " + e);
652
+ return t.ownerId;
653
+ }
654
+ clearScope(e) {
655
+ let t = this.#t.get(e);
656
+ if (!t) throw Error("Unknown scope: " + e);
657
+ t.params.clear(), t.initializers.clear();
658
+ }
659
+ registerInitializer(e, t, n) {
660
+ o(t);
661
+ let r = this.#t.get(e);
662
+ if (!r) throw Error("Unknown scope: " + e);
663
+ if (r.params.has(t) || r.initializers.has(t)) throw Error(`Parameter "${t}" already exists in scope ${e}`);
664
+ r.initializers.set(t, {
665
+ initialize: n,
666
+ initializing: !1
667
+ });
668
+ }
669
+ register(e, t, n) {
670
+ o(t);
671
+ let r = this.#t.get(e);
672
+ if (!r) throw Error("Unknown scope: " + e);
673
+ if (r.params.has(t) || r.initializers.get(t)?.initializing === !1) throw Error("Parameter \"" + t + "\" already exists in scope " + e);
674
+ return r.params.set(t, n), n;
675
+ }
676
+ resolve(e, t) {
677
+ o(t);
678
+ let n = e;
679
+ for (; n;) {
680
+ let e = this.#t.get(n);
681
+ if (!e) throw Error("Unknown scope: " + n);
682
+ let r = e.initializers.get(t);
683
+ if (r) {
684
+ if (r.initializing) throw Error(`Parameter dependency cycle while initializing "${t}" in ${n}.`);
685
+ r.initializing = !0;
686
+ try {
687
+ if (r.initialize(), !e.params.has(t)) throw Error(`Initializer did not register parameter "${t}".`);
688
+ e.initializers.delete(t);
689
+ } finally {
690
+ r.initializing = !1;
691
+ }
692
+ }
693
+ let i = e.params.get(t);
694
+ if (i) return i;
695
+ n = e.parentScope;
696
+ }
697
+ }
698
+ };
699
+ //#endregion
700
+ //#region ../core/src/paramRuntime/expressionCompiler.js
701
+ function je(e, t = {}, n = {}) {
702
+ return f(e, t, n);
703
+ }
704
+ //#endregion
705
+ //#region ../core/src/paramRuntime/expressionRef.js
706
+ function F(e, t, n = {}) {
707
+ let r = {}, i = je(e, r, n), a = /* @__PURE__ */ new Map();
708
+ for (let n of i.globals) {
709
+ if (a.has(n)) continue;
710
+ let i = t(n);
711
+ if (!i) throw Error("Unknown variable \"" + n + "\" in expression: " + e);
712
+ a.set(n, i), Object.defineProperty(r, n, {
713
+ enumerable: !0,
714
+ get() {
715
+ return i.get();
716
+ }
717
+ });
718
+ }
719
+ let o = /* @__PURE__ */ new Set();
720
+ return i.subscribe = (e) => {
721
+ let t = [];
722
+ for (let n of a.values()) t.push(n.subscribe(e));
723
+ for (let n of i.scaleDependencies ?? []) t.push(n.subscribe(e));
724
+ let n = !0, r = () => {
725
+ n && (n = !1, o.delete(r), t.forEach((e) => e()));
726
+ };
727
+ return o.add(r), r;
728
+ }, i.invalidate = () => {
729
+ for (let e of o) e();
730
+ o.clear();
731
+ }, i.identifier = () => i.code + "|" + Array.from(a.values()).map((e) => e.id).concat((i.scaleDependencies ?? []).map((e) => e.id)).join(","), i.dependencies = Array.from(a.values()).concat(i.scaleDependencies ?? []), {
732
+ expression: i,
733
+ dependencies: i.dependencies
734
+ };
735
+ }
736
+ //#endregion
737
+ //#region ../core/src/paramRuntime/paramRuntime.js
738
+ var Me = class {
739
+ #e = new ke();
740
+ #t = new Oe({ lifecycleRegistry: this.#e });
741
+ #n = new Ae();
742
+ createScope(e) {
743
+ let t = this.#e.createOwner("scope", e ?? "root");
744
+ return e ? this.#n.createChildScope(t, e) : this.#n.createRootScope(t);
745
+ }
746
+ disposeScope(e) {
747
+ let t = this.#n.getOwnerId(e);
748
+ this.#e.disposeOwner(t), this.#n.clearScope(e);
749
+ }
750
+ addScopeDisposer(e, t) {
751
+ let n = this.#n.getOwnerId(e);
752
+ this.#e.addDisposer(n, t);
753
+ }
754
+ registerInitializer(e, t, n) {
755
+ this.#n.registerInitializer(e, t, n);
756
+ }
757
+ registerBase(e, t, n, r) {
758
+ let i = this.#n.getOwnerId(e), a = this.#t.createWritable(i, t, "base", n, r);
759
+ return this.#n.register(e, t, a);
760
+ }
761
+ registerSelection(e, t, n, r) {
762
+ let i = this.#n.getOwnerId(e), a = this.#t.createWritable(i, t, "selection", n, r);
763
+ return this.#n.register(e, t, a);
764
+ }
765
+ registerDerived(e, t, n, r) {
766
+ let { expression: i, dependencies: a } = F(n, (t) => this.resolve(r?.expressionScope ?? e, t), r), o = this.#n.getOwnerId(e), s = this.#t.computed(o, t, a, () => i(null));
767
+ return this.#n.register(e, t, s);
768
+ }
769
+ createExpression(e, t, n) {
770
+ let { expression: r } = F(t, (t) => this.resolve(e, t), n);
771
+ return r;
772
+ }
773
+ resolve(e, t) {
774
+ return this.#n.resolve(e, t);
775
+ }
776
+ signal(e, t, n) {
777
+ return this.#t.createWritable(this.#n.getOwnerId(e), t, "base", n);
778
+ }
779
+ computed(e, t, n, r, i) {
780
+ return this.#t.computed(this.#n.getOwnerId(e), t, n, r, i);
781
+ }
782
+ operation(e, t, n, r, i, a) {
783
+ return this.#t.operation(this.#n.getOwnerId(e), t, n, r, i, a);
784
+ }
785
+ effect(e, t, n) {
786
+ return this.#t.effect(this.#n.getOwnerId(e), t, n);
787
+ }
788
+ requestUpdate(e, t = 0, n, r) {
789
+ this.#t.requestUpdate(e, t, n, r);
790
+ }
791
+ cancelUpdate(e) {
792
+ this.#t.cancelUpdate(e);
793
+ }
794
+ runInTransaction(e) {
795
+ return this.#t.runInTransaction(e);
796
+ }
797
+ flushNow(e) {
798
+ this.#t.flushNow(e);
799
+ }
800
+ whenPropagated(e) {
801
+ return this.#t.whenPropagated(e);
802
+ }
803
+ }, Ne = (e) => new Promise((t) => setTimeout(t, e));
804
+ function Pe() {
805
+ return { canceled: !1 };
806
+ }
807
+ function Fe(e) {
808
+ let t = e.requestAnimationFrame || window.requestAnimationFrame, n = e.signal, r = e.cancelToken, i = () => new Promise((i, a) => {
809
+ if (r?.canceled) return i();
810
+ if (n?.aborted) return a("aborted");
811
+ let o = performance.now(), s = o + (e.duration || 1e3), c = typeof e.from == "number" ? e.from : 0, l = typeof e.to == "number" ? e.to : 1, u = e.easingFunction || ((e) => e), d = (e) => (e - o) / (s - o), f = (e) => e * (l - c) + c, p = (e) => Math.max(0, Math.min(1, e)), m = (o) => {
812
+ if (r?.canceled) {
813
+ i();
814
+ return;
815
+ }
816
+ n?.aborted ? a("aborted") : (e.onUpdate(f(u(p(d(o))))), o < s ? t(m) : (e.onUpdate(f(u(1))), i()));
817
+ };
818
+ t(m);
819
+ });
820
+ return e.delay ? r?.canceled ? Promise.resolve() : n?.aborted ? Promise.reject("aborted") : Ne(e.delay).then(i) : i();
821
+ }
822
+ //#endregion
823
+ //#region ../core/src/utils/animator.js
824
+ var Ie = class {
825
+ constructor(e) {
826
+ this._renderCallback = e, this._renderRequested = !1, this._finalized = !1, this._warn = !1, this._animationFrameRequest = void 0, this.transitions = [], this.transitionsEnabled = !0;
827
+ }
828
+ requestTransition(e) {
829
+ this._finalized || (this.cancelTransition(e), this.transitions.push(e), this.requestRender());
830
+ }
831
+ cancelTransition(e) {
832
+ let t = this.transitions.indexOf(e);
833
+ t >= 0 && this.transitions.splice(t, 1);
834
+ }
835
+ requestRender() {
836
+ this._finalized || (this._renderRequested ? this._warn && console.warn("Render already requested!") : (this._renderRequested = !0, this._animationFrameRequest = window.requestAnimationFrame((e) => {
837
+ if (this._animationFrameRequest = void 0, this._finalized) return;
838
+ this._renderRequested = !1;
839
+ let t = this.transitions;
840
+ this.transitions = [];
841
+ let n;
842
+ for (; n = t.shift();) n(e);
843
+ this._finalized || this._renderCallback(e);
844
+ })));
845
+ }
846
+ finalize() {
847
+ this._finalized = !0, this._renderRequested = !1, this.transitions = [], this._animationFrameRequest !== void 0 && (window.cancelAnimationFrame(this._animationFrameRequest), this._animationFrameRequest = void 0);
848
+ }
849
+ transition(e) {
850
+ return Fe({
851
+ requestAnimationFrame: (e) => this.requestTransition(e),
852
+ ...e
853
+ });
854
+ }
855
+ };
856
+ function Le(e, t, n, r, i) {
857
+ let a = 0, o = !0, s = !1, c = structuredClone(i), l = c;
858
+ function u(e, t, n, r) {
859
+ return t + (e - t) * 2 ** (-n / r);
860
+ }
861
+ function d(i) {
862
+ if (s = !1, o) return;
863
+ let d = i - a;
864
+ a = i;
865
+ for (let e of Object.keys(l)) c[e] = u(c[e], l[e], d, n);
866
+ t(c);
867
+ let p = -Infinity;
868
+ for (let e of Object.keys(l)) p = Math.max(p, Math.abs(l[e] - c[e]));
869
+ p < r ? (c = l, t(c), o = !0, p != 0 && e.requestRender()) : f();
870
+ }
871
+ function f() {
872
+ s || (s = !0, e.requestTransition(d));
873
+ }
874
+ function p(n) {
875
+ l = n, e.transitionsEnabled === !1 ? (c = l, o = !0, s = !1, e.cancelTransition(d), t(c)) : o && (o = !1, a = Re(), d(a));
876
+ }
877
+ return p.stop = () => {
878
+ o = !0, s = !1, e.cancelTransition(d);
879
+ }, p.snap = (e) => {
880
+ l = e, c = e, p.stop(), t(c);
881
+ }, p;
882
+ }
883
+ function Re() {
884
+ let e = globalThis.document?.timeline?.currentTime;
885
+ return typeof e == "number" ? e : performance.now();
886
+ }
887
+ //#endregion
888
+ //#region ../core/src/paramRuntime/viewParamRuntime.js
889
+ var ze = class {
890
+ #e;
891
+ #t;
892
+ #n = /* @__PURE__ */ new Map();
893
+ #r = /* @__PURE__ */ new Map();
894
+ #i = /* @__PURE__ */ new Map();
895
+ #a = /* @__PURE__ */ new Map();
896
+ #o;
897
+ #s;
898
+ #c;
899
+ #l;
900
+ #u = !1;
901
+ constructor(e, t, n, r = {}) {
902
+ this.#o = e ?? (() => void 0), this.#s = t ?? (() => void 0), this.#c = n, this.#l = r.snapTransitionedUpdates ?? !1;
903
+ let i = this.#o();
904
+ i ? (this.#e = i.#e, this.#t = this.#e.createScope(i.#t)) : (this.#e = new Me(), this.#t = this.#e.createScope());
905
+ }
906
+ registerParam(e, t = {}) {
907
+ let n = e.name;
908
+ if (o(n), this.#i.has(n)) throw Error("Parameter \"" + n + "\" already registered in this scope.");
909
+ if (Ve(e), t.defer) {
910
+ if (!("expr" in e)) throw Error("Only expression parameters can be deferred.");
911
+ return this.#e.registerInitializer(this.#t, n, () => {
912
+ this.#d(e);
913
+ }), this.#i.set(n, e), () => {
914
+ throw Error("Cannot set derived parameter \"" + n + "\".");
915
+ };
916
+ }
917
+ return this.#d(e);
918
+ }
919
+ registerScopedExpression(e, t, n) {
920
+ if (this.#e !== n.#e) throw Error("Scoped expressions must share a parameter runtime.");
921
+ if (this.#i.has(e)) throw Error("Parameter \"" + e + "\" already registered in this scope.");
922
+ this.#e.registerInitializer(this.#t, e, () => {
923
+ let r = this.#e.registerDerived(this.#t, e, t, {
924
+ expressionScope: n.#t,
925
+ resolveScaleResolution: n.#s
926
+ });
927
+ this.#r.set(e, r);
928
+ }), this.#i.set(e, {
929
+ name: e,
930
+ expr: t
931
+ });
932
+ }
933
+ #d(e) {
934
+ let t = e.name, n, i;
935
+ if (e.push == "outer") {
936
+ let a = this.findRuntimeForParam(t);
937
+ if (!a) throw Error(`Parameter "${t}" not found in outer scope!`);
938
+ let o = a.paramConfigs.get(t);
939
+ if (!o) throw Error(`Outer parameter "${t}" exists as a value but has no registered config.`);
940
+ if ("expr" in o || "select" in o || "ruler" in o) throw Error(`The outer parameter "${t}" must not have expr, select, or ruler properties!`);
941
+ n = (e) => {
942
+ a.setValue(t, e);
943
+ }, this.#n.set(t, n), "ruler" in e && (i = r(e, this), n(i));
944
+ } else if ("value" in e) i = r(e, this), n = "transition" in e ? this.#p(t, i, e.transition) : this.#f(t, i);
945
+ else if ("expr" in e) {
946
+ if ("transition" in e) this.#m(t, e.expr, e.transition);
947
+ else {
948
+ let n = this.#e.registerDerived(this.#t, t, e.expr, { resolveScaleResolution: this.#s });
949
+ this.#r.set(t, n);
950
+ }
951
+ n = () => {
952
+ throw Error("Cannot set derived parameter \"" + t + "\".");
953
+ };
954
+ } else i = r(e, this), n = this.#f(t, i);
955
+ if ("select" in e) {
956
+ if (i ??= r(e, this), !this.#n.has(t)) {
957
+ let e = this.#e.registerSelection(this.#t, t, i);
958
+ this.#r.set(t, e), this.#n.set(t, (t) => {
959
+ e.set(t), this.#e.flushNow();
960
+ }), n = this.#n.get(t);
961
+ }
962
+ n(i);
963
+ }
964
+ return this.#i.set(t, e), n;
965
+ }
966
+ allocateSetter(e, t, n = !1) {
967
+ if (o(e), this.#n.has(e)) throw Error("Setter already allocated for parameter: " + e);
968
+ let r = this.#e.registerBase(this.#t, e, t, { notify: !n });
969
+ this.#r.set(e, r);
970
+ let i = (e) => {
971
+ r.set(e), this.#e.flushNow();
972
+ };
973
+ return this.#n.set(e, i), i;
974
+ }
975
+ setValue(e, t, n) {
976
+ o(e);
977
+ let r = this.#n.get(e);
978
+ if (!r) throw Error("Writable parameter not found in this scope: " + e);
979
+ r(t, n);
980
+ }
981
+ getValue(e) {
982
+ return !this.#r.has(e) && this.hasLocalParam(e) && this.#e.resolve(this.#t, e), this.#r.get(e)?.get();
983
+ }
984
+ getTargetValue(e) {
985
+ return o(e), this.#a.get(e)?.target ?? this.getValue(e);
986
+ }
987
+ subscribe(e, t) {
988
+ o(e);
989
+ let n = this.findRuntimeForParam(e);
990
+ if (!n) throw Error("Parameter not found: " + e);
991
+ let r = n.#e.resolve(n.#t, e);
992
+ if (!r) throw Error("Parameter found without local reference: " + e);
993
+ return r.subscribe(t);
994
+ }
995
+ findValue(e) {
996
+ return this.findRuntimeForParam(e)?.getValue(e);
997
+ }
998
+ findTargetValue(e) {
999
+ return this.findRuntimeForParam(e)?.getTargetValue(e);
1000
+ }
1001
+ get paramConfigs() {
1002
+ return this.#i;
1003
+ }
1004
+ hasLocalParam(e) {
1005
+ o(e);
1006
+ let t = this.#i.get(e);
1007
+ return this.#r.has(e) || t !== void 0 && "expr" in t;
1008
+ }
1009
+ isPendingParam(e) {
1010
+ let t = this.findRuntimeForParam(e);
1011
+ return t !== void 0 && !t.#r.has(e);
1012
+ }
1013
+ hasConfiguredParamInScopeChain(e) {
1014
+ return o(e), this.#i.has(e) ? !0 : this.#o()?.hasConfiguredParamInScopeChain(e) ?? !1;
1015
+ }
1016
+ findRuntimeForParam(e) {
1017
+ return this.hasLocalParam(e) ? this : this.#o()?.findRuntimeForParam(e);
1018
+ }
1019
+ getDebugState() {
1020
+ let e = [];
1021
+ for (let [t, n] of this.#r) {
1022
+ let r = this.#i.get(t);
1023
+ e.push({
1024
+ name: t,
1025
+ kind: Be(r),
1026
+ value: n.get(),
1027
+ writable: this.#n.has(t),
1028
+ configured: !!r,
1029
+ config: r ? structuredClone(r) : void 0,
1030
+ target: this.#a.get(t)?.target
1031
+ });
1032
+ }
1033
+ return {
1034
+ scopeId: this.#t,
1035
+ disposed: this.#u,
1036
+ params: e
1037
+ };
1038
+ }
1039
+ createExpression(e) {
1040
+ return this.#e.createExpression(this.#t, e, { resolveScaleResolution: this.#s });
1041
+ }
1042
+ watchExpression(e, t, n = {}) {
1043
+ let r = this.createExpression(e), i = r.subscribe(t);
1044
+ return (n.scopeOwned ?? !0) && this.#e.addScopeDisposer(this.#t, i), n.registerDisposer?.(i), r;
1045
+ }
1046
+ signal(e, t) {
1047
+ return this.#e.signal(this.#t, e, t);
1048
+ }
1049
+ computed(e, t, n, r) {
1050
+ return this.#e.computed(this.#t, e, t, n, r);
1051
+ }
1052
+ operation(e, t, n, r, i) {
1053
+ return this.#e.operation(this.#t, e, t, n, r, i);
1054
+ }
1055
+ effect(e, t) {
1056
+ return this.#e.effect(this.#t, e, t);
1057
+ }
1058
+ get updateScheduler() {
1059
+ return this.#e;
1060
+ }
1061
+ requestUpdate(e, t = 0, n, r) {
1062
+ this.#e.requestUpdate(e, t, n, r);
1063
+ }
1064
+ cancelUpdate(e) {
1065
+ this.#e.cancelUpdate(e);
1066
+ }
1067
+ #f(e, t) {
1068
+ let n = this.#e.registerBase(this.#t, e, t);
1069
+ this.#r.set(e, n);
1070
+ let r = (e) => {
1071
+ n.set(e), this.#e.flushNow();
1072
+ };
1073
+ return this.#n.set(e, r), r;
1074
+ }
1075
+ #p(e, t, n) {
1076
+ let r = this.#h(e, t, n), i = (t, n) => {
1077
+ this.#g(e, r, t, n);
1078
+ };
1079
+ return this.#n.set(e, i), i;
1080
+ }
1081
+ #m(e, t, n) {
1082
+ let r = this.createExpression(t), i = this.#h(e, r(null), n), a = r.subscribe(() => {
1083
+ this.#g(e, i, r(null), { animate: !this.#l });
1084
+ });
1085
+ this.#e.addScopeDisposer(this.#t, a);
1086
+ }
1087
+ #h(e, t, n) {
1088
+ let r = He(e, t), i = this.#e.registerBase(this.#t, e, r);
1089
+ this.#r.set(e, i);
1090
+ let a = this.#c;
1091
+ if (!a) throw Error(`The parameter "${e}" uses transition but no animator is available.`);
1092
+ let o = Le(a, ({ value: e }) => {
1093
+ i.set(e), this.#e.flushNow();
1094
+ }, n.halfLife ?? 80, n.epsilon ?? .01, { value: i.get() }), s = {
1095
+ target: i.get(),
1096
+ smoother: o,
1097
+ dispose: () => {
1098
+ o.stop(), this.#a.delete(e);
1099
+ }
1100
+ };
1101
+ return this.#a.set(e, s), this.#e.addScopeDisposer(this.#t, s.dispose), s;
1102
+ }
1103
+ #g(e, t, n, r = {}) {
1104
+ let i = He(e, n);
1105
+ t.target = i, r.animate === !1 ? t.smoother.snap({ value: i }) : t.smoother({ value: i });
1106
+ }
1107
+ evaluateAndGet(e) {
1108
+ return this.createExpression(e)();
1109
+ }
1110
+ runInTransaction(e) {
1111
+ return this.#e.runInTransaction(e);
1112
+ }
1113
+ flushNow(e) {
1114
+ this.#e.flushNow(e);
1115
+ }
1116
+ whenPropagated(e) {
1117
+ return this.#e.whenPropagated(e);
1118
+ }
1119
+ finalizeInitialization() {
1120
+ this.#l = !1;
1121
+ }
1122
+ dispose() {
1123
+ this.#u || (this.#u = !0, this.#e.disposeScope(this.#t), this.#n.clear(), this.#r.clear(), this.#i.clear(), this.#a.clear());
1124
+ }
1125
+ hasPointSelections() {
1126
+ for (let e of this.#i.values()) if (i(e)) {
1127
+ let t = e.select;
1128
+ if (p(t)) {
1129
+ if (t == "point") return !0;
1130
+ } else if (t.type == "point") return !0;
1131
+ }
1132
+ return !1;
1133
+ }
1134
+ };
1135
+ function Be(e) {
1136
+ return e ? e.push === "outer" ? "push" : "select" in e ? "selection" : "ruler" in e ? "ruler" : "expr" in e ? "derived" : "base" : "auto";
1137
+ }
1138
+ function Ve(e) {
1139
+ let t = e.name;
1140
+ if ("value" in e && "expr" in e) throw Error(`The parameter "${t}" must not have both value and expr properties!`);
1141
+ if ("expr" in e && "bind" in e) throw Error(`The parameter "${t}" must not have both expr and bind properties!`);
1142
+ if (!("transition" in e)) return;
1143
+ if ("select" in e || "ruler" in e || e.push === "outer") throw Error(`The parameter "${t}" must not use transition with select, ruler, or push.`);
1144
+ if (!("value" in e || "expr" in e)) throw Error(`The transitioned parameter "${t}" must have a value or expr property.`);
1145
+ let n = e.transition;
1146
+ if (!n) throw Error(`The parameter "${t}" must have a transition configuration.`);
1147
+ if (n.type !== "lerp") throw Error(`Unsupported transition type for parameter "${t}": ${n.type}`);
1148
+ if (n.halfLife != null && (!Number.isFinite(n.halfLife) || n.halfLife <= 0)) throw Error(`The transition halfLife for parameter "${t}" must be a positive finite number.`);
1149
+ if (n.epsilon != null && (!Number.isFinite(n.epsilon) || n.epsilon < 0)) throw Error(`The transition epsilon for parameter "${t}" must be a non-negative finite number.`);
1150
+ }
1151
+ function He(e, t) {
1152
+ if (typeof t != "number" || !Number.isFinite(t)) throw Error(`Transitioned parameter "${e}" must have a finite numeric value.`);
1153
+ return t;
1154
+ }
1155
+ //#endregion
1156
+ //#region ../core/src/utils/addBaseUrl.js
1157
+ function Ue(e, t) {
1158
+ return !t || /^(data:|([A-Za-z]+:)?\/\/)/.test(e) || e.startsWith("/") ? e : (t.endsWith("/") || (t += "/"), t + e);
1159
+ }
1160
+ function We(e) {
1161
+ if (!e) return e;
1162
+ if (/[?#]/.test(e)) throw Error(`Invalid base URL: ${e} - cannot contain query or hash.`);
1163
+ return e.endsWith("/") ? e : e + "/";
1164
+ }
1165
+ //#endregion
1166
+ //#region ../core/src/config/mergeConfig.js
1167
+ function I(e) {
1168
+ return u(e) && !Array.isArray(e);
1169
+ }
1170
+ function Ge(e) {
1171
+ let t = {};
1172
+ for (let [n, r] of Object.entries(e)) t[n] = L(r);
1173
+ return t;
1174
+ }
1175
+ function L(e) {
1176
+ return Array.isArray(e) ? e.map(L) : I(e) ? Ge(e) : e;
1177
+ }
1178
+ function R(e, t) {
1179
+ for (let [n, r] of Object.entries(t)) {
1180
+ if (r === void 0) continue;
1181
+ let t = e[n];
1182
+ I(r) && I(t) ? R(t, r) : e[n] = L(r);
1183
+ }
1184
+ return e;
1185
+ }
1186
+ function z(e) {
1187
+ let t = {};
1188
+ for (let n of e) n && R(t, n);
1189
+ return t;
1190
+ }
1191
+ //#endregion
1192
+ //#region ../core/src/view/viewChrome.js
1193
+ var B = /* @__PURE__ */ new WeakMap();
1194
+ function Ke(e, t) {
1195
+ B.set(e, t);
1196
+ }
1197
+ function qe(e) {
1198
+ return B.get(e);
1199
+ }
1200
+ function V(e) {
1201
+ return B.has(e);
1202
+ }
1203
+ function H(e) {
1204
+ let t = e;
1205
+ for (; t;) {
1206
+ let n = B.get(t);
1207
+ if (n === "excludeSubtree" || t === e && n === "exclude") return !0;
1208
+ t = t.layoutParent;
1209
+ }
1210
+ return !1;
1211
+ }
1212
+ //#endregion
1213
+ //#region ../core/src/view/postScaleParams.js
1214
+ var U = /* @__PURE__ */ new WeakMap();
1215
+ function Je(e, t) {
1216
+ U.set(e, t);
1217
+ }
1218
+ function Ye(e) {
1219
+ return U.get(e);
1220
+ }
1221
+ //#endregion
1222
+ //#region ../core/src/data/namedDataScope.js
1223
+ var W = class {
1224
+ name;
1225
+ owner;
1226
+ getDefaultData;
1227
+ #e;
1228
+ #t = !1;
1229
+ #n = 0;
1230
+ #r = !1;
1231
+ constructor(e, t, n) {
1232
+ this.name = e, this.owner = t, this.getDefaultData = n;
1233
+ }
1234
+ get disposed() {
1235
+ return this.#r;
1236
+ }
1237
+ beginUpdate() {
1238
+ if (this.#r) throw Error(`Named dataset "${this.name}" has been disposed.`);
1239
+ return ++this.#n;
1240
+ }
1241
+ isCurrentUpdate(e) {
1242
+ return !this.#r && e === this.#n;
1243
+ }
1244
+ getData() {
1245
+ if (this.#r) throw Error(`Named dataset "${this.name}" has been disposed.`);
1246
+ let e = this.#t ? this.#e : this.getDefaultData();
1247
+ if (e === void 0) return [];
1248
+ if (!Array.isArray(e)) throw Error(`Named data "${this.name}" is not an array!`);
1249
+ return e;
1250
+ }
1251
+ setData(e) {
1252
+ if (!Array.isArray(e)) throw Error(`Named data "${this.name}" is not an array!`);
1253
+ this.#e = e, this.#t = !0;
1254
+ }
1255
+ resetData() {
1256
+ this.#e = void 0, this.#t = !1;
1257
+ }
1258
+ dispose() {
1259
+ this.#e = void 0, this.#t = !1, this.#n++, this.#r = !0;
1260
+ }
1261
+ }, Xe = class {
1262
+ view;
1263
+ #e = /* @__PURE__ */ new Map();
1264
+ #t = /* @__PURE__ */ new Map();
1265
+ constructor(e) {
1266
+ this.view = e;
1267
+ for (let [t, n] of Object.entries(e.spec.datasets ?? {})) this.#e.set(t, new W(t, e, () => n));
1268
+ }
1269
+ getLocalBinding(e) {
1270
+ return this.#e.get(e);
1271
+ }
1272
+ findDeclaredBinding(e) {
1273
+ return this.#e.get(e) || this.view.dataParent?.namedDataScope.findDeclaredBinding(e);
1274
+ }
1275
+ resolve(e) {
1276
+ let t = this.#e.get(e);
1277
+ if (t) return t;
1278
+ let n = this.view.dataParent?.namedDataScope;
1279
+ if (n) return n.resolve(e);
1280
+ let r = this.#t.get(e);
1281
+ return r || (r = new W(e, void 0, () => this.view.context.getNamedDataFromProvider(e)), this.#t.set(e, r)), r;
1282
+ }
1283
+ dispose() {
1284
+ for (let e of this.#e.values()) e.dispose();
1285
+ this.#e.clear();
1286
+ for (let e of this.#t.values()) e.dispose();
1287
+ this.#t.clear();
1288
+ }
1289
+ }, G = "VISIT_SKIP", K = "VISIT_STOP", q = (e) => e, Ze = class {
1290
+ spec;
1291
+ namedDataScope;
1292
+ #e;
1293
+ #t;
1294
+ #n = {};
1295
+ #r = {};
1296
+ #i = {};
1297
+ #a;
1298
+ #o;
1299
+ #s = !1;
1300
+ #c = !1;
1301
+ #l = void 0;
1302
+ #u = !1;
1303
+ #d = [];
1304
+ opacityFunction = q;
1305
+ #f = [];
1306
+ #p = "none";
1307
+ #m = /* @__PURE__ */ new Map();
1308
+ facetCoords = new ae([], JSON.stringify);
1309
+ constructor(e, t, n, r, i, a = {}) {
1310
+ if (!e) throw Error("View spec must be defined!");
1311
+ if (this.context = t, this.layoutParent = n, this.dataParent = r, this.#t = i, this.spec = e, this.namedDataScope = new Xe(this), r && e.theme !== void 0) throw Error("\"theme\" is only supported at the root specification. Use \"config\" and \"style\" for subtree customization.");
1312
+ let o = r ? r.getConfigScopes() : [t.getBaseConfig()], s = e.config;
1313
+ this.#e = [...o, s].filter((e) => !!e), this.resolutions = {
1314
+ scale: {},
1315
+ axis: {},
1316
+ legend: {}
1317
+ }, ne(this), this.options = {
1318
+ inheritEncoding: !1,
1319
+ layoutSizeParams: "own",
1320
+ ...a
1321
+ }, this.flowHandle = void 0, this.needsAxes = {
1322
+ x: !1,
1323
+ y: !1
1324
+ }, this.paramRuntime = new ze(() => this.dataParent?.paramRuntime, (e) => this.getScaleResolution(e), t.animator, { snapTransitionedUpdates: !0 });
1325
+ let l = [...e.params ?? [], ...Ye(e) ?? []];
1326
+ for (let e of l) {
1327
+ if ("expr" in e) {
1328
+ let { usesScaleHelper: t, globals: n } = c(e.expr), r = n.some((e) => this.paramRuntime.isPendingParam(e));
1329
+ if (t || r) {
1330
+ this.paramRuntime.registerParam(e, { defer: !0 }), this.#d.push(e.name);
1331
+ continue;
1332
+ }
1333
+ }
1334
+ this.paramRuntime.registerParam(e);
1335
+ }
1336
+ this.options.layoutSizeParams !== "inherit" && (this.#a = this.#h("width"), this.#o = this.#h("height"));
1337
+ }
1338
+ #h(e) {
1339
+ if (!(this.paramRuntime.hasLocalParam(e) || this.options.layoutSizeParams != "force" && this.paramRuntime.hasConfiguredParamInScopeChain(e))) return this.paramRuntime.allocateSetter(e, 0);
1340
+ }
1341
+ get name() {
1342
+ return this.spec.name ?? this.#t;
1343
+ }
1344
+ get explicitName() {
1345
+ return this.spec.name;
1346
+ }
1347
+ getZindex() {
1348
+ return this.spec.zindex ?? 0;
1349
+ }
1350
+ get defaultName() {
1351
+ return this.#t;
1352
+ }
1353
+ getConfig() {
1354
+ return z(this.#e);
1355
+ }
1356
+ getCursorSpec() {
1357
+ return this.spec.cursor;
1358
+ }
1359
+ getCursor() {
1360
+ let t = this.getCursorSpec();
1361
+ return e(t) ? this.paramRuntime.evaluateAndGet(t.expr) : t;
1362
+ }
1363
+ watchCursor(t, n) {
1364
+ let r = this.getCursorSpec();
1365
+ e(r) && this.paramRuntime.watchExpression(r.expr, t, {
1366
+ scopeOwned: !1,
1367
+ registerDisposer: n
1368
+ });
1369
+ }
1370
+ getConfigScopes() {
1371
+ return this.#e.slice();
1372
+ }
1373
+ get coords() {
1374
+ return this.facetCoords.values().next().value;
1375
+ }
1376
+ getPadding() {
1377
+ return this._cache("size/padding", () => k.createFromConfig(this.spec.padding));
1378
+ }
1379
+ getOverhang() {
1380
+ return k.zero();
1381
+ }
1382
+ isScrollable() {
1383
+ return this.spec.viewportWidth != null || this.spec.viewportHeight != null;
1384
+ }
1385
+ getSize() {
1386
+ return this._cache("size/size", () => this.isConfiguredVisible() ? new y(this.#g("width"), this.#g("height")) : de);
1387
+ }
1388
+ getViewportSize() {
1389
+ if (!this.isScrollable()) return this.getSize();
1390
+ if (!this.isConfiguredVisible()) return de;
1391
+ let e = this.getSize();
1392
+ return new y(this.#g("viewportWidth") ?? e.width, this.#g("viewportHeight") ?? e.height);
1393
+ }
1394
+ #g(e) {
1395
+ let { value: t, implicit: n } = this.#_(e), r = this.resolveSizeValue(e, t), i = J(r), a = e == "viewportWidth" || e == "viewportHeight";
1396
+ if (i) {
1397
+ if (a) throw new _(`Cannot use step-based size with "${e}"!`, this);
1398
+ let t = this.#x(e, r), i = this.getScaleResolution(e == "width" ? "x" : "y")?.getScale();
1399
+ if (i) {
1400
+ let n;
1401
+ if (v(i.type)) n = i.domain().length;
1402
+ else if (["locus", "index"].includes(i.type)) {
1403
+ let e = i.domain();
1404
+ n = ee(e) - e[0];
1405
+ } else throw new _(`Cannot use step-based size with "${i.type}" scale!`, this);
1406
+ let a = i;
1407
+ n = ie(n, a.paddingInner(), a.paddingOuter());
1408
+ let o = e == "width" ? "xOffset" : "yOffset", s = this.getScaleResolution(o)?.getScale(), c = r.for ?? (s && v(s.type) ? "offset" : "position"), l = t;
1409
+ if (c == "offset") {
1410
+ if (!s || !v(s.type)) throw new _(`Cannot use ${e}.step.for = "offset" without a discrete ${o} scale!`, this);
1411
+ let t = s, n = ie(s.domain().length, t.paddingInner(), t.paddingOuter());
1412
+ l *= n / (1 - a.paddingInner());
1413
+ }
1414
+ return {
1415
+ px: n * l,
1416
+ grow: 0
1417
+ };
1418
+ } else if (n) return {
1419
+ px: t,
1420
+ grow: 0
1421
+ };
1422
+ else throw new _(`Cannot use step-based size with "${e}"!`, this);
1423
+ } else return (r && C(r)) ?? (a ? void 0 : {
1424
+ px: 0,
1425
+ grow: 1
1426
+ });
1427
+ }
1428
+ #_(e) {
1429
+ let t = this.spec[e];
1430
+ return t != null || e == "viewportWidth" || e == "viewportHeight" ? {
1431
+ value: t,
1432
+ implicit: !1
1433
+ } : {
1434
+ value: this.#v(e),
1435
+ implicit: !0
1436
+ };
1437
+ }
1438
+ #v(e) {
1439
+ if (H(this)) return;
1440
+ let t = this.getConfig().view;
1441
+ if (!t) return;
1442
+ let n = e == "width" ? "x" : "y", r = this.getScaleResolution(n)?.getResolvedScaleType();
1443
+ return r && !v(r) ? e == "width" ? t.continuousWidth : t.continuousHeight : (e == "width" ? t.discreteWidth : t.discreteHeight) ?? (t.step === void 0 ? void 0 : { step: t.step });
1444
+ }
1445
+ resolveSizeValue(t, n) {
1446
+ if (!e(n)) return n;
1447
+ let r = this.#C(t)();
1448
+ if (nt(r) || r === "container") return r;
1449
+ throw new _(`"${t}" ExprRef must resolve to a finite number or "container"!`, this);
1450
+ }
1451
+ registerSizeInvalidation() {
1452
+ this.#y("width", "x"), this.#y("height", "y"), this.#b("width"), this.#b("height"), this.#b("viewportWidth"), this.#b("viewportHeight");
1453
+ }
1454
+ #y(e, t) {
1455
+ let { value: n, implicit: r } = this.#_(e);
1456
+ if (!J(n)) return;
1457
+ let i = this.getScaleResolution(t);
1458
+ if (!i) {
1459
+ if (r) return;
1460
+ throw new _("Cannot use 'step' size without a scale!", this);
1461
+ }
1462
+ let a = () => {
1463
+ let t = this.getSize()[e];
1464
+ this.invalidateSizeCache();
1465
+ let n = this.getSize()[e];
1466
+ fe(t, n) || this.context.requestLayoutReflow();
1467
+ };
1468
+ if (i.addEventListener("domain", a), this.registerDisposer(() => i.removeEventListener("domain", a)), n.for != "position") {
1469
+ let t = e == "width" ? "xOffset" : "yOffset", n = this.getScaleResolution(t);
1470
+ n && v(n.getResolvedScaleType()) && (n.addEventListener("domain", a), this.registerDisposer(() => n.removeEventListener("domain", a)));
1471
+ }
1472
+ }
1473
+ #b(t) {
1474
+ let { value: n } = this.#_(t);
1475
+ e(n) ? this.#S(t, n.expr) : J(n) && e(n.step) && this.#S(t + ".step", n.step.expr);
1476
+ }
1477
+ #x(t, n) {
1478
+ let r = e(n.step) ? this.#C(t + ".step")() : n.step;
1479
+ if (nt(r)) return r;
1480
+ throw new _(`"${t}.step" ExprRef must resolve to a finite number!`, this);
1481
+ }
1482
+ #S(e, t) {
1483
+ if (!this.#m.has(e)) {
1484
+ let n = this.paramRuntime.watchExpression(t, () => {
1485
+ this.invalidateSizeCache(), this.context.requestLayoutReflow();
1486
+ });
1487
+ this.#m.set(e, n);
1488
+ }
1489
+ }
1490
+ #C(e) {
1491
+ let t = this.#m.get(e);
1492
+ if (!t) throw new _(`"${e}" ExprRef was not registered before layout!`, this);
1493
+ return t;
1494
+ }
1495
+ isConfiguredVisible() {
1496
+ return this.context.isViewConfiguredVisible(this);
1497
+ }
1498
+ isVisibleInSpec() {
1499
+ return this.spec.visible ?? !0;
1500
+ }
1501
+ isVisible() {
1502
+ return this.getLayoutAncestors().every((e) => e.isConfiguredVisible());
1503
+ }
1504
+ isDomainInert() {
1505
+ if (this.spec.domainInert) return !0;
1506
+ let e = this.dataParent;
1507
+ return e ? e.isDomainInert() : !1;
1508
+ }
1509
+ getDataInitializationState() {
1510
+ return this.#p;
1511
+ }
1512
+ _setDataInitializationState(e) {
1513
+ this.#p = e;
1514
+ }
1515
+ isDataInitialized() {
1516
+ return this.#p === "ready";
1517
+ }
1518
+ getEffectiveOpacity() {
1519
+ return this.opacityFunction(this.layoutParent?.getEffectiveOpacity() ?? 1);
1520
+ }
1521
+ getOpacity() {
1522
+ return this.opacityFunction(1);
1523
+ }
1524
+ hasLocalOpacity() {
1525
+ return this.opacityFunction !== q;
1526
+ }
1527
+ getPathString() {
1528
+ return this.getLayoutAncestors().map((e) => e.name).reverse().join("/");
1529
+ }
1530
+ #w(e) {
1531
+ let t = [], n = this;
1532
+ do
1533
+ t.push(n), n = n[e];
1534
+ while (n);
1535
+ return t;
1536
+ }
1537
+ getLayoutAncestors() {
1538
+ return this.#w("layoutParent");
1539
+ }
1540
+ getDataAncestors() {
1541
+ return this.#w("dataParent");
1542
+ }
1543
+ handleBroadcast(e) {
1544
+ for (let t of this.#n[e.type] || []) t(e);
1545
+ }
1546
+ _addBroadcastHandler(e, t) {
1547
+ let n = this.#n[e];
1548
+ return n || (n = [], this.#n[e] = n), n.push(t), () => {
1549
+ let n = this.#n[e];
1550
+ if (!n) return;
1551
+ let r = n.indexOf(t);
1552
+ r >= 0 && n.splice(r, 1);
1553
+ };
1554
+ }
1555
+ handleInteraction(e, t) {
1556
+ t && e.type === "mousemove" && e.pointedViews.add(this);
1557
+ let n = t ? this.#r : this.#i;
1558
+ for (let t of n[e.type] || []) t(e);
1559
+ }
1560
+ addInteractionListener(e, t, n) {
1561
+ let r = n ? this.#r : this.#i, i = r[e];
1562
+ i || (i = [], r[e] = i), i.push(t);
1563
+ }
1564
+ removeInteractionListener(e, t, n) {
1565
+ let r = (n ? this.#r : this.#i)?.[e];
1566
+ if (r) {
1567
+ let e = r.indexOf(t);
1568
+ e >= 0 && r.splice(e, 1);
1569
+ }
1570
+ }
1571
+ visit(e) {
1572
+ try {
1573
+ let t = e(this);
1574
+ if (e.postOrder && e.postOrder(this), t !== "VISIT_STOP") return t;
1575
+ } catch (e) {
1576
+ throw e.view = this, e;
1577
+ }
1578
+ }
1579
+ getDescendants() {
1580
+ let e = [];
1581
+ return this.visit((t) => {
1582
+ e.push(t);
1583
+ }), e;
1584
+ }
1585
+ dispose() {
1586
+ for (let e of this.#f) e();
1587
+ this.#f.length = 0;
1588
+ let e = this.flowHandle;
1589
+ e?.collector && (this.context.dataFlow.pruneCollectorBranch(e.collector), this.context.dataFlow.removeCollector(e.collector)), e?.dataSource && e.dataSource.view === this && !e.dataSource.shareKey && this.context.dataFlow.removeDataSource(e.dataSource), this.paramRuntime.dispose(), this.namedDataScope.dispose(), this.context.dataFlow.loadingStatusRegistry.delete(this), this.flowHandle = void 0;
1590
+ }
1591
+ registerDisposer(e) {
1592
+ this.#f.push(e);
1593
+ }
1594
+ disposeSubtree() {
1595
+ let e = () => void 0;
1596
+ e.postOrder = (e) => {
1597
+ e.dispose();
1598
+ }, this.visit(e);
1599
+ }
1600
+ configurePostScaleParams() {
1601
+ let e = this.#d;
1602
+ if (e.length && !this.#u) {
1603
+ this.#u = !0, this.#l = !1;
1604
+ for (let t of e) this.paramRuntime.getValue(t);
1605
+ this.registerDisposer(this._addBroadcastHandler("subtreeDataReady", () => {
1606
+ this.#l = !0, this.#T();
1607
+ }));
1608
+ }
1609
+ }
1610
+ configureViewOpacity() {
1611
+ (!this.opacityFunction || this.opacityFunction === q) && (this.opacityFunction = $e(this));
1612
+ }
1613
+ finalizeParamRuntimeInitialization() {
1614
+ this.#l === void 0 ? this.paramRuntime.finalizeInitialization() : this.#T();
1615
+ }
1616
+ onBeforeRender() {
1617
+ this.#s ||= !0;
1618
+ }
1619
+ hasRendered() {
1620
+ return this.#s;
1621
+ }
1622
+ arrange(e, t, n = {}) {
1623
+ if (n.firstFacet && this.facetCoords.clear(), this.facetCoords.set(n.facetId, m(t, l(n))), this.#a || this.#o) {
1624
+ let e = this.getOverhang(), n = this.layoutParent ? k.zero() : this.getPadding();
1625
+ this.#a?.(t.width - e.width - n.width), this.#o?.(t.height - e.height - n.height);
1626
+ }
1627
+ this.#c = !0, this.#T();
1628
+ }
1629
+ #T() {
1630
+ this.#l && this.#c && (this.#l = void 0, this.paramRuntime.finalizeInitialization());
1631
+ }
1632
+ getEncoding() {
1633
+ let e = this.dataParent && this.options.inheritEncoding ? this.dataParent.getEncoding() : {}, t = this.spec.encoding || {}, n = {
1634
+ ...e,
1635
+ ...t
1636
+ };
1637
+ for (let [e, t] of Object.entries(n)) t === null && delete n[e];
1638
+ return n;
1639
+ }
1640
+ getFacetAccessor(e) {
1641
+ if (this.layoutParent) return this.layoutParent.getFacetAccessor(this);
1642
+ }
1643
+ getFacetFields(e) {
1644
+ let t = this.getEncoding().sample;
1645
+ return n(t) ? [t.field] : this.options.inheritEncoding ? this.layoutParent?.getFacetFields(this) : [];
1646
+ }
1647
+ usesSampleFacetRendering() {
1648
+ return this.layoutParent?.usesSampleFacetRendering() ?? !1;
1649
+ }
1650
+ getParentGridChromePolicy() {
1651
+ return {
1652
+ axes: !0,
1653
+ background: !0
1654
+ };
1655
+ }
1656
+ getScaleResolution(e) {
1657
+ let t = h(e);
1658
+ return this.getDataAncestors().map((e) => e.resolutions.scale[t]).find((e) => e);
1659
+ }
1660
+ getAxisResolution(e) {
1661
+ let t = h(e);
1662
+ return this.getDataAncestors().map((e) => e.resolutions.axis[t]).find((e) => e);
1663
+ }
1664
+ getLegendResolution(e) {
1665
+ let t = h(e);
1666
+ return this.getDataAncestors().map((e) => e.resolutions.legend[t]).find((e) => e);
1667
+ }
1668
+ getConfiguredResolution(e, t) {
1669
+ return this.spec.resolve?.[t]?.[e];
1670
+ }
1671
+ getConfiguredOrDefaultResolution(e, t) {
1672
+ return (this.getConfiguredResolution(e, t) ?? this.getConfiguredResolution("default", t)) || (t == "legend" ? this.getConfiguredOrDefaultResolution(e, "scale") : this.getDefaultResolution(e, t));
1673
+ }
1674
+ getDefaultResolution(e, t) {
1675
+ return "independent";
1676
+ }
1677
+ getBaseUrl() {
1678
+ return j(() => this.dataParent?.getBaseUrl(), We(this.spec.baseUrl));
1679
+ }
1680
+ isPickingSupported() {
1681
+ return !0;
1682
+ }
1683
+ getTitleText() {
1684
+ let t = this.spec.title;
1685
+ if (t) return p(t) ? t : e(t.text) ? this.paramRuntime.evaluateAndGet(t.text.expr) : t.text;
1686
+ }
1687
+ _cache(e, t) {
1688
+ return te(this, e, t);
1689
+ }
1690
+ _invalidateCacheByPrefix(e, t = "self") {
1691
+ switch (t) {
1692
+ case "self":
1693
+ g(this, e);
1694
+ break;
1695
+ case "ancestors":
1696
+ for (let t of this.getLayoutAncestors()) g(t, e);
1697
+ break;
1698
+ case "progeny":
1699
+ this.visit((t) => g(t, e));
1700
+ break;
1701
+ default:
1702
+ }
1703
+ }
1704
+ invalidateSizeCache() {
1705
+ g(this, "size"), this._invalidateCacheByPrefix("size", "ancestors");
1706
+ }
1707
+ propagateInteraction(e) {}
1708
+ };
1709
+ function Qe(e) {
1710
+ return "unitsPerPixel" in e;
1711
+ }
1712
+ function $e(t) {
1713
+ let n = "opacity" in t.spec ? t.spec.opacity : void 0;
1714
+ if (n !== void 0) {
1715
+ if (a(n)) return (e) => e * n;
1716
+ if (Qe(n)) {
1717
+ let r = (e) => {
1718
+ let n = t.getScaleResolution(e), r = n?.getScale();
1719
+ if ([
1720
+ "linear",
1721
+ "index",
1722
+ "locus"
1723
+ ].includes(r?.type)) return {
1724
+ scale: r,
1725
+ scaleResolution: n
1726
+ };
1727
+ }, i = tt(n.values, "opacity.values", t);
1728
+ if (!s(n.unitsPerPixel)) throw new _("\"opacity.unitsPerPixel\" must be an array.", t);
1729
+ let a = () => 1, o = [], c = () => {
1730
+ let e = et(tt(o.map((e) => e()), "opacity.unitsPerPixel", t), i, t), n = re().domain(e.unitsPerPixel).range(e.values).clamp(!0);
1731
+ a = (e) => n(e);
1732
+ };
1733
+ o = n.unitsPerPixel.map((n) => {
1734
+ if (e(n)) {
1735
+ let e = t.paramRuntime.watchExpression(n.expr, () => {
1736
+ c(), t.context.animator.requestRender();
1737
+ });
1738
+ return () => e(null);
1739
+ } else return () => n;
1740
+ }), c();
1741
+ let l = (e) => {
1742
+ let t = e.scaleResolution.getAxisLength() || 1e3;
1743
+ return d(e.scale.domain()) / t;
1744
+ }, u;
1745
+ if (n.channel === "auto") {
1746
+ let e = r("x"), n = r("y");
1747
+ if (e && n) u = () => (l(e) + l(n)) / 2;
1748
+ else if (e) u = () => l(e);
1749
+ else if (n) u = () => l(n);
1750
+ else throw new _("Cannot find a resolved quantitative x or y scale for dynamic opacity!", t);
1751
+ } else {
1752
+ let e = n.channel ? r(n.channel) : r("x") ?? r("y");
1753
+ if (!e) throw new _("Cannot find a resolved quantitative scale for dynamic opacity!", t);
1754
+ u = () => l(e);
1755
+ }
1756
+ return (e) => a(u()) * e;
1757
+ } else if (e(n)) {
1758
+ let e = t.paramRuntime.watchExpression(n.expr, () => t.context.animator.requestRender());
1759
+ return (t) => e(null) * t;
1760
+ }
1761
+ }
1762
+ return q;
1763
+ }
1764
+ function et(e, t, n) {
1765
+ if (!e.length) throw new _("\"opacity.unitsPerPixel\" must contain at least one stop.", n);
1766
+ if (e.length !== t.length) throw new _("\"opacity.unitsPerPixel\" and \"opacity.values\" must have the same length.", n);
1767
+ e.forEach((e, t) => {
1768
+ if (e <= 0) throw new _("Invalid opacity.unitsPerPixel value at index " + t + ". Stop values must be positive.", n);
1769
+ });
1770
+ let r = e.map((e, n) => ({
1771
+ stop: e,
1772
+ value: t[n]
1773
+ }));
1774
+ r.sort((e, t) => t.stop - e.stop);
1775
+ let i = r.map((e) => e.stop), a = r.map((e) => e.value);
1776
+ for (let t = 1; t < e.length; t++) if (i[t - 1] <= i[t]) throw new _("\"opacity.unitsPerPixel\" must be strictly decreasing.", n);
1777
+ return {
1778
+ unitsPerPixel: i,
1779
+ values: a
1780
+ };
1781
+ }
1782
+ function tt(e, t, n) {
1783
+ if (!s(e)) throw new _("\"" + t + "\" must evaluate to an array.", n);
1784
+ return e.map((e, r) => {
1785
+ if (!a(e) || !Number.isFinite(e)) throw new _("Invalid " + t + " value at index " + r + ". Expected a finite number.", n);
1786
+ return e;
1787
+ });
1788
+ }
1789
+ var J = (e) => !!e && typeof e == "object" && "step" in e;
1790
+ function nt(e) {
1791
+ return typeof e == "number" && Number.isFinite(e);
1792
+ }
1793
+ var Y = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
1794
+ function rt(e, t) {
1795
+ at(e, t, "Import");
1796
+ }
1797
+ function it(e, t) {
1798
+ at(e, t, "View");
1799
+ }
1800
+ function at(e, t, n) {
1801
+ if (t !== null && typeof t != "string") throw Error(n + " scope name must be a string or null.");
1802
+ Y.set(e, { name: t });
1803
+ }
1804
+ function ot(e) {
1805
+ return Y.get(e);
1806
+ }
1807
+ function st(e, t = {}) {
1808
+ let n = t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude";
1809
+ X.set(e, n);
1810
+ }
1811
+ function ct(e, t = {}) {
1812
+ Ke(e, t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude");
1813
+ }
1814
+ function lt(e) {
1815
+ return e.getLayoutAncestors().some(V);
1816
+ }
1817
+ function Z(e) {
1818
+ let t = e.getDataAncestors(), n = [];
1819
+ for (let e = t.length - 1; e >= 0; --e) {
1820
+ let r = Y.get(t[e]);
1821
+ r && typeof r.name == "string" && n.push(r.name);
1822
+ }
1823
+ return n;
1824
+ }
1825
+ function ut(e) {
1826
+ let t = e.explicitName;
1827
+ if (!t) throw Error("Cannot build a selector for a view without a name.");
1828
+ return {
1829
+ scope: Z(e),
1830
+ view: t
1831
+ };
1832
+ }
1833
+ function dt(e, t) {
1834
+ if (!t) throw Error("Cannot build a selector for a parameter without a name.");
1835
+ return {
1836
+ scope: Z(e),
1837
+ param: t
1838
+ };
1839
+ }
1840
+ function ft(e) {
1841
+ return bt(e), "p:" + JSON.stringify({
1842
+ scope: e.scope,
1843
+ param: e.param
1844
+ });
1845
+ }
1846
+ function pt(e, t) {
1847
+ e.visit((e) => {
1848
+ let n = qe(e);
1849
+ if (n === "excludeSubtree") return G;
1850
+ if (n !== "exclude") return t(e);
1851
+ });
1852
+ }
1853
+ function mt(e, t) {
1854
+ e.visit((e) => {
1855
+ let n = X.get(e);
1856
+ if (n === "excludeSubtree") return G;
1857
+ if (n !== "exclude") return t(e);
1858
+ });
1859
+ }
1860
+ function ht(e, t) {
1861
+ if (xt(t), !kt(e, t.scope)) return;
1862
+ let n = [];
1863
+ if ($(e, t.scope, (e) => {
1864
+ e.explicitName === t.view && n.push(e);
1865
+ }, { includeNamedImportRoots: !0 }), n.length === 1) return n[0];
1866
+ if (n.length !== 0) throw Error("View selector is ambiguous for view \"" + t.view + "\" in scope " + JSON.stringify(t.scope));
1867
+ }
1868
+ function gt(e, t) {
1869
+ if (bt(t), !kt(e, t.scope)) return;
1870
+ let n = [];
1871
+ if ($(e, t.scope, (e) => {
1872
+ for (let [r, i] of e.paramRuntime.paramConfigs) r === t.param && Q(i) && n.push({
1873
+ view: e,
1874
+ param: i
1875
+ });
1876
+ }), n.length === 1) return n[0];
1877
+ if (n.length !== 0) throw Error("Param selector is ambiguous for param \"" + t.param + "\" in scope " + JSON.stringify(t.scope));
1878
+ }
1879
+ function _t(e, t) {
1880
+ e.visit((e) => {
1881
+ let n = X.get(e);
1882
+ if (n === "excludeSubtree") return G;
1883
+ if (n !== "exclude") for (let [n, r] of e.paramRuntime.paramConfigs) Q(r) && t({
1884
+ view: e,
1885
+ param: r,
1886
+ selector: dt(e, n)
1887
+ });
1888
+ });
1889
+ }
1890
+ function vt(e) {
1891
+ let t = [];
1892
+ return _t(e, (e) => t.push(e)), t;
1893
+ }
1894
+ function yt(e) {
1895
+ let t = [];
1896
+ for (let n of St(e)) {
1897
+ let r = Ct(n);
1898
+ Tt(e, r, t), Et(e, r, t);
1899
+ }
1900
+ return t;
1901
+ }
1902
+ function bt(e) {
1903
+ if (!e || !Array.isArray(e.scope)) throw Error("Param selector scope must be an array.");
1904
+ if (typeof e.param != "string" || !e.param.length) throw Error("Param selector param must be a non-empty string.");
1905
+ }
1906
+ function xt(e) {
1907
+ if (!e || !Array.isArray(e.scope)) throw Error("View selector scope must be an array.");
1908
+ if (typeof e.view != "string" || !e.view.length) throw Error("View selector view must be a non-empty string.");
1909
+ }
1910
+ function Q(e) {
1911
+ return e.persist === !1 ? !1 : i(e) ? !0 : t(e) ? !!e.bind : !1;
1912
+ }
1913
+ function St(e) {
1914
+ let t = /* @__PURE__ */ new Set([e]);
1915
+ return e.visit((e) => {
1916
+ let n = Y.get(e);
1917
+ n && typeof n.name == "string" && t.add(e);
1918
+ }), Array.from(t);
1919
+ }
1920
+ function Ct(e) {
1921
+ return Z(e);
1922
+ }
1923
+ function wt(e) {
1924
+ return e.length ? "import scope [" + e.join(" / ") + "]" : "import scope (root)";
1925
+ }
1926
+ function Tt(e, t, n) {
1927
+ let r = /* @__PURE__ */ new Map();
1928
+ $(e, t, (e) => {
1929
+ for (let [t, n] of e.paramRuntime.paramConfigs) {
1930
+ if (!Q(n)) continue;
1931
+ let i = r.get(t);
1932
+ i ? i.push(e) : r.set(t, [e]);
1933
+ }
1934
+ });
1935
+ for (let [e, i] of r) {
1936
+ if (i.length <= 1) continue;
1937
+ let r = i.map((e) => e.getPathString()).join(", ");
1938
+ n.push({
1939
+ message: "Bookmarkable parameter \"" + e + "\" is not unique within " + wt(t) + ". Found in: " + r + ".",
1940
+ scope: t
1941
+ });
1942
+ }
1943
+ }
1944
+ function Et(e, t, n) {
1945
+ let r = Dt(e, t);
1946
+ if (!r.length) return;
1947
+ let i = r.filter((e) => Ot(e));
1948
+ if (i.length <= 1) return;
1949
+ let a = /* @__PURE__ */ new Map();
1950
+ for (let e of i) {
1951
+ let t = Y.get(e), n = t ? t.name : void 0;
1952
+ typeof n != "string" || !n.length || a.set(n, (a.get(n) ?? 0) + 1);
1953
+ }
1954
+ for (let [e, r] of a) r > 1 && n.push({
1955
+ message: "Import instance name \"" + e + "\" is used multiple times for addressable instances in " + wt(t) + ".",
1956
+ scope: t
1957
+ });
1958
+ }
1959
+ function Dt(e, t) {
1960
+ let n = [];
1961
+ return $(e, t, (e) => {
1962
+ if (Z(e).length !== t.length + 1) return;
1963
+ let r = Y.get(e);
1964
+ !r || typeof r.name != "string" || n.push(e);
1965
+ }, { includeNamedImportRoots: !0 }), n;
1966
+ }
1967
+ function Ot(e) {
1968
+ let t = !1;
1969
+ return e.visit((e) => {
1970
+ let n = X.get(e);
1971
+ if (n === "excludeSubtree") return G;
1972
+ if (n !== "exclude") {
1973
+ for (let n of e.paramRuntime.paramConfigs.values()) if (Q(n)) return t = !0, K;
1974
+ }
1975
+ }), t;
1976
+ }
1977
+ function kt(e, t) {
1978
+ let n = e, r = [];
1979
+ for (let i of t) {
1980
+ if (typeof i != "string" || !i.length) throw Error("Scope names must be non-empty strings.");
1981
+ let t, a = !1;
1982
+ if ($(e, r, (e) => {
1983
+ let n = Y.get(e);
1984
+ if (!(!n || n.name !== i) && Z(e).length === r.length + 1) {
1985
+ if (t) return a = !0, K;
1986
+ t = e;
1987
+ }
1988
+ }, { includeNamedImportRoots: !0 }), a) throw Error("Multiple import instances named \"" + i + "\" in scope.");
1989
+ if (t) n = t, r.push(i);
1990
+ else return;
1991
+ }
1992
+ return n;
1993
+ }
1994
+ function $(e, t, n, r = {}) {
1995
+ let i = r.includeNamedImportRoots ?? !1;
1996
+ e.visit((e) => {
1997
+ let r = Y.get(e), a = X.get(e);
1998
+ if (a === "excludeSubtree") return G;
1999
+ if (a !== "exclude" && At(e, t, r, i)) return n(e);
2000
+ });
2001
+ }
2002
+ function At(e, t, n, r) {
2003
+ let i = Z(e);
2004
+ return jt(i, t) ? !0 : !r || !n || typeof n.name != "string" || i.length !== t.length + 1 ? !1 : Mt(t, i);
2005
+ }
2006
+ function jt(e, t) {
2007
+ return e.length === t.length && Mt(e, t);
2008
+ }
2009
+ function Mt(e, t) {
2010
+ if (e.length > t.length) return !1;
2011
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
2012
+ return !0;
2013
+ }
2014
+ //#endregion
2015
+ export { M as A, oe as B, Ue as C, Pe as D, Le as E, b as F, ue as H, le as I, se as L, k as M, ve as N, N as O, y as P, D as R, z as S, Ie as T, ce as U, C as V, K as _, lt as a, V as b, st as c, gt as d, ht as f, G as g, pt as h, ut as i, be as j, j as k, rt as l, mt as m, ot as n, ft as o, yt as p, Z as r, ct as s, vt as t, it as u, Ze as v, ze as w, H as x, Je as y, E as z };