@arenarium/maps 1.0.187 → 1.0.189

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.
@@ -1,454 +0,0 @@
1
- var q = Object.defineProperty;
2
- var K = (a, g, m) => g in a ? q(a, g, { enumerable: !0, configurable: !0, writable: !0, value: m }) : a[g] = m;
3
- var A = (a, g, m) => K(a, typeof g != "symbol" ? g + "" : g, m);
4
- var Z;
5
- ((a) => {
6
- function g(m, d, h) {
7
- const b = m / 2, p = d / 2, c = Math.sqrt(b * b + p * p), u = Math.atan(p / b) * (180 / Math.PI), l = h * (Math.PI / 180);
8
- return h < 180 ? h < 90 ? h < u ? {
9
- offsetX: 0,
10
- offsetY: c * Math.sin(l) - p
11
- } : {
12
- offsetX: c * Math.cos(l) - b,
13
- offsetY: 0
14
- } : h < 180 - u ? {
15
- offsetX: c * Math.cos(l) - b,
16
- offsetY: 0
17
- } : {
18
- offsetX: -m,
19
- offsetY: c * Math.sin(l) - p
20
- } : h < 270 ? h < 180 + u ? {
21
- offsetX: -m,
22
- offsetY: c * Math.sin(l) - p
23
- } : {
24
- offsetX: c * Math.cos(l) - b,
25
- offsetY: -d
26
- } : h < 360 - u ? {
27
- offsetX: c * Math.cos(l) - b,
28
- offsetY: -d
29
- } : {
30
- offsetX: 0,
31
- offsetY: c * Math.sin(l) - p
32
- };
33
- }
34
- a.getOffsets = g;
35
- })(Z || (Z = {}));
36
- var k;
37
- ((a) => {
38
- function g(c, u, l) {
39
- return {
40
- x: d(u) * l,
41
- y: h(c) * l
42
- };
43
- }
44
- a.project = g;
45
- function m(c, u, l) {
46
- return {
47
- lat: p(u / l),
48
- lng: b(c / l)
49
- };
50
- }
51
- a.unproject = m;
52
- function d(c) {
53
- return (180 + c) / 360;
54
- }
55
- function h(c) {
56
- return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + c * Math.PI / 360))) / 360;
57
- }
58
- function b(c) {
59
- return c * 360 - 180;
60
- }
61
- function p(c) {
62
- return 360 / Math.PI * Math.atan(Math.exp((180 - c * 360) * Math.PI / 180)) - 90;
63
- }
64
- })(k || (k = {}));
65
- var P;
66
- ((a) => {
67
- a.COUNT = 12, a.DEFAULT = 270, a.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
68
- })(P || (P = {}));
69
- var j;
70
- ((a) => {
71
- let g;
72
- ((p) => {
73
- p.RADIANS = P.DEGREES.map((l) => l * Math.PI / 180), p.RADIANS_COS = p.RADIANS.map((l) => Math.cos(l)), p.RADIANS_SIN = p.RADIANS.map((l) => Math.sin(l));
74
- function c(l, D) {
75
- const I = Math.abs(D / l);
76
- return I < 1 ? I < 0.26795 ? 0 : 1 : I < 3.73205 ? 2 : 3;
77
- }
78
- function u(l, D) {
79
- const I = c(l, D);
80
- return l > 0 ? D > 0 ? (12 - I) % 12 : 0 + I : D > 0 ? 6 + I : 6 - I;
81
- }
82
- p.getAngleIndex = u;
83
- })(g = a.Angle || (a.Angle = {}));
84
- class m {
85
- constructor(c, u, l, D) {
86
- /** The center of the particle. */
87
- A(this, "center");
88
- /** The width of the rectangle of possible positions of the particle. */
89
- A(this, "width");
90
- /** The width of the rectangle of possible positions of the particle. */
91
- A(this, "height");
92
- /** The index of the particle position in the points array. */
93
- A(this, "index");
94
- this.center = c, this.width = u, this.height = l, this.index = D;
95
- }
96
- }
97
- a.Particle = m;
98
- function d(p) {
99
- let c = !0;
100
- for (let u = 0; u < p.length; u++) {
101
- const { particle: l, influences: D } = p[u], I = l.index, M = l.center, N = l.width, v = l.height, i = b(I, -1), t = b(I, 1), n = M.x + N * g.RADIANS_COS[i], o = M.y + v * g.RADIANS_SIN[i], e = M.x + N * g.RADIANS_COS[I], s = M.y + v * g.RADIANS_SIN[I], r = M.x + N * g.RADIANS_COS[t], f = M.y + v * g.RADIANS_SIN[t];
102
- let x = 0, S = 0, O = 0;
103
- for (let R = 0; R < D.length; R++) {
104
- const w = D[R], T = w.index, C = w.center, H = w.width, L = w.height, X = C.x + H * g.RADIANS_COS[T], Y = C.y + L * g.RADIANS_SIN[T], B = n - X, F = o - Y;
105
- x += 1 / (B * B + F * F);
106
- const G = e - X, W = s - Y;
107
- S += 1 / (G * G + W * W);
108
- const _ = r - X, U = f - Y;
109
- O += 1 / (_ * _ + U * U);
110
- }
111
- let z = 0;
112
- x < S && x < O && (z = -1), O < S && O < x && (z = 1), z != 0 && (l.index = b(I, z), c = !1);
113
- }
114
- return c;
115
- }
116
- a.updatePointIndexes = d;
117
- function h(p) {
118
- for (let c = 0; c < p.length; c++) {
119
- const { particle: u, influences: l } = p[c], D = u.center;
120
- let I = 0, M = 0;
121
- for (let N = 0; N < l.length; N++) {
122
- const i = l[N].center, t = D.x - i.x, n = D.y - i.y;
123
- if (t == 0 && n == 0) continue;
124
- const o = Math.sqrt(t * t + n * n), e = 1 / (o * o);
125
- I += e * t / o, M += -(e * n) / o;
126
- }
127
- u.index = g.getAngleIndex(I, M);
128
- }
129
- }
130
- a.initializePointIndexes = h;
131
- function b(p, c) {
132
- return c == 0 ? p : ((p + c) % P.COUNT + P.COUNT) % P.COUNT;
133
- }
134
- })(j || (j = {}));
135
- var E;
136
- ((a) => {
137
- function g(d, h) {
138
- return !(d.x - d.left > h.x + h.right || d.x + d.right < h.x - h.left || d.y - d.top > h.y + h.bottom || d.y + d.bottom < h.y - h.top);
139
- }
140
- a.areOverlaping = g;
141
- function m(d, h) {
142
- let b = Math.abs(d.x - h.x), c = (d.x < h.x ? d.right + h.left : d.left + h.right) / b, u = Math.abs(d.y - h.y), D = (d.y < h.y ? d.bottom + h.top : d.top + h.bottom) / u, I = Math.min(c, D);
143
- return Math.log2(I);
144
- }
145
- a.getZoomWhenTouching = m;
146
- })(E || (E = {}));
147
- var y;
148
- ((a) => {
149
- class g {
150
- constructor() {
151
- A(this, "zoomAfterExpanded");
152
- A(this, "zoomAfterAngleIndexes");
153
- this.zoomAfterExpanded = NaN, this.zoomAfterAngleIndexes = [];
154
- }
155
- }
156
- a.Tooltip = g;
157
- class m {
158
- constructor(t, n, o) {
159
- // PROPERTIES
160
- /** The index of the node in the nodes array. */
161
- A(this, "index");
162
- /** The id of the tooltip that this node represents. */
163
- A(this, "id");
164
- /** The rank of the tooltip node. */
165
- A(this, "rank");
166
- /** The x coordinate of the tooltip node. */
167
- A(this, "x");
168
- /** The y coordinate of the tooltip node. */
169
- A(this, "y");
170
- /** The width of the tooltip node. */
171
- A(this, "width");
172
- /** The height of the tooltip node. */
173
- A(this, "height");
174
- // STATE
175
- /** State of the tooltip expanded or not. */
176
- A(this, "expanded");
177
- /** The angle of the tooltip node. */
178
- A(this, "angle");
179
- /** The bounds of the tooltip node. */
180
- A(this, "bounds");
181
- /** The neighbours of the tooltip node. */
182
- A(this, "neighbours");
183
- // SIMULATION
184
- /** A node has a particle whose position is used to calculate the angle */
185
- A(this, "particle");
186
- /** The particles that influence the node particle. */
187
- A(this, "influences");
188
- const e = k.project(n.lat, n.lng, t.mapSize), s = n.width + 2 * n.margin, r = n.height + 2 * n.margin;
189
- this.index = o, this.id = n.id, this.rank = n.rank, this.x = e.x, this.y = e.y, this.width = s, this.height = r, this.expanded = !0, this.angle = P.DEFAULT, this.bounds = this.getBounds(1), this.neighbours = new Array(), this.particle = new j.Particle(
190
- { x: e.x, y: e.y },
191
- this.getParticleWidth(1),
192
- this.getParticleHeight(1),
193
- P.DEGREES.indexOf(P.DEFAULT)
194
- ), this.influences = [];
195
- }
196
- getBounds(t) {
197
- let { offsetX: n, offsetY: o } = Z.getOffsets(this.width, this.height, this.angle), e = -n, s = this.width - e, r = -o, f = this.height - r;
198
- return {
199
- x: this.x,
200
- y: this.y,
201
- left: e / t,
202
- right: s / t,
203
- top: r / t,
204
- bottom: f / t
205
- };
206
- }
207
- getParticleWidth(t) {
208
- return this.width / 2 / t;
209
- }
210
- getParticleHeight(t) {
211
- return this.height / 2 / t;
212
- }
213
- updateBounds(t) {
214
- this.bounds = this.getBounds(t);
215
- }
216
- updateParticle(t) {
217
- this.particle.width = this.getParticleWidth(t), this.particle.height = this.getParticleHeight(t);
218
- }
219
- }
220
- a.Node = m;
221
- class d {
222
- constructor(t) {
223
- A(this, "min");
224
- A(this, "max");
225
- A(this, "scale");
226
- A(this, "step");
227
- this.min = t.zoomMin, this.max = t.zoomMax, this.scale = t.zoomScale, this.step = 1 / this.scale;
228
- }
229
- addSteps(t, n) {
230
- return Math.round((t + n * this.step) * this.scale) / this.scale;
231
- }
232
- getIndex(t) {
233
- if (!(t < this.min))
234
- return Math.min(Math.ceil(t * this.scale), this.max * this.scale);
235
- }
236
- getMax(t) {
237
- let n = this.min;
238
- for (let o = 0; o < t.length; o++) {
239
- const s = t[o].keys();
240
- for (const r of s) {
241
- const f = Number(r) / this.scale;
242
- f > n && (n = f);
243
- }
244
- }
245
- return n;
246
- }
247
- }
248
- a.Zoom = d;
249
- function h(i, t) {
250
- let n = new Array(t.length);
251
- for (let o = 0; o < t.length; o++)
252
- n[o] = new m(i, t[o], o);
253
- return n;
254
- }
255
- a.createNodes = h;
256
- function b(i, t) {
257
- const n = new Array();
258
- for (let e = 0; e < t.length; e++)
259
- n[e] = new Array();
260
- const o = new Array(t.length);
261
- for (let e = 0; e < t.length; e++) {
262
- const s = t[e];
263
- o[e] = {
264
- x: s.x,
265
- y: s.y,
266
- left: s.width,
267
- right: s.width,
268
- top: s.height,
269
- bottom: s.height
270
- };
271
- }
272
- for (let e = 0; e < t.length; e++) {
273
- const s = t[e], r = o[e], f = n[e];
274
- for (let x = e + 1; x < t.length; x++) {
275
- const S = t[x], O = o[x], z = n[x], R = E.getZoomWhenTouching(r, O), w = i.getIndex(R);
276
- if (w == null) continue;
277
- const T = f[w], C = z[w];
278
- T ? T.push(S) : f[w] = [S], C ? C.push(s) : z[w] = [s];
279
- }
280
- }
281
- return n;
282
- }
283
- a.createNeighbourDeltas = b;
284
- function p(i) {
285
- const t = /* @__PURE__ */ new Set(), n = [];
286
- for (let o = 0; o < i.length; o++) {
287
- let e = i[o];
288
- if (e.expanded == !1 || e.neighbours.length == 0 || t.has(e)) continue;
289
- t.add(e);
290
- const s = [], r = [e];
291
- for (; r.length > 0; ) {
292
- const f = r.pop();
293
- s.push(f);
294
- for (const x of f.neighbours)
295
- t.has(x) || (t.add(x), r.push(x));
296
- }
297
- n.push(s);
298
- }
299
- return n;
300
- }
301
- a.getNeighbourGraphs = p;
302
- function c(i, t, n) {
303
- for (let o = 0; o < i.length; o++) {
304
- let e = i[o];
305
- if (e.expanded == !1) {
306
- e.neighbours.length = 0, e.influences.length = 0;
307
- continue;
308
- }
309
- const r = t[o][n];
310
- if (r != null)
311
- for (let f = 0; f < r.length; f++) {
312
- const x = r[f];
313
- x.expanded != !1 && (e.neighbours.push(x), e.influences.push(x.particle));
314
- }
315
- }
316
- }
317
- a.updateNeighbours = c;
318
- function u(i) {
319
- i.expanded = !1;
320
- const t = i.neighbours;
321
- for (let n = 0; n < t.length; n++) {
322
- const o = t[n], e = o.neighbours.indexOf(i);
323
- o.neighbours.splice(e, 1), o.influences.splice(e, 1);
324
- }
325
- }
326
- a.updateCollapsed = u;
327
- function l(i, t, n) {
328
- for (let o = 0; o < i.length; o++) {
329
- const e = i[o];
330
- if (e.expanded == !1) continue;
331
- const s = t.get(e.id);
332
- if (!s) throw new Error("Tooltip not found");
333
- s.zoomAfterExpanded = n;
334
- const r = P.DEGREES.indexOf(e.angle);
335
- s.zoomAfterAngleIndexes.length == 0 ? s.zoomAfterAngleIndexes.push([n, r]) : s.zoomAfterAngleIndexes[0][1] != r ? s.zoomAfterAngleIndexes.unshift([n, r]) : s.zoomAfterAngleIndexes[0][0] = n;
336
- }
337
- }
338
- a.updateTooltips = l;
339
- function D(i, t) {
340
- for (let n = 0; n < i.length; n++)
341
- i[n].updateBounds(t);
342
- }
343
- a.updateBounds = D;
344
- function I(i) {
345
- const t = /* @__PURE__ */ new Set();
346
- for (let n = 0; n < i.length; n++) {
347
- const o = i[n], e = o.bounds, s = i[n].neighbours;
348
- for (let r = 0; r < s.length; r++) {
349
- const f = s[r], x = f.bounds;
350
- E.areOverlaping(x, e) && (t.add(o), t.add(f));
351
- }
352
- }
353
- return t;
354
- }
355
- a.getOverlaps = I;
356
- function M(i, t) {
357
- let n = !1;
358
- for (let o = 0; o < t.length; o++) {
359
- const e = t[o], s = e.bounds, r = t[o].neighbours;
360
- for (let f = 0; f < r.length; f++) {
361
- const x = r[f], S = x.bounds;
362
- E.areOverlaping(S, s) && (i.has(e) || (i.add(e), n = !0), i.has(x) || (i.add(x), n = !0));
363
- }
364
- }
365
- return n;
366
- }
367
- a.updateOverlaps = M;
368
- function N(i) {
369
- let t, n = 0;
370
- for (let o = 0; o < i.length; o++) {
371
- const e = i[o], s = e.bounds, r = i[o].neighbours;
372
- let f = 0;
373
- for (let x = 0; x < r.length; x++) {
374
- const S = r[x], O = S.bounds;
375
- E.areOverlaping(O, s) && (f += 1 + (S.rank - e.rank));
376
- }
377
- f = f * r.length, f > n && (n = f, t = e);
378
- }
379
- return t;
380
- }
381
- a.getOverlapsWorstNode = N;
382
- function v(i) {
383
- for (let t = 0; t < i.length; t++) {
384
- const o = i[t].bounds;
385
- for (let e = t + 1; e < i.length; e++) {
386
- const r = i[e].bounds;
387
- if (E.areOverlaping(r, o))
388
- return !0;
389
- }
390
- }
391
- return !1;
392
- }
393
- a.areOverlaping = v, ((i) => {
394
- function t(e) {
395
- const s = e.map((r) => r.particle);
396
- j.initializePointIndexes(s.map((r) => ({ particle: r, influences: s })));
397
- for (let r = 0; r < e.length; r++) {
398
- const f = e[r];
399
- f.angle = P.DEGREES[f.particle.index];
400
- }
401
- }
402
- i.initializeAngles = t;
403
- function n(e) {
404
- const s = j.updatePointIndexes(e);
405
- for (let r = 0; r < e.length; r++) {
406
- const f = e[r];
407
- f.angle = P.DEGREES[f.particle.index];
408
- }
409
- return s;
410
- }
411
- i.updateAngles = n;
412
- function o(e, s) {
413
- for (let r = 0; r < e.length; r++)
414
- e[r].updateParticle(s);
415
- }
416
- i.updateParticles = o;
417
- })(a.Particles || (a.Particles = {}));
418
- })(y || (y = {}));
419
- function V(a, g) {
420
- const m = new y.Zoom(a);
421
- if (g.length == 0) return [];
422
- if (g.length == 1) return [[m.min, [[m.min, P.DEGREES.indexOf(P.DEFAULT)]]]];
423
- const d = new Map(g.map((u) => [u.id, new y.Tooltip()])), h = y.createNodes(a, g), b = y.createNeighbourDeltas(m, h), p = m.min, c = m.getMax(b);
424
- y.Particles.initializeAngles(h), y.updateTooltips(h, d, m.addSteps(m.max, 1));
425
- for (let u = c; u >= p; u = m.addSteps(u, -1)) {
426
- const l = Math.pow(2, u), D = Math.round(u * m.scale);
427
- y.updateNeighbours(h, b, D);
428
- const I = y.getNeighbourGraphs(h);
429
- for (const M of I) {
430
- y.updateBounds(M, l), y.Particles.updateParticles(M, l);
431
- const N = y.getOverlaps(M);
432
- for (; N.size > 1; ) {
433
- const v = Array.from(N);
434
- for (; ; ) {
435
- const n = y.Particles.updateAngles(v);
436
- if (y.updateBounds(v, l), n == !0 || y.areOverlaping(v) == !1) break;
437
- }
438
- if (y.updateOverlaps(N, v)) continue;
439
- const t = y.getOverlapsWorstNode(v);
440
- if (t == null) break;
441
- y.updateCollapsed(t), N.delete(t);
442
- }
443
- }
444
- y.updateTooltips(h, d, Number(u.toFixed(1)));
445
- }
446
- return Array.from(d.values()).map((u) => [u.zoomAfterExpanded, u.zoomAfterAngleIndexes]);
447
- }
448
- export {
449
- P as A,
450
- E as B,
451
- k as M,
452
- Z as R,
453
- V as g
454
- };
@@ -1 +0,0 @@
1
- "use strict";var _=Object.defineProperty;var U=(l,g,A)=>g in l?_(l,g,{enumerable:!0,configurable:!0,writable:!0,value:A}):l[g]=A;var m=(l,g,A)=>U(l,typeof g!="symbol"?g+"":g,A);exports.Rectangle=void 0;(l=>{function g(A,d,h){const b=A/2,p=d/2,c=Math.sqrt(b*b+p*p),u=Math.atan(p/b)*(180/Math.PI),a=h*(Math.PI/180);return h<180?h<90?h<u?{offsetX:0,offsetY:c*Math.sin(a)-p}:{offsetX:c*Math.cos(a)-b,offsetY:0}:h<180-u?{offsetX:c*Math.cos(a)-b,offsetY:0}:{offsetX:-A,offsetY:c*Math.sin(a)-p}:h<270?h<180+u?{offsetX:-A,offsetY:c*Math.sin(a)-p}:{offsetX:c*Math.cos(a)-b,offsetY:-d}:h<360-u?{offsetX:c*Math.cos(a)-b,offsetY:-d}:{offsetX:0,offsetY:c*Math.sin(a)-p}}l.getOffsets=g})(exports.Rectangle||(exports.Rectangle={}));exports.Mercator=void 0;(l=>{function g(c,u,a){return{x:d(u)*a,y:h(c)*a}}l.project=g;function A(c,u,a){return{lat:p(u/a),lng:b(c/a)}}l.unproject=A;function d(c){return(180+c)/360}function h(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function b(c){return c*360-180}function p(c){return 360/Math.PI*Math.atan(Math.exp((180-c*360)*Math.PI/180))-90}})(exports.Mercator||(exports.Mercator={}));exports.Angles=void 0;(l=>{l.COUNT=12,l.DEFAULT=270,l.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(exports.Angles||(exports.Angles={}));var T;(l=>{let g;(p=>{p.RADIANS=exports.Angles.DEGREES.map(a=>a*Math.PI/180),p.RADIANS_COS=p.RADIANS.map(a=>Math.cos(a)),p.RADIANS_SIN=p.RADIANS.map(a=>Math.sin(a));function c(a,M){const I=Math.abs(M/a);return I<1?I<.26795?0:1:I<3.73205?2:3}function u(a,M){const I=c(a,M);return a>0?M>0?(12-I)%12:0+I:M>0?6+I:6-I}p.getAngleIndex=u})(g=l.Angle||(l.Angle={}));class A{constructor(c,u,a,M){m(this,"center");m(this,"width");m(this,"height");m(this,"index");this.center=c,this.width=u,this.height=a,this.index=M}}l.Particle=A;function d(p){let c=!0;for(let u=0;u<p.length;u++){const{particle:a,influences:M}=p[u],I=a.index,D=a.center,N=a.width,P=a.height,i=b(I,-1),t=b(I,1),n=D.x+N*g.RADIANS_COS[i],o=D.y+P*g.RADIANS_SIN[i],e=D.x+N*g.RADIANS_COS[I],r=D.y+P*g.RADIANS_SIN[I],s=D.x+N*g.RADIANS_COS[t],f=D.y+P*g.RADIANS_SIN[t];let x=0,v=0,w=0;for(let z=0;z<M.length;z++){const S=M[z],R=S.index,E=S.center,G=S.width,W=S.height,B=E.x+G*g.RADIANS_COS[R],C=E.y+W*g.RADIANS_SIN[R],j=n-B,X=o-C;x+=1/(j*j+X*X);const Y=e-B,Z=r-C;v+=1/(Y*Y+Z*Z);const k=s-B,F=f-C;w+=1/(k*k+F*F)}let O=0;x<v&&x<w&&(O=-1),w<v&&w<x&&(O=1),O!=0&&(a.index=b(I,O),c=!1)}return c}l.updatePointIndexes=d;function h(p){for(let c=0;c<p.length;c++){const{particle:u,influences:a}=p[c],M=u.center;let I=0,D=0;for(let N=0;N<a.length;N++){const i=a[N].center,t=M.x-i.x,n=M.y-i.y;if(t==0&&n==0)continue;const o=Math.sqrt(t*t+n*n),e=1/(o*o);I+=e*t/o,D+=-(e*n)/o}u.index=g.getAngleIndex(I,D)}}l.initializePointIndexes=h;function b(p,c){return c==0?p:((p+c)%exports.Angles.COUNT+exports.Angles.COUNT)%exports.Angles.COUNT}})(T||(T={}));exports.Bounds=void 0;(l=>{function g(d,h){return!(d.x-d.left>h.x+h.right||d.x+d.right<h.x-h.left||d.y-d.top>h.y+h.bottom||d.y+d.bottom<h.y-h.top)}l.areOverlaping=g;function A(d,h){let b=Math.abs(d.x-h.x),c=(d.x<h.x?d.right+h.left:d.left+h.right)/b,u=Math.abs(d.y-h.y),M=(d.y<h.y?d.bottom+h.top:d.top+h.bottom)/u,I=Math.min(c,M);return Math.log2(I)}l.getZoomWhenTouching=A})(exports.Bounds||(exports.Bounds={}));var y;(l=>{class g{constructor(){m(this,"zoomAfterExpanded");m(this,"zoomAfterAngleIndexes");this.zoomAfterExpanded=NaN,this.zoomAfterAngleIndexes=[]}}l.Tooltip=g;class A{constructor(t,n,o){m(this,"index");m(this,"id");m(this,"rank");m(this,"x");m(this,"y");m(this,"width");m(this,"height");m(this,"expanded");m(this,"angle");m(this,"bounds");m(this,"neighbours");m(this,"particle");m(this,"influences");const e=exports.Mercator.project(n.lat,n.lng,t.mapSize),r=n.width+2*n.margin,s=n.height+2*n.margin;this.index=o,this.id=n.id,this.rank=n.rank,this.x=e.x,this.y=e.y,this.width=r,this.height=s,this.expanded=!0,this.angle=exports.Angles.DEFAULT,this.bounds=this.getBounds(1),this.neighbours=new Array,this.particle=new T.Particle({x:e.x,y:e.y},this.getParticleWidth(1),this.getParticleHeight(1),exports.Angles.DEGREES.indexOf(exports.Angles.DEFAULT)),this.influences=[]}getBounds(t){let{offsetX:n,offsetY:o}=exports.Rectangle.getOffsets(this.width,this.height,this.angle),e=-n,r=this.width-e,s=-o,f=this.height-s;return{x:this.x,y:this.y,left:e/t,right:r/t,top:s/t,bottom:f/t}}getParticleWidth(t){return this.width/2/t}getParticleHeight(t){return this.height/2/t}updateBounds(t){this.bounds=this.getBounds(t)}updateParticle(t){this.particle.width=this.getParticleWidth(t),this.particle.height=this.getParticleHeight(t)}}l.Node=A;class d{constructor(t){m(this,"min");m(this,"max");m(this,"scale");m(this,"step");this.min=t.zoomMin,this.max=t.zoomMax,this.scale=t.zoomScale,this.step=1/this.scale}addSteps(t,n){return Math.round((t+n*this.step)*this.scale)/this.scale}getIndex(t){if(!(t<this.min))return Math.min(Math.ceil(t*this.scale),this.max*this.scale)}getMax(t){let n=this.min;for(let o=0;o<t.length;o++){const r=t[o].keys();for(const s of r){const f=Number(s)/this.scale;f>n&&(n=f)}}return n}}l.Zoom=d;function h(i,t){let n=new Array(t.length);for(let o=0;o<t.length;o++)n[o]=new A(i,t[o],o);return n}l.createNodes=h;function b(i,t){const n=new Array;for(let e=0;e<t.length;e++)n[e]=new Array;const o=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e];o[e]={x:r.x,y:r.y,left:r.width,right:r.width,top:r.height,bottom:r.height}}for(let e=0;e<t.length;e++){const r=t[e],s=o[e],f=n[e];for(let x=e+1;x<t.length;x++){const v=t[x],w=o[x],O=n[x],z=exports.Bounds.getZoomWhenTouching(s,w),S=i.getIndex(z);if(S==null)continue;const R=f[S],E=O[S];R?R.push(v):f[S]=[v],E?E.push(r):O[S]=[r]}}return n}l.createNeighbourDeltas=b;function p(i){const t=new Set,n=[];for(let o=0;o<i.length;o++){let e=i[o];if(e.expanded==!1||e.neighbours.length==0||t.has(e))continue;t.add(e);const r=[],s=[e];for(;s.length>0;){const f=s.pop();r.push(f);for(const x of f.neighbours)t.has(x)||(t.add(x),s.push(x))}n.push(r)}return n}l.getNeighbourGraphs=p;function c(i,t,n){for(let o=0;o<i.length;o++){let e=i[o];if(e.expanded==!1){e.neighbours.length=0,e.influences.length=0;continue}const s=t[o][n];if(s!=null)for(let f=0;f<s.length;f++){const x=s[f];x.expanded!=!1&&(e.neighbours.push(x),e.influences.push(x.particle))}}}l.updateNeighbours=c;function u(i){i.expanded=!1;const t=i.neighbours;for(let n=0;n<t.length;n++){const o=t[n],e=o.neighbours.indexOf(i);o.neighbours.splice(e,1),o.influences.splice(e,1)}}l.updateCollapsed=u;function a(i,t,n){for(let o=0;o<i.length;o++){const e=i[o];if(e.expanded==!1)continue;const r=t.get(e.id);if(!r)throw new Error("Tooltip not found");r.zoomAfterExpanded=n;const s=exports.Angles.DEGREES.indexOf(e.angle);r.zoomAfterAngleIndexes.length==0?r.zoomAfterAngleIndexes.push([n,s]):r.zoomAfterAngleIndexes[0][1]!=s?r.zoomAfterAngleIndexes.unshift([n,s]):r.zoomAfterAngleIndexes[0][0]=n}}l.updateTooltips=a;function M(i,t){for(let n=0;n<i.length;n++)i[n].updateBounds(t)}l.updateBounds=M;function I(i){const t=new Set;for(let n=0;n<i.length;n++){const o=i[n],e=o.bounds,r=i[n].neighbours;for(let s=0;s<r.length;s++){const f=r[s],x=f.bounds;exports.Bounds.areOverlaping(x,e)&&(t.add(o),t.add(f))}}return t}l.getOverlaps=I;function D(i,t){let n=!1;for(let o=0;o<t.length;o++){const e=t[o],r=e.bounds,s=t[o].neighbours;for(let f=0;f<s.length;f++){const x=s[f],v=x.bounds;exports.Bounds.areOverlaping(v,r)&&(i.has(e)||(i.add(e),n=!0),i.has(x)||(i.add(x),n=!0))}}return n}l.updateOverlaps=D;function N(i){let t,n=0;for(let o=0;o<i.length;o++){const e=i[o],r=e.bounds,s=i[o].neighbours;let f=0;for(let x=0;x<s.length;x++){const v=s[x],w=v.bounds;exports.Bounds.areOverlaping(w,r)&&(f+=1+(v.rank-e.rank))}f=f*s.length,f>n&&(n=f,t=e)}return t}l.getOverlapsWorstNode=N;function P(i){for(let t=0;t<i.length;t++){const o=i[t].bounds;for(let e=t+1;e<i.length;e++){const s=i[e].bounds;if(exports.Bounds.areOverlaping(s,o))return!0}}return!1}l.areOverlaping=P,(i=>{function t(e){const r=e.map(s=>s.particle);T.initializePointIndexes(r.map(s=>({particle:s,influences:r})));for(let s=0;s<e.length;s++){const f=e[s];f.angle=exports.Angles.DEGREES[f.particle.index]}}i.initializeAngles=t;function n(e){const r=T.updatePointIndexes(e);for(let s=0;s<e.length;s++){const f=e[s];f.angle=exports.Angles.DEGREES[f.particle.index]}return r}i.updateAngles=n;function o(e,r){for(let s=0;s<e.length;s++)e[s].updateParticle(r)}i.updateParticles=o})(l.Particles||(l.Particles={}))})(y||(y={}));function H(l,g){const A=new y.Zoom(l);if(g.length==0)return[];if(g.length==1)return[[A.min,[[A.min,exports.Angles.DEGREES.indexOf(exports.Angles.DEFAULT)]]]];const d=new Map(g.map(u=>[u.id,new y.Tooltip])),h=y.createNodes(l,g),b=y.createNeighbourDeltas(A,h),p=A.min,c=A.getMax(b);y.Particles.initializeAngles(h),y.updateTooltips(h,d,A.addSteps(A.max,1));for(let u=c;u>=p;u=A.addSteps(u,-1)){const a=Math.pow(2,u),M=Math.round(u*A.scale);y.updateNeighbours(h,b,M);const I=y.getNeighbourGraphs(h);for(const D of I){y.updateBounds(D,a),y.Particles.updateParticles(D,a);const N=y.getOverlaps(D);for(;N.size>1;){const P=Array.from(N);for(;;){const n=y.Particles.updateAngles(P);if(y.updateBounds(P,a),n==!0||y.areOverlaping(P)==!1)break}if(y.updateOverlaps(N,P))continue;const t=y.getOverlapsWorstNode(P);if(t==null)break;y.updateCollapsed(t),N.delete(t)}}y.updateTooltips(h,d,Number(u.toFixed(1)))}return Array.from(d.values()).map(u=>[u.zoomAfterExpanded,u.zoomAfterAngleIndexes])}exports.getStates=H;