@genome-spy/app 0.88.1 → 0.90.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 (65) hide show
  1. package/dist/{agentApi-BIpg3JKh.js → agentApi-Z65dw-sD.js} +5976 -6711
  2. package/dist/agentApi.es.js +3580 -4470
  3. package/dist/agentShared.es.js +742 -683
  4. package/dist/{canvas2d-BVQ7-2eJ.js → canvas2d-DiPQvNtZ.js} +122 -109
  5. package/dist/{canvas2d-D7SZK3xv.js → canvas2d-t_N10CeW.js} +114 -101
  6. package/dist/{canvasSizeHelper-7h_8rOcx.js → canvasSizeHelper-foL2YvGL.js} +15 -8
  7. package/dist/{clipOptions-DTMcB_9z.js → clipOptions-B5PibDq3.js} +1610 -1342
  8. package/dist/{clipOptions-BWHr3aTa.js → clipOptions-Cba4I0AO.js} +1872 -1644
  9. package/dist/{componentStyles-FsNmIb22.js → componentStyles-DGtQXvwc.js} +17 -15
  10. package/dist/{debug-CVpoEOWx.js → debug-CVAlrcZt.js} +2 -2
  11. package/dist/{debug-DYAMZZKl.js → debug-DP4WzTNo.js} +2 -2
  12. package/dist/dialog.es.js +4 -3
  13. package/dist/esm-BiqrFjMh.js +443 -0
  14. package/dist/{esm-lwYrRdbg.js → esm-Bv7Frz7C.js} +142 -79
  15. package/dist/{esm-VvpZ9hsq.js → esm-C3A-AuRi.js} +1 -1
  16. package/dist/esm-CvpR1OcU.js +322 -0
  17. package/dist/esm-DFHFX1sH.js +1526 -0
  18. package/dist/esm-Dndm-NaA.js +1193 -0
  19. package/dist/{esm-CcDLRSvC.js → esm-DtNElqRr.js} +64 -63
  20. package/dist/esm-L53qjcYH.js +1155 -0
  21. package/dist/esm-VFJeyk9i.js +249 -0
  22. package/dist/{esm-BdLYkz-m.js → esm-_xCtpDwm.js} +1 -1
  23. package/dist/index.es.js +4203 -3910
  24. package/dist/index.js +971 -482
  25. package/dist/{indexer-CXjZDo2Q.js → indexer-DbFTKGlm.js} +1 -1
  26. package/dist/{indexer-DAH_ruVn.js → indexer-En7gpvLN.js} +1 -1
  27. package/dist/{lit-ByuJ0FJ4.js → lit-CoXp9NFX.js} +12 -10
  28. package/dist/order-BkYCnwD7.js +1062 -0
  29. package/dist/order-R043xTpC.js +1062 -0
  30. package/dist/{parquetRead-Cs2xRrvz.js → parquetRead-0hFIa3Cc.js} +532 -350
  31. package/dist/rasterExport-C_FcNBkC.js +52 -0
  32. package/dist/rasterExport-Z7gs5346.js +52 -0
  33. package/dist/rasterization-_-9JmSas.js +63 -0
  34. package/dist/rectangle-DE98gIxF.js +108 -0
  35. package/dist/{renderCanvas2D-DxturTEW.js → renderCanvas2D-DK1c9TFK.js} +68 -67
  36. package/dist/{renderCanvas2D-DtcJjqpB.js → renderCanvas2D-IM-A9DYG.js} +57 -56
  37. package/dist/schema.json +599 -116
  38. package/dist/{src-DjOlFqSn.js → src-DJtvThVC.js} +3 -5
  39. package/dist/style.css +1 -1
  40. package/dist/{svg-SDJMzL--.js → svg-DW3tfUmm.js} +339 -326
  41. package/dist/{svg-CyrLfa9e.js → svg-PabUdcDi.js} +365 -352
  42. package/dist/{svgRasterizer-f7DJ3UO0.js → svgRasterizer-B6YtWLJs.js} +6 -5
  43. package/dist/{svgRasterizer-mWK7HTkx.js → svgRasterizer-BEVDyyS3.js} +6 -5
  44. package/dist/{vega-scale-DLKCwWRs.js → vega-scale-Byaw1K8O.js} +823 -780
  45. package/dist/{vega-scale-CypF85iS.js → vega-scale-Ctz_wa3z.js} +963 -923
  46. package/dist/{viewIdentityRegistry-Dl-vMN9I.js → viewIdentityRegistry-BW415b3o.js} +1 -1
  47. package/dist/{viewIdentityRegistry-DIDo44XQ.js → viewIdentityRegistry-_F0E7nkA.js} +1 -1
  48. package/dist/{viewSelectors-CymbZyE6.js → viewSelectors-DYz-PhTO.js} +407 -340
  49. package/dist/{viewSelectors-DNiDip5e.js → viewSelectors-KtD-QSN0.js} +349 -282
  50. package/dist/{viewUtils-BrJLIj2o.js → viewUtils-BZGPseMx.js} +2052 -1871
  51. package/dist/{webgl-tZfZ8y3q.js → webgl-BKSGqHaz.js} +2144 -784
  52. package/dist/{webgl-CTJt7jQd.js → webgl-tdKf9SlZ.js} +2386 -1026
  53. package/package.json +5 -5
  54. package/dist/esm-80V4xF_D.js +0 -1098
  55. package/dist/esm-BA6yMcc-.js +0 -1222
  56. package/dist/esm-BdT7qUL-.js +0 -157
  57. package/dist/esm-CfYZhLHN.js +0 -1367
  58. package/dist/esm-D-iG_TIX.js +0 -441
  59. package/dist/esm-JAiZmFIS.js +0 -128
  60. package/dist/order-C5CzA37O.js +0 -918
  61. package/dist/order-DvY7KNcu.js +0 -918
  62. package/dist/rasterExport-BgZ98e6U.js +0 -44
  63. package/dist/rasterExport-DEr8fOLm.js +0 -44
  64. package/dist/rasterization-CFogVB3B.js +0 -50
  65. package/dist/rectangle-DKnrAmKs.js +0 -142
@@ -0,0 +1,1062 @@
1
+ import { $t as e, Ft as t, St as n, mt as r, un as i } from "./clipOptions-Cba4I0AO.js";
2
+ import { i as a } from "./rasterization-_-9JmSas.js";
3
+ import { t as o } from "./rectangle-DE98gIxF.js";
4
+ //#region ../core/src/rendering/immediate/markData.js
5
+ var s = [], c = class {
6
+ #e = {
7
+ x: 0,
8
+ y: 0,
9
+ width: 0,
10
+ height: 0
11
+ };
12
+ #t = new o(() => this.#e.x, () => this.#e.y, () => this.#e.width, () => this.#e.height);
13
+ #n;
14
+ #r = 0;
15
+ #i = 0;
16
+ #a = NaN;
17
+ #o = NaN;
18
+ #s = NaN;
19
+ resolveFacet(e, t) {
20
+ this.#c(e);
21
+ let n = t.locSize.location, r = t.locSize.size;
22
+ return (this.#a !== n || this.#o !== r || this.#s !== t.pixelToUnit) && (this.#l(n, r, t.pixelToUnit), this.#a = n, this.#o = r, this.#s = t.pixelToUnit), this.#t;
23
+ }
24
+ resolvePlacement(e, t, n) {
25
+ if (!t) return;
26
+ let r = t.getSnapshot().rectangles, i = n * 4;
27
+ if (!(i + 3 >= r.length)) return this.#c(e), this.#l(r[i + 1], r[i + 3], 1), this.#a = NaN, this.#o = NaN, this.#s = NaN, this.#t;
28
+ }
29
+ #c(e) {
30
+ this.#n !== e && (this.#e.x = e.x, this.#r = e.y, this.#e.width = e.width, this.#i = e.height, this.#n = e, this.#a = NaN, this.#o = NaN, this.#s = NaN);
31
+ }
32
+ #l(e, t, n) {
33
+ this.#e.y = this.#r + e * n * this.#i, this.#e.height = t * n * this.#i;
34
+ }
35
+ };
36
+ function l(e, t) {
37
+ let n = e.unitView.getCollector();
38
+ if (!n) throw Error(`Cannot render an uninitialized mark. View: ${e.unitView.getPathString()}`);
39
+ let r = n.facetBatches.get(void 0);
40
+ return r?.length ? r : n.facetBatches.get(t.facetId) ?? s;
41
+ }
42
+ function u(e, t, n, r, i, a) {
43
+ let o = l(e, t);
44
+ if (t.sampleFacetRenderingOptions) i(r.resolveFacet(n, t.sampleFacetRenderingOptions), o);
45
+ else if (e.encoders.facetIndex) for (let [s, c] of d(e.encoders.facetIndex, o)) {
46
+ let e = r.resolvePlacement(n, t.placement?.source, s);
47
+ e ? i(e, c) : a(s);
48
+ }
49
+ else i(n, o);
50
+ }
51
+ function d(e, t) {
52
+ let n = /* @__PURE__ */ new Map();
53
+ for (let r of t) {
54
+ let t = +e(r), i = n.get(t);
55
+ i || (i = [], n.set(t, i)), i.push(r);
56
+ }
57
+ return n;
58
+ }
59
+ //#endregion
60
+ //#region ../core/src/rendering/immediate/bounds.js
61
+ function f(e, t, n) {
62
+ return {
63
+ x1: n?.clipX ? Math.max(0, n.rect.x) : 0,
64
+ y1: n?.clipY ? Math.max(0, n.rect.y) : 0,
65
+ x2: n?.clipX ? Math.min(e, n.rect.x2) : e,
66
+ y2: n?.clipY ? Math.min(t, n.rect.y2) : t
67
+ };
68
+ }
69
+ function p(e, t, n) {
70
+ let r = n === !0 || n === "x", i = n === !0 || n === "y";
71
+ return {
72
+ x1: r ? t?.clipX ? t.rect.x : e.x : -Infinity,
73
+ y1: i ? t?.clipY ? t.rect.y : e.y : -Infinity,
74
+ x2: r ? t?.clipX ? t.rect.x2 : e.x2 : Infinity,
75
+ y2: i ? t?.clipY ? t.rect.y2 : e.y2 : Infinity
76
+ };
77
+ }
78
+ function m(e) {
79
+ return e.x1 <= e.x2 && e.y1 <= e.y2;
80
+ }
81
+ function h(e, t, n) {
82
+ return t < e.x1 || t > e.x2 || n < e.y1 || n > e.y2;
83
+ }
84
+ function g(e, t, n, r, i, a = 0) {
85
+ return !(Math.max(t, r) + a < e.x1 || Math.min(t, r) - a > e.x2 || Math.max(n, i) + a < e.y1 || Math.min(n, i) - a > e.y2);
86
+ }
87
+ //#endregion
88
+ //#region ../core/src/rendering/immediate/geometry/polygonUnion.js
89
+ var _ = 1e-8;
90
+ function v(e) {
91
+ let t = e.flatMap((e, t) => e.map((n, r) => ({
92
+ a: n,
93
+ b: e[(r + 1) % e.length],
94
+ polygonIndex: t
95
+ }))), n = [];
96
+ for (let r of t) {
97
+ let i = [0, 1];
98
+ for (let e of t) r.polygonIndex != e.polygonIndex && y(r, e, i);
99
+ i.sort((e, t) => e - t);
100
+ for (let t = 0; t < i.length - 1; t++) {
101
+ let a = i[t], o = i[t + 1];
102
+ if (o - a <= _) continue;
103
+ let s = T(r.a, r.b, a), c = T(r.a, r.b, o), l = T(s, c, .5);
104
+ e.some((e, t) => t != r.polygonIndex && C(l, e)) || n.push({
105
+ a: s,
106
+ b: c,
107
+ polygonIndex: r.polygonIndex
108
+ });
109
+ }
110
+ }
111
+ return S(x(n));
112
+ }
113
+ function y(e, t, n) {
114
+ let r = D(e.b, e.a), i = D(t.b, t.a), a = D(t.a, e.a), o = k(r, i);
115
+ if (Math.abs(o) > _) {
116
+ let e = k(a, i) / o, t = k(a, r) / o;
117
+ e > _ && e < .99999999 && t >= -1e-8 && t <= 1.00000001 && n.push(e);
118
+ } else Math.abs(k(a, r)) <= _ && (b(e, t.a, n), b(e, t.b, n));
119
+ }
120
+ function b(e, t, n) {
121
+ let r = D(e.b, e.a), i = O(r, r), a = O(D(t, e.a), r) / i;
122
+ a > _ && a < .99999999 && n.push(a);
123
+ }
124
+ function x(e) {
125
+ let t = /* @__PURE__ */ new Map();
126
+ for (let n of e) {
127
+ let e = E(n.a) + ":" + E(n.b), r = E(n.b) + ":" + E(n.a);
128
+ t.has(r) ? t.delete(r) : t.has(e) || t.set(e, n);
129
+ }
130
+ return Array.from(t.values());
131
+ }
132
+ function S(e) {
133
+ let t = /* @__PURE__ */ new Map();
134
+ for (let n of e) {
135
+ let e = E(n.a), r = t.get(e) ?? [];
136
+ r.push(n), t.set(e, r);
137
+ }
138
+ let n = new Set(e), r = [];
139
+ for (; n.size;) {
140
+ let e = n.values().next().value, i = [e.a], a = e;
141
+ for (;;) {
142
+ if (n.delete(a), i.push(a.b), E(a.b) == E(i[0])) {
143
+ i.pop();
144
+ break;
145
+ }
146
+ let e = (t.get(E(a.b)) ?? []).find((e) => n.has(e));
147
+ if (!e) throw Error("Cannot chain SVG polygon union boundary.");
148
+ a = e;
149
+ }
150
+ r.push(i);
151
+ }
152
+ return r;
153
+ }
154
+ function C(e, t) {
155
+ let n = !1;
156
+ for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
157
+ let a = t[i], o = t[r];
158
+ if (w(e, a, o)) return !1;
159
+ a.y > e.y != o.y > e.y && e.x < (o.x - a.x) * (e.y - a.y) / (o.y - a.y) + a.x && (n = !n);
160
+ }
161
+ return n;
162
+ }
163
+ function w(e, t, n) {
164
+ return Math.abs(k(D(e, t), D(n, t))) <= _ && O(D(e, t), D(e, n)) <= _;
165
+ }
166
+ function T(e, t, n) {
167
+ return {
168
+ x: e.x + (t.x - e.x) * n,
169
+ y: e.y + (t.y - e.y) * n
170
+ };
171
+ }
172
+ function E(e) {
173
+ return `${Math.round(e.x / _)},${Math.round(e.y / _)}`;
174
+ }
175
+ function D(e, t) {
176
+ return {
177
+ x: e.x - t.x,
178
+ y: e.y - t.y
179
+ };
180
+ }
181
+ function O(e, t) {
182
+ return e.x * t.x + e.y * t.y;
183
+ }
184
+ function k(e, t) {
185
+ return e.x * t.y - e.y * t.x;
186
+ }
187
+ //#endregion
188
+ //#region ../core/src/rendering/immediate/markEncoding.js
189
+ function A(e, t, n) {
190
+ return e.x + t * e.width + n;
191
+ }
192
+ function j(e, t, n) {
193
+ return e.y + (1 - t) * e.height + n;
194
+ }
195
+ function M(e, t, n, r = [0, 0]) {
196
+ return F(e, t.x, t.x2, t.xOffset, t.x2Offset, n, A, r);
197
+ }
198
+ function N(e, t, n, r = [0, 0]) {
199
+ return F(e, t.y, t.y2, t.yOffset, t.y2Offset, n, j, r);
200
+ }
201
+ function P(e, t, n, r) {
202
+ let i = t[n], a = t[n + "2"], o = t[n + "Offset"], s = t[n + "2Offset"], c = n == "x" ? e.width : e.height, l = n == "x" ? e.x : e.y + c, u = n == "x" ? c : -c, d = R(i), f = a ? R(a) : 0, p = i.constant ? I(i, r) + d : 0, m = a?.constant ? I(a, r) + f : 0, h = o.constant ? I(o, r) : 0, g = a && s?.constant ? I(s, r) : 0;
203
+ return (e, t) => {
204
+ let n = o.constant ? h : I(o, e), r = i.constant ? p : I(i, e) + d, c = l + r * u + n, _ = c;
205
+ if (a) {
206
+ let t = a.constant ? m : I(a, e) + f, r = s ? s.constant ? g : I(s, e) : n;
207
+ _ = l + t * u + r;
208
+ }
209
+ return t[0] = c, t[1] = _, t;
210
+ };
211
+ }
212
+ function F(e, t, n, r, i, a, o, s) {
213
+ let c = I(r, a), l = o(e, L(t, a), c), u = n ? o(e, L(n, a), i ? I(i, a) : c) : l;
214
+ return s[0] = l, s[1] = u, s;
215
+ }
216
+ function I(e, t) {
217
+ return e(t);
218
+ }
219
+ function L(e, t) {
220
+ return I(e, t) + R(e);
221
+ }
222
+ function R(e) {
223
+ let t = e.scale;
224
+ if (!t) return 0;
225
+ let n = e.channelDef, r = n && "band" in n ? n.band ?? .5 : .5;
226
+ return a(t, r);
227
+ }
228
+ function z(e, t) {
229
+ return V(e(t));
230
+ }
231
+ function B(e, t) {
232
+ return n(t) ? e.unitView.paramRuntime.evaluateAndGet(t.expr) : t;
233
+ }
234
+ function V(e) {
235
+ return e == null ? "none" : "" + e;
236
+ }
237
+ //#endregion
238
+ //#region ../core/src/rendering/immediate/marks/arrow.js
239
+ function H(e) {
240
+ let t = e.properties, n = B(e, t.headSpacing);
241
+ return {
242
+ configuredRHeadSlope: ce(B(e, t.headAngle)),
243
+ configuredRHeadNotchSlope: ce(B(e, t.headNotchAngle)),
244
+ headShape: B(e, t.headShape),
245
+ headWidth: B(e, t.headWidth),
246
+ minSize: B(e, t.minSize),
247
+ stem: B(e, t.stem),
248
+ startNotch: B(e, t.startNotch),
249
+ minStemLength: B(e, t.minStemLength),
250
+ headSpacing: n,
251
+ repeatHeads: n != null && n >= 0,
252
+ headPlacement: B(e, t.headPlacement)
253
+ };
254
+ }
255
+ function ee(e, t, n, r) {
256
+ let { viewOpacity: i } = n, a = e.encoders;
257
+ return U(e, t, n, (e) => {
258
+ let n = t.stem ? re(e.tail, e.tip, e.tangent, e.normal, e.stemHalfWidth, e.rHeadSlope, t.startNotch && !e.bidirectional, e.bidirectional) : null, o = n ? [n] : [];
259
+ W(e, (t, n, r, i) => {
260
+ let a = {
261
+ x: t,
262
+ y: n
263
+ };
264
+ o.push(e.renderedHeadShape == "open" ? ie(a, r, i, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope, e.size) : ne(a, r, i, e.headHalfWidth, e.rHeadSlope, e.rHeadNotchSlope));
265
+ });
266
+ let s = V(a.stroke(e.datum)) != "none" && I(a.strokeOpacity, e.datum) * i > 0 && e.strokeWidth > 0;
267
+ r({
268
+ datum: e.datum,
269
+ boundaryLoops: o.length == 1 || !s ? o : v(o),
270
+ strokeWidth: e.strokeWidth,
271
+ headShapeFallback: e.headShapeFallback
272
+ });
273
+ });
274
+ }
275
+ function U(e, t, n, r) {
276
+ let { coords: i, data: a, visibleBounds: o, countOnly: s } = n, c = e.encoders;
277
+ if (a.length == 0) return 0;
278
+ let l = P(i, c, "x", a[0]), u = P(i, c, "y", a[0]), d = [0, 0], f = [0, 0], p = {
279
+ datum: {},
280
+ tail: {
281
+ x: 0,
282
+ y: 0
283
+ },
284
+ tip: {
285
+ x: 0,
286
+ y: 0
287
+ },
288
+ tangent: {
289
+ x: 0,
290
+ y: 0
291
+ },
292
+ normal: {
293
+ x: 0,
294
+ y: 0
295
+ },
296
+ reverseTangent: {
297
+ x: 0,
298
+ y: 0
299
+ },
300
+ reverseNormal: {
301
+ x: 0,
302
+ y: 0
303
+ },
304
+ size: 0,
305
+ stemHalfWidth: 0,
306
+ headHalfWidth: 0,
307
+ headAxisLength: 0,
308
+ rHeadSlope: 0,
309
+ rHeadNotchSlope: 0,
310
+ strokeWidth: 0,
311
+ repeatSpacing: Infinity,
312
+ headRepeatFootprint: 0,
313
+ geometryLength: 0,
314
+ bidirectional: !1,
315
+ stemContainsHead: !1,
316
+ renderedHeadShape: "triangle",
317
+ headShapeFallback: !1
318
+ }, m = 0;
319
+ for (let e of a) {
320
+ l(e, d), u(e, f);
321
+ let n = te(c.direction, e), i = n == "reverse", a = n == "both", h = i ? d[1] : d[0], _ = i ? f[1] : f[0], v = i ? d[0] : d[1], y = i ? f[0] : f[1], b = v - h, x = y - _, S = Math.hypot(b, x);
322
+ if (S == 0) continue;
323
+ let C = b / S, w = x / S, T = Math.max(I(c.size, e), t.minSize), E = T / 2, D = Math.max(t.headWidth * T, 0) / 2, O = ae({
324
+ segmentLength: S,
325
+ headHalfWidth: D,
326
+ stemHalfWidth: t.stem ? E : -E,
327
+ configuredRHeadSlope: t.configuredRHeadSlope,
328
+ configuredRHeadNotchSlope: t.configuredRHeadNotchSlope,
329
+ headRepeat: t.repeatHeads && !a,
330
+ headPlacement: t.headPlacement,
331
+ startNotch: t.startNotch && !a,
332
+ minStemLength: t.minStemLength,
333
+ headShape: t.headShape,
334
+ bidirectional: a
335
+ }), k = t.headShape == "open" ? O : Math.min(t.configuredRHeadNotchSlope, O), A = t.headShape == "open" ? T : 0, j = t.headPlacement == "outside" ? se(D, O, k, A) : 0, M = v + C * j, N = y + w * j;
336
+ a && (h -= C * j, _ -= w * j);
337
+ let P = D * O, F = Math.hypot(D, P), L = t.headShape == "open" && F > 0 ? T * D / F : 0, R = M - C * (P + L), z = N - w * (P + L), B = a ? h + C * (P + L) : h, V = a ? _ + w * (P + L) : _, H = I(c.strokeWidth, e), ee = Math.max(t.stem ? E : 0, D) + H * 2;
338
+ if (!g(o, Math.min(h, M, R, B), Math.min(_, N, z, V), Math.max(h, M, R, B), Math.max(_, N, z, V), ee) || (m++, s)) continue;
339
+ let U = t.headShape == "triangle" || t.headShape == "open" ? t.headShape : "triangle", W = P + A / Math.hypot(O, 1) + H, ne = !t.repeatHeads || a ? Infinity : Math.max((t.headSpacing ?? 0) * T, W);
340
+ p.datum = e, q(p.tail, h, _), q(p.tip, M, N), q(p.tangent, C, w), q(p.normal, -w, C), q(p.reverseTangent, -C, -w), q(p.reverseNormal, w, -C), p.size = T, p.stemHalfWidth = E, p.headHalfWidth = D, p.headAxisLength = P, p.rHeadSlope = O, p.rHeadNotchSlope = k, p.strokeWidth = H, p.repeatSpacing = ne, p.headRepeatFootprint = W, p.geometryLength = Math.hypot(M - h, N - _), p.bidirectional = a, p.stemContainsHead = t.stem && U == "triangle" && (!t.repeatHeads || a) && D <= E, p.renderedHeadShape = U, p.headShapeFallback = U != t.headShape, r(p);
341
+ }
342
+ return m;
343
+ }
344
+ function te(e, t) {
345
+ let n = z(e, t);
346
+ switch (n) {
347
+ case "forward":
348
+ case "reverse":
349
+ case "both": return n;
350
+ default: throw Error(`Invalid value for "direction" channel: ${n}`);
351
+ }
352
+ }
353
+ function W(e, t) {
354
+ e.bidirectional && !e.stemContainsHead && t(e.tail.x, e.tail.y, e.reverseTangent, e.reverseNormal);
355
+ for (let n = 0; !e.stemContainsHead && !(n > 0 && n + e.headRepeatFootprint - e.strokeWidth / 2 > e.geometryLength || (t(e.tip.x - e.tangent.x * n, e.tip.y - e.tangent.y * n, e.tangent, e.normal), !(e.repeatSpacing > 0) || !Number.isFinite(e.repeatSpacing))); n += e.repeatSpacing);
356
+ }
357
+ function ne(e, t, n, r, i, a) {
358
+ let o = r * i, s = o - r * a, c = G(G(e, K(t, -o)), K(n, r)), l = G(G(e, K(t, -o)), K(n, -r));
359
+ return [
360
+ e,
361
+ c,
362
+ G(e, K(t, -s)),
363
+ l
364
+ ];
365
+ }
366
+ function re(e, t, n, r, i, a, o, s) {
367
+ let c = i * a, l = G(G(t, K(n, -c)), K(r, i)), u = G(G(t, K(n, -c)), K(r, -i)), d = G(e, K(r, i)), f = G(e, K(r, -i));
368
+ return s ? [
369
+ t,
370
+ l,
371
+ G(G(e, K(n, c)), K(r, i)),
372
+ e,
373
+ G(G(e, K(n, c)), K(r, -i)),
374
+ u
375
+ ] : [
376
+ t,
377
+ l,
378
+ d,
379
+ ...o ? [G(e, K(n, i * a))] : [],
380
+ f,
381
+ u
382
+ ];
383
+ }
384
+ function ie(e, t, n, r, i, a, o) {
385
+ let s = r * i, c = G(G(e, K(t, -s)), K(n, r)), l = G(G(e, K(t, -s)), K(n, -r)), u = Math.hypot(r, s), d = u > 0 ? o * r / u : 0, f = u > 0 ? o * s / u : 0, p = G(G(c, K(t, -d)), K(n, -f)), m = G(G(l, K(t, -d)), K(n, f));
386
+ return [
387
+ e,
388
+ c,
389
+ p,
390
+ G(e, K(t, -(s + d - (r - f) * a))),
391
+ m,
392
+ l
393
+ ];
394
+ }
395
+ function ae({ segmentLength: e, headHalfWidth: t, stemHalfWidth: n, configuredRHeadSlope: r, configuredRHeadNotchSlope: i, headRepeat: a, headPlacement: o, startNotch: s, minStemLength: c, headShape: l, bidirectional: u }) {
396
+ if (a || n < 0) return r;
397
+ if (o == "outside") return !s || n <= 0 ? r : Math.min(r, Math.max(e - c, 0) / n);
398
+ if (l != "triangle") return r;
399
+ let d = Math.max(e - c, 0) / (u ? 2 : 1);
400
+ return oe(n, t, r, i) <= d ? r : d < n * i ? n > 0 ? le(d / n, 0, r) : 0 : le((d + (t - n) * i) / t, 0, r);
401
+ }
402
+ function oe(e, t, n, r) {
403
+ return t * n - (t - e) * Math.min(r, n);
404
+ }
405
+ function se(e, t, n, r) {
406
+ if (e <= 0) return 0;
407
+ let i = e * t, a = Math.hypot(e, i);
408
+ return i + r * e / a - (e - r * i / a) * n;
409
+ }
410
+ function ce(e) {
411
+ let t = le(e, 1, 90) * Math.PI / 180;
412
+ return 1 / Math.max(Math.tan(t), 1e-6);
413
+ }
414
+ function G(e, t) {
415
+ return {
416
+ x: e.x + t.x,
417
+ y: e.y + t.y
418
+ };
419
+ }
420
+ function K(e, t) {
421
+ return {
422
+ x: e.x * t,
423
+ y: e.y * t
424
+ };
425
+ }
426
+ function q(e, t, n) {
427
+ e.x = t, e.y = n;
428
+ }
429
+ function le(e, t, n) {
430
+ return Math.min(Math.max(e, t), n);
431
+ }
432
+ //#endregion
433
+ //#region ../core/src/rendering/immediate/linkFading.js
434
+ var ue = 4;
435
+ function de(e, t, n) {
436
+ let r = t[0] - e[0], i = t[1] - e[1], a = Math.hypot(r, i);
437
+ if (a == 0) return;
438
+ let o = -i / a, s = r / a;
439
+ (o < 0 || o == 0 && s < 0) && (o = -o, s = -s);
440
+ let c = o * e[0] + s * e[1], [l, u] = n, d = JSON.stringify([
441
+ J(o, 6),
442
+ J(s, 6),
443
+ J(c, 1),
444
+ J(l, 1),
445
+ J(u, 1)
446
+ ]);
447
+ return {
448
+ normalX: o,
449
+ normalY: s,
450
+ offset: c,
451
+ start: l,
452
+ end: u,
453
+ key: d
454
+ };
455
+ }
456
+ function fe(e, t, n = !1) {
457
+ let r = B(e, e.properties.arcFadingDistance);
458
+ return t != "arc" && t != "dome" || r === !1 || r[0] <= 0 || r[1] <= 0 || n && B(e, e.properties.noFadingOnSecondPass) ? !1 : r;
459
+ }
460
+ function pe(e, t) {
461
+ let n = [], r = (r) => {
462
+ for (let i = 0; i <= ue; i++) {
463
+ let a = i / ue, o = r ? t + (e - t) * a : e + (t - e) * a, s = r ? (t - o) / (2 * t) : (t + o) / (2 * t), c = (o - e) / (t - e);
464
+ n.push({
465
+ offset: s,
466
+ opacity: 1 - me(c)
467
+ });
468
+ }
469
+ };
470
+ return r(!0), r(!1), n;
471
+ }
472
+ function me(e) {
473
+ let t = Math.max(0, Math.min(1, e));
474
+ return t * t * (3 - 2 * t);
475
+ }
476
+ function J(e, t) {
477
+ let n = 10 ** t;
478
+ return Math.round(e * n) / n;
479
+ }
480
+ //#endregion
481
+ //#region ../core/src/rendering/immediate/geometry/linkGeometry.js
482
+ function he(e, t, n, r) {
483
+ if (r.shape == "arc") {
484
+ let i = [...e], a = [...t], o = X(a, i), s = ye(o);
485
+ if (s == 0) return [
486
+ i,
487
+ i,
488
+ a,
489
+ a
490
+ ];
491
+ let c = Z(o, 1 / s), l = [-c[1], c[0]];
492
+ s = ge(i, a, s, r.maxChordLength, n);
493
+ let u = Z(l, Math.max(s / 2 * r.arcHeightFactor, r.minArcHeight) / .75);
494
+ return [
495
+ i,
496
+ Y(i, u),
497
+ Y(a, u),
498
+ a
499
+ ];
500
+ }
501
+ if (r.shape == "dome") {
502
+ let i, a, o;
503
+ r.orient == "vertical" ? (i = [Math.min(e[0], t[0]), t[1]], a = [Math.max(e[0], t[0]), t[1]], o = [0, e[1] - t[1]]) : (i = [t[0], Math.min(e[1], t[1])], a = [t[0], Math.max(e[1], t[1])], o = [e[0] - t[0], 0]);
504
+ let s = ye(X(a, i));
505
+ ge(i, a, s, r.maxChordLength, n), r.clampApex && _e(i, a, r.orient, n);
506
+ let c = Z(o, 1 / .75);
507
+ return [
508
+ i,
509
+ Y(i, c),
510
+ Y(a, c),
511
+ a
512
+ ];
513
+ }
514
+ if (r.shape == "diagonal") {
515
+ if (r.orient == "vertical") {
516
+ let n = (e[1] + t[1]) / 2;
517
+ return [
518
+ e,
519
+ [e[0], n],
520
+ [t[0], n],
521
+ t
522
+ ];
523
+ }
524
+ {
525
+ let n = (e[0] + t[0]) / 2;
526
+ return [
527
+ e,
528
+ [n, e[1]],
529
+ [n, t[1]],
530
+ t
531
+ ];
532
+ }
533
+ }
534
+ if (r.shape == "line") {
535
+ let n = Z(Y(e, t), .5);
536
+ return [
537
+ e,
538
+ n,
539
+ n,
540
+ t
541
+ ];
542
+ }
543
+ throw Error(`Unsupported link shape: ${r.shape}`);
544
+ }
545
+ function ge(e, t, n, r, i) {
546
+ if (n <= r) return n;
547
+ let a = Z(X(t, e), 1 / n);
548
+ return ve(e, i, 2) ? (be(t, Y(e, Z(a, r))), r) : ve(t, i, 2) ? (be(e, X(t, Z(a, r))), r) : n;
549
+ }
550
+ function _e(e, t, n, r) {
551
+ n == "vertical" ? (t[0] > 0 && (e[0] = Math.max(e[0], -t[0])), e[0] < r.width && (t[0] = Math.min(t[0], 2 * r.width - e[0]))) : (t[1] > 0 && (e[1] = Math.max(e[1], -t[1])), e[1] < r.height && (t[1] = Math.min(t[1], 2 * r.height - e[1])));
552
+ }
553
+ function ve(e, t, n) {
554
+ return e[0] >= -t.width * n && e[0] <= t.width * (1 + n) && e[1] >= -t.height * n && e[1] <= t.height * (1 + n);
555
+ }
556
+ function Y(e, t) {
557
+ return [e[0] + t[0], e[1] + t[1]];
558
+ }
559
+ function X(e, t) {
560
+ return [e[0] - t[0], e[1] - t[1]];
561
+ }
562
+ function Z(e, t) {
563
+ return [e[0] * t, e[1] * t];
564
+ }
565
+ function ye(e) {
566
+ return Math.hypot(e[0], e[1]);
567
+ }
568
+ function be(e, t) {
569
+ e[0] = t[0], e[1] = t[1];
570
+ }
571
+ //#endregion
572
+ //#region ../core/src/rendering/immediate/marks/link.js
573
+ function xe(e) {
574
+ let t = e.properties;
575
+ return {
576
+ shape: B(e, t.linkShape),
577
+ orient: B(e, t.orient),
578
+ arcHeightFactor: B(e, t.arcHeightFactor),
579
+ minArcHeight: B(e, t.minArcHeight),
580
+ maxChordLength: B(e, t.maxChordLength),
581
+ clampApex: B(e, t.clampApex)
582
+ };
583
+ }
584
+ function Se(e, t, n, r) {
585
+ let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
586
+ if (a.length == 0) return 0;
587
+ let c = P(i, s, "x", a[0]), l = P(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = i.x, p = i.y, m = {
588
+ width: i.width,
589
+ height: i.height
590
+ }, h = p + m.height, _ = 0;
591
+ for (let e of a) {
592
+ c(e, u), l(e, d);
593
+ let [n, i] = u, [a, p] = d, v = he([n - f, h - a], [i - f, h - p], m, t);
594
+ for (let e of v) e[0] += f, e[1] = h - e[1];
595
+ let [y, b, x, S] = v, C = I(s.size, e);
596
+ g(o, Math.min(y[0], b[0], x[0], S[0]), Math.min(y[1], b[1], x[1], S[1]), Math.max(y[0], b[0], x[0], S[0]), Math.max(y[1], b[1], x[1], S[1]), C / 2) && (_++, r({
597
+ datum: e,
598
+ points: v,
599
+ strokeWidth: C
600
+ }));
601
+ }
602
+ return _;
603
+ }
604
+ //#endregion
605
+ //#region ../core/src/rendering/immediate/marks/point.js
606
+ function Ce(e) {
607
+ return { inwardStroke: B(e, e.properties.inwardStroke) };
608
+ }
609
+ function we(e, t, n, r) {
610
+ let { coords: i, data: a, visibleBounds: o, anchorCullBounds: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
611
+ if (c === l) return 0;
612
+ let d = P(i, u, "x", a[c]), f = P(i, u, "y", a[c]), p = [0, 0], m = [0, 0], _ = e.getSemanticThreshold(), v = {
613
+ datum: {},
614
+ shape: "circle",
615
+ x: 0,
616
+ y: 0,
617
+ geometryRadius: 0,
618
+ boundsRadius: 0,
619
+ angle: 0,
620
+ strokeWidth: 0,
621
+ lineShape: !1
622
+ }, y = 0;
623
+ for (let e = c; e < l; e++) {
624
+ let n = a[e];
625
+ if (I(u.semanticScore, n) < _) continue;
626
+ d(n, p), f(n, m);
627
+ let i = p[0] + I(u.dx, n), c = m[0] - I(u.dy, n);
628
+ if (h(s, i, c)) continue;
629
+ let l = Math.sqrt(I(u.size, n)) / 2;
630
+ if (t.inwardStroke && l <= 0) continue;
631
+ let b = z(u.shape, n), x = I(u.strokeWidth, n), S = b == "x" || b == "+", C = t.inwardStroke && !S ? Math.min(x, l) : x, w = t.inwardStroke && !S ? l - C / 2 : l, T = t.inwardStroke ? 0 : x / 2, E = l * Math.SQRT2 + T;
632
+ g(o, i - E, c - E, i + E, c + E) && (y++, v.datum = n, v.shape = b, v.x = i, v.y = c, v.geometryRadius = w, v.boundsRadius = E, v.angle = I(u.angle, n), v.strokeWidth = C, v.lineShape = S, r(v));
633
+ }
634
+ return y;
635
+ }
636
+ //#endregion
637
+ //#region ../core/src/rendering/immediate/geometry/pointPath.js
638
+ function Te(e, t, n, r, i) {
639
+ let a = r * .4, o = r * .15, s = Math.sqrt(3) * r / 2;
640
+ switch (e) {
641
+ case "diamond": return i.moveTo(t, n - r), i.lineTo(t + r, n), i.lineTo(t, n + r), i.lineTo(t - r, n), i.closePath(), !0;
642
+ case "cross": return i.moveTo(t - a, n - r), i.lineTo(t + a, n - r), i.lineTo(t + a, n - a), i.lineTo(t + r, n - a), i.lineTo(t + r, n + a), i.lineTo(t + a, n + a), i.lineTo(t + a, n + r), i.lineTo(t - a, n + r), i.lineTo(t - a, n + a), i.lineTo(t - r, n + a), i.lineTo(t - r, n - a), i.lineTo(t - a, n - a), i.closePath(), !0;
643
+ case "triangle-up": return i.moveTo(t, n - s), i.lineTo(t + r, n + s), i.lineTo(t - r, n + s), i.closePath(), !0;
644
+ case "triangle-right": return i.moveTo(t + s, n), i.lineTo(t - s, n + r), i.lineTo(t - s, n - r), i.closePath(), !0;
645
+ case "triangle-down": return i.moveTo(t, n + s), i.lineTo(t - r, n - s), i.lineTo(t + r, n - s), i.closePath(), !0;
646
+ case "triangle-left": return i.moveTo(t - s, n), i.lineTo(t + s, n - r), i.lineTo(t + s, n + r), i.closePath(), !0;
647
+ case "tick-up": return Q(i, t - o, n - r, t + o, n), !0;
648
+ case "tick-right": return Q(i, t, n - o, t + r, n + o), !0;
649
+ case "tick-down": return Q(i, t - o, n, t + o, n + r), !0;
650
+ case "tick-left": return Q(i, t - r, n - o, t, n + o), !0;
651
+ case "+": return i.moveTo(t - r, n), i.lineTo(t + r, n), i.moveTo(t, n - r), i.lineTo(t, n + r), !0;
652
+ case "x": return i.moveTo(t - r, n - r), i.lineTo(t + r, n + r), i.moveTo(t + r, n - r), i.lineTo(t - r, n + r), !0;
653
+ default: return !1;
654
+ }
655
+ }
656
+ function Q(e, t, n, r, i) {
657
+ e.moveTo(t, n), e.lineTo(r, n), e.lineTo(r, i), e.lineTo(t, i), e.closePath();
658
+ }
659
+ //#endregion
660
+ //#region ../core/src/rendering/immediate/marks/rect.js
661
+ var Ee = .1;
662
+ function De(e) {
663
+ let t = e.properties, n = B(e, t.cornerRadius), r = {
664
+ topLeft: B(e, t.cornerRadiusTopLeft ?? n),
665
+ topRight: B(e, t.cornerRadiusTopRight ?? n),
666
+ bottomRight: B(e, t.cornerRadiusBottomRight ?? n),
667
+ bottomLeft: B(e, t.cornerRadiusBottomLeft ?? n)
668
+ }, i = {
669
+ blur: B(e, t.shadowBlur ?? 0),
670
+ color: B(e, t.shadowColor ?? "black"),
671
+ offsetX: B(e, t.shadowOffsetX ?? 0),
672
+ offsetY: B(e, t.shadowOffsetY ?? 0),
673
+ opacity: B(e, t.shadowOpacity ?? 0)
674
+ }, a = B(e, t.hatch ?? "none"), o = !je(r);
675
+ return {
676
+ cornerRadii: r,
677
+ minWidth: B(e, t.minWidth),
678
+ minHeight: B(e, t.minHeight),
679
+ minOpacity: B(e, t.minOpacity),
680
+ shadow: i,
681
+ hatch: a,
682
+ hasCornerRadii: o,
683
+ canPadSeams: a == "none" && i.opacity == 0 && !o
684
+ };
685
+ }
686
+ function Oe(e, t, n, r) {
687
+ let { coords: i, data: a, visibleBounds: o, viewOpacity: s } = n, c = n.start ?? 0, l = n.end ?? a.length, u = e.encoders;
688
+ if (c === l) return 0;
689
+ let d = u.strokeWidth.constant, f = u.fillOpacity.constant, p = d ? I(u.strokeWidth, a[c]) : 0, m = f ? I(u.fillOpacity, a[c]) : 0, h = u.fill.constant, _ = h ? V(u.fill(a[c])) : "none", v = t.shadow.opacity > 0 ? t.shadow.blur + Math.max(Math.abs(t.shadow.offsetX), Math.abs(t.shadow.offsetY)) : 0, y = P(i, u, "x", a[c]), b = P(i, u, "y", a[c]), x = [0, 0], S = [0, 0], C = {
690
+ datum: {},
691
+ x: 0,
692
+ y: 0,
693
+ width: 0,
694
+ height: 0,
695
+ radii: {
696
+ topLeft: 0,
697
+ topRight: 0,
698
+ bottomRight: 0,
699
+ bottomLeft: 0
700
+ },
701
+ opacityFactor: 1,
702
+ strokeWidth: 0,
703
+ fill: "none",
704
+ fillOpacity: 0
705
+ }, w = 0;
706
+ for (let e = c; e < l; e++) {
707
+ let n = a[e];
708
+ y(n, x), b(n, S);
709
+ let i = Math.min(x[0], x[1]), c = Math.min(S[0], S[1]), l = Math.abs(x[1] - x[0]), T = Math.abs(S[1] - S[0]), E = ke(l, t.minWidth), D = ke(T, t.minHeight), O = Math.max(t.minOpacity, E * D);
710
+ l < t.minWidth && (i -= (t.minWidth - l) / 2, l = t.minWidth), T < t.minHeight && (c -= (t.minHeight - T) / 2, T = t.minHeight);
711
+ let k = d ? p : I(u.strokeWidth, n), A = h ? _ : V(u.fill(n)), j = (f ? m : I(u.fillOpacity, n)) * s, M = k == 0 && j == 1 && O == 1 && t.canPadSeams && A != "none" ? Ee : 0;
712
+ M && (i -= M, c -= M, l += M * 2, T += M * 2), g(o, i, c, i + l, c + T, k / 2 + v) && (w++, C.datum = n, C.x = i, C.y = c, C.width = l, C.height = T, C.opacityFactor = O, C.strokeWidth = k, C.fill = A, C.fillOpacity = j, t.hasCornerRadii && Ae(t.cornerRadii, l, T, C.radii), r(C));
713
+ }
714
+ return w;
715
+ }
716
+ function ke(e, t) {
717
+ return t > 0 && e < t ? e / t : 1;
718
+ }
719
+ function Ae(e, t, n, r) {
720
+ let i = Math.min(t, n) / 2;
721
+ r.topLeft = Math.max(0, Math.min(e.topLeft, i)), r.topRight = Math.max(0, Math.min(e.topRight, i)), r.bottomRight = Math.max(0, Math.min(e.bottomRight, i)), r.bottomLeft = Math.max(0, Math.min(e.bottomLeft, i));
722
+ }
723
+ function je(e) {
724
+ return e.topLeft == 0 && e.topRight == 0 && e.bottomRight == 0 && e.bottomLeft == 0;
725
+ }
726
+ //#endregion
727
+ //#region ../core/src/rendering/immediate/marks/rule.js
728
+ function Me(e) {
729
+ return { minLength: B(e, e.properties.minLength) };
730
+ }
731
+ function Ne(e, t, n, r) {
732
+ let { coords: i, data: a, visibleBounds: o } = n, s = e.encoders;
733
+ if (a.length == 0) return 0;
734
+ let c = P(i, s, "x", a[0]), l = P(i, s, "y", a[0]), u = [0, 0], d = [0, 0], f = {
735
+ datum: {},
736
+ x1: 0,
737
+ y1: 0,
738
+ x2: 0,
739
+ y2: 0,
740
+ strokeWidth: 0
741
+ }, p = 0;
742
+ for (let e of a) {
743
+ c(e, u), l(e, d);
744
+ let [n, i] = u, [a, m] = d, h = i - n, _ = m - a, v = Math.hypot(h, _);
745
+ if (v > 0 && v < t.minLength) {
746
+ let e = (t.minLength - v) / 2, r = h / v, o = _ / v;
747
+ n -= r * e, a -= o * e, i += r * e, m += o * e;
748
+ }
749
+ let y = I(s.size, e);
750
+ g(o, n, a, i, m, y / 2) && (p++, f.datum = e, f.x1 = n, f.y1 = a, f.x2 = i, f.y2 = m, f.strokeWidth = y, r(f));
751
+ }
752
+ return p;
753
+ }
754
+ //#endregion
755
+ //#region ../core/src/rendering/immediate/marks/text.js
756
+ function Pe(e) {
757
+ let t = e.properties;
758
+ return {
759
+ align: B(e, t.align),
760
+ baseline: B(e, t.baseline),
761
+ logoLetters: B(e, t.logoLetters),
762
+ paddingX: B(e, t.paddingX),
763
+ paddingY: B(e, t.paddingY),
764
+ flushX: B(e, t.flushX),
765
+ flushY: B(e, t.flushY),
766
+ squeeze: B(e, t.squeeze),
767
+ dx: B(e, t.dx),
768
+ dy: B(e, t.dy)
769
+ };
770
+ }
771
+ function Fe(e, n, a, o) {
772
+ let { coords: s, data: c, visibleBounds: l, anchorCullBounds: u } = a, { align: d, baseline: f } = n, p = e.encoders;
773
+ if (c.length == 0) return 0;
774
+ let m = p.size.constant ? I(p.size, c[0]) : 0, g = p.angle.constant ? I(p.angle, c[0]) : 0, _ = P(s, p, "x", c[0]), v = P(s, p, "y", c[0]), y = e.encoding.text, b = "format" in y ? t(y.format) : (e) => e, x = [0, 0], S = [0, 0], C = {
775
+ width: 0,
776
+ height: 0
777
+ }, w = {
778
+ x: 0,
779
+ y: 0
780
+ }, T = {
781
+ position: 0,
782
+ scale: 0
783
+ }, E = {
784
+ scaleX: 0,
785
+ scaleY: 0,
786
+ originX: 0,
787
+ originY: 0
788
+ }, D = Array(8).fill(0), O = {
789
+ datum: {},
790
+ text: "",
791
+ x: 0,
792
+ y: 0,
793
+ size: 0,
794
+ width: 0,
795
+ angle: 0,
796
+ dx: n.dx,
797
+ dy: n.dy,
798
+ fadeOpacity: 1,
799
+ scale: 1,
800
+ logoTransform: void 0,
801
+ multiCharacterLogo: !1,
802
+ boundsQuad: D
803
+ }, k = !!p.x2, A = !!p.y2, j = 0;
804
+ for (let e of c) {
805
+ let t = b(p.text(e)), c = i(t) ? t : t === null ? "" : "" + t;
806
+ if (!c) continue;
807
+ _(e, x), v(e, S);
808
+ let [y, M] = x, [N, P] = S, F = p.size.constant ? m : I(p.size, e), L = p.angle.constant ? g : I(p.angle, e);
809
+ if (n.logoLetters) {
810
+ let t = F, r = F;
811
+ if (k && (t = M - y, y = (y + M) / 2), A && (r = N - P, N = (N + P) / 2), Ie(D, y, N, Math.abs(t), Math.abs(r), "center", "middle", L, n.dx, n.dy), !t || !r || h(u, y, N) || !Le(l, D)) continue;
812
+ let i = a.measureLogoInkBounds(c);
813
+ if (!i) continue;
814
+ j++, O.datum = e, O.text = c, O.x = y, O.y = N, O.size = 100, O.width = i.xMax - i.xMin, O.angle = L, O.fadeOpacity = 1, O.scale = 1, E.scaleX = t / O.width, E.scaleY = r / (i.yMax - i.yMin), E.originX = (i.xMin + i.xMax) / 2, E.originY = (i.yMin + i.yMax) / 2, O.logoTransform = E, O.multiCharacterLogo = c.length > 1, o(O);
815
+ continue;
816
+ }
817
+ let R = a.fontMeasurement.measureWidth(c, F);
818
+ Re(R, F, L, C), k || A ? Be(d, f, L, w) : (w.x = Ve[d], w.y = He[f]);
819
+ let z = 1;
820
+ if (k && (ze(Math.min(y, M), Math.max(y, M), C.width, n.paddingX, w.x, n.flushX, s.x, s.x2, T), y = T.position, z *= T.scale), A && (ze(Math.min(N, P), Math.max(N, P), C.height * z, n.paddingY, w.y, n.flushY, s.y, s.y2, T), N = T.position, z *= T.scale), h(u, y, N)) continue;
821
+ let B = 1;
822
+ if (z < 1) {
823
+ if (!n.squeeze || z < 3 / F) continue;
824
+ B = r(3 / F, 6 / F, z);
825
+ }
826
+ let V = F * z, H = R * z;
827
+ Ie(D, y, N, H, V, d, f, L, n.dx, n.dy), Le(l, D) && (j++, O.datum = e, O.text = c, O.x = y, O.y = N, O.size = F, O.width = H, O.angle = L, O.fadeOpacity = B, O.scale = z, O.logoTransform = void 0, O.multiCharacterLogo = !1, o(O));
828
+ }
829
+ return j;
830
+ }
831
+ function Ie(e, t, n, r, i, a, o, s, c, l) {
832
+ let u = t + c - (Ve[a] + 1) / 2 * r, d = n + l - (He[o] + 1) / 2 * i, f = u + r, p = d + i, m = s * Math.PI / 180, h = Math.sin(m), g = Math.cos(m);
833
+ return $(e, 0, t, n, u, d, h, g), $(e, 2, t, n, f, d, h, g), $(e, 4, t, n, f, p, h, g), $(e, 6, t, n, u, p, h, g), e;
834
+ }
835
+ function Le(e, t) {
836
+ return g(e, Math.min(t[0], t[2], t[4], t[6]), Math.min(t[1], t[3], t[5], t[7]), Math.max(t[0], t[2], t[4], t[6]), Math.max(t[1], t[3], t[5], t[7]), 1);
837
+ }
838
+ function $(e, t, n, r, i, a, o, s) {
839
+ e[t] = n + (i - n) * s - (a - r) * o, e[t + 1] = r + (i - n) * o + (a - r) * s;
840
+ }
841
+ function Re(e, t, n, r) {
842
+ let i = n * Math.PI / 180, a = Math.abs(Math.sin(i)), o = Math.abs(Math.cos(i));
843
+ r.width = e * o + t * a, r.height = e * a + t * o;
844
+ }
845
+ function ze(e, t, n, r, i, a, o, s, c) {
846
+ let l = t - e, u = n + 2 * r;
847
+ if (e > s || t < o) {
848
+ c.position = 0, c.scale = 0;
849
+ return;
850
+ }
851
+ let d = Math.max(0, l - u), f;
852
+ if (i == 0) {
853
+ let n = e + t;
854
+ if (a) {
855
+ let e = Math.max(0, 2 * o + u - n);
856
+ n += Math.min(e, d);
857
+ let t = Math.max(0, u + n - 2 * s);
858
+ n -= Math.min(t, d);
859
+ }
860
+ f = n / 2;
861
+ } else if (i < 0) {
862
+ let t = e;
863
+ a && (t += Math.min(Math.max(0, o - t), d)), f = t + r;
864
+ } else {
865
+ let e = t;
866
+ a && (e -= Math.min(Math.max(0, e - s), d)), f = e - r;
867
+ }
868
+ c.position = f, c.scale = Math.max(0, Math.min(1, (l - r) / u));
869
+ }
870
+ function Be(e, t, n, r) {
871
+ let i = Ve[e], a = -He[t], o = ((n + 45) % 360 + 360) % 360, s, c;
872
+ o < 90 ? (s = i, c = a) : o < 180 ? (s = a, c = -i) : o < 270 ? (s = -i, c = a) : (s = -a, c = i), r.x = s, r.y = -c;
873
+ }
874
+ var Ve = {
875
+ left: -1,
876
+ center: 0,
877
+ right: 1
878
+ }, He = {
879
+ top: -1,
880
+ middle: 0,
881
+ bottom: 1,
882
+ alphabetic: 1,
883
+ baseline: 1
884
+ }, Ue = [
885
+ "Lato",
886
+ "Avenir Next",
887
+ "Avenir",
888
+ "Segoe UI",
889
+ "Ubuntu",
890
+ "Noto Sans",
891
+ "Helvetica Neue",
892
+ "Helvetica",
893
+ "Arial",
894
+ "sans-serif"
895
+ ], We = /* @__PURE__ */ new Set([
896
+ "serif",
897
+ "sans-serif",
898
+ "monospace",
899
+ "cursive",
900
+ "fantasy",
901
+ "system-ui",
902
+ "ui-serif",
903
+ "ui-sans-serif",
904
+ "ui-monospace",
905
+ "ui-rounded",
906
+ "emoji",
907
+ "math",
908
+ "fangsong"
909
+ ]), Ge = {
910
+ thin: 100,
911
+ light: 300,
912
+ regular: 400,
913
+ normal: 400,
914
+ medium: 500,
915
+ bold: 700,
916
+ black: 900
917
+ };
918
+ function Ke(e) {
919
+ let t = e ?? "Lato";
920
+ return [t, ...Ue.filter((e) => e.toLowerCase() != t.toLowerCase())].map(Xe).join(", ");
921
+ }
922
+ function qe(e) {
923
+ if (typeof e == "number") return e;
924
+ let t = Ge[e];
925
+ if (t === void 0) throw Error("Unknown font weight: " + e);
926
+ return t;
927
+ }
928
+ function Je(e) {
929
+ return {
930
+ style: e.fontStyle ?? "normal",
931
+ weight: qe(e.fontWeight ?? "normal"),
932
+ family: Ke(e.font)
933
+ };
934
+ }
935
+ function Ye(e, t) {
936
+ switch (e) {
937
+ case "top": return .79 * t;
938
+ case "middle": return .35 * t;
939
+ case "bottom": return -.21 * t;
940
+ case "alphabetic":
941
+ case "baseline": return 0;
942
+ default: throw Error(`Unknown text baseline: ${e}`);
943
+ }
944
+ }
945
+ function Xe(e) {
946
+ let t = e.toLowerCase();
947
+ return We.has(t) ? t : `'${e.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
948
+ }
949
+ //#endregion
950
+ //#region ../core/src/rendering/nativeTextMetrics.js
951
+ var Ze = "Mg", Qe = 100, $e = class {
952
+ #e;
953
+ #t;
954
+ #n = new e([], JSON.stringify);
955
+ #r = [];
956
+ #i;
957
+ constructor(e, t) {
958
+ this.#e = e, this.#t = t, e.fontKerning = "normal", e.direction = "ltr", e.textAlign = "left", e.textBaseline = "alphabetic";
959
+ }
960
+ requestFont(e) {
961
+ let t = Je(e), n = this.#n.get(t);
962
+ if (!n) {
963
+ n = new et((e, n) => this.#a(t, e, n)), this.#n.set(t, n);
964
+ let e = this.#t?.load(rt(t, 16));
965
+ e && this.#r.push(e.then(() => n.invalidateCache()));
966
+ }
967
+ return n;
968
+ }
969
+ async waitUntilReady() {
970
+ await Promise.all(this.#r);
971
+ }
972
+ #a(e, t, n) {
973
+ let r = rt(e, n);
974
+ return r != this.#i && (this.#e.font = r, this.#i = r), this.#e.measureText(t);
975
+ }
976
+ }, et = class {
977
+ #e;
978
+ #t = NaN;
979
+ #n = /* @__PURE__ */ new Float64Array(128);
980
+ #r = NaN;
981
+ #i = Array(128);
982
+ constructor(e) {
983
+ this.#e = e, this.#n.fill(NaN);
984
+ }
985
+ measureWidth(e, t) {
986
+ this.#a(t);
987
+ let n = e.length == 1 ? e.charCodeAt(0) : 128;
988
+ if (n < 128) {
989
+ let r = this.#n[n];
990
+ if (!Number.isNaN(r)) return r;
991
+ let i = this.#e(e, t).width;
992
+ return this.#n[n] = i, i;
993
+ }
994
+ return this.#e(e, t).width;
995
+ }
996
+ getHeight(e) {
997
+ if (this.#a(e), Number.isNaN(this.#r)) {
998
+ let t = this.#e(Ze, e);
999
+ this.#r = t.actualBoundingBoxAscent + t.actualBoundingBoxDescent;
1000
+ }
1001
+ return this.#r;
1002
+ }
1003
+ measureInkBounds(e) {
1004
+ let t = e.length == 1 ? e.charCodeAt(0) : 128;
1005
+ if (t < 128 && this.#i[t] !== void 0) return this.#i[t];
1006
+ let n = tt(this.#e(e, Qe));
1007
+ return t < 128 && (this.#i[t] = n), n;
1008
+ }
1009
+ invalidateCache() {
1010
+ this.#t = NaN, this.#n.fill(NaN), this.#r = NaN, this.#i.fill(void 0);
1011
+ }
1012
+ #a(e) {
1013
+ e != this.#t && (this.#t = e, this.#n.fill(NaN), this.#r = NaN);
1014
+ }
1015
+ };
1016
+ function tt(e) {
1017
+ let t = {
1018
+ xMin: -e.actualBoundingBoxLeft,
1019
+ xMax: e.actualBoundingBoxRight,
1020
+ yMin: -e.actualBoundingBoxAscent,
1021
+ yMax: e.actualBoundingBoxDescent
1022
+ };
1023
+ return t.xMax > t.xMin && t.yMax > t.yMin ? t : null;
1024
+ }
1025
+ function nt(e, t) {
1026
+ let n = e.requestFont(t);
1027
+ return n instanceof et ? (e) => n.measureInkBounds(e) : (e) => {
1028
+ let t = n.measureWidth(e, Qe), r = n.getHeight(Qe);
1029
+ return t > 0 && r > 0 ? {
1030
+ xMin: 0,
1031
+ xMax: t,
1032
+ yMin: -r,
1033
+ yMax: 0
1034
+ } : null;
1035
+ };
1036
+ }
1037
+ function rt(e, t) {
1038
+ return `${e.style} ${e.weight} ${t}px ${e.family}`;
1039
+ }
1040
+ function it(e) {
1041
+ let t = e.createElement("canvas").getContext("2d");
1042
+ if (!t) throw Error("Canvas2D text measurement is unavailable.");
1043
+ return new $e(t, e.fonts);
1044
+ }
1045
+ async function at(e, t) {
1046
+ t.visit((t) => {
1047
+ let n = t.mark;
1048
+ n?.getType() == "text" && e.requestFont(n.properties);
1049
+ }), await e.waitUntilReady();
1050
+ }
1051
+ //#endregion
1052
+ //#region ../core/src/rendering/immediate/order.js
1053
+ function ot(e, t, n, r, i) {
1054
+ let a = [], o = [];
1055
+ for (let i = t; i < n; i++) {
1056
+ let t = e[i];
1057
+ (r(t) ? a : o).push(t);
1058
+ }
1059
+ return i.map((e) => e === "matching" ? a : o);
1060
+ }
1061
+ //#endregion
1062
+ export { V as A, W as C, M as D, I as E, c as F, u as I, f as M, m as N, N as O, g as P, H as S, U as T, xe as _, Ke as a, de as b, Pe as c, Ne as d, De as f, we as g, Ce as h, nt as i, p as j, B as k, Fe as l, Te as m, it as n, Ye as o, Oe as p, at as r, qe as s, ot as t, Me as u, Se as v, ee as w, fe as x, pe as y };