mudlet-map-renderer 2.3.0 → 2.4.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.
package/dist/index.mjs CHANGED
@@ -1,31 +1,33 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as ee, p as te, r as C, s as w, u as ne, v as T, w as E, x as re, y as ie } from "./flushSceneShapes-Duhi0OQv.js";
2
- import { n as ae, r as oe, t as se } from "./MapReader-Brzg-X7T.js";
3
- import D from "konva";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, L as l, M as u, N as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as ee, h as E, i as te, j as D, k as ne, l as re, m as ie, n as ae, o as oe, p as se, r as O, s as ce, u as le, v as ue, w as de, x as fe, y as pe, z as me } from "./flushSceneShapes-c7ttw7D-.js";
2
+ import { n as he, r as ge, t as _e } from "./MapReader-Brzg-X7T.js";
3
+ import k from "konva";
4
4
  //#region \0rolldown/runtime.js
5
- var ce = Object.create, le = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, de = Object.getOwnPropertyNames, fe = Object.getPrototypeOf, pe = Object.prototype.hasOwnProperty, O = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), me = (e, t, n, r) => {
6
- if (t && typeof t == "object" || typeof t == "function") for (var i = de(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !pe.call(e, s) && s !== n && le(e, s, {
5
+ var ve = Object.create, ye = Object.defineProperty, be = Object.getOwnPropertyDescriptor, xe = Object.getOwnPropertyNames, Se = Object.getPrototypeOf, Ce = Object.prototype.hasOwnProperty, A = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), we = (e, t, n, r) => {
6
+ if (t && typeof t == "object" || typeof t == "function") for (var i = xe(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ce.call(e, s) && s !== n && ye(e, s, {
7
7
  get: ((e) => t[e]).bind(null, s),
8
- enumerable: !(r = ue(t, s)) || r.enumerable
8
+ enumerable: !(r = be(t, s)) || r.enumerable
9
9
  });
10
10
  return e;
11
- }, he = (e, t, n) => (n = e == null ? {} : ce(fe(e)), me(t || !e || !e.__esModule ? le(n, "default", {
11
+ }, Te = (e, t, n) => (n = e == null ? {} : ve(Se(e)), we(t || !e || !e.__esModule ? ye(n, "default", {
12
12
  value: e,
13
13
  enumerable: !0
14
- }) : n, e)), ge = .6, _e = .025, ve = "rgb(225, 255, 225)";
15
- function ye() {
14
+ }) : n, e)), Ee = .6, De = .025, Oe = "rgb(225, 255, 225)";
15
+ function ke() {
16
16
  return {
17
- roomSize: ge,
18
- lineWidth: _e,
19
- lineColor: ve,
17
+ roomSize: Ee,
18
+ lineWidth: De,
19
+ lineColor: Oe,
20
20
  backgroundColor: "#000000",
21
21
  instantMapMove: !1,
22
22
  highlightCurrentRoom: !0,
23
23
  cullingEnabled: !0,
24
24
  cullingMode: "indexed",
25
+ coalesceRooms: !1,
25
26
  cullingBounds: null,
26
27
  labelRenderMode: "image",
27
28
  transparentLabels: !1,
28
29
  roomShape: "rectangle",
30
+ hiddenRooms: "hide",
29
31
  playerMarker: {
30
32
  strokeColor: "#00e5b2",
31
33
  strokeAlpha: 1,
@@ -59,14 +61,16 @@ function ye() {
59
61
  fontFamily: "sans-serif",
60
62
  uniformLevelSize: !1,
61
63
  areaExitLabels: !1,
62
- areaExitLabelFontSize: .3
64
+ areaExitLabelFontSize: .3,
65
+ neighborSpill: !1,
66
+ neighborSpillDistance: 20
63
67
  };
64
68
  }
65
69
  //#endregion
66
70
  //#region src/MapState.ts
67
- var be = class {
71
+ var Ae = class {
68
72
  constructor(e, t) {
69
- this.events = new y(), this.highlights = /* @__PURE__ */ new Map(), this.paths = [], this.lens = n, this.mapReader = e, this.settings = t;
73
+ this.events = new p(), this.highlights = /* @__PURE__ */ new Map(), this.paths = [], this.lens = u, this.mapReader = e, this.settings = t;
70
74
  }
71
75
  setLens(e) {
72
76
  this.lens = e, this.events.emit("lens", { lens: e });
@@ -199,7 +203,7 @@ var be = class {
199
203
  };
200
204
  //#endregion
201
205
  //#region src/scene/elements/GridLayout.ts
202
- function xe(e, t, n = {}) {
206
+ function je(e, t, n = {}) {
203
207
  if (!t.gridEnabled) return [];
204
208
  let r = n.inverseTransform ?? ((e, t) => ({
205
209
  x: e,
@@ -236,11 +240,11 @@ function xe(e, t, n = {}) {
236
240
  }
237
241
  //#endregion
238
242
  //#region src/export/clipSceneToViewport.ts
239
- function Se(e, t, n, r) {
243
+ function Me(e, t, n, r) {
240
244
  if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
241
245
  let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
242
246
  if (l) {
243
- let c = Ce(e, t, n, r, l);
247
+ let c = Ne(e, t, n, r, l);
244
248
  return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
245
249
  }
246
250
  return n >= i && e <= a && r >= o && t <= s;
@@ -253,7 +257,7 @@ function Se(e, t, n, r) {
253
257
  for (let { shape: t, bounds: n } of e.areaExitLabelShapeRefs) d.set(t, u(n.x, n.y, n.x + n.width, n.y + n.height));
254
258
  return d;
255
259
  }
256
- function Ce(e, t, n, r, i) {
260
+ function Ne(e, t, n, r, i) {
257
261
  let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
258
262
  return {
259
263
  minX: Math.min(a.x, o.x, s.x, c.x),
@@ -262,13 +266,13 @@ function Ce(e, t, n, r, i) {
262
266
  maxY: Math.max(a.y, o.y, s.y, c.y)
263
267
  };
264
268
  }
265
- function k(e, t, n, r) {
266
- let i = xe(t, n, { inverseTransform: r?.inverse });
269
+ function Pe(e, t, n, r) {
270
+ let i = je(t, n, { inverseTransform: r?.inverse });
267
271
  if (!n.cullingEnabled) return {
268
272
  ...e.sceneShapes,
269
273
  grid: i
270
274
  };
271
- let a = Se(e, t, n, r);
275
+ let a = Me(e, t, n, r);
272
276
  return {
273
277
  grid: i,
274
278
  link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
@@ -278,14 +282,14 @@ function k(e, t, n, r) {
278
282
  }
279
283
  //#endregion
280
284
  //#region src/rendering/SceneManager.ts
281
- var we = {
285
+ var Fe = {
282
286
  grid: [],
283
287
  link: [],
284
288
  room: [],
285
289
  topLabel: []
286
- }, Te = class {
290
+ }, Ie = class {
287
291
  constructor(e, t, n) {
288
- this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new g(n, t);
292
+ this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new E(n, t);
289
293
  }
290
294
  get exitRenderer() {
291
295
  return this.pipeline.exitRenderer;
@@ -308,8 +312,8 @@ var we = {
308
312
  get hitShapes() {
309
313
  return this.lastBuildResult?.hitShapes ?? [];
310
314
  }
311
- rebuild(e, t, n, r) {
312
- return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
315
+ rebuild(e, t, n, r, i) {
316
+ return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r, i), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
313
317
  }
314
318
  buildExitShape(e) {
315
319
  return this.pipeline.buildExitShape(e);
@@ -318,36 +322,36 @@ var we = {
318
322
  this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
319
323
  }
320
324
  resetPipeline(e) {
321
- this.pipeline = new g(e, this.settings), this.reset();
325
+ this.pipeline = new E(e, this.settings), this.reset();
322
326
  }
323
- cullInteractive(e = c) {
327
+ cullInteractive(t = e) {
324
328
  if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
325
- let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === c ? void 0 : { forward: e };
326
- return Se(this.lastBuildResult, t, this.settings, n);
329
+ let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t };
330
+ return Me(this.lastBuildResult, n, this.settings, r);
327
331
  }
328
- cull(e = c) {
332
+ cull(t = e) {
329
333
  if (!this.lastBuildResult) return {
330
- shapes: we,
334
+ shapes: Fe,
331
335
  stats: {
332
336
  visibleRooms: 0,
333
337
  totalRooms: 0,
334
338
  visibleExits: 0
335
339
  }
336
340
  };
337
- let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === c ? void 0 : { forward: e }, r = k(this.lastBuildResult, t, this.settings, n);
341
+ let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t }, i = Pe(this.lastBuildResult, n, this.settings, r);
338
342
  return {
339
- shapes: r,
343
+ shapes: i,
340
344
  stats: {
341
- visibleRooms: r.room.length,
345
+ visibleRooms: i.room.length,
342
346
  totalRooms: this.lastBuildResult.roomShapeRefs.size,
343
- visibleExits: r.link.filter((e) => this.standaloneExitShapeSet.has(e)).length
347
+ visibleExits: i.link.filter((e) => this.standaloneExitShapeSet.has(e)).length
344
348
  }
345
349
  };
346
350
  }
347
351
  };
348
352
  //#endregion
349
353
  //#region src/render/canvasGradient.ts
350
- function A(e, t) {
354
+ function j(e, t) {
351
355
  if (typeof t == "string") return t;
352
356
  if (t.type === "linear") {
353
357
  let n = e.createLinearGradient(t.x0, t.y0, t.x1, t.y1);
@@ -360,13 +364,13 @@ function A(e, t) {
360
364
  }
361
365
  //#endregion
362
366
  //#region src/render/RecordingLayer.ts
363
- function Ee(e, t) {
367
+ function M(e, t) {
364
368
  switch (t.type) {
365
369
  case "rect":
366
- e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
370
+ e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
367
371
  break;
368
372
  case "circle":
369
- e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
373
+ e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
370
374
  break;
371
375
  case "line": {
372
376
  if (t.points.length < 4) break;
@@ -380,7 +384,7 @@ function Ee(e, t) {
380
384
  if (t.vertices.length < 4) break;
381
385
  e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
382
386
  for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
383
- e.closePath(), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
387
+ e.closePath(), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
384
388
  break;
385
389
  case "text": {
386
390
  let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
@@ -417,7 +421,7 @@ function Ee(e, t) {
417
421
  break;
418
422
  }
419
423
  }
420
- var De = class {
424
+ var Le = class {
421
425
  constructor(e, t) {
422
426
  this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
423
427
  }
@@ -447,45 +451,102 @@ var De = class {
447
451
  }
448
452
  materialize() {
449
453
  if (this._konvaGroup) return this._konvaGroup;
450
- let e = new D.Group({
454
+ let e = new k.Group({
451
455
  x: this.x,
452
456
  y: this.y,
453
457
  listening: !1,
454
458
  visible: this._visible
455
459
  }), t = this.commands;
456
- return e.add(new D.Shape({
460
+ return e.add(new k.Shape({
457
461
  listening: !1,
458
462
  perfectDrawEnabled: !1,
459
463
  sceneFunc: (e) => {
460
464
  let n = e._context;
461
- for (let e of t) Ee(n, e);
465
+ for (let e of t) M(n, e);
462
466
  }
463
467
  })), this._konvaGroup = e, e;
464
468
  }
465
- }, Oe = class {
466
- constructor(e) {
467
- this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
468
- let t = this;
469
- this.konvaShape = new D.Shape({
469
+ };
470
+ function Re(e) {
471
+ if (e.noScaling || e.commands.length !== 1) return null;
472
+ let t = e.commands[0];
473
+ return t.type === "rect" ? typeof t.fill != "string" && t.fill !== void 0 || t.dash ? null : `r|${t.fill ?? ""}|${t.stroke ?? ""}|${t.sw}|${t.cr}` : t.type === "circle" ? typeof t.fill != "string" && t.fill !== void 0 || t.dash ? null : `c|${t.fill ?? ""}|${t.stroke ?? ""}|${t.sw}|${t.r}` : t.type === "line" ? t.dash || t.alpha !== void 0 ? null : `l|${t.stroke ?? ""}|${t.sw}|${t.lineCap ?? ""}|${t.lineJoin ?? ""}` : null;
474
+ }
475
+ var ze = class {
476
+ constructor(e, t = () => !1) {
477
+ this.coalesce = t, this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.buckets = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
478
+ let n = this;
479
+ this.konvaShape = new k.Shape({
470
480
  listening: !1,
471
481
  perfectDrawEnabled: !1,
472
482
  sceneFunc: (e) => {
473
- let n = e._context, r = n.getTransform(), i = r.a, a = r.b, o = r.c, s = r.d;
474
- for (let e of t.entries) {
475
- if (!e.visible) continue;
476
- let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
477
- e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
478
- for (let t of e.commands) Ee(n, t);
479
- }
480
- n.setTransform(r);
483
+ let t = e._context;
484
+ n.coalesce() ? n.drawCoalesced(t) : n.drawPerEntry(t);
481
485
  }
482
486
  }), e.add(this.konvaShape);
483
487
  }
488
+ drawPerEntry(e) {
489
+ let t = e.getTransform(), n = t.a, r = t.b, i = t.c, a = t.d;
490
+ for (let o of this.entries) {
491
+ if (!o.visible) continue;
492
+ let s = n * o.x + i * o.y + t.e, c = r * o.x + a * o.y + t.f;
493
+ o.noScaling ? e.setTransform(75, 0, 0, 75, s, c) : e.setTransform(n, r, i, a, s, c);
494
+ for (let t of o.commands) M(e, t);
495
+ }
496
+ e.setTransform(t);
497
+ }
498
+ drawCoalesced(e) {
499
+ let t = e.getTransform();
500
+ this.sweep(e, t, (e) => e.layer !== "room"), this.sweep(e, t, (e) => e.layer === "room"), e.setTransform(t);
501
+ }
502
+ sweep(e, t, n) {
503
+ let r = t.a, i = t.b, a = t.c, o = t.d, s = t.e, c = t.f, l = this.buckets;
504
+ l.clear();
505
+ for (let t of this.entries) {
506
+ if (!t.visible || !n(t)) continue;
507
+ let u = Re(t);
508
+ if (u === null) {
509
+ let n = r * t.x + a * t.y + s, l = i * t.x + o * t.y + c;
510
+ t.noScaling ? e.setTransform(75, 0, 0, 75, n, l) : e.setTransform(r, i, a, o, n, l);
511
+ for (let n of t.commands) M(e, n);
512
+ } else {
513
+ let e = l.get(u);
514
+ e || l.set(u, e = []), e.push(t);
515
+ }
516
+ }
517
+ if (l.size !== 0) {
518
+ e.setTransform(r, i, a, o, s, c);
519
+ for (let t of l.values()) {
520
+ let n = t[0].commands[0];
521
+ if (e.beginPath(), n.type === "rect") {
522
+ let r = n.cr > 0 && typeof e.roundRect == "function";
523
+ for (let i of t) r ? e.roundRect(i.x + n.x, i.y + n.y, n.w, n.h, n.cr) : e.rect(i.x + n.x, i.y + n.y, n.w, n.h);
524
+ n.fill && (e.fillStyle = n.fill, e.fill()), n.stroke && n.sw > 0 && (e.strokeStyle = n.stroke, e.lineWidth = n.sw, e.setLineDash([]), e.stroke());
525
+ } else if (n.type === "circle") {
526
+ for (let r of t) {
527
+ let t = r.x + n.cx, i = r.y + n.cy;
528
+ e.moveTo(t + n.r, i), e.arc(t, i, n.r, 0, Math.PI * 2);
529
+ }
530
+ n.fill && (e.fillStyle = n.fill, e.fill()), n.stroke && n.sw > 0 && (e.strokeStyle = n.stroke, e.lineWidth = n.sw, e.setLineDash([]), e.stroke());
531
+ } else if (n.type === "line") {
532
+ for (let n of t) {
533
+ let t = n.commands[0].points;
534
+ if (!(t.length < 4)) {
535
+ e.moveTo(t[0] + n.x, t[1] + n.y);
536
+ for (let r = 2; r < t.length; r += 2) e.lineTo(t[r] + n.x, t[r + 1] + n.y);
537
+ }
538
+ }
539
+ n.stroke && (e.strokeStyle = n.stroke), e.lineWidth = n.sw, e.setLineDash([]), n.lineCap && (e.lineCap = n.lineCap), n.lineJoin && (e.lineJoin = n.lineJoin), e.stroke();
540
+ }
541
+ }
542
+ }
543
+ }
484
544
  addNode(e) {
485
545
  let t = {
486
546
  x: e.x,
487
547
  y: e.y,
488
548
  noScaling: e.noScaling,
549
+ layer: e.layer,
489
550
  commands: e.commands,
490
551
  visible: e._visible
491
552
  };
@@ -503,11 +564,11 @@ var De = class {
503
564
  ensureShape() {
504
565
  this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
505
566
  }
506
- }, j = class {
567
+ }, N = class {
507
568
  constructor(e) {
508
569
  this.groups = [], this.konvaLayer = e, e.destroyChildren();
509
570
  let t = this;
510
- this.konvaShape = new D.Shape({
571
+ this.konvaShape = new k.Shape({
511
572
  listening: !1,
512
573
  perfectDrawEnabled: !1,
513
574
  sceneFunc: (e) => {
@@ -516,7 +577,7 @@ var De = class {
516
577
  if (!e._visible) continue;
517
578
  let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
518
579
  e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
519
- for (let t of e.commands) Ee(n, t);
580
+ for (let t of e.commands) M(n, t);
520
581
  }
521
582
  n.setTransform(r);
522
583
  }
@@ -534,7 +595,7 @@ var De = class {
534
595
  ensureShape() {
535
596
  this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
536
597
  }
537
- }, ke = class {
598
+ }, Be = class {
538
599
  constructor(e) {
539
600
  this.konvaLayer = e;
540
601
  }
@@ -550,14 +611,14 @@ var De = class {
550
611
  };
551
612
  //#endregion
552
613
  //#region src/scene/Shape.ts
553
- function Ae(e) {
614
+ function Ve(e) {
554
615
  return typeof e == "object" && !!e;
555
616
  }
556
- function je(e, t) {
617
+ function He(e, t) {
557
618
  return t !== !1 && e ? e : void 0;
558
619
  }
559
- function M(e, t, n, r, i, a) {
560
- return Ae(e) ? e.type === "linear" ? {
620
+ function P(e, t, n, r, i, a) {
621
+ return Ve(e) ? e.type === "linear" ? {
561
622
  type: "linear",
562
623
  x0: (t + e.x0) * r + i,
563
624
  y0: (n + e.y0) * r + a,
@@ -577,14 +638,14 @@ function M(e, t, n, r, i, a) {
577
638
  }
578
639
  //#endregion
579
640
  //#region src/render/shapeToRecording.ts
580
- function Me(e) {
581
- let t = new De(e.x, e.y);
582
- return e.noScale && (t.noScaling = !0), Ne(t, e.children, 0, 0), t;
641
+ function Ue(e) {
642
+ let t = new Le(e.x, e.y);
643
+ return e.noScale && (t.noScaling = !0), t.layer = e.layer, We(t, e.children, 0, 0), t;
583
644
  }
584
- function Ne(e, t, n, r) {
585
- for (let i of t) Pe(e, i, n, r);
645
+ function We(e, t, n, r) {
646
+ for (let i of t) Ge(e, i, n, r);
586
647
  }
587
- function Pe(e, t, n, r) {
648
+ function Ge(e, t, n, r) {
588
649
  switch (t.type) {
589
650
  case "rect":
590
651
  e.commands.push({
@@ -593,11 +654,11 @@ function Pe(e, t, n, r) {
593
654
  y: t.y + r,
594
655
  w: t.width,
595
656
  h: t.height,
596
- fill: M(t.paint.fill, n, r, 1, 0, 0),
657
+ fill: P(t.paint.fill, n, r, 1, 0, 0),
597
658
  stroke: t.paint.stroke,
598
659
  sw: t.paint.strokeWidth ?? 0,
599
660
  cr: t.cornerRadius ?? 0,
600
- dash: je(t.paint.dash, t.paint.dashEnabled)
661
+ dash: He(t.paint.dash, t.paint.dashEnabled)
601
662
  });
602
663
  return;
603
664
  case "circle":
@@ -606,20 +667,20 @@ function Pe(e, t, n, r) {
606
667
  cx: t.cx + n,
607
668
  cy: t.cy + r,
608
669
  r: t.radius,
609
- fill: M(t.paint.fill, n, r, 1, 0, 0),
670
+ fill: P(t.paint.fill, n, r, 1, 0, 0),
610
671
  stroke: t.paint.stroke,
611
672
  sw: t.paint.strokeWidth ?? 0,
612
- dash: je(t.paint.dash, t.paint.dashEnabled)
673
+ dash: He(t.paint.dash, t.paint.dashEnabled)
613
674
  });
614
675
  return;
615
676
  case "line": {
616
- let i = n === 0 && r === 0 ? t.points : Fe(t.points, n, r);
677
+ let i = n === 0 && r === 0 ? t.points : Ke(t.points, n, r);
617
678
  e.commands.push({
618
679
  type: "line",
619
680
  points: i,
620
681
  stroke: t.paint.stroke,
621
682
  sw: t.paint.strokeWidth ?? 0,
622
- dash: je(t.paint.dash, t.paint.dashEnabled),
683
+ dash: He(t.paint.dash, t.paint.dashEnabled),
623
684
  lineCap: t.lineCap,
624
685
  lineJoin: t.lineJoin,
625
686
  alpha: t.paint.alpha
@@ -629,8 +690,8 @@ function Pe(e, t, n, r) {
629
690
  case "polygon":
630
691
  e.commands.push({
631
692
  type: "polygon",
632
- vertices: n === 0 && r === 0 ? t.vertices : Fe(t.vertices, n, r),
633
- fill: M(t.paint.fill, n, r, 1, 0, 0),
693
+ vertices: n === 0 && r === 0 ? t.vertices : Ke(t.vertices, n, r),
694
+ fill: P(t.paint.fill, n, r, 1, 0, 0),
634
695
  stroke: t.paint.stroke,
635
696
  sw: t.paint.strokeWidth ?? 0
636
697
  });
@@ -656,7 +717,7 @@ function Pe(e, t, n, r) {
656
717
  });
657
718
  return;
658
719
  case "image": {
659
- let i = Ie(t.src);
720
+ let i = qe(t.src);
660
721
  e.commands.push({
661
722
  type: "image",
662
723
  x: t.x + n,
@@ -669,58 +730,58 @@ function Pe(e, t, n, r) {
669
730
  return;
670
731
  }
671
732
  case "group":
672
- Ne(e, t.children, n + t.x, r + t.y);
733
+ We(e, t.children, n + t.x, r + t.y);
673
734
  return;
674
735
  }
675
736
  }
676
- function Fe(e, t, n) {
737
+ function Ke(e, t, n) {
677
738
  let r = Array(e.length);
678
739
  for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
679
740
  return r;
680
741
  }
681
- function Ie(e) {
682
- let t = D === void 0 ? typeof Image < "u" ? new Image() : null : D.Util.createImageElement();
742
+ function qe(e) {
743
+ let t = k === void 0 ? typeof Image < "u" ? new Image() : null : k.Util.createImageElement();
683
744
  return t && (t.src = e), t;
684
745
  }
685
746
  //#endregion
686
747
  //#region src/rendering/KonvaRenderBackend.ts
687
- var N = "rgb(120, 72, 0)", Le = class {
748
+ var F = "rgb(120, 72, 0)", Je = class {
688
749
  get coordinateTransform() {
689
750
  return this._coordinateTransform;
690
751
  }
691
- constructor(e, t) {
692
- this.gridCachedBounds = null, this.currentStyle = u, this.hitTester = new ee(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = c, this.coordinateInverse = c, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = e, this.container = t, t ? (this.stage = new D.Stage({
693
- container: t,
694
- width: t.clientWidth,
695
- height: t.clientHeight,
752
+ constructor(t, n) {
753
+ this.gridCachedBounds = null, this.currentStyle = x, this.hitTester = new oe(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.spilledRoomPositions = /* @__PURE__ */ new Map(), this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = e, this.coordinateInverse = e, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = t, this.container = n, n ? (this.stage = new k.Stage({
754
+ container: n,
755
+ width: n.clientWidth,
756
+ height: n.clientHeight,
696
757
  draggable: !1
697
- }), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new r(t.clientWidth, t.clientHeight)) : (this.stage = new D.Stage({
758
+ }), n.style.backgroundColor = t.settings.backgroundColor, this.camera = new D(n.clientWidth, n.clientHeight)) : (this.stage = new k.Stage({
698
759
  width: 1,
699
760
  height: 1
700
- }), this.camera = new r(1, 1)), this.gridLayer = new D.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
701
- let n = new D.Layer({ listening: !1 });
702
- if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new D.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new D.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new D.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new ke(this.positionLayer), this.overlayLayerNode = new ke(this.overlayLayer), this.sceneNode = new Oe(n), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(this.topLabelLayer), this.sceneManager = new Te(this.camera, e.settings, e.mapReader), this.events = new y(t), this.culling = new E(e.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), t) {
761
+ }), this.camera = new D(1, 1)), this.gridLayer = new k.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
762
+ let r = new k.Layer({ listening: !1 });
763
+ if (this.linkLayer = r, this.roomLayer = r, this.stage.add(r), this.positionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new k.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new k.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Be(this.positionLayer), this.overlayLayerNode = new Be(this.overlayLayer), this.sceneNode = new ze(r, () => t.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.sceneManager = new Ie(this.camera, t.settings, t.mapReader), this.events = new p(n), this.culling = new ne(t.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), n) {
703
764
  this.origSetSize = this.camera.setSize.bind(this.camera);
704
- let n = this.origSetSize;
705
- this.camera.setSize = (e, t) => {
706
- n(e, t), this.stage.width(e), this.stage.height(t);
707
- }, this.interactionHandler = new x(t, this.camera, e, {
708
- clientToMapPoint: (e, n) => this.camera.clientToMapPoint(e, n, t.getBoundingClientRect()),
765
+ let e = this.origSetSize;
766
+ this.camera.setSize = (t, n) => {
767
+ e(t, n), this.stage.width(t), this.stage.height(n);
768
+ }, this.interactionHandler = new ie(n, this.camera, t, {
769
+ clientToMapPoint: (e, t) => this.camera.clientToMapPoint(e, t, n.getBoundingClientRect()),
709
770
  pickAtPoint: (e, t) => this.hitTester.pick(e, t)
710
771
  }, this.events);
711
772
  }
712
- this.applyStyleTransforms(), this.subscribeToState(e);
773
+ this.applyStyleTransforms(), this.subscribeToState(t);
713
774
  }
714
775
  setStyle(e) {
715
- this.currentStyle = e, this.sceneNode = new Oe(this.linkLayer), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
776
+ this.currentStyle = e, this.sceneNode = new ze(this.linkLayer, () => this.state.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
716
777
  }
717
778
  applyStyleTransforms() {
718
- let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) : c, n = e.sceneToWorld ? (t, n) => e.sceneToWorld(t, n) : c, r = this.coordinateInverse, i = e.sceneLayerOffset ? (t) => e.sceneLayerOffset(t) : void 0;
719
- this._coordinateTransform = t, this.coordinateInverse = n, this.coordinateLayerOffset = i, this.culling.setCoordinateTransform(t), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, t, i);
720
- let a = this.camera.getScale(), o = this.camera.width / 2, s = this.camera.height / 2, l = r((o - this.camera.position.x) / a, (s - this.camera.position.y) / a), u = t(l.x, l.y);
779
+ let t = this.currentStyle, n = t.worldToScene ? (e, n) => t.worldToScene(e, n) : e, r = t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : e, i = this.coordinateInverse, a = t.sceneLayerOffset ? (e) => t.sceneLayerOffset(e) : void 0;
780
+ this._coordinateTransform = n, this.coordinateInverse = r, this.coordinateLayerOffset = a, this.culling.setCoordinateTransform(n), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, n, a);
781
+ let o = this.camera.getScale(), s = this.camera.width / 2, c = this.camera.height / 2, l = i((s - this.camera.position.x) / o, (c - this.camera.position.y) / o), u = n(l.x, l.y);
721
782
  this.camera.position = {
722
- x: o - u.x * a,
723
- y: s - u.y * a
783
+ x: s - u.x * o,
784
+ y: c - u.y * o
724
785
  }, this.applyViewportToStage();
725
786
  }
726
787
  styleContext() {
@@ -838,7 +899,7 @@ var N = "rgb(120, 72, 0)", Le = class {
838
899
  e.events.on("area", () => {
839
900
  this.refresh();
840
901
  }), e.events.on("position", ({ roomId: e, center: t, areaChanged: n }) => {
841
- this.onPositionChanged(e, t, n);
902
+ this.onPositionChanged(e, t, n), this.state.settings.neighborSpill && e !== void 0 && this.refresh();
842
903
  }), e.events.on("center", ({ roomId: t, instant: n }) => {
843
904
  let r = e.mapReader.getRoom(t);
844
905
  if (r) {
@@ -857,20 +918,35 @@ var N = "rgb(120, 72, 0)", Le = class {
857
918
  }
858
919
  buildScene(e, t, n) {
859
920
  this.positionLayer.destroyChildren(), this.positionMarker = void 0, this.clearOverlayShapes(), this.currentRoomOverlay = [], this.sceneNode.destroyChildren(), this.gridLayerNode.destroyChildren(), this.gridCachedBounds = null, this.topLabelLayerNode.destroyChildren();
860
- let r = this.sceneManager.rebuild(e, t, n, this.state.lens);
921
+ let r = this.computeNeighborSpill(e, n);
922
+ this.spilledRoomPositions = r ? pe(r) : /* @__PURE__ */ new Map();
923
+ let i = this.sceneManager.rebuild(e, t, n, this.state.lens, r);
861
924
  this.shapeToGroup = /* @__PURE__ */ new Map(), this.refreshGrid(this.camera.getViewportBounds());
862
- for (let e of r.sceneShapes.link) {
925
+ for (let e of i.sceneShapes.link) {
863
926
  let t = this.addStyledShape(e, this.sceneNode);
864
927
  t && this.shapeToGroup.set(e, t);
865
928
  }
866
- for (let e of r.sceneShapes.room) {
929
+ for (let e of i.sceneShapes.room) {
867
930
  let t = this.addStyledShape(e, this.sceneNode);
868
931
  t && this.shapeToGroup.set(e, t);
869
932
  }
870
- for (let e of r.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
933
+ for (let e of i.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
934
+ }
935
+ computeNeighborSpill(e, t) {
936
+ let n = this.state.settings;
937
+ if (!n.neighborSpill) return;
938
+ let r = this.state.positionRoomId;
939
+ if (r === void 0) return;
940
+ let i = this.state.mapReader.getRoom(r);
941
+ if (!i || i.area !== e.getAreaId() || i.z !== t) return;
942
+ let a = this.state.lens;
943
+ return b(this.state.mapReader, e.getAreaId(), t, r, n.neighborSpillDistance, (e) => a.isVisible(e));
944
+ }
945
+ overlayReader() {
946
+ return this.spilledRoomPositions.size === 0 || this.state.currentArea === void 0 || this.state.currentZIndex === void 0 ? this.state.mapReader : new ee(this.state.mapReader, this.state.currentArea, this.state.currentZIndex, this.spilledRoomPositions);
871
947
  }
872
948
  addStyledShape(e, t, n = !1) {
873
- let r = n || this.currentStyle === u ? [e] : C([e], this.currentStyle, this.styleContext());
949
+ let r = n || this.currentStyle === x ? [e] : O([e], this.currentStyle, this.styleContext());
874
950
  if (r.length === 0) return;
875
951
  let i;
876
952
  i = r.length === 1 && r[0].type === "group" ? r[0] : {
@@ -881,7 +957,7 @@ var N = "rgb(120, 72, 0)", Le = class {
881
957
  layer: e.layer,
882
958
  noScale: e.noScale
883
959
  };
884
- let a = Me(i);
960
+ let a = Ue(i);
885
961
  return t.addNode(a), a;
886
962
  }
887
963
  refreshGrid(e) {
@@ -893,7 +969,7 @@ var N = "rgb(120, 72, 0)", Le = class {
893
969
  let n = this.coordinateInverse, r = n(e.minX, e.minY), i = n(e.maxX, e.minY), a = n(e.maxX, e.maxY), o = n(e.minX, e.maxY), s = Math.min(r.x, i.x, a.x, o.x), c = Math.max(r.x, i.x, a.x, o.x), l = Math.min(r.y, i.y, a.y, o.y), u = Math.max(r.y, i.y, a.y, o.y), d = t.gridSize * 2, f = Math.floor((s - d) / t.gridSize) * t.gridSize, p = Math.ceil((c + d) / t.gridSize) * t.gridSize, m = Math.floor((l - d) / t.gridSize) * t.gridSize, h = Math.ceil((u + d) / t.gridSize) * t.gridSize, g = this.gridCachedBounds;
894
970
  if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
895
971
  this.gridLayerNode.destroyChildren();
896
- let _ = xe(e, t, { inverseTransform: this.coordinateInverse });
972
+ let _ = je(e, t, { inverseTransform: this.coordinateInverse });
897
973
  for (let e of _) this.addStyledShape(e, this.gridLayerNode);
898
974
  this.gridCachedBounds = {
899
975
  left: f,
@@ -943,8 +1019,8 @@ var N = "rgb(120, 72, 0)", Le = class {
943
1019
  this.positionLayerNode.batchDraw();
944
1020
  return;
945
1021
  }
946
- let t = m(e, this.state.settings);
947
- this.positionMarker = this.addStyledShape(b(t), this.positionLayerNode);
1022
+ let t = T(e, this.state.settings);
1023
+ this.positionMarker = this.addStyledShape(re(t), this.positionLayerNode);
948
1024
  }
949
1025
  clearCurrentRoomOverlay() {
950
1026
  this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
@@ -954,42 +1030,48 @@ var N = "rgb(120, 72, 0)", Le = class {
954
1030
  this.positionLayerNode.batchDraw();
955
1031
  return;
956
1032
  }
957
- let t = this.state.settings;
958
- if (!t.highlightCurrentRoom) {
1033
+ let r = this.state.settings;
1034
+ if (!r.highlightCurrentRoom) {
959
1035
  this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
960
1036
  return;
961
1037
  }
962
- let n = /* @__PURE__ */ new Map();
963
- n.set(e.id, e);
964
- let r = [], i = this.sceneManager.exitRenderer, a = this.state.lens;
1038
+ let a = /* @__PURE__ */ new Map();
1039
+ a.set(e.id, e);
1040
+ let o = [], s = this.sceneManager.exitRenderer, c = S(this.state.lens, r.hiddenRooms === "hide");
965
1041
  this.state.currentAreaInstance && this.state.currentZIndex !== void 0 && this.state.currentAreaInstance.getLinkExits(this.state.currentZIndex).filter((t) => t.a === e.id || t.b === e.id).forEach((e) => {
966
- let t = i.renderDataWithColor(e, N, this.state.currentZIndex);
967
- t && r.push(this.sceneManager.buildExitShape(t));
1042
+ let t = this.state.mapReader.getRoom(e.a), n = this.state.mapReader.getRoom(e.b);
1043
+ if (!t || !n || (c.getExitTreatment ? c.getExitTreatment(e, t, n) : d(c, e, t, n)) !== "full") return;
1044
+ let r = s.renderDataWithColor(e, F, this.state.currentZIndex);
1045
+ if (r) {
1046
+ if (r.targetRoomId !== void 0 && this.spilledRoomPositions.has(r.targetRoomId)) return;
1047
+ o.push(this.sceneManager.buildExitShape(r));
1048
+ }
968
1049
  });
969
- for (let n of d(e, t, N)) r.push(l(n, e.id));
970
- for (let n of re(e, t, N)) r.push(h(n));
1050
+ for (let t of g(e, r, F)) o.push(h(t, e.id));
1051
+ for (let t of i(e, r, F)) o.push(fe(t));
971
1052
  [...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
972
1053
  let t = this.state.mapReader.getRoom(e);
973
- t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
974
- }), r.forEach((e) => {
1054
+ t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && c.isVisible(t) && a.set(e, t);
1055
+ }), o.forEach((e) => {
975
1056
  let t = this.addStyledShape(e, this.positionLayerNode);
976
1057
  t && this.currentRoomOverlay.push(t);
977
- }), n.forEach((n, r) => {
978
- let i = r === e.id, a = ie(n, this.state.mapReader, t, {
979
- strokeOverride: i ? N : t.lineColor,
980
- flatPipeline: !0
1058
+ }), a.forEach((i, a) => {
1059
+ let o = a === e.id, s = de(i, this.state.mapReader, r, {
1060
+ strokeOverride: o ? F : r.lineColor,
1061
+ flatPipeline: !0,
1062
+ ...t(i, r.hiddenRooms)
981
1063
  });
982
- a.children.push(...T(n, this.state.mapReader, t));
983
- let o = this.addStyledShape(a, this.positionLayerNode);
984
- o && this.currentRoomOverlay.push(o);
1064
+ s.children.push(...n(i, this.state.mapReader, r));
1065
+ let c = this.addStyledShape(s, this.positionLayerNode);
1066
+ c && this.currentRoomOverlay.push(c);
985
1067
  }), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
986
1068
  }
987
1069
  syncHighlight(e, t) {
988
1070
  let n = this.highlightShapes.get(e);
989
1071
  if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
990
- let n = this.state.mapReader.getRoom(e);
1072
+ let n = this.overlayReader().getRoom(e);
991
1073
  if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
992
- let r = ne(n, t, this.state.settings), i = this.addStyledShape(w(r), this.overlayLayerNode);
1074
+ let r = le(n, t, this.state.settings), i = this.addStyledShape(ce(r), this.overlayLayerNode);
993
1075
  i && this.highlightShapes.set(e, i);
994
1076
  }
995
1077
  }
@@ -998,28 +1080,28 @@ var N = "rgb(120, 72, 0)", Le = class {
998
1080
  syncHighlights() {
999
1081
  for (let e of this.highlightShapes.values()) e.destroy();
1000
1082
  this.highlightShapes.clear();
1001
- for (let [e, t] of this.state.highlights) {
1002
- if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
1003
- let n = this.state.mapReader.getRoom(e);
1004
- if (!n) continue;
1005
- let r = ne(n, t.colors, this.state.settings), i = this.addStyledShape(w(r), this.overlayLayerNode);
1006
- i && this.highlightShapes.set(e, i);
1083
+ let e = this.overlayReader();
1084
+ for (let [t] of this.state.highlights) {
1085
+ let n = e.getRoom(t);
1086
+ if (!n || n.area !== this.state.currentArea || n.z !== this.state.currentZIndex) continue;
1087
+ let r = le(n, this.state.highlights.get(t).colors, this.state.settings), i = this.addStyledShape(ce(r), this.overlayLayerNode);
1088
+ i && this.highlightShapes.set(t, i);
1007
1089
  }
1008
1090
  this.overlayLayerNode.batchDraw();
1009
1091
  }
1010
1092
  syncPaths() {
1011
1093
  this.clearPathShapes();
1012
1094
  let { currentArea: e, currentZIndex: t } = this.state;
1013
- if (!(e === void 0 || t === void 0)) {
1014
- for (let n of this.state.paths) {
1015
- let r = p(this.state.mapReader, this.state.settings, n.locations, n.color, e, t);
1016
- for (let e of f(r)) {
1017
- let t = this.addStyledShape(e, this.overlayLayerNode);
1018
- t && this.pathShapes.push(t);
1019
- }
1095
+ if (e === void 0 || t === void 0) return;
1096
+ let n = this.overlayReader();
1097
+ for (let r of this.state.paths) {
1098
+ let i = w(n, this.state.settings, r.locations, r.color, e, t);
1099
+ for (let e of C(i)) {
1100
+ let t = this.addStyledShape(e, this.overlayLayerNode);
1101
+ t && this.pathShapes.push(t);
1020
1102
  }
1021
- this.overlayLayerNode.batchDraw();
1022
1103
  }
1104
+ this.overlayLayerNode.batchDraw();
1023
1105
  }
1024
1106
  clearOverlayShapes() {
1025
1107
  for (let e of this.highlightShapes.values()) e.destroy();
@@ -1032,7 +1114,7 @@ var N = "rgb(120, 72, 0)", Le = class {
1032
1114
  };
1033
1115
  //#endregion
1034
1116
  //#region src/style/shape/paintMap.ts
1035
- function P(e, t) {
1117
+ function I(e, t) {
1036
1118
  if (e !== void 0) return typeof e == "string" ? t(e) : {
1037
1119
  ...e,
1038
1120
  stops: e.stops.map((e) => ({
@@ -1041,7 +1123,7 @@ function P(e, t) {
1041
1123
  }))
1042
1124
  };
1043
1125
  }
1044
- function F(e) {
1126
+ function L(e) {
1045
1127
  let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
1046
1128
  return t ? {
1047
1129
  r: parseInt(t[1]),
@@ -1055,13 +1137,13 @@ function F(e) {
1055
1137
  a: 1
1056
1138
  } : null;
1057
1139
  }
1058
- function I(e, t, n, r = 1) {
1140
+ function R(e, t, n, r = 1) {
1059
1141
  return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
1060
1142
  }
1061
- function L(e) {
1143
+ function z(e) {
1062
1144
  return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
1063
1145
  }
1064
- function Re(e, t, n) {
1146
+ function Ye(e, t, n) {
1065
1147
  e /= 255, t /= 255, n /= 255;
1066
1148
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
1067
1149
  if (r === i) return [
@@ -1076,99 +1158,99 @@ function Re(e, t, n) {
1076
1158
  a
1077
1159
  ];
1078
1160
  }
1079
- function ze(e, t, n, r = 1) {
1161
+ function Xe(e, t, n, r = 1) {
1080
1162
  e = (e % 360 + 360) % 360;
1081
1163
  let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
1082
- return e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a), I(Math.round((s + o) * 255), Math.round((c + o) * 255), Math.round((l + o) * 255), r);
1164
+ return e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a), R(Math.round((s + o) * 255), Math.round((c + o) * 255), Math.round((l + o) * 255), r);
1083
1165
  }
1084
1166
  //#endregion
1085
1167
  //#region src/style/shape/ParchmentStyle.ts
1086
- var Be = "#4a3728", Ve = "#3b2a1a", He = 139, Ue = 115, We = 85, Ge = 244, Ke = 228, qe = 193;
1087
- function Je(e) {
1088
- let t = F(e);
1089
- if (!t) return I(Ge, Ke, qe);
1090
- let n = L(t);
1091
- return I(Math.round(He + (Ge - He) * n), Math.round(Ue + (Ke - Ue) * n), Math.round(We + (qe - We) * n), t.a);
1168
+ var Ze = "#4a3728", Qe = "#3b2a1a", $e = 139, et = 115, tt = 85, nt = 244, rt = 228, it = 193;
1169
+ function at(e) {
1170
+ let t = L(e);
1171
+ if (!t) return R(nt, rt, it);
1172
+ let n = z(t);
1173
+ return R(Math.round($e + (nt - $e) * n), Math.round(et + (rt - et) * n), Math.round(tt + (it - tt) * n), t.a);
1092
1174
  }
1093
- function Ye(e) {
1094
- let t = F(e);
1095
- if (!t || t.a >= 1) return Be;
1096
- let n = F(Be);
1097
- return I(n.r, n.g, n.b, t.a);
1175
+ function ot(e) {
1176
+ let t = L(e);
1177
+ if (!t || t.a >= 1) return Ze;
1178
+ let n = L(Ze);
1179
+ return R(n.r, n.g, n.b, t.a);
1098
1180
  }
1099
- function Xe(e) {
1181
+ function st(e) {
1100
1182
  return {
1101
1183
  ...e,
1102
- fill: P(e.fill, Je),
1103
- stroke: e.stroke ? Ye(e.stroke) : e.stroke
1184
+ fill: I(e.fill, at),
1185
+ stroke: e.stroke ? ot(e.stroke) : e.stroke
1104
1186
  };
1105
1187
  }
1106
- var Ze = { transform(e) {
1188
+ var ct = { transform(e) {
1107
1189
  switch (e.type) {
1108
1190
  case "rect":
1109
1191
  case "circle":
1110
1192
  case "polygon": return {
1111
1193
  ...e,
1112
- paint: Xe(e.paint)
1194
+ paint: st(e.paint)
1113
1195
  };
1114
1196
  case "line": return {
1115
1197
  ...e,
1116
1198
  paint: e.paint.stroke ? {
1117
1199
  ...e.paint,
1118
- stroke: Ye(e.paint.stroke)
1200
+ stroke: ot(e.paint.stroke)
1119
1201
  } : e.paint
1120
1202
  };
1121
1203
  case "text": return {
1122
1204
  ...e,
1123
- fill: Ve
1205
+ fill: Qe
1124
1206
  };
1125
1207
  case "image":
1126
1208
  case "group": return e;
1127
1209
  }
1128
- } }, Qe = "#c0deff", $e = "#e0f0ff", et = 20, tt = 40, nt = 80, rt = 60, it = 100, at = 160;
1129
- function ot(e) {
1130
- let t = F(e);
1131
- if (!t) return I(rt, it, at);
1132
- let n = L(t);
1133
- return I(Math.round(et + (rt - et) * n), Math.round(tt + (it - tt) * n), Math.round(nt + (at - nt) * n), t.a);
1210
+ } }, lt = "#c0deff", ut = "#e0f0ff", dt = 20, ft = 40, pt = 80, mt = 60, ht = 100, gt = 160;
1211
+ function _t(e) {
1212
+ let t = L(e);
1213
+ if (!t) return R(mt, ht, gt);
1214
+ let n = z(t);
1215
+ return R(Math.round(dt + (mt - dt) * n), Math.round(ft + (ht - ft) * n), Math.round(pt + (gt - pt) * n), t.a);
1134
1216
  }
1135
- function st(e) {
1136
- let t = F(e);
1137
- if (!t || t.a >= 1) return Qe;
1138
- let n = F(Qe);
1139
- return I(n.r, n.g, n.b, t.a);
1217
+ function vt(e) {
1218
+ let t = L(e);
1219
+ if (!t || t.a >= 1) return lt;
1220
+ let n = L(lt);
1221
+ return R(n.r, n.g, n.b, t.a);
1140
1222
  }
1141
- function ct(e) {
1223
+ function yt(e) {
1142
1224
  return {
1143
1225
  ...e,
1144
- fill: P(e.fill, ot),
1145
- stroke: e.stroke ? st(e.stroke) : e.stroke
1226
+ fill: I(e.fill, _t),
1227
+ stroke: e.stroke ? vt(e.stroke) : e.stroke
1146
1228
  };
1147
1229
  }
1148
- var lt = { transform(e) {
1230
+ var bt = { transform(e) {
1149
1231
  switch (e.type) {
1150
1232
  case "rect":
1151
1233
  case "circle":
1152
1234
  case "polygon": return {
1153
1235
  ...e,
1154
- paint: ct(e.paint)
1236
+ paint: yt(e.paint)
1155
1237
  };
1156
1238
  case "line": return {
1157
1239
  ...e,
1158
1240
  paint: e.paint.stroke ? {
1159
1241
  ...e.paint,
1160
- stroke: st(e.paint.stroke)
1242
+ stroke: vt(e.paint.stroke)
1161
1243
  } : e.paint
1162
1244
  };
1163
1245
  case "text": return {
1164
1246
  ...e,
1165
- fill: $e
1247
+ fill: ut
1166
1248
  };
1167
1249
  case "image":
1168
1250
  case "group": return e;
1169
1251
  }
1170
- } }, ut = "#00ffd0", dt = .3, ft = 3;
1171
- function pt(e, t, n) {
1252
+ } }, xt = "#00ffd0", St = .3, Ct = 3;
1253
+ function wt(e, t, n) {
1172
1254
  e /= 255, t /= 255, n /= 255;
1173
1255
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
1174
1256
  if (r === i) return [
@@ -1183,68 +1265,68 @@ function pt(e, t, n) {
1183
1265
  a
1184
1266
  ];
1185
1267
  }
1186
- function mt(e, t, n, r = 1) {
1268
+ function Tt(e, t, n, r = 1) {
1187
1269
  e = (e % 360 + 360) % 360;
1188
1270
  let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
1189
1271
  e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
1190
1272
  let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
1191
1273
  return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
1192
1274
  }
1193
- function ht(e) {
1194
- let t = F(e);
1275
+ function Et(e) {
1276
+ let t = L(e);
1195
1277
  if (!t) return {
1196
1278
  h: 150,
1197
1279
  a: 1
1198
1280
  };
1199
- let [n] = pt(t.r, t.g, t.b);
1281
+ let [n] = wt(t.r, t.g, t.b);
1200
1282
  return {
1201
1283
  h: n,
1202
1284
  a: t.a
1203
1285
  };
1204
1286
  }
1205
- function gt(e) {
1206
- let { h: t, a: n } = ht(e);
1207
- return mt(t, .95, .65, n);
1287
+ function Dt(e) {
1288
+ let { h: t, a: n } = Et(e);
1289
+ return Tt(t, .95, .65, n);
1208
1290
  }
1209
- function _t(e) {
1210
- let t = F(e);
1291
+ function Ot(e) {
1292
+ let t = L(e);
1211
1293
  if (!t) return "rgb(8, 12, 10)";
1212
- let [n] = pt(t.r, t.g, t.b);
1213
- return mt(n, .4, .1, t.a);
1294
+ let [n] = wt(t.r, t.g, t.b);
1295
+ return Tt(n, .4, .1, t.a);
1214
1296
  }
1215
- function vt(e) {
1216
- let { h: t, a: n } = ht(e);
1217
- return mt(t, .95, .65, Math.min(n, dt));
1297
+ function kt(e) {
1298
+ let { h: t, a: n } = Et(e);
1299
+ return Tt(t, .95, .65, Math.min(n, St));
1218
1300
  }
1219
- function yt(e) {
1301
+ function At(e) {
1220
1302
  return {
1221
1303
  ...e,
1222
- fill: P(e.fill, _t),
1223
- stroke: e.stroke ? gt(e.stroke) : e.stroke
1304
+ fill: I(e.fill, Ot),
1305
+ stroke: e.stroke ? Dt(e.stroke) : e.stroke
1224
1306
  };
1225
1307
  }
1226
- function bt(e, t = !1) {
1308
+ function jt(e, t = !1) {
1227
1309
  if (!e.stroke) return e;
1228
- let n = (e.strokeWidth ?? 1) * ft;
1310
+ let n = (e.strokeWidth ?? 1) * Ct;
1229
1311
  return {
1230
- stroke: vt(e.stroke),
1312
+ stroke: kt(e.stroke),
1231
1313
  strokeWidth: n,
1232
1314
  dash: e.dash,
1233
1315
  dashEnabled: e.dashEnabled,
1234
- alpha: t ? dt : e.alpha
1316
+ alpha: t ? St : e.alpha
1235
1317
  };
1236
1318
  }
1237
- var xt = { transform(e) {
1319
+ var Mt = { transform(e) {
1238
1320
  switch (e.type) {
1239
1321
  case "rect": {
1240
1322
  let t = {
1241
1323
  ...e,
1242
- paint: yt(e.paint)
1324
+ paint: At(e.paint)
1243
1325
  };
1244
1326
  return e.paint.stroke ? [{
1245
1327
  ...e,
1246
1328
  paint: {
1247
- ...bt(e.paint),
1329
+ ...jt(e.paint),
1248
1330
  fill: void 0
1249
1331
  }
1250
1332
  }, t] : t;
@@ -1252,12 +1334,12 @@ var xt = { transform(e) {
1252
1334
  case "circle": {
1253
1335
  let t = {
1254
1336
  ...e,
1255
- paint: yt(e.paint)
1337
+ paint: At(e.paint)
1256
1338
  };
1257
1339
  return e.paint.stroke ? [{
1258
1340
  ...e,
1259
1341
  paint: {
1260
- ...bt(e.paint),
1342
+ ...jt(e.paint),
1261
1343
  fill: void 0
1262
1344
  }
1263
1345
  }, t] : t;
@@ -1267,21 +1349,21 @@ var xt = { transform(e) {
1267
1349
  ...e,
1268
1350
  paint: e.paint.stroke ? {
1269
1351
  ...e.paint,
1270
- stroke: gt(e.paint.stroke)
1352
+ stroke: Dt(e.paint.stroke)
1271
1353
  } : e.paint
1272
1354
  };
1273
1355
  return e.paint.stroke ? [{
1274
1356
  ...e,
1275
- paint: bt(e.paint, !0)
1357
+ paint: jt(e.paint, !0)
1276
1358
  }, t] : t;
1277
1359
  }
1278
1360
  case "polygon": return {
1279
1361
  ...e,
1280
- paint: yt(e.paint)
1362
+ paint: At(e.paint)
1281
1363
  };
1282
1364
  case "text": return {
1283
1365
  ...e,
1284
- fill: ut
1366
+ fill: xt
1285
1367
  };
1286
1368
  case "image":
1287
1369
  case "group": return e;
@@ -1289,16 +1371,16 @@ var xt = { transform(e) {
1289
1371
  } };
1290
1372
  //#endregion
1291
1373
  //#region src/style/shape/wobble.ts
1292
- function R(e) {
1374
+ function B(e) {
1293
1375
  let t = e | 0 || 1;
1294
1376
  return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
1295
1377
  }
1296
- function z(...e) {
1378
+ function V(...e) {
1297
1379
  let t = 2654435769;
1298
1380
  for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
1299
1381
  return t;
1300
1382
  }
1301
- function St(e, t, n, r, i, a) {
1383
+ function H(e, t, n, r, i, a) {
1302
1384
  let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
1303
1385
  if (c < .001) return [
1304
1386
  e,
@@ -1313,17 +1395,17 @@ function St(e, t, n, r, i, a) {
1313
1395
  }
1314
1396
  return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
1315
1397
  }
1316
- function Ct(e, t, n) {
1398
+ function Nt(e, t, n) {
1317
1399
  if (e.length < 4) return e;
1318
1400
  let r = [];
1319
1401
  for (let i = 0; i < e.length - 2; i += 2) {
1320
- let a = St(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
1402
+ let a = H(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
1321
1403
  if (i === 0) r.push(...a);
1322
1404
  else for (let e = 2; e < a.length; e++) r.push(a[e]);
1323
1405
  }
1324
1406
  return r;
1325
1407
  }
1326
- function B(e, t, n, r, i, a) {
1408
+ function U(e, t, n, r, i, a) {
1327
1409
  let o = [
1328
1410
  e,
1329
1411
  t,
@@ -1335,12 +1417,12 @@ function B(e, t, n, r, i, a) {
1335
1417
  t + r
1336
1418
  ], s = [];
1337
1419
  for (let e = 0; e < 4; e++) {
1338
- let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = St(t, n, c, l, i, a);
1420
+ let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = H(t, n, c, l, i, a);
1339
1421
  for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
1340
1422
  }
1341
1423
  return s;
1342
1424
  }
1343
- function V(e, t, n, r, i) {
1425
+ function Pt(e, t, n, r, i) {
1344
1426
  let a = [];
1345
1427
  for (let o = 0; o < 24; o++) {
1346
1428
  let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
@@ -1348,31 +1430,31 @@ function V(e, t, n, r, i) {
1348
1430
  }
1349
1431
  return a;
1350
1432
  }
1351
- function H(e, t, n) {
1433
+ function Ft(e, t, n) {
1352
1434
  let r = e.length / 2;
1353
1435
  if (r < 2) return e;
1354
1436
  let i = [];
1355
1437
  for (let a = 0; a < r; a++) {
1356
- let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = St(o, s, l, u, t, n);
1438
+ let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = H(o, s, l, u, t, n);
1357
1439
  for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
1358
1440
  }
1359
1441
  return i;
1360
1442
  }
1361
1443
  //#endregion
1362
1444
  //#region src/style/shape/SketchyStyle.ts
1363
- function wt(e, t) {
1445
+ function It(e, t) {
1364
1446
  if (!t) return e;
1365
1447
  let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
1366
1448
  if (!n) return e;
1367
1449
  let r = parseFloat(n[1]);
1368
1450
  return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
1369
1451
  }
1370
- function Tt(e) {
1452
+ function Lt(e) {
1371
1453
  let { jitter: t, color: n } = e;
1372
1454
  return { transform(e) {
1373
1455
  switch (e.type) {
1374
1456
  case "rect": {
1375
- let r = R(z(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
1457
+ let r = B(V(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
1376
1458
  if (e.cornerRadius && e.cornerRadius > 0) {
1377
1459
  let n = [];
1378
1460
  if (i && n.push({
@@ -1385,7 +1467,7 @@ function Tt(e) {
1385
1467
  }), a && e.paint.strokeWidth) {
1386
1468
  let i = {
1387
1469
  type: "polygon",
1388
- vertices: B(e.x, e.y, e.width, e.height, t, r),
1470
+ vertices: U(e.x, e.y, e.width, e.height, t, r),
1389
1471
  paint: {
1390
1472
  stroke: a,
1391
1473
  strokeWidth: e.paint.strokeWidth
@@ -1400,7 +1482,7 @@ function Tt(e) {
1400
1482
  }
1401
1483
  return {
1402
1484
  type: "polygon",
1403
- vertices: B(e.x, e.y, e.width, e.height, t, r),
1485
+ vertices: U(e.x, e.y, e.width, e.height, t, r),
1404
1486
  paint: {
1405
1487
  fill: i,
1406
1488
  stroke: a,
@@ -1412,10 +1494,10 @@ function Tt(e) {
1412
1494
  };
1413
1495
  }
1414
1496
  case "circle": {
1415
- let r = R(z(e.cx, e.cy, e.radius));
1497
+ let r = B(V(e.cx, e.cy, e.radius));
1416
1498
  return {
1417
1499
  type: "polygon",
1418
- vertices: V(e.cx, e.cy, e.radius, t, r),
1500
+ vertices: Pt(e.cx, e.cy, e.radius, t, r),
1419
1501
  paint: {
1420
1502
  fill: e.paint.fill ? "#ffffff" : void 0,
1421
1503
  stroke: e.paint.stroke ? n : void 0,
@@ -1427,7 +1509,7 @@ function Tt(e) {
1427
1509
  };
1428
1510
  }
1429
1511
  case "line": {
1430
- let r = R(z(...e.points.slice(0, 4))), i = Ct(e.points, t, r), a = wt(n, e.paint.stroke), o = {
1512
+ let r = B(V(...e.points.slice(0, 4))), i = Nt(e.points, t, r), a = It(n, e.paint.stroke), o = {
1431
1513
  ...e.paint,
1432
1514
  stroke: a
1433
1515
  };
@@ -1438,7 +1520,7 @@ function Tt(e) {
1438
1520
  };
1439
1521
  }
1440
1522
  case "polygon": {
1441
- let r = R(z(...e.vertices.slice(0, 4))), i = H(e.vertices, t, r);
1523
+ let r = B(V(...e.vertices.slice(0, 4))), i = Ft(e.vertices, t, r);
1442
1524
  return {
1443
1525
  ...e,
1444
1526
  vertices: i,
@@ -1460,10 +1542,10 @@ function Tt(e) {
1460
1542
  }
1461
1543
  //#endregion
1462
1544
  //#region src/style/shape/IsometricStyle.ts
1463
- function U(e, t) {
1464
- return P(e, (e) => v(e, t));
1465
- }
1466
1545
  function W(e, t) {
1546
+ return I(e, (e) => _(e, t));
1547
+ }
1548
+ function G(e, t) {
1467
1549
  if (!t || typeof t == "string") return t;
1468
1550
  if (t.type === "linear") {
1469
1551
  let [n, r] = e(t.x0, t.y0), [i, a] = e(t.x1, t.y1);
@@ -1486,16 +1568,16 @@ function W(e, t) {
1486
1568
  }
1487
1569
  return i;
1488
1570
  }
1489
- function Et(e) {
1571
+ function Rt(e) {
1490
1572
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
1491
1573
  return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
1492
1574
  }
1493
- function Dt(e) {
1575
+ function zt(e) {
1494
1576
  let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
1495
1577
  return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
1496
1578
  }
1497
- var G = 32;
1498
- function Ot(e, t) {
1579
+ var K = 32;
1580
+ function Bt(e, t) {
1499
1581
  let n = Array(t.length);
1500
1582
  for (let r = 0; r < t.length; r += 2) {
1501
1583
  let [i, a] = e(t[r], t[r + 1]);
@@ -1503,7 +1585,7 @@ function Ot(e, t) {
1503
1585
  }
1504
1586
  return n;
1505
1587
  }
1506
- function kt(e, t, n, r, i) {
1588
+ function Vt(e, t, n, r, i) {
1507
1589
  let [a, o] = e(t, n), [s, c] = e(t + r, n), [l, u] = e(t + r, n + i), [d, f] = e(t, n + i);
1508
1590
  return [
1509
1591
  a,
@@ -1516,8 +1598,8 @@ function kt(e, t, n, r, i) {
1516
1598
  f
1517
1599
  ];
1518
1600
  }
1519
- function At(e = {}) {
1520
- let t = e.rotation ?? 0, n = e.depth ?? .18, r = Et(t), i = Dt(t);
1601
+ function Ht(e = {}) {
1602
+ let t = e.rotation ?? 0, n = e.depth ?? .18, r = Rt(t), i = zt(t);
1521
1603
  function a(e, t, n, i) {
1522
1604
  let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
1523
1605
  return [
@@ -1530,7 +1612,7 @@ function At(e = {}) {
1530
1612
  ];
1531
1613
  }
1532
1614
  function o(e) {
1533
- let { x: t, y: i, width: a, height: o, paint: s } = e, c = kt(r, t, i, a, o);
1615
+ let { x: t, y: i, width: a, height: o, paint: s } = e, c = Vt(r, t, i, a, o);
1534
1616
  if (s.dash || s.dashEnabled) {
1535
1617
  let t = [];
1536
1618
  for (let n = 0; n < 8; n += 2) {
@@ -1556,7 +1638,7 @@ function At(e = {}) {
1556
1638
  if (n > 0 && s.fill) {
1557
1639
  let t = [], i = 0;
1558
1640
  for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[i * 2 + 1] && (i = e);
1559
- let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = W(r, s.fill);
1641
+ let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = G(r, s.fill);
1560
1642
  if (t.push({
1561
1643
  type: "polygon",
1562
1644
  vertices: [
@@ -1569,7 +1651,7 @@ function At(e = {}) {
1569
1651
  u,
1570
1652
  d + n
1571
1653
  ],
1572
- paint: { fill: U(v, .2) },
1654
+ paint: { fill: W(v, .2) },
1573
1655
  layer: e.layer
1574
1656
  }), t.push({
1575
1657
  type: "polygon",
@@ -1583,7 +1665,7 @@ function At(e = {}) {
1583
1665
  a,
1584
1666
  o + n
1585
1667
  ],
1586
- paint: { fill: U(v, .4) },
1668
+ paint: { fill: W(v, .4) },
1587
1669
  layer: e.layer
1588
1670
  }), t.push({
1589
1671
  type: "polygon",
@@ -1639,7 +1721,7 @@ function At(e = {}) {
1639
1721
  type: "polygon",
1640
1722
  vertices: c,
1641
1723
  paint: {
1642
- fill: W(r, s.fill),
1724
+ fill: G(r, s.fill),
1643
1725
  stroke: s.stroke,
1644
1726
  strokeWidth: s.strokeWidth
1645
1727
  },
@@ -1649,15 +1731,15 @@ function At(e = {}) {
1649
1731
  };
1650
1732
  }
1651
1733
  function s(e) {
1652
- let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(G * 2);
1653
- for (let e = 0; e < G; e++) {
1654
- let n = e / G * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
1734
+ let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(K * 2);
1735
+ for (let e = 0; e < K; e++) {
1736
+ let n = e / K * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
1655
1737
  s[e * 2] = o, s[e * 2 + 1] = c;
1656
1738
  }
1657
1739
  if (o.dash || o.dashEnabled) {
1658
1740
  let t = [];
1659
- for (let n = 0; n < G; n++) {
1660
- let r = (n + 1) % G;
1741
+ for (let n = 0; n < K; n++) {
1742
+ let r = (n + 1) % K;
1661
1743
  t.push({
1662
1744
  type: "line",
1663
1745
  points: [
@@ -1676,18 +1758,18 @@ function At(e = {}) {
1676
1758
  }
1677
1759
  return t;
1678
1760
  }
1679
- let c = [], l = W(r, o.fill);
1761
+ let c = [], l = G(r, o.fill);
1680
1762
  if (n > 0 && o.fill) {
1681
1763
  let t = 0, r = 0, i = 0, a = -Infinity, u = Infinity, d = -Infinity;
1682
- for (let e = 0; e < G; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
1764
+ for (let e = 0; e < K; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
1683
1765
  let f = [], p = t;
1684
- for (let e = 0; e <= G && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % G;
1766
+ for (let e = 0; e <= K && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % K;
1685
1767
  for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + n);
1686
1768
  c.push({
1687
1769
  type: "polygon",
1688
1770
  vertices: f,
1689
1771
  paint: {
1690
- fill: U(l, .2),
1772
+ fill: W(l, .2),
1691
1773
  stroke: o.stroke,
1692
1774
  strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
1693
1775
  },
@@ -1695,13 +1777,13 @@ function At(e = {}) {
1695
1777
  });
1696
1778
  let m = [];
1697
1779
  p = i;
1698
- for (let e = 0; e <= G && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % G;
1780
+ for (let e = 0; e <= K && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % K;
1699
1781
  for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + n);
1700
1782
  c.push({
1701
1783
  type: "polygon",
1702
1784
  vertices: m,
1703
1785
  paint: {
1704
- fill: U(l, .4),
1786
+ fill: W(l, .4),
1705
1787
  stroke: o.stroke,
1706
1788
  strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
1707
1789
  },
@@ -1729,14 +1811,14 @@ function At(e = {}) {
1729
1811
  case "circle": return s(e);
1730
1812
  case "line": return {
1731
1813
  ...e,
1732
- points: Ot(r, e.points)
1814
+ points: Bt(r, e.points)
1733
1815
  };
1734
1816
  case "polygon": return {
1735
1817
  ...e,
1736
- vertices: Ot(r, e.vertices),
1818
+ vertices: Bt(r, e.vertices),
1737
1819
  paint: {
1738
1820
  ...e.paint,
1739
- fill: W(r, e.paint.fill)
1821
+ fill: G(r, e.paint.fill)
1740
1822
  }
1741
1823
  };
1742
1824
  case "text": {
@@ -1801,21 +1883,21 @@ function At(e = {}) {
1801
1883
  }
1802
1884
  //#endregion
1803
1885
  //#region src/style/shape/ConstructionStyle.ts
1804
- var K = "#1a1a1a", jt = "#ffc200", Mt = "#ff6600", Nt = 26, Pt = 26, Ft = 26, It = 255, Lt = 194, Rt = 0;
1805
- function zt(e) {
1806
- let t = F(e);
1807
- if (!t) return I(It, Lt, Rt);
1808
- let n = L(t);
1809
- return I(Math.round(Nt + (It - Nt) * n), Math.round(Pt + (Lt - Pt) * n), Math.round(Ft + (Rt - Ft) * n), t.a);
1886
+ var q = "#1a1a1a", Ut = "#ffc200", Wt = "#ff6600", Gt = 26, Kt = 26, qt = 26, Jt = 255, Yt = 194, Xt = 0;
1887
+ function Zt(e) {
1888
+ let t = L(e);
1889
+ if (!t) return R(Jt, Yt, Xt);
1890
+ let n = z(t);
1891
+ return R(Math.round(Gt + (Jt - Gt) * n), Math.round(Kt + (Yt - Kt) * n), Math.round(qt + (Xt - qt) * n), t.a);
1810
1892
  }
1811
- function Bt(e) {
1893
+ function Qt(e) {
1812
1894
  return {
1813
1895
  ...e,
1814
- fill: P(e.fill, zt),
1815
- stroke: e.stroke ? K : e.stroke
1896
+ fill: I(e.fill, Zt),
1897
+ stroke: e.stroke ? q : e.stroke
1816
1898
  };
1817
1899
  }
1818
- function Vt(e, t, n, r) {
1900
+ function $t(e, t, n, r) {
1819
1901
  let i = [], a = e.length;
1820
1902
  for (let o = 0; o < a; o++) {
1821
1903
  let s = e[o], c = e[(o + 1) % a], l = t * s[0] + n * s[1] - r, u = t * c[0] + n * c[1] - r;
@@ -1826,7 +1908,7 @@ function Vt(e, t, n, r) {
1826
1908
  }
1827
1909
  return i;
1828
1910
  }
1829
- function Ht(e, t, n, r, i) {
1911
+ function en(e, t, n, r, i) {
1830
1912
  let a = [
1831
1913
  [e, t],
1832
1914
  [e + n, t],
@@ -1834,37 +1916,37 @@ function Ht(e, t, n, r, i) {
1834
1916
  [e, t + r]
1835
1917
  ], o = i * .4, s = o * .35, c = e + t, l = e + n + t + r, u = Math.floor(c / o) - 1, d = Math.ceil(l / o) + 1, f = [];
1836
1918
  for (let e = u; e <= d; e++) {
1837
- let t = e * o, n = t + s, r = Vt(a, 1, 1, t);
1838
- r = Vt(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
1919
+ let t = e * o, n = t + s, r = $t(a, 1, 1, t);
1920
+ r = $t(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
1839
1921
  }
1840
1922
  return f;
1841
1923
  }
1842
- var Ut = { transform(e, t) {
1924
+ var tn = { transform(e, t) {
1843
1925
  switch (e.type) {
1844
1926
  case "rect": {
1845
1927
  if (!e.paint.fill) return {
1846
1928
  ...e,
1847
- paint: Bt(e.paint)
1929
+ paint: Qt(e.paint)
1848
1930
  };
1849
1931
  let n = {
1850
1932
  ...e,
1851
1933
  paint: {
1852
- fill: K,
1934
+ fill: q,
1853
1935
  strokeWidth: e.paint.strokeWidth
1854
1936
  }
1855
- }, r = Ht(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
1937
+ }, r = en(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
1856
1938
  type: "polygon",
1857
1939
  vertices: t,
1858
1940
  layer: e.layer,
1859
1941
  paint: {
1860
- fill: jt,
1942
+ fill: Ut,
1861
1943
  alpha: .65
1862
1944
  }
1863
1945
  })), i = {
1864
1946
  ...e,
1865
1947
  hit: void 0,
1866
1948
  paint: {
1867
- stroke: K,
1949
+ stroke: q,
1868
1950
  strokeWidth: e.paint.strokeWidth
1869
1951
  }
1870
1952
  };
@@ -1876,38 +1958,38 @@ var Ut = { transform(e, t) {
1876
1958
  }
1877
1959
  case "circle": return {
1878
1960
  ...e,
1879
- paint: Bt(e.paint)
1961
+ paint: Qt(e.paint)
1880
1962
  };
1881
1963
  case "polygon": return {
1882
1964
  ...e,
1883
1965
  paint: {
1884
1966
  ...e.paint,
1885
- fill: e.paint.fill ? Mt : e.paint.fill,
1886
- stroke: e.paint.stroke ? K : e.paint.stroke
1967
+ fill: e.paint.fill ? Wt : e.paint.fill,
1968
+ stroke: e.paint.stroke ? q : e.paint.stroke
1887
1969
  }
1888
1970
  };
1889
1971
  case "line": return {
1890
1972
  ...e,
1891
1973
  paint: e.paint.stroke ? {
1892
1974
  ...e.paint,
1893
- stroke: Mt
1975
+ stroke: Wt
1894
1976
  } : e.paint
1895
1977
  };
1896
1978
  case "text": return {
1897
1979
  ...e,
1898
- fill: Mt,
1899
- stroke: K,
1980
+ fill: Wt,
1981
+ stroke: q,
1900
1982
  strokeWidth: t.roomSize * .25
1901
1983
  };
1902
1984
  case "image":
1903
1985
  case "group": return e;
1904
1986
  }
1905
- } }, Wt = "#c8eeff", Gt = "#00c8ff", Kt = "#00ffaa", qt = .2, Jt = 5, Yt = 190;
1906
- function Xt(e, t, n) {
1987
+ } }, nn = "#c8eeff", rn = "#00c8ff", an = "#00ffaa", on = .2, sn = 5, cn = 190;
1988
+ function ln(e, t, n) {
1907
1989
  e /= 255, t /= 255, n /= 255;
1908
1990
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
1909
1991
  if (r === i) return [
1910
- Yt,
1992
+ cn,
1911
1993
  0,
1912
1994
  a
1913
1995
  ];
@@ -1918,54 +2000,54 @@ function Xt(e, t, n) {
1918
2000
  a
1919
2001
  ];
1920
2002
  }
1921
- function Zt(e, t, n, r = 1) {
2003
+ function un(e, t, n, r = 1) {
1922
2004
  e = (e % 360 + 360) % 360;
1923
2005
  let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
1924
2006
  e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
1925
2007
  let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
1926
2008
  return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
1927
2009
  }
1928
- function Qt(e) {
1929
- let t = F(e);
1930
- if (!t) return Zt(Yt, .55, .18);
1931
- let [n, r] = Xt(t.r, t.g, t.b);
1932
- return Zt(r < .08 ? Yt : n, .55, .18, t.a);
2010
+ function dn(e) {
2011
+ let t = L(e);
2012
+ if (!t) return un(cn, .55, .18);
2013
+ let [n, r] = ln(t.r, t.g, t.b);
2014
+ return un(r < .08 ? cn : n, .55, .18, t.a);
1933
2015
  }
1934
- function $t(e) {
2016
+ function fn(e) {
1935
2017
  return {
1936
2018
  ...e,
1937
- fill: P(e.fill, Qt),
1938
- stroke: e.stroke ? Gt : e.stroke
2019
+ fill: I(e.fill, dn),
2020
+ stroke: e.stroke ? rn : e.stroke
1939
2021
  };
1940
2022
  }
1941
- function en(e) {
2023
+ function pn(e) {
1942
2024
  return {
1943
- stroke: Gt,
1944
- strokeWidth: (e.strokeWidth ?? 1) * Jt,
1945
- alpha: qt
2025
+ stroke: rn,
2026
+ strokeWidth: (e.strokeWidth ?? 1) * sn,
2027
+ alpha: on
1946
2028
  };
1947
2029
  }
1948
- function tn(e) {
2030
+ function mn(e) {
1949
2031
  return {
1950
- stroke: Kt,
1951
- strokeWidth: (e.strokeWidth ?? 1) * Jt,
1952
- alpha: qt,
2032
+ stroke: an,
2033
+ strokeWidth: (e.strokeWidth ?? 1) * sn,
2034
+ alpha: on,
1953
2035
  dash: e.dash,
1954
2036
  dashEnabled: e.dashEnabled
1955
2037
  };
1956
2038
  }
1957
- var nn = { transform(e) {
2039
+ var hn = { transform(e) {
1958
2040
  switch (e.type) {
1959
2041
  case "rect": {
1960
2042
  let t = {
1961
2043
  ...e,
1962
- paint: $t(e.paint)
2044
+ paint: fn(e.paint)
1963
2045
  };
1964
2046
  return e.paint.stroke ? [{
1965
2047
  ...e,
1966
2048
  hit: void 0,
1967
2049
  paint: {
1968
- ...en(e.paint),
2050
+ ...pn(e.paint),
1969
2051
  fill: void 0
1970
2052
  }
1971
2053
  }, t] : t;
@@ -1973,13 +2055,13 @@ var nn = { transform(e) {
1973
2055
  case "circle": {
1974
2056
  let t = {
1975
2057
  ...e,
1976
- paint: $t(e.paint)
2058
+ paint: fn(e.paint)
1977
2059
  };
1978
2060
  return e.paint.stroke ? [{
1979
2061
  ...e,
1980
2062
  hit: void 0,
1981
2063
  paint: {
1982
- ...en(e.paint),
2064
+ ...pn(e.paint),
1983
2065
  fill: void 0
1984
2066
  }
1985
2067
  }, t] : t;
@@ -1996,37 +2078,37 @@ var nn = { transform(e) {
1996
2078
  ...e,
1997
2079
  paint: e.paint.stroke ? {
1998
2080
  ...e.paint,
1999
- stroke: Kt
2081
+ stroke: an
2000
2082
  } : e.paint
2001
2083
  };
2002
2084
  return e.paint.stroke ? [{
2003
2085
  ...e,
2004
2086
  hit: void 0,
2005
- paint: tn(e.paint)
2087
+ paint: mn(e.paint)
2006
2088
  }, t] : t;
2007
2089
  }
2008
2090
  case "polygon": return {
2009
2091
  ...e,
2010
2092
  paint: {
2011
2093
  ...e.paint,
2012
- fill: e.paint.fill ? Kt : e.paint.fill,
2094
+ fill: e.paint.fill ? an : e.paint.fill,
2013
2095
  stroke: void 0
2014
2096
  }
2015
2097
  };
2016
2098
  case "text": return {
2017
2099
  ...e,
2018
- fill: Wt
2100
+ fill: nn
2019
2101
  };
2020
2102
  case "image":
2021
2103
  case "group": return e;
2022
2104
  }
2023
- } }, rn = {
2105
+ } }, gn = {
2024
2106
  lighten: .35,
2025
2107
  darken: .25
2026
2108
  };
2027
- function an(e = {}) {
2028
- let t = e.lighten ?? rn.lighten, n = e.darken ?? rn.darken;
2029
- function r(e, r, i, o, s) {
2109
+ function _n(e = {}) {
2110
+ let t = e.lighten ?? gn.lighten, n = e.darken ?? gn.darken;
2111
+ function r(e, r, i, a, s) {
2030
2112
  let c = e.fill;
2031
2113
  if (typeof c != "string") return e;
2032
2114
  let l = {
@@ -2037,10 +2119,10 @@ function an(e = {}) {
2037
2119
  y1: i + s,
2038
2120
  stops: [{
2039
2121
  offset: 0,
2040
- color: a(c, t)
2122
+ color: o(c, t)
2041
2123
  }, {
2042
2124
  offset: 1,
2043
- color: v(c, n)
2125
+ color: _(c, n)
2044
2126
  }]
2045
2127
  };
2046
2128
  return {
@@ -2076,124 +2158,124 @@ function an(e = {}) {
2076
2158
  }
2077
2159
  //#endregion
2078
2160
  //#region src/style/shape/StainedGlassStyle.ts
2079
- var on = "#0a0a0a", sn = "#f4f0e0", cn = .6, ln = .4, un = .62, dn = 2.2, fn = .06;
2080
- function pn(e) {
2081
- let t = F(e);
2161
+ var vn = "#0a0a0a", yn = "#f4f0e0", bn = .6, xn = .4, Sn = .62, Cn = 2.2, wn = .06;
2162
+ function Tn(e) {
2163
+ let t = L(e);
2082
2164
  if (!t) return e;
2083
- let [n, r, i] = Re(t.r, t.g, t.b);
2084
- return ze(n, r < .08 ? r : Math.max(r, cn), Math.min(un, Math.max(ln, i)), t.a);
2165
+ let [n, r, i] = Ye(t.r, t.g, t.b);
2166
+ return Xe(n, r < .08 ? r : Math.max(r, bn), Math.min(Sn, Math.max(xn, i)), t.a);
2085
2167
  }
2086
- function mn(e) {
2087
- return Math.max((e ?? .04) * dn, fn);
2168
+ function En(e) {
2169
+ return Math.max((e ?? .04) * Cn, wn);
2088
2170
  }
2089
- function hn(e) {
2090
- let t = P(e.fill, pn), n = t !== void 0 || e.stroke !== void 0;
2171
+ function Dn(e) {
2172
+ let t = I(e.fill, Tn), n = t !== void 0 || e.stroke !== void 0;
2091
2173
  return {
2092
2174
  ...e,
2093
2175
  fill: t,
2094
- stroke: n ? on : void 0,
2095
- strokeWidth: n ? mn(e.strokeWidth) : e.strokeWidth,
2176
+ stroke: n ? vn : void 0,
2177
+ strokeWidth: n ? En(e.strokeWidth) : e.strokeWidth,
2096
2178
  dash: void 0,
2097
2179
  dashEnabled: void 0
2098
2180
  };
2099
2181
  }
2100
- var gn = { transform(e) {
2182
+ var On = { transform(e) {
2101
2183
  switch (e.type) {
2102
2184
  case "rect":
2103
2185
  case "circle":
2104
2186
  case "polygon": return {
2105
2187
  ...e,
2106
- paint: hn(e.paint)
2188
+ paint: Dn(e.paint)
2107
2189
  };
2108
2190
  case "line": return {
2109
2191
  ...e,
2110
2192
  paint: e.paint.stroke ? {
2111
2193
  ...e.paint,
2112
- stroke: on,
2113
- strokeWidth: mn(e.paint.strokeWidth)
2194
+ stroke: vn,
2195
+ strokeWidth: En(e.paint.strokeWidth)
2114
2196
  } : e.paint
2115
2197
  };
2116
2198
  case "text": return {
2117
2199
  ...e,
2118
- fill: sn
2200
+ fill: yn
2119
2201
  };
2120
2202
  case "image":
2121
2203
  case "group": return e;
2122
2204
  }
2123
- } }, _n = "#1c3f6e", vn = 1.4, yn = .05, bn = 198, xn = 212, Sn = 230, Cn = 248, wn = 250, Tn = 255;
2124
- function En(e) {
2125
- let t = F(e);
2126
- if (!t) return I(Cn, wn, Tn);
2127
- let n = L(t);
2128
- return I(Math.round(bn + (Cn - bn) * n), Math.round(xn + (wn - xn) * n), Math.round(Sn + (Tn - Sn) * n), t.a);
2205
+ } }, kn = "#1c3f6e", An = 1.4, jn = .05, Mn = 198, Nn = 212, Pn = 230, Fn = 248, In = 250, Ln = 255;
2206
+ function Rn(e) {
2207
+ let t = L(e);
2208
+ if (!t) return R(Fn, In, Ln);
2209
+ let n = z(t);
2210
+ return R(Math.round(Mn + (Fn - Mn) * n), Math.round(Nn + (In - Nn) * n), Math.round(Pn + (Ln - Pn) * n), t.a);
2129
2211
  }
2130
- function Dn(e) {
2131
- let t = F(e);
2132
- if (!t || t.a >= 1) return _n;
2133
- let n = F(_n);
2134
- return I(n.r, n.g, n.b, t.a);
2212
+ function zn(e) {
2213
+ let t = L(e);
2214
+ if (!t || t.a >= 1) return kn;
2215
+ let n = L(kn);
2216
+ return R(n.r, n.g, n.b, t.a);
2135
2217
  }
2136
- function On(e) {
2137
- return Math.max((e ?? .04) * vn, yn);
2218
+ function Bn(e) {
2219
+ return Math.max((e ?? .04) * An, jn);
2138
2220
  }
2139
- function kn(e) {
2221
+ function Vn(e) {
2140
2222
  return {
2141
2223
  ...e,
2142
- fill: P(e.fill, En),
2143
- stroke: e.stroke ? Dn(e.stroke) : e.stroke,
2144
- strokeWidth: e.stroke ? On(e.strokeWidth) : e.strokeWidth
2224
+ fill: I(e.fill, Rn),
2225
+ stroke: e.stroke ? zn(e.stroke) : e.stroke,
2226
+ strokeWidth: e.stroke ? Bn(e.strokeWidth) : e.strokeWidth
2145
2227
  };
2146
2228
  }
2147
- var An = { transform(e) {
2229
+ var Hn = { transform(e) {
2148
2230
  switch (e.type) {
2149
2231
  case "rect":
2150
2232
  case "circle":
2151
2233
  case "polygon": return {
2152
2234
  ...e,
2153
- paint: kn(e.paint)
2235
+ paint: Vn(e.paint)
2154
2236
  };
2155
2237
  case "line": return e.paint.stroke ? {
2156
2238
  ...e,
2157
2239
  paint: {
2158
2240
  ...e.paint,
2159
- stroke: Dn(e.paint.stroke),
2160
- strokeWidth: e.grid ? e.paint.strokeWidth : On(e.paint.strokeWidth)
2241
+ stroke: zn(e.paint.stroke),
2242
+ strokeWidth: e.grid ? e.paint.strokeWidth : Bn(e.paint.strokeWidth)
2161
2243
  }
2162
2244
  } : e;
2163
2245
  case "text": return {
2164
2246
  ...e,
2165
- fill: _n
2247
+ fill: kn
2166
2248
  };
2167
2249
  case "image":
2168
2250
  case "group": return e;
2169
2251
  }
2170
- } }, jn = "#7a6a48", Mn = "#8a7a55", Nn = "#4a3f28", Pn = 78, Fn = 93, In = 52, Ln = 221, Rn = 207, zn = 166, Bn = 2, Vn = .26, Hn = .02;
2171
- function Un(e) {
2172
- let t = F(e);
2173
- if (!t) return I(Ln, Rn, zn);
2174
- let n = L(t);
2175
- return I(Math.round(Pn + (Ln - Pn) * n), Math.round(Fn + (Rn - Fn) * n), Math.round(In + (zn - In) * n), t.a);
2252
+ } }, Un = "#7a6a48", Wn = "#8a7a55", Gn = "#4a3f28", Kn = 78, qn = 93, Jn = 52, Yn = 221, Xn = 207, Zn = 166, Qn = 2, $n = .26, er = .02;
2253
+ function tr(e) {
2254
+ let t = L(e);
2255
+ if (!t) return R(Yn, Xn, Zn);
2256
+ let n = z(t);
2257
+ return R(Math.round(Kn + (Yn - Kn) * n), Math.round(qn + (Xn - qn) * n), Math.round(Jn + (Zn - Jn) * n), t.a);
2176
2258
  }
2177
- function Wn(e) {
2259
+ function nr(e) {
2178
2260
  return {
2179
2261
  ...e,
2180
- fill: P(e.fill, Un),
2181
- stroke: e.stroke ? jn : e.stroke
2262
+ fill: I(e.fill, tr),
2263
+ stroke: e.stroke ? Un : e.stroke
2182
2264
  };
2183
2265
  }
2184
- var Gn = {
2185
- stroke: jn,
2186
- strokeWidth: Hn
2187
- }, Kn = { transform(e) {
2266
+ var rr = {
2267
+ stroke: Un,
2268
+ strokeWidth: er
2269
+ }, ir = { transform(e) {
2188
2270
  switch (e.type) {
2189
2271
  case "rect": {
2190
2272
  let t = {
2191
2273
  ...e,
2192
- paint: Wn(e.paint)
2274
+ paint: nr(e.paint)
2193
2275
  };
2194
2276
  if (!e.paint.fill) return t;
2195
- let n = [t], r = Math.min(e.width, e.height) / 2 * Vn, i = Math.min(e.width, e.height) * .12;
2196
- for (let t = 1; t <= Bn; t++) {
2277
+ let n = [t], r = Math.min(e.width, e.height) / 2 * $n, i = Math.min(e.width, e.height) * .12;
2278
+ for (let t = 1; t <= Qn; t++) {
2197
2279
  let a = r * t, o = e.width - a * 2, s = e.height - a * 2;
2198
2280
  if (o <= i || s <= i) break;
2199
2281
  n.push({
@@ -2203,7 +2285,7 @@ var Gn = {
2203
2285
  width: o,
2204
2286
  height: s,
2205
2287
  cornerRadius: e.cornerRadius,
2206
- paint: Gn,
2288
+ paint: rr,
2207
2289
  layer: e.layer,
2208
2290
  noScale: e.noScale
2209
2291
  });
@@ -2213,11 +2295,11 @@ var Gn = {
2213
2295
  case "circle": {
2214
2296
  let t = {
2215
2297
  ...e,
2216
- paint: Wn(e.paint)
2298
+ paint: nr(e.paint)
2217
2299
  };
2218
2300
  if (!e.paint.fill) return t;
2219
- let n = [t], r = e.radius * Vn;
2220
- for (let t = 1; t <= Bn; t++) {
2301
+ let n = [t], r = e.radius * $n;
2302
+ for (let t = 1; t <= Qn; t++) {
2221
2303
  let i = e.radius - r * t;
2222
2304
  if (i <= e.radius * .12) break;
2223
2305
  n.push({
@@ -2225,7 +2307,7 @@ var Gn = {
2225
2307
  cx: e.cx,
2226
2308
  cy: e.cy,
2227
2309
  radius: i,
2228
- paint: Gn,
2310
+ paint: rr,
2229
2311
  layer: e.layer,
2230
2312
  noScale: e.noScale
2231
2313
  });
@@ -2235,21 +2317,21 @@ var Gn = {
2235
2317
  case "polygon": {
2236
2318
  let t = {
2237
2319
  ...e,
2238
- paint: Wn(e.paint)
2320
+ paint: nr(e.paint)
2239
2321
  };
2240
2322
  if (!e.paint.fill) return t;
2241
2323
  let n = [t], r = e.vertices.length / 2, i = 0, a = 0;
2242
2324
  for (let t = 0; t < r; t++) i += e.vertices[t * 2], a += e.vertices[t * 2 + 1];
2243
2325
  i /= r, a /= r;
2244
- for (let t = 1; t <= Bn; t++) {
2245
- let o = 1 - Vn * t;
2326
+ for (let t = 1; t <= Qn; t++) {
2327
+ let o = 1 - $n * t;
2246
2328
  if (o <= .15) break;
2247
2329
  let s = [];
2248
2330
  for (let t = 0; t < r; t++) s.push(i + (e.vertices[t * 2] - i) * o, a + (e.vertices[t * 2 + 1] - a) * o);
2249
2331
  n.push({
2250
2332
  type: "polygon",
2251
2333
  vertices: s,
2252
- paint: Gn,
2334
+ paint: rr,
2253
2335
  layer: e.layer,
2254
2336
  noScale: e.noScale
2255
2337
  });
@@ -2260,29 +2342,29 @@ var Gn = {
2260
2342
  ...e,
2261
2343
  paint: {
2262
2344
  ...e.paint,
2263
- stroke: Mn
2345
+ stroke: Wn
2264
2346
  }
2265
2347
  } : e;
2266
2348
  case "text": return {
2267
2349
  ...e,
2268
- fill: Nn
2350
+ fill: Gn
2269
2351
  };
2270
2352
  case "image":
2271
2353
  case "group": return e;
2272
2354
  }
2273
- } }, qn = "#3a3a44";
2274
- function Jn(e, t) {
2275
- return P(e, (e) => {
2276
- let n = F(e);
2355
+ } }, ar = "#3a3a44";
2356
+ function or(e, t) {
2357
+ return I(e, (e) => {
2358
+ let n = L(e);
2277
2359
  return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${(n.a * t).toFixed(3)})` : e;
2278
2360
  });
2279
2361
  }
2280
- function Yn(e = {}) {
2362
+ function sr(e = {}) {
2281
2363
  let t = e.bleed ?? .05, n = Math.max(1, Math.min(4, e.layers ?? 2)), r = e.alpha ?? .4;
2282
2364
  function i(e, t, i, a, o, s) {
2283
- let c = Jn(t.fill, r), l = [];
2365
+ let c = or(t.fill, r), l = [];
2284
2366
  for (let t = 0; t < n; t++) {
2285
- let n = R(i + t * 2654435769);
2367
+ let n = B(i + t * 2654435769);
2286
2368
  l.push({
2287
2369
  type: "polygon",
2288
2370
  vertices: e(n),
@@ -2301,10 +2383,10 @@ function Yn(e = {}) {
2301
2383
  switch (e.type) {
2302
2384
  case "rect":
2303
2385
  if (!e.paint.fill) {
2304
- let n = R(z(e.x, e.y, e.width, e.height));
2386
+ let n = B(V(e.x, e.y, e.width, e.height));
2305
2387
  return {
2306
2388
  type: "polygon",
2307
- vertices: B(e.x, e.y, e.width, e.height, t, n),
2389
+ vertices: U(e.x, e.y, e.width, e.height, t, n),
2308
2390
  paint: {
2309
2391
  stroke: e.paint.stroke,
2310
2392
  strokeWidth: e.paint.strokeWidth ?? 0,
@@ -2315,13 +2397,13 @@ function Yn(e = {}) {
2315
2397
  noScale: e.noScale
2316
2398
  };
2317
2399
  }
2318
- return i((n) => B(e.x, e.y, e.width, e.height, t, n), e.paint, z(e.x, e.y, e.width, e.height), e.layer, e.hit, e.noScale);
2400
+ return i((n) => U(e.x, e.y, e.width, e.height, t, n), e.paint, V(e.x, e.y, e.width, e.height), e.layer, e.hit, e.noScale);
2319
2401
  case "circle":
2320
2402
  if (!e.paint.fill) {
2321
- let n = R(z(e.cx, e.cy, e.radius));
2403
+ let n = B(V(e.cx, e.cy, e.radius));
2322
2404
  return {
2323
2405
  type: "polygon",
2324
- vertices: V(e.cx, e.cy, e.radius, t, n),
2406
+ vertices: Pt(e.cx, e.cy, e.radius, t, n),
2325
2407
  paint: {
2326
2408
  stroke: e.paint.stroke,
2327
2409
  strokeWidth: e.paint.strokeWidth ?? 0,
@@ -2332,20 +2414,20 @@ function Yn(e = {}) {
2332
2414
  noScale: e.noScale
2333
2415
  };
2334
2416
  }
2335
- return i((n) => V(e.cx, e.cy, e.radius, t, n), e.paint, z(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
2417
+ return i((n) => Pt(e.cx, e.cy, e.radius, t, n), e.paint, V(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
2336
2418
  case "polygon":
2337
2419
  if (!e.paint.fill) {
2338
- let n = R(z(...e.vertices.slice(0, 4)));
2420
+ let n = B(V(...e.vertices.slice(0, 4)));
2339
2421
  return {
2340
2422
  ...e,
2341
- vertices: H(e.vertices, t, n),
2423
+ vertices: Ft(e.vertices, t, n),
2342
2424
  paint: {
2343
2425
  ...e.paint,
2344
2426
  alpha: .5
2345
2427
  }
2346
2428
  };
2347
2429
  }
2348
- return i((n) => H(e.vertices, t, n), e.paint, z(...e.vertices.slice(0, 4)), e.layer, e.hit, e.noScale);
2430
+ return i((n) => Ft(e.vertices, t, n), e.paint, V(...e.vertices.slice(0, 4)), e.layer, e.hit, e.noScale);
2349
2431
  case "line": return {
2350
2432
  ...e,
2351
2433
  paint: {
@@ -2355,7 +2437,7 @@ function Yn(e = {}) {
2355
2437
  };
2356
2438
  case "text": return {
2357
2439
  ...e,
2358
- fill: qn
2440
+ fill: ar
2359
2441
  };
2360
2442
  case "image":
2361
2443
  case "group": return e;
@@ -2364,32 +2446,32 @@ function Yn(e = {}) {
2364
2446
  }
2365
2447
  //#endregion
2366
2448
  //#region src/style/shape/DarkModernStyle.ts
2367
- var Xn = "rgba(255, 255, 255, 0.14)", Zn = "#5b6573", Qn = "#e6e8ec", $n = "rgba(0, 0, 0, 0.38)", er = .08, tr = .34;
2368
- function nr(e) {
2369
- let t = F(e);
2449
+ var cr = "rgba(255, 255, 255, 0.14)", lr = "#5b6573", ur = "#e6e8ec", dr = "rgba(0, 0, 0, 0.38)", fr = .08, pr = .34;
2450
+ function mr(e) {
2451
+ let t = L(e);
2370
2452
  if (!t) return "rgb(38, 42, 48)";
2371
- let [n, r, i] = Re(t.r, t.g, t.b);
2372
- return ze(n, Math.min(r, tr), .22 + i * .18, t.a);
2453
+ let [n, r, i] = Ye(t.r, t.g, t.b);
2454
+ return Xe(n, Math.min(r, pr), .22 + i * .18, t.a);
2373
2455
  }
2374
- function rr(e) {
2456
+ function hr(e) {
2375
2457
  return {
2376
2458
  ...e,
2377
- fill: P(e.fill, nr),
2378
- stroke: e.stroke ? Xn : e.stroke
2459
+ fill: I(e.fill, mr),
2460
+ stroke: e.stroke ? cr : e.stroke
2379
2461
  };
2380
2462
  }
2381
- function ir(e) {
2463
+ function gr(e) {
2382
2464
  return e.hit?.kind === "room" && e.paint.fill !== void 0;
2383
2465
  }
2384
- var ar = { transform(e, t) {
2466
+ var _r = { transform(e, t) {
2385
2467
  switch (e.type) {
2386
2468
  case "rect": {
2387
2469
  let n = {
2388
2470
  ...e,
2389
- paint: rr(e.paint)
2471
+ paint: hr(e.paint)
2390
2472
  };
2391
- if (!ir(e)) return n;
2392
- let r = t.roomSize * er;
2473
+ if (!gr(e)) return n;
2474
+ let r = t.roomSize * fr;
2393
2475
  return [{
2394
2476
  type: "rect",
2395
2477
  x: e.x + r,
@@ -2397,7 +2479,7 @@ var ar = { transform(e, t) {
2397
2479
  width: e.width,
2398
2480
  height: e.height,
2399
2481
  cornerRadius: e.cornerRadius,
2400
- paint: { fill: $n },
2482
+ paint: { fill: dr },
2401
2483
  layer: e.layer,
2402
2484
  noScale: e.noScale
2403
2485
  }, n];
@@ -2405,82 +2487,82 @@ var ar = { transform(e, t) {
2405
2487
  case "circle": {
2406
2488
  let n = {
2407
2489
  ...e,
2408
- paint: rr(e.paint)
2490
+ paint: hr(e.paint)
2409
2491
  };
2410
- if (!ir(e)) return n;
2411
- let r = t.roomSize * er;
2492
+ if (!gr(e)) return n;
2493
+ let r = t.roomSize * fr;
2412
2494
  return [{
2413
2495
  type: "circle",
2414
2496
  cx: e.cx + r,
2415
2497
  cy: e.cy + r,
2416
2498
  radius: e.radius,
2417
- paint: { fill: $n },
2499
+ paint: { fill: dr },
2418
2500
  layer: e.layer,
2419
2501
  noScale: e.noScale
2420
2502
  }, n];
2421
2503
  }
2422
2504
  case "polygon": return {
2423
2505
  ...e,
2424
- paint: rr(e.paint)
2506
+ paint: hr(e.paint)
2425
2507
  };
2426
2508
  case "line": return {
2427
2509
  ...e,
2428
2510
  paint: e.paint.stroke ? {
2429
2511
  ...e.paint,
2430
- stroke: Zn
2512
+ stroke: lr
2431
2513
  } : e.paint
2432
2514
  };
2433
2515
  case "text": return {
2434
2516
  ...e,
2435
- fill: Qn
2517
+ fill: ur
2436
2518
  };
2437
2519
  case "image":
2438
2520
  case "group": return e;
2439
2521
  }
2440
- } }, q = "#5a3a22", or = "#43301c", sr = 120, cr = 86, lr = 50, ur = 232, J = 205, dr = 158;
2441
- function fr(e) {
2442
- let t = F(e);
2443
- if (!t) return I(ur, J, dr);
2444
- let n = L(t);
2445
- return I(Math.round(sr + (ur - sr) * n), Math.round(cr + (J - cr) * n), Math.round(lr + (dr - lr) * n), t.a);
2522
+ } }, J = "#5a3a22", vr = "#43301c", yr = 120, br = 86, xr = 50, Sr = 232, Cr = 205, wr = 158;
2523
+ function Tr(e) {
2524
+ let t = L(e);
2525
+ if (!t) return R(Sr, Cr, wr);
2526
+ let n = z(t);
2527
+ return R(Math.round(yr + (Sr - yr) * n), Math.round(br + (Cr - br) * n), Math.round(xr + (wr - xr) * n), t.a);
2446
2528
  }
2447
- function pr(e) {
2448
- let t = F(e);
2449
- if (!t || t.a >= 1) return q;
2450
- let n = F(q);
2451
- return I(n.r, n.g, n.b, t.a);
2529
+ function Er(e) {
2530
+ let t = L(e);
2531
+ if (!t || t.a >= 1) return J;
2532
+ let n = L(J);
2533
+ return R(n.r, n.g, n.b, t.a);
2452
2534
  }
2453
- function mr(e) {
2535
+ function Dr(e) {
2454
2536
  return {
2455
2537
  ...e,
2456
- fill: P(e.fill, fr),
2457
- stroke: e.stroke ? pr(e.stroke) : e.stroke
2538
+ fill: I(e.fill, Tr),
2539
+ stroke: e.stroke ? Er(e.stroke) : e.stroke
2458
2540
  };
2459
2541
  }
2460
- var hr = { transform(e) {
2542
+ var Or = { transform(e) {
2461
2543
  switch (e.type) {
2462
2544
  case "rect":
2463
2545
  case "circle":
2464
2546
  case "polygon": return {
2465
2547
  ...e,
2466
- paint: mr(e.paint)
2548
+ paint: Dr(e.paint)
2467
2549
  };
2468
2550
  case "line": return {
2469
2551
  ...e,
2470
2552
  paint: e.paint.stroke ? {
2471
2553
  ...e.paint,
2472
- stroke: pr(e.paint.stroke)
2554
+ stroke: Er(e.paint.stroke)
2473
2555
  } : e.paint
2474
2556
  };
2475
2557
  case "text": return {
2476
2558
  ...e,
2477
- fill: or
2559
+ fill: vr
2478
2560
  };
2479
2561
  case "image":
2480
2562
  case "group": return e;
2481
2563
  }
2482
2564
  } };
2483
- function gr(e, t, n) {
2565
+ function kr(e, t, n) {
2484
2566
  let r = [], i = n * .42;
2485
2567
  for (let a = 0; a < 8; a++) {
2486
2568
  let o = (-90 + a * 45) * (Math.PI / 180), s = a % 2 == 0 ? n : i;
@@ -2488,7 +2570,7 @@ function gr(e, t, n) {
2488
2570
  }
2489
2571
  return r;
2490
2572
  }
2491
- function _r() {
2573
+ function Ar() {
2492
2574
  let e;
2493
2575
  return {
2494
2576
  attach(t) {
@@ -2508,7 +2590,7 @@ function _r() {
2508
2590
  width: n - e * 2,
2509
2591
  height: r - e * 2,
2510
2592
  paint: {
2511
- stroke: q,
2593
+ stroke: J,
2512
2594
  strokeWidth: s
2513
2595
  },
2514
2596
  layer: "top"
@@ -2520,16 +2602,16 @@ function _r() {
2520
2602
  cy: d,
2521
2603
  radius: l * 1.25,
2522
2604
  paint: {
2523
- stroke: q,
2605
+ stroke: J,
2524
2606
  strokeWidth: s
2525
2607
  },
2526
2608
  layer: "top"
2527
2609
  }), c.push({
2528
2610
  type: "polygon",
2529
- vertices: gr(u, d, l),
2611
+ vertices: kr(u, d, l),
2530
2612
  paint: {
2531
- fill: I(ur, J, dr, .85),
2532
- stroke: q,
2613
+ fill: R(Sr, Cr, wr, .85),
2614
+ stroke: J,
2533
2615
  strokeWidth: s
2534
2616
  },
2535
2617
  layer: "top"
@@ -2538,7 +2620,7 @@ function _r() {
2538
2620
  cx: u,
2539
2621
  cy: d,
2540
2622
  radius: l * .16,
2541
- paint: { fill: q },
2623
+ paint: { fill: J },
2542
2624
  layer: "top"
2543
2625
  }), c.push({
2544
2626
  type: "text",
@@ -2547,7 +2629,7 @@ function _r() {
2547
2629
  text: "N",
2548
2630
  fontSize: l * .5,
2549
2631
  fontStyle: "bold",
2550
- fill: or,
2632
+ fill: vr,
2551
2633
  align: "center",
2552
2634
  verticalAlign: "middle",
2553
2635
  layer: "top"
@@ -2557,22 +2639,22 @@ function _r() {
2557
2639
  }
2558
2640
  //#endregion
2559
2641
  //#region src/style/index.ts
2560
- var vr = Ze, yr = lt, br = xt;
2561
- function xr(e) {
2562
- return Tt(e);
2642
+ var jr = ct, Mr = bt, Nr = Mt;
2643
+ function Pr(e) {
2644
+ return Lt(e);
2563
2645
  }
2564
- function Sr(e = {}) {
2565
- return At(e);
2646
+ function Fr(e = {}) {
2647
+ return Ht(e);
2566
2648
  }
2567
- var Cr = Ut, wr = nn;
2568
- function Tr(e = {}) {
2569
- return an(e);
2649
+ var Ir = tn, Lr = hn;
2650
+ function Rr(e = {}) {
2651
+ return _n(e);
2570
2652
  }
2571
- var Er = gn, Dr = An, Or = Kn;
2572
- function kr(e = {}) {
2573
- return Yn(e);
2653
+ var zr = On, Br = Hn, Vr = ir;
2654
+ function Hr(e = {}) {
2655
+ return sr(e);
2574
2656
  }
2575
- var Ar = ar, jr = hr, Mr = class {
2657
+ var Ur = _r, Wr = Or, Gr = class {
2576
2658
  get settings() {
2577
2659
  return this.state.settings;
2578
2660
  }
@@ -2589,7 +2671,7 @@ var Ar = ar, jr = hr, Mr = class {
2589
2671
  return this.backend.events;
2590
2672
  }
2591
2673
  constructor(e, t, n, r) {
2592
- this.currentStyle = u, this.state = new be(e, t ?? ye()), this.backend = r ? r(this.state) : new Le(this.state, n);
2674
+ this.currentStyle = x, this.state = new Ae(e, t ?? ke()), this.backend = r ? r(this.state) : new Je(this.state, n);
2593
2675
  }
2594
2676
  destroy() {
2595
2677
  this.backend.destroy();
@@ -2643,7 +2725,7 @@ var Ar = ar, jr = hr, Mr = class {
2643
2725
  this.currentStyle = e, this.backend.setStyle(e);
2644
2726
  }
2645
2727
  clearStyle() {
2646
- this.setStyle(u);
2728
+ this.setStyle(x);
2647
2729
  }
2648
2730
  getStyle() {
2649
2731
  return this.currentStyle;
@@ -2745,15 +2827,15 @@ var Ar = ar, jr = hr, Mr = class {
2745
2827
  getCullingMode() {
2746
2828
  return this.state.settings.cullingMode;
2747
2829
  }
2748
- }, Nr = "room";
2749
- function Pr(e, t) {
2830
+ }, Kr = "room";
2831
+ function qr(e, t) {
2750
2832
  let n = /* @__PURE__ */ new Map();
2751
2833
  function r(e) {
2752
2834
  let t = n.get(e);
2753
2835
  return t || (t = [], n.set(e, t)), t;
2754
2836
  }
2755
2837
  function i(e, t, n, i, o, s, c) {
2756
- let l = e.layer ?? c ?? Nr;
2838
+ let l = e.layer ?? c ?? Kr;
2757
2839
  switch (e.type) {
2758
2840
  case "rect": {
2759
2841
  let a = {
@@ -2762,11 +2844,11 @@ function Pr(e, t) {
2762
2844
  y: (n + e.y) * i + s,
2763
2845
  w: e.width * i,
2764
2846
  h: e.height * i,
2765
- fill: M(e.paint.fill, t, n, i, o, s),
2847
+ fill: P(e.paint.fill, t, n, i, o, s),
2766
2848
  stroke: e.paint.stroke,
2767
2849
  sw: (e.paint.strokeWidth ?? 0) * i,
2768
2850
  cr: (e.cornerRadius ?? 0) * i,
2769
- dash: Ir(e.paint.dash, i, e.paint.dashEnabled)
2851
+ dash: Yr(e.paint.dash, i, e.paint.dashEnabled)
2770
2852
  };
2771
2853
  r(l).push(a);
2772
2854
  return;
@@ -2777,19 +2859,19 @@ function Pr(e, t) {
2777
2859
  cx: (t + e.cx) * i + o,
2778
2860
  cy: (n + e.cy) * i + s,
2779
2861
  r: e.radius * i,
2780
- fill: M(e.paint.fill, t, n, i, o, s),
2862
+ fill: P(e.paint.fill, t, n, i, o, s),
2781
2863
  stroke: e.paint.stroke,
2782
2864
  sw: (e.paint.strokeWidth ?? 0) * i,
2783
- dash: Ir(e.paint.dash, i, e.paint.dashEnabled)
2865
+ dash: Yr(e.paint.dash, i, e.paint.dashEnabled)
2784
2866
  });
2785
2867
  return;
2786
2868
  case "line": {
2787
2869
  let a = {
2788
2870
  type: "line",
2789
- points: Fr(e.points, t, n, i, o, s),
2871
+ points: Jr(e.points, t, n, i, o, s),
2790
2872
  stroke: e.paint.stroke,
2791
2873
  sw: (e.paint.strokeWidth ?? 0) * i,
2792
- dash: Ir(e.paint.dash, i, e.paint.dashEnabled),
2874
+ dash: Yr(e.paint.dash, i, e.paint.dashEnabled),
2793
2875
  lineCap: e.lineCap,
2794
2876
  lineJoin: e.lineJoin,
2795
2877
  alpha: e.paint.alpha
@@ -2800,8 +2882,8 @@ function Pr(e, t) {
2800
2882
  case "polygon": {
2801
2883
  let a = {
2802
2884
  type: "polygon",
2803
- vertices: Fr(e.vertices, t, n, i, o, s),
2804
- fill: M(e.paint.fill, t, n, i, o, s),
2885
+ vertices: Jr(e.vertices, t, n, i, o, s),
2886
+ fill: P(e.paint.fill, t, n, i, o, s),
2805
2887
  stroke: e.paint.stroke,
2806
2888
  sw: (e.paint.strokeWidth ?? 0) * i
2807
2889
  };
@@ -2809,7 +2891,7 @@ function Pr(e, t) {
2809
2891
  return;
2810
2892
  }
2811
2893
  case "text": {
2812
- let a = Lr(e.transform, t, n, i, o, s), c = {
2894
+ let a = Xr(e.transform, t, n, i, o, s), c = {
2813
2895
  type: "text",
2814
2896
  x: a ? 0 : (t + e.x) * i + o,
2815
2897
  y: a ? 0 : (n + e.y) * i + s,
@@ -2832,7 +2914,7 @@ function Pr(e, t) {
2832
2914
  return;
2833
2915
  }
2834
2916
  case "image": {
2835
- let a = Lr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
2917
+ let a = Xr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
2836
2918
  r(l).push({
2837
2919
  type: "image",
2838
2920
  x: c,
@@ -2852,7 +2934,7 @@ function Pr(e, t) {
2852
2934
  function a(e, t, n, a, o, s, c) {
2853
2935
  let l = e.layer ?? c;
2854
2936
  if (e.noScale) {
2855
- let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? Nr);
2937
+ let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? Kr);
2856
2938
  d.push({
2857
2939
  type: "pushTransform",
2858
2940
  matrix: [
@@ -2879,19 +2961,19 @@ function Pr(e, t) {
2879
2961
  });
2880
2962
  return o;
2881
2963
  }
2882
- function Fr(e, t, n, r, i, a) {
2964
+ function Jr(e, t, n, r, i, a) {
2883
2965
  let o = Array(e.length);
2884
2966
  for (let s = 0; s < e.length; s += 2) o[s] = (t + e[s]) * r + i, o[s + 1] = (n + e[s + 1]) * r + a;
2885
2967
  return o;
2886
2968
  }
2887
- function Ir(e, t, n) {
2969
+ function Yr(e, t, n) {
2888
2970
  if (n === !1) return;
2889
2971
  if (!e || e.length === 0) return e;
2890
2972
  let r = Array(e.length);
2891
2973
  for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
2892
2974
  return r;
2893
2975
  }
2894
- function Lr(e, t, n, r, i, a) {
2976
+ function Xr(e, t, n, r, i, a) {
2895
2977
  if (!e) return;
2896
2978
  let [o, s, c, l, u, d] = e;
2897
2979
  return [
@@ -2911,33 +2993,33 @@ function Y(e) {
2911
2993
  function X(e, t) {
2912
2994
  return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? Y(t) : t}"`;
2913
2995
  }
2914
- function Rr(e) {
2996
+ function Zr(e) {
2915
2997
  return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
2916
2998
  }
2917
- var zr = 0;
2918
- function Br() {
2919
- return `mmr-grad-${++zr}`;
2999
+ var Qr = 0;
3000
+ function $r() {
3001
+ return `mmr-grad-${++Qr}`;
2920
3002
  }
2921
- function Vr(e, t) {
3003
+ function ei(e, t) {
2922
3004
  let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join("");
2923
3005
  return `<defs><linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${t.x0}" y1="${t.y0}" x2="${t.x1}" y2="${t.y1}">${n}</linearGradient></defs>`;
2924
3006
  }
2925
- function Hr(e, t) {
3007
+ function ti(e, t) {
2926
3008
  let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join(""), r = (t.fx === void 0 ? "" : ` fx="${t.fx}"`) + (t.fy === void 0 ? "" : ` fy="${t.fy}"`) + (t.fr === void 0 ? "" : ` fr="${t.fr}"`);
2927
3009
  return `<defs><radialGradient id="${e}" gradientUnits="userSpaceOnUse" cx="${t.cx}" cy="${t.cy}" r="${t.r}"${r}>${n}</radialGradient></defs>`;
2928
3010
  }
2929
- function Ur(e, t) {
3011
+ function ni(e, t) {
2930
3012
  if (e === void 0) return;
2931
3013
  if (typeof e == "string") return e;
2932
- let n = Br();
2933
- return t.push(e.type === "linear" ? Vr(n, e) : Hr(n, e)), `url(#${n})`;
3014
+ let n = $r();
3015
+ return t.push(e.type === "linear" ? ei(n, e) : ti(n, e)), `url(#${n})`;
2934
3016
  }
2935
- function Wr(e) {
3017
+ function ri(e) {
2936
3018
  let t = [];
2937
- for (let n of e) Gr(n.commands, t);
3019
+ for (let n of e) ii(n.commands, t);
2938
3020
  return t;
2939
3021
  }
2940
- function Gr(e, t) {
3022
+ function ii(e, t) {
2941
3023
  let n = [];
2942
3024
  for (let r of e) switch (r.type) {
2943
3025
  case "pushTransform": {
@@ -2955,21 +3037,21 @@ function Gr(e, t) {
2955
3037
  break;
2956
3038
  }
2957
3039
  default:
2958
- Kr(r, t);
3040
+ ai(r, t);
2959
3041
  break;
2960
3042
  }
2961
3043
  for (; n.length > 0;) t.push(n.pop());
2962
3044
  }
2963
- function Kr(e, t) {
3045
+ function ai(e, t) {
2964
3046
  switch (e.type) {
2965
3047
  case "rect": {
2966
- let n = Ur(e.fill, t) ?? "none", r = e.cr > 0 ? `${X("rx", e.cr)}${X("ry", e.cr)}` : "";
2967
- t.push(`<rect${X("x", e.x)}${X("y", e.y)}${X("width", e.w)}${X("height", e.h)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${r}${Rr(e.dash)}/>`);
3048
+ let n = ni(e.fill, t) ?? "none", r = e.cr > 0 ? `${X("rx", e.cr)}${X("ry", e.cr)}` : "";
3049
+ t.push(`<rect${X("x", e.x)}${X("y", e.y)}${X("width", e.w)}${X("height", e.h)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${r}${Zr(e.dash)}/>`);
2968
3050
  return;
2969
3051
  }
2970
3052
  case "circle": {
2971
- let n = Ur(e.fill, t) ?? "none";
2972
- t.push(`<circle${X("cx", e.cx)}${X("cy", e.cy)}${X("r", e.r)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Rr(e.dash)}/>`);
3053
+ let n = ni(e.fill, t) ?? "none";
3054
+ t.push(`<circle${X("cx", e.cx)}${X("cy", e.cy)}${X("r", e.r)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Zr(e.dash)}/>`);
2973
3055
  return;
2974
3056
  }
2975
3057
  case "line": {
@@ -2977,7 +3059,7 @@ function Kr(e, t) {
2977
3059
  if (n.length < 2) return;
2978
3060
  let r = [];
2979
3061
  for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
2980
- t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Rr(e.dash)}${X("stroke-linecap", e.lineCap)}${X("stroke-linejoin", e.lineJoin)}${X("opacity", e.alpha)} fill="none"/>`);
3062
+ t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Zr(e.dash)}${X("stroke-linecap", e.lineCap)}${X("stroke-linejoin", e.lineJoin)}${X("opacity", e.alpha)} fill="none"/>`);
2981
3063
  return;
2982
3064
  }
2983
3065
  case "polygon": {
@@ -2985,7 +3067,7 @@ function Kr(e, t) {
2985
3067
  if (n.length < 4) return;
2986
3068
  let r = [];
2987
3069
  for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
2988
- let i = Ur(e.fill, t);
3070
+ let i = ni(e.fill, t);
2989
3071
  t.push(`<polygon points="${r.join(" ")}"${X("fill", i)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}/>`);
2990
3072
  return;
2991
3073
  }
@@ -3008,18 +3090,18 @@ function Kr(e, t) {
3008
3090
  }
3009
3091
  //#endregion
3010
3092
  //#region src/render/CanvasRenderer.ts
3011
- var qr = (e) => {
3093
+ var oi = (e) => {
3012
3094
  if (typeof Image < "u") {
3013
3095
  let t = new Image();
3014
3096
  return t.src = e, t;
3015
3097
  }
3016
3098
  return null;
3017
3099
  };
3018
- function Jr(e, t, n = {}) {
3019
- let r = n.imageFactory ?? qr;
3020
- for (let n of t) Yr(e, n.commands, r);
3100
+ function si(e, t, n = {}) {
3101
+ let r = n.imageFactory ?? oi;
3102
+ for (let n of t) ci(e, n.commands, r);
3021
3103
  }
3022
- function Yr(e, t, n) {
3104
+ function ci(e, t, n) {
3023
3105
  let r = 0;
3024
3106
  for (let i of t) switch (i.type) {
3025
3107
  case "pushTransform":
@@ -3033,18 +3115,18 @@ function Yr(e, t, n) {
3033
3115
  r > 0 && (e.restore(), r--);
3034
3116
  break;
3035
3117
  default:
3036
- Xr(e, i, n);
3118
+ li(e, i, n);
3037
3119
  break;
3038
3120
  }
3039
3121
  for (; r > 0;) e.restore(), r--;
3040
3122
  }
3041
- function Xr(e, t, n) {
3123
+ function li(e, t, n) {
3042
3124
  switch (t.type) {
3043
3125
  case "rect":
3044
- e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
3126
+ e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
3045
3127
  break;
3046
3128
  case "circle":
3047
- e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
3129
+ e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
3048
3130
  break;
3049
3131
  case "line": {
3050
3132
  if (t.points.length < 4) break;
@@ -3058,7 +3140,7 @@ function Xr(e, t, n) {
3058
3140
  if (t.vertices.length < 4) break;
3059
3141
  e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
3060
3142
  for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
3061
- e.closePath(), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
3143
+ e.closePath(), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
3062
3144
  break;
3063
3145
  case "text": {
3064
3146
  let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
@@ -3099,7 +3181,7 @@ function Xr(e, t, n) {
3099
3181
  }
3100
3182
  //#endregion
3101
3183
  //#region src/export/sceneBounds.ts
3102
- function Zr(e, t, n = 0) {
3184
+ function ui(e, t, n = 0) {
3103
3185
  if (!t.worldToScene) return e;
3104
3186
  let r = [
3105
3187
  t.worldToScene(e.x, e.y),
@@ -3117,47 +3199,47 @@ function Zr(e, t, n = 0) {
3117
3199
  }
3118
3200
  //#endregion
3119
3201
  //#region src/export/SvgExporter.ts
3120
- var Qr = {
3202
+ var di = {
3121
3203
  scale: 1,
3122
3204
  offsetX: 0,
3123
3205
  offsetY: 0
3124
3206
  };
3125
- function $r(e) {
3207
+ function fi(e) {
3126
3208
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3127
3209
  }
3128
- var ei = class {
3210
+ var pi = class {
3129
3211
  constructor(e = {}) {
3130
3212
  this.options = e;
3131
3213
  }
3132
3214
  render({ state: e, style: t, sceneOverlays: n }) {
3133
- let { currentArea: i, currentZIndex: a, currentAreaInstance: o } = e;
3134
- if (i === void 0 || a === void 0 || !o) return;
3135
- let s = o, c = s.getPlane(a);
3136
- if (!c) return;
3137
- let l = e.settings, d = this.options.padding ?? 3, f = e.computeExportBounds(s, c, this.options.roomId, d), p = r.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(), m = k(new g(e.mapReader, l).buildScene(s, c, a, e.lens), p, l, {
3215
+ let { currentArea: r, currentZIndex: i, currentAreaInstance: a } = e;
3216
+ if (r === void 0 || i === void 0 || !a) return;
3217
+ let o = a, s = o.getPlane(i);
3218
+ if (!s) return;
3219
+ let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Pe(new E(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
3138
3220
  forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
3139
3221
  inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
3140
- }), h = {
3222
+ }), p = {
3141
3223
  scale: 1,
3142
- roomSize: l.roomSize
3143
- }, _ = (e) => t === u ? e : C(e, t, h), v = Zr(f, t, l.roomSize * .5), y = [];
3144
- return y.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${v.x} ${v.y} ${v.w} ${v.h}">`), y.push(`<rect x="${v.x}" y="${v.y}" width="${v.w}" height="${v.h}" fill="${$r(l.backgroundColor)}"/>`), S(m, {
3224
+ roomSize: c.roomSize
3225
+ }, m = (e) => t === x ? e : O(e, t, p), h = ui(u, t, c.roomSize * .5), g = [];
3226
+ return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${fi(c.backgroundColor)}"/>`), ae(f, {
3145
3227
  state: e,
3146
- viewportBounds: p,
3228
+ viewportBounds: d,
3147
3229
  sceneOverlays: n,
3148
3230
  overlays: this.options.overlays
3149
3231
  }, (e, t) => {
3150
- e.length !== 0 && y.push(...Wr(Pr(t ? e : _(e), Qr)));
3151
- }), y.push("</svg>"), y.join("\n");
3232
+ e.length !== 0 && g.push(...ri(qr(t ? e : m(e), di)));
3233
+ }), g.push("</svg>"), g.join("\n");
3152
3234
  }
3153
- }, ti = class {
3235
+ }, mi = class {
3154
3236
  constructor(e = {}) {
3155
3237
  this.options = e;
3156
3238
  }
3157
3239
  render({ backend: e }) {
3158
3240
  return e.exportCanvas(this.options)?.toDataURL("image/png");
3159
3241
  }
3160
- }, ni = class {
3242
+ }, hi = class {
3161
3243
  constructor(e = {}) {
3162
3244
  this.options = e;
3163
3245
  }
@@ -3174,87 +3256,87 @@ var ei = class {
3174
3256
  };
3175
3257
  //#endregion
3176
3258
  //#region src/export/canvasToBytes.ts
3177
- function ri(e, t = "image/png", n) {
3259
+ function gi(e, t = "image/png", n) {
3178
3260
  let r = e.toDataURL(t, n), i = r.indexOf(","), a = i >= 0 ? r.slice(i + 1) : r, o = atob(a), s = new Uint8Array(o.length);
3179
3261
  for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
3180
3262
  return s;
3181
3263
  }
3182
3264
  //#endregion
3183
3265
  //#region src/export/CanvasExporter.ts
3184
- var ii = class {
3266
+ var _i = class {
3185
3267
  constructor(e) {
3186
3268
  this.options = e;
3187
3269
  }
3188
3270
  render({ state: e, style: t, sceneOverlays: n }) {
3189
- let { currentArea: i, currentZIndex: a, currentAreaInstance: o } = e;
3190
- if (i === void 0 || a === void 0 || !o) return;
3191
- let s = o, c = s.getPlane(a);
3192
- if (!c) return;
3193
- let l = e.settings, { width: d, height: f } = this.options, p = this.options.padding ?? 3, m = e.computeExportBounds(s, c, this.options.roomId, p), h = Zr(m, t, l.roomSize * .5), _ = Math.min(d / h.w, f / h.h), v = h.w * _, y = h.h * _, b = (d - v) / 2 - h.x * _, x = (f - y) / 2 - h.y * _, ee = {
3194
- scale: _,
3195
- offsetX: b,
3196
- offsetY: x
3197
- }, te = r.forRenderCamera(d, f, _, b, x), w = {
3271
+ let { currentArea: r, currentZIndex: i, currentAreaInstance: a } = e;
3272
+ if (r === void 0 || i === void 0 || !a) return;
3273
+ let o = a, s = o.getPlane(i);
3274
+ if (!s) return;
3275
+ let c = e.settings, { width: l, height: u } = this.options, d = this.options.padding ?? 3, f = e.computeExportBounds(o, s, this.options.roomId, d), p = ui(f, t, c.roomSize * .5), m = Math.min(l / p.w, u / p.h), h = p.w * m, g = p.h * m, _ = (l - h) / 2 - p.x * m, v = (u - g) / 2 - p.y * m, y = {
3276
+ scale: m,
3277
+ offsetX: _,
3278
+ offsetY: v
3279
+ }, b = D.forRenderCamera(l, u, m, _, v), S = {
3198
3280
  forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
3199
3281
  inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
3200
- }, ne = k(new g(e.mapReader, l).buildScene(s, c, a, e.lens), te.getViewportBounds(), l, w), T = D.Util.createCanvasElement();
3201
- T.width = d, T.height = f;
3202
- let E = T.getContext("2d");
3203
- if (!E) return;
3204
- E.fillStyle = l.backgroundColor, E.fillRect(0, 0, d, f);
3205
- let re = {
3206
- scale: _,
3207
- roomSize: l.roomSize
3208
- }, ie = (e) => t === u ? e : C(e, t, re);
3209
- return S(ne, {
3282
+ }, C = Pe(new E(e.mapReader, c).buildScene(o, s, i, e.lens), b.getViewportBounds(), c, S), w = k.Util.createCanvasElement();
3283
+ w.width = l, w.height = u;
3284
+ let T = w.getContext("2d");
3285
+ if (!T) return;
3286
+ T.fillStyle = c.backgroundColor, T.fillRect(0, 0, l, u);
3287
+ let ee = {
3288
+ scale: m,
3289
+ roomSize: c.roomSize
3290
+ }, te = (e) => t === x ? e : O(e, t, ee);
3291
+ return ae(C, {
3210
3292
  state: e,
3211
- viewportBounds: r.forMapBounds(m.x, m.x + m.w, m.y, m.y + m.h).getViewportBounds(),
3293
+ viewportBounds: D.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(),
3212
3294
  sceneOverlays: n,
3213
3295
  overlays: this.options.overlays
3214
3296
  }, (e, t) => {
3215
- e.length !== 0 && Jr(E, Pr(t ? e : ie(e), ee));
3216
- }), T;
3297
+ e.length !== 0 && si(T, qr(t ? e : te(e), y));
3298
+ }), w;
3217
3299
  }
3218
- }, ai = class {
3300
+ }, vi = class {
3219
3301
  constructor(e) {
3220
- this.options = e, this.canvasExporter = new ii(e);
3302
+ this.options = e, this.canvasExporter = new _i(e);
3221
3303
  }
3222
3304
  render(e) {
3223
3305
  let t = this.canvasExporter.render(e);
3224
- if (t) return ri(t, this.options.mimeType, this.options.quality);
3306
+ if (t) return gi(t, this.options.mimeType, this.options.quality);
3225
3307
  }
3226
- }, Z, oi, si = 256;
3227
- function ci(e, t, n) {
3308
+ }, Z, yi, bi = 256;
3309
+ function xi(e, t, n) {
3228
3310
  let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
3229
- if (oi === r && Z) return Z;
3230
- let i = si, a = i / 2, o = document.createElement("canvas");
3311
+ if (yi === r && Z) return Z;
3312
+ let i = bi, a = i / 2, o = document.createElement("canvas");
3231
3313
  o.width = i, o.height = i;
3232
3314
  let s = o.getContext("2d");
3233
3315
  s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
3234
3316
  let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
3235
3317
  c.addColorStop(0, "rgba(0, 0, 0, 1)"), c.addColorStop(l * .25, "rgba(0, 0, 0, 0.97)"), c.addColorStop(l * .5, "rgba(0, 0, 0, 0.82)"), c.addColorStop(l * .7, "rgba(0, 0, 0, 0.50)"), c.addColorStop(l * .85, "rgba(0, 0, 0, 0.22)"), c.addColorStop(l * .95, "rgba(0, 0, 0, 0.06)"), c.addColorStop(l, "rgba(0, 0, 0, 0)"), l < .98 && c.addColorStop(1, "rgba(0, 0, 0, 0)"), s.fillStyle = c, s.beginPath(), s.arc(a, a, a, 0, Math.PI * 2), s.fill(), s.globalCompositeOperation = "source-over";
3236
3318
  let u = parseInt(t.slice(1, 3), 16), d = parseInt(t.slice(3, 5), 16), f = parseInt(t.slice(5, 7), 16), p = s.createRadialGradient(a, a, 0, a, a, a * l);
3237
- return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), Z = o.toDataURL(), oi = r, Z;
3319
+ return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), Z = o.toDataURL(), yi = r, Z;
3238
3320
  }
3239
- function li(e, t, n, r) {
3321
+ function Si(e, t, n, r) {
3240
3322
  let { radius: i, intensity: a, color: o } = r, s = n.maxX - n.minX, c = n.maxY - n.minY, l = Math.sqrt(s * s + c * c), u = Math.max(l * 2.5, i * 4);
3241
3323
  return {
3242
3324
  cx: e,
3243
3325
  cy: t,
3244
3326
  displaySize: u,
3245
- src: ci(a, o, Math.round(i / (u / 2) * 50) / 50)
3327
+ src: xi(a, o, Math.round(i / (u / 2) * 50) / 50)
3246
3328
  };
3247
3329
  }
3248
3330
  //#endregion
3249
3331
  //#region src/overlay/AmbientLightOverlay.ts
3250
- var ui = {
3332
+ var Ci = {
3251
3333
  color: "#ffcc44",
3252
3334
  radius: 12,
3253
3335
  intensity: .7
3254
- }, di = class {
3336
+ }, wi = class {
3255
3337
  constructor(e) {
3256
3338
  this.onPosition = () => this.ctx?.invalidate(), this.params = {
3257
- ...ui,
3339
+ ...Ci,
3258
3340
  ...e
3259
3341
  };
3260
3342
  }
@@ -3277,7 +3359,7 @@ var ui = {
3277
3359
  if (e.positionRoomId === void 0) return;
3278
3360
  let n = e.mapReader.getRoom(e.positionRoomId);
3279
3361
  if (!n) return;
3280
- let r = li(n.x, n.y, t, this.params);
3362
+ let r = Si(n.x, n.y, t, this.params);
3281
3363
  return {
3282
3364
  type: "image",
3283
3365
  x: r.cx - r.displaySize / 2,
@@ -3288,7 +3370,7 @@ var ui = {
3288
3370
  layer: "overlay"
3289
3371
  };
3290
3372
  }
3291
- }, fi = () => typeof performance < "u" ? performance.now() : Date.now(), pi = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(fi()), 16), mi = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), hi = class {
3373
+ }, Ti = () => typeof performance < "u" ? performance.now() : Date.now(), Ei = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(Ti()), 16), Di = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), Oi = class {
3292
3374
  constructor(e, t, n = {}) {
3293
3375
  this.worldX = e, this.worldY = t, this.cancelled = !1, this.transform = (e, t) => ({
3294
3376
  x: e,
@@ -3297,7 +3379,7 @@ var ui = {
3297
3379
  }
3298
3380
  attach(e) {
3299
3381
  let t = this.transform(this.worldX, this.worldY);
3300
- this.ring = new D.Circle({
3382
+ this.ring = new k.Circle({
3301
3383
  x: t.x,
3302
3384
  y: t.y,
3303
3385
  radius: this.startRadius,
@@ -3312,12 +3394,12 @@ var ui = {
3312
3394
  n(1), this.onComplete?.();
3313
3395
  return;
3314
3396
  }
3315
- let r = fi(), i = (e) => {
3397
+ let r = Ti(), i = (e) => {
3316
3398
  if (this.cancelled) return;
3317
3399
  let t = Math.min((e - r) / this.duration, 1);
3318
- n(t), t < 1 ? this.rafId = pi(i) : (this.rafId = void 0, this.onComplete?.());
3400
+ n(t), t < 1 ? this.rafId = Ei(i) : (this.rafId = void 0, this.onComplete?.());
3319
3401
  };
3320
- this.rafId = pi(i);
3402
+ this.rafId = Ei(i);
3321
3403
  }
3322
3404
  updateViewport(e, t, n) {
3323
3405
  if (this.transform = n, this.ring) {
@@ -3329,9 +3411,9 @@ var ui = {
3329
3411
  }
3330
3412
  }
3331
3413
  destroy() {
3332
- this.cancelled = !0, this.rafId !== void 0 && (mi(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
3414
+ this.cancelled = !0, this.rafId !== void 0 && (Di(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
3333
3415
  }
3334
- }, gi = {
3416
+ }, ki = {
3335
3417
  n: {
3336
3418
  x: 0,
3337
3419
  y: -1
@@ -3364,7 +3446,7 @@ var ui = {
3364
3446
  x: -Math.SQRT1_2,
3365
3447
  y: Math.SQRT1_2
3366
3448
  }
3367
- }, _i = [
3449
+ }, Ai = [
3368
3450
  "n",
3369
3451
  "s",
3370
3452
  "e",
@@ -3373,22 +3455,22 @@ var ui = {
3373
3455
  "nw",
3374
3456
  "se",
3375
3457
  "sw"
3376
- ], vi = new Set([
3458
+ ], ji = new Set([
3377
3459
  "ne",
3378
3460
  "nw",
3379
3461
  "se",
3380
3462
  "sw"
3381
- ]), yi = {
3463
+ ]), Mi = {
3382
3464
  clear: 10,
3383
3465
  diagonal: .3,
3384
3466
  preferred: 1,
3385
3467
  distance: .05
3386
- }, bi = [
3468
+ }, Ni = [
3387
3469
  "n",
3388
3470
  "s",
3389
3471
  "e",
3390
3472
  "w"
3391
- ], xi = [
3473
+ ], Pi = [
3392
3474
  "n",
3393
3475
  "s",
3394
3476
  "e",
@@ -3398,16 +3480,16 @@ var ui = {
3398
3480
  "se",
3399
3481
  "sw"
3400
3482
  ];
3401
- function Si(e, t) {
3483
+ function Fi(e, t) {
3402
3484
  return Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y));
3403
3485
  }
3404
- function Ci(e, t) {
3486
+ function Ii(e, t) {
3405
3487
  let n = Math.max(e.x - (t.x + t.width), t.x - (e.x + e.width), 0), r = Math.max(e.y - (t.y + t.height), t.y - (e.y + e.height), 0);
3406
3488
  return Math.hypot(n, r);
3407
3489
  }
3408
3490
  function Q(e, t, n) {
3409
- let r = gi[t];
3410
- if (vi.has(t)) {
3491
+ let r = ki[t];
3492
+ if (ji.has(t)) {
3411
3493
  let t = e.x + r.x * n, i = e.y + r.y * n;
3412
3494
  return {
3413
3495
  x: r.x < 0 ? t - e.width : t,
@@ -3424,9 +3506,9 @@ function Q(e, t, n) {
3424
3506
  height: e.height
3425
3507
  };
3426
3508
  }
3427
- function wi(e, t, n = {}) {
3428
- let r = n.offset ?? .6, i = n.slots === 4 ? bi : _i, a = {
3429
- ...yi,
3509
+ function Li(e, t, n = {}) {
3510
+ let r = n.offset ?? .6, i = n.slots === 4 ? Ni : Ai, a = {
3511
+ ...Mi,
3430
3512
  ...n.weights
3431
3513
  }, o = [], s = [];
3432
3514
  for (let c of e) {
@@ -3436,11 +3518,11 @@ function wi(e, t, n = {}) {
3436
3518
  for (let n = r; n <= r + e + 1e-9; n += u) {
3437
3519
  let e = Q(c, t, n), r = !1, o = Infinity;
3438
3520
  for (let t of p) {
3439
- if (t.kind !== "exit" && Si(e, t) > 0) {
3521
+ if (t.kind !== "exit" && Fi(e, t) > 0) {
3440
3522
  r = !0;
3441
3523
  break;
3442
3524
  }
3443
- let n = Ci(e, t);
3525
+ let n = Ii(e, t);
3444
3526
  n < o && (o = n);
3445
3527
  }
3446
3528
  if (r) {
@@ -3467,7 +3549,7 @@ function wi(e, t, n = {}) {
3467
3549
  continue;
3468
3550
  }
3469
3551
  let o = 0;
3470
- c.preferred ? t === c.preferred && (o -= a.preferred) : vi.has(t) && (o += a.diagonal);
3552
+ c.preferred ? t === c.preferred && (o -= a.preferred) : ji.has(t) && (o += a.diagonal);
3471
3553
  let s = -i.value * a.clear + o;
3472
3554
  n.onScored && h.push({
3473
3555
  dir: t,
@@ -3490,9 +3572,9 @@ function wi(e, t, n = {}) {
3490
3572
  off: r,
3491
3573
  cost: 0,
3492
3574
  clearance: 0
3493
- }, m.clearance < (n.minClearance ?? 0)) for (let e of xi) {
3575
+ }, m.clearance < (n.minClearance ?? 0)) for (let e of Pi) {
3494
3576
  let t = Q(c, e, r);
3495
- if (!p.some((e) => e.kind !== "exit" && Si(t, e) > 0)) {
3577
+ if (!p.some((e) => e.kind !== "exit" && Fi(t, e) > 0)) {
3496
3578
  m = {
3497
3579
  box: t,
3498
3580
  dir: e,
@@ -3504,7 +3586,7 @@ function wi(e, t, n = {}) {
3504
3586
  }
3505
3587
  }
3506
3588
  n.onScored?.(c, h, m.dir);
3507
- let g = gi[m.dir];
3589
+ let g = ki[m.dir];
3508
3590
  s.push({
3509
3591
  id: c.id,
3510
3592
  x: m.box.x,
@@ -3524,8 +3606,156 @@ function wi(e, t, n = {}) {
3524
3606
  return s;
3525
3607
  }
3526
3608
  //#endregion
3527
- //#region node_modules/node-dijkstra/libs/PriorityQueue.js
3528
- var Ti = /* @__PURE__ */ O(((e, t) => {
3609
+ //#region src/overlay/WaypointOverlay.ts
3610
+ var Ri = class {
3611
+ constructor() {
3612
+ this.waypoints = [], this.placed = [];
3613
+ }
3614
+ set(e) {
3615
+ this.waypoints = [...e], this.ctx?.invalidate();
3616
+ }
3617
+ add(e) {
3618
+ this.waypoints.push(e), this.ctx?.invalidate();
3619
+ }
3620
+ remove(e) {
3621
+ let t = this.waypoints.length;
3622
+ this.waypoints = this.waypoints.filter((t) => t.roomId !== e), this.waypoints.length !== t && this.ctx?.invalidate();
3623
+ }
3624
+ has(e) {
3625
+ return this.waypoints.some((t) => t.roomId === e);
3626
+ }
3627
+ hitTest(e, t) {
3628
+ for (let n = this.placed.length - 1; n >= 0; n--) {
3629
+ let r = this.placed[n];
3630
+ if (e >= r.x && e <= r.x + r.width && t >= r.y && t <= r.y + r.height) return r.wp;
3631
+ }
3632
+ }
3633
+ attach(e) {
3634
+ this.ctx = e;
3635
+ }
3636
+ detach() {
3637
+ this.ctx = void 0, this.placed = [];
3638
+ }
3639
+ render(e, t) {
3640
+ this.placed = [];
3641
+ let n = e.currentArea, r = e.currentZIndex;
3642
+ if (n === void 0 || r === void 0 || this.waypoints.length === 0) return [];
3643
+ let i = e.currentAreaInstance?.getPlane(r);
3644
+ if (!i) return [];
3645
+ let a = e.settings.roomSize, o = a * .6, s = o * .5, c = o * 1.2, l = i.getRooms(), u = l.map((e) => ({
3646
+ x: e.x - a / 2,
3647
+ y: e.y - a / 2,
3648
+ width: a,
3649
+ height: a,
3650
+ kind: "room"
3651
+ })), d = (e, t, n, r) => u.push({
3652
+ x: Math.min(e, n) - .03,
3653
+ y: Math.min(t, r) - .03,
3654
+ width: Math.abs(n - e) + .06,
3655
+ height: Math.abs(r - t) + .06,
3656
+ kind: "exit"
3657
+ });
3658
+ for (let t of l) for (let i of [...Object.values(t.exits), ...Object.values(t.specialExits)]) {
3659
+ let a = e.mapReader.getRoom(i);
3660
+ a && a.area === n && a.z === r && d(t.x, t.y, a.x, a.y);
3661
+ }
3662
+ let f = [], p = [];
3663
+ for (let t of this.waypoints) {
3664
+ let i = e.mapReader.getRoom(t.roomId);
3665
+ if (!i || i.area !== n || i.z !== r) continue;
3666
+ let a = Array.isArray(t.label) ? t.label : [t.label], l = a.reduce((e, t) => Math.max(e, t.length), 0) * o * .6 + s * 2, u = a.length * c + o * .4;
3667
+ f.push({
3668
+ x: i.x,
3669
+ y: i.y,
3670
+ width: l,
3671
+ height: u,
3672
+ id: f.length,
3673
+ preferred: t.preferred
3674
+ }), p.push({
3675
+ wp: t,
3676
+ rx: i.x,
3677
+ ry: i.y,
3678
+ lines: a
3679
+ });
3680
+ }
3681
+ if (f.length === 0) return [];
3682
+ let m = "rgba(20, 20, 24, 0.82)", h = Li(f, u, {
3683
+ offset: a * .7,
3684
+ extend: a * 4,
3685
+ clearCap: a * 1.5,
3686
+ minClearance: a * .7
3687
+ }), g = [];
3688
+ for (let t = 0; t < h.length; t++) {
3689
+ let n = h[t], { wp: r, rx: i, ry: s } = p[t], l = r.color ?? "#ffcc33", u = i - (n.x + n.width / 2), d = s - (n.y + n.height / 2), f = Math.hypot(u, d) || 1, _ = u / f, v = d / f, y = o * .7, b = o * .5, x = n.direction.length === 2, S;
3690
+ if (x) {
3691
+ let e = _ < 0 ? n.x : n.x + n.width, t = v < 0 ? n.y : n.y + n.height, r = o * .85;
3692
+ S = [
3693
+ e + (_ < 0 ? r : -r),
3694
+ t,
3695
+ e + _ * y,
3696
+ t + v * y,
3697
+ e,
3698
+ t + (v < 0 ? r : -r)
3699
+ ];
3700
+ } else {
3701
+ let e = Math.abs(u), t = Math.abs(d), r = (e > 1e-6 ? n.width / 2 / e : Infinity) <= (t > 1e-6 ? n.height / 2 / t : Infinity), i = r ? _ < 0 ? n.x : n.x + n.width : n.x + n.width / 2, a = r ? n.y + n.height / 2 : v < 0 ? n.y : n.y + n.height, o = +!r, s = +!!r;
3702
+ S = [
3703
+ i + o * b,
3704
+ a + s * b,
3705
+ i + _ * y,
3706
+ a + v * y,
3707
+ i - o * b,
3708
+ a - s * b
3709
+ ];
3710
+ }
3711
+ g.push({
3712
+ type: "polygon",
3713
+ vertices: S,
3714
+ paint: {
3715
+ fill: m,
3716
+ stroke: l,
3717
+ strokeWidth: a * .03
3718
+ },
3719
+ layer: "top"
3720
+ }), g.push({
3721
+ type: "rect",
3722
+ x: n.x,
3723
+ y: n.y,
3724
+ width: n.width,
3725
+ height: n.height,
3726
+ cornerRadius: o * .3,
3727
+ paint: {
3728
+ fill: m,
3729
+ stroke: l,
3730
+ strokeWidth: a * .03
3731
+ },
3732
+ layer: "top"
3733
+ }), this.placed.push({
3734
+ wp: r,
3735
+ x: n.x,
3736
+ y: n.y,
3737
+ width: n.width,
3738
+ height: n.height
3739
+ });
3740
+ let C = p[t].lines, w = (n.height - C.length * c) / 2;
3741
+ for (let t = 0; t < C.length; t++) g.push({
3742
+ type: "text",
3743
+ x: n.x,
3744
+ y: n.y + w + t * c,
3745
+ width: n.width,
3746
+ height: c,
3747
+ text: C[t],
3748
+ fontSize: o,
3749
+ fontFamily: e.settings.fontFamily,
3750
+ fill: "#f4f4f6",
3751
+ align: "center",
3752
+ verticalAlign: "middle",
3753
+ layer: "top"
3754
+ });
3755
+ }
3756
+ return g;
3757
+ }
3758
+ }, zi = /* @__PURE__ */ A(((e, t) => {
3529
3759
  t.exports = class {
3530
3760
  constructor() {
3531
3761
  this.keys = /* @__PURE__ */ new Set(), this.queue = [];
@@ -3555,14 +3785,14 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3555
3785
  return this.queue.find((t) => t.key === e);
3556
3786
  }
3557
3787
  };
3558
- })), Ei = /* @__PURE__ */ O(((e, t) => {
3788
+ })), Bi = /* @__PURE__ */ A(((e, t) => {
3559
3789
  function n(e, t) {
3560
3790
  let r = /* @__PURE__ */ new Map();
3561
3791
  for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
3562
3792
  return r;
3563
3793
  }
3564
3794
  t.exports = n;
3565
- })), Di = /* @__PURE__ */ O(((e, t) => {
3795
+ })), Vi = /* @__PURE__ */ A(((e, t) => {
3566
3796
  function n(e) {
3567
3797
  let t = Number(e);
3568
3798
  return !(isNaN(t) || t <= 0);
@@ -3577,7 +3807,7 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3577
3807
  }), t;
3578
3808
  }
3579
3809
  t.exports = r;
3580
- })), Oi = /* @__PURE__ */ O(((e, t) => {
3810
+ })), Hi = /* @__PURE__ */ A(((e, t) => {
3581
3811
  function n(e) {
3582
3812
  if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
3583
3813
  e.forEach((e, t) => {
@@ -3589,8 +3819,8 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3589
3819
  });
3590
3820
  }
3591
3821
  t.exports = n;
3592
- })), ki = /* @__PURE__ */ he((/* @__PURE__ */ O(((e, t) => {
3593
- var n = Ti(), r = Ei(), i = Di(), a = Oi();
3822
+ })), Ui = /* @__PURE__ */ Te((/* @__PURE__ */ A(((e, t) => {
3823
+ var n = zi(), r = Bi(), i = Vi(), a = Hi();
3594
3824
  t.exports = class {
3595
3825
  constructor(e) {
3596
3826
  e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
@@ -3640,7 +3870,7 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3640
3870
  return this.path(...e);
3641
3871
  }
3642
3872
  };
3643
- })))(), 1), Ai = {
3873
+ })))(), 1), Wi = {
3644
3874
  1: "north",
3645
3875
  2: "northeast",
3646
3876
  3: "northwest",
@@ -3653,7 +3883,7 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3653
3883
  10: "down",
3654
3884
  11: "in",
3655
3885
  12: "out"
3656
- }, ji = {
3886
+ }, Gi = {
3657
3887
  north: "n",
3658
3888
  northeast: "ne",
3659
3889
  northwest: "nw",
@@ -3666,7 +3896,7 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3666
3896
  down: "down",
3667
3897
  in: "in",
3668
3898
  out: "out"
3669
- }, Mi = class {
3899
+ }, Ki = class {
3670
3900
  constructor(e) {
3671
3901
  this.mapReader = e, this.data = this.buildGraph();
3672
3902
  }
@@ -3692,12 +3922,12 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3692
3922
  buildGraph() {
3693
3923
  let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
3694
3924
  return this.mapReader.getRooms().forEach((i) => {
3695
- let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Ai[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
3925
+ let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Wi[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
3696
3926
  Object.entries(i.exits ?? {}).forEach(([e, t]) => {
3697
3927
  if (s.has(e)) return;
3698
3928
  let c = this.mapReader.getRoom(t);
3699
3929
  if (c) {
3700
- let s = ji[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
3930
+ let s = Gi[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
3701
3931
  a.push({
3702
3932
  id: t,
3703
3933
  weight: l
@@ -3728,7 +3958,7 @@ var Ti = /* @__PURE__ */ O(((e, t) => {
3728
3958
  };
3729
3959
  //#endregion
3730
3960
  //#region src/PathFinder.ts
3731
- function Ni(e, t) {
3961
+ function qi(e, t) {
3732
3962
  e.push(t);
3733
3963
  let n = e.length - 1;
3734
3964
  for (; n > 0;) {
@@ -3737,7 +3967,7 @@ function Ni(e, t) {
3737
3967
  [e[t], e[n]] = [e[n], e[t]], n = t;
3738
3968
  }
3739
3969
  }
3740
- function Pi(e) {
3970
+ function Ji(e) {
3741
3971
  if (e.length === 0) return;
3742
3972
  let t = e[0], n = e.pop();
3743
3973
  if (e.length > 0) {
@@ -3751,16 +3981,16 @@ function Pi(e) {
3751
3981
  }
3752
3982
  return t;
3753
3983
  }
3754
- function Fi(e, t, n) {
3984
+ function Yi(e, t, n) {
3755
3985
  let r = [n], i = n;
3756
3986
  for (; i !== t;) i = e.get(i), r.push(i);
3757
3987
  return r.reverse(), r;
3758
3988
  }
3759
- function Ii(e, t, n) {
3989
+ function Xi(e, t, n) {
3760
3990
  let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
3761
3991
  return i ? i.map((e) => Number(e)) : null;
3762
3992
  }
3763
- function Li(e, t, n, r) {
3993
+ function Zi(e, t, n, r) {
3764
3994
  let i = r.getRoom(n);
3765
3995
  if (!i) return null;
3766
3996
  let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
@@ -3769,16 +3999,16 @@ function Li(e, t, n, r) {
3769
3999
  let n = t.x - a, i = t.y - o, u = t.z - s;
3770
4000
  return Math.sqrt(n * n + i * i + u * u) / c * l;
3771
4001
  }, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
3772
- for (d.set(t, 0), Ni(p, {
4002
+ for (d.set(t, 0), qi(p, {
3773
4003
  id: t,
3774
4004
  priority: u(t)
3775
4005
  }); p.length > 0;) {
3776
- let { id: r } = Pi(p);
3777
- if (r === n) return Fi(f, t, n);
4006
+ let { id: r } = Ji(p);
4007
+ if (r === n) return Yi(f, t, n);
3778
4008
  let i = d.get(r) ?? Infinity, a = e.get(r);
3779
4009
  if (a) for (let e of a) {
3780
4010
  let t = i + e.weight;
3781
- t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), Ni(p, {
4011
+ t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), qi(p, {
3782
4012
  id: e.id,
3783
4013
  priority: t + u(e.id)
3784
4014
  }));
@@ -3786,9 +4016,9 @@ function Li(e, t, n, r) {
3786
4016
  }
3787
4017
  return null;
3788
4018
  }
3789
- var Ri = class {
4019
+ var Qi = class {
3790
4020
  constructor(e, t = "dijkstra") {
3791
- this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Mi(e), this.dijkstraGraph = new ki.default(this.mapGraph.getGraphDefinition());
4021
+ this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Ki(e), this.dijkstraGraph = new Ui.default(this.mapGraph.getGraphDefinition());
3792
4022
  }
3793
4023
  get algorithm() {
3794
4024
  return this._algorithm;
@@ -3807,10 +4037,10 @@ var Ri = class {
3807
4037
  let r;
3808
4038
  switch (this._algorithm) {
3809
4039
  case "dijkstra":
3810
- r = Ii(this.dijkstraGraph, e, t);
4040
+ r = Xi(this.dijkstraGraph, e, t);
3811
4041
  break;
3812
4042
  case "astar":
3813
- r = Li(this.mapGraph.getAdj(), e, t, this.mapGraph);
4043
+ r = Zi(this.mapGraph.getAdj(), e, t, this.mapGraph);
3814
4044
  break;
3815
4045
  }
3816
4046
  return this.cache.set(n, r), r;
@@ -3820,10 +4050,10 @@ var Ri = class {
3820
4050
  stub: 1,
3821
4051
  full: 0
3822
4052
  };
3823
- function zi(e, t, n) {
4053
+ function $i(e, t, n) {
3824
4054
  return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
3825
4055
  }
3826
- function Bi(e, ...t) {
4056
+ function ea(e, ...t) {
3827
4057
  let n = {}, r;
3828
4058
  e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
3829
4059
  let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
@@ -3836,10 +4066,10 @@ function Bi(e, ...t) {
3836
4066
  },
3837
4067
  getExitTreatment(e, t, n) {
3838
4068
  let a;
3839
- for (let s of r) {
3840
- let r = s.getExitTreatment ? s.getExitTreatment(e, t, n) : o(s, e, t, n);
4069
+ for (let o of r) {
4070
+ let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : d(o, e, t, n);
3841
4071
  if (a === void 0) a = r;
3842
- else if (a = zi(a, r, i), i === "first") break;
4072
+ else if (a = $i(a, r, i), i === "first") break;
3843
4073
  }
3844
4074
  return a ?? "full";
3845
4075
  },
@@ -3852,7 +4082,7 @@ function Bi(e, ...t) {
3852
4082
  }
3853
4083
  //#endregion
3854
4084
  //#region src/lens/ExplorationLens.ts
3855
- var Vi = class {
4085
+ var ta = class {
3856
4086
  constructor(e) {
3857
4087
  this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
3858
4088
  }
@@ -3887,7 +4117,7 @@ var Vi = class {
3887
4117
  clear() {
3888
4118
  this.visited.size !== 0 && (this.visited.clear(), this.version++);
3889
4119
  }
3890
- }, Hi = {
4120
+ }, na = {
3891
4121
  1: "north",
3892
4122
  2: "northeast",
3893
4123
  3: "northwest",
@@ -3901,7 +4131,7 @@ var Vi = class {
3901
4131
  11: "in",
3902
4132
  12: "out"
3903
4133
  };
3904
- function Ui() {
4134
+ function ra() {
3905
4135
  return {
3906
4136
  areaWidth: 150,
3907
4137
  areaHeight: 80,
@@ -3915,14 +4145,14 @@ function Ui() {
3915
4145
  highlightColor: "#ff9900"
3916
4146
  };
3917
4147
  }
3918
- var Wi = class {
4148
+ var ia = class {
3919
4149
  constructor(e, t, n) {
3920
- this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? Ui(), this.stage = new D.Stage({
4150
+ this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? ra(), this.stage = new k.Stage({
3921
4151
  container: e,
3922
4152
  width: e.clientWidth,
3923
4153
  height: e.clientHeight,
3924
4154
  draggable: !0
3925
- }), this.backgroundLayer = new D.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new D.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new D.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
4155
+ }), this.backgroundLayer = new k.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new k.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
3926
4156
  }
3927
4157
  initResize(e) {
3928
4158
  new ResizeObserver(() => {
@@ -4014,7 +4244,7 @@ var Wi = class {
4014
4244
  if (this.backgroundLayer.destroyChildren(), !this.backgroundConfig) return;
4015
4245
  let e = new Image();
4016
4246
  e.crossOrigin = "anonymous", e.onload = () => {
4017
- this.backgroundImage = new D.Image({
4247
+ this.backgroundImage = new k.Image({
4018
4248
  x: this.backgroundConfig.x,
4019
4249
  y: this.backgroundConfig.y,
4020
4250
  image: e,
@@ -4047,16 +4277,16 @@ var Wi = class {
4047
4277
  roomCount: r.length
4048
4278
  });
4049
4279
  }
4050
- let r = 1;
4280
+ let i = 1;
4051
4281
  for (let e of n.values()) {
4052
4282
  let t = e.maxX - e.minX, n = e.maxY - e.minY;
4053
- r = Math.max(r, t, n);
4283
+ i = Math.max(i, t, n);
4054
4284
  }
4055
- let i = 200 / r;
4285
+ let a = 200 / i;
4056
4286
  for (let e of t) {
4057
4287
  let t = e.getAreaId(), r = n.get(t);
4058
4288
  if (!r || !this.isAreaInDomain(t)) continue;
4059
- let a = r.maxX - r.minX, o = r.maxY - r.minY, s = Math.max(100, a * i), c = Math.max(100, o * i), l = s / c;
4289
+ let i = r.maxX - r.minX, o = r.maxY - r.minY, s = Math.max(100, i * a), c = Math.max(100, o * a), l = s / c;
4060
4290
  l > 3 ? c = s / 3 : l < 1 / 3 && (s = c / 3), this.areaNodes.set(t, {
4061
4291
  areaId: t,
4062
4292
  name: e.getAreaName(),
@@ -4070,44 +4300,44 @@ var Wi = class {
4070
4300
  realCenterY: r.centerY
4071
4301
  });
4072
4302
  }
4073
- let a = /* @__PURE__ */ new Map();
4303
+ let o = /* @__PURE__ */ new Map();
4074
4304
  for (let t of e) {
4075
4305
  let e = t.area;
4076
4306
  if (!this.areaNodes.has(e)) continue;
4077
4307
  let n = this.getLockedDirections(t), r = new Set(t.mSpecialExitLocks ?? []);
4078
4308
  for (let [r, i] of Object.entries(t.exits ?? {})) {
4079
4309
  if (n.has(r)) continue;
4080
- let o = this.mapReader.getRoom(i);
4081
- if (!o || o.area === e || !this.areaNodes.has(o.area) || !this.areAreasInSameDomain(e, o.area)) continue;
4082
- let s = this.createConnection(t, o, r);
4083
- s && this.addConnection(a, s);
4310
+ let a = this.mapReader.getRoom(i);
4311
+ if (!a || a.area === e || !this.areaNodes.has(a.area) || !this.areAreasInSameDomain(e, a.area)) continue;
4312
+ let s = this.createConnection(t, a, r);
4313
+ s && this.addConnection(o, s);
4084
4314
  }
4085
4315
  for (let [n, i] of Object.entries(t.specialExits ?? {})) {
4086
4316
  if (r.has(i)) continue;
4087
- let o = this.mapReader.getRoom(i);
4088
- if (!o || o.area === e || !this.areaNodes.has(o.area) || !this.areAreasInSameDomain(e, o.area)) continue;
4089
- let s = this.parseDirection(n), c = this.createConnection(t, o, s);
4090
- c && this.addConnection(a, c);
4317
+ let a = this.mapReader.getRoom(i);
4318
+ if (!a || a.area === e || !this.areaNodes.has(a.area) || !this.areAreasInSameDomain(e, a.area)) continue;
4319
+ let s = this.parseDirection(n), c = this.createConnection(t, a, s);
4320
+ c && this.addConnection(o, c);
4091
4321
  }
4092
4322
  }
4093
- for (let [e, t] of a) {
4094
- let [n, r] = e.split("-").map(Number), i = this.createConnectionGroup(n, r, t);
4095
- this.connectionGroups.push(i);
4096
- let a = this.areaNodes.get(n), o = this.areaNodes.get(r);
4097
- if (a && a.connections.push(...t), o) for (let e of t) o.connections.push({
4323
+ for (let [e, t] of o) {
4324
+ let [n, i] = e.split("-").map(Number), a = this.createConnectionGroup(n, i, t);
4325
+ this.connectionGroups.push(a);
4326
+ let o = this.areaNodes.get(n), s = this.areaNodes.get(i);
4327
+ if (o && o.connections.push(...t), s) for (let e of t) s.connections.push({
4098
4328
  ...e,
4099
4329
  fromAreaId: e.toAreaId,
4100
4330
  toAreaId: e.fromAreaId,
4101
4331
  fromRoomId: e.toRoomId,
4102
4332
  toRoomId: e.fromRoomId,
4103
- direction: e.direction ? s[e.direction] : null,
4333
+ direction: e.direction ? r[e.direction] : null,
4104
4334
  fromRoomPosition: e.toRoomPosition,
4105
4335
  toRoomPosition: e.fromRoomPosition
4106
4336
  });
4107
4337
  }
4108
4338
  }
4109
4339
  getLockedDirections(e) {
4110
- return new Set((e.exitLocks ?? []).map((e) => Hi[e]).filter((e) => !!e));
4340
+ return new Set((e.exitLocks ?? []).map((e) => na[e]).filter((e) => !!e));
4111
4341
  }
4112
4342
  createConnection(e, t, n) {
4113
4343
  let r = this.toPlanarDirection(n);
@@ -4176,7 +4406,7 @@ var Wi = class {
4176
4406
  }[e.toLowerCase().trim()] ?? null;
4177
4407
  }
4178
4408
  toPlanarDirection(e) {
4179
- return e && t.includes(e) ? e : null;
4409
+ return e && f.includes(e) ? e : null;
4180
4410
  }
4181
4411
  layoutAreas() {
4182
4412
  if (Array.from(this.areaNodes.values()).length === 0) return;
@@ -4569,7 +4799,7 @@ var Wi = class {
4569
4799
  y: n.y + n.height / 2
4570
4800
  }, a, o;
4571
4801
  if (this.dotsMode ? (a = r, o = i) : (a = this.getEdgePoint(t, i), o = this.getEdgePoint(n, r)), !isFinite(a.x) || !isFinite(a.y) || !isFinite(o.x) || !isFinite(o.y)) continue;
4572
- let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new D.Line({
4802
+ let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new k.Line({
4573
4803
  points: [
4574
4804
  a.x,
4575
4805
  a.y,
@@ -4602,16 +4832,16 @@ var Wi = class {
4602
4832
  if (!isFinite(e.x) || !isFinite(e.y)) continue;
4603
4833
  let t = e.areaId === this.highlightedArea;
4604
4834
  if (this.dotsMode) {
4605
- let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new D.Group({
4835
+ let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new k.Group({
4606
4836
  x: n,
4607
4837
  y: r,
4608
4838
  draggable: !0
4609
- }), a = new D.Circle({
4839
+ }), a = new k.Circle({
4610
4840
  radius: 6,
4611
4841
  fill: t ? this.settings.highlightColor : "#ffffff",
4612
4842
  stroke: t ? this.settings.highlightColor : "#ffffff",
4613
4843
  strokeWidth: 1
4614
- }), o = new D.Text({
4844
+ }), o = new k.Text({
4615
4845
  text: e.name,
4616
4846
  fontSize: 10,
4617
4847
  fill: "#ffffff",
@@ -4632,18 +4862,18 @@ var Wi = class {
4632
4862
  this.stage.container().style.cursor = "pointer";
4633
4863
  }), this.areaLayer.add(i);
4634
4864
  } else {
4635
- let n = new D.Group({
4865
+ let n = new k.Group({
4636
4866
  x: e.x,
4637
4867
  y: e.y,
4638
4868
  draggable: !0
4639
- }), r = new D.Rect({
4869
+ }), r = new k.Rect({
4640
4870
  width: e.width,
4641
4871
  height: e.height,
4642
4872
  fill: this.settings.areaFillColor,
4643
4873
  stroke: t ? this.settings.highlightColor : this.settings.areaStrokeColor,
4644
4874
  strokeWidth: t ? 3 : 2,
4645
4875
  cornerRadius: 8
4646
- }), i = new D.Text({
4876
+ }), i = new k.Text({
4647
4877
  text: e.name,
4648
4878
  fontSize: this.settings.fontSize,
4649
4879
  fill: this.settings.textColor,
@@ -4655,7 +4885,7 @@ var Wi = class {
4655
4885
  verticalAlign: "middle",
4656
4886
  ellipsis: !0,
4657
4887
  wrap: "word"
4658
- }), a = new D.Text({
4888
+ }), a = new k.Text({
4659
4889
  text: `${e.roomCount} rooms`,
4660
4890
  fontSize: 10,
4661
4891
  fill: this.settings.connectionColor,
@@ -4719,6 +4949,6 @@ var Wi = class {
4719
4949
  }
4720
4950
  };
4721
4951
  //#endregion
4722
- export { n as ALL_VISIBLE, di as AmbientLightOverlay, ae as Area, Wi as AreaMapRenderer, yr as Blueprint, r as Camera, ii as CanvasExporter, Cr as Construction, E as CullingManager, Ar as DarkModern, Oe as DrawCommandLayerNode, Vi as ExplorationLens, Tr as GradientRooms, Dr as GraphPaper, ee as HitTester, c as IDENTITY_TRANSFORM, Sr as Isometric, Mi as MapGraph, se as MapReader, Mr as MapRenderer, be as MapState, ke as MaterializingLayerNode, br as Neon, vr as Parchment, Ri as PathFinder, oe as Plane, ni as PngBlobExporter, ai as PngBytesExporter, ti as PngExporter, De as RecordingGroupNode, j as RecordingLayerNode, hi as RippleEffect, wr as SciFi, xr as Sketchy, Er as StainedGlass, ei as SvgExporter, Or as Topographic, jr as TreasureMap, kr as Watercolor, C as applyStyleToShapes, Pr as buildDrawCommands, ri as canvasToBytes, e as colorLightness, _ as compose, Bi as composeLenses, te as computePathData, Ui as createAreaMapSettings, ye as createSettings, v as darkenColor, o as defaultExitTreatment, i as hexToRgba, u as identityStyle, Ae as isGradientFill, wi as placeLabels, Jr as renderToCanvas, Me as shapeToRecording, Wr as svgFromBatches, M as transformFill, _r as treasureMapDecorations };
4952
+ export { u as ALL_VISIBLE, wi as AmbientLightOverlay, he as Area, ia as AreaMapRenderer, Mr as Blueprint, D as Camera, _i as CanvasExporter, Ir as Construction, ne as CullingManager, Ur as DarkModern, ze as DrawCommandLayerNode, ta as ExplorationLens, Rr as GradientRooms, Br as GraphPaper, oe as HitTester, e as IDENTITY_TRANSFORM, Fr as Isometric, Ki as MapGraph, _e as MapReader, Gr as MapRenderer, Ae as MapState, Be as MaterializingLayerNode, Nr as Neon, jr as Parchment, Qi as PathFinder, ge as Plane, hi as PngBlobExporter, vi as PngBytesExporter, mi as PngExporter, ee as ProjectedMapReader, a as ROOM_UI_BORDER_COLOR, c as ROOM_UI_BORDER_THICKNESS, l as ROOM_UI_HIDDEN, Le as RecordingGroupNode, N as RecordingLayerNode, Oi as RippleEffect, Lr as SciFi, Pr as Sketchy, zr as StainedGlass, pi as SvgExporter, Vr as Topographic, Wr as TreasureMap, Hr as Watercolor, Ri as WaypointOverlay, O as applyStyleToShapes, qr as buildDrawCommands, gi as canvasToBytes, s as colorLightness, te as compose, ea as composeLenses, b as computeNeighborSpill, se as computePathData, ra as createAreaMapSettings, ke as createSettings, _ as darkenColor, d as defaultExitTreatment, m as getRoomBorderColor, me as getRoomBorderThickness, y as hexToRgba, x as identityStyle, Ve as isGradientFill, v as isRoomHidden, Li as placeLabels, ue as projectRoom, si as renderToCanvas, Ue as shapeToRecording, pe as spillPositionMap, ri as svgFromBatches, P as transformFill, Ar as treasureMapDecorations };
4723
4953
 
4724
4954
  //# sourceMappingURL=index.mjs.map