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