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