@genome-spy/app 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/{SharedReadCache-Ey5QIiPM.js → SharedReadCache-9sT2aIxW.js} +6 -12
  2. package/dist/__vite-browser-external-Dgu_Ldik.js +7 -0
  3. package/dist/{agentApi-8hMSlqAQ.js → agentApi-BclFF9zB.js} +7130 -7509
  4. package/dist/agentApi.es.js +4344 -4015
  5. package/dist/agentShared.es.js +431 -458
  6. package/dist/arrayUtils-Bm7QnzhN.js +1306 -0
  7. package/dist/{blosc-JROzDOnd.js → blosc-C-W97QwH.js} +3 -3
  8. package/dist/{canvas2d-Bd8H8MMo.js → canvas2d-8MSf70d4.js} +78 -86
  9. package/dist/{canvas2d-D6VYooRf.js → canvas2d-BwGNI_Rx.js} +83 -91
  10. package/dist/clipOptions-SrrxeAEU.js +4316 -0
  11. package/dist/clipOptions-clBEbkjv.js +4326 -0
  12. package/dist/{layoutResult-D50MSHXR.js → color-jETn8xK_.js} +29 -10
  13. package/dist/color-uTRRsy8i.js +116 -0
  14. package/dist/{componentStyles-DGtQXvwc.js → componentStyles-C7FbjS-a.js} +1 -1
  15. package/dist/{containerView-aEVmYmkA.js → containerView-BItRtKqu.js} +5 -1
  16. package/dist/{containerView-CRJSc4bM.js → containerView-CWa6ZIJW.js} +5 -1
  17. package/dist/{debug-CQ0agCrd.js → debug-23s-jja_.js} +3 -2
  18. package/dist/{debug-DkIMiGdW.js → debug-CWRxvAss.js} +2 -3
  19. package/dist/dialog.es.js +1 -1
  20. package/dist/dist-CmY6iewb.js +1501 -0
  21. package/dist/dist-D6xbz5Ks.js +1501 -0
  22. package/dist/{esm-CjkeZi__.js → esm-BFwBAnbO.js} +25 -25
  23. package/dist/esm-BUkWqSr2.js +299 -0
  24. package/dist/{esm-C-6g-SkZ.js → esm-C0xXMLsR.js} +37 -41
  25. package/dist/{esm-CJeszW-t.js → esm-C2xhhXs0.js} +7 -7
  26. package/dist/esm-C6erfjPM.js +252 -0
  27. package/dist/{esm-DFHFX1sH.js → esm-CVjC7qA4.js} +34 -38
  28. package/dist/esm-CqY5ezGz.js +1249 -0
  29. package/dist/esm-DfMIJ_N2.js +1522 -0
  30. package/dist/esm-Dls41IbZ.js +787 -0
  31. package/dist/{esm-Bv7Frz7C.js → esm-DzQDfrsZ.js} +7 -10
  32. package/dist/esm-aGLCvYRP.js +238 -0
  33. package/dist/{esm-VFJeyk9i.js → esm-nzwgJFGz.js} +40 -36
  34. package/dist/figWigMetadataSourceAdapter-8Kf_vZRf.js +36 -0
  35. package/dist/figWigMetadataSourceAdapter-DdDMZpYO.js +36 -0
  36. package/dist/flowNode-BSjy0Wz3.js +1306 -0
  37. package/dist/flowOutput-D5qpxWe0.js +183 -0
  38. package/dist/index.es.js +4756 -5528
  39. package/dist/index.js +707 -547
  40. package/dist/inflate-BdC5KvHn.js +886 -0
  41. package/dist/{lz4-CUYSbVey.js → lz4-BLPgBOlE.js} +1 -1
  42. package/dist/{markUtils-CvLDz744.js → markUtils-RaatLEa-.js} +9 -6
  43. package/dist/metadataUtils-DxEPe0vj.js +879 -0
  44. package/dist/{order-BVvkjDRT.js → order-BnKzKjt4.js} +383 -347
  45. package/dist/{order-DmMoZsi1.js → order-BpJnq_nV.js} +375 -339
  46. package/dist/{parquetRead-0hFIa3Cc.js → parquetRead-D-yY8njE.js} +3 -11
  47. package/dist/{rasterExport-jeRVq6kY.js → rasterExport-B-WrX1pa.js} +5 -5
  48. package/dist/{rasterExport-DxvowWjH.js → rasterExport-C_vx4Jwd.js} +3 -3
  49. package/dist/{rasterization-DFj3Cvx4.js → rasterization-QktH8Sn2.js} +1 -1
  50. package/dist/{rectangle-Dl4Dy0hS.js → rectangle-BAdoDPXu.js} +34 -31
  51. package/dist/{renderCanvas2D-Bfm1NHFu.js → renderCanvas2D-CsRO78Pq.js} +88 -87
  52. package/dist/{renderCanvas2D-DVjhp834.js → renderCanvas2D-Y7pkRzbC.js} +93 -92
  53. package/dist/{rolldown-runtime-DF993M8W.js → rolldown-runtime-DeIk2rA4.js} +1 -1
  54. package/dist/{indexer-DOYMJ-Md.js → scaleNull-CVzag4z8.js} +2 -12
  55. package/dist/{indexer-DDC0YRGn.js → scaleNull-Pbz7QGnl.js} +2 -12
  56. package/dist/{scalePosition-0aeqp_kz.js → scalePosition-CRXa0rCC.js} +1 -1
  57. package/dist/schema.json +3801 -816
  58. package/dist/{svg-Bm2zxBPu.js → svg-BBMtLgtM.js} +369 -285
  59. package/dist/{svg-CkfuhONt.js → svg-JjWL6U-T.js} +371 -287
  60. package/dist/{svgRasterizer-DoRQEqFA.js → svgRasterizer-6OcftuoI.js} +2 -2
  61. package/dist/{svgRasterizer-raDDhBF-.js → svgRasterizer-DkNRaCPs.js} +4 -4
  62. package/dist/tableMetadataSourceAdapter-CUNwLsdi.js +291 -0
  63. package/dist/tableMetadataSourceAdapter-DQrEXCo6.js +1283 -0
  64. package/dist/url-DeOdSRrv.js +183 -0
  65. package/dist/{viewError-BkJeVYXA.js → viewError-B0TMfOpB.js} +1 -1
  66. package/dist/{viewError-IYqyluc7.js → viewError-D9aO90cI.js} +1 -1
  67. package/dist/{viewSelectors-7LyasQN-.js → viewSelectors-DkFvo33d.js} +832 -734
  68. package/dist/{viewSelectors-CbmkSQRT.js → viewSelectors-lM93fHAq.js} +900 -802
  69. package/dist/{viewUtils-DuddMNNw.js → viewUtils-0SJOewM6.js} +1861 -2459
  70. package/dist/webgl-CXIO3OQz.js +5782 -0
  71. package/dist/webgl-Pdvfhio5.js +5783 -0
  72. package/package.json +7 -5
  73. package/src/agentApi/index.d.ts +3 -2
  74. package/src/agentShared/index.d.ts +2 -0
  75. package/src/appTypes.d.ts +1 -6
  76. package/src/embedTypes.d.ts +36 -1
  77. package/src/index.d.ts +6 -0
  78. package/src/spec/sampleView.d.ts +68 -13
  79. package/src/state/paramProvenanceTypes.d.ts +25 -2
  80. package/src/state.d.ts +14 -52
  81. package/dist/clipOptions-DElJ8dTZ.js +0 -3097
  82. package/dist/clipOptions-D_wBNhzs.js +0 -3087
  83. package/dist/esm-Dndm-NaA.js +0 -1193
  84. package/dist/vega-scale-BoGHANI7.js +0 -2446
  85. package/dist/vega-scale-o9TRyzYH.js +0 -2443
  86. package/dist/webgl-CQfvgnxo.js +0 -5633
  87. package/dist/webgl-DVYkXtiZ.js +0 -5632
@@ -1,344 +1,13 @@
1
- import { At as e, B as t, Bt as n, Dt as r, It as i, Lt as a, Nt as o, O as s, On as c, Pt as l, Sn as u, _n as d, bn as f, dn as p, ft as m, l as ee, o as te, pt as ne, t as re, xn as ie, y as h } from "./clipOptions-D_wBNhzs.js";
2
- import { a as g, n as ae, r as oe, t as _ } from "./viewError-IYqyluc7.js";
3
- import { H as se, m as v, y } from "./vega-scale-BoGHANI7.js";
4
- import { t as ce } from "./warning-CpIIpk8e.js";
5
- //#region ../core/src/view/layout/flexLayout.js
6
- function le(e, t, n = {}) {
7
- let { sizes: r } = ve(e, t, n.spacing || 0);
8
- return b(e, r, t, n);
9
- }
10
- function b(e, t, n, { spacing: r, devicePixelRatio: i, offset: a, reverse: o } = {}) {
11
- r ||= 0, a ||= 0;
12
- let s = 0, c = 0;
13
- for (let n = 0; n < e.length; n++) s += t[n], C(e[n]) || c++;
14
- let l = s + Math.max(0, c - 1) * r, u = i === void 0 ? (e) => e : (e) => Math.round(e * i) / i, d = 0, f = [], p = (e) => {
15
- let t = d;
16
- if (!t) return;
17
- let n = (e ? r : 0) * (o ? -1 : 1);
18
- m -= n;
19
- for (let e = 0; e < t; e++) f.push({
20
- location: m + (e + 1) / (t + 1) * n,
21
- size: 0
22
- });
23
- m += n, d = 0;
24
- }, m = o ? Math.max(n, l) : 0 + a;
25
- if (e.length == 1 && C(e[0])) return [{
26
- location: m,
27
- size: 0
28
- }];
29
- for (let n = 0; n < e.length; n++) {
30
- let i = e[n];
31
- if (C(i)) d++;
32
- else {
33
- p(f.length > 0);
34
- let e = t[n];
35
- o && (m -= e), f.push({
36
- location: u(m),
37
- size: u(e)
38
- }), o ? m -= r : m += e + r;
39
- }
40
- }
41
- return m += o ? r : -r, p(!1), f;
42
- }
43
- function ue(e, { spacing: t } = { spacing: 0 }) {
44
- let n = 0;
45
- for (let r of e) n += E(r) + (C(r) ? 0 : t);
46
- return Math.max(0, n - t);
47
- }
48
- function de(e, t, { spacing: n = 0 } = {}) {
49
- let r = [], i = [], a = 0, o = 0;
50
- for (let [s, c] of e.entries()) {
51
- let e = E(c), l = !C(c), u = o && l ? n : 0;
52
- 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;
53
- }
54
- return i.length && r.push(i), r;
55
- }
56
- function fe(e) {
57
- let t = 0, n = 0, r = 0, i, a = !0;
58
- for (let o of e) {
59
- t = Math.max(t, o.px ?? 0), n = Math.max(n, o.grow ?? 0), r = Math.max(r, E(o));
60
- let e = D(o);
61
- e === void 0 ? a = !1 : i = i === void 0 ? e : Math.max(i, e);
62
- }
63
- return A({
64
- px: t,
65
- grow: n,
66
- minPx: r,
67
- maxPx: a ? i : void 0
68
- });
69
- }
70
- function pe(e, t = 0, n = 0) {
71
- let r = Math.max(0, e.length - 1) * t, i = {
72
- px: r,
73
- grow: e.length ? 0 : n,
74
- minPx: r,
75
- maxPx: r
76
- }, a = e.length > 0;
77
- for (let t of e) {
78
- i.px += w(t.px), i.grow += w(t.grow), i.minPx += E(t);
79
- let e = D(t);
80
- e === void 0 ? a = !1 : i.maxPx += e;
81
- }
82
- return a || delete i.maxPx, A(i);
83
- }
84
- var x = class e {
85
- constructor(e, t) {
86
- this.width = e, this.height = t;
87
- }
88
- addPadding(e) {
89
- return this.#e(e.width, e.height);
90
- }
91
- subtractPadding(e) {
92
- return this.#e(-e.width, -e.height);
93
- }
94
- #e(t, n) {
95
- return new e(k(this.width, t), k(this.height, n));
96
- }
97
- isGrowing() {
98
- return !!(this.width.grow || this.height.grow);
99
- }
100
- }, me = Object.freeze({
101
- px: 0,
102
- grow: 0
103
- }), S = new x(me, me);
104
- function C(e) {
105
- return !e.px && !e.grow && !e.minPx;
106
- }
107
- function he(e, t) {
108
- return !e || !t ? !1 : e.px === t.px && e.grow === t.grow && e.minPx === t.minPx && e.maxPx === t.maxPx;
109
- }
110
- function w(e) {
111
- return e || 0;
112
- }
113
- function ge(e) {
114
- return e && (f(e.px) || f(e.grow) || f(e.minPx) || f(e.maxPx));
115
- }
116
- function _e(e) {
117
- if (q(e)) throw Error("parseSizeDef does not accept step-based sizes.");
118
- if (ge(e)) return be(e), A(e);
119
- if (f(e)) return {
120
- px: e,
121
- grow: 0
122
- };
123
- if (e === "container" || !e) return {
124
- px: 0,
125
- grow: 1
126
- };
127
- throw Error(`Invalid sizeDef: ${e}`);
128
- }
129
- function ve(e, t, n = 0) {
130
- let r = !1;
131
- for (let t of e) be(t), r ||= O(t);
132
- if (!r) return ye(e, t, n);
133
- let i = Array(e.length).fill(0), a = [];
134
- for (let t = 0; t < e.length; t++) C(e[t]) || a.push(t);
135
- let o = Math.max(0, a.length - 1) * n, s = Math.max(0, t - o), c = /* @__PURE__ */ new Set();
136
- for (let t of a) {
137
- let n = e[t];
138
- w(n.grow) || (i[t] = T(w(n.px), n), c.add(t));
139
- }
140
- let l = 0;
141
- for (;;) {
142
- let t = 0, n = 0, r = 0;
143
- for (let o of a) c.has(o) ? r += i[o] : (t += w(e[o].px), n += w(e[o].grow));
144
- if (!n) {
145
- for (let t of a) c.has(t) || (i[t] = T(w(e[t].px), e[t]), c.add(t));
146
- break;
147
- }
148
- let o = Math.max(0, s - r - t);
149
- l = o / n;
150
- let u = 0, d = [], f = [];
151
- for (let t of a) {
152
- if (c.has(t)) continue;
153
- let r = e[t], a = w(r.px) + w(r.grow) / n * o, s = T(a, r);
154
- i[t] = s;
155
- let l = s - a;
156
- u += l, l > 0 ? d.push(t) : l < 0 && f.push(t);
157
- }
158
- if (!d.length && !f.length) break;
159
- if (u > 0) for (let e of d) c.add(e);
160
- else if (u < 0) for (let e of f) c.add(e);
161
- else for (let e of a) c.add(e);
162
- }
163
- return {
164
- sizes: i,
165
- growth: l
166
- };
167
- }
168
- function ye(e, t, n) {
169
- let r = 0, i = 0;
170
- for (let t of e) r += w(t.px) + (C(t) ? 0 : n), i += w(t.grow);
171
- r -= n;
172
- let a = Math.max(0, t - r), o = Array(e.length);
173
- for (let t = 0; t < e.length; t++) {
174
- let n = e[t];
175
- o[t] = C(n) ? 0 : w(n.px) + (i ? w(n.grow) / i * a : 0);
176
- }
177
- return {
178
- sizes: o,
179
- growth: i ? a / i : 0
180
- };
181
- }
182
- function be(e) {
183
- if (e.minPx !== void 0 && e.maxPx !== void 0 && e.minPx > e.maxPx) throw Error("SizeDef minPx cannot be greater than maxPx.");
184
- }
185
- function T(e, t) {
186
- return Math.min(Math.max(e, t.minPx ?? 0), t.maxPx ?? Infinity);
187
- }
188
- function E(e) {
189
- return T(w(e.px), e);
190
- }
191
- function D(e) {
192
- return e.maxPx ?? (w(e.grow) ? void 0 : E(e));
193
- }
194
- function O(e) {
195
- return e.minPx !== void 0 || e.maxPx !== void 0;
196
- }
197
- function k(e, t) {
198
- return A({
199
- px: (e.px ?? 0) + t,
200
- grow: e.grow,
201
- minPx: e.minPx === void 0 ? void 0 : Math.max(0, e.minPx + t),
202
- maxPx: e.maxPx === void 0 ? void 0 : Math.max(0, e.maxPx + t)
203
- });
204
- }
205
- function A(e) {
206
- let t = {}, n = e.px !== void 0, r = e.grow !== void 0, i = O(e);
207
- 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 > w(e.px) && (t.minPx = e.minPx), e.maxPx !== void 0 && (w(t.grow) || e.maxPx < w(e.px)) && (t.maxPx = e.maxPx), t;
208
- }
209
- //#endregion
210
- //#region ../core/src/view/layout/padding.js
211
- var j = class e {
212
- constructor(e, t, n, r) {
213
- this.top = e || 0, this.right = t || 0, this.bottom = n || 0, this.left = r || 0;
214
- }
215
- get width() {
216
- return this.left + this.right;
217
- }
218
- get height() {
219
- return this.top + this.bottom;
220
- }
221
- expand(t) {
222
- return t <= 0 ? this : new e(this.top + t, this.right + t, this.bottom + t, this.left + t);
223
- }
224
- add(t) {
225
- return new e(this.top + t.top, this.right + t.right, this.bottom + t.bottom, this.left + t.left);
226
- }
227
- subtract(t) {
228
- return new e(this.top - t.top, this.right - t.right, this.bottom - t.bottom, this.left - t.left);
229
- }
230
- union(t) {
231
- 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));
232
- }
233
- getHorizontal() {
234
- return new e(0, this.right, 0, this.left);
235
- }
236
- getVertical() {
237
- return new e(this.top, 0, this.bottom, 0);
238
- }
239
- get horizontalTotal() {
240
- return this.left + this.right;
241
- }
242
- get verticalTotal() {
243
- return this.top + this.bottom;
244
- }
245
- static createFromConfig(e) {
246
- return typeof e == "number" ? this.createUniformPadding(e) : e ? this.createFromRecord(e) : M;
247
- }
248
- static createFromRecord(t) {
249
- return new e(t.top, t.right, t.bottom, t.left);
250
- }
251
- static zero() {
252
- return M;
253
- }
254
- static createUniformPadding(t) {
255
- return new e(t, t, t, t);
256
- }
257
- };
258
- function xe(e, t, n = j.zero()) {
259
- return t ? new j(t.top === !1 ? n.top : e.top, t.right === !1 ? n.right : e.right, t.bottom === !1 ? n.bottom : e.bottom, t.left === !1 ? n.left : e.left) : e;
260
- }
261
- var M = j.createUniformPadding(0);
262
- Object.freeze(M);
263
- //#endregion
264
- //#region ../core/src/utils/url.js
265
- var Se = /^([A-Za-z]+:)?\/\//;
266
- function N(e, t) {
267
- if (t && Se.test(t)) return t;
268
- let n = typeof e == "function" ? e() : e;
269
- if (!n) return t;
270
- if (!t) return n;
271
- if (/[#?]/.test(n)) throw Error(`Cannot append to a url with query or hash. Append: ${t}, base: ${n}`);
272
- return P(n) + t;
273
- }
274
- function Ce(e, t, n = we()) {
275
- let r = typeof e == "function" ? e() : e;
276
- if (!t) return r;
277
- try {
278
- if (r) {
279
- let e = n ? new URL(r, n).href : new URL(r).href;
280
- return new URL(t, e).href;
281
- }
282
- if (n) return new URL(t, n).href;
283
- } catch {}
284
- return N(r, t);
285
- }
286
- function P(e) {
287
- let t = e.replace(/[^/]*$/, "");
288
- return t === "" ? void 0 : t.endsWith("://") ? e + "/" : t;
289
- }
290
- function we() {
291
- if (typeof document < "u" && document.baseURI) return document.baseURI;
292
- if (typeof window < "u" && window.location?.href) return window.location.href;
293
- }
294
- //#endregion
295
- //#region ../../node_modules/flatqueue/index.js
296
- var F = class {
297
- constructor(e = Infinity, t = Float64Array, n = Uint32Array) {
298
- let r = e !== Infinity;
299
- this.ids = r ? new n(e) : [], this.values = r ? new t(e) : [], this.capacity = e, this.length = 0;
300
- }
301
- clear() {
302
- this.length = 0;
303
- }
304
- push(e, t) {
305
- if (this.length === this.capacity) throw RangeError("Queue is at capacity.");
306
- let n = this.length++;
307
- for (; n > 0;) {
308
- let e = n - 1 >> 1, r = this.values[e];
309
- if (t >= r) break;
310
- this.ids[n] = this.ids[e], this.values[n] = r, n = e;
311
- }
312
- this.ids[n] = e, this.values[n] = t;
313
- }
314
- pop() {
315
- if (this.length === 0) return;
316
- let e = this.ids, t = this.values, n = e[0], r = --this.length;
317
- if (r > 0) {
318
- let n = e[r], i = t[r], a = 0, o = r >> 1;
319
- for (; a < o;) {
320
- let n = (a << 1) + 1, o = n + 1, s = n + (+(o < r) & t[o] < t[n]);
321
- if (t[s] >= i) break;
322
- e[a] = e[s], t[a] = t[s], a = s;
323
- }
324
- e[a] = n, t[a] = i;
325
- }
326
- return n;
327
- }
328
- peek() {
329
- return this.length > 0 ? this.ids[0] : void 0;
330
- }
331
- peekValue() {
332
- return this.length > 0 ? this.values[0] : void 0;
333
- }
334
- shrink() {
335
- Array.isArray(this.ids) && (this.ids.length = this.length), Array.isArray(this.values) && (this.values.length = this.length);
336
- }
337
- }, I = Symbol("runtimeNode"), L = 1e6;
338
- function Te(e) {
1
+ import { C as e, E as t, Fn as n, Jn as r, K as i, M as a, On as o, P as s, Q as c, Tt as l, Wn as u, Yn as d, Z as f, _ as p, _n as m, an as ee, b as h, f as g, g as _, gt as v, l as te, m as y, o as ne, p as re, qn as b, t as ie, tr as ae, un as x } from "./clipOptions-clBEbkjv.js";
2
+ import { i as oe, l as se, t as ce, u as le } from "./url-DeOdSRrv.js";
3
+ import { a as S, n as ue, r as de, t as C } from "./viewError-D9aO90cI.js";
4
+ import { t as fe } from "./warning-CpIIpk8e.js";
5
+ //#region ../core/src/paramRuntime/graphRuntime.js
6
+ var pe = Symbol("runtimeNode"), me = 1e6;
7
+ function he(e) {
339
8
  return e ? (t, n) => e.addDisposer(t, n) : () => () => void 0;
340
9
  }
341
- function R(e, t, n = !0) {
10
+ function w(e, t, n = !0) {
342
11
  let r = {
343
12
  id: e.id,
344
13
  name: e.name,
@@ -353,7 +22,7 @@ function R(e, t, n = !0) {
353
22
  };
354
23
  }
355
24
  };
356
- return Object.defineProperty(r, I, {
25
+ return Object.defineProperty(r, pe, {
357
26
  enumerable: !1,
358
27
  configurable: !1,
359
28
  writable: !1,
@@ -362,18 +31,25 @@ function R(e, t, n = !0) {
362
31
  t(e);
363
32
  } }) : r;
364
33
  }
365
- function Ee(e) {
366
- let t = e[I];
34
+ function T(e) {
35
+ let t = e[pe];
367
36
  if (!t) throw Error("ParamRef is not bound to this graph runtime. Expected runtime-created ref.");
368
37
  return t;
369
38
  }
370
- function De(e) {
371
- return typeof e.rank == "number" ? e.rank : Ee(e).rank;
39
+ function ge(e, t) {
40
+ let n = T(t), r = /* @__PURE__ */ new Set(), i = (e) => {
41
+ let t = T(e);
42
+ return t === n || !r.has(t) && (r.add(t), (t.dependencies ?? []).some(i));
43
+ };
44
+ return i(e);
45
+ }
46
+ function _e(e) {
47
+ return typeof e.rank == "number" ? e.rank : T(e).rank;
372
48
  }
373
- function Oe(e) {
49
+ function ve(e) {
374
50
  for (let t of e) t();
375
51
  }
376
- var ke = class {
52
+ var ye = class {
377
53
  #e = 1;
378
54
  #t = 1;
379
55
  #n = 0;
@@ -387,13 +63,13 @@ var ke = class {
387
63
  #u = /* @__PURE__ */ new Map();
388
64
  #d = /* @__PURE__ */ new Set();
389
65
  #f = /* @__PURE__ */ new Set();
390
- #p = new F();
391
- #m = new F();
66
+ #p = new le();
67
+ #m = new le();
392
68
  #h = /* @__PURE__ */ new Set();
393
69
  #g;
394
70
  #_;
395
71
  constructor(e = {}) {
396
- this.#g = Te(e.lifecycleRegistry), this.#_ = e.onError;
72
+ this.#g = he(e.lifecycleRegistry), this.#_ = e.onError;
397
73
  }
398
74
  createWritable(e, t, n, r, i = {}) {
399
75
  let a = "n" + this.#e++, o = i.notify ?? !0, s = {
@@ -415,7 +91,7 @@ var ke = class {
415
91
  }, l = () => {
416
92
  s.disposed = !0, s.listeners.clear(), u();
417
93
  }, u = this.#g(e, l);
418
- return Object.assign(R(s, c, o), { dispose: l });
94
+ return Object.assign(w(s, c, o), { dispose: l });
419
95
  }
420
96
  computed(e, t, n, r, i = {}) {
421
97
  return this.#v(e, t, n, r, i);
@@ -450,19 +126,13 @@ var ke = class {
450
126
  })), l = c(), u = () => {
451
127
  s.disposed || (s.disposed = !0, d(), l.forEach((e) => e()), s.listeners.clear(), this.#d.delete(s));
452
128
  }, d = this.#g(e, u);
453
- return Object.assign(R(s), {
129
+ return Object.assign(w(s), {
454
130
  dispose: u,
455
131
  rebind: (e, n) => {
456
132
  if (s.disposed) throw Error("Cannot rebind disposed operation: " + t);
457
- let r = /* @__PURE__ */ new Set(), i = (e) => {
458
- let n = e[I];
459
- if (n === s) throw Error("Reactive dependency cycle: " + t);
460
- if (!r.has(n)) {
461
- r.add(n);
462
- for (let e of n?.dependencies ?? []) i(e);
463
- }
464
- };
465
- e.forEach(i), l.forEach((e) => e()), s.dependencies = e, s.fn = n, this.#n++, l = c(), this.#C(s), this.#p.clear();
133
+ let r = w(s);
134
+ if (e.some((e) => ge(e, r))) throw Error("Reactive dependency cycle: " + t);
135
+ l.forEach((e) => e()), s.dependencies = e, s.fn = n, this.#n++, l = c(), this.#C(s), this.#p.clear();
466
136
  for (let e of this.#d) this.#p.push(e, this.#T(e.rank));
467
137
  this.#m.clear();
468
138
  for (let e of this.#f) this.#m.push(e, this.#T(e.rank));
@@ -556,7 +226,7 @@ var ke = class {
556
226
  #y(e) {
557
227
  this.#s++;
558
228
  try {
559
- Oe(e);
229
+ ve(e);
560
230
  } catch (e) {
561
231
  throw this.#c = !1, !this.#o && this.#s === 1 && this.#b(e), e;
562
232
  } finally {
@@ -600,25 +270,17 @@ var ke = class {
600
270
  }
601
271
  #S(e) {
602
272
  let t = -1, n = 0;
603
- return () => (t !== this.#n && (n = 1 + e().reduce((e, t) => Math.max(e, De(t)), 0), t = this.#n), n);
273
+ return () => (t !== this.#n && (n = 1 + e().reduce((e, t) => Math.max(e, _e(t)), 0), t = this.#n), n);
604
274
  }
605
275
  #C(e) {
606
- if (this.#d.has(e)) {
607
- this.#E();
608
- return;
609
- }
610
- this.#d.add(e), this.#p.push(e, this.#T(e.rank)), this.#E();
276
+ this.#d.has(e) || (this.#d.add(e), this.#p.push(e, this.#T(e.rank))), this.#E();
611
277
  }
612
278
  #w(e) {
613
- if (this.#f.has(e)) {
614
- this.#E();
615
- return;
616
- }
617
- this.#f.add(e), this.#m.push(e, this.#T(e.rank)), this.#E();
279
+ this.#f.has(e) || (this.#f.add(e), this.#m.push(e, this.#T(e.rank))), this.#E();
618
280
  }
619
281
  #T(e) {
620
- let t = this.#t % L;
621
- return this.#t += 1, e * L + t;
282
+ let t = this.#t % me;
283
+ return this.#t += 1, e * me + t;
622
284
  }
623
285
  #E() {
624
286
  this.#r > 0 || this.#a || this.#o || (this.#a = !0, queueMicrotask(() => {
@@ -634,7 +296,7 @@ var ke = class {
634
296
  this.#h.clear();
635
297
  }
636
298
  }
637
- }, Ae = class {
299
+ }, be = class {
638
300
  #e = 1;
639
301
  #t = /* @__PURE__ */ new Map();
640
302
  createOwner(e, t) {
@@ -655,7 +317,7 @@ var ke = class {
655
317
  t.clear(), this.#t.delete(e);
656
318
  }
657
319
  }
658
- }, je = class {
320
+ }, xe = class {
659
321
  #e = 1;
660
322
  #t = /* @__PURE__ */ new Map();
661
323
  createRootScope(e) {
@@ -686,106 +348,106 @@ var ke = class {
686
348
  if (!t) throw Error("Unknown scope: " + e);
687
349
  t.params.clear(), t.initializers.clear();
688
350
  }
689
- registerInitializer(e, t, r) {
690
- n(t);
691
- let i = this.#t.get(e);
692
- if (!i) throw Error("Unknown scope: " + e);
693
- if (i.params.has(t) || i.initializers.has(t)) throw Error(`Parameter "${t}" already exists in scope ${e}`);
694
- i.initializers.set(t, {
695
- initialize: r,
351
+ registerInitializer(e, t, n) {
352
+ h(t);
353
+ let r = this.#t.get(e);
354
+ if (!r) throw Error("Unknown scope: " + e);
355
+ if (r.params.has(t) || r.initializers.has(t)) throw Error(`Parameter "${t}" already exists in scope ${e}`);
356
+ r.initializers.set(t, {
357
+ initialize: n,
696
358
  initializing: !1
697
359
  });
698
360
  }
699
- register(e, t, r) {
700
- n(t);
701
- let i = this.#t.get(e);
702
- if (!i) throw Error("Unknown scope: " + e);
703
- if (i.params.has(t) || i.initializers.get(t)?.initializing === !1) throw Error("Parameter \"" + t + "\" already exists in scope " + e);
704
- return i.params.set(t, r), r;
361
+ register(e, t, n) {
362
+ h(t);
363
+ let r = this.#t.get(e);
364
+ if (!r) throw Error("Unknown scope: " + e);
365
+ if (r.params.has(t) || r.initializers.get(t)?.initializing === !1) throw Error("Parameter \"" + t + "\" already exists in scope " + e);
366
+ return r.params.set(t, n), n;
705
367
  }
706
368
  resolve(e, t) {
707
- n(t);
708
- let r = e;
709
- for (; r;) {
710
- let e = this.#t.get(r);
711
- if (!e) throw Error("Unknown scope: " + r);
712
- let n = e.initializers.get(t);
713
- if (n) {
714
- if (n.initializing) throw Error(`Parameter dependency cycle while initializing "${t}" in ${r}.`);
715
- n.initializing = !0;
369
+ h(t);
370
+ let n = e;
371
+ for (; n;) {
372
+ let e = this.#t.get(n);
373
+ if (!e) throw Error("Unknown scope: " + n);
374
+ let r = e.initializers.get(t);
375
+ if (r) {
376
+ if (r.initializing) throw Error(`Parameter dependency cycle while initializing "${t}" in ${n}.`);
377
+ r.initializing = !0;
716
378
  try {
717
- if (n.initialize(), !e.params.has(t)) throw Error(`Initializer did not register parameter "${t}".`);
379
+ if (r.initialize(), !e.params.has(t)) throw Error(`Initializer did not register parameter "${t}".`);
718
380
  e.initializers.delete(t);
719
381
  } finally {
720
- n.initializing = !1;
382
+ r.initializing = !1;
721
383
  }
722
384
  }
723
385
  let i = e.params.get(t);
724
386
  if (i) return i;
725
- r = e.parentScope;
387
+ n = e.parentScope;
726
388
  }
727
389
  }
728
390
  };
729
391
  //#endregion
730
392
  //#region ../core/src/paramRuntime/expressionCompiler.js
731
- function Me(e, t = {}, n = {}) {
732
- return ne(e, t, n);
393
+ function Se(e, t = {}, n = {}) {
394
+ return c(e, t, n);
733
395
  }
734
396
  //#endregion
735
397
  //#region ../core/src/paramRuntime/expressionRef.js
736
- function z(t, n, r = {}) {
737
- let i = {}, a = Me(t, i, r), o = /* @__PURE__ */ new Map();
398
+ function E(e, t, n = {}) {
399
+ let r = {}, i = Se(e, r, n), a = /* @__PURE__ */ new Map();
738
400
  try {
739
- for (let e of a.globals) {
740
- if (o.has(e)) continue;
741
- let r = n(e);
742
- if (!r) throw Error("Unknown variable \"" + e + "\" in expression: " + t);
743
- o.set(e, r), Object.defineProperty(i, e, {
401
+ for (let n of i.globals) {
402
+ if (a.has(n)) continue;
403
+ let i = t(n);
404
+ if (!i) throw Error("Unknown variable \"" + n + "\" in expression: " + e);
405
+ a.set(n, i), Object.defineProperty(r, n, {
744
406
  enumerable: !0,
745
407
  get() {
746
- return r.get();
408
+ return i.get();
747
409
  }
748
410
  });
749
411
  }
750
- } catch (t) {
751
- throw e(t, r.specLocation);
412
+ } catch (e) {
413
+ throw o(e, n.specLocation);
752
414
  }
753
415
  let s = /* @__PURE__ */ new Set();
754
- return a.subscribe = (e) => {
416
+ return i.subscribe = (e) => {
755
417
  let t = [];
756
- for (let n of o.values()) t.push(n.subscribe(e));
757
- for (let n of a.scaleDependencies ?? []) t.push(n.subscribe(e));
418
+ for (let n of a.values()) t.push(n.subscribe(e));
419
+ for (let n of i.scaleDependencies ?? []) t.push(n.subscribe(e));
758
420
  let n = !0, r = () => {
759
421
  n && (n = !1, s.delete(r), t.forEach((e) => e()));
760
422
  };
761
423
  return s.add(r), r;
762
- }, a.invalidate = () => {
424
+ }, i.invalidate = () => {
763
425
  for (let e of s) e();
764
426
  s.clear();
765
- }, a.createSnapshotEvaluator = () => {
427
+ }, i.createSnapshotEvaluator = () => {
766
428
  let e = {};
767
- for (let t of Object.keys(i)) o.has(t) || (e[t] = i[t]);
768
- for (let [t, n] of o) n.batchStable || Object.defineProperty(e, t, {
429
+ for (let t of Object.keys(r)) a.has(t) || (e[t] = r[t]);
430
+ for (let [t, n] of a) n.batchStable || Object.defineProperty(e, t, {
769
431
  enumerable: !0,
770
432
  get: () => n.get()
771
433
  });
772
- let t = Object.assign(a.createEvaluator(e), { refresh() {
773
- for (let [t, n] of o) n.batchStable && (e[t] = n.get());
434
+ let t = Object.assign(i.createEvaluator(e), { refresh() {
435
+ for (let [t, n] of a) n.batchStable && (e[t] = n.get());
774
436
  } });
775
437
  return t.refresh(), t;
776
- }, a.identifier = () => a.code + "|" + Array.from(o.values()).map((e) => e.id).concat((a.scaleDependencies ?? []).map((e) => e.id)).join(","), a.dependencies = Array.from(o.values()).concat(a.scaleDependencies ?? []), {
777
- expression: a,
778
- dependencies: a.dependencies
438
+ }, 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 ?? []), {
439
+ expression: i,
440
+ dependencies: i.dependencies
779
441
  };
780
442
  }
781
443
  //#endregion
782
444
  //#region ../core/src/paramRuntime/paramRuntime.js
783
- var Ne = class {
784
- #e = new Ae();
445
+ var Ce = class {
446
+ #e = new be();
785
447
  #t;
786
- #n = new je();
448
+ #n = new xe();
787
449
  constructor(e = {}) {
788
- this.#t = new ke({
450
+ this.#t = new ye({
789
451
  lifecycleRegistry: this.#e,
790
452
  onError: e.onError
791
453
  });
@@ -814,11 +476,14 @@ var Ne = class {
814
476
  return this.#n.register(e, t, a);
815
477
  }
816
478
  registerDerived(e, t, n, r) {
817
- let { expression: i, dependencies: a } = z(n, (t) => this.resolve(r?.expressionScope ?? e, t), r), o = this.#n.getOwnerId(e), s = this.#t.computed(o, t, a, () => i(null));
479
+ let { expression: i, dependencies: a } = E(n, (t) => this.resolve(r?.expressionScope ?? e, t), r), o = this.#n.getOwnerId(e), s = this.#t.computed(o, t, a, () => i(null));
818
480
  return this.#n.register(e, t, s);
819
481
  }
482
+ registerComputed(e, t, n, r) {
483
+ return this.#n.register(e, t, this.#t.computed(this.#n.getOwnerId(e), t, n, r));
484
+ }
820
485
  createExpression(e, t, n) {
821
- let { expression: r } = z(t, (t) => this.resolve(e, t), n);
486
+ let { expression: r } = E(t, (t) => this.resolve(e, t), n);
822
487
  return r;
823
488
  }
824
489
  resolve(e, t) {
@@ -851,28 +516,82 @@ var Ne = class {
851
516
  whenPropagated(e) {
852
517
  return this.#t.whenPropagated(e);
853
518
  }
854
- }, Pe = (e) => new Promise((t) => setTimeout(t, e));
855
- function Fe() {
519
+ }, we = class {
520
+ #e;
521
+ #t;
522
+ #n;
523
+ #r;
524
+ #i = /* @__PURE__ */ new Set();
525
+ #a = !1;
526
+ #o;
527
+ #s;
528
+ constructor(e, t, n) {
529
+ this.#e = e, this.#t = t, this.#n = n, this.#o = e.signal("intervalCompletion", 0), this.#s = e.effect([e.getParamRef(t), this.#o], () => {
530
+ if (this.#a) {
531
+ this.#a = !1;
532
+ for (let n of Array.from(this.#i)) try {
533
+ n(e.getValue(t));
534
+ } catch (e) {
535
+ console.error(e);
536
+ }
537
+ }
538
+ });
539
+ }
540
+ beforeWrite(e, t) {
541
+ let n = this.#n;
542
+ if (n) {
543
+ if (e?.type !== "interval") throw Error(`Parameter "${this.#t}" requires an interval selection.`);
544
+ i(e.intervals, n);
545
+ }
546
+ this.#r && t !== this.#r.host && this.cancel(), this.#a = !this.#r && !se(e, this.#e.getValue(this.#t));
547
+ }
548
+ begin(e, t) {
549
+ this.cancel(), this.#r = {
550
+ host: e,
551
+ cancel: t,
552
+ initial: structuredClone(this.#e.getValue(this.#t))
553
+ };
554
+ }
555
+ finish(e, t) {
556
+ if (this.#r?.host !== e) return;
557
+ let n = this.#r.initial;
558
+ this.#r = void 0, t && !se(n, this.#e.getValue(this.#t)) && (this.#a = !0, this.#o.set(this.#o.get() + 1), this.#e.flushNow());
559
+ }
560
+ cancel() {
561
+ let e = this.#r;
562
+ this.#r = void 0, e?.cancel();
563
+ }
564
+ clear() {
565
+ this.cancel();
566
+ let e = this.#e.getValue(this.#t);
567
+ a(e) && this.#e.setValue(this.#t, t(Object.keys(e.intervals)));
568
+ }
569
+ subscribeCommit(e) {
570
+ return this.#i.add(e), () => {
571
+ this.#i.delete(e);
572
+ };
573
+ }
574
+ dispose() {
575
+ this.cancel(), this.#s(), this.#i.clear();
576
+ }
577
+ }, Te = (e) => new Promise((t) => setTimeout(t, e));
578
+ function Ee() {
856
579
  return { canceled: !1 };
857
580
  }
858
- function Ie(e) {
581
+ function De(e) {
859
582
  let t = e.requestAnimationFrame || window.requestAnimationFrame, n = e.signal, r = e.cancelToken, i = () => new Promise((i, a) => {
860
583
  if (r?.canceled) return i();
861
584
  if (n?.aborted) return a("aborted");
862
585
  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) => {
863
- if (r?.canceled) {
864
- i();
865
- return;
866
- }
867
- n?.aborted ? a("aborted") : (e.onUpdate(f(u(p(d(o))))), o < s ? t(m) : (e.onUpdate(f(u(1))), i()));
586
+ r?.canceled ? i() : n?.aborted ? a("aborted") : (e.onUpdate(f(u(p(d(o))))), o < s ? t(m) : (e.onUpdate(f(u(1))), i()));
868
587
  };
869
588
  t(m);
870
589
  });
871
- return e.delay ? r?.canceled ? Promise.resolve() : n?.aborted ? Promise.reject("aborted") : Pe(e.delay).then(i) : i();
590
+ return e.delay ? r?.canceled ? Promise.resolve() : n?.aborted ? Promise.reject("aborted") : Te(e.delay).then(i) : i();
872
591
  }
873
592
  //#endregion
874
593
  //#region ../core/src/utils/animator.js
875
- var Le = class {
594
+ var Oe = class {
876
595
  constructor(e, t) {
877
596
  this._renderCallback = e, this._onError = t, this._renderRequested = !1, this._finalized = !1, this._warn = !1, this._animationFrameRequest = void 0, this.transitions = [], this.transitionsEnabled = !0;
878
597
  }
@@ -903,13 +622,13 @@ var Le = class {
903
622
  this._finalized = !0, this._renderRequested = !1, this.transitions = [], this._animationFrameRequest !== void 0 && (window.cancelAnimationFrame(this._animationFrameRequest), this._animationFrameRequest = void 0);
904
623
  }
905
624
  transition(e) {
906
- return Ie({
625
+ return De({
907
626
  requestAnimationFrame: (e) => this.requestTransition(e),
908
627
  ...e
909
628
  });
910
629
  }
911
630
  };
912
- function Re(e, t, n, r, i) {
631
+ function ke(e, t, n, r, i) {
913
632
  let a = 0, o = !0, s = !1, c = structuredClone(i), l = c;
914
633
  function u(e, t, n, r) {
915
634
  return t + (e - t) * 2 ** (-n / r);
@@ -928,7 +647,7 @@ function Re(e, t, n, r, i) {
928
647
  s || (s = !0, e.requestTransition(d));
929
648
  }
930
649
  function p(n) {
931
- l = n, e.transitionsEnabled === !1 ? (c = l, o = !0, s = !1, e.cancelTransition(d), t(c)) : o && (o = !1, a = ze(), d(a));
650
+ l = n, e.transitionsEnabled === !1 ? (c = l, o = !0, s = !1, e.cancelTransition(d), t(c)) : o && (o = !1, a = Ae(), d(a));
932
651
  }
933
652
  return p.stop = () => {
934
653
  o = !0, s = !1, e.cancelTransition(d);
@@ -936,168 +655,228 @@ function Re(e, t, n, r, i) {
936
655
  l = e, c = e, p.stop(), t(c);
937
656
  }, p;
938
657
  }
939
- function ze() {
658
+ function Ae() {
940
659
  let e = globalThis.document?.timeline?.currentTime;
941
660
  return typeof e == "number" ? e : performance.now();
942
661
  }
943
662
  //#endregion
944
663
  //#region ../core/src/paramRuntime/viewParamRuntime.js
945
- var B = class {
664
+ var je = class {
946
665
  #e;
947
666
  #t;
948
667
  #n = /* @__PURE__ */ new Map();
949
668
  #r = /* @__PURE__ */ new Map();
950
- #i = /* @__PURE__ */ new Map();
951
- #a = /* @__PURE__ */ new Set();
669
+ #i = !0;
670
+ #a = /* @__PURE__ */ new Map();
952
671
  #o = /* @__PURE__ */ new Map();
953
- #s;
954
- #c = /* @__PURE__ */ new Map();
672
+ #s = /* @__PURE__ */ new Map();
673
+ #c = /* @__PURE__ */ new Set();
955
674
  #l = /* @__PURE__ */ new Map();
956
675
  #u = /* @__PURE__ */ new Map();
957
676
  #d;
958
- #f;
959
- #p;
960
- #m;
677
+ #f = /* @__PURE__ */ new Map();
678
+ #p = /* @__PURE__ */ new Map();
679
+ #m = /* @__PURE__ */ new Map();
961
680
  #h;
962
- #g = !1;
681
+ #g;
682
+ #_;
683
+ #v;
684
+ #y;
685
+ #b = !1;
963
686
  constructor(e, t, n, r = {}) {
964
- this.#d = e ?? (() => void 0), this.#f = t ?? (() => void 0), this.#p = n, this.#h = r.getSpecOrigin, this.#m = r.settleTemporalUpdatesImmediately ?? !1;
965
- let i = this.#d();
966
- i ? (this.#e = i.#e, this.#t = this.#e.createScope(i.#t)) : (this.#e = new Ne({ onError: r.onError }), this.#t = this.#e.createScope());
687
+ this.#h = e ?? (() => void 0), this.#g = t ?? (() => void 0), this.#_ = n, this.#y = r.getSpecOrigin, this.#v = r.settleTemporalUpdatesImmediately ?? !1;
688
+ let i = this.#h();
689
+ i ? (this.#e = i.#e, this.#t = this.#e.createScope(i.#t)) : (this.#e = new Ce({ onError: r.onError }), this.#t = this.#e.createScope());
967
690
  }
968
691
  setSelectionSource(e) {
969
- this.#s = e;
692
+ this.#d = e;
970
693
  }
971
694
  findSelectionCapability(e) {
972
- let t = this.findRuntimeForParam(e), n = t && t.#c.get(e);
695
+ let t = this.findRuntimeForParam(e), n = t && t.#f.get(e);
973
696
  if (!n?.size) return;
974
697
  let r = Array.from(n, (t) => ({
975
698
  type: t.kind,
976
699
  components: t.components.map((e) => ({
977
700
  component: e,
978
- type: t.source?.getScaleResolution(e)?.type
701
+ type: t.kind === "interval" ? t.source?.getScaleResolution(e)?.type : void 0
979
702
  })),
980
703
  location: t.source?.name ?? e
981
704
  })), i = r[0], a = JSON.stringify(i.components), o = r.find(({ components: e }) => JSON.stringify(e) !== a);
982
705
  if (o) throw Error(`Conflicting selection declarations for "${e}" in "${i.location}" and "${o.location}".`);
983
706
  return i;
984
707
  }
985
- #_(e) {
986
- if (!("select" in e)) return;
987
- let n = t(e.select), r = n.type === "interval" ? "interval" : n.toggle ? "multi" : "single", i = n.type === "interval" ? Array.from(new Set(n.encodings)).sort() : [], a = e.push === "outer" ? this.findRuntimeForParam(e.name) : this, o = {
708
+ #x(t) {
709
+ if (!("select" in t)) return;
710
+ let n = e(t.select), r = n.type === "interval" ? "interval" : n.encodings ? "categories" : n.toggle ? "multi" : "single", i = n.encodings ? Array.from(new Set(n.encodings)).sort() : [], a = t.push === "outer" ? this.findRuntimeForParam(t.name) : this, o = {
988
711
  kind: r,
712
+ toggle: n.type === "point" ? !!n.toggle : void 0,
989
713
  components: i,
990
- source: this.#s
991
- }, s = a.#c.get(e.name) ?? /* @__PURE__ */ new Set(), c = s.values().next().value;
992
- if (c && (c.kind !== r || JSON.stringify(c.components) !== JSON.stringify(i))) throw Error(`Conflicting selection declarations for "${e.name}" in "${c.source?.name ?? e.name}" and "${this.#s?.name ?? e.name}".`);
993
- s.add(o), a.#c.set(e.name, s), this.#e.addScopeDisposer(this.#t, () => {
714
+ source: this.#d
715
+ }, s = a.#f.get(t.name) ?? /* @__PURE__ */ new Set(), c = s.values().next().value;
716
+ if (c && (c.kind !== r || c.toggle !== o.toggle || JSON.stringify(c.components) !== JSON.stringify(i))) throw Error(`Conflicting selection declarations for "${t.name}" in "${c.source?.name ?? t.name}" and "${this.#d?.name ?? t.name}".`);
717
+ s.add(o), a.#f.set(t.name, s), this.#e.addScopeDisposer(this.#t, () => {
994
718
  s.delete(o);
995
719
  });
996
720
  }
997
- #v(e) {
721
+ #S(e) {
998
722
  return {
999
- resolveScaleResolution: this.#f,
723
+ resolveScaleResolution: this.#g,
1000
724
  specLocation: this.getSpecLocation(e, ["expr"])
1001
725
  };
1002
726
  }
1003
- registerParam(t, r = {}) {
1004
- let i = t.name;
727
+ registerOutput(e) {
728
+ return this.registerParam({ name: e }), this.#C(e);
729
+ }
730
+ #C(e) {
731
+ let t = this.#r.get(e);
732
+ if (t) return t;
733
+ if (!this.#i) throw Error("Cannot add a transform output to configured ancestor parameter \"" + e + "\". Create its owner and producer together.");
734
+ let n = this.#s.get(e);
735
+ if (!n || Object.keys(n).some((e) => e !== "name" && e !== "description") || this.#a.get(e)?.size) throw Error("Transform output target \"" + e + "\" must be a bare parameter with no other writers.");
736
+ let r = this.#o.get(e), i = new oe(r);
737
+ return i.owner = this.#d, this.#n.delete(e), this.#r.set(e, i), this.#s.set(e, {
738
+ ...n,
739
+ persist: !1
740
+ }), r.set(Object.freeze([])), this.#e.flushNow(), i;
741
+ }
742
+ finalizeOutputDeclarations() {
743
+ this.#i = !1;
744
+ }
745
+ getOutput(e) {
746
+ let t = this.#r.get(e);
747
+ if (!t) throw Error("Output parameter \"" + e + "\" is not declared.");
748
+ return t;
749
+ }
750
+ resolveOutput(e) {
751
+ if (typeof e == "string") return this.getOutput(e);
752
+ if (e.push !== "outer") throw Error("Transform output pushing requires push: \"outer\".");
753
+ let t = this.#h()?.findRuntimeForParam(e.name);
754
+ if (!t) throw Error("Output parameter \"" + e.name + "\" not found in outer scope.");
755
+ return t.#C(e.name);
756
+ }
757
+ get outputs() {
758
+ return this.#r.values();
759
+ }
760
+ isWritable(e) {
761
+ return this.#n.has(e);
762
+ }
763
+ registerParam(e, t = {}) {
764
+ let n = e.name;
1005
765
  try {
1006
- n(i);
1007
- } catch (n) {
1008
- throw e(n, this.getSpecLocation(t, ["name"]));
766
+ h(n);
767
+ } catch (t) {
768
+ throw o(t, this.getSpecLocation(e, ["name"]));
1009
769
  }
1010
- if (this.#i.has(i) || this.#a.has(i)) throw e(/* @__PURE__ */ Error("Parameter \"" + i + "\" already registered in this scope."), this.getSpecLocation(t, ["name"]));
1011
- if (Ve(t), r.defer) {
1012
- if (!("expr" in t)) throw Error("Only expression parameters can be deferred.");
1013
- return this.#e.registerInitializer(this.#t, i, () => {
1014
- this.#y(t);
1015
- }), this.#i.set(i, t), () => {
1016
- throw Error("Cannot set derived parameter \"" + i + "\".");
770
+ if (this.#s.has(n) || this.#c.has(n)) throw o(/* @__PURE__ */ Error("Parameter \"" + n + "\" already registered in this scope."), this.getSpecLocation(e, ["name"]));
771
+ if (Ne(e), t.defer) {
772
+ if (!("expr" in e)) throw Error("Only expression parameters can be deferred.");
773
+ return this.#e.registerInitializer(this.#t, n, () => {
774
+ this.#w(e);
775
+ }), this.#s.set(n, e), () => {
776
+ throw Error("Cannot set derived parameter \"" + n + "\".");
1017
777
  };
1018
778
  }
1019
- return this.#y(t);
779
+ return this.#w(e);
1020
780
  }
1021
781
  registerLazyExpression(e, t, n) {
1022
782
  this.#e.registerInitializer(this.#t, e, () => {
1023
783
  n?.();
1024
- let r = this.#e.registerDerived(this.#t, e, t, this.#v());
1025
- this.#r.set(e, r);
1026
- }), this.#a.add(e);
784
+ let r = this.#e.registerDerived(this.#t, e, t, this.#S());
785
+ this.#o.set(e, r);
786
+ }), this.#c.add(e);
787
+ }
788
+ registerComputed(e, t, n) {
789
+ this.#e.registerInitializer(this.#t, e, () => {
790
+ this.#o.set(e, this.#e.registerComputed(this.#t, e, t(), n));
791
+ }), this.#c.add(e);
1027
792
  }
1028
793
  registerScopedExpression(e, t, n) {
1029
794
  if (this.#e !== n.#e) throw Error("Scoped expressions must share a parameter runtime.");
1030
- if (this.#i.has(e)) throw Error("Parameter \"" + e + "\" already registered in this scope.");
795
+ if (this.#s.has(e)) throw Error("Parameter \"" + e + "\" already registered in this scope.");
1031
796
  this.#e.registerInitializer(this.#t, e, () => {
1032
797
  let r = this.#e.registerDerived(this.#t, e, t, {
1033
798
  expressionScope: n.#t,
1034
- ...n.#v()
799
+ ...n.#S()
1035
800
  });
1036
- this.#r.set(e, r);
1037
- }), this.#i.set(e, {
801
+ this.#o.set(e, r);
802
+ }), this.#s.set(e, {
1038
803
  name: e,
1039
804
  expr: t
1040
805
  });
1041
806
  }
1042
- #y(t) {
807
+ #w(t) {
1043
808
  let n = t.name, r, i;
1044
809
  if (t.push == "outer") {
1045
- let a = this.findRuntimeForParam(n);
1046
- if (!a) throw e(/* @__PURE__ */ Error(`Parameter "${n}" not found in outer scope!`), this.getSpecLocation(t, ["name"]));
1047
- let s = a.paramConfigs.get(n);
1048
- if (!s) throw Error(`Outer parameter "${n}" exists as a value but has no registered config.`);
1049
- if ("expr" in s || "select" in s || "ruler" in s) throw Error(`The outer parameter "${n}" must not have expr, select, or ruler properties!`);
1050
- r = (e) => {
1051
- a.setValue(n, e);
1052
- }, this.#n.set(n, r), "ruler" in t && (i = o(t, this), r(i));
1053
- } else if ("value" in t) i = o(t, this), r = "transition" in t ? this.#x(n, i, t.transition) : this.#b(n, i);
1054
- else if (l(t)) {
1055
- if ("transition" in t) this.#S(n, t, t.transition);
1056
- else if ("debounce" in t) this.#C(n, t, t.debounce);
810
+ let e = this.findRuntimeForParam(n);
811
+ if (!e) throw o(/* @__PURE__ */ Error(`Parameter "${n}" not found in outer scope!`), this.getSpecLocation(t, ["name"]));
812
+ let a = e.paramConfigs.get(n);
813
+ if (!a) throw Error(`Outer parameter "${n}" exists as a value but has no registered config.`);
814
+ if ("expr" in a || "select" in a && !("select" in t) || "ruler" in a || !e.isWritable(n)) throw Error(`The outer parameter "${n}" must not have expr, select, or ruler properties!`);
815
+ r = (t, r = {}) => {
816
+ e.setValue(n, t, r);
817
+ }, this.#n.set(n, r);
818
+ let s = e.#a.get(n) ?? /* @__PURE__ */ new Set();
819
+ s.add(this), e.#a.set(n, s), this.#e.addScopeDisposer(this.#t, () => {
820
+ s.delete(this);
821
+ }), "ruler" in t && (i = g(t, this), r(i));
822
+ } else if ("value" in t) i = g(t, this), r = "transition" in t ? this.#T(n, i, t.transition) : this.allocateSetter(n, i);
823
+ else if (y(t)) {
824
+ if ("transition" in t) this.#E(n, t, t.transition);
825
+ else if ("debounce" in t) this.#D(n, t, t.debounce);
1057
826
  else {
1058
- let e = this.#e.registerDerived(this.#t, n, t.expr, this.#v(t));
1059
- this.#r.set(n, e);
827
+ let e = this.#e.registerDerived(this.#t, n, t.expr, this.#S(t));
828
+ this.#o.set(n, e);
1060
829
  }
1061
830
  r = () => {
1062
831
  throw Error("Cannot set derived parameter \"" + n + "\".");
1063
832
  };
1064
- } else i = o(t, this), r = this.#b(n, i);
833
+ } else i = g(t, this), r = this.allocateSetter(n, i);
1065
834
  if ("select" in t) {
1066
- if (i ??= o(t, this), !this.#n.has(n)) {
835
+ if (t.push === "outer") {
836
+ let e = this.findValue(n);
837
+ e && [
838
+ "single",
839
+ "multi",
840
+ "categories",
841
+ "interval"
842
+ ].includes(e.type) && (i = e);
843
+ }
844
+ if (i ??= g(t, this), !this.#n.has(n)) {
1067
845
  let e = this.#e.registerSelection(this.#t, n, i);
1068
- this.#r.set(n, e), this.#n.set(n, (t) => {
1069
- e.set(t), this.#e.flushNow();
846
+ this.#o.set(n, e), this.#n.set(n, (t, r) => {
847
+ this.#u.get(n)?.beforeWrite(t, r?.intervalGesture), e.set(t), this.#e.flushNow();
1070
848
  }), r = this.#n.get(n);
1071
849
  }
1072
850
  r(i);
1073
851
  }
1074
- return this.#i.set(n, t), this.#_(t), r;
1075
- }
1076
- allocateSetter(e, t, r = !1) {
1077
- if (n(e), this.#n.has(e)) throw Error("Setter already allocated for parameter: " + e);
1078
- let i = this.#e.registerBase(this.#t, e, t, { notify: !r });
1079
- this.#r.set(e, i);
1080
- let a = (e) => {
1081
- i.set(e), this.#e.flushNow();
852
+ return this.#s.set(n, t), this.#x(t), "select" in t && e(t.select).type === "interval" && this.getIntervalSelectionState(n).beforeWrite(this.findValue(n)), r;
853
+ }
854
+ allocateSetter(e, t, n = !1) {
855
+ if (h(e), this.#n.has(e)) throw Error("Setter already allocated for parameter: " + e);
856
+ let r = this.#e.registerBase(this.#t, e, t, { notify: !n });
857
+ this.#o.set(e, r);
858
+ let i = (t, n = {}) => {
859
+ if (this.#r.has(e)) throw Error("Cannot set output parameter \"" + e + "\".");
860
+ this.#u.get(e)?.beforeWrite(t, n?.intervalGesture), r.set(t), this.#e.flushNow();
1082
861
  };
1083
- return this.#n.set(e, a), a;
862
+ return this.#n.set(e, i), i;
1084
863
  }
1085
- setValue(e, t, r) {
1086
- n(e);
1087
- let i = this.#n.get(e);
1088
- if (!i) throw Error("Writable parameter not found in this scope: " + e);
1089
- i(t, r);
864
+ setValue(e, t, n) {
865
+ h(e);
866
+ let r = this.#n.get(e);
867
+ if (!r) throw Error("Writable parameter not found in this scope: " + e);
868
+ r(t, n);
1090
869
  }
1091
870
  getValue(e) {
1092
- return !this.#r.has(e) && this.hasLocalParam(e) && this.#e.resolve(this.#t, e), this.#r.get(e)?.get();
871
+ return !this.#o.has(e) && this.hasLocalParam(e) && this.#e.resolve(this.#t, e), this.#o.get(e)?.get();
1093
872
  }
1094
873
  getParamRef(e) {
1095
- n(e);
874
+ h(e);
1096
875
  let t = this.findRuntimeForParam(e);
1097
- if (t) return t.#r.has(e) || t.#e.resolve(t.#t, e), t.#r.get(e);
876
+ if (t) return t.#o.has(e) || t.#e.resolve(t.#t, e), t.#o.get(e);
1098
877
  }
1099
878
  getTargetValue(e) {
1100
- return n(e), this.#l.get(e)?.target ?? this.#u.get(e)?.target ?? this.getValue(e);
879
+ return h(e), this.#p.get(e)?.target ?? this.#m.get(e)?.target ?? this.getValue(e);
1101
880
  }
1102
881
  subscribe(e, t) {
1103
882
  let n = this.getParamRef(e);
@@ -1111,38 +890,53 @@ var B = class {
1111
890
  return this.findRuntimeForParam(e)?.getTargetValue(e);
1112
891
  }
1113
892
  get paramConfigs() {
1114
- return this.#i;
893
+ return this.#s;
1115
894
  }
1116
895
  hasLocalParam(e) {
1117
- n(e);
1118
- let t = this.#i.get(e);
1119
- return this.#r.has(e) || this.#a.has(e) || t !== void 0 && "expr" in t;
896
+ h(e);
897
+ let t = this.#s.get(e);
898
+ return this.#o.has(e) || this.#c.has(e) || t !== void 0 && "expr" in t;
1120
899
  }
1121
900
  isPendingParam(e) {
1122
901
  let t = this.findRuntimeForParam(e);
1123
- return t !== void 0 && !t.#r.has(e);
902
+ return t !== void 0 && !t.#o.has(e);
1124
903
  }
1125
904
  hasConfiguredParamInScopeChain(e) {
1126
- return n(e), this.#i.has(e) ? !0 : this.#d()?.hasConfiguredParamInScopeChain(e) ?? !1;
905
+ return h(e), this.#s.has(e) ? !0 : this.#h()?.hasConfiguredParamInScopeChain(e) ?? !1;
1127
906
  }
1128
907
  findRuntimeForParam(e) {
1129
- return this.hasLocalParam(e) ? this : this.#d()?.findRuntimeForParam(e);
908
+ return this.hasLocalParam(e) ? this : this.#h()?.findRuntimeForParam(e);
1130
909
  }
1131
910
  findConfiguredParam(e) {
1132
- let t = this.#i.get(e);
911
+ let t = this.#s.get(e);
1133
912
  return t ? {
1134
913
  runtime: this,
1135
914
  config: t
1136
- } : this.#d()?.findConfiguredParam(e);
915
+ } : this.#h()?.findConfiguredParam(e);
916
+ }
917
+ getIntervalSelectionState(e) {
918
+ let t = this.findRuntimeForParam(e), n = t.#u.get(e);
919
+ if (!n) {
920
+ let r = t.#f.get(e)?.values().next().value;
921
+ n = new we(t, e, r?.components.find(s)), t.#u.set(e, n);
922
+ }
923
+ return n;
924
+ }
925
+ getComplexIntervals(e, t) {
926
+ let n = this.findRuntimeForParam(e).#f.get(e)?.values().next().value?.source;
927
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => {
928
+ let r = n?.getScaleResolution(e);
929
+ return [e, t ? t.map((e) => r ? r.toComplex(e) : e) : null];
930
+ }));
1137
931
  }
1138
932
  registerSelectionController(e, t) {
1139
- let n = this.#o.get(e);
1140
- return n || (n = /* @__PURE__ */ new Set(), this.#o.set(e, n)), n.add(t), () => {
1141
- n.delete(t), n.size === 0 && this.#o.delete(e);
933
+ let n = this.#l.get(e);
934
+ return n || (n = /* @__PURE__ */ new Set(), this.#l.set(e, n)), n.add(t), () => {
935
+ n.delete(t), n.size === 0 && this.#l.delete(e);
1142
936
  };
1143
937
  }
1144
938
  getSelectionController(e) {
1145
- let t = this.#o.get(e);
939
+ let t = this.#l.get(e);
1146
940
  if (t) {
1147
941
  if (t.size > 1) throw Error(`Selection "${e}" has ambiguous interaction ownership.`);
1148
942
  return t.values().next().value;
@@ -1150,29 +944,29 @@ var B = class {
1150
944
  }
1151
945
  getDebugState() {
1152
946
  let e = [];
1153
- for (let [t, n] of this.#r) {
1154
- let r = this.#i.get(t);
947
+ for (let [t, n] of this.#o) {
948
+ let r = this.#s.get(t);
1155
949
  e.push({
1156
950
  name: t,
1157
- kind: Be(r),
951
+ kind: Me(r),
1158
952
  value: n.get(),
1159
953
  writable: this.#n.has(t),
1160
954
  configured: !!r,
1161
955
  config: r ? structuredClone(r) : void 0,
1162
- target: this.#l.get(t)?.target ?? this.#u.get(t)?.target
956
+ target: this.#p.get(t)?.target ?? this.#m.get(t)?.target
1163
957
  });
1164
958
  }
1165
959
  return {
1166
960
  scopeId: this.#t,
1167
- disposed: this.#g,
961
+ disposed: this.#b,
1168
962
  params: e
1169
963
  };
1170
964
  }
1171
965
  getSpecLocation(e, t) {
1172
- return ee(e, this.#h, t);
966
+ return te(e, this.#y, t);
1173
967
  }
1174
968
  createExpression(e) {
1175
- return this.#e.createExpression(this.#t, typeof e == "string" ? e : e.expr, this.#v(typeof e == "string" ? void 0 : e));
969
+ return this.#e.createExpression(this.#t, typeof e == "string" ? e : e.expr, this.#S(typeof e == "string" ? void 0 : e));
1176
970
  }
1177
971
  watchExpression(e, t, n = {}) {
1178
972
  let r = this.createExpression(e), i = r.subscribe(t);
@@ -1199,59 +993,51 @@ var B = class {
1199
993
  cancelUpdate(e) {
1200
994
  this.#e.cancelUpdate(e);
1201
995
  }
1202
- #b(e, t) {
1203
- let n = this.#e.registerBase(this.#t, e, t);
1204
- this.#r.set(e, n);
1205
- let r = (e) => {
1206
- n.set(e), this.#e.flushNow();
1207
- };
1208
- return this.#n.set(e, r), r;
1209
- }
1210
- #x(e, t, n) {
1211
- let r = this.#w(e, t, n), i = (t, n) => {
1212
- this.#T(e, r, t, n);
996
+ #T(e, t, n) {
997
+ let r = this.#O(e, t, n), i = (t, n) => {
998
+ this.#k(e, r, t, n);
1213
999
  };
1214
1000
  return this.#n.set(e, i), i;
1215
1001
  }
1216
- #S(e, t, n) {
1217
- let r = this.createExpression(t), i = this.#w(e, r(null), n), a = r.subscribe(() => {
1218
- this.#T(e, i, r(null), { animate: !this.#m });
1002
+ #E(e, t, n) {
1003
+ let r = this.createExpression(t), i = this.#O(e, r(null), n), a = r.subscribe(() => {
1004
+ this.#k(e, i, r(null), { animate: !this.#v });
1219
1005
  });
1220
1006
  this.#e.addScopeDisposer(this.#t, a);
1221
1007
  }
1222
- #C(e, t, n) {
1008
+ #D(e, t, n) {
1223
1009
  let r = this.createExpression(t), i = r(null), a = this.#e.registerBase(this.#t, e, i);
1224
- this.#r.set(e, a);
1010
+ this.#o.set(e, a);
1225
1011
  let o = {
1226
1012
  target: i,
1227
1013
  timeout: void 0
1228
1014
  }, s = () => {
1229
1015
  o.timeout = void 0, a.set(o.target), this.#e.flushNow();
1230
1016
  }, c = r.subscribe(() => {
1231
- o.target = r(null), clearTimeout(o.timeout), o.timeout = void 0, o.target !== a.get() && (this.#m ? s() : o.timeout = setTimeout(s, n));
1017
+ o.target = r(null), clearTimeout(o.timeout), o.timeout = void 0, o.target !== a.get() && (this.#v ? s() : o.timeout = setTimeout(s, n));
1232
1018
  });
1233
- this.#u.set(e, o), this.#e.addScopeDisposer(this.#t, () => {
1234
- clearTimeout(o.timeout), c(), this.#u.delete(e);
1019
+ this.#m.set(e, o), this.#e.addScopeDisposer(this.#t, () => {
1020
+ clearTimeout(o.timeout), c(), this.#m.delete(e);
1235
1021
  });
1236
1022
  }
1237
- #w(e, t, n) {
1238
- let r = He(e, t), i = this.#e.registerBase(this.#t, e, r);
1239
- this.#r.set(e, i);
1240
- let a = this.#p;
1023
+ #O(e, t, n) {
1024
+ let r = Pe(e, t), i = this.#e.registerBase(this.#t, e, r);
1025
+ this.#o.set(e, i);
1026
+ let a = this.#_;
1241
1027
  if (!a) throw Error(`The parameter "${e}" uses transition but no animator is available.`);
1242
- let o = Re(a, ({ value: e }) => {
1028
+ let o = ke(a, ({ value: e }) => {
1243
1029
  i.set(e), this.#e.flushNow();
1244
1030
  }, n.halfLife ?? 80, n.epsilon ?? .01, { value: i.get() }), s = {
1245
1031
  target: i.get(),
1246
1032
  smoother: o,
1247
1033
  dispose: () => {
1248
- o.stop(), this.#l.delete(e);
1034
+ o.stop(), this.#p.delete(e);
1249
1035
  }
1250
1036
  };
1251
- return this.#l.set(e, s), this.#e.addScopeDisposer(this.#t, s.dispose), s;
1037
+ return this.#p.set(e, s), this.#e.addScopeDisposer(this.#t, s.dispose), s;
1252
1038
  }
1253
- #T(e, t, n, r = {}) {
1254
- let i = He(e, n);
1039
+ #k(e, t, n, r = {}) {
1040
+ let i = Pe(e, n);
1255
1041
  t.target = i, r.animate === !1 ? t.smoother.snap({ value: i }) : t.smoother({ value: i });
1256
1042
  }
1257
1043
  evaluateAndGet(e) {
@@ -1267,20 +1053,24 @@ var B = class {
1267
1053
  return this.#e.whenPropagated(e);
1268
1054
  }
1269
1055
  finalizeInitialization() {
1270
- this.#m = !1;
1056
+ this.#v = !1;
1271
1057
  }
1272
1058
  dispose() {
1273
- this.#g || (this.#g = !0, this.#e.disposeScope(this.#t), this.#n.clear(), this.#r.clear(), this.#i.clear(), this.#a.clear(), this.#o.clear(), this.#l.clear(), this.#u.clear());
1059
+ if (!this.#b) {
1060
+ this.#b = !0;
1061
+ for (let e of this.#u.values()) e.dispose();
1062
+ this.#u.clear(), this.#e.disposeScope(this.#t), this.#n.clear(), this.#o.clear(), this.#r.clear(), this.#a.clear(), this.#s.clear(), this.#c.clear(), this.#l.clear(), this.#p.clear(), this.#m.clear();
1063
+ }
1274
1064
  }
1275
- hasPointSelections({ inherited: e = !1 } = {}) {
1276
- for (let t = this; t; t = e ? t.#d() : void 0) for (let n of t.#i.values()) if (i(n) && (n.select === "point" || typeof n.select == "object" && n.select.type === "point") && (!e || this.findConfiguredParam(n.name).config === n)) return !0;
1065
+ hasPointSelections({ inherited: e = !1, recordsOnly: t = !1, inputOnly: n = !1 } = {}) {
1066
+ for (let r = this; r; r = e ? r.#h() : void 0) for (let i of r.#s.values()) if (_(i) && (!n || re(i)) && (i.select === "point" || typeof i.select == "object" && i.select.type === "point") && (!t || typeof i.select == "string" || !("encodings" in i.select && i.select.encodings)) && (!e || this.findConfiguredParam(i.name).config === i)) return !0;
1277
1067
  return !1;
1278
1068
  }
1279
1069
  };
1280
- function Be(e) {
1070
+ function Me(e) {
1281
1071
  return e ? e.push === "outer" ? "push" : "select" in e ? "selection" : "ruler" in e ? "ruler" : "expr" in e ? "derived" : "base" : "auto";
1282
1072
  }
1283
- function Ve(e) {
1073
+ function Ne(e) {
1284
1074
  let t = e.name;
1285
1075
  if ("value" in e && "expr" in e) throw Error(`The parameter "${t}" must not have both value and expr properties!`);
1286
1076
  if ("expr" in e && "bind" in e) throw Error(`The parameter "${t}" must not have both expr and bind properties!`);
@@ -1298,16 +1088,275 @@ function Ve(e) {
1298
1088
  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.`);
1299
1089
  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.`);
1300
1090
  }
1301
- function He(e, t) {
1091
+ function Pe(e, t) {
1302
1092
  if (typeof t != "number" || !Number.isFinite(t)) throw Error(`Transitioned parameter "${e}" must have a finite numeric value.`);
1303
1093
  return t;
1304
1094
  }
1305
1095
  //#endregion
1096
+ //#region ../core/src/view/layout/flexLayout.js
1097
+ function Fe(e, t, n = {}) {
1098
+ let { sizes: r } = N(e, t, n.spacing || 0);
1099
+ return Ie(e, r, t, n);
1100
+ }
1101
+ function Ie(e, t, n, { spacing: r, devicePixelRatio: i, offset: a, reverse: o } = {}) {
1102
+ r ||= 0, a ||= 0;
1103
+ let s = 0, c = 0;
1104
+ for (let n = 0; n < e.length; n++) s += t[n], k(e[n]) || c++;
1105
+ let l = s + Math.max(0, c - 1) * r, u = i === void 0 ? (e) => e : (e) => Math.round(e * i) / i, d = 0, f = [], p = (e) => {
1106
+ let t = d;
1107
+ if (!t) return;
1108
+ let n = (e ? r : 0) * (o ? -1 : 1);
1109
+ m -= n;
1110
+ for (let e = 0; e < t; e++) f.push({
1111
+ location: m + (e + 1) / (t + 1) * n,
1112
+ size: 0
1113
+ });
1114
+ m += n, d = 0;
1115
+ }, m = o ? Math.max(n, l) : 0 + a;
1116
+ if (e.length == 1 && k(e[0])) return [{
1117
+ location: m,
1118
+ size: 0
1119
+ }];
1120
+ for (let n = 0; n < e.length; n++) {
1121
+ let i = e[n];
1122
+ if (k(i)) d++;
1123
+ else {
1124
+ p(f.length > 0);
1125
+ let e = t[n];
1126
+ o && (m -= e), f.push({
1127
+ location: u(m),
1128
+ size: u(e)
1129
+ }), o ? m -= r : m += e + r;
1130
+ }
1131
+ }
1132
+ return m += o ? r : -r, p(!1), f;
1133
+ }
1134
+ function Le(e, { spacing: t } = { spacing: 0 }) {
1135
+ let n = 0;
1136
+ for (let r of e) n += F(r) + (k(r) ? 0 : t);
1137
+ return Math.max(0, n - t);
1138
+ }
1139
+ function Re(e, t, { spacing: n = 0 } = {}) {
1140
+ let r = [], i = [], a = 0, o = 0;
1141
+ for (let [s, c] of e.entries()) {
1142
+ let e = F(c), l = !k(c), u = o && l ? n : 0;
1143
+ 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;
1144
+ }
1145
+ return i.length && r.push(i), r;
1146
+ }
1147
+ function ze(e) {
1148
+ let t = 0, n = 0, r = 0, i, a = !0;
1149
+ for (let o of e) {
1150
+ t = Math.max(t, o.px ?? 0), n = Math.max(n, o.grow ?? 0), r = Math.max(r, F(o));
1151
+ let e = I(o);
1152
+ e === void 0 ? a = !1 : i = i === void 0 ? e : Math.max(i, e);
1153
+ }
1154
+ return R({
1155
+ px: t,
1156
+ grow: n,
1157
+ minPx: r,
1158
+ maxPx: a ? i : void 0
1159
+ });
1160
+ }
1161
+ function Be(e, t = 0, n = 0) {
1162
+ let r = Math.max(0, e.length - 1) * t, i = {
1163
+ px: r,
1164
+ grow: e.length ? 0 : n,
1165
+ minPx: r,
1166
+ maxPx: r
1167
+ }, a = e.length > 0;
1168
+ for (let t of e) {
1169
+ i.px += A(t.px), i.grow += A(t.grow), i.minPx += F(t);
1170
+ let e = I(t);
1171
+ e === void 0 ? a = !1 : i.maxPx += e;
1172
+ }
1173
+ return a || delete i.maxPx, R(i);
1174
+ }
1175
+ var D = class e {
1176
+ constructor(e, t) {
1177
+ this.width = e, this.height = t;
1178
+ }
1179
+ addPadding(e) {
1180
+ return this.#e(e.width, e.height);
1181
+ }
1182
+ subtractPadding(e) {
1183
+ return this.#e(-e.width, -e.height);
1184
+ }
1185
+ #e(t, n) {
1186
+ return new e(L(this.width, t), L(this.height, n));
1187
+ }
1188
+ isGrowing() {
1189
+ return !!(this.width.grow || this.height.grow);
1190
+ }
1191
+ }, Ve = Object.freeze({
1192
+ px: 0,
1193
+ grow: 0
1194
+ }), O = new D(Ve, Ve);
1195
+ function k(e) {
1196
+ return !e.px && !e.grow && !e.minPx;
1197
+ }
1198
+ function He(e, t) {
1199
+ return !e || !t ? !1 : e.px === t.px && e.grow === t.grow && e.minPx === t.minPx && e.maxPx === t.maxPx;
1200
+ }
1201
+ function A(e) {
1202
+ return e || 0;
1203
+ }
1204
+ function j(e) {
1205
+ return e && (b(e.px) || b(e.grow) || b(e.minPx) || b(e.maxPx));
1206
+ }
1207
+ function M(e) {
1208
+ if (J(e)) throw Error("parseSizeDef does not accept step-based sizes.");
1209
+ if (j(e)) return We(e), R(e);
1210
+ if (b(e)) return {
1211
+ px: e,
1212
+ grow: 0
1213
+ };
1214
+ if (e === "container" || !e) return {
1215
+ px: 0,
1216
+ grow: 1
1217
+ };
1218
+ throw Error(`Invalid sizeDef: ${e}`);
1219
+ }
1220
+ function N(e, t, n = 0) {
1221
+ let r = !1;
1222
+ for (let t of e) We(t), r ||= Ge(t);
1223
+ if (!r) return Ue(e, t, n);
1224
+ let i = Array(e.length).fill(0), a = [];
1225
+ for (let t = 0; t < e.length; t++) k(e[t]) || a.push(t);
1226
+ let o = Math.max(0, a.length - 1) * n, s = Math.max(0, t - o), c = /* @__PURE__ */ new Set();
1227
+ for (let t of a) {
1228
+ let n = e[t];
1229
+ A(n.grow) || (i[t] = P(A(n.px), n), c.add(t));
1230
+ }
1231
+ let l = 0;
1232
+ for (;;) {
1233
+ let t = 0, n = 0, r = 0;
1234
+ for (let o of a) c.has(o) ? r += i[o] : (t += A(e[o].px), n += A(e[o].grow));
1235
+ if (!n) {
1236
+ for (let t of a) c.has(t) || (i[t] = P(A(e[t].px), e[t]), c.add(t));
1237
+ break;
1238
+ }
1239
+ let o = Math.max(0, s - r - t);
1240
+ l = o / n;
1241
+ let u = 0, d = [], f = [];
1242
+ for (let t of a) {
1243
+ if (c.has(t)) continue;
1244
+ let r = e[t], a = A(r.px) + A(r.grow) / n * o, s = P(a, r);
1245
+ i[t] = s;
1246
+ let l = s - a;
1247
+ u += l, l > 0 ? d.push(t) : l < 0 && f.push(t);
1248
+ }
1249
+ if (!d.length && !f.length) break;
1250
+ if (u > 0) for (let e of d) c.add(e);
1251
+ else if (u < 0) for (let e of f) c.add(e);
1252
+ else for (let e of a) c.add(e);
1253
+ }
1254
+ return {
1255
+ sizes: i,
1256
+ growth: l
1257
+ };
1258
+ }
1259
+ function Ue(e, t, n) {
1260
+ let r = 0, i = 0;
1261
+ for (let t of e) r += A(t.px) + (k(t) ? 0 : n), i += A(t.grow);
1262
+ r -= n;
1263
+ let a = Math.max(0, t - r), o = Array(e.length);
1264
+ for (let t = 0; t < e.length; t++) {
1265
+ let n = e[t];
1266
+ o[t] = k(n) ? 0 : A(n.px) + (i ? A(n.grow) / i * a : 0);
1267
+ }
1268
+ return {
1269
+ sizes: o,
1270
+ growth: i ? a / i : 0
1271
+ };
1272
+ }
1273
+ function We(e) {
1274
+ if (e.minPx !== void 0 && e.maxPx !== void 0 && e.minPx > e.maxPx) throw Error("SizeDef minPx cannot be greater than maxPx.");
1275
+ }
1276
+ function P(e, t) {
1277
+ return Math.min(Math.max(e, t.minPx ?? 0), t.maxPx ?? Infinity);
1278
+ }
1279
+ function F(e) {
1280
+ return P(A(e.px), e);
1281
+ }
1282
+ function I(e) {
1283
+ return e.maxPx ?? (A(e.grow) ? void 0 : F(e));
1284
+ }
1285
+ function Ge(e) {
1286
+ return e.minPx !== void 0 || e.maxPx !== void 0;
1287
+ }
1288
+ function L(e, t) {
1289
+ return R({
1290
+ px: (e.px ?? 0) + t,
1291
+ grow: e.grow,
1292
+ minPx: e.minPx === void 0 ? void 0 : Math.max(0, e.minPx + t),
1293
+ maxPx: e.maxPx === void 0 ? void 0 : Math.max(0, e.maxPx + t)
1294
+ });
1295
+ }
1296
+ function R(e) {
1297
+ let t = {}, n = e.px !== void 0, r = e.grow !== void 0, i = Ge(e);
1298
+ 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 > A(e.px) && (t.minPx = e.minPx), e.maxPx !== void 0 && (A(t.grow) || e.maxPx < A(e.px)) && (t.maxPx = e.maxPx), t;
1299
+ }
1300
+ //#endregion
1301
+ //#region ../core/src/view/layout/padding.js
1302
+ var z = class e {
1303
+ constructor(e, t, n, r) {
1304
+ this.top = e || 0, this.right = t || 0, this.bottom = n || 0, this.left = r || 0;
1305
+ }
1306
+ get width() {
1307
+ return this.left + this.right;
1308
+ }
1309
+ get height() {
1310
+ return this.top + this.bottom;
1311
+ }
1312
+ expand(t) {
1313
+ return t <= 0 ? this : new e(this.top + t, this.right + t, this.bottom + t, this.left + t);
1314
+ }
1315
+ add(t) {
1316
+ return new e(this.top + t.top, this.right + t.right, this.bottom + t.bottom, this.left + t.left);
1317
+ }
1318
+ subtract(t) {
1319
+ return new e(this.top - t.top, this.right - t.right, this.bottom - t.bottom, this.left - t.left);
1320
+ }
1321
+ union(t) {
1322
+ 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));
1323
+ }
1324
+ getHorizontal() {
1325
+ return new e(0, this.right, 0, this.left);
1326
+ }
1327
+ getVertical() {
1328
+ return new e(this.top, 0, this.bottom, 0);
1329
+ }
1330
+ get horizontalTotal() {
1331
+ return this.left + this.right;
1332
+ }
1333
+ get verticalTotal() {
1334
+ return this.top + this.bottom;
1335
+ }
1336
+ static createFromConfig(e) {
1337
+ return typeof e == "number" ? this.createUniformPadding(e) : e ? this.createFromRecord(e) : B;
1338
+ }
1339
+ static createFromRecord(t) {
1340
+ return new e(t.top, t.right, t.bottom, t.left);
1341
+ }
1342
+ static zero() {
1343
+ return B;
1344
+ }
1345
+ static createUniformPadding(t) {
1346
+ return new e(t, t, t, t);
1347
+ }
1348
+ };
1349
+ function Ke(e, t, n = z.zero()) {
1350
+ return t ? new z(t.top === !1 ? n.top : e.top, t.right === !1 ? n.right : e.right, t.bottom === !1 ? n.bottom : e.bottom, t.left === !1 ? n.left : e.left) : e;
1351
+ }
1352
+ var B = z.createUniformPadding(0);
1353
+ Object.freeze(B);
1354
+ //#endregion
1306
1355
  //#region ../core/src/utils/addBaseUrl.js
1307
- function Ue(e, t) {
1356
+ function qe(e, t) {
1308
1357
  return !t || /^(data:|([A-Za-z]+:)?\/\/)/.test(e) || e.startsWith("/") ? e : (t.endsWith("/") || (t += "/"), t + e);
1309
1358
  }
1310
- function We(e) {
1359
+ function Je(e) {
1311
1360
  if (!e) return e;
1312
1361
  if (/[?#]/.test(e)) throw Error(`Invalid base URL: ${e} - cannot contain query or hash.`);
1313
1362
  return e.endsWith("/") ? e : e + "/";
@@ -1315,42 +1364,42 @@ function We(e) {
1315
1364
  //#endregion
1316
1365
  //#region ../core/src/config/mergeConfig.js
1317
1366
  function V(e) {
1318
- return ie(e) && !Array.isArray(e) && !("expr" in e && typeof e.expr == "string");
1367
+ return r(e) && !Array.isArray(e) && !("expr" in e && typeof e.expr == "string");
1319
1368
  }
1320
- function Ge(e) {
1369
+ function Ye(e) {
1321
1370
  let t = {};
1322
1371
  for (let [n, r] of Object.entries(e)) t[n] = H(r);
1323
1372
  return t;
1324
1373
  }
1325
1374
  function H(e) {
1326
- return Array.isArray(e) ? e.map(H) : V(e) ? Ge(e) : e;
1375
+ return Array.isArray(e) ? e.map(H) : V(e) ? Ye(e) : e;
1327
1376
  }
1328
- function Ke(e, t) {
1377
+ function Xe(e, t) {
1329
1378
  for (let [n, r] of Object.entries(t)) {
1330
1379
  if (r === void 0) continue;
1331
1380
  let t = e[n];
1332
- V(r) && V(t) ? Ke(t, r) : e[n] = H(r);
1381
+ V(r) && V(t) ? Xe(t, r) : e[n] = H(r);
1333
1382
  }
1334
1383
  return e;
1335
1384
  }
1336
- function qe(e) {
1385
+ function Ze(e) {
1337
1386
  let t = {};
1338
- for (let n of e) n && Ke(t, n);
1387
+ for (let n of e) n && Xe(t, n);
1339
1388
  return t;
1340
1389
  }
1341
1390
  //#endregion
1342
1391
  //#region ../core/src/view/viewChrome.js
1343
1392
  var U = /* @__PURE__ */ new WeakMap();
1344
- function Je(e, t) {
1393
+ function Qe(e, t) {
1345
1394
  U.set(e, t);
1346
1395
  }
1347
- function Ye(e) {
1396
+ function $e(e) {
1348
1397
  return U.get(e);
1349
1398
  }
1350
- function Xe(e) {
1399
+ function W(e) {
1351
1400
  return U.has(e);
1352
1401
  }
1353
- function Ze(e) {
1402
+ function et(e) {
1354
1403
  let t = e;
1355
1404
  for (; t;) {
1356
1405
  let n = U.get(t);
@@ -1361,16 +1410,34 @@ function Ze(e) {
1361
1410
  }
1362
1411
  //#endregion
1363
1412
  //#region ../core/src/view/postScaleParams.js
1364
- var Qe = /* @__PURE__ */ new WeakMap();
1365
- function $e(e, t) {
1366
- Qe.set(e, t);
1413
+ var tt = /* @__PURE__ */ new WeakMap();
1414
+ function nt(e, t) {
1415
+ tt.set(e, t);
1367
1416
  }
1368
- function et(e) {
1369
- return Qe.get(e);
1417
+ function rt(e) {
1418
+ return tt.get(e);
1419
+ }
1420
+ //#endregion
1421
+ //#region ../core/src/view/transformOutputDeclarations.js
1422
+ function* it(e) {
1423
+ for (let t of e) t.type === "values" ? yield {
1424
+ transform: t,
1425
+ property: "param",
1426
+ param: t.param
1427
+ } : t.type === "dendrogram" && t.domainParam !== void 0 ? yield {
1428
+ transform: t,
1429
+ property: "domainParam",
1430
+ param: t.domainParam
1431
+ } : t.type === "branch" && (yield* it(t.transform));
1432
+ }
1433
+ function at(e) {
1434
+ e.visit((e) => {
1435
+ e.paramRuntime.finalizeOutputDeclarations();
1436
+ });
1370
1437
  }
1371
1438
  //#endregion
1372
1439
  //#region ../core/src/data/namedDataScope.js
1373
- var tt = class {
1440
+ var ot = class {
1374
1441
  name;
1375
1442
  owner;
1376
1443
  getDefaultData;
@@ -1408,13 +1475,13 @@ var tt = class {
1408
1475
  dispose() {
1409
1476
  this.#e = void 0, this.#t = !1, this.#n++, this.#r = !0;
1410
1477
  }
1411
- }, nt = class {
1478
+ }, st = class {
1412
1479
  view;
1413
1480
  #e = /* @__PURE__ */ new Map();
1414
1481
  #t = /* @__PURE__ */ new Map();
1415
1482
  constructor(e) {
1416
1483
  this.view = e;
1417
- for (let [t, n] of Object.entries(e.spec.datasets ?? {})) this.#e.set(t, new tt(t, e, () => n));
1484
+ for (let [t, n] of Object.entries(e.spec.datasets ?? {})) this.#e.set(t, new ot(t, e, () => n));
1418
1485
  }
1419
1486
  getLocalBinding(e) {
1420
1487
  return this.#e.get(e);
@@ -1428,7 +1495,7 @@ var tt = class {
1428
1495
  let n = this.view.dataParent?.namedDataScope;
1429
1496
  if (n) return n.resolve(e);
1430
1497
  let r = this.#t.get(e);
1431
- return r || (r = new tt(e, void 0, () => this.view.context.getNamedDataFromProvider(e)), this.#t.set(e, r)), r;
1498
+ return r || (r = new ot(e, void 0, () => this.view.context.getNamedDataFromProvider(e)), this.#t.set(e, r)), r;
1432
1499
  }
1433
1500
  dispose() {
1434
1501
  for (let e of this.#e.values()) e.dispose();
@@ -1436,9 +1503,10 @@ var tt = class {
1436
1503
  for (let e of this.#t.values()) e.dispose();
1437
1504
  this.#t.clear();
1438
1505
  }
1439
- }, W = "VISIT_SKIP", G = "VISIT_STOP", K = (e) => e, rt = class {
1506
+ }, G = "VISIT_SKIP", K = "VISIT_STOP", q = (e) => e, ct = class {
1440
1507
  spec;
1441
1508
  namedDataScope;
1509
+ flowOutputs = /* @__PURE__ */ new Set();
1442
1510
  #e;
1443
1511
  #t;
1444
1512
  #n = {};
@@ -1451,36 +1519,45 @@ var tt = class {
1451
1519
  #l = void 0;
1452
1520
  #u = !1;
1453
1521
  #d = [];
1454
- opacityFunction = K;
1522
+ opacityFunction = q;
1455
1523
  #f = [];
1456
1524
  #p = "none";
1457
1525
  #m = /* @__PURE__ */ new Map();
1458
- facetCoords = new p([], JSON.stringify);
1526
+ facetCoords = new n([], JSON.stringify);
1459
1527
  layoutCoords;
1460
1528
  constructor(e, t, n, r, i, a = {}) {
1461
1529
  if (!e) throw Error("View spec must be defined!");
1462
- if (this.context = t, this.layoutParent = n, this.dataParent = r, a.chrome && Je(this, "excludeSubtree"), this.#t = i, this.spec = e, this.namedDataScope = new nt(this), r && e.theme !== void 0) throw Error("\"theme\" is only supported at the root specification. Use \"config\" and \"style\" for subtree customization.");
1463
- let o = r ? r.getConfigScopes() : [t.getBaseConfig()], s = e.config;
1464
- this.#e = [...o, s].filter((e) => !!e), this.resolutions = {
1530
+ if (this.context = t, this.layoutParent = n, this.dataParent = r, a.chrome && Qe(this, "excludeSubtree"), this.#t = i, this.spec = e, this.namedDataScope = new st(this), r && e.theme !== void 0) throw Error("\"theme\" is only supported at the root specification. Use \"config\" and \"style\" for subtree customization.");
1531
+ let s = r ? r.getConfigScopes() : [t.getBaseConfig()], c = e.config;
1532
+ this.#e = [...s, c].filter((e) => !!e), this.resolutions = {
1465
1533
  scale: {},
1466
1534
  axis: {},
1467
1535
  legend: {}
1468
- }, oe(this), this.options = {
1536
+ }, de(this), this.options = {
1469
1537
  inheritEncoding: !1,
1470
1538
  layoutSizeParams: "own",
1471
1539
  ...a
1472
1540
  }, this.flowHandle = void 0, this.needsAxes = {
1473
1541
  x: !1,
1474
1542
  y: !1
1475
- }, this.paramRuntime = new B(() => this.dataParent?.paramRuntime, (e) => this.getScaleResolution(e), t.animator, {
1543
+ }, this.paramRuntime = new je(() => this.dataParent?.paramRuntime, (e) => this.getScaleResolution(e), t.animator, {
1476
1544
  settleTemporalUpdatesImmediately: !0,
1477
1545
  onError: t.reportError,
1478
1546
  getSpecOrigin: t.getSpecOrigin
1479
- }), this.paramRuntime.setSelectionSource(this), "mark" in e && this.paramRuntime.registerLazyExpression("zoomLevel", "zoomLevel()", () => ce("The automatic zoomLevel parameter is deprecated. Use zoomLevel() or an explicit channel such as zoomLevel(\"x\") instead."));
1480
- let c = [...e.params ?? [], ...et(e) ?? []];
1481
- for (let e of c) {
1547
+ }), this.paramRuntime.setSelectionSource(this), "mark" in e && this.paramRuntime.registerLazyExpression("zoomLevel", "zoomLevel()", () => fe("The automatic zoomLevel parameter is deprecated. Use zoomLevel() or an explicit channel such as zoomLevel(\"x\") instead."));
1548
+ for (let { transform: t, property: n, param: r } of it(e.transform ?? [])) try {
1549
+ typeof r == "string" && this.paramRuntime.registerOutput(r);
1550
+ let e = this.paramRuntime.resolveOutput(r);
1551
+ if (e.producerView) throw Error("Duplicate transform output producer.");
1552
+ e.producerView = this, this.flowOutputs.add(e);
1553
+ } catch (e) {
1554
+ throw o(e, this.paramRuntime.getSpecLocation(t, [n]));
1555
+ }
1556
+ let l = [...e.params ?? [], ...rt(e) ?? []];
1557
+ this.options.layoutSizeParams !== "inherit" && (l.some((e) => e.name === "width") || (this.#a = this.#h("width")), l.some((e) => e.name === "height") || (this.#o = this.#h("height")));
1558
+ for (let e of l) {
1482
1559
  if ("expr" in e) {
1483
- let { usesScaleHelper: t, globals: n } = m(e.expr, this.paramRuntime.getSpecLocation(e, ["expr"])), r = n.some((e) => this.paramRuntime.isPendingParam(e));
1560
+ let { usesScaleHelper: t, globals: n } = f(e.expr, this.paramRuntime.getSpecLocation(e, ["expr"])), r = n.some((e) => this.paramRuntime.isPendingParam(e));
1484
1561
  if (t || r) {
1485
1562
  this.paramRuntime.registerParam(e, { defer: !0 }), this.#d.push(e.name);
1486
1563
  continue;
@@ -1488,7 +1565,6 @@ var tt = class {
1488
1565
  }
1489
1566
  this.paramRuntime.registerParam(e);
1490
1567
  }
1491
- this.options.layoutSizeParams !== "inherit" && (this.#a = this.#h("width"), this.#o = this.#h("height"));
1492
1568
  }
1493
1569
  #h(e) {
1494
1570
  if (!(this.paramRuntime.hasLocalParam(e) || this.options.layoutSizeParams != "force" && this.paramRuntime.hasConfiguredParamInScopeChain(e))) return this.paramRuntime.allocateSetter(e, 0);
@@ -1506,18 +1582,18 @@ var tt = class {
1506
1582
  return this.#t;
1507
1583
  }
1508
1584
  getConfig() {
1509
- return qe(this.#e);
1585
+ return Ze(this.#e);
1510
1586
  }
1511
1587
  getCursorSpec() {
1512
1588
  return this.spec.cursor;
1513
1589
  }
1514
1590
  getCursor() {
1515
1591
  let e = this.getCursorSpec();
1516
- return l(e) ? this.paramRuntime.evaluateAndGet(e) : e;
1592
+ return y(e) ? this.paramRuntime.evaluateAndGet(e) : e;
1517
1593
  }
1518
1594
  watchCursor(e, t) {
1519
1595
  let n = this.getCursorSpec();
1520
- l(n) && this.paramRuntime.watchExpression(n, e, {
1596
+ y(n) && this.paramRuntime.watchExpression(n, e, {
1521
1597
  scopeOwned: !1,
1522
1598
  registerDisposer: t
1523
1599
  });
@@ -1529,13 +1605,13 @@ var tt = class {
1529
1605
  return this.facetCoords.values().next().value;
1530
1606
  }
1531
1607
  getPadding() {
1532
- return this._cache("size/padding", () => j.createFromConfig(this.spec.padding));
1608
+ return this._cache("size/padding", () => z.createFromConfig(this.spec.padding));
1533
1609
  }
1534
1610
  getOverhang() {
1535
- return j.zero();
1611
+ return z.zero();
1536
1612
  }
1537
1613
  getStructuralOverhang() {
1538
- return j.zero();
1614
+ return z.zero();
1539
1615
  }
1540
1616
  getStructuralSizeDefs(e) {
1541
1617
  let t = this.getStructuralOverhang();
@@ -1566,36 +1642,40 @@ var tt = class {
1566
1642
  return this.spec.viewportWidth != null || this.spec.viewportHeight != null;
1567
1643
  }
1568
1644
  getSize() {
1569
- return this._cache("size/size", () => this.isConfiguredVisible() ? new x(this.#g("width"), this.#g("height")) : S);
1645
+ return this._cache("size/size", () => this.isConfiguredVisible() ? new D(this.#g("width"), this.#g("height")) : O);
1570
1646
  }
1571
1647
  getViewportSize() {
1572
1648
  if (!this.isScrollable()) return this.getSize();
1573
- if (!this.isConfiguredVisible()) return S;
1649
+ if (!this.isConfiguredVisible()) return O;
1574
1650
  let e = this.getSize();
1575
- return new x(this.#g("viewportWidth") ?? e.width, this.#g("viewportHeight") ?? e.height);
1651
+ return new D(this.#g("viewportWidth") ?? e.width, this.#g("viewportHeight") ?? e.height);
1652
+ }
1653
+ getViewportAnchor(e) {
1654
+ let t = this.spec[e];
1655
+ if (!t || typeof t != "object" || !("anchor" in t)) return "start";
1656
+ if (e !== "viewportWidth" && e !== "viewportHeight") throw new C("Anchors are supported only on viewport sizes.", this);
1657
+ if (!j(t) && !y(t)) throw new C("An anchored viewport must define a size.", this);
1658
+ let n = t.anchor === void 0 ? "start" : t.anchor;
1659
+ if (n !== "start" && n !== "end") throw new C("Viewport anchor must be \"start\" or \"end\".", this);
1660
+ return n;
1576
1661
  }
1577
1662
  #g(e) {
1578
- let { value: t, implicit: n } = this.#_(e), i = this.resolveSizeValue(e, t), a = q(i), o = e == "viewportWidth" || e == "viewportHeight";
1579
- if (a) {
1580
- if (o) throw new _(`Cannot use step-based size with "${e}"!`, this);
1581
- let t = this.#x(e, i), a = this.getScaleResolution(e == "width" ? "x" : "y")?.getScale();
1582
- if (a) {
1583
- let n;
1584
- if (y(a.type)) n = a.domain().length;
1585
- else if (["locus", "index"].includes(a.type)) {
1586
- let e = a.domain();
1587
- n = r(e) - e[0];
1588
- } else throw new _(`Cannot use step-based size with "${a.type}" scale!`, this);
1589
- let o = a;
1590
- n = v(n, o.paddingInner(), o.paddingOuter());
1591
- let s = e == "width" ? "xOffset" : "yOffset", c = this.getScaleResolution(s)?.getScale(), l = i.for ?? (c && y(c.type) ? "offset" : "position"), u = t;
1592
- if (l == "offset") {
1593
- if (!c || !y(c.type)) throw new _(`Cannot use ${e}.step.for = "offset" without a discrete ${s} scale!`, this);
1594
- let t = c, n = v(c.domain().length, t.paddingInner(), t.paddingOuter());
1595
- u *= n / (1 - o.paddingInner());
1663
+ let { value: t, implicit: n } = this.#_(e), r = this.resolveSizeValue(e, t), i = J(r), a = e == "viewportWidth" || e == "viewportHeight";
1664
+ if (i) {
1665
+ if (a) throw new C(`Cannot use step-based size with "${e}"!`, this);
1666
+ let t = this.#x(e, r), i = this.getScaleResolution(e == "width" ? "x" : "y")?.getScale();
1667
+ if (i) {
1668
+ if (!("sizeForStep" in i)) throw new C(`Cannot use step-based size with "${i.type}" scale!`, this);
1669
+ let n = e == "width" ? "xOffset" : "yOffset", a = this.getScaleResolution(n)?.getScale(), o = r.for ?? (a && x(a.type) ? "offset" : "position"), s = t;
1670
+ if (o == "offset") {
1671
+ let t = i.paddingInner?.() ?? 1;
1672
+ if (t === 1) throw new C("Offset-step sizing requires a primary scale with nonzero bandwidth.", this);
1673
+ if (!a || !x(a.type)) throw new C(`Cannot use ${e}.step.for = "offset" without a discrete ${n} scale!`, this);
1674
+ let r = a, o = ee(a.domain().length, a.type === "point" ? 1 : r.paddingInner(), r.paddingOuter());
1675
+ s *= o / (1 - t);
1596
1676
  }
1597
1677
  return {
1598
- px: n * u,
1678
+ px: i.sizeForStep(s),
1599
1679
  grow: 0
1600
1680
  };
1601
1681
  }
@@ -1603,9 +1683,9 @@ var tt = class {
1603
1683
  px: t,
1604
1684
  grow: 0
1605
1685
  };
1606
- throw new _(`Cannot use step-based size with "${e}"!`, this);
1686
+ throw new C(`Cannot use step-based size with "${e}"!`, this);
1607
1687
  }
1608
- return (i && _e(i)) ?? (o ? void 0 : {
1688
+ return (r && M(r)) ?? (a ? void 0 : {
1609
1689
  px: 0,
1610
1690
  grow: 1
1611
1691
  });
@@ -1621,48 +1701,51 @@ var tt = class {
1621
1701
  };
1622
1702
  }
1623
1703
  #v(e) {
1624
- if (Ze(this)) return;
1704
+ if (et(this)) return;
1625
1705
  let t = this.getConfig().view;
1626
1706
  if (!t) return;
1627
1707
  let n = e == "width" ? "x" : "y", r = this.getScaleResolution(n)?.getResolvedScaleType();
1628
- return r && !y(r) ? e == "width" ? t.continuousWidth : t.continuousHeight : (e == "width" ? t.discreteWidth : t.discreteHeight) ?? (t.step === void 0 ? void 0 : { step: t.step });
1708
+ return r && !x(r) ? e == "width" ? t.continuousWidth : t.continuousHeight : (e == "width" ? t.discreteWidth : t.discreteHeight) ?? (t.step === void 0 ? void 0 : { step: t.step });
1629
1709
  }
1630
1710
  resolveSizeValue(e, t) {
1631
- if (!l(t)) return t;
1711
+ if (this.getViewportAnchor(e), !y(t)) return t;
1632
1712
  let n = this.#C(e)();
1633
- if (ct(n) || n === "container") return n;
1634
- throw new _(`"${e}" ExprRef must resolve to a finite number or "container"!`, this);
1713
+ if (pt(n) || n === "container") return n;
1714
+ throw new C(`"${e}" ExprRef must resolve to a finite number or "container"!`, this);
1635
1715
  }
1636
1716
  registerSizeInvalidation() {
1637
- this.#y("width", "x"), this.#y("height", "y"), this.#b("width"), this.#b("height"), this.#b("viewportWidth"), this.#b("viewportHeight");
1717
+ this.#b("width"), this.#b("height"), this.#b("viewportWidth"), this.#b("viewportHeight");
1718
+ }
1719
+ isStepSized(e) {
1720
+ return J(this.#_(e).value);
1638
1721
  }
1639
1722
  #y(e, t) {
1640
1723
  let { value: n, implicit: r } = this.#_(e);
1641
- if (!q(n)) return;
1724
+ if (!J(n)) return;
1642
1725
  let i = this.getScaleResolution(t);
1643
1726
  if (!i) {
1644
1727
  if (r) return;
1645
- throw new _("Cannot use 'step' size without a scale!", this);
1728
+ throw new C("Cannot use 'step' size without a scale!", this);
1646
1729
  }
1647
1730
  let a = () => {
1648
1731
  let t = this.getSize()[e];
1649
1732
  this.invalidateSizeCache();
1650
1733
  let n = this.getSize()[e];
1651
- he(t, n) || this.context.requestLayoutReflow();
1734
+ He(t, n) || this.context.requestLayoutReflow();
1652
1735
  };
1653
- if (i.addEventListener("domain", a), this.registerDisposer(() => i.removeEventListener("domain", a)), n.for != "position") {
1736
+ if (this.registerDisposer(i.observeMapping(a)), n.for != "position") {
1654
1737
  let t = e == "width" ? "xOffset" : "yOffset", n = this.getScaleResolution(t);
1655
- n && y(n.getResolvedScaleType()) && (n.addEventListener("domain", a), this.registerDisposer(() => n.removeEventListener("domain", a)));
1738
+ n && x(n.getResolvedScaleType()) && this.registerDisposer(n.observeMapping(a));
1656
1739
  }
1657
1740
  }
1658
1741
  #b(e) {
1659
1742
  let { value: t } = this.#_(e);
1660
- l(t) ? this.#S(e, t) : q(t) && l(t.step) && this.#S(e + ".step", t.step);
1743
+ y(t) ? this.#S(e, t) : J(t) && y(t.step) && this.#S(e + ".step", t.step);
1661
1744
  }
1662
1745
  #x(e, t) {
1663
- let n = l(t.step) ? this.#C(e + ".step")() : t.step;
1664
- if (ct(n)) return n;
1665
- throw new _(`"${e}.step" ExprRef must resolve to a finite number!`, this);
1746
+ let n = y(t.step) ? this.#C(e + ".step")() : t.step;
1747
+ if (pt(n)) return n;
1748
+ throw new C(`"${e}.step" ExprRef must resolve to a finite number!`, this);
1666
1749
  }
1667
1750
  #S(e, t) {
1668
1751
  if (!this.#m.has(e)) {
@@ -1674,7 +1757,7 @@ var tt = class {
1674
1757
  }
1675
1758
  #C(e) {
1676
1759
  let t = this.#m.get(e);
1677
- if (!t) throw new _(`"${e}" ExprRef was not registered before layout!`, this);
1760
+ if (!t) throw new C(`"${e}" ExprRef was not registered before layout!`, this);
1678
1761
  return t;
1679
1762
  }
1680
1763
  isConfiguredVisible() {
@@ -1707,7 +1790,7 @@ var tt = class {
1707
1790
  return this.opacityFunction(1);
1708
1791
  }
1709
1792
  hasLocalOpacity() {
1710
- return this.opacityFunction !== K;
1793
+ return this.opacityFunction !== q;
1711
1794
  }
1712
1795
  getPathString() {
1713
1796
  return this.getLayoutAncestors().map((e) => e.name).reverse().join("/");
@@ -1771,23 +1854,33 @@ var tt = class {
1771
1854
  for (let e of this.#f) e();
1772
1855
  this.#f.length = 0;
1773
1856
  let e = this.flowHandle;
1774
- 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.flowHandle = void 0, this.context.dataFlow.loadingStatusRegistry.delete(this);
1857
+ for (let t of e?.terminals ?? []) t.children.length === 0 && this.context.dataFlow.pruneBranch(t);
1858
+ e?.collector && (this.context.dataFlow.pruneBranch(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();
1859
+ for (let e of this.flowOutputs) e.producerView = void 0;
1860
+ this.flowOutputs.clear(), this.flowHandle = void 0, this.context.dataFlow.loadingStatusRegistry.delete(this);
1775
1861
  }
1776
1862
  registerDisposer(e) {
1777
1863
  this.#f.push(e);
1778
1864
  }
1779
- disposeSubtree() {
1780
- let e = (e) => {
1865
+ assertCanDisposeSubtree() {
1866
+ let e = new Set(this.getDescendants());
1867
+ for (let t of e) for (let n of t.flowOutputs) if (n.owner && !e.has(n.owner)) throw Error("Cannot remove a shared output producer while its owner survives.");
1868
+ }
1869
+ disposeSubtree({ checkDependencies: e = !0 } = {}) {
1870
+ e && this.assertCanDisposeSubtree();
1871
+ let t = (e) => {
1781
1872
  for (let t of Object.values(e.resolutions.scale)) t.dispose();
1782
1873
  };
1783
- e.postOrder = (e) => {
1874
+ t.postOrder = (e) => {
1784
1875
  e.dispose();
1785
- }, this.visit(e);
1876
+ }, this.visit(t);
1786
1877
  }
1787
1878
  configurePostScaleParams() {
1879
+ if (this.#u) return;
1880
+ this.#u = !0, this.#y("width", "x"), this.#y("height", "y");
1788
1881
  let e = this.#d;
1789
- if (e.length && !this.#u) {
1790
- this.#u = !0, this.#l = !1;
1882
+ if (e.length) {
1883
+ this.#l = !1;
1791
1884
  for (let t of e) this.paramRuntime.getValue(t);
1792
1885
  this.registerDisposer(this._addBroadcastHandler("subtreeDataReady", () => {
1793
1886
  this.#l = !0, this.#T();
@@ -1795,7 +1888,7 @@ var tt = class {
1795
1888
  }
1796
1889
  }
1797
1890
  configureViewOpacity() {
1798
- (!this.opacityFunction || this.opacityFunction === K) && (this.opacityFunction = at(this));
1891
+ (!this.opacityFunction || this.opacityFunction === q) && (this.opacityFunction = ut(this));
1799
1892
  }
1800
1893
  finalizeParamRuntimeInitialization() {
1801
1894
  this.#l === void 0 ? this.paramRuntime.finalizeInitialization() : this.#T();
@@ -1809,8 +1902,8 @@ var tt = class {
1809
1902
  arrange(e, t, n = {}) {
1810
1903
  if (this.layoutParent || this.visit((e) => {
1811
1904
  e.layoutCoords = void 0;
1812
- }), this.layoutCoords = t, n.firstFacet && this.facetCoords.clear(), this.facetCoords.set(n.facetId, re(t, te(n))), this.#a || this.#o) {
1813
- let e = this.getOverhang(), n = this.layoutParent ? j.zero() : this.getPadding();
1905
+ }), this.layoutCoords = t, n.firstFacet && this.facetCoords.clear(), this.facetCoords.set(n.facetId, ie(t, ne(n))), this.#a || this.#o) {
1906
+ let e = this.getOverhang(), n = this.layoutParent ? z.zero() : this.getPadding();
1814
1907
  this.#a?.(t.width - e.width - n.width), this.#o?.(t.height - e.height - n.height);
1815
1908
  }
1816
1909
  this.#c = !0, this.#T();
@@ -1831,7 +1924,7 @@ var tt = class {
1831
1924
  }
1832
1925
  getFacetFields(e) {
1833
1926
  let t = this.getEncoding().sample;
1834
- return s(t) ? [t.field] : this.options.inheritEncoding ? this.layoutParent?.getFacetFields(this) : [];
1927
+ return l(t) ? [t.field] : this.options.inheritEncoding ? this.layoutParent?.getFacetFields(this) : [];
1835
1928
  }
1836
1929
  usesSampleFacetRendering() {
1837
1930
  return this.layoutParent?.usesSampleFacetRendering() ?? !1;
@@ -1849,17 +1942,17 @@ var tt = class {
1849
1942
  return this.#E(e, "axis");
1850
1943
  }
1851
1944
  #E(e, t) {
1852
- let n = h(e);
1945
+ let n = v(e);
1853
1946
  for (let e of this.getDataAncestors()) {
1854
1947
  let r = e.resolutions[t][n];
1855
1948
  if (r || e.isResolutionBoundary(n)) return r;
1856
1949
  }
1857
1950
  }
1858
1951
  isResolutionBoundary(e) {
1859
- return this.options.resolutionBoundaryChannels?.some((t) => t === h(e)) ?? !1;
1952
+ return this.options.resolutionBoundaryChannels?.some((t) => t === v(e)) ?? !1;
1860
1953
  }
1861
1954
  getLegendResolution(e) {
1862
- let t = h(e);
1955
+ let t = v(e);
1863
1956
  return this.getDataAncestors().map((e) => e.resolutions.legend[t]).find((e) => e);
1864
1957
  }
1865
1958
  getConfiguredResolution(e, t) {
@@ -1872,42 +1965,42 @@ var tt = class {
1872
1965
  return "independent";
1873
1966
  }
1874
1967
  getBaseUrl() {
1875
- return N(() => this.dataParent?.getBaseUrl(), We(this.spec.baseUrl));
1968
+ return ce(() => this.dataParent?.getBaseUrl(), Je(this.spec.baseUrl));
1876
1969
  }
1877
1970
  isPickingSupported() {
1878
1971
  return !0;
1879
1972
  }
1880
1973
  getTitleText() {
1881
1974
  let e = this.spec.title;
1882
- if (e) return u(e) ? e : l(e.text) ? this.paramRuntime.evaluateAndGet(e.text) : e.text;
1975
+ if (e) return d(e) ? e : y(e.text) ? this.paramRuntime.evaluateAndGet(e.text) : e.text;
1883
1976
  }
1884
1977
  _cache(e, t) {
1885
- return ae(this, e, t);
1978
+ return ue(this, e, t);
1886
1979
  }
1887
1980
  _invalidateCacheByPrefix(e, t = "self") {
1888
1981
  switch (t) {
1889
1982
  case "self":
1890
- g(this, e);
1983
+ S(this, e);
1891
1984
  break;
1892
1985
  case "ancestors":
1893
- for (let t of this.getLayoutAncestors()) g(t, e);
1986
+ for (let t of this.getLayoutAncestors()) S(t, e);
1894
1987
  break;
1895
- case "progeny": this.visit((t) => g(t, e));
1988
+ case "progeny": this.visit((t) => S(t, e));
1896
1989
  }
1897
1990
  }
1898
1991
  invalidateSizeCache() {
1899
- g(this, "size"), this._invalidateCacheByPrefix("size", "ancestors");
1992
+ S(this, "size"), this._invalidateCacheByPrefix("size", "ancestors");
1900
1993
  }
1901
1994
  propagateInteraction(e) {}
1902
1995
  };
1903
- function it(e) {
1996
+ function lt(e) {
1904
1997
  return "unitsPerPixel" in e;
1905
1998
  }
1906
- function at(e) {
1999
+ function ut(e) {
1907
2000
  let t = "opacity" in e.spec ? e.spec.opacity : void 0;
1908
2001
  if (t !== void 0) {
1909
- if (f(t)) return (e) => e * t;
1910
- if (it(t)) {
2002
+ if (b(t)) return (e) => e * t;
2003
+ if (lt(t)) {
1911
2004
  let n = (t) => {
1912
2005
  let n = e.getScaleResolution(t), r = n?.getScale();
1913
2006
  if ([
@@ -1918,14 +2011,14 @@ function at(e) {
1918
2011
  scale: r,
1919
2012
  scaleResolution: n
1920
2013
  };
1921
- }, r = st(t.values, "opacity.values", e);
1922
- if (!d(t.unitsPerPixel)) throw new _("\"opacity.unitsPerPixel\" must be an array.", e);
2014
+ }, r = ft(t.values, "opacity.values", e);
2015
+ if (!u(t.unitsPerPixel)) throw new C("\"opacity.unitsPerPixel\" must be an array.", e);
1923
2016
  let i = () => 1, a = [], o = () => {
1924
- let t = ot(st(a.map((e) => e()), "opacity.unitsPerPixel", e), r, e), n = se().domain(t.unitsPerPixel).range(t.values).clamp(!0);
2017
+ let t = dt(ft(a.map((e) => e()), "opacity.unitsPerPixel", e), r, e), n = m().domain(t.unitsPerPixel).range(t.values).clamp(!0);
1925
2018
  i = (e) => n(e);
1926
2019
  };
1927
2020
  a = t.unitsPerPixel.map((t) => {
1928
- if (l(t)) {
2021
+ if (y(t)) {
1929
2022
  let n = e.paramRuntime.watchExpression(t, () => {
1930
2023
  o(), e.context.animator.requestRender();
1931
2024
  });
@@ -1935,33 +2028,33 @@ function at(e) {
1935
2028
  }), o();
1936
2029
  let s = (e) => {
1937
2030
  let t = e.scaleResolution.getAxisLength() || 1e3;
1938
- return c(e.scale.domain()) / t;
1939
- }, u;
2031
+ return ae(e.scale.domain()) / t;
2032
+ }, c;
1940
2033
  if (t.channel === "auto") {
1941
2034
  let t = n("x"), r = n("y");
1942
- if (t && r) u = () => (s(t) + s(r)) / 2;
1943
- else if (t) u = () => s(t);
1944
- else if (r) u = () => s(r);
1945
- else throw new _("Cannot find a resolved quantitative x or y scale for dynamic opacity!", e);
2035
+ if (t && r) c = () => (s(t) + s(r)) / 2;
2036
+ else if (t) c = () => s(t);
2037
+ else if (r) c = () => s(r);
2038
+ else throw new C("Cannot find a resolved quantitative x or y scale for dynamic opacity!", e);
1946
2039
  } else {
1947
2040
  let r = t.channel ? n(t.channel) : n("x") ?? n("y");
1948
- if (!r) throw new _("Cannot find a resolved quantitative scale for dynamic opacity!", e);
1949
- u = () => s(r);
2041
+ if (!r) throw new C("Cannot find a resolved quantitative scale for dynamic opacity!", e);
2042
+ c = () => s(r);
1950
2043
  }
1951
- return (e) => i(u()) * e;
2044
+ return (e) => i(c()) * e;
1952
2045
  }
1953
- if (l(t)) {
2046
+ if (y(t)) {
1954
2047
  let n = e.paramRuntime.watchExpression(t, () => e.context.animator.requestRender());
1955
2048
  return (e) => n(null) * e;
1956
2049
  }
1957
2050
  }
1958
- return K;
2051
+ return q;
1959
2052
  }
1960
- function ot(e, t, n) {
1961
- if (!e.length) throw new _("\"opacity.unitsPerPixel\" must contain at least one stop.", n);
1962
- if (e.length !== t.length) throw new _("\"opacity.unitsPerPixel\" and \"opacity.values\" must have the same length.", n);
2053
+ function dt(e, t, n) {
2054
+ if (!e.length) throw new C("\"opacity.unitsPerPixel\" must contain at least one stop.", n);
2055
+ if (e.length !== t.length) throw new C("\"opacity.unitsPerPixel\" and \"opacity.values\" must have the same length.", n);
1963
2056
  e.forEach((e, t) => {
1964
- if (e <= 0) throw new _("Invalid opacity.unitsPerPixel value at index " + t + ". Stop values must be positive.", n);
2057
+ if (e <= 0) throw new C("Invalid opacity.unitsPerPixel value at index " + t + ". Stop values must be positive.", n);
1965
2058
  });
1966
2059
  let r = e.map((e, n) => ({
1967
2060
  stop: e,
@@ -1969,161 +2062,166 @@ function ot(e, t, n) {
1969
2062
  }));
1970
2063
  r.sort((e, t) => t.stop - e.stop);
1971
2064
  let i = r.map((e) => e.stop), a = r.map((e) => e.value);
1972
- for (let t = 1; t < e.length; t++) if (i[t - 1] <= i[t]) throw new _("\"opacity.unitsPerPixel\" must be strictly decreasing.", n);
2065
+ for (let t = 1; t < e.length; t++) if (i[t - 1] <= i[t]) throw new C("\"opacity.unitsPerPixel\" must be strictly decreasing.", n);
1973
2066
  return {
1974
2067
  unitsPerPixel: i,
1975
2068
  values: a
1976
2069
  };
1977
2070
  }
1978
- function st(e, t, n) {
1979
- if (!d(e)) throw new _("\"" + t + "\" must evaluate to an array.", n);
2071
+ function ft(e, t, n) {
2072
+ if (!u(e)) throw new C("\"" + t + "\" must evaluate to an array.", n);
1980
2073
  return e.map((e, r) => {
1981
- if (!f(e) || !Number.isFinite(e)) throw new _("Invalid " + t + " value at index " + r + ". Expected a finite number.", n);
2074
+ if (!b(e) || !Number.isFinite(e)) throw new C("Invalid " + t + " value at index " + r + ". Expected a finite number.", n);
1982
2075
  return e;
1983
2076
  });
1984
2077
  }
1985
- var q = (e) => !!e && typeof e == "object" && "step" in e;
1986
- function ct(e) {
2078
+ var J = (e) => !!e && typeof e == "object" && "step" in e;
2079
+ function pt(e) {
1987
2080
  return typeof e == "number" && Number.isFinite(e);
1988
2081
  }
1989
- var J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
1990
- function lt(e, t) {
1991
- dt(e, t, "Import");
2082
+ var Y = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
2083
+ function mt(e, t) {
2084
+ gt(e, t, "Import");
1992
2085
  }
1993
- function ut(e, t) {
1994
- dt(e, t, "View");
2086
+ function ht(e, t) {
2087
+ gt(e, t, "View");
1995
2088
  }
1996
- function dt(e, t, n) {
2089
+ function gt(e, t, n) {
1997
2090
  if (t !== null && typeof t != "string") throw Error(n + " scope name must be a string or null.");
1998
- J.set(e, { name: t });
2091
+ Y.set(e, { name: t });
1999
2092
  }
2000
- function ft(e) {
2001
- return J.get(e);
2093
+ function _t(e) {
2094
+ return Y.get(e);
2002
2095
  }
2003
- function pt(e, t = {}) {
2096
+ function vt(e, t = {}) {
2004
2097
  let n = t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude";
2005
- Y.set(e, n);
2098
+ X.set(e, n);
2006
2099
  }
2007
- function mt(e, t = {}) {
2008
- Je(e, t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude");
2100
+ function yt(e, t = {}) {
2101
+ Qe(e, t.skipSubtree ?? !1 ? "excludeSubtree" : "exclude");
2009
2102
  }
2010
- function ht(e) {
2011
- return e.getLayoutAncestors().some(Xe);
2103
+ function bt(e) {
2104
+ return e.getLayoutAncestors().some(W);
2012
2105
  }
2013
- function X(e) {
2106
+ function Z(e) {
2014
2107
  let t = e.getDataAncestors(), n = [];
2015
2108
  for (let e = t.length - 1; e >= 0; --e) {
2016
- let r = J.get(t[e]);
2109
+ let r = Y.get(t[e]);
2017
2110
  r && typeof r.name == "string" && n.push(r.name);
2018
2111
  }
2019
2112
  return n;
2020
2113
  }
2021
- function gt(e) {
2114
+ function xt(e) {
2022
2115
  let t = e.explicitName;
2023
2116
  if (!t) throw Error("Cannot build a selector for a view without a name.");
2024
2117
  return {
2025
- scope: X(e),
2118
+ scope: Z(e),
2026
2119
  view: t
2027
2120
  };
2028
2121
  }
2029
- function _t(e, t) {
2122
+ function St(e, t) {
2030
2123
  if (!t) throw Error("Cannot build a selector for a parameter without a name.");
2031
2124
  return {
2032
- scope: X(e),
2125
+ scope: Z(e),
2033
2126
  param: t
2034
2127
  };
2035
2128
  }
2036
- function vt(e) {
2037
- return Et(e), "p:" + JSON.stringify({
2129
+ function Ct(e) {
2130
+ return jt(e), "p:" + JSON.stringify({
2038
2131
  scope: e.scope,
2039
2132
  param: e.param
2040
2133
  });
2041
2134
  }
2042
- function yt(e, t) {
2135
+ function wt(e, t) {
2043
2136
  e.visit((e) => {
2044
- let n = Ye(e);
2045
- if (n === "excludeSubtree") return W;
2137
+ let n = $e(e);
2138
+ if (n === "excludeSubtree") return G;
2046
2139
  if (n !== "exclude") return t(e);
2047
2140
  });
2048
2141
  }
2049
- function bt(e, t) {
2142
+ function Tt(e, t) {
2050
2143
  e.visit((e) => {
2051
- let n = Y.get(e);
2052
- if (n === "excludeSubtree") return W;
2144
+ let n = X.get(e);
2145
+ if (n === "excludeSubtree") return G;
2053
2146
  if (n !== "exclude") return t(e);
2054
2147
  });
2055
2148
  }
2056
- function xt(e, t) {
2057
- if (Dt(t), !Ft(e, t.scope)) return;
2149
+ function Et(e, t) {
2150
+ if (Mt(t), !Bt(e, t.scope)) return;
2058
2151
  let n = [];
2059
- if (Q(e, t.scope, (e) => {
2152
+ if ($(e, t.scope, (e) => {
2060
2153
  e.explicitName === t.view && n.push(e);
2061
2154
  }, { includeNamedImportRoots: !0 }), n.length === 1) return n[0];
2062
2155
  if (n.length !== 0) throw Error("View selector is ambiguous for view \"" + t.view + "\" in scope " + JSON.stringify(t.scope));
2063
2156
  }
2064
- function St(e, t) {
2065
- if (Et(t), !Ft(e, t.scope)) return;
2157
+ function Dt(e, t) {
2158
+ if (jt(t), !Bt(e, t.scope)) return;
2066
2159
  let n = [];
2067
- if (Q(e, t.scope, (e) => {
2068
- for (let [r, i] of e.paramRuntime.paramConfigs) r === t.param && Z(i) && n.push({
2160
+ if ($(e, t.scope, (e) => {
2161
+ for (let [r, i] of e.paramRuntime.paramConfigs) r === t.param && Q(i, e) && n.push({
2069
2162
  view: e,
2070
2163
  param: i
2071
2164
  });
2072
2165
  }), n.length === 1) return n[0];
2073
2166
  if (n.length !== 0) throw Error("Param selector is ambiguous for param \"" + t.param + "\" in scope " + JSON.stringify(t.scope));
2074
2167
  }
2075
- function Ct(e, t) {
2168
+ function Ot(e, t) {
2076
2169
  e.visit((e) => {
2077
- let n = Y.get(e);
2078
- if (n === "excludeSubtree") return W;
2079
- if (n !== "exclude") for (let [n, r] of e.paramRuntime.paramConfigs) Z(r) && t({
2170
+ let n = X.get(e);
2171
+ if (n === "excludeSubtree") return G;
2172
+ if (n !== "exclude") for (let [n, r] of e.paramRuntime.paramConfigs) Q(r, e) && t({
2080
2173
  view: e,
2081
2174
  param: r,
2082
- selector: _t(e, n)
2175
+ selector: St(e, n)
2083
2176
  });
2084
2177
  });
2085
2178
  }
2086
- function wt(e) {
2179
+ function kt(e) {
2087
2180
  let t = [];
2088
- return Ct(e, (e) => t.push(e)), t;
2181
+ return Ot(e, (e) => t.push(e)), t;
2089
2182
  }
2090
- function Tt(e) {
2183
+ function At(e) {
2091
2184
  let t = [];
2092
- for (let n of Ot(e)) {
2093
- let r = kt(n);
2094
- jt(e, r, t), Mt(e, r, t);
2185
+ for (let n of Nt(e)) {
2186
+ let r = Pt(n);
2187
+ It(e, r, t), Lt(e, r, t);
2095
2188
  }
2096
2189
  return t;
2097
2190
  }
2098
- function Et(e) {
2191
+ function jt(e) {
2099
2192
  if (!e || !Array.isArray(e.scope)) throw Error("Param selector scope must be an array.");
2100
2193
  if (typeof e.param != "string" || !e.param.length) throw Error("Param selector param must be a non-empty string.");
2101
2194
  }
2102
- function Dt(e) {
2195
+ function Mt(e) {
2103
2196
  if (!e || !Array.isArray(e.scope)) throw Error("View selector scope must be an array.");
2104
2197
  if (typeof e.view != "string" || !e.view.length) throw Error("View selector view must be a non-empty string.");
2105
2198
  }
2106
- function Z(e) {
2107
- return e.persist === !1 ? !1 : i(e) ? !0 : a(e) ? !!e.bind : !1;
2199
+ function Q(e, t) {
2200
+ if (e.persist === !1) return !1;
2201
+ if (e.push === "outer") {
2202
+ let n = t.paramRuntime.findRuntimeForParam(e.name);
2203
+ if (_(n.paramConfigs.get(e.name))) return !1;
2204
+ }
2205
+ return _(e) ? !0 : p(e) ? !!e.bind : !1;
2108
2206
  }
2109
- function Ot(e) {
2207
+ function Nt(e) {
2110
2208
  let t = /* @__PURE__ */ new Set([e]);
2111
2209
  return e.visit((e) => {
2112
- let n = J.get(e);
2210
+ let n = Y.get(e);
2113
2211
  n && typeof n.name == "string" && t.add(e);
2114
2212
  }), Array.from(t);
2115
2213
  }
2116
- function kt(e) {
2117
- return X(e);
2214
+ function Pt(e) {
2215
+ return Z(e);
2118
2216
  }
2119
- function At(e) {
2217
+ function Ft(e) {
2120
2218
  return e.length ? "import scope [" + e.join(" / ") + "]" : "import scope (root)";
2121
2219
  }
2122
- function jt(e, t, n) {
2220
+ function It(e, t, n) {
2123
2221
  let r = /* @__PURE__ */ new Map();
2124
- Q(e, t, (e) => {
2222
+ $(e, t, (e) => {
2125
2223
  for (let [t, n] of e.paramRuntime.paramConfigs) {
2126
- if (!Z(n)) continue;
2224
+ if (!Q(n, e)) continue;
2127
2225
  let i = r.get(t);
2128
2226
  i ? i.push(e) : r.set(t, [e]);
2129
2227
  }
@@ -2132,53 +2230,53 @@ function jt(e, t, n) {
2132
2230
  if (i.length <= 1) continue;
2133
2231
  let r = i.map((e) => e.getPathString()).join(", ");
2134
2232
  n.push({
2135
- message: "Bookmarkable parameter \"" + e + "\" is not unique within " + At(t) + ". Found in: " + r + ".",
2233
+ message: "Bookmarkable parameter \"" + e + "\" is not unique within " + Ft(t) + ". Found in: " + r + ".",
2136
2234
  scope: t
2137
2235
  });
2138
2236
  }
2139
2237
  }
2140
- function Mt(e, t, n) {
2141
- let r = Nt(e, t);
2238
+ function Lt(e, t, n) {
2239
+ let r = Rt(e, t);
2142
2240
  if (!r.length) return;
2143
- let i = r.filter((e) => Pt(e));
2241
+ let i = r.filter((e) => zt(e));
2144
2242
  if (i.length <= 1) return;
2145
2243
  let a = /* @__PURE__ */ new Map();
2146
2244
  for (let e of i) {
2147
- let t = J.get(e), n = t ? t.name : void 0;
2245
+ let t = Y.get(e), n = t ? t.name : void 0;
2148
2246
  typeof n == "string" && n.length && a.set(n, (a.get(n) ?? 0) + 1);
2149
2247
  }
2150
2248
  for (let [e, r] of a) r > 1 && n.push({
2151
- message: "Import instance name \"" + e + "\" is used multiple times for addressable instances in " + At(t) + ".",
2249
+ message: "Import instance name \"" + e + "\" is used multiple times for addressable instances in " + Ft(t) + ".",
2152
2250
  scope: t
2153
2251
  });
2154
2252
  }
2155
- function Nt(e, t) {
2253
+ function Rt(e, t) {
2156
2254
  let n = [];
2157
- return Q(e, t, (e) => {
2158
- if (X(e).length !== t.length + 1) return;
2159
- let r = J.get(e);
2255
+ return $(e, t, (e) => {
2256
+ if (Z(e).length !== t.length + 1) return;
2257
+ let r = Y.get(e);
2160
2258
  r && typeof r.name == "string" && n.push(e);
2161
2259
  }, { includeNamedImportRoots: !0 }), n;
2162
2260
  }
2163
- function Pt(e) {
2261
+ function zt(e) {
2164
2262
  let t = !1;
2165
2263
  return e.visit((e) => {
2166
- let n = Y.get(e);
2167
- if (n === "excludeSubtree") return W;
2264
+ let n = X.get(e);
2265
+ if (n === "excludeSubtree") return G;
2168
2266
  if (n !== "exclude") {
2169
- for (let n of e.paramRuntime.paramConfigs.values()) if (Z(n)) return t = !0, G;
2267
+ for (let n of e.paramRuntime.paramConfigs.values()) if (Q(n, e)) return t = !0, K;
2170
2268
  }
2171
2269
  }), t;
2172
2270
  }
2173
- function Ft(e, t) {
2271
+ function Bt(e, t) {
2174
2272
  let n = e, r = [];
2175
2273
  for (let i of t) {
2176
2274
  if (typeof i != "string" || !i.length) throw Error("Scope names must be non-empty strings.");
2177
2275
  let t, a = !1;
2178
- if (Q(e, r, (e) => {
2179
- let n = J.get(e);
2180
- if (n && n.name === i && X(e).length === r.length + 1) {
2181
- if (t) return a = !0, G;
2276
+ if ($(e, r, (e) => {
2277
+ let n = Y.get(e);
2278
+ if (n && n.name === i && Z(e).length === r.length + 1) {
2279
+ if (t) return a = !0, K;
2182
2280
  t = e;
2183
2281
  }
2184
2282
  }, { includeNamedImportRoots: !0 }), a) throw Error("Multiple import instances named \"" + i + "\" in scope.");
@@ -2187,25 +2285,25 @@ function Ft(e, t) {
2187
2285
  }
2188
2286
  return n;
2189
2287
  }
2190
- function Q(e, t, n, r = {}) {
2288
+ function $(e, t, n, r = {}) {
2191
2289
  let i = r.includeNamedImportRoots ?? !1;
2192
2290
  e.visit((e) => {
2193
- let r = J.get(e), a = Y.get(e);
2194
- if (a === "excludeSubtree") return W;
2195
- if (a !== "exclude" && It(e, t, r, i)) return n(e);
2291
+ let r = Y.get(e), a = X.get(e);
2292
+ if (a === "excludeSubtree") return G;
2293
+ if (a !== "exclude" && Vt(e, t, r, i)) return n(e);
2196
2294
  });
2197
2295
  }
2198
- function It(e, t, n, r) {
2199
- let i = X(e);
2200
- return Lt(i, t) ? !0 : !r || !n || typeof n.name != "string" || i.length !== t.length + 1 ? !1 : $(t, i);
2296
+ function Vt(e, t, n, r) {
2297
+ let i = Z(e);
2298
+ return Ht(i, t) ? !0 : !r || !n || typeof n.name != "string" || i.length !== t.length + 1 ? !1 : Ut(t, i);
2201
2299
  }
2202
- function Lt(e, t) {
2203
- return e.length === t.length && $(e, t);
2300
+ function Ht(e, t) {
2301
+ return e.length === t.length && Ut(e, t);
2204
2302
  }
2205
- function $(e, t) {
2303
+ function Ut(e, t) {
2206
2304
  if (e.length > t.length) return !1;
2207
2305
  for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
2208
2306
  return !0;
2209
2307
  }
2210
2308
  //#endregion
2211
- export { P as A, D as B, Ue as C, Fe as D, Re as E, S as F, ve as G, le as H, k as I, pe as K, T as L, j as M, xe as N, F as O, x as P, fe as R, qe as S, Le as T, _e as U, E as V, b as W, G as _, ht as a, Xe as b, pt as c, St as d, xt as f, W as g, yt as h, gt as i, Ce as j, N as k, lt as l, bt as m, ft as n, vt as o, Tt as p, de as q, X as r, mt as s, wt as t, ut as u, rt as v, B as w, Ze as x, $e as y, ue as z };
2309
+ export { L as A, Be as B, et as C, Ke as D, z as E, F, Ee as G, je as H, Fe as I, De as K, M as L, ze as M, Le as N, D as O, I as P, Ie as R, W as S, qe as T, Oe as U, Re as V, ke as W, G as _, xt as a, at as b, yt as c, ht as d, Dt as f, wt as g, Tt as h, Z as i, P as j, O as k, vt as l, At as m, _t as n, bt as o, Et as p, ge as q, St as r, Ct as s, kt as t, mt as u, K as v, Ze as w, nt as x, ct as y, N as z };