mudlet-map-renderer 2.3.1 → 2.5.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.
@@ -7,21 +7,32 @@ function t(e) {
7
7
  else return .5;
8
8
  return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
9
9
  }
10
- function n(e, t) {
11
- let n, r, i, a = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
12
- if (a) n = parseInt(a[1]), r = parseInt(a[2]), i = parseInt(a[3]);
13
- else if (e.startsWith("#") && e.length >= 7) n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16);
14
- else return e;
15
- return n = Math.round(n * (1 - t)), r = Math.round(r * (1 - t)), i = Math.round(i * (1 - t)), `rgb(${n}, ${r}, ${i})`;
16
- }
17
- function r(e, t) {
18
- let n, r, i, a = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
19
- if (a) n = parseInt(a[1]), r = parseInt(a[2]), i = parseInt(a[3]);
20
- else if (e.startsWith("#") && e.length >= 7) n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16);
21
- else return e;
22
- return n = Math.min(255, Math.round(n + (255 - n) * t)), r = Math.min(255, Math.round(r + (255 - r) * t)), i = Math.min(255, Math.round(i + (255 - i) * t)), `rgb(${n}, ${r}, ${i})`;
23
- }
24
- var i = {
10
+ function n(e) {
11
+ let t = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?/);
12
+ if (t) return {
13
+ r: parseInt(t[1]),
14
+ g: parseInt(t[2]),
15
+ b: parseInt(t[3]),
16
+ a: t[4] === void 0 ? void 0 : parseFloat(t[4])
17
+ };
18
+ if (e.startsWith("#") && e.length >= 7) return {
19
+ r: parseInt(e.slice(1, 3), 16),
20
+ g: parseInt(e.slice(3, 5), 16),
21
+ b: parseInt(e.slice(5, 7), 16)
22
+ };
23
+ }
24
+ function r(e, t, n, r) {
25
+ return r === void 0 ? `rgb(${e}, ${t}, ${n})` : `rgba(${e}, ${t}, ${n}, ${r})`;
26
+ }
27
+ function i(e, t) {
28
+ let i = n(e);
29
+ return i ? r(Math.round(i.r * (1 - t)), Math.round(i.g * (1 - t)), Math.round(i.b * (1 - t)), i.a) : e;
30
+ }
31
+ function a(e, t) {
32
+ let i = n(e);
33
+ return i ? r(Math.min(255, Math.round(i.r + (255 - i.r) * t)), Math.min(255, Math.round(i.g + (255 - i.g) * t)), Math.min(255, Math.round(i.b + (255 - i.b) * t)), i.a) : e;
34
+ }
35
+ var o = {
25
36
  black: [
26
37
  0,
27
38
  0,
@@ -153,7 +164,7 @@ var i = {
153
164
  0
154
165
  ]
155
166
  };
156
- function a(e, t) {
167
+ function s(e, t) {
157
168
  let n = e.trim();
158
169
  if (n.startsWith("#")) {
159
170
  let r, i, a;
@@ -164,12 +175,39 @@ function a(e, t) {
164
175
  }
165
176
  let r = n.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/i);
166
177
  if (r) return `rgba(${parseInt(r[1], 10)}, ${parseInt(r[2], 10)}, ${parseInt(r[3], 10)}, ${r[4] === void 0 ? t : parseFloat(r[4]) * t})`;
167
- let a = i[n.toLowerCase()];
168
- return a ? `rgba(${a[0]}, ${a[1]}, ${a[2]}, ${t})` : e;
178
+ let i = o[n.toLowerCase()];
179
+ return i ? `rgba(${i[0]}, ${i[1]}, ${i[2]}, ${t})` : e;
180
+ }
181
+ //#endregion
182
+ //#region src/scene/RoomFlags.ts
183
+ var c = "system.fallback_hidden", l = "room.ui_borderColor", u = "room.ui_borderThickness";
184
+ function d(e) {
185
+ let t = e.userData?.[c];
186
+ return typeof t == "string" && t.toLowerCase() === "true";
187
+ }
188
+ function f(e) {
189
+ let t = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{6})$/.exec(e.trim());
190
+ if (!t) return e;
191
+ let [, n, r] = t;
192
+ return n.toLowerCase() === "ff" ? `#${r}` : `#${r}${n}`;
193
+ }
194
+ function p(e) {
195
+ let t = e.userData?.[l];
196
+ return t ? f(t) : void 0;
197
+ }
198
+ var m = .35;
199
+ function h(e, t) {
200
+ return d(e) ? t === "faded" ? { fade: m } : t === "dashed" ? { dashedBorder: !0 } : {} : {};
201
+ }
202
+ function g(e) {
203
+ let t = e.userData?.[u];
204
+ if (t === void 0) return;
205
+ let n = parseInt(t, 10);
206
+ if (Number.isFinite(n)) return Math.min(10, Math.max(1, n));
169
207
  }
170
208
  //#endregion
171
209
  //#region src/TypedEventEmitter.ts
172
- var o = class {
210
+ var _ = class {
173
211
  constructor(e) {
174
212
  this.listeners = /* @__PURE__ */ new Map(), this.container = e;
175
213
  }
@@ -186,18 +224,18 @@ var o = class {
186
224
  emit(e, t) {
187
225
  this.listeners.get(e)?.forEach((e) => e(t)), this.container && this.container.dispatchEvent(new CustomEvent(e, { detail: t }));
188
226
  }
189
- }, s = {
227
+ }, v = {
190
228
  isVisible: () => !0,
191
229
  getVersion: () => 0
192
230
  };
193
- function c(e, t, n, r) {
231
+ function y(e, t, n, r) {
194
232
  let i = e.isVisible(n), a = e.isVisible(r);
195
233
  return i && a ? "full" : i || a ? "stub" : "hidden";
196
234
  }
197
- function l(e) {
235
+ function ee(e) {
198
236
  return e < .5 ? 2 * e * e : -1 + (4 - 2 * e) * e;
199
237
  }
200
- var u = class e extends o {
238
+ var b = class e extends _ {
201
239
  constructor(e, t) {
202
240
  super(), this.zoom = 1, this.minZoom = .05, this.position = {
203
241
  x: 0,
@@ -349,7 +387,7 @@ var u = class e extends o {
349
387
  this.cancelAnimation();
350
388
  let n = performance.now(), r = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(performance.now()), 16), i = (a) => {
351
389
  let o = a - n, s = Math.min(o / e, 1);
352
- t(l(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
390
+ t(ee(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
353
391
  };
354
392
  this.animationId = r(i);
355
393
  }
@@ -374,12 +412,12 @@ var u = class e extends o {
374
412
  }
375
413
  this.emit("change", void 0);
376
414
  }
377
- }, d = (e, t) => ({
415
+ }, x = (e, t) => ({
378
416
  x: e,
379
417
  y: t
380
- }), f = class {
418
+ }), S = class {
381
419
  constructor(e, t) {
382
- this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform = d;
420
+ this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform = x;
383
421
  }
384
422
  setCoordinateTransform(e) {
385
423
  this.coordinateTransform = e;
@@ -398,7 +436,7 @@ var u = class e extends o {
398
436
  updateCulling() {
399
437
  this.onCullingNeeded();
400
438
  }
401
- }, p = [
439
+ }, C = [
402
440
  "north",
403
441
  "south",
404
442
  "east",
@@ -407,7 +445,7 @@ var u = class e extends o {
407
445
  "northwest",
408
446
  "southeast",
409
447
  "southwest"
410
- ], m = {
448
+ ], w = {
411
449
  n: "north",
412
450
  s: "south",
413
451
  e: "east",
@@ -416,7 +454,7 @@ var u = class e extends o {
416
454
  nw: "northwest",
417
455
  se: "southeast",
418
456
  sw: "southwest"
419
- }, h = {
457
+ }, T = {
420
458
  north: "n",
421
459
  south: "s",
422
460
  east: "e",
@@ -429,7 +467,7 @@ var u = class e extends o {
429
467
  down: "d",
430
468
  in: "i",
431
469
  out: "o"
432
- }, g = {
470
+ }, E = {
433
471
  north: {
434
472
  x: 0,
435
473
  y: -1
@@ -462,7 +500,7 @@ var u = class e extends o {
462
500
  x: -1,
463
501
  y: 1
464
502
  }
465
- }, _ = [
503
+ }, D = [
466
504
  "north",
467
505
  "south",
468
506
  "east",
@@ -471,7 +509,7 @@ var u = class e extends o {
471
509
  "northwest",
472
510
  "southeast",
473
511
  "southwest"
474
- ], v = {
512
+ ], O = {
475
513
  north: "south",
476
514
  south: "north",
477
515
  east: "west",
@@ -481,39 +519,39 @@ var u = class e extends o {
481
519
  southeast: "northwest",
482
520
  southwest: "northeast"
483
521
  };
484
- function y(e) {
485
- return e ? Object.prototype.hasOwnProperty.call(g, e) : !1;
522
+ function k(e) {
523
+ return e ? Object.prototype.hasOwnProperty.call(E, e) : !1;
486
524
  }
487
- function b(e, t, n, r = 1) {
488
- if (!y(n)) return {
525
+ function A(e, t, n, r = 1) {
526
+ if (!k(n)) return {
489
527
  x: e,
490
528
  y: t
491
529
  };
492
- let i = g[n];
530
+ let i = E[n];
493
531
  return {
494
532
  x: e + i.x * r,
495
533
  y: t + i.y * r
496
534
  };
497
535
  }
498
- function x(e, t, n, r = 1, i = 0) {
499
- if (!y(n)) return {
536
+ function j(e, t, n, r = 1, i = 0) {
537
+ if (!k(n)) return {
500
538
  x: e,
501
539
  y: t
502
540
  };
503
- let a = g[n];
504
- if (!(a.x !== 0 && a.y !== 0) || i <= 0) return b(e, t, n, r);
541
+ let a = E[n];
542
+ if (!(a.x !== 0 && a.y !== 0) || i <= 0) return A(e, t, n, r);
505
543
  let o = r - i + i / Math.SQRT2;
506
544
  return {
507
545
  x: e + a.x * o,
508
546
  y: t + a.y * o
509
547
  };
510
548
  }
511
- function S(e, t, n, r = 1) {
512
- if (!y(n)) return {
549
+ function M(e, t, n, r = 1) {
550
+ if (!k(n)) return {
513
551
  x: e,
514
552
  y: t
515
553
  };
516
- let i = g[n], a = Math.atan2(i.y, i.x);
554
+ let i = E[n], a = Math.atan2(i.y, i.x);
517
555
  return {
518
556
  x: e + Math.cos(a) * r,
519
557
  y: t + Math.sin(a) * r
@@ -521,32 +559,32 @@ function S(e, t, n, r = 1) {
521
559
  }
522
560
  //#endregion
523
561
  //#region src/ExitRenderer.ts
524
- var C = {
562
+ var N = {
525
563
  OPEN_DOOR: "rgb(10, 155, 10)",
526
564
  CLOSED_DOOR: "rgb(226, 205, 59)",
527
565
  LOCKED_DOOR: "rgb(155, 10, 10)",
528
566
  ONE_WAY_FILL: "rgb(155, 10, 10)"
529
567
  };
530
- function w(e) {
568
+ function P(e) {
531
569
  switch (e) {
532
- case 1: return C.OPEN_DOOR;
533
- case 2: return C.CLOSED_DOOR;
534
- default: return C.LOCKED_DOOR;
570
+ case 1: return N.OPEN_DOOR;
571
+ case 2: return N.CLOSED_DOOR;
572
+ default: return N.LOCKED_DOOR;
535
573
  }
536
574
  }
537
- var T = class {
575
+ var F = class {
538
576
  constructor(e, t) {
539
577
  this.mapReader = e, this.settings = t;
540
578
  }
541
579
  getRoomEdgePoint(e, t, n, r) {
542
580
  let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
543
- return this.settings.roomShape === "circle" ? S(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? x(e, t, n, i, this.settings.roomSize * .2) : b(e, t, n, i);
581
+ return this.settings.roomShape === "circle" ? M(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? j(e, t, n, i, this.settings.roomSize * .2) : A(e, t, n, i);
544
582
  }
545
583
  renderData(e, t) {
546
584
  return this.renderDataWithColor(e, this.settings.lineColor, t);
547
585
  }
548
586
  renderDataWithColor(e, t, n) {
549
- let r = e.aDir && p.includes(e.aDir), i = e.bDir && p.includes(e.bDir);
587
+ let r = e.aDir && C.includes(e.aDir), i = e.bDir && C.includes(e.bDir);
550
588
  if (r && i) return this.renderTwoWayExitData(e, t, n);
551
589
  if (r || i) {
552
590
  let n = r ? "a" : "b";
@@ -555,7 +593,7 @@ var T = class {
555
593
  }
556
594
  renderTwoWayExitData(e, t, n) {
557
595
  let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
558
- if (!r || !i || !e.aDir || !e.bDir || r.customLines[h[e.aDir]] && i.customLines[h[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[h[e.aDir]] || n !== r.z && i.customLines[h[e.bDir]])) return;
596
+ if (!r || !i || !e.aDir || !e.bDir || r.customLines[T[e.aDir]] && i.customLines[T[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[T[e.aDir]] || n !== r.z && i.customLines[T[e.bDir]])) return;
559
597
  let a = this.getRoomEdgePoint(r.x, r.y, e.aDir, this.settings.roomSize / 2), o = this.getRoomEdgePoint(i.x, i.y, e.bDir, this.settings.roomSize / 2), s = [
560
598
  a.x,
561
599
  a.y,
@@ -565,7 +603,7 @@ var T = class {
565
603
  points: s,
566
604
  stroke: t,
567
605
  strokeWidth: this.settings.lineWidth
568
- }], l = [], u = r.doors[h[e.aDir]] ?? i.doors[h[e.bDir]];
606
+ }], l = [], u = r.doors[T[e.aDir]] ?? i.doors[T[e.bDir]];
569
607
  if (u) {
570
608
  let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
571
609
  l.push({
@@ -573,11 +611,11 @@ var T = class {
573
611
  y: t - this.settings.roomSize / 4,
574
612
  width: this.settings.roomSize / 2,
575
613
  height: this.settings.roomSize / 2,
576
- stroke: w(u),
614
+ stroke: P(u),
577
615
  strokeWidth: this.settings.lineWidth
578
616
  });
579
617
  }
580
- let d = Math.min(s[0], s[2]), f = Math.max(s[0], s[2]), p = Math.min(s[1], s[3]), m = Math.max(s[1], s[3]), g = (r.z === i.z ? void 0 : r.z === n ? i.id : r.id) ?? (r.area === i.area ? void 0 : i.id), _ = g === void 0 ? {} : {
618
+ let d = Math.min(s[0], s[2]), f = Math.max(s[0], s[2]), p = Math.min(s[1], s[3]), m = Math.max(s[1], s[3]), h = (r.z === i.z ? void 0 : r.z === n ? i.id : r.id) ?? (r.area === i.area ? void 0 : i.id), g = h === void 0 ? {} : {
581
619
  from: {
582
620
  x: r.x,
583
621
  y: r.y
@@ -598,15 +636,15 @@ var T = class {
598
636
  width: f - d,
599
637
  height: m - p
600
638
  },
601
- targetRoomId: g,
602
- ..._
639
+ targetRoomId: h,
640
+ ...g
603
641
  };
604
642
  }
605
643
  renderOneWayExitData(e, t, n) {
606
644
  let r = n === "a" || !n && e.aDir, i = r ? this.mapReader.getRoom(e.a) : this.mapReader.getRoom(e.b), a = r ? this.mapReader.getRoom(e.b) : this.mapReader.getRoom(e.a), o = r ? e.aDir : e.bDir;
607
- if (!o || !i || !a || !p.includes(o) || i.customLines[h[o] || o]) return;
645
+ if (!o || !i || !a || !C.includes(o) || i.customLines[T[o] || o]) return;
608
646
  if (i.area != a.area && o) {
609
- let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = b(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
647
+ let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = A(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
610
648
  return {
611
649
  lines: [],
612
650
  arrows: [{
@@ -645,32 +683,32 @@ var T = class {
645
683
  x: a.x,
646
684
  y: a.y
647
685
  };
648
- s && (c = b(i.x, i.y, o, this.settings.roomSize / 2));
649
- let l = b(i.x, i.y, o, .3), u = l.x - (l.x - c.x) / 2, d = l.y - (l.y - c.y) / 2, f = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), m = [
686
+ s && (c = A(i.x, i.y, o, this.settings.roomSize / 2));
687
+ let l = A(i.x, i.y, o, .3), u = l.x - (l.x - c.x) / 2, d = l.y - (l.y - c.y) / 2, f = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), p = [
650
688
  f.x,
651
689
  f.y,
652
690
  c.x,
653
691
  c.y
654
- ], g = [
692
+ ], m = [
655
693
  f.x,
656
694
  c.x,
657
695
  u
658
- ], _ = [
696
+ ], h = [
659
697
  f.y,
660
698
  c.y,
661
699
  d
662
- ], v = Math.min(...g), y = Math.max(...g), x = Math.min(..._), S = Math.max(..._);
700
+ ], g = Math.min(...m), _ = Math.max(...m), v = Math.min(...h), y = Math.max(...h);
663
701
  return {
664
702
  lines: [{
665
- points: m,
703
+ points: p,
666
704
  stroke: t,
667
705
  strokeWidth: this.settings.lineWidth,
668
706
  dash: [.1, .05]
669
707
  }],
670
708
  arrows: [{
671
709
  points: [
672
- m[0],
673
- m[1],
710
+ p[0],
711
+ p[1],
674
712
  u,
675
713
  d
676
714
  ],
@@ -678,15 +716,15 @@ var T = class {
678
716
  pointerWidth: .35,
679
717
  strokeWidth: this.settings.lineWidth * 1.4,
680
718
  stroke: t,
681
- fill: C.ONE_WAY_FILL,
719
+ fill: N.ONE_WAY_FILL,
682
720
  dash: [.1, .05]
683
721
  }],
684
722
  doors: [],
685
723
  bounds: {
686
- x: v,
687
- y: x,
688
- width: y - v,
689
- height: S - x
724
+ x: g,
725
+ y: v,
726
+ width: _ - g,
727
+ height: y - v
690
728
  },
691
729
  ...s ? { targetRoomId: a.id } : {}
692
730
  };
@@ -733,7 +771,7 @@ var T = class {
733
771
  for (let [r, i] of Object.entries(e.customLines)) {
734
772
  let a = e.specialExits[r];
735
773
  if (a === void 0) {
736
- let t = m[r] ?? n[r];
774
+ let t = w[r] ?? n[r];
737
775
  t && (a = e.exits[t] ?? e.specialExits[t]);
738
776
  }
739
777
  if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
@@ -765,7 +803,7 @@ var T = class {
765
803
  }
766
804
  return t;
767
805
  }
768
- }, E = {
806
+ }, te = {
769
807
  1: "north",
770
808
  2: "northeast",
771
809
  3: "northwest",
@@ -779,15 +817,15 @@ var T = class {
779
817
  11: "in",
780
818
  12: "out"
781
819
  };
782
- function D(e, t, n, r, i) {
783
- return e.roomShape === "circle" ? S(t, n, r, i) : e.roomShape === "roundedRectangle" ? x(t, n, r, i, e.roomSize * .2) : b(t, n, r, i);
820
+ function ne(e, t, n, r, i) {
821
+ return e.roomShape === "circle" ? M(t, n, r, i) : e.roomShape === "roundedRectangle" ? j(t, n, r, i, e.roomSize * .2) : A(t, n, r, i);
784
822
  }
785
- function O(e, t, n) {
823
+ function re(e, t, n) {
786
824
  let r = [];
787
825
  for (let i of e.stubs) {
788
- let a = E[i];
826
+ let a = te[i];
789
827
  if (!a) continue;
790
- let o = D(t, e.x, e.y, a, t.roomSize / 2), s = b(e.x, e.y, a, t.roomSize / 2 + .5);
828
+ let o = ne(t, e.x, e.y, a, t.roomSize / 2), s = A(e.x, e.y, a, t.roomSize / 2 + .5);
791
829
  r.push({
792
830
  roomId: e.id,
793
831
  direction: a,
@@ -803,12 +841,12 @@ function O(e, t, n) {
803
841
  }
804
842
  //#endregion
805
843
  //#region src/scene/SpecialExitStyle.ts
806
- var k = {
844
+ var ie = {
807
845
  1: "rgb(10, 155, 10)",
808
846
  2: "rgb(226, 205, 59)",
809
847
  3: "rgb(155, 10, 10)"
810
848
  };
811
- function A(e, t, n) {
849
+ function I(e, t, n) {
812
850
  let r = [];
813
851
  for (let [i, a] of Object.entries(e.customLines)) {
814
852
  let o = [e.x, e.y];
@@ -855,7 +893,7 @@ function A(e, t, n) {
855
893
  y: n - r / 2,
856
894
  width: r,
857
895
  height: r,
858
- stroke: k[f] ?? k[3],
896
+ stroke: ie[f] ?? ie[3],
859
897
  strokeWidth: t.lineWidth
860
898
  };
861
899
  }
@@ -870,59 +908,62 @@ function A(e, t, n) {
870
908
  }
871
909
  //#endregion
872
910
  //#region src/utils/textMeasure.ts
873
- var j = 72, M = 200, N = 120, P = /* @__PURE__ */ new Map(), F = null;
874
- function I() {
875
- return F || (F = e.Util.createCanvasElement(), F.width = M, F.height = M), F;
911
+ var L = 72, R = 200, z = 120, B = /* @__PURE__ */ new Map(), V = null;
912
+ function ae() {
913
+ return V || (V = e.Util.createCanvasElement(), V.width = R, V.height = R), V;
876
914
  }
877
- function ee(e, t) {
878
- let n = `${e}::${t}`, r = P.get(n);
915
+ function oe(e, t) {
916
+ let n = `${e}::${t}`, r = B.get(n);
879
917
  if (r !== void 0) return r;
880
- let i = I().getContext("2d", { willReadFrequently: !0 }), a = `bold ${j}px ${t}`;
881
- i.clearRect(0, 0, M, M), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, M / 2, N);
882
- let { data: o } = i.getImageData(0, 0, M, M), s = M, c = -1;
883
- for (let e = 0; e < M; e++) for (let t = 0; t < M; t++) o[(e * M + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
918
+ let i = ae().getContext("2d", { willReadFrequently: !0 }), a = `bold ${L}px ${t}`;
919
+ i.clearRect(0, 0, R, R), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, R / 2, z);
920
+ let { data: o } = i.getImageData(0, 0, R, R), s = R, c = -1;
921
+ for (let e = 0; e < R; e++) for (let t = 0; t < R; t++) o[(e * R + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
884
922
  if (c === -1) {
885
923
  let e = {
886
924
  baselineRatio: .35,
887
925
  konvaCorrectionRatio: 0
888
926
  };
889
- return P.set(n, e), e;
927
+ return B.set(n, e), e;
890
928
  }
891
- let l = (N - s - Math.max(0, c - N)) / 2 / j, u = i.measureText("M"), d = {
929
+ let l = (z - s - Math.max(0, c - z)) / 2 / L, u = i.measureText("M"), d = {
892
930
  baselineRatio: l,
893
- konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / j - l
931
+ konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / L - l
894
932
  };
895
- return P.set(n, d), d;
933
+ return B.set(n, d), d;
896
934
  }
897
935
  //#endregion
898
936
  //#region src/scene/RoomStyle.ts
899
- function te(e, t, i, a) {
900
- let o = t.getColorValue(e.env), s = i.coloredMode ? n(o, .5) : i.frameMode ? i.backgroundColor : o, c = i.coloredMode ? r(o, .1) : o;
937
+ function se(e, t, n, r) {
938
+ let o = t.getColorValue(e.env), s = n.coloredMode ? i(o, .5) : n.frameMode ? n.backgroundColor : o, c = n.coloredMode ? a(o, .1) : o, l = r ? n.frameMode || n.coloredMode ? c : r : n.frameMode || n.coloredMode ? c : n.lineColor, u = n.borders ? n.lineWidth : 0, d = p(e), f = g(e);
939
+ d && (l = d), f === void 0 ? d && u === 0 && (u = n.lineWidth) : u = n.lineWidth * f;
940
+ let m = e.userData?.["system.fallback_symbol_color"] ?? (n.frameMode || n.coloredMode ? c : t.getSymbolColor(e.env));
901
941
  return {
902
942
  fillColor: s,
903
- strokeColor: a ? i.frameMode || i.coloredMode ? c : a : i.frameMode || i.coloredMode ? c : i.lineColor,
904
- borderWidth: i.borders ? i.lineWidth : 0,
905
- symbolColor: e.userData?.["system.fallback_symbol_color"] ?? (i.frameMode || i.coloredMode ? c : t.getSymbolColor(e.env)),
906
- envColor: o
943
+ strokeColor: l,
944
+ borderWidth: u,
945
+ symbolColor: m,
946
+ envColor: o,
947
+ customBorder: d !== void 0
907
948
  };
908
949
  }
909
- function ne(e, t) {
950
+ function ce(e, t) {
910
951
  if (!t.emboss) return null;
911
- let i = t.roomSize, a = t.borders ? t.lineWidth / 2 : 0, o = t.lineWidth, s = r(e, .35), c = n(e, .45);
952
+ let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, o = t.lineWidth, s = a(e, .35), c = i(e, .45);
912
953
  if (t.roomShape === "circle") {
913
- let e = i / 2, t = i / 2, n = i / 2 - a, r = [];
914
- for (let i = 0; i <= 48; i++) {
915
- let a = i / 48 * 360 * Math.PI / 180;
916
- r.push(e + Math.cos(a) * n, t + Math.sin(a) * n);
954
+ let e = n / 2, t = n / 2, i = n / 2 - r, a = [];
955
+ for (let n = 0; n <= 48; n++) {
956
+ let r = n / 48 * 360 * Math.PI / 180;
957
+ a.push(e + Math.cos(r) * i, t + Math.sin(r) * i);
917
958
  }
918
959
  let l = [];
919
- for (let r = 0; r <= 19; r++) {
920
- let i = (200 + r / 19 * 140) * Math.PI / 180;
921
- l.push(e + Math.cos(i) * n, t + Math.sin(i) * n);
960
+ for (let n = 0; n <= 19; n++) {
961
+ let r = (200 + n / 19 * 140) * Math.PI / 180;
962
+ l.push(e + Math.cos(r) * i, t + Math.sin(r) * i);
922
963
  }
923
964
  return {
924
965
  shadow: {
925
- points: r,
966
+ points: a,
926
967
  stroke: c,
927
968
  strokeWidth: o,
928
969
  lineCap: "round",
@@ -938,27 +979,27 @@ function ne(e, t) {
938
979
  };
939
980
  }
940
981
  if (t.roomShape === "roundedRectangle") {
941
- let e = (i - a * 2) * .2, t = a, n = a, r = i - a, l = i - a, u = [];
982
+ let e = (n - r * 2) * .2, t = r, i = r, a = n - r, l = n - r, u = [];
942
983
  for (let n = 0; n <= 10 / 2; n++) {
943
984
  let r = (135 + n / (10 / 2) * 45) * Math.PI / 180;
944
985
  u.push(t + e + Math.cos(r) * e, l - e + Math.sin(r) * e);
945
986
  }
946
- for (let r = 1; r <= 10; r++) {
947
- let i = (180 + r / 10 * 90) * Math.PI / 180;
948
- u.push(t + e + Math.cos(i) * e, n + e + Math.sin(i) * e);
987
+ for (let n = 1; n <= 10; n++) {
988
+ let r = (180 + n / 10 * 90) * Math.PI / 180;
989
+ u.push(t + e + Math.cos(r) * e, i + e + Math.sin(r) * e);
949
990
  }
950
991
  for (let t = 1; t <= 10 / 2; t++) {
951
- let i = (270 + t / (10 / 2) * 45) * Math.PI / 180;
952
- u.push(r - e + Math.cos(i) * e, n + e + Math.sin(i) * e);
992
+ let n = (270 + t / (10 / 2) * 45) * Math.PI / 180;
993
+ u.push(a - e + Math.cos(n) * e, i + e + Math.sin(n) * e);
953
994
  }
954
995
  let d = u.slice(), f = [];
955
996
  for (let t = 0; t <= 10 / 2; t++) {
956
- let i = (315 + t / (10 / 2) * 45) * Math.PI / 180;
957
- f.push(r - e + Math.cos(i) * e, n + e + Math.sin(i) * e);
997
+ let n = (315 + t / (10 / 2) * 45) * Math.PI / 180;
998
+ f.push(a - e + Math.cos(n) * e, i + e + Math.sin(n) * e);
958
999
  }
959
1000
  for (let t = 1; t <= 10; t++) {
960
1001
  let n = t / 10 * 90 * Math.PI / 180;
961
- f.push(r - e + Math.cos(n) * e, l - e + Math.sin(n) * e);
1002
+ f.push(a - e + Math.cos(n) * e, l - e + Math.sin(n) * e);
962
1003
  }
963
1004
  for (let n = 1; n <= 10 / 2; n++) {
964
1005
  let r = (90 + n / (10 / 2) * 45) * Math.PI / 180;
@@ -984,24 +1025,24 @@ function ne(e, t) {
984
1025
  return {
985
1026
  highlight: {
986
1027
  points: [
987
- a,
988
- i - a,
989
- a,
990
- a,
991
- i - a,
992
- a
1028
+ r,
1029
+ n - r,
1030
+ r,
1031
+ r,
1032
+ n - r,
1033
+ r
993
1034
  ],
994
1035
  stroke: s,
995
1036
  strokeWidth: o
996
1037
  },
997
1038
  shadow: {
998
1039
  points: [
999
- a,
1000
- i - a,
1001
- i - a,
1002
- i - a,
1003
- i - a,
1004
- a
1040
+ r,
1041
+ n - r,
1042
+ n - r,
1043
+ n - r,
1044
+ n - r,
1045
+ r
1005
1046
  ],
1006
1047
  stroke: c,
1007
1048
  strokeWidth: o
@@ -1010,131 +1051,137 @@ function ne(e, t) {
1010
1051
  }
1011
1052
  //#endregion
1012
1053
  //#region src/scene/elements/RoomLayout.ts
1013
- function L(e, t, r, i) {
1014
- let { fillColor: a, strokeColor: o, borderWidth: s, symbolColor: c } = te(e, t, r, i.strokeOverride), l = r.roomSize, u = [], d = ne(a, r), f = d ? 0 : s, p = r.coloredMode && f > 0 && i.flatPipeline, m = (e) => r.roomShape === "roundedRectangle" ? Math.max(0, (l - 2 * e) * .2) : 0;
1015
- if (p) {
1016
- let e = [n(o, .5), o], t = s * 2;
1017
- r.roomShape === "circle" ? u.push({
1054
+ function H(e, t, n, r) {
1055
+ let a = se(e, t, n, r.strokeOverride), o = r.fade, c = o === void 0 ? a.fillColor : s(a.fillColor, o), l = o === void 0 ? a.strokeColor : s(a.strokeColor, o), u = o === void 0 ? a.symbolColor : s(a.symbolColor, o), d = a.borderWidth, f = n.roomSize, p = [], m = r.dashedBorder ?? !1, h = a.customBorder || m ? null : ce(c, n), g = h ? 0 : d;
1056
+ m && g === 0 && (g = n.lineWidth);
1057
+ let _ = m ? [Math.max(f * .32, n.lineWidth * 4), Math.max(f * .13, n.lineWidth * 1.5)] : void 0, v = !m && n.coloredMode && g > 0 && r.flatPipeline, y = (e) => n.roomShape === "roundedRectangle" ? Math.max(0, (f - 2 * e) * .2) : 0;
1058
+ if (v) {
1059
+ let e = [i(l, .5), l], t = d * 2;
1060
+ n.roomShape === "circle" ? p.push({
1018
1061
  type: "circle",
1019
- cx: l / 2,
1020
- cy: l / 2,
1021
- radius: l / 2 - t,
1022
- paint: { fill: a }
1023
- }) : u.push({
1062
+ cx: f / 2,
1063
+ cy: f / 2,
1064
+ radius: f / 2 - t,
1065
+ paint: { fill: c }
1066
+ }) : p.push({
1024
1067
  type: "rect",
1025
1068
  x: t,
1026
1069
  y: t,
1027
- width: l - t * 2,
1028
- height: l - t * 2,
1029
- cornerRadius: m(t),
1030
- paint: { fill: a }
1070
+ width: f - t * 2,
1071
+ height: f - t * 2,
1072
+ cornerRadius: y(t),
1073
+ paint: { fill: c }
1031
1074
  });
1032
1075
  for (let t = 0; t < e.length; t++) {
1033
- let n = s / 2 + t * s;
1034
- r.roomShape === "circle" ? u.push({
1076
+ let r = d / 2 + t * d;
1077
+ n.roomShape === "circle" ? p.push({
1035
1078
  type: "circle",
1036
- cx: l / 2,
1037
- cy: l / 2,
1038
- radius: l / 2 - n,
1079
+ cx: f / 2,
1080
+ cy: f / 2,
1081
+ radius: f / 2 - r,
1039
1082
  paint: {
1040
1083
  stroke: e[t],
1041
- strokeWidth: s
1084
+ strokeWidth: d
1042
1085
  }
1043
- }) : u.push({
1086
+ }) : p.push({
1044
1087
  type: "rect",
1045
- x: n,
1046
- y: n,
1047
- width: l - n * 2,
1048
- height: l - n * 2,
1049
- cornerRadius: m(n),
1088
+ x: r,
1089
+ y: r,
1090
+ width: f - r * 2,
1091
+ height: f - r * 2,
1092
+ cornerRadius: y(r),
1050
1093
  paint: {
1051
1094
  stroke: e[t],
1052
- strokeWidth: s
1095
+ strokeWidth: d
1053
1096
  }
1054
1097
  });
1055
1098
  }
1056
- } else r.roomShape === "circle" ? u.push({
1099
+ } else n.roomShape === "circle" ? p.push({
1057
1100
  type: "circle",
1058
- cx: l / 2,
1059
- cy: l / 2,
1060
- radius: l / 2,
1101
+ cx: f / 2,
1102
+ cy: f / 2,
1103
+ radius: f / 2,
1061
1104
  paint: {
1062
- fill: a,
1063
- stroke: f ? o : void 0,
1064
- strokeWidth: f
1105
+ fill: c,
1106
+ stroke: g ? l : void 0,
1107
+ strokeWidth: g,
1108
+ dash: _,
1109
+ dashEnabled: _ ? !0 : void 0
1065
1110
  }
1066
- }) : u.push({
1111
+ }) : p.push({
1067
1112
  type: "rect",
1068
1113
  x: 0,
1069
1114
  y: 0,
1070
- width: l,
1071
- height: l,
1072
- cornerRadius: r.roomShape === "roundedRectangle" ? l * .2 : 0,
1115
+ width: f,
1116
+ height: f,
1117
+ cornerRadius: n.roomShape === "roundedRectangle" ? f * .2 : 0,
1073
1118
  paint: {
1074
- fill: a,
1075
- stroke: f ? o : void 0,
1076
- strokeWidth: f
1119
+ fill: c,
1120
+ stroke: g ? l : void 0,
1121
+ strokeWidth: g,
1122
+ dash: _,
1123
+ dashEnabled: _ ? !0 : void 0
1077
1124
  }
1078
1125
  });
1079
- if (d && (u.push({
1126
+ if (h && (p.push({
1080
1127
  type: "line",
1081
- points: d.shadow.points,
1128
+ points: h.shadow.points,
1082
1129
  paint: {
1083
- stroke: d.shadow.stroke,
1084
- strokeWidth: d.shadow.strokeWidth
1130
+ stroke: h.shadow.stroke,
1131
+ strokeWidth: h.shadow.strokeWidth
1085
1132
  },
1086
- lineCap: d.shadow.lineCap,
1087
- lineJoin: d.shadow.lineJoin
1088
- }), u.push({
1133
+ lineCap: h.shadow.lineCap,
1134
+ lineJoin: h.shadow.lineJoin
1135
+ }), p.push({
1089
1136
  type: "line",
1090
- points: d.highlight.points,
1137
+ points: h.highlight.points,
1091
1138
  paint: {
1092
- stroke: d.highlight.stroke,
1093
- strokeWidth: d.highlight.strokeWidth
1139
+ stroke: h.highlight.stroke,
1140
+ strokeWidth: h.highlight.strokeWidth
1094
1141
  },
1095
- lineCap: d.highlight.lineCap,
1096
- lineJoin: d.shadow.lineJoin
1142
+ lineCap: h.highlight.lineCap,
1143
+ lineJoin: h.shadow.lineJoin
1097
1144
  })), e.roomChar) {
1098
- let t = l * .75, { baselineRatio: n, konvaCorrectionRatio: i } = ee(e.roomChar, r.fontFamily), a = Math.max(l, e.roomChar.length * t * .8), o = (a - l) / 2;
1099
- u.push({
1145
+ let t = f * .75, { baselineRatio: r, konvaCorrectionRatio: i } = oe(e.roomChar, n.fontFamily), a = Math.max(f, e.roomChar.length * t * .8), o = (a - f) / 2;
1146
+ p.push({
1100
1147
  type: "text",
1101
1148
  x: -o,
1102
1149
  y: 0,
1103
1150
  text: e.roomChar,
1104
1151
  fontSize: t,
1105
- fontFamily: r.fontFamily,
1152
+ fontFamily: n.fontFamily,
1106
1153
  fontStyle: "bold",
1107
- fill: c,
1154
+ fill: u,
1108
1155
  align: "center",
1109
1156
  verticalAlign: "middle",
1110
1157
  width: a,
1111
- height: l,
1112
- baselineRatio: n,
1158
+ height: f,
1159
+ baselineRatio: r,
1113
1160
  konvaCorrectionRatio: i
1114
1161
  });
1115
1162
  }
1116
1163
  return {
1117
1164
  type: "group",
1118
- x: e.x - l / 2,
1119
- y: e.y - l / 2,
1165
+ x: e.x - f / 2,
1166
+ y: e.y - f / 2,
1120
1167
  layer: "room",
1121
1168
  hit: {
1122
1169
  kind: "room",
1123
1170
  id: e.id,
1124
1171
  payload: e
1125
1172
  },
1126
- children: u
1173
+ children: p
1127
1174
  };
1128
1175
  }
1129
1176
  //#endregion
1130
1177
  //#region src/scene/InnerExitStyle.ts
1131
- var re = [
1178
+ var le = [
1132
1179
  "up",
1133
1180
  "down",
1134
1181
  "in",
1135
1182
  "out"
1136
1183
  ];
1137
- function ie(e, t, n, r) {
1184
+ function ue(e, t, n, r) {
1138
1185
  let i = r * Math.PI / 180, a = [];
1139
1186
  for (let r = 0; r < 3; r++) {
1140
1187
  let o = 2 * Math.PI * r / 3 - Math.PI / 2, s = Math.cos(o) * n * 1.4, c = Math.sin(o) * n * .8, l = s * Math.cos(i) - c * Math.sin(i), u = s * Math.sin(i) + c * Math.cos(i);
@@ -1142,50 +1189,50 @@ function ie(e, t, n, r) {
1142
1189
  }
1143
1190
  return a;
1144
1191
  }
1145
- function ae(e, t, n) {
1192
+ function de(e, t, n) {
1146
1193
  let r = e.userData?.["system.fallback_symbol_color"];
1147
1194
  return {
1148
1195
  symbolColor: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env)),
1149
1196
  symbolFill: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6))
1150
1197
  };
1151
1198
  }
1152
- var R = {
1199
+ var U = {
1153
1200
  1: "rgb(10, 155, 10)",
1154
1201
  2: "rgb(226, 205, 59)",
1155
1202
  3: "rgb(155, 10, 10)"
1156
1203
  };
1157
- function z(e, t, n) {
1204
+ function W(e, t, n) {
1158
1205
  let r = n.roomSize, i = r / 5, a = (e, t, n) => ({
1159
1206
  cx: e,
1160
1207
  cy: t,
1161
- vertices: ie(e, t, i, n)
1208
+ vertices: ue(e, t, i, n)
1162
1209
  });
1163
1210
  switch (t) {
1164
1211
  case "up": {
1165
- let t = b(e.x, e.y, "south", r / 4);
1212
+ let t = A(e.x, e.y, "south", r / 4);
1166
1213
  return [a(t.x, t.y, 0)];
1167
1214
  }
1168
1215
  case "down": {
1169
- let t = b(e.x, e.y, "north", r / 4);
1216
+ let t = A(e.x, e.y, "north", r / 4);
1170
1217
  return [a(t.x, t.y, 180)];
1171
1218
  }
1172
1219
  case "in": {
1173
- let t = b(e.x, e.y, "west", r / 4), n = b(e.x, e.y, "east", r / 4);
1220
+ let t = A(e.x, e.y, "west", r / 4), n = A(e.x, e.y, "east", r / 4);
1174
1221
  return [a(t.x, t.y, 90), a(n.x, n.y, -90)];
1175
1222
  }
1176
1223
  case "out": {
1177
- let t = b(e.x, e.y, "west", r / 4), n = b(e.x, e.y, "east", r / 4);
1224
+ let t = A(e.x, e.y, "west", r / 4), n = A(e.x, e.y, "east", r / 4);
1178
1225
  return [a(t.x, t.y, -90), a(n.x, n.y, 90)];
1179
1226
  }
1180
1227
  default: return [];
1181
1228
  }
1182
1229
  }
1183
- function oe(e, t, n) {
1184
- let r = [], { symbolColor: i, symbolFill: a } = ae(e, t, n);
1185
- for (let t of re) {
1230
+ function fe(e, t, n) {
1231
+ let r = [], { symbolColor: i, symbolFill: a } = de(e, t, n);
1232
+ for (let t of le) {
1186
1233
  if (!e.exits[t]) continue;
1187
- let o = e.doors[t], s = o === void 0 ? i : R[o] ?? R[3];
1188
- for (let i of z(e, t, n)) r.push({
1234
+ let o = e.doors[t], s = o === void 0 ? i : U[o] ?? U[3];
1235
+ for (let i of W(e, t, n)) r.push({
1189
1236
  cx: i.cx,
1190
1237
  cy: i.cy,
1191
1238
  vertices: i.vertices,
@@ -1198,8 +1245,8 @@ function oe(e, t, n) {
1198
1245
  }
1199
1246
  //#endregion
1200
1247
  //#region src/scene/elements/ExitLayout.ts
1201
- function B(e, t, n) {
1202
- let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } = oe(e, t, n);
1248
+ function G(e, t, n) {
1249
+ let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } = fe(e, t, n);
1203
1250
  return o.map((e) => {
1204
1251
  let t = Array(e.vertices.length);
1205
1252
  for (let n = 0; n < e.vertices.length; n += 2) t[n] = e.vertices[n] - i, t[n + 1] = e.vertices[n + 1] - a;
@@ -1214,7 +1261,7 @@ function B(e, t, n) {
1214
1261
  };
1215
1262
  });
1216
1263
  }
1217
- function V(e, t) {
1264
+ function pe(e, t) {
1218
1265
  let n = [];
1219
1266
  for (let t of e.lines) n.push({
1220
1267
  type: "line",
@@ -1225,7 +1272,7 @@ function V(e, t) {
1225
1272
  dash: t.dash
1226
1273
  }
1227
1274
  });
1228
- for (let t of e.arrows) se(n, t);
1275
+ for (let t of e.arrows) me(n, t);
1229
1276
  for (let t of e.doors) n.push({
1230
1277
  type: "rect",
1231
1278
  x: t.x,
@@ -1246,7 +1293,7 @@ function V(e, t) {
1246
1293
  children: n
1247
1294
  };
1248
1295
  }
1249
- function se(e, t) {
1296
+ function me(e, t) {
1250
1297
  e.push({
1251
1298
  type: "line",
1252
1299
  points: t.points,
@@ -1276,7 +1323,7 @@ function se(e, t) {
1276
1323
  }
1277
1324
  //#endregion
1278
1325
  //#region src/scene/elements/SpecialExitLayout.ts
1279
- function H(e, t) {
1326
+ function he(e, t) {
1280
1327
  let n = [];
1281
1328
  if (n.push({
1282
1329
  type: "line",
@@ -1337,7 +1384,7 @@ function H(e, t) {
1337
1384
  }
1338
1385
  //#endregion
1339
1386
  //#region src/scene/elements/StubLayout.ts
1340
- function U(e) {
1387
+ function K(e) {
1341
1388
  return {
1342
1389
  type: "group",
1343
1390
  x: 0,
@@ -1365,11 +1412,11 @@ function U(e) {
1365
1412
  }
1366
1413
  //#endregion
1367
1414
  //#region src/scene/elements/LabelLayout.ts
1368
- function W(e) {
1415
+ function ge(e) {
1369
1416
  let t = (e?.alpha ?? 255) / 255, n = (e) => Math.min(255, Math.max(0, e ?? 0));
1370
1417
  return `rgba(${n(e?.r)}, ${n(e?.g)}, ${n(e?.b)}, ${t})`;
1371
1418
  }
1372
- function ce(e, t) {
1419
+ function _e(e, t) {
1373
1420
  if (t.labelRenderMode === "none") return null;
1374
1421
  let n = e.X, r = -e.Y, i = !!e.noScaling, a = i ? n : 0, o = i ? r : 0, s = i ? 0 : n, c = i ? 0 : r;
1375
1422
  if (t.labelRenderMode === "image" && e.pixMap) return {
@@ -1398,7 +1445,7 @@ function ce(e, t) {
1398
1445
  y: c,
1399
1446
  width: e.Width,
1400
1447
  height: e.Height,
1401
- paint: { fill: W(e.BgColor) }
1448
+ paint: { fill: ge(e.BgColor) }
1402
1449
  }), e.Text) {
1403
1450
  let t = Math.min(.75, e.Width / Math.max(e.Text.length / 2, 1)), n = Math.max(.1, Math.min(t, Math.max(e.Height * .9, .1)));
1404
1451
  l.push({
@@ -1409,7 +1456,7 @@ function ce(e, t) {
1409
1456
  height: e.Height,
1410
1457
  text: e.Text,
1411
1458
  fontSize: n,
1412
- fill: W(e.FgColor),
1459
+ fill: ge(e.FgColor),
1413
1460
  align: "center",
1414
1461
  verticalAlign: "middle"
1415
1462
  });
@@ -1428,12 +1475,159 @@ function ce(e, t) {
1428
1475
  };
1429
1476
  }
1430
1477
  //#endregion
1478
+ //#region src/lens/hiddenAwareLens.ts
1479
+ function ve(e, t) {
1480
+ return t ? {
1481
+ isVisible: (t) => e.isVisible(t) && !d(t),
1482
+ getExitTreatment: (t, n, r) => d(n) || d(r) ? "hidden" : e.getExitTreatment ? e.getExitTreatment(t, n, r) : y(e, t, n, r),
1483
+ getVersion: () => e.getVersion()
1484
+ } : e;
1485
+ }
1486
+ //#endregion
1487
+ //#region src/scene/NeighborProjector.ts
1488
+ var ye = new Set(D);
1489
+ function q(e, t, n, r, i) {
1490
+ let a = t - e.x, o = n - e.y, s = e.customLines;
1491
+ if (s && Object.keys(s).length > 0 && (a !== 0 || o !== 0)) {
1492
+ s = {};
1493
+ for (let [t, n] of Object.entries(e.customLines)) s[t] = {
1494
+ ...n,
1495
+ points: n.points.map((e) => ({
1496
+ x: e.x + a,
1497
+ y: e.y - o
1498
+ }))
1499
+ };
1500
+ }
1501
+ return {
1502
+ ...e,
1503
+ x: t,
1504
+ y: n,
1505
+ area: r,
1506
+ z: i,
1507
+ customLines: s
1508
+ };
1509
+ }
1510
+ function be(e, t) {
1511
+ let n = (t) => !!(e.customLines[t] || e.customLines[T[t]]);
1512
+ for (let [r, i] of Object.entries(e.exits ?? {})) if (i === t.id && n(r)) return !0;
1513
+ for (let [r, i] of Object.entries(e.specialExits ?? {})) if (i === t.id && n(r)) return !0;
1514
+ return !1;
1515
+ }
1516
+ var xe = 2;
1517
+ function Se(e, t, n, r, i, a = () => !0) {
1518
+ let o = e.getRoom(r);
1519
+ if (!o || i <= 0) return;
1520
+ let s = /* @__PURE__ */ new Map();
1521
+ s.set(o.id, {
1522
+ x: o.x,
1523
+ y: o.y
1524
+ });
1525
+ let c = [{
1526
+ id: o.id,
1527
+ x: o.x,
1528
+ y: o.y,
1529
+ depth: 0
1530
+ }], l = [], u = [];
1531
+ for (; c.length > 0;) {
1532
+ let r = c.shift();
1533
+ if (r.depth >= i) continue;
1534
+ let o = e.getRoom(r.id);
1535
+ if (!o) continue;
1536
+ let u = [...Object.entries(o.exits ?? {}).map(([e, t]) => ({
1537
+ targetId: t,
1538
+ dir: e
1539
+ })), ...Object.values(o.specialExits ?? {}).map((e) => ({ targetId: e }))];
1540
+ for (let { targetId: i, dir: d } of u) {
1541
+ let u = e.getRoom(i);
1542
+ if (!u || s.has(u.id)) continue;
1543
+ let f = u.area === o.area, p, m;
1544
+ if (f) p = r.x + (u.x - o.x), m = r.y + (u.y - o.y);
1545
+ else {
1546
+ if (!d) continue;
1547
+ let e = A(r.x, r.y, d, xe);
1548
+ if (e.x === r.x && e.y === r.y) continue;
1549
+ p = e.x, m = e.y;
1550
+ }
1551
+ s.set(u.id, {
1552
+ x: p,
1553
+ y: m
1554
+ }), c.push({
1555
+ id: u.id,
1556
+ x: p,
1557
+ y: m,
1558
+ depth: r.depth + 1
1559
+ }), u.area !== t && u.z === n && a(u) && l.push(u.id);
1560
+ }
1561
+ }
1562
+ if (l.length === 0) return;
1563
+ let d = l.map((t) => {
1564
+ let n = s.get(t);
1565
+ return {
1566
+ room: e.getRoom(t),
1567
+ x: n.x,
1568
+ y: n.y
1569
+ };
1570
+ }), f = /* @__PURE__ */ new Set();
1571
+ for (let [r, i] of s) {
1572
+ let o = e.getRoom(r);
1573
+ if (!o || o.z !== n || !a(o)) continue;
1574
+ let c = o.area !== t, l = [...Object.entries(o.exits ?? {}).filter(([e]) => ye.has(e)).map(([, e]) => e), ...Object.values(o.specialExits ?? {})];
1575
+ for (let d of l) {
1576
+ let l = s.get(d);
1577
+ if (!l) continue;
1578
+ let p = e.getRoom(d);
1579
+ if (!p || p.z !== n || !a(p) || !c && p.area === t || be(o, p) || be(p, o)) continue;
1580
+ let m = r < d ? `${r}-${d}` : `${d}-${r}`;
1581
+ f.has(m) || (f.add(m), u.push({
1582
+ ax: i.x,
1583
+ ay: i.y,
1584
+ bx: l.x,
1585
+ by: l.y
1586
+ }));
1587
+ }
1588
+ }
1589
+ return {
1590
+ rooms: d,
1591
+ edges: u
1592
+ };
1593
+ }
1594
+ var Ce = class {
1595
+ constructor(e, t, n, r) {
1596
+ this.base = e, this.currentArea = t, this.currentZ = n, this.projected = r;
1597
+ }
1598
+ getRoom(e) {
1599
+ let t = this.base.getRoom(e), n = t ? this.projected.get(e) : void 0;
1600
+ return n ? q(t, n.x, n.y, this.currentArea, this.currentZ) : t;
1601
+ }
1602
+ getArea(e) {
1603
+ return this.base.getArea(e);
1604
+ }
1605
+ getAreas() {
1606
+ return this.base.getAreas();
1607
+ }
1608
+ getRooms() {
1609
+ return this.base.getRooms();
1610
+ }
1611
+ getColorValue(e) {
1612
+ return this.base.getColorValue(e);
1613
+ }
1614
+ getSymbolColor(e, t) {
1615
+ return this.base.getSymbolColor(e, t);
1616
+ }
1617
+ };
1618
+ function we(e) {
1619
+ return new Map(e.rooms.map((e) => [e.room.id, {
1620
+ x: e.x,
1621
+ y: e.y
1622
+ }]));
1623
+ }
1624
+ //#endregion
1431
1625
  //#region src/ScenePipeline.ts
1432
- function le(e, t) {
1433
- let n = G(e);
1626
+ function Te(e, t) {
1627
+ let n = J(e);
1434
1628
  return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${t})` : e;
1435
1629
  }
1436
- function G(e) {
1630
+ function J(e) {
1437
1631
  let t = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
1438
1632
  if (t) return {
1439
1633
  r: +t[1],
@@ -1446,11 +1640,11 @@ function G(e) {
1446
1640
  b: parseInt(e.slice(5, 7), 16)
1447
1641
  };
1448
1642
  }
1449
- function ue(e, t, n) {
1450
- let r = G(e), i = G(t);
1643
+ function Ee(e, t, n) {
1644
+ let r = J(e), i = J(t);
1451
1645
  return !r || !i ? e : `rgb(${Math.round(r.r * n + i.r * (1 - n))}, ${Math.round(r.g * n + i.g * (1 - n))}, ${Math.round(r.b * n + i.b * (1 - n))})`;
1452
1646
  }
1453
- function de(e, t) {
1647
+ function De(e, t) {
1454
1648
  let n = t * t, r = [];
1455
1649
  outer: for (let t of e) {
1456
1650
  for (let e of r) for (let r of e) {
@@ -1464,33 +1658,33 @@ function de(e, t) {
1464
1658
  }
1465
1659
  return r;
1466
1660
  }
1467
- var fe = class {
1661
+ var Oe = class {
1468
1662
  constructor(e, t) {
1469
- this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new T(e, t);
1470
- }
1471
- buildScene(e, t, n, r = s) {
1472
- this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.renderLabels(t.getLabels(), e.getAreaId());
1473
- let i = this.renderLinkExits(e.getLinkExits(n), n, r), a = (t.getRooms() ?? []).filter((e) => r.isVisible(e)), o = this.renderRooms(a, n);
1474
- this.renderAreaName(e, t);
1475
- let c = [...i.areaExitHitZones, ...o.areaExitHitZones], l = this.renderAreaExitLabels(c, e.getAreaId(), a, i.standaloneExitShapeRefs.map((e) => e.bounds));
1476
- c.push(...l);
1477
- let u = [
1663
+ this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.spilledRoomIds = /* @__PURE__ */ new Set(), this.mapReader = e, this.settings = t, this.exitRenderer = new F(e, t);
1664
+ }
1665
+ buildScene(e, t, n, r = v, i) {
1666
+ this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.spilledRoomIds = i ? new Set(i.rooms.map((e) => e.room.id)) : /* @__PURE__ */ new Set(), this.renderLabels(t.getLabels(), e.getAreaId());
1667
+ let a = this.settings.hiddenRooms === "hide", o = ve(r, a), s = this.renderLinkExits(e.getLinkExits(n), n, o), c = (t.getRooms() ?? []).filter((e) => o.isVisible(e)), l = i ? i.rooms.filter((e) => !(a && d(e.room))).map((t) => q(t.room, t.x, t.y, e.getAreaId(), n)) : [], u = this.renderRooms([...c, ...l], n);
1668
+ i && this.renderSpillConnectors(i), this.renderAreaName(e, t);
1669
+ let f = [...s.areaExitHitZones, ...u.areaExitHitZones], p = this.renderAreaExitLabels(f, e.getAreaId(), c, s.standaloneExitShapeRefs.map((e) => e.bounds));
1670
+ f.push(...p);
1671
+ let m = [
1478
1672
  ...this.linkShapes,
1479
1673
  ...this.roomShapes,
1480
1674
  ...this.topLabelShapes
1481
1675
  ];
1482
1676
  return {
1483
- roomShapeRefs: o.roomShapeRefs,
1484
- standaloneExitShapeRefs: i.standaloneExitShapeRefs,
1677
+ roomShapeRefs: u.roomShapeRefs,
1678
+ standaloneExitShapeRefs: s.standaloneExitShapeRefs,
1485
1679
  labelShapeRefs: this.labelShapeRefs,
1486
1680
  specialExitShapeRefs: this.specialExitShapeRefs,
1487
1681
  stubShapeRefs: this.stubShapeRefs,
1488
1682
  areaExitLabelShapeRefs: this.areaExitLabelShapeRefs,
1489
- areaExitHitZones: c,
1490
- drawnExits: i.drawnExits,
1491
- drawnSpecialExits: o.drawnSpecialExits,
1492
- drawnStubs: o.drawnStubs,
1493
- hitShapes: u,
1683
+ areaExitHitZones: f,
1684
+ drawnExits: s.drawnExits,
1685
+ drawnSpecialExits: u.drawnSpecialExits,
1686
+ drawnStubs: u.drawnStubs,
1687
+ hitShapes: m,
1494
1688
  sceneShapes: {
1495
1689
  grid: [],
1496
1690
  link: this.linkShapes,
@@ -1505,10 +1699,13 @@ var fe = class {
1505
1699
  renderRooms(e, t) {
1506
1700
  let n = /* @__PURE__ */ new Map(), r = [], i = [], a = [], o = [];
1507
1701
  e.forEach((e) => {
1508
- let t = L(e, this.mapReader, this.settings, { flatPipeline: !0 });
1509
- t.children.push(...B(e, this.mapReader, this.settings));
1510
- for (let t of A(e, this.settings)) {
1511
- let n = H(t, e.id);
1702
+ let t = H(e, this.mapReader, this.settings, {
1703
+ flatPipeline: !0,
1704
+ ...h(e, this.settings.hiddenRooms)
1705
+ });
1706
+ t.children.push(...G(e, this.mapReader, this.settings));
1707
+ for (let t of I(e, this.settings)) {
1708
+ let n = he(t, e.id);
1512
1709
  this.linkShapes.push(n);
1513
1710
  let r = t.line.points, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
1514
1711
  for (let e = 0; e < r.length; e += 2) r[e] < a && (a = r[e]), r[e] > s && (s = r[e]), r[e + 1] < o && (o = r[e + 1]), r[e + 1] > c && (c = r[e + 1]);
@@ -1536,8 +1733,8 @@ var fe = class {
1536
1733
  bounds: l
1537
1734
  });
1538
1735
  }
1539
- this.exitRenderer.getSpecialExitAreaTargets(e).forEach((e) => {
1540
- r.push({
1736
+ this.spilledRoomIds.has(e.id) || (this.exitRenderer.getSpecialExitAreaTargets(e).forEach((e) => {
1737
+ this.spilledRoomIds.has(e.targetRoomId) || r.push({
1541
1738
  bounds: e.bounds,
1542
1739
  targetRoomId: e.targetRoomId,
1543
1740
  from: e.from,
@@ -1545,16 +1742,16 @@ var fe = class {
1545
1742
  arrowColor: e.arrowColor
1546
1743
  });
1547
1744
  }), this.exitRenderer.getInnerExitAreaTargets(e).forEach((e) => {
1548
- r.push({
1745
+ this.spilledRoomIds.has(e.targetRoomId) || r.push({
1549
1746
  bounds: e.bounds,
1550
1747
  targetRoomId: e.targetRoomId,
1551
1748
  from: e.from,
1552
1749
  tip: e.tip,
1553
1750
  arrowColor: e.arrowColor
1554
1751
  });
1555
- });
1556
- for (let t of O(e, this.settings)) {
1557
- let e = U(t);
1752
+ }));
1753
+ for (let t of re(e, this.settings)) {
1754
+ let e = K(t);
1558
1755
  this.linkShapes.push(e), a.push({
1559
1756
  roomId: t.roomId,
1560
1757
  direction: t.direction,
@@ -1587,21 +1784,37 @@ var fe = class {
1587
1784
  drawnStubs: a
1588
1785
  };
1589
1786
  }
1787
+ renderSpillConnectors(e) {
1788
+ for (let t of e.edges) this.linkShapes.push({
1789
+ type: "line",
1790
+ layer: "link",
1791
+ points: [
1792
+ t.ax,
1793
+ t.ay,
1794
+ t.bx,
1795
+ t.by
1796
+ ],
1797
+ paint: {
1798
+ stroke: this.settings.lineColor,
1799
+ strokeWidth: this.settings.lineWidth
1800
+ }
1801
+ });
1802
+ }
1590
1803
  renderLinkExits(e, t, n) {
1591
1804
  let r = [], i = [], a = [];
1592
1805
  return e.forEach((e) => {
1593
1806
  let o = this.mapReader.getRoom(e.a), s = this.mapReader.getRoom(e.b);
1594
1807
  if (!o || !s) return;
1595
- let l = n.getExitTreatment ? n.getExitTreatment(e, o, s) : c(n, e, o, s);
1596
- if (l === "hidden") return;
1597
- if (l === "stub") {
1808
+ let c = n.getExitTreatment ? n.getExitTreatment(e, o, s) : y(n, e, o, s);
1809
+ if (c === "hidden") return;
1810
+ if (c === "stub") {
1598
1811
  let t = this.buildLensStub(e, o, s, n);
1599
1812
  t && this.emitLensStub(t);
1600
1813
  return;
1601
1814
  }
1602
- let u = this.exitRenderer.renderData(e, t);
1603
- if (!u) return;
1604
- let d = V(u, {
1815
+ let l = this.exitRenderer.renderData(e, t);
1816
+ if (!l || l.targetRoomId !== void 0 && this.spilledRoomIds.has(l.targetRoomId)) return;
1817
+ let u = pe(l, {
1605
1818
  kind: "exit",
1606
1819
  id: `${e.a}:${e.b}:${e.aDir ?? ""}:${e.bDir ?? ""}`,
1607
1820
  payload: {
@@ -1612,10 +1825,10 @@ var fe = class {
1612
1825
  kind: e.kind ?? "exit"
1613
1826
  }
1614
1827
  });
1615
- this.linkShapes.push(d), r.push({
1616
- shape: d,
1617
- bounds: u.bounds,
1618
- targetRoomId: u.targetRoomId
1828
+ this.linkShapes.push(u), r.push({
1829
+ shape: u,
1830
+ bounds: l.bounds,
1831
+ targetRoomId: l.targetRoomId
1619
1832
  }), a.push({
1620
1833
  a: e.a,
1621
1834
  b: e.b,
@@ -1623,13 +1836,13 @@ var fe = class {
1623
1836
  bDir: e.bDir,
1624
1837
  kind: e.kind ?? "exit",
1625
1838
  zIndex: e.zIndex,
1626
- data: u
1627
- }), u.targetRoomId !== void 0 && i.push({
1628
- bounds: u.bounds,
1629
- targetRoomId: u.targetRoomId,
1630
- from: u.from,
1631
- tip: u.tip,
1632
- arrowColor: u.arrowColor
1839
+ data: l
1840
+ }), l.targetRoomId !== void 0 && i.push({
1841
+ bounds: l.bounds,
1842
+ targetRoomId: l.targetRoomId,
1843
+ from: l.from,
1844
+ tip: l.tip,
1845
+ arrowColor: l.arrowColor
1633
1846
  });
1634
1847
  }), {
1635
1848
  standaloneExitShapeRefs: r,
@@ -1641,8 +1854,8 @@ var fe = class {
1641
1854
  let i = r.isVisible(t);
1642
1855
  if (i === r.isVisible(n)) return;
1643
1856
  let a = i ? t : n, o = i ? e.aDir : e.bDir;
1644
- if (!o || !p.includes(o) || a.customLines[h[o]]) return;
1645
- let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l = b(a.x, a.y, o, s / 2 + .5);
1857
+ if (!o || !C.includes(o) || a.customLines[T[o]]) return;
1858
+ let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l = A(a.x, a.y, o, s / 2 + .5);
1646
1859
  return {
1647
1860
  roomId: a.id,
1648
1861
  direction: o,
@@ -1655,7 +1868,7 @@ var fe = class {
1655
1868
  };
1656
1869
  }
1657
1870
  emitLensStub(e) {
1658
- let t = U(e);
1871
+ let t = K(e);
1659
1872
  this.linkShapes.push(t), this.stubShapeRefs.push({
1660
1873
  shape: t,
1661
1874
  bounds: {
@@ -1667,14 +1880,14 @@ var fe = class {
1667
1880
  });
1668
1881
  }
1669
1882
  getRoomEdgePoint(e, t, n, r) {
1670
- return this.settings.roomShape === "circle" ? S(e, t, n, r) : this.settings.roomShape === "roundedRectangle" ? x(e, t, n, r, this.settings.roomSize * .2) : b(e, t, n, r);
1883
+ return this.settings.roomShape === "circle" ? M(e, t, n, r) : this.settings.roomShape === "roundedRectangle" ? j(e, t, n, r, this.settings.roomSize * .2) : A(e, t, n, r);
1671
1884
  }
1672
1885
  buildExitShape(e) {
1673
- return V(e);
1886
+ return pe(e);
1674
1887
  }
1675
1888
  renderLabels(e, t) {
1676
1889
  for (let n of e) {
1677
- let e = ce(n, this.settings);
1890
+ let e = _e(n, this.settings);
1678
1891
  e && (e.hit = {
1679
1892
  kind: "label",
1680
1893
  id: n.labelId,
@@ -1724,7 +1937,7 @@ var fe = class {
1724
1937
  }, y = (e, t, n, r, i) => {
1725
1938
  for (let a of i) if (e < a.x + a.width && e + n > a.x && t < a.y + a.height && t + r > a.y) return !0;
1726
1939
  return !1;
1727
- }, b = [
1940
+ }, ee = [
1728
1941
  [0, 1],
1729
1942
  [0, -1],
1730
1943
  [1, 0],
@@ -1733,53 +1946,53 @@ var fe = class {
1733
1946
  [-.707, .707],
1734
1947
  [.707, -.707],
1735
1948
  [-.707, -.707]
1736
- ], x = (e, t, n) => {
1737
- let r = t.length * u + c * 2, a = d + l * 2, o = 0, s = 0, f = 0, p = 0, m = Infinity, h = -Infinity, v = Infinity, x = -Infinity, S = /* @__PURE__ */ new Map();
1738
- for (let t of e) o += t.tip.x, s += t.tip.y, f += t.dir.x, p += t.dir.y, t.tip.x < m && (m = t.tip.x), t.tip.x > h && (h = t.tip.x), t.tip.y < v && (v = t.tip.y), t.tip.y > x && (x = t.tip.y), S.set(t.color, (S.get(t.color) ?? 0) + 1);
1739
- let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0, E = w > 0 ? p / w : 0, D = 0;
1949
+ ], b = (e, t, n) => {
1950
+ let r = t.length * u + c * 2, a = d + l * 2, o = 0, s = 0, f = 0, p = 0, m = Infinity, h = -Infinity, v = Infinity, b = -Infinity, x = /* @__PURE__ */ new Map();
1951
+ for (let t of e) o += t.tip.x, s += t.tip.y, f += t.dir.x, p += t.dir.y, t.tip.x < m && (m = t.tip.x), t.tip.x > h && (h = t.tip.x), t.tip.y < v && (v = t.tip.y), t.tip.y > b && (b = t.tip.y), x.set(t.color, (x.get(t.color) ?? 0) + 1);
1952
+ let S = e.length, C = Math.hypot(f, p), w = C > 0 ? f / C : 0, T = C > 0 ? p / C : 0, E = 0;
1740
1953
  for (let t = 0; t < e.length; t++) for (let n = t + 1; n < e.length; n++) {
1741
1954
  let r = e[t].tip.x - e[n].tip.x, i = e[t].tip.y - e[n].tip.y, a = Math.hypot(r, i);
1742
- a > D && (D = a);
1955
+ a > E && (E = a);
1743
1956
  }
1744
- let O = D > 3, k = w / C >= .4, A = n?.x ?? (O ? (m + h) / 2 : o / C), j = n?.y ?? (O ? (v + x) / 2 : s / C), M = "white", N = 0;
1745
- for (let [e, t] of S) t > N && (M = e, N = t);
1746
- let P = g.concat(_).concat(i), F = (e, t, n = 0) => .5 + n + Math.abs(e) * r / 2 + Math.abs(t) * a / 2, I = [];
1747
- if (k) {
1748
- let e = F(T, E);
1749
- I.push({
1750
- x: A + T * e,
1751
- y: j + E * e
1957
+ let D = E > 3, O = C / S >= .4, k = n?.x ?? (D ? (m + h) / 2 : o / S), A = n?.y ?? (D ? (v + b) / 2 : s / S), j = "white", M = 0;
1958
+ for (let [e, t] of x) t > M && (j = e, M = t);
1959
+ let N = g.concat(_).concat(i), P = (e, t, n = 0) => .5 + n + Math.abs(e) * r / 2 + Math.abs(t) * a / 2, F = [];
1960
+ if (O) {
1961
+ let e = P(w, T);
1962
+ F.push({
1963
+ x: k + w * e,
1964
+ y: A + T * e
1752
1965
  });
1753
1966
  }
1754
- I.push({
1755
- x: A,
1756
- y: j
1967
+ F.push({
1968
+ x: k,
1969
+ y: A
1757
1970
  });
1758
1971
  for (let e of [
1759
1972
  0,
1760
1973
  .6,
1761
1974
  1.4
1762
- ]) for (let [t, n] of b) {
1763
- let r = F(t, n, e);
1764
- I.push({
1765
- x: A + t * r,
1766
- y: j + n * r
1975
+ ]) for (let [t, n] of ee) {
1976
+ let r = P(t, n, e);
1977
+ F.push({
1978
+ x: k + t * r,
1979
+ y: A + n * r
1767
1980
  });
1768
1981
  }
1769
- for (let t of I) {
1982
+ for (let t of F) {
1770
1983
  let n = t.x - r / 2, i = t.y - a / 2;
1771
- if (!y(n, i, r, a, P)) return {
1984
+ if (!y(n, i, r, a, N)) return {
1772
1985
  cluster: e,
1773
1986
  boxX: n,
1774
1987
  boxY: i,
1775
1988
  boxW: r,
1776
1989
  boxH: a,
1777
- color: M
1990
+ color: j
1778
1991
  };
1779
1992
  }
1780
1993
  };
1781
1994
  for (let [e, n] of o) {
1782
- let r = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, i = de(n, 10).map((e) => x(e, r)).filter((e) => e !== void 0), o = !0;
1995
+ let r = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, i = De(n, 10).map((e) => b(e, r)).filter((e) => e !== void 0), o = !0;
1783
1996
  for (; o && i.length > 1;) {
1784
1997
  o = !1;
1785
1998
  outer: for (let e = 0; e < i.length; e++) for (let t = e + 1; t < i.length; t++) {
@@ -1795,17 +2008,17 @@ var fe = class {
1795
2008
  h: i[t].boxH
1796
2009
  };
1797
2010
  if (v(n, a, 2)) {
1798
- let s = [...i[e].cluster, ...i[t].cluster], c = x(s, r, {
2011
+ let s = [...i[e].cluster, ...i[t].cluster], c = b(s, r, {
1799
2012
  x: (n.x + n.w / 2 + a.x + a.w / 2) / 2,
1800
2013
  y: (n.y + n.h / 2 + a.y + a.h / 2) / 2
1801
- }) ?? x(s, r);
2014
+ }) ?? b(s, r);
1802
2015
  c ? (i[e] = c, i.splice(t, 1)) : (i.splice(t, 1), i.splice(e, 1)), o = !0;
1803
2016
  break outer;
1804
2017
  }
1805
2018
  }
1806
2019
  }
1807
2020
  for (let e of i) {
1808
- let n = le(e.color, p), i = t(ue(e.color, this.settings.backgroundColor, p)) > .55 ? "#000" : "#fff", o = {
2021
+ let n = Te(e.color, p), i = t(Ee(e.color, this.settings.backgroundColor, p)) > .55 ? "#000" : "#fff", o = {
1809
2022
  type: "group",
1810
2023
  x: 0,
1811
2024
  y: 0,
@@ -1878,7 +2091,7 @@ var fe = class {
1878
2091
  };
1879
2092
  this.roomShapes.push(i);
1880
2093
  }
1881
- }, pe = class {
2094
+ }, ke = class {
1882
2095
  setCursor(e) {
1883
2096
  this.container.dataset.editorCursor || (this.container.style.cursor = e);
1884
2097
  }
@@ -2070,20 +2283,20 @@ var fe = class {
2070
2283
  emitMapClickEvent() {
2071
2284
  this.events.emit("mapclick", void 0);
2072
2285
  }
2073
- }, K = [
2286
+ }, Y = [
2074
2287
  "up",
2075
2288
  "down",
2076
2289
  "in",
2077
2290
  "out"
2078
2291
  ];
2079
- function q(e, t, n, r, i) {
2080
- return e.roomShape === "circle" ? S(t, n, r, i) : e.roomShape === "roundedRectangle" ? x(t, n, r, i, e.roomSize * .2) : b(t, n, r, i);
2292
+ function X(e, t, n, r, i) {
2293
+ return e.roomShape === "circle" ? M(t, n, r, i) : e.roomShape === "roundedRectangle" ? j(t, n, r, i, e.roomSize * .2) : A(t, n, r, i);
2081
2294
  }
2082
- function me(e, t, n) {
2295
+ function Ae(e, t, n) {
2083
2296
  for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
2084
2297
  let r = e;
2085
- if (K.includes(r)) {
2086
- let e = h[r];
2298
+ if (Y.includes(r)) {
2299
+ let e = T[r];
2087
2300
  return {
2088
2301
  type: "inner",
2089
2302
  fromDir: r,
@@ -2092,7 +2305,7 @@ function me(e, t, n) {
2092
2305
  toRoom: n
2093
2306
  };
2094
2307
  }
2095
- let i = h[r];
2308
+ let i = T[r];
2096
2309
  return t.customLines[i] ? {
2097
2310
  type: "special",
2098
2311
  fromDir: r,
@@ -2108,7 +2321,7 @@ function me(e, t, n) {
2108
2321
  } : {
2109
2322
  type: "regular",
2110
2323
  fromDir: r,
2111
- toDir: he(n, t.id),
2324
+ toDir: je(n, t.id),
2112
2325
  fromRoom: t,
2113
2326
  toRoom: n
2114
2327
  };
@@ -2125,8 +2338,8 @@ function me(e, t, n) {
2125
2338
  };
2126
2339
  for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
2127
2340
  let r = e;
2128
- if (K.includes(r)) {
2129
- let e = h[r];
2341
+ if (Y.includes(r)) {
2342
+ let e = T[r];
2130
2343
  return {
2131
2344
  type: "inner",
2132
2345
  toDir: r,
@@ -2135,7 +2348,7 @@ function me(e, t, n) {
2135
2348
  toRoom: n
2136
2349
  };
2137
2350
  }
2138
- let i = h[r];
2351
+ let i = T[r];
2139
2352
  return n.customLines[i] ? {
2140
2353
  type: "special",
2141
2354
  toDir: r,
@@ -2171,39 +2384,39 @@ function me(e, t, n) {
2171
2384
  toRoom: n
2172
2385
  };
2173
2386
  }
2174
- function he(e, t) {
2387
+ function je(e, t) {
2175
2388
  for (let [n, r] of Object.entries(e.exits)) if (r === t) return n;
2176
2389
  }
2177
- function J(e, t, n) {
2390
+ function Me(e, t, n) {
2178
2391
  return e ? e.area === t && e.z === n : !1;
2179
2392
  }
2180
- function ge(e, t) {
2393
+ function Ne(e, t) {
2181
2394
  for (let [n, r] of Object.entries(e.exits)) if (r === t.id) return { direction: n };
2182
2395
  for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
2183
2396
  }
2184
- function _e(e, t) {
2185
- for (let n of _) if (e.exits[n] === t.id) return n;
2186
- for (let n of _) if (t.exits[n] === e.id) return v[n];
2397
+ function Pe(e, t) {
2398
+ for (let n of D) if (e.exits[n] === t.id) return n;
2399
+ for (let n of D) if (t.exits[n] === e.id) return O[n];
2187
2400
  }
2188
- function ve(e, t, n) {
2401
+ function Fe(e, t, n) {
2189
2402
  let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
2190
- if (n.length === 0 && n.push(r.x, r.y), a && p.includes(a)) {
2191
- let t = q(e, r.x, r.y, a, e.roomSize / 2);
2403
+ if (n.length === 0 && n.push(r.x, r.y), a && C.includes(a)) {
2404
+ let t = X(e, r.x, r.y, a, e.roomSize / 2);
2192
2405
  n.push(t.x, t.y);
2193
2406
  }
2194
- if (o && p.includes(o)) {
2195
- let t = q(e, i.x, i.y, o, e.roomSize / 2);
2407
+ if (o && C.includes(o)) {
2408
+ let t = X(e, i.x, i.y, o, e.roomSize / 2);
2196
2409
  n.push(t.x, t.y);
2197
2410
  }
2198
2411
  n.push(i.x, i.y);
2199
2412
  }
2200
- function ye(e, t) {
2413
+ function Ie(e, t) {
2201
2414
  let { fromRoom: n, toRoom: r, customLineKey: i } = e, a = n, o;
2202
2415
  i && (o = n.customLines[i], o || (o = r.customLines[i], a = r)), t.length === 0 && t.push(a.x, a.y), o && o.points.forEach((e) => {
2203
2416
  t.push(e.x, -e.y);
2204
2417
  }), t.push(r.x, r.y);
2205
2418
  }
2206
- function Y(e, t, n, r, i) {
2419
+ function Le(e, t, n, r, i) {
2207
2420
  let a = [], o = [], s = [], c = n.map((t) => e.getRoom(t)).filter((e) => e !== void 0), l = [], u = () => {
2208
2421
  l.length >= 4 && a.push({ points: [...l] }), l = [];
2209
2422
  }, d = (e) => {
@@ -2217,28 +2430,28 @@ function Y(e, t, n, r, i) {
2217
2430
  }), s.push({ points: t });
2218
2431
  }
2219
2432
  }
2220
- r && K.includes(r) && o.push({
2433
+ r && Y.includes(r) && o.push({
2221
2434
  room: t,
2222
2435
  direction: r
2223
- }), i && K.includes(i) && o.push({
2436
+ }), i && Y.includes(i) && o.push({
2224
2437
  room: n,
2225
2438
  direction: i
2226
2439
  });
2227
2440
  };
2228
2441
  for (let n = 0; n < c.length - 1; n++) {
2229
- let a = c[n], s = c[n + 1], f = J(a, r, i), m = J(s, r, i);
2230
- if (!f && !m) {
2442
+ let a = c[n], s = c[n + 1], f = Me(a, r, i), p = Me(s, r, i);
2443
+ if (!f && !p) {
2231
2444
  u();
2232
2445
  continue;
2233
2446
  }
2234
- if (f && m) {
2235
- let n = me(e, a, s);
2447
+ if (f && p) {
2448
+ let n = Ae(e, a, s);
2236
2449
  switch (n.type) {
2237
2450
  case "regular":
2238
- ve(t, n, l);
2451
+ Fe(t, n, l);
2239
2452
  break;
2240
2453
  case "special":
2241
- ye(n, l);
2454
+ Ie(n, l);
2242
2455
  break;
2243
2456
  case "inner":
2244
2457
  u(), d(n);
@@ -2248,22 +2461,22 @@ function Y(e, t, n, r, i) {
2248
2461
  break;
2249
2462
  }
2250
2463
  } else {
2251
- let e = f ? a : s, n = f ? s : a, r = ge(e, n);
2464
+ let e = f ? a : s, n = f ? s : a, r = Ne(e, n);
2252
2465
  if (r) {
2253
- if (K.includes(r.direction)) u(), o.push({
2466
+ if (Y.includes(r.direction)) u(), o.push({
2254
2467
  room: e,
2255
2468
  direction: r.direction
2256
2469
  });
2257
- else if (p.includes(r.direction)) {
2470
+ else if (C.includes(r.direction)) {
2258
2471
  l.length === 0 && l.push(e.x, e.y);
2259
- let n = q(t, e.x, e.y, r.direction, t.roomSize / 2), i = b(e.x, e.y, r.direction, t.roomSize);
2472
+ let n = X(t, e.x, e.y, r.direction, t.roomSize / 2), i = A(e.x, e.y, r.direction, t.roomSize);
2260
2473
  l.push(n.x, n.y, i.x, i.y), u();
2261
2474
  }
2262
2475
  } else {
2263
- let r = _e(e, n);
2476
+ let r = Pe(e, n);
2264
2477
  if (r) {
2265
2478
  l.length === 0 && l.push(e.x, e.y);
2266
- let n = q(t, e.x, e.y, r, t.roomSize / 2), i = b(e.x, e.y, r, t.roomSize);
2479
+ let n = X(t, e.x, e.y, r, t.roomSize / 2), i = A(e.x, e.y, r, t.roomSize);
2267
2480
  l.push(n.x, n.y, i.x, i.y), u();
2268
2481
  }
2269
2482
  }
@@ -2277,12 +2490,12 @@ function Y(e, t, n, r, i) {
2277
2490
  }
2278
2491
  //#endregion
2279
2492
  //#region src/scene/OverlayStyle.ts
2280
- function be(e, t) {
2493
+ function Re(e, t) {
2281
2494
  let n = e.shape ?? "match";
2282
2495
  return n === "match" ? (e.matchRoomShape ?? !0) && t !== "circle" ? t === "roundedRectangle" ? "roundedRectangle" : "rectangle" : "circle" : n;
2283
2496
  }
2284
- function X(e, t, n) {
2285
- let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = be(r, n.roomShape), s = Array.isArray(t) ? t.length > 0 ? [...t] : ["#ffffff"] : [t];
2497
+ function ze(e, t, n) {
2498
+ let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = Re(r, n.roomShape), s = Array.isArray(t) ? t.length > 0 ? [...t] : ["#ffffff"] : [t];
2286
2499
  return {
2287
2500
  shape: o === "circle" ? "circle" : "rect",
2288
2501
  cx: e.x,
@@ -2297,7 +2510,7 @@ function X(e, t, n) {
2297
2510
  dashEnabled: r.dashEnabled
2298
2511
  };
2299
2512
  }
2300
- function xe(e, t) {
2513
+ function Be(e, t) {
2301
2514
  let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
2302
2515
  return {
2303
2516
  shape: i ? "rect" : "circle",
@@ -2314,12 +2527,12 @@ function xe(e, t) {
2314
2527
  dashEnabled: n.dashEnabled
2315
2528
  };
2316
2529
  }
2317
- function Z(e, t, n, r, i, a) {
2318
- let o = Y(e, t, n, i, a), s = t.lineWidth, c = [];
2530
+ function Ve(e, t, n, r, i, a) {
2531
+ let o = Le(e, t, n, i, a), s = t.lineWidth, c = [];
2319
2532
  for (let e of o.segments) e.points.length >= 4 && c.push({ points: e.points });
2320
2533
  for (let e of o.customLines) e.points.length >= 4 && c.push({ points: e.points });
2321
2534
  let l = [];
2322
- for (let e of o.innerMarkers) for (let n of z(e.room, e.direction, t)) l.push({ vertices: n.vertices });
2535
+ for (let e of o.innerMarkers) for (let n of W(e.room, e.direction, t)) l.push({ vertices: n.vertices });
2323
2536
  return {
2324
2537
  segments: c,
2325
2538
  triangles: l,
@@ -2330,9 +2543,9 @@ function Z(e, t, n, r, i, a) {
2330
2543
  }
2331
2544
  //#endregion
2332
2545
  //#region src/scene/elements/OverlayLayout.ts
2333
- function Se(e) {
2334
- if (e.colors.length > 1) return Ce(e);
2335
- let t = e.colors[0], n = a(t, e.strokeAlpha), r = e.fillAlpha > 0 ? a(t, e.fillAlpha) : void 0;
2546
+ function He(e) {
2547
+ if (e.colors.length > 1) return Ue(e);
2548
+ let t = e.colors[0], n = s(t, e.strokeAlpha), r = e.fillAlpha > 0 ? s(t, e.fillAlpha) : void 0;
2336
2549
  if (e.shape === "circle") return {
2337
2550
  type: "circle",
2338
2551
  cx: e.cx,
@@ -2363,21 +2576,21 @@ function Se(e) {
2363
2576
  },
2364
2577
  layer: "overlay"
2365
2578
  };
2366
- let i = e.cx - e.size, o = e.cy - e.size, s = e.cx + e.size, c = e.cy + e.size, l = [
2579
+ let i = e.cx - e.size, a = e.cy - e.size, o = e.cx + e.size, c = e.cy + e.size, l = [
2367
2580
  [
2368
2581
  i,
2582
+ a,
2369
2583
  o,
2370
- s,
2371
- o
2584
+ a
2372
2585
  ],
2373
2586
  [
2374
- s,
2375
2587
  o,
2376
- s,
2588
+ a,
2589
+ o,
2377
2590
  c
2378
2591
  ],
2379
2592
  [
2380
- s,
2593
+ o,
2381
2594
  c,
2382
2595
  i,
2383
2596
  c
@@ -2386,13 +2599,13 @@ function Se(e) {
2386
2599
  i,
2387
2600
  c,
2388
2601
  i,
2389
- o
2602
+ a
2390
2603
  ]
2391
2604
  ], u = [];
2392
2605
  r && u.push({
2393
2606
  type: "rect",
2394
2607
  x: i,
2395
- y: o,
2608
+ y: a,
2396
2609
  width: e.size * 2,
2397
2610
  height: e.size * 2,
2398
2611
  cornerRadius: e.cornerRadius,
@@ -2419,10 +2632,10 @@ function Se(e) {
2419
2632
  layer: "overlay"
2420
2633
  };
2421
2634
  }
2422
- function Ce(e) {
2635
+ function Ue(e) {
2423
2636
  let t = e.colors.length, n = Math.PI * 2 / t, r = -Math.PI / 2, i = [];
2424
- for (let o = 0; o < t; o++) {
2425
- let t = e.colors[o], s = a(t, e.strokeAlpha), c = e.fillAlpha > 0 ? a(t, e.fillAlpha) : void 0, l = r + o * n, u = Te(e, l, l + n);
2637
+ for (let a = 0; a < t; a++) {
2638
+ let t = e.colors[a], o = s(t, e.strokeAlpha), c = e.fillAlpha > 0 ? s(t, e.fillAlpha) : void 0, l = r + a * n, u = Ge(e, l, l + n);
2426
2639
  if (c) {
2427
2640
  let t = [e.cx, e.cy];
2428
2641
  for (let [e, n] of u) t.push(e, n);
@@ -2439,7 +2652,7 @@ function Ce(e) {
2439
2652
  type: "line",
2440
2653
  points: d,
2441
2654
  paint: {
2442
- stroke: s,
2655
+ stroke: o,
2443
2656
  strokeWidth: e.strokeWidth,
2444
2657
  dash: e.dash,
2445
2658
  dashEnabled: e.dashEnabled
@@ -2456,7 +2669,7 @@ function Ce(e) {
2456
2669
  layer: "overlay"
2457
2670
  };
2458
2671
  }
2459
- function we(e, t) {
2672
+ function We(e, t) {
2460
2673
  let n = Math.cos(t), r = Math.sin(t);
2461
2674
  if (e.shape === "circle") return [e.cx + e.size * n, e.cy + e.size * r];
2462
2675
  let i = e.size, a = Math.max(Math.abs(n), Math.abs(r)), o = i / a * n, s = i / a * r, c = Math.min(e.cornerRadius, i), l = i - c;
@@ -2466,7 +2679,7 @@ function we(e, t) {
2466
2679
  }
2467
2680
  return [e.cx + o, e.cy + s];
2468
2681
  }
2469
- function Te(e, t, n) {
2682
+ function Ge(e, t, n) {
2470
2683
  let r = [t], i = e.shape !== "circle" && e.cornerRadius > 0;
2471
2684
  if (e.shape === "circle" || i) {
2472
2685
  let e = i ? Math.PI / 36 : Math.PI / 18, a = Math.max(1, Math.ceil((n - t) / e));
@@ -2478,10 +2691,10 @@ function Te(e, t, n) {
2478
2691
  a > t + 1e-9 && a < n - 1e-9 && r.push(a);
2479
2692
  }
2480
2693
  }
2481
- return r.push(n), r.sort((e, t) => e - t), r.map((t) => we(e, t));
2694
+ return r.push(n), r.sort((e, t) => e - t), r.map((t) => We(e, t));
2482
2695
  }
2483
- function Ee(e) {
2484
- let t = a(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? a(e.fillColor, e.fillAlpha) : void 0;
2696
+ function Ke(e) {
2697
+ let t = s(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? s(e.fillColor, e.fillAlpha) : void 0;
2485
2698
  return e.shape === "circle" ? {
2486
2699
  type: "circle",
2487
2700
  cx: e.cx,
@@ -2512,7 +2725,7 @@ function Ee(e) {
2512
2725
  layer: "overlay"
2513
2726
  };
2514
2727
  }
2515
- function De(e) {
2728
+ function qe(e) {
2516
2729
  let t = [];
2517
2730
  for (let n of e.segments) t.push({
2518
2731
  type: "line",
@@ -2551,29 +2764,29 @@ function De(e) {
2551
2764
  }
2552
2765
  //#endregion
2553
2766
  //#region src/hit/HitTester.ts
2554
- var Oe = {
2767
+ var Je = {
2555
2768
  areaExit: 110,
2556
2769
  room: 100,
2557
2770
  label: 80,
2558
2771
  specialExit: 60,
2559
2772
  exit: 40,
2560
2773
  stub: 20
2561
- }, ke = {
2774
+ }, Ye = {
2562
2775
  room: .3,
2563
2776
  areaExit: 1,
2564
2777
  label: 1,
2565
2778
  specialExit: .5,
2566
2779
  exit: .35,
2567
2780
  stub: .3
2568
- }, Ae = (e, t) => ({
2781
+ }, Xe = (e, t) => ({
2569
2782
  x: e,
2570
2783
  y: t
2571
- }), je = class {
2784
+ }), Ze = class {
2572
2785
  constructor() {
2573
- this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform = Ae;
2786
+ this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform = Xe;
2574
2787
  }
2575
2788
  build(e, t, n, r) {
2576
- this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ?? Ae, this.layerOffset = r, this.collectHitShapes(e, 0, 0);
2789
+ this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ?? Xe, this.layerOffset = r, this.collectHitShapes(e, 0, 0);
2577
2790
  }
2578
2791
  clear() {
2579
2792
  this.entries = [], this.spatialIndex.clear();
@@ -2617,13 +2830,13 @@ var Oe = {
2617
2830
  forEachCandidate(e, t, n) {
2618
2831
  let r = Math.floor(e / this.bucketSize), i = Math.floor(t / this.bucketSize), a = /* @__PURE__ */ new Set();
2619
2832
  for (let o = -1; o <= 1; o++) for (let s = -1; s <= 1; s++) {
2620
- let c = this.spatialIndex.get(ze(r + o, i + s));
2833
+ let c = this.spatialIndex.get(at(r + o, i + s));
2621
2834
  if (c) for (let r of c) {
2622
2835
  if (a.has(r)) continue;
2623
2836
  a.add(r);
2624
2837
  let i = r.margin * this.roomSize;
2625
2838
  if (e < r.rMinX - i || e > r.rMaxX + i || t < r.rMinY - i || t > r.rMaxY + i) continue;
2626
- let o = Pe(r, e, t);
2839
+ let o = et(r, e, t);
2627
2840
  o > i || n(r, o);
2628
2841
  }
2629
2842
  }
@@ -2642,8 +2855,8 @@ var Oe = {
2642
2855
  collectHitShapes(e, t, n) {
2643
2856
  for (let r of e) {
2644
2857
  if (r.hit) {
2645
- let e = [], i = Me();
2646
- Ne(r, t, n, this.entryTransform(r.layer), e, i), e.length > 0 && i.minX <= i.maxX && this.indexEntry(i, e, r.hit);
2858
+ let e = [], i = Qe();
2859
+ $e(r, t, n, this.entryTransform(r.layer), e, i), e.length > 0 && i.minX <= i.maxX && this.indexEntry(i, e, r.hit);
2647
2860
  }
2648
2861
  r.type === "group" && this.collectHitShapes(r.children, t + r.x, n + r.y);
2649
2862
  }
@@ -2661,7 +2874,7 @@ var Oe = {
2661
2874
  };
2662
2875
  }
2663
2876
  indexEntry(e, t, n) {
2664
- let r = n.margin ?? ke[n.kind] ?? 1, i = n.priority ?? Oe[n.kind] ?? 50, a = (e.minX + e.maxX) / 2, o = (e.minY + e.maxY) / 2, s = {
2877
+ let r = n.margin ?? Ye[n.kind] ?? 1, i = n.priority ?? Je[n.kind] ?? 50, a = (e.minX + e.maxX) / 2, o = (e.minY + e.maxY) / 2, s = {
2665
2878
  info: n,
2666
2879
  margin: r,
2667
2880
  priority: i,
@@ -2676,12 +2889,12 @@ var Oe = {
2676
2889
  this.entries.push(s);
2677
2890
  let c = this.bucketSize, l = Math.floor(e.minX / c), u = Math.floor(e.maxX / c), d = Math.floor(e.minY / c), f = Math.floor(e.maxY / c);
2678
2891
  for (let e = l; e <= u; e++) for (let t = d; t <= f; t++) {
2679
- let n = ze(e, t), r = this.spatialIndex.get(n);
2892
+ let n = at(e, t), r = this.spatialIndex.get(n);
2680
2893
  r || (r = [], this.spatialIndex.set(n, r)), r.push(s);
2681
2894
  }
2682
2895
  }
2683
2896
  };
2684
- function Me() {
2897
+ function Qe() {
2685
2898
  return {
2686
2899
  minX: Infinity,
2687
2900
  minY: Infinity,
@@ -2689,17 +2902,17 @@ function Me() {
2689
2902
  maxY: -Infinity
2690
2903
  };
2691
2904
  }
2692
- function Q(e, t, n) {
2905
+ function Z(e, t, n) {
2693
2906
  t < e.minX && (e.minX = t), t > e.maxX && (e.maxX = t), n < e.minY && (e.minY = n), n > e.maxY && (e.maxY = n);
2694
2907
  }
2695
- function Ne(e, t, n, r, i, a) {
2908
+ function $e(e, t, n, r, i, a) {
2696
2909
  if (e.type === "group") {
2697
- for (let o of e.children) o.hit || $(o, t + e.x, n + e.y, r, i, a);
2910
+ for (let o of e.children) o.hit || Q(o, t + e.x, n + e.y, r, i, a);
2698
2911
  return;
2699
2912
  }
2700
- $(e, t, n, r, i, a);
2913
+ Q(e, t, n, r, i, a);
2701
2914
  }
2702
- function $(e, t, n, r, i, a) {
2915
+ function Q(e, t, n, r, i, a) {
2703
2916
  switch (e.type) {
2704
2917
  case "rect":
2705
2918
  case "image": {
@@ -2718,14 +2931,14 @@ function $(e, t, n, r, i, a) {
2718
2931
  pts: u,
2719
2932
  closed: !0
2720
2933
  });
2721
- for (let e = 0; e < u.length; e += 2) Q(a, u[e], u[e + 1]);
2934
+ for (let e = 0; e < u.length; e += 2) Z(a, u[e], u[e + 1]);
2722
2935
  return;
2723
2936
  }
2724
2937
  case "text": {
2725
2938
  let o = e.width ?? 0, s = e.height ?? 0;
2726
2939
  if (o === 0 || s === 0) {
2727
2940
  let i = r(t + e.x, n + e.y);
2728
- Q(a, i.x, i.y);
2941
+ Z(a, i.x, i.y);
2729
2942
  return;
2730
2943
  }
2731
2944
  let c = r(t + e.x, n + e.y), l = r(t + e.x + o, n + e.y), u = r(t + e.x + o, n + e.y + s), d = r(t + e.x, n + e.y + s), f = [
@@ -2743,7 +2956,7 @@ function $(e, t, n, r, i, a) {
2743
2956
  pts: f,
2744
2957
  closed: !0
2745
2958
  });
2746
- for (let e = 0; e < f.length; e += 2) Q(a, f[e], f[e + 1]);
2959
+ for (let e = 0; e < f.length; e += 2) Z(a, f[e], f[e + 1]);
2747
2960
  return;
2748
2961
  }
2749
2962
  case "circle": {
@@ -2753,14 +2966,14 @@ function $(e, t, n, r, i, a) {
2753
2966
  cx: o.x,
2754
2967
  cy: o.y,
2755
2968
  r: e.radius
2756
- }), Q(a, o.x - e.radius, o.y - e.radius), Q(a, o.x + e.radius, o.y + e.radius);
2969
+ }), Z(a, o.x - e.radius, o.y - e.radius), Z(a, o.x + e.radius, o.y + e.radius);
2757
2970
  return;
2758
2971
  }
2759
2972
  case "line": {
2760
2973
  let o = [];
2761
2974
  for (let i = 0; i < e.points.length; i += 2) {
2762
2975
  let s = r(t + e.points[i], n + e.points[i + 1]);
2763
- o.push(s.x, s.y), Q(a, s.x, s.y);
2976
+ o.push(s.x, s.y), Z(a, s.x, s.y);
2764
2977
  }
2765
2978
  o.length >= 2 && i.push({
2766
2979
  type: "polyline",
@@ -2773,7 +2986,7 @@ function $(e, t, n, r, i, a) {
2773
2986
  let o = [];
2774
2987
  for (let i = 0; i < e.vertices.length; i += 2) {
2775
2988
  let s = r(t + e.vertices[i], n + e.vertices[i + 1]);
2776
- o.push(s.x, s.y), Q(a, s.x, s.y);
2989
+ o.push(s.x, s.y), Z(a, s.x, s.y);
2777
2990
  }
2778
2991
  o.length >= 2 && i.push({
2779
2992
  type: "polyline",
@@ -2783,42 +2996,42 @@ function $(e, t, n, r, i, a) {
2783
2996
  return;
2784
2997
  }
2785
2998
  case "group":
2786
- for (let o of e.children) o.hit || $(o, t + e.x, n + e.y, r, i, a);
2999
+ for (let o of e.children) o.hit || Q(o, t + e.x, n + e.y, r, i, a);
2787
3000
  return;
2788
3001
  }
2789
3002
  }
2790
- function Pe(e, t, n) {
3003
+ function et(e, t, n) {
2791
3004
  let r = Infinity;
2792
3005
  for (let i of e.geoms) {
2793
- let e = Fe(i, t, n);
3006
+ let e = tt(i, t, n);
2794
3007
  if (e < r && (r = e), r === 0) return 0;
2795
3008
  }
2796
3009
  return r;
2797
3010
  }
2798
- function Fe(e, t, n) {
3011
+ function tt(e, t, n) {
2799
3012
  if (e.type === "circle") {
2800
3013
  let r = t - e.cx, i = n - e.cy;
2801
3014
  return Math.max(0, Math.hypot(r, i) - e.r);
2802
3015
  }
2803
- return e.closed && Re(e.pts, t, n) ? 0 : Ie(e.pts, t, n, e.closed);
3016
+ return e.closed && it(e.pts, t, n) ? 0 : nt(e.pts, t, n, e.closed);
2804
3017
  }
2805
- function Ie(e, t, n, r) {
3018
+ function nt(e, t, n, r) {
2806
3019
  let i = e.length / 2;
2807
3020
  if (i < 2) return i === 1 ? Math.hypot(t - e[0], n - e[1]) : Infinity;
2808
3021
  let a = Infinity, o = r ? i : i - 1;
2809
3022
  for (let r = 0; r < o; r++) {
2810
- let o = r * 2, s = (r + 1) % i * 2, c = Le(t, n, e[o], e[o + 1], e[s], e[s + 1]);
3023
+ let o = r * 2, s = (r + 1) % i * 2, c = rt(t, n, e[o], e[o + 1], e[s], e[s + 1]);
2811
3024
  c < a && (a = c);
2812
3025
  }
2813
3026
  return a;
2814
3027
  }
2815
- function Le(e, t, n, r, i, a) {
3028
+ function rt(e, t, n, r, i, a) {
2816
3029
  let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : ((e - n) * o + (t - r) * s) / c;
2817
3030
  l < 0 ? l = 0 : l > 1 && (l = 1);
2818
3031
  let u = n + l * o, d = r + l * s;
2819
3032
  return Math.hypot(e - u, t - d);
2820
3033
  }
2821
- function Re(e, t, n) {
3034
+ function it(e, t, n) {
2822
3035
  let r = !1, i = e.length / 2;
2823
3036
  for (let a = 0, o = i - 1; a < i; o = a++) {
2824
3037
  let i = e[a * 2], s = e[a * 2 + 1], c = e[o * 2], l = e[o * 2 + 1], u = l - s || 1e-12;
@@ -2826,14 +3039,14 @@ function Re(e, t, n) {
2826
3039
  }
2827
3040
  return r;
2828
3041
  }
2829
- function ze(e, t) {
3042
+ function at(e, t) {
2830
3043
  return e * 1000003 + t;
2831
3044
  }
2832
3045
  //#endregion
2833
3046
  //#region src/style/Style.ts
2834
- var Be = { transform: (e) => e };
2835
- function Ve(...e) {
2836
- return e.length === 0 ? Be : e.length === 1 ? e[0] : {
3047
+ var ot = { transform: (e) => e };
3048
+ function st(...e) {
3049
+ return e.length === 0 ? ot : e.length === 1 ? e[0] : {
2837
3050
  transform(t, n) {
2838
3051
  let r = [t];
2839
3052
  for (let t of e) {
@@ -2881,19 +3094,19 @@ function Ve(...e) {
2881
3094
  }
2882
3095
  //#endregion
2883
3096
  //#region src/style/applyStyle.ts
2884
- function He(e, t, n) {
3097
+ function ct(e, t, n) {
2885
3098
  let r = [];
2886
3099
  for (let i of e) {
2887
- let e = Ue(i, t, n);
3100
+ let e = lt(i, t, n);
2888
3101
  Array.isArray(e) ? r.push(...e) : r.push(e);
2889
3102
  }
2890
3103
  return r;
2891
3104
  }
2892
- function Ue(e, t, n) {
3105
+ function lt(e, t, n) {
2893
3106
  if (e.type === "group") {
2894
3107
  let r = [];
2895
3108
  for (let i of e.children) {
2896
- let e = Ue(i, t, n);
3109
+ let e = lt(i, t, n);
2897
3110
  Array.isArray(e) ? r.push(...e) : r.push(e);
2898
3111
  }
2899
3112
  return t.transform({
@@ -2905,33 +3118,33 @@ function Ue(e, t, n) {
2905
3118
  }
2906
3119
  //#endregion
2907
3120
  //#region src/export/flushSceneShapes.ts
2908
- function We(e, t, n) {
2909
- n(e.grid), n(e.link), n(e.room), n(Ge(t.state, t.overlays));
3121
+ function ut(e, t, n) {
3122
+ n(e.grid), n(e.link), n(e.room), n($(t.state, t.overlays));
2910
3123
  for (let e of t.sceneOverlays) {
2911
3124
  let r = e.render(t.state, t.viewportBounds);
2912
3125
  r && n(Array.isArray(r) ? r : [r], e.sceneSpace);
2913
3126
  }
2914
3127
  n(e.topLabel);
2915
3128
  }
2916
- function Ge(e, t) {
3129
+ function $(e, t) {
2917
3130
  let n = e.getOverlaysForArea(t);
2918
3131
  if (!n) return [];
2919
3132
  let r = e.settings, i = [];
2920
3133
  if (n.paths) for (let t of n.paths) {
2921
- let n = Z(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
2922
- i.push(...De(n));
3134
+ let n = Ve(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
3135
+ i.push(...qe(n));
2923
3136
  }
2924
3137
  if (n.highlights) for (let t of n.highlights) {
2925
3138
  let n = e.mapReader.getRoom(t.roomId);
2926
- n && i.push(Se(X(n, t.color, r)));
3139
+ n && i.push(He(ze(n, t.color, r)));
2927
3140
  }
2928
3141
  if (n.position) {
2929
3142
  let t = e.mapReader.getRoom(n.position.roomId);
2930
- t && i.push(Ee(xe(t, r)));
3143
+ t && i.push(Ke(Be(t, r)));
2931
3144
  }
2932
3145
  return i;
2933
3146
  }
2934
3147
  //#endregion
2935
- export { t as A, _ as C, s as D, u as E, a as M, r as N, c as O, v as S, d as T, H as _, Be as a, A as b, De as c, Z as d, xe as f, U as g, fe as h, Ve as i, n as j, o as k, Ee as l, pe as m, We as n, je as o, Y as p, He as r, Se as s, Ge as t, X as u, B as v, f as w, O as x, L as y };
3148
+ export { x as A, h as B, G as C, O as D, re as E, l as F, a as G, t as H, u as I, c as L, v as M, y as N, D as O, _ as P, p as R, he as S, I as T, i as U, d as V, s as W, Se as _, ot as a, ve as b, qe as c, Ve as d, Be as f, Ce as g, Oe as h, st as i, b as j, S as k, Ke as l, ke as m, ut as n, Ze as o, Le as p, ct as r, He as s, $ as t, ze as u, q as v, H as w, K as x, we as y, g as z };
2936
3149
 
2937
- //# sourceMappingURL=flushSceneShapes-Duhi0OQv.js.map
3150
+ //# sourceMappingURL=flushSceneShapes-c7ttw7D-.js.map