mudlet-map-editor 0.2.0 → 0.3.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-lib/index.js CHANGED
@@ -83,7 +83,10 @@ var T = C(), E = {
83
83
  getState = () => this.state;
84
84
  setState = (e) => {
85
85
  let t = typeof e == "function" ? e(this.state) : e;
86
- this.state = {
86
+ "selection" in t && t.selection !== this.state.selection && t.selection !== null && !("sidebarTab" in t) && (t = {
87
+ ...t,
88
+ sidebarTab: "selection"
89
+ }), this.state = {
87
90
  ...this.state,
88
91
  ...t
89
92
  }, this.listeners.forEach((e) => e(this.state));
@@ -315,15 +318,15 @@ ne.read = function(e, t, n, r, i) {
315
318
  case "latin1":
316
319
  case "binary": return n;
317
320
  case "utf8":
318
- case "utf-8": return pe(e).length;
321
+ case "utf-8": return fe(e).length;
319
322
  case "ucs2":
320
323
  case "ucs-2":
321
324
  case "utf16le":
322
325
  case "utf-16le": return n * 2;
323
326
  case "hex": return n >>> 1;
324
- case "base64": return G(e).length;
327
+ case "base64": return K(e).length;
325
328
  default:
326
- if (i) return r ? -1 : pe(e).length;
329
+ if (i) return r ? -1 : fe(e).length;
327
330
  t = ("" + t).toLowerCase(), i = !0;
328
331
  }
329
332
  }
@@ -449,16 +452,16 @@ ne.read = function(e, t, n, r, i) {
449
452
  return o;
450
453
  }
451
454
  function O(e, t, n, r) {
452
- return K(pe(t, e.length - n), e, n, r);
455
+ return he(fe(t, e.length - n), e, n, r);
453
456
  }
454
457
  function k(e, t, n, r) {
455
- return K(me(t), e, n, r);
458
+ return he(pe(t), e, n, r);
456
459
  }
457
460
  function j(e, t, n, r) {
458
- return K(G(t), e, n, r);
461
+ return he(K(t), e, n, r);
459
462
  }
460
463
  function M(e, t, n, r) {
461
- return K(he(t, e.length - n), e, n, r);
464
+ return he(me(t, e.length - n), e, n, r);
462
465
  }
463
466
  u.prototype.write = function(e, t, n, r) {
464
467
  if (t === void 0) r = "utf8", n = this.length, t = 0;
@@ -581,15 +584,15 @@ ne.read = function(e, t, n, r, i) {
581
584
  }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
582
585
  return e >>>= 0, t || B(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
583
586
  }, u.prototype.readBigUInt64LE = ve(function(e) {
584
- e >>>= 0, le(e, "offset");
587
+ e >>>= 0, ce(e, "offset");
585
588
  let t = this[e], n = this[e + 7];
586
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
589
+ (t === void 0 || n === void 0) && le(e, this.length - 8);
587
590
  let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
588
591
  return BigInt(r) + (BigInt(i) << BigInt(32));
589
592
  }), u.prototype.readBigUInt64BE = ve(function(e) {
590
- e >>>= 0, le(e, "offset");
593
+ e >>>= 0, ce(e, "offset");
591
594
  let t = this[e], n = this[e + 7];
592
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
595
+ (t === void 0 || n === void 0) && le(e, this.length - 8);
593
596
  let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
594
597
  return (BigInt(r) << BigInt(32)) + BigInt(i);
595
598
  }), u.prototype.readIntLE = function(e, t, n) {
@@ -617,15 +620,15 @@ ne.read = function(e, t, n, r, i) {
617
620
  }, u.prototype.readInt32BE = function(e, t) {
618
621
  return e >>>= 0, t || B(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
619
622
  }, u.prototype.readBigInt64LE = ve(function(e) {
620
- e >>>= 0, le(e, "offset");
623
+ e >>>= 0, ce(e, "offset");
621
624
  let t = this[e], n = this[e + 7];
622
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
625
+ (t === void 0 || n === void 0) && le(e, this.length - 8);
623
626
  let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
624
627
  return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
625
628
  }), u.prototype.readBigInt64BE = ve(function(e) {
626
- e >>>= 0, le(e, "offset");
629
+ e >>>= 0, ce(e, "offset");
627
630
  let t = this[e], n = this[e + 7];
628
- (t === void 0 || n === void 0) && ue(e, this.length - 8);
631
+ (t === void 0 || n === void 0) && le(e, this.length - 8);
629
632
  let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
630
633
  return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
631
634
  }), u.prototype.readFloatLE = function(e, t) {
@@ -670,14 +673,14 @@ ne.read = function(e, t, n, r, i) {
670
673
  return e = +e, t >>>= 0, n || V(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
671
674
  };
672
675
  function te(e, t, n, r, i) {
673
- ce(t, r, i, e, n, 7);
676
+ se(t, r, i, e, n, 7);
674
677
  let a = Number(t & BigInt(4294967295));
675
678
  e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
676
679
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
677
680
  return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
678
681
  }
679
682
  function re(e, t, n, r, i) {
680
- ce(t, r, i, e, n, 7);
683
+ se(t, r, i, e, n, 7);
681
684
  let a = Number(t & BigInt(4294967295));
682
685
  e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
683
686
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
@@ -729,13 +732,13 @@ ne.read = function(e, t, n, r, i) {
729
732
  }, u.prototype.writeFloatBE = function(e, t, n) {
730
733
  return H(this, e, t, !1, n);
731
734
  };
732
- function ae(e, t, r, i, a) {
735
+ function U(e, t, r, i, a) {
733
736
  return t = +t, r >>>= 0, a || ie(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
734
737
  }
735
738
  u.prototype.writeDoubleLE = function(e, t, n) {
736
- return ae(this, e, t, !0, n);
739
+ return U(this, e, t, !0, n);
737
740
  }, u.prototype.writeDoubleBE = function(e, t, n) {
738
- return ae(this, e, t, !1, n);
741
+ return U(this, e, t, !1, n);
739
742
  }, u.prototype.copy = function(e, t, n, r) {
740
743
  if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
741
744
  if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
@@ -766,9 +769,9 @@ ne.read = function(e, t, n, r, i) {
766
769
  }
767
770
  return this;
768
771
  };
769
- let U = {};
770
- function W(e, t, n) {
771
- U[e] = class extends n {
772
+ let W = {};
773
+ function G(e, t, n) {
774
+ W[e] = class extends n {
772
775
  constructor() {
773
776
  super(), Object.defineProperty(this, "message", {
774
777
  value: t.apply(this, arguments),
@@ -792,42 +795,42 @@ ne.read = function(e, t, n, r, i) {
792
795
  }
793
796
  };
794
797
  }
795
- W("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
798
+ G("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
796
799
  return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
797
- }, RangeError), W("ERR_INVALID_ARG_TYPE", function(e, t) {
800
+ }, RangeError), G("ERR_INVALID_ARG_TYPE", function(e, t) {
798
801
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
799
- }, TypeError), W("ERR_OUT_OF_RANGE", function(e, t, n) {
802
+ }, TypeError), G("ERR_OUT_OF_RANGE", function(e, t, n) {
800
803
  let r = `The value of "${e}" is out of range.`, i = n;
801
- return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = oe(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = oe(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
804
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = ae(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = ae(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
802
805
  }, RangeError);
803
- function oe(e) {
806
+ function ae(e) {
804
807
  let t = "", n = e.length, r = +(e[0] === "-");
805
808
  for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
806
809
  return `${e.slice(0, n)}${t}`;
807
810
  }
808
- function se(e, t, n) {
809
- le(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && ue(t, e.length - (n + 1));
811
+ function oe(e, t, n) {
812
+ ce(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && le(t, e.length - (n + 1));
810
813
  }
811
- function ce(e, t, n, r, i, a) {
814
+ function se(e, t, n, r, i, a) {
812
815
  if (e > n || e < t) {
813
816
  let r = typeof t == "bigint" ? "n" : "", i;
814
- throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new U.ERR_OUT_OF_RANGE("value", i, e);
817
+ throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new W.ERR_OUT_OF_RANGE("value", i, e);
815
818
  }
816
- se(r, i, a);
819
+ oe(r, i, a);
817
820
  }
818
- function le(e, t) {
819
- if (typeof e != "number") throw new U.ERR_INVALID_ARG_TYPE(t, "number", e);
821
+ function ce(e, t) {
822
+ if (typeof e != "number") throw new W.ERR_INVALID_ARG_TYPE(t, "number", e);
820
823
  }
821
- function ue(e, t, n) {
822
- throw Math.floor(e) === e ? t < 0 ? new U.ERR_BUFFER_OUT_OF_BOUNDS() : new U.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (le(e, n), new U.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
824
+ function le(e, t, n) {
825
+ throw Math.floor(e) === e ? t < 0 ? new W.ERR_BUFFER_OUT_OF_BOUNDS() : new W.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (ce(e, n), new W.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
823
826
  }
824
- let de = /[^+/0-9A-Za-z-_]/g;
825
- function fe(e) {
826
- if (e = e.split("=")[0], e = e.trim().replace(de, ""), e.length < 2) return "";
827
+ let ue = /[^+/0-9A-Za-z-_]/g;
828
+ function de(e) {
829
+ if (e = e.split("=")[0], e = e.trim().replace(ue, ""), e.length < 2) return "";
827
830
  for (; e.length % 4 != 0;) e += "=";
828
831
  return e;
829
832
  }
830
- function pe(e, t) {
833
+ function fe(e, t) {
831
834
  t ||= Infinity;
832
835
  let n, r = e.length, i = null, a = [];
833
836
  for (let o = 0; o < r; ++o) {
@@ -865,20 +868,20 @@ ne.read = function(e, t, n, r, i) {
865
868
  }
866
869
  return a;
867
870
  }
868
- function me(e) {
871
+ function pe(e) {
869
872
  let t = [];
870
873
  for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
871
874
  return t;
872
875
  }
873
- function he(e, t) {
876
+ function me(e, t) {
874
877
  let n, r, i, a = [];
875
878
  for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
876
879
  return a;
877
880
  }
878
- function G(e) {
879
- return t.toByteArray(fe(e));
881
+ function K(e) {
882
+ return t.toByteArray(de(e));
880
883
  }
881
- function K(e, t, n, r) {
884
+ function he(e, t, n, r) {
882
885
  let i;
883
886
  for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
884
887
  return i;
@@ -914,10 +917,10 @@ function ie(e) {
914
917
  function H(e) {
915
918
  return new Uint8Array(c(e));
916
919
  }
917
- function ae(e) {
920
+ function U(e) {
918
921
  return s(e);
919
922
  }
920
- function U() {
923
+ function W() {
921
924
  return {
922
925
  version: 20,
923
926
  rooms: {},
@@ -967,7 +970,7 @@ function U() {
967
970
  }
968
971
  //#endregion
969
972
  //#region src/editor/loadFile.ts
970
- async function W(e, t) {
973
+ async function G(e, t) {
971
974
  try {
972
975
  D.setState({ status: "Fetching…" });
973
976
  let n = await fetch(e);
@@ -1004,7 +1007,7 @@ async function W(e, t) {
1004
1007
  D.setState({ status: `Failed to load URL: ${e.message}` });
1005
1008
  }
1006
1009
  }
1007
- async function oe(e) {
1010
+ async function ae(e) {
1008
1011
  try {
1009
1012
  D.setState({ status: `Reading ${e.name}…` });
1010
1013
  let t = ie(await e.arrayBuffer()), n = Number(Object.keys(t.areaNames)[0] ?? -1), r = Number.isNaN(n) ? null : n;
@@ -1028,7 +1031,7 @@ async function oe(e) {
1028
1031
  }
1029
1032
  //#endregion
1030
1033
  //#region src/components/DropdownSelect.tsx
1031
- function se({ label: e, value: n, options: a, onChange: o, searchable: s, emptyText: c = "—", width: p }) {
1034
+ function oe({ label: e, value: n, options: a, onChange: o, searchable: s, emptyText: c = "—", width: p }) {
1032
1035
  let [m, h] = i(!1), [g, _] = i(""), [v, y] = i(-1), [b, x] = i({}), S = r(null), C = r(null), w = r(null), T = a.find((e) => e.value === n), E = s && g.trim() ? a.filter((e) => e.label.toLowerCase().includes(g.toLowerCase())) : a;
1033
1036
  t(() => {
1034
1037
  let e = E.findIndex((e) => e.value === n);
@@ -1129,7 +1132,7 @@ function se({ label: e, value: n, options: a, onChange: o, searchable: s, emptyT
1129
1132
  }
1130
1133
  //#endregion
1131
1134
  //#region src/components/HelpModal.tsx
1132
- var ce = [
1135
+ var se = [
1133
1136
  {
1134
1137
  id: "select",
1135
1138
  label: "Select",
@@ -1178,7 +1181,7 @@ var ce = [
1178
1181
  hint: "Click or drag rooms to apply the active room swatch (symbol + environment). Select a swatch in the Swatches palette first.",
1179
1182
  key: "8"
1180
1183
  }
1181
- ], le = [
1184
+ ], ce = [
1182
1185
  {
1183
1186
  keys: ["1–7"],
1184
1187
  desc: "Switch tool"
@@ -1224,7 +1227,7 @@ var ce = [
1224
1227
  desc: "Cancel / deselect"
1225
1228
  }
1226
1229
  ];
1227
- function ue({ onClose: e }) {
1230
+ function le({ onClose: e }) {
1228
1231
  return /* @__PURE__ */ d("div", {
1229
1232
  className: "modal-overlay",
1230
1233
  onClick: e,
@@ -1256,7 +1259,7 @@ function ue({ onClose: e }) {
1256
1259
  }),
1257
1260
  /* @__PURE__ */ d("table", {
1258
1261
  className: "help-table",
1259
- children: /* @__PURE__ */ d("tbody", { children: ce.map((e) => /* @__PURE__ */ f("tr", { children: [
1262
+ children: /* @__PURE__ */ d("tbody", { children: se.map((e) => /* @__PURE__ */ f("tr", { children: [
1260
1263
  /* @__PURE__ */ d("td", { children: /* @__PURE__ */ d("kbd", { children: e.key }) }),
1261
1264
  /* @__PURE__ */ d("td", {
1262
1265
  className: "help-tool-name",
@@ -1274,7 +1277,7 @@ function ue({ onClose: e }) {
1274
1277
  }),
1275
1278
  /* @__PURE__ */ d("table", {
1276
1279
  className: "help-table",
1277
- children: /* @__PURE__ */ d("tbody", { children: le.map((e, t) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("td", { children: e.keys.map((e) => /* @__PURE__ */ d("kbd", { children: e }, e)) }), /* @__PURE__ */ d("td", {
1280
+ children: /* @__PURE__ */ d("tbody", { children: ce.map((e, t) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("td", { children: e.keys.map((e) => /* @__PURE__ */ d("kbd", { children: e }, e)) }), /* @__PURE__ */ d("td", {
1278
1281
  colSpan: 2,
1279
1282
  className: "help-tool-hint",
1280
1283
  children: e.desc
@@ -1287,7 +1290,7 @@ function ue({ onClose: e }) {
1287
1290
  }
1288
1291
  //#endregion
1289
1292
  //#region src/components/Toolbar.tsx
1290
- function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a, onSave: o }) {
1293
+ function ue({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a, onSave: o }) {
1291
1294
  let s = O((e) => e.activeTool), c = O((e) => e.map), l = c != null, p = O((e) => e.loaded), m = O((e) => e.currentAreaId), h = O((e) => e.currentZ), _ = O((e) => e.snapToGrid), v = O((e) => e.status), y = O((e) => e.pending), b = O((e) => e.undo.length), x = O((e) => e.redo.length), C = O((e) => e.savedUndoLength), w = O((e) => e.swatchPaletteOpen), T = O((e) => e.activeSwatchId), E = O((e) => e.activeSwatchSetId), k = O((e) => e.swatchSets), A = O((e) => e.pluginSwatchSets), j = [...k, ...A].find((e) => e.id === E)?.swatches.find((e) => e.id === T) ?? null, M = b !== C, N = O((e) => e.structureVersion), P = n(() => c ? Object.entries(c.areaNames).map(([e, t]) => ({
1292
1295
  id: Number(e),
1293
1296
  name: t
@@ -1323,7 +1326,7 @@ function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1323
1326
  pending: null
1324
1327
  }), D.bumpStructure(), R("");
1325
1328
  }, z = () => {
1326
- let e = U();
1329
+ let e = W();
1327
1330
  D.setState({
1328
1331
  map: e,
1329
1332
  loaded: { fileName: "new-map.dat" },
@@ -1338,14 +1341,14 @@ function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1338
1341
  status: "New map created · 0 rooms · 1 area",
1339
1342
  sessionId: null
1340
1343
  }), D.bumpStructure();
1341
- }, B = oe;
1344
+ }, B = ae;
1342
1345
  return /* @__PURE__ */ f("div", {
1343
1346
  className: "toolbar",
1344
1347
  children: [/* @__PURE__ */ f("div", {
1345
1348
  className: "toolbar-row toolbar-row-header",
1346
1349
  children: [
1347
1350
  /* @__PURE__ */ d("img", {
1348
- src: "/logo.png",
1351
+ src: "logo.png",
1349
1352
  alt: "Mudlet logo",
1350
1353
  id: "logo"
1351
1354
  }),
@@ -1537,7 +1540,7 @@ function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1537
1540
  }),
1538
1541
  l && /* @__PURE__ */ f(u, { children: [
1539
1542
  /* @__PURE__ */ d("div", { className: "toolbar-sep" }),
1540
- /* @__PURE__ */ d(se, {
1543
+ /* @__PURE__ */ d(oe, {
1541
1544
  label: "Area",
1542
1545
  value: m,
1543
1546
  options: P.map((e) => ({
@@ -1555,7 +1558,7 @@ function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1555
1558
  searchable: !0,
1556
1559
  width: 300
1557
1560
  }),
1558
- /* @__PURE__ */ d(se, {
1561
+ /* @__PURE__ */ d(oe, {
1559
1562
  label: "Level",
1560
1563
  value: h,
1561
1564
  options: F.map((e) => ({
@@ -1639,7 +1642,7 @@ function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1639
1642
  children: [
1640
1643
  /* @__PURE__ */ d("div", {
1641
1644
  className: "tool-group",
1642
- children: ce.map((e) => /* @__PURE__ */ f("button", {
1645
+ children: se.map((e) => /* @__PURE__ */ f("button", {
1643
1646
  type: "button",
1644
1647
  className: `tool-btn${s === e.id ? " active" : ""}`,
1645
1648
  title: `${e.label} (${e.key}) — ${e.hint}`,
@@ -1743,9 +1746,9 @@ function de({ title: e = "Mudlet Map Editor", onHelpClick: t, onLoadFromUrl: a,
1743
1746
  }
1744
1747
  //#endregion
1745
1748
  //#region src/components/UrlLoadModal.tsx
1746
- function fe({ onClose: e, initialUrl: n }) {
1749
+ function de({ onClose: e, initialUrl: n }) {
1747
1750
  let [r, a] = i(n ?? ""), [o, s] = i(!1), [c, l] = i(null), u = async (t = r.trim()) => {
1748
- t && (a(t), s(!0), l(0), await W(t, l), s(!1), l(null), D.getState().map && e());
1751
+ t && (a(t), s(!0), l(0), await G(t, l), s(!1), l(null), D.getState().map && e());
1749
1752
  };
1750
1753
  return t(() => {
1751
1754
  n && u(n);
@@ -1831,14 +1834,14 @@ function fe({ onClose: e, initialUrl: n }) {
1831
1834
  }
1832
1835
  //#endregion
1833
1836
  //#region src/editor/types.ts
1834
- var pe = {
1837
+ var fe = {
1835
1838
  family: "Arial",
1836
1839
  size: 30,
1837
1840
  bold: !1,
1838
1841
  italic: !1,
1839
1842
  underline: !1,
1840
1843
  strikeout: !1
1841
- }, me = [
1844
+ }, pe = [
1842
1845
  "north",
1843
1846
  "northeast",
1844
1847
  "east",
@@ -1851,7 +1854,7 @@ var pe = {
1851
1854
  "down",
1852
1855
  "in",
1853
1856
  "out"
1854
- ], he = {
1857
+ ], me = {
1855
1858
  north: "south",
1856
1859
  south: "north",
1857
1860
  east: "west",
@@ -1864,7 +1867,7 @@ var pe = {
1864
1867
  down: "up",
1865
1868
  in: "out",
1866
1869
  out: "in"
1867
- }, G = {
1870
+ }, K = {
1868
1871
  north: "n",
1869
1872
  south: "s",
1870
1873
  east: "e",
@@ -1877,7 +1880,7 @@ var pe = {
1877
1880
  down: "down",
1878
1881
  in: "in",
1879
1882
  out: "out"
1880
- }, K = {
1883
+ }, he = Object.entries(K).reduce((e, [t, n]) => (e[n] = t, e), {}), q = {
1881
1884
  north: 1,
1882
1885
  northeast: 2,
1883
1886
  northwest: 3,
@@ -1890,18 +1893,18 @@ var pe = {
1890
1893
  down: 10,
1891
1894
  in: 11,
1892
1895
  out: 12
1893
- }, q = new Set(Object.values(G)), ge = Object.entries(G).reduce((e, [t, n]) => (e[n] = t, e), {});
1894
- function _e(e) {
1896
+ }, ge = new Set(Object.values(K)), _e = Object.entries(K).reduce((e, [t, n]) => (e[n] = t, e), {});
1897
+ function ve(e) {
1895
1898
  let t = e.trim(), n = t.toLowerCase();
1896
- return n in G ? G[n] : q.has(n) ? n : t;
1899
+ return n in K ? K[n] : ge.has(n) ? n : t;
1897
1900
  }
1898
1901
  //#endregion
1899
1902
  //#region src/editor/mapHelpers.ts
1900
- function ve(e) {
1903
+ function ye(e) {
1901
1904
  let t = Object.keys(e.areas).map(Number);
1902
1905
  return t.length === 0 ? 1 : Math.max(...t) + 1;
1903
1906
  }
1904
- function ye(e) {
1907
+ function be(e) {
1905
1908
  let t = 0;
1906
1909
  for (let n of Object.keys(e.rooms)) {
1907
1910
  let e = Number(n);
@@ -1909,7 +1912,7 @@ function ye(e) {
1909
1912
  }
1910
1913
  return t + 1;
1911
1914
  }
1912
- function be(e, t, n, r, i) {
1915
+ function xe(e, t, n, r, i) {
1913
1916
  return {
1914
1917
  area: t,
1915
1918
  x: n,
@@ -1945,34 +1948,34 @@ function be(e, t, n, r, i) {
1945
1948
  doors: {}
1946
1949
  };
1947
1950
  }
1948
- function xe(e, t, n, r) {
1951
+ function Se(e, t, n, r) {
1949
1952
  let i = n - e, a = r - t;
1950
1953
  if (Math.abs(i) < .001 && Math.abs(a) < .001) return "north";
1951
1954
  let o = (Math.atan2(a, i) * 180 / Math.PI + 360) % 360;
1952
1955
  return o < 22.5 || o >= 337.5 ? "east" : o < 67.5 ? "southeast" : o < 112.5 ? "south" : o < 157.5 ? "southwest" : o < 202.5 ? "west" : o < 247.5 ? "northwest" : o < 292.5 ? "north" : "northeast";
1953
1956
  }
1954
1957
  function J(e, t) {
1955
- return e[t];
1958
+ return e[t] ?? e.mSpecialExits[t] ?? void 0;
1956
1959
  }
1957
- function Se(e, t) {
1960
+ function Ce(e, t) {
1958
1961
  let n = [];
1959
1962
  for (let r of Object.keys(e.rooms)) {
1960
1963
  let i = Number(r);
1961
1964
  if (i === t) continue;
1962
1965
  let a = e.rooms[i];
1963
- for (let e of me) J(a, e) === t && n.push({
1966
+ for (let e of pe) J(a, e) === t && n.push({
1964
1967
  roomId: i,
1965
1968
  dir: e
1966
1969
  });
1967
1970
  }
1968
1971
  return n;
1969
1972
  }
1970
- function Ce(e) {
1973
+ function we(e) {
1971
1974
  return e !== "up" && e !== "down" && e !== "in" && e !== "out";
1972
1975
  }
1973
1976
  //#endregion
1974
1977
  //#region src/editor/commands.ts
1975
- function we(e, t, n) {
1978
+ function Te(e, t, n) {
1976
1979
  let r = n?.reader;
1977
1980
  switch (t.kind) {
1978
1981
  case "moveRoom":
@@ -2142,7 +2145,7 @@ function we(e, t, n) {
2142
2145
  }
2143
2146
  return { structural: !1 };
2144
2147
  case "setDoor": {
2145
- let n = G[t.dir];
2148
+ let n = K[t.dir];
2146
2149
  if (r) r.setDoor(t.roomId, t.dir, t.to);
2147
2150
  else {
2148
2151
  let r = e.rooms[t.roomId];
@@ -2151,7 +2154,7 @@ function we(e, t, n) {
2151
2154
  return { structural: !1 };
2152
2155
  }
2153
2156
  case "setExitWeight": {
2154
- let n = G[t.dir];
2157
+ let n = K[t.dir];
2155
2158
  if (r) r.setExitWeight(t.roomId, t.dir, t.to);
2156
2159
  else {
2157
2160
  let r = e.rooms[t.roomId];
@@ -2160,7 +2163,7 @@ function we(e, t, n) {
2160
2163
  return { structural: !1 };
2161
2164
  }
2162
2165
  case "setExitLock": {
2163
- let n = K[t.dir];
2166
+ let n = q[t.dir];
2164
2167
  if (r) r.setExitLock(t.roomId, t.dir, t.lock);
2165
2168
  else {
2166
2169
  let r = e.rooms[t.roomId];
@@ -2173,7 +2176,7 @@ function we(e, t, n) {
2173
2176
  return { structural: !1 };
2174
2177
  }
2175
2178
  case "setStub": {
2176
- let n = K[t.dir];
2179
+ let n = q[t.dir];
2177
2180
  if (r) r.setStub(t.roomId, t.dir, t.stub);
2178
2181
  else {
2179
2182
  let r = e.rooms[t.roomId];
@@ -2311,12 +2314,12 @@ function we(e, t, n) {
2311
2314
  return n.reader.removeRooms(r), { structural: !0 };
2312
2315
  }
2313
2316
  let r = !1;
2314
- for (let i of t.cmds) we(e, i, n).structural && (r = !0);
2317
+ for (let i of t.cmds) Te(e, i, n).structural && (r = !0);
2315
2318
  return { structural: r };
2316
2319
  }
2317
2320
  }
2318
2321
  }
2319
- function Te(e, t, n) {
2322
+ function Ee(e, t, n) {
2320
2323
  let r = n?.reader;
2321
2324
  switch (t.kind) {
2322
2325
  case "moveRoom":
@@ -2506,7 +2509,7 @@ function Te(e, t, n) {
2506
2509
  }
2507
2510
  return { structural: !1 };
2508
2511
  case "setDoor": {
2509
- let n = G[t.dir];
2512
+ let n = K[t.dir];
2510
2513
  if (r) r.setDoor(t.roomId, t.dir, t.from);
2511
2514
  else {
2512
2515
  let r = e.rooms[t.roomId];
@@ -2515,7 +2518,7 @@ function Te(e, t, n) {
2515
2518
  return { structural: !1 };
2516
2519
  }
2517
2520
  case "setExitWeight": {
2518
- let n = G[t.dir];
2521
+ let n = K[t.dir];
2519
2522
  if (r) r.setExitWeight(t.roomId, t.dir, t.from);
2520
2523
  else {
2521
2524
  let r = e.rooms[t.roomId];
@@ -2524,7 +2527,7 @@ function Te(e, t, n) {
2524
2527
  return { structural: !1 };
2525
2528
  }
2526
2529
  case "setExitLock": {
2527
- let n = K[t.dir];
2530
+ let n = q[t.dir];
2528
2531
  if (r) r.setExitLock(t.roomId, t.dir, !t.lock);
2529
2532
  else {
2530
2533
  let r = e.rooms[t.roomId];
@@ -2537,7 +2540,7 @@ function Te(e, t, n) {
2537
2540
  return { structural: !1 };
2538
2541
  }
2539
2542
  case "setStub": {
2540
- let n = K[t.dir];
2543
+ let n = q[t.dir];
2541
2544
  if (r) r.setStub(t.roomId, t.dir, !t.stub);
2542
2545
  else {
2543
2546
  let r = e.rooms[t.roomId];
@@ -2667,7 +2670,7 @@ function Te(e, t, n) {
2667
2670
  return { structural: !1 };
2668
2671
  case "batch": {
2669
2672
  let r = !1;
2670
- for (let i of [...t.cmds].reverse()) Te(e, i, n).structural && (r = !0);
2673
+ for (let i of [...t.cmds].reverse()) Ee(e, i, n).structural && (r = !0);
2671
2674
  return { structural: r };
2672
2675
  }
2673
2676
  }
@@ -2675,19 +2678,19 @@ function Te(e, t, n) {
2675
2678
  function Y(e, t) {
2676
2679
  let n = D.getState();
2677
2680
  if (!n.map) return !1;
2678
- let { structural: r } = we(n.map, e, t);
2681
+ let { structural: r } = Te(n.map, e, t);
2679
2682
  return D.setState((t) => ({
2680
2683
  undo: [...t.undo, e],
2681
2684
  redo: []
2682
2685
  })), r;
2683
2686
  }
2684
- function Ee(e, t) {
2687
+ function De(e, t) {
2685
2688
  if (e.length === 0) return !1;
2686
2689
  if (e.length === 1) return Y(e[0], t);
2687
2690
  let n = D.getState();
2688
2691
  if (!n.map) return !1;
2689
2692
  let r = !1;
2690
- for (let i of e) we(n.map, i, t).structural && (r = !0);
2693
+ for (let i of e) Te(n.map, i, t).structural && (r = !0);
2691
2694
  let i = {
2692
2695
  kind: "batch",
2693
2696
  cmds: e
@@ -2697,13 +2700,13 @@ function Ee(e, t) {
2697
2700
  redo: []
2698
2701
  })), r;
2699
2702
  }
2700
- function De(e) {
2703
+ function Oe(e) {
2701
2704
  let t = D.getState();
2702
2705
  if (!t.map || t.undo.length === 0) return {
2703
2706
  changed: !1,
2704
2707
  structural: !1
2705
2708
  };
2706
- let n = t.undo[t.undo.length - 1], { structural: r } = Te(t.map, n, e);
2709
+ let n = t.undo[t.undo.length - 1], { structural: r } = Ee(t.map, n, e);
2707
2710
  return D.setState((e) => ({
2708
2711
  undo: e.undo.slice(0, -1),
2709
2712
  redo: [...e.redo, n]
@@ -2712,13 +2715,13 @@ function De(e) {
2712
2715
  structural: r
2713
2716
  };
2714
2717
  }
2715
- function Oe(e) {
2718
+ function ke(e) {
2716
2719
  let t = D.getState();
2717
2720
  if (!t.map || t.redo.length === 0) return {
2718
2721
  changed: !1,
2719
2722
  structural: !1
2720
2723
  };
2721
- let n = t.redo[t.redo.length - 1], { structural: r } = we(t.map, n, e);
2724
+ let n = t.redo[t.redo.length - 1], { structural: r } = Te(t.map, n, e);
2722
2725
  return D.setState((e) => ({
2723
2726
  undo: [...e.undo, n],
2724
2727
  redo: e.redo.slice(0, -1)
@@ -2727,7 +2730,7 @@ function Oe(e) {
2727
2730
  structural: r
2728
2731
  };
2729
2732
  }
2730
- function ke(e, t, n, r) {
2733
+ function Ae(e, t, n, r) {
2731
2734
  if (n === 0 && r === 0) return [];
2732
2735
  let i = e.rooms[t];
2733
2736
  if (!i) return [];
@@ -2762,20 +2765,20 @@ function ke(e, t, n, r) {
2762
2765
  }
2763
2766
  return a;
2764
2767
  }
2765
- function Ae(e, t) {
2766
- return Se(e, t).map((t) => ({
2768
+ function je(e, t) {
2769
+ return Ce(e, t).map((t) => ({
2767
2770
  roomId: t.roomId,
2768
2771
  dir: t.dir,
2769
2772
  was: J(e.rooms[t.roomId], t.dir)
2770
2773
  }));
2771
2774
  }
2772
- function je(e, t) {
2775
+ function Me(e, t) {
2773
2776
  let n = new Set(t), r = new Map(t.map((e) => [e, []]));
2774
2777
  for (let t of Object.keys(e.rooms)) {
2775
2778
  let i = Number(t);
2776
2779
  if (n.has(i)) continue;
2777
2780
  let a = e.rooms[i];
2778
- for (let e of me) {
2781
+ for (let e of pe) {
2779
2782
  let t = J(a, e);
2780
2783
  n.has(t) && r.get(t).push({
2781
2784
  roomId: i,
@@ -2788,7 +2791,7 @@ function je(e, t) {
2788
2791
  }
2789
2792
  //#endregion
2790
2793
  //#region src/components/panelShared.tsx
2791
- function Me({ id: e, name: t, className: n }) {
2794
+ function Ne({ id: e, name: t, className: n }) {
2792
2795
  return /* @__PURE__ */ f("button", {
2793
2796
  type: "button",
2794
2797
  className: n ?? "exit-target",
@@ -2846,7 +2849,7 @@ function X({ label: e, children: t, as: n = "label" }) {
2846
2849
  }), t]
2847
2850
  });
2848
2851
  }
2849
- function Ne({ checked: e, onChange: t, description: n }) {
2852
+ function Pe({ checked: e, onChange: t, description: n }) {
2850
2853
  return /* @__PURE__ */ f("label", {
2851
2854
  className: "field checkbox-field",
2852
2855
  children: [/* @__PURE__ */ d("input", {
@@ -2856,7 +2859,7 @@ function Ne({ checked: e, onChange: t, description: n }) {
2856
2859
  }), /* @__PURE__ */ d("span", { children: n })]
2857
2860
  });
2858
2861
  }
2859
- function Pe({ activeTool: e }) {
2862
+ function Fe({ activeTool: e }) {
2860
2863
  return /* @__PURE__ */ d("p", {
2861
2864
  className: "hint-tool",
2862
2865
  children: {
@@ -2871,7 +2874,7 @@ function Pe({ activeTool: e }) {
2871
2874
  }[e] ?? ""
2872
2875
  });
2873
2876
  }
2874
- function Fe({ data: e, onCommit: t }) {
2877
+ function Ie({ data: e, onCommit: t }) {
2875
2878
  let [n, r] = i(""), [a, o] = i(""), s = () => {
2876
2879
  let e = n.trim();
2877
2880
  e && (t(e, null, a), r(""), o(""));
@@ -2938,14 +2941,14 @@ function Fe({ data: e, onCommit: t }) {
2938
2941
  ]
2939
2942
  });
2940
2943
  }
2941
- function Ie(e) {
2944
+ function Le(e) {
2942
2945
  return "#" + [
2943
2946
  e.r,
2944
2947
  e.g,
2945
2948
  e.b
2946
2949
  ].map((e) => e.toString(16).padStart(2, "0")).join("");
2947
2950
  }
2948
- function Le(e) {
2951
+ function Re(e) {
2949
2952
  return {
2950
2953
  spec: 1,
2951
2954
  alpha: 255,
@@ -2957,7 +2960,7 @@ function Le(e) {
2957
2960
  }
2958
2961
  //#endregion
2959
2962
  //#region src/components/AreaManagerModal.tsx
2960
- function Re({ sceneRef: e }) {
2963
+ function ze({ sceneRef: e }) {
2961
2964
  let t = O((e) => e.map), [n, r] = i(""), [a, o] = i(null), [s, c] = i(""), [l, u] = i(null), [p, m] = i(null);
2962
2965
  if (!t) return /* @__PURE__ */ d("div", {
2963
2966
  className: "modal-empty",
@@ -2970,7 +2973,7 @@ function Re({ sceneRef: e }) {
2970
2973
  })).sort((e, t) => e.name.localeCompare(t.name)), g = () => {
2971
2974
  let i = n.trim();
2972
2975
  if (!i) return;
2973
- let a = ve(t);
2976
+ let a = ye(t);
2974
2977
  Y({
2975
2978
  kind: "addArea",
2976
2979
  id: a,
@@ -3004,7 +3007,7 @@ function Re({ sceneRef: e }) {
3004
3007
  let n = Number(e);
3005
3008
  if (a.has(n)) continue;
3006
3009
  let r = t.rooms[n];
3007
- for (let e of me) {
3010
+ for (let e of pe) {
3008
3011
  let t = r[e];
3009
3012
  typeof t == "number" && a.has(t) && (s.push({
3010
3013
  roomId: n,
@@ -3029,7 +3032,7 @@ function Re({ sceneRef: e }) {
3029
3032
  }, y = () => {
3030
3033
  if (!l || l.moveTarget === "") return;
3031
3034
  let t = Number(l.moveTarget);
3032
- Ee([{
3035
+ De([{
3033
3036
  kind: "moveRoomsToArea",
3034
3037
  roomIds: [...l.rooms],
3035
3038
  fromAreaId: l.id,
@@ -3128,7 +3131,7 @@ function Re({ sceneRef: e }) {
3128
3131
  }),
3129
3132
  p === n && /* @__PURE__ */ d("div", {
3130
3133
  className: "area-ud-section",
3131
- children: /* @__PURE__ */ d(Fe, {
3134
+ children: /* @__PURE__ */ d(Ie, {
3132
3135
  data: t.areas[n]?.userData ?? {},
3133
3136
  onCommit: (t, r, i) => {
3134
3137
  Y({
@@ -3200,14 +3203,14 @@ function Re({ sceneRef: e }) {
3200
3203
  }
3201
3204
  //#endregion
3202
3205
  //#region src/components/EnvManagerModal.tsx
3203
- function ze(e) {
3206
+ function Be(e) {
3204
3207
  return "#" + [
3205
3208
  e.r,
3206
3209
  e.g,
3207
3210
  e.b
3208
3211
  ].map((e) => e.toString(16).padStart(2, "0")).join("");
3209
3212
  }
3210
- function Be(e) {
3213
+ function Ve(e) {
3211
3214
  return {
3212
3215
  spec: 1,
3213
3216
  alpha: 255,
@@ -3217,7 +3220,7 @@ function Be(e) {
3217
3220
  pad: 0
3218
3221
  };
3219
3222
  }
3220
- function Ve({ sceneRef: e }) {
3223
+ function He({ sceneRef: e }) {
3221
3224
  let t = O((e) => e.map), n = O((e) => e.dataVersion), [r, a] = i(""), [o, s] = i(null), [c, l] = i(!1), [u, p] = i(""), [m, h] = i("#888888");
3222
3225
  if (!t) return /* @__PURE__ */ d("div", {
3223
3226
  className: "modal-empty",
@@ -3238,7 +3241,7 @@ function Ve({ sceneRef: e }) {
3238
3241
  }, S = () => {
3239
3242
  s(null), p(String(x())), l(!0);
3240
3243
  }, C = (n, r) => {
3241
- let i = Be(r);
3244
+ let i = Ve(r);
3242
3245
  Y({
3243
3246
  kind: "setCustomEnvColor",
3244
3247
  envId: n,
@@ -3259,7 +3262,7 @@ function Ve({ sceneRef: e }) {
3259
3262
  D.setState({ status: "Env IDs 1–256 are reserved. Use 257 or higher." });
3260
3263
  return;
3261
3264
  }
3262
- let r = Be(m);
3265
+ let r = Ve(m);
3263
3266
  Y({
3264
3267
  kind: "setCustomEnvColor",
3265
3268
  envId: n,
@@ -3364,7 +3367,7 @@ function Ve({ sceneRef: e }) {
3364
3367
  }),
3365
3368
  /* @__PURE__ */ d("input", {
3366
3369
  type: "color",
3367
- value: ze(t.mCustomEnvColors[y.envId]),
3370
+ value: Be(t.mCustomEnvColors[y.envId]),
3368
3371
  onChange: (e) => C(y.envId, e.target.value),
3369
3372
  style: {
3370
3373
  width: "100%",
@@ -3389,7 +3392,7 @@ function Ve({ sceneRef: e }) {
3389
3392
  }
3390
3393
  //#endregion
3391
3394
  //#region src/components/panels/HistoryPanel.tsx
3392
- function He(e) {
3395
+ function Ue(e) {
3393
3396
  switch (e.kind) {
3394
3397
  case "moveRoom": return `Move room #${e.id}`;
3395
3398
  case "addRoom": return `Add room #${e.id}`;
@@ -3431,10 +3434,10 @@ function He(e) {
3431
3434
  case "setLabelNoScaling": return `${e.to ? "Disable" : "Enable"} zoom scaling on label #${e.id}`;
3432
3435
  case "setLabelShowOnTop": return `Set label #${e.id} ${e.to ? "foreground" : "background"}`;
3433
3436
  case "resizeLabel": return `Resize label #${e.id}`;
3434
- case "batch": return He(e.cmds[0]);
3437
+ case "batch": return Ue(e.cmds[0]);
3435
3438
  }
3436
3439
  }
3437
- function Ue({ cmd: e, className: t, onClick: n, title: r }) {
3440
+ function We({ cmd: e, className: t, onClick: n, title: r }) {
3438
3441
  return /* @__PURE__ */ f("button", {
3439
3442
  type: "button",
3440
3443
  className: t,
@@ -3442,23 +3445,23 @@ function Ue({ cmd: e, className: t, onClick: n, title: r }) {
3442
3445
  title: r,
3443
3446
  children: [/* @__PURE__ */ d("span", {
3444
3447
  className: "history-label",
3445
- children: He(e)
3448
+ children: Ue(e)
3446
3449
  }), e.kind === "batch" && e.cmds.slice(1).map((e, t) => /* @__PURE__ */ d("span", {
3447
3450
  className: "history-sub",
3448
- children: He(e)
3451
+ children: Ue(e)
3449
3452
  }, t))]
3450
3453
  });
3451
3454
  }
3452
- function We({ sceneRef: e }) {
3455
+ function Ge({ sceneRef: e }) {
3453
3456
  let t = O((e) => e.undo), n = O((e) => e.redo), r = (t, n) => {
3454
3457
  let r = e.current, i = !1;
3455
3458
  for (let e = 0; e < t; e++) {
3456
- let e = De(r);
3459
+ let e = Oe(r);
3457
3460
  if (!e.changed) break;
3458
3461
  e.structural && (i = !0);
3459
3462
  }
3460
3463
  for (let e = 0; e < n; e++) {
3461
- let e = Oe(r);
3464
+ let e = ke(r);
3462
3465
  if (!e.changed) break;
3463
3466
  e.structural && (i = !0);
3464
3467
  }
@@ -3479,7 +3482,7 @@ function We({ sceneRef: e }) {
3479
3482
  children: "Current state"
3480
3483
  })]
3481
3484
  }),
3482
- i.map((e, t) => /* @__PURE__ */ d(Ue, {
3485
+ i.map((e, t) => /* @__PURE__ */ d(We, {
3483
3486
  cmd: e,
3484
3487
  className: "history-item history-done",
3485
3488
  onClick: () => r(t + 1, 0),
@@ -3493,7 +3496,7 @@ function We({ sceneRef: e }) {
3493
3496
  n.length > 0 && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
3494
3497
  className: "history-sep",
3495
3498
  children: "— undone —"
3496
- }), a.map((e, t) => /* @__PURE__ */ d(Ue, {
3499
+ }), a.map((e, t) => /* @__PURE__ */ d(We, {
3497
3500
  cmd: e,
3498
3501
  className: "history-item history-undone",
3499
3502
  onClick: () => r(0, t + 1),
@@ -3505,7 +3508,7 @@ function We({ sceneRef: e }) {
3505
3508
  }
3506
3509
  //#endregion
3507
3510
  //#region src/components/panels/MapPanel.tsx
3508
- function Ge(e, t) {
3511
+ function Ke(e, t) {
3509
3512
  let n = [], r = e.current?.reader;
3510
3513
  if (r) for (let e of r.getAreas()) {
3511
3514
  let t = e.getAreaId(), r = e.getAreaName();
@@ -3547,7 +3550,7 @@ function Ge(e, t) {
3547
3550
  }
3548
3551
  return n;
3549
3552
  }
3550
- function Ke(e) {
3553
+ function qe(e) {
3551
3554
  let t = D.getState(), n = e.areaId !== t.currentAreaId, r = e.z !== t.currentZ, i = e.x, a = -e.y;
3552
3555
  n || r ? (D.setState({
3553
3556
  selection: {
@@ -3575,7 +3578,7 @@ function Ke(e) {
3575
3578
  sidebarTab: "selection"
3576
3579
  });
3577
3580
  }
3578
- function qe(e) {
3581
+ function Je(e) {
3579
3582
  let t = D.getState(), n = t.map?.rooms[e.roomId];
3580
3583
  if (!n) return;
3581
3584
  let r = n.area !== t.currentAreaId, i = n.z !== t.currentZ;
@@ -3603,7 +3606,7 @@ function qe(e) {
3603
3606
  sidebarTab: "selection"
3604
3607
  });
3605
3608
  }
3606
- function Je({ sceneRef: e }) {
3609
+ function Ye({ sceneRef: e }) {
3607
3610
  let t = O((e) => e.map);
3608
3611
  if (O((e) => e.structureVersion), O((e) => e.dataVersion), !t) return /* @__PURE__ */ f("div", {
3609
3612
  className: "panel-content",
@@ -3612,7 +3615,7 @@ function Je({ sceneRef: e }) {
3612
3615
  children: "Drag a .dat file in or load from toolbar."
3613
3616
  })]
3614
3617
  });
3615
- let n = Object.keys(t.rooms).length, r = Object.keys(t.areas).length, i = Object.keys(t.mCustomEnvColors).length, a = Ge(e, t);
3618
+ let n = Object.keys(t.rooms).length, r = Object.keys(t.areas).length, i = Object.keys(t.mCustomEnvColors).length, a = Ke(e, t);
3616
3619
  return /* @__PURE__ */ f("div", {
3617
3620
  className: "panel-content",
3618
3621
  children: [
@@ -3663,7 +3666,7 @@ function Je({ sceneRef: e }) {
3663
3666
  ]
3664
3667
  }),
3665
3668
  /* @__PURE__ */ d("h4", { children: "User Data" }),
3666
- /* @__PURE__ */ d(Fe, {
3669
+ /* @__PURE__ */ d(Ie, {
3667
3670
  data: t.mUserData ?? {},
3668
3671
  onCommit: (t, n, r) => {
3669
3672
  Y({
@@ -3702,7 +3705,7 @@ function Je({ sceneRef: e }) {
3702
3705
  /* @__PURE__ */ d("button", {
3703
3706
  type: "button",
3704
3707
  className: "warning-go-btn",
3705
- onClick: () => Ke(e),
3708
+ onClick: () => qe(e),
3706
3709
  children: "Go"
3707
3710
  })
3708
3711
  ]
@@ -3729,7 +3732,7 @@ function Je({ sceneRef: e }) {
3729
3732
  /* @__PURE__ */ d("button", {
3730
3733
  type: "button",
3731
3734
  className: "warning-go-btn",
3732
- onClick: () => qe(e),
3735
+ onClick: () => Je(e),
3733
3736
  children: "Go"
3734
3737
  })
3735
3738
  ]
@@ -3741,7 +3744,7 @@ function Je({ sceneRef: e }) {
3741
3744
  }
3742
3745
  //#endregion
3743
3746
  //#region src/components/panels/ExitPanel.tsx
3744
- function Ye({ selection: e, map: t, sceneRef: n }) {
3747
+ function Xe({ selection: e, map: t, sceneRef: n }) {
3745
3748
  let r = t.rooms[e.fromId], i = t.rooms[e.toId], a = {
3746
3749
  north: "south",
3747
3750
  south: "north",
@@ -3783,7 +3786,7 @@ function Ye({ selection: e, map: t, sceneRef: n }) {
3783
3786
  /* @__PURE__ */ f("div", {
3784
3787
  className: "exit-flow",
3785
3788
  children: [
3786
- /* @__PURE__ */ d(Me, {
3789
+ /* @__PURE__ */ d(Ne, {
3787
3790
  id: e.fromId,
3788
3791
  name: r?.name
3789
3792
  }),
@@ -3818,7 +3821,7 @@ function Ye({ selection: e, map: t, sceneRef: n }) {
3818
3821
  })
3819
3822
  ]
3820
3823
  }),
3821
- /* @__PURE__ */ d(Me, {
3824
+ /* @__PURE__ */ d(Ne, {
3822
3825
  id: e.toId,
3823
3826
  name: i?.name
3824
3827
  })
@@ -3834,10 +3837,10 @@ function Ye({ selection: e, map: t, sceneRef: n }) {
3834
3837
  }
3835
3838
  //#endregion
3836
3839
  //#region src/editor/coords.ts
3837
- function Xe(e, t) {
3840
+ function Ze(e, t) {
3838
3841
  return Math.round(e / t) * t;
3839
3842
  }
3840
- function Ze(e, t, n, r) {
3843
+ function Qe(e, t, n, r) {
3841
3844
  let i = t.getBoundingClientRect(), a = e.backend.viewport.clientToMapPoint(n, r, {
3842
3845
  left: i.left,
3843
3846
  top: i.top
@@ -3851,7 +3854,7 @@ function Ze(e, t, n, r) {
3851
3854
  }
3852
3855
  //#endregion
3853
3856
  //#region src/editor/hitTest.ts
3854
- function Qe(e, t, n, r, i) {
3857
+ function $e(e, t, n, r, i) {
3855
3858
  let a = i.getArea(e);
3856
3859
  if (!a) return null;
3857
3860
  let o = a.getPlane(t);
@@ -3866,7 +3869,7 @@ function Qe(e, t, n, r, i) {
3866
3869
  }
3867
3870
  return c;
3868
3871
  }
3869
- function $e(e, t, n, r, i) {
3872
+ function et(e, t, n, r, i) {
3870
3873
  let a = i.getArea(e);
3871
3874
  if (!a) return [];
3872
3875
  let o = a.getPlane(t);
@@ -3881,7 +3884,7 @@ function $e(e, t, n, r, i) {
3881
3884
  }
3882
3885
  return c;
3883
3886
  }
3884
- function et(e, t, n, r, i, a, o, s) {
3887
+ function tt(e, t, n, r, i, a, o, s) {
3885
3888
  let c = [], l = e.backend.culling?.findRoomAtMapPoint?.(i, a);
3886
3889
  if (l) {
3887
3890
  let e = t.rooms[l.id];
@@ -3890,19 +3893,19 @@ function et(e, t, n, r, i, a, o, s) {
3890
3893
  id: Number(i)
3891
3894
  });
3892
3895
  }
3893
- let u = $e(n, r, i, a, s);
3896
+ let u = et(n, r, i, a, s);
3894
3897
  for (let e = u.length - 1; e >= 0; e--) c.push({
3895
3898
  kind: "label",
3896
3899
  id: u[e].id,
3897
3900
  areaId: u[e].areaId
3898
3901
  });
3899
- let d = ct(e, i, a, o);
3902
+ let d = lt(e, i, a, o);
3900
3903
  d && c.push({
3901
3904
  kind: "customLine",
3902
3905
  roomId: d.roomId,
3903
3906
  exitName: d.exitName
3904
3907
  });
3905
- let f = st(e, i, a, o);
3908
+ let f = ct(e, i, a, o);
3906
3909
  return f && c.push({
3907
3910
  kind: "exit",
3908
3911
  fromId: f.fromId,
@@ -3910,7 +3913,7 @@ function et(e, t, n, r, i, a, o, s) {
3910
3913
  dir: f.dir
3911
3914
  }), c;
3912
3915
  }
3913
- function tt(e, t, n, r) {
3916
+ function nt(e, t, n, r) {
3914
3917
  let i = .05, a = e.x - i, o = e.y - i, s = e.w + i * 2, c = e.h + i * 2, l = Math.max(.15, r), u = [
3915
3918
  [
3916
3919
  a,
@@ -3962,7 +3965,7 @@ function tt(e, t, n, r) {
3962
3965
  }
3963
3966
  return d?.handle ?? null;
3964
3967
  }
3965
- function nt(e, t, n, r, i) {
3968
+ function rt(e, t, n, r, i) {
3966
3969
  let a = e.areas[t];
3967
3970
  if (!a) return null;
3968
3971
  for (let t of a.rooms) {
@@ -3971,22 +3974,22 @@ function nt(e, t, n, r, i) {
3971
3974
  }
3972
3975
  return null;
3973
3976
  }
3974
- function rt(e, t, n, r, i, a) {
3977
+ function it(e, t, n, r, i, a) {
3975
3978
  let o = i - n, s = a - r, c = o * o + s * s;
3976
3979
  if (c < 1e-9) return Math.hypot(e - n, t - r);
3977
3980
  let l = ((e - n) * o + (t - r) * s) / c;
3978
3981
  return l = Math.max(0, Math.min(1, l)), Math.hypot(e - (n + l * o), t - (r + l * s));
3979
3982
  }
3980
- function it(e, t, n) {
3983
+ function at(e, t, n) {
3981
3984
  if (e.length < 4) return Infinity;
3982
3985
  let r = Infinity;
3983
3986
  for (let i = 0; i + 3 < e.length; i += 2) {
3984
- let a = rt(t, n, e[i], e[i + 1], e[i + 2], e[i + 3]);
3987
+ let a = it(t, n, e[i], e[i + 1], e[i + 2], e[i + 3]);
3985
3988
  a < r && (r = a);
3986
3989
  }
3987
3990
  return r;
3988
3991
  }
3989
- var at = [
3992
+ var ot = [
3990
3993
  [
3991
3994
  0,
3992
3995
  -1,
@@ -4028,18 +4031,18 @@ var at = [
4028
4031
  "northwest"
4029
4032
  ]
4030
4033
  ];
4031
- function ot(e, t, n) {
4034
+ function st(e, t, n) {
4032
4035
  let r = e.x - t.x, i = e.y - t.y;
4033
4036
  if (r === 0 && i === 0) return "east";
4034
4037
  let a = (Math.atan2(i, r) * 180 / Math.PI + 360) % 360;
4035
4038
  return a < 22.5 || a >= 337.5 ? "east" : a < 67.5 ? "southeast" : a < 112.5 ? "south" : a < 157.5 ? "southwest" : a < 202.5 ? "west" : a < 247.5 ? "northwest" : a < 292.5 ? "north" : "northeast";
4036
4039
  }
4037
- function st(e, t, n, r) {
4040
+ function ct(e, t, n, r) {
4038
4041
  let i = r * .35, a = e.getDrawnExits(), o = null;
4039
4042
  for (let e of a) {
4040
4043
  let r = Infinity, a = !0;
4041
4044
  for (let i of e.data.lines) {
4042
- let e = it(i.points, t, n);
4045
+ let e = at(i.points, t, n);
4043
4046
  if (e < r) {
4044
4047
  r = e;
4045
4048
  let o = Math.hypot(t - i.points[0], n - i.points[1]), s = i.points.length - 2;
@@ -4047,7 +4050,7 @@ function st(e, t, n, r) {
4047
4050
  }
4048
4051
  }
4049
4052
  for (let i of e.data.arrows) {
4050
- let o = it(i.points, t, n);
4053
+ let o = at(i.points, t, n);
4051
4054
  if (o < r) {
4052
4055
  r = o;
4053
4056
  let s = Math.hypot(t - i.points[0], n - i.points[1]), c = i.points.length - 2, l = Math.hypot(t - i.points[c], n - i.points[c + 1]);
@@ -4081,10 +4084,10 @@ function st(e, t, n, r) {
4081
4084
  dir: o.bDir
4082
4085
  } : null : null;
4083
4086
  }
4084
- function ct(e, t, n, r) {
4087
+ function lt(e, t, n, r) {
4085
4088
  let i = r * .5, a = null;
4086
4089
  for (let r of e.getDrawnSpecialExits()) {
4087
- let e = it(r.points, t, n);
4090
+ let e = at(r.points, t, n);
4088
4091
  e < i && (a === null || e < a.dist) && (a = {
4089
4092
  roomId: r.roomId,
4090
4093
  exitName: r.exitName,
@@ -4096,13 +4099,13 @@ function ct(e, t, n, r) {
4096
4099
  exitName: a.exitName
4097
4100
  } : null;
4098
4101
  }
4099
- function lt(e, t, n, r, i, a) {
4102
+ function ut(e, t, n, r, i, a) {
4100
4103
  let o = a * .5;
4101
4104
  for (let a of e.getDrawnSpecialExits()) {
4102
4105
  if (a.roomId !== t || a.exitName !== n) continue;
4103
4106
  let e = null;
4104
4107
  for (let t = 0; t + 3 < a.points.length; t += 2) {
4105
- let n = rt(r, i, a.points[t], a.points[t + 1], a.points[t + 2], a.points[t + 3]);
4108
+ let n = it(r, i, a.points[t], a.points[t + 1], a.points[t + 2], a.points[t + 3]);
4106
4109
  n < o && (e === null || n < e.dist) && (e = {
4107
4110
  segIdx: t / 2,
4108
4111
  dist: n
@@ -4112,7 +4115,7 @@ function lt(e, t, n, r, i, a) {
4112
4115
  }
4113
4116
  return null;
4114
4117
  }
4115
- function ut(e, t, n, r, i, a) {
4118
+ function dt(e, t, n, r, i, a) {
4116
4119
  let o = a * .45;
4117
4120
  for (let a of e.getDrawnSpecialExits()) {
4118
4121
  if (a.roomId !== t || a.exitName !== n) continue;
@@ -4130,21 +4133,21 @@ function ut(e, t, n, r, i, a) {
4130
4133
  }
4131
4134
  //#endregion
4132
4135
  //#region src/editor/tools.ts
4133
- var dt = null;
4134
- function ft(e) {
4135
- dt = e;
4136
+ var ft = null;
4137
+ function pt(e) {
4138
+ ft = e;
4136
4139
  }
4137
4140
  function Z(e, t) {
4138
- return Ze(e.renderer, e.container, t.clientX, t.clientY);
4141
+ return Qe(e.renderer, e.container, t.clientX, t.clientY);
4139
4142
  }
4140
- function pt(e, t) {
4143
+ function mt(e, t) {
4141
4144
  let n = Z(e, t), r = D.getState();
4142
4145
  return r.snapToGrid ? {
4143
- x: Xe(n.x, r.gridStep),
4144
- y: Xe(n.y, r.gridStep)
4146
+ x: Ze(n.x, r.gridStep),
4147
+ y: Ze(n.y, r.gridStep)
4145
4148
  } : n;
4146
4149
  }
4147
- function mt() {
4150
+ function ht() {
4148
4151
  let e = D.getState();
4149
4152
  return !e.map || e.currentAreaId == null ? null : {
4150
4153
  map: e.map,
@@ -4154,7 +4157,7 @@ function mt() {
4154
4157
  };
4155
4158
  }
4156
4159
  function Q(e, t) {
4157
- if (!mt()) return null;
4160
+ if (!ht()) return null;
4158
4161
  let n = e.container.getBoundingClientRect(), r = e.renderer.backend.viewport.clientToMapPoint(t.clientX, t.clientY, {
4159
4162
  left: n.left,
4160
4163
  top: n.top
@@ -4163,7 +4166,7 @@ function Q(e, t) {
4163
4166
  let i = e.renderer.backend.culling?.findRoomAtMapPoint?.(r.x, r.y);
4164
4167
  return i ? e.scene.getRenderRoom(i.id) ?? null : null;
4165
4168
  }
4166
- var ht = .15, gt = {
4169
+ var gt = .15, _t = {
4167
4170
  id: "select",
4168
4171
  cursor: "default",
4169
4172
  onPointerDown(e, t) {
@@ -4196,7 +4199,7 @@ var ht = .15, gt = {
4196
4199
  }
4197
4200
  if (n.pending?.kind === "pickSpecialExit") {
4198
4201
  let r = Q(t, e), i = n.pending.fromId;
4199
- return r && dt && dt(r.id), D.setState({
4202
+ return r && ft && ft(r.id), D.setState({
4200
4203
  pending: null,
4201
4204
  selection: {
4202
4205
  kind: "room",
@@ -4215,9 +4218,9 @@ var ht = .15, gt = {
4215
4218
  }
4216
4219
  return D.setState({ pending: null }), !0;
4217
4220
  }
4218
- let r = Z(t, e), i = mt();
4221
+ let r = Z(t, e), i = ht();
4219
4222
  if (e.altKey) {
4220
- let e = i ? et(t.renderer, i.map, i.areaId, i.z, r.x, r.y, t.settings.roomSize, t.scene.reader) : [];
4223
+ let e = i ? tt(t.renderer, i.map, i.areaId, i.z, r.x, r.y, t.settings.roomSize, t.scene.reader) : [];
4221
4224
  if (e.length > 0) {
4222
4225
  let t = Math.round(r.x), i = Math.round(r.y), a = n.hitCycle, o = a && a.x === t && a.y === i ? (a.index + 1) % e.length : 0, s = e[o];
4223
4226
  D.setState({
@@ -4226,15 +4229,15 @@ var ht = .15, gt = {
4226
4229
  y: i,
4227
4230
  index: o
4228
4231
  },
4229
- selection: It(s),
4232
+ selection: Lt(s),
4230
4233
  sidebarTab: "selection",
4231
- status: `Selected ${Lt(s)} (${o + 1}/${e.length})`
4234
+ status: `Selected ${Rt(s)} (${o + 1}/${e.length})`
4232
4235
  });
4233
4236
  }
4234
4237
  return !0;
4235
4238
  }
4236
4239
  if (D.setState({ hitCycle: null }), n.selection?.kind === "customLine" && i) {
4237
- let i = ut(t.renderer, n.selection.roomId, n.selection.exitName, r.x, r.y, t.settings.roomSize);
4240
+ let i = dt(t.renderer, n.selection.roomId, n.selection.exitName, r.x, r.y, t.settings.roomSize);
4238
4241
  if (i !== null) {
4239
4242
  let r = n.map?.rooms[n.selection.roomId], a = r?.customLines?.[n.selection.exitName] ? [...r.customLines[n.selection.exitName]] : [];
4240
4243
  return D.setState({
@@ -4269,7 +4272,7 @@ var ht = .15, gt = {
4269
4272
  }), c = t.renderer.backend.viewport.clientToMapPoint(8, 0, {
4270
4273
  left: o.left,
4271
4274
  top: o.top
4272
- }), l = s && c ? Math.abs(c.x - s.x) : .25, u = tt(n, r.x, r.y, l);
4275
+ }), l = s && c ? Math.abs(c.x - s.x) : .25, u = nt(n, r.x, r.y, l);
4273
4276
  if (u) return D.setState({ pending: {
4274
4277
  kind: "labelResize",
4275
4278
  labelId: i.id,
@@ -4280,7 +4283,7 @@ var ht = .15, gt = {
4280
4283
  } }), t.container.setPointerCapture(e.pointerId), !0;
4281
4284
  }
4282
4285
  }
4283
- let a = Qe(i.areaId, i.z, r.x, r.y, t.scene.reader);
4286
+ let a = $e(i.areaId, i.z, r.x, r.y, t.scene.reader);
4284
4287
  if (a) {
4285
4288
  let n = t.scene.reader.getLabelSnapshot(a.areaId, a.id), i = n ? n.pos[0] : 0, o = n ? -n.pos[1] : 0;
4286
4289
  return D.setState({
@@ -4365,13 +4368,13 @@ var ht = .15, gt = {
4365
4368
  }), t.container.setPointerCapture(e.pointerId), !0;
4366
4369
  }
4367
4370
  if (i) {
4368
- let e = ct(t.renderer, r.x, r.y, t.settings.roomSize);
4371
+ let e = lt(t.renderer, r.x, r.y, t.settings.roomSize);
4369
4372
  if (e) return D.setState({ selection: {
4370
4373
  kind: "customLine",
4371
4374
  roomId: e.roomId,
4372
4375
  exitName: e.exitName
4373
4376
  } }), !0;
4374
- let n = st(t.renderer, r.x, r.y, t.settings.roomSize);
4377
+ let n = ct(t.renderer, r.x, r.y, t.settings.roomSize);
4375
4378
  if (n) return D.setState({ selection: {
4376
4379
  kind: "exit",
4377
4380
  fromId: n.fromId,
@@ -4393,7 +4396,7 @@ var ht = .15, gt = {
4393
4396
  onPointerMove(e, t) {
4394
4397
  let n = D.getState();
4395
4398
  if (n.pending?.kind === "customLinePoint") {
4396
- let r = pt(t, e);
4399
+ let r = mt(t, e);
4397
4400
  return t.scene.reader.setCustomLinePoint(n.pending.roomId, n.pending.exitName, n.pending.pointIndex, r.x, r.y), t.refresh(), D.bumpData(), !0;
4398
4401
  }
4399
4402
  if (n.pending?.kind === "marquee") {
@@ -4401,7 +4404,7 @@ var ht = .15, gt = {
4401
4404
  ...n.pending,
4402
4405
  currentX: r.x,
4403
4406
  currentY: r.y
4404
- }, a = _t(Math.min(i.startX, r.x), Math.max(i.startX, r.x), Math.min(i.startY, r.y), Math.max(i.startY, r.y)), o;
4407
+ }, a = vt(Math.min(i.startX, r.x), Math.max(i.startX, r.x), Math.min(i.startY, r.y), Math.max(i.startY, r.y)), o;
4405
4408
  if (i.ctrlHeld) {
4406
4409
  let e = new Set(i.preExistingIds);
4407
4410
  for (let t of a) e.has(t) ? e.delete(t) : e.add(t);
@@ -4420,24 +4423,24 @@ var ht = .15, gt = {
4420
4423
  x: r.x - n.pending.offsetX,
4421
4424
  y: r.y - n.pending.offsetY
4422
4425
  }, a = n.snapToGrid ? {
4423
- x: Xe(i.x, n.gridStep),
4424
- y: Xe(i.y, n.gridStep)
4426
+ x: Ze(i.x, n.gridStep),
4427
+ y: Ze(i.y, n.gridStep)
4425
4428
  } : i, o = t.scene.reader.getLabelSnapshot(n.pending.areaId, n.pending.labelId), s = o ? a.x - o.pos[0] : 1, c = o ? a.y - -o.pos[1] : 1;
4426
4429
  return (s !== 0 || c !== 0) && (t.scene.reader.moveLabel(n.pending.areaId, n.pending.labelId, a.x, a.y), t.refresh(), D.bumpData()), !0;
4427
4430
  }
4428
4431
  if (n.pending?.kind === "labelResize") {
4429
- let r = Z(t, e), i = n.pending, a = n.labelAspectRatioLocked && i.originSize[1] > 0 ? i.originSize[0] / i.originSize[1] : void 0, o = At(i.handle, i.originPos[0], -i.originPos[1], i.originSize[0], i.originSize[1], r.x, r.y, a), s = t.scene.reader.getLabelSnapshot(i.areaId, i.labelId);
4432
+ let r = Z(t, e), i = n.pending, a = n.labelAspectRatioLocked && i.originSize[1] > 0 ? i.originSize[0] / i.originSize[1] : void 0, o = jt(i.handle, i.originPos[0], -i.originPos[1], i.originSize[0], i.originSize[1], r.x, r.y, a), s = t.scene.reader.getLabelSnapshot(i.areaId, i.labelId);
4430
4433
  return (!s || o.x !== s.pos[0] || o.y !== -s.pos[1] || o.w !== s.size[0] || o.h !== s.size[1]) && (t.scene.reader.moveLabel(i.areaId, i.labelId, o.x, o.y), t.scene.reader.setLabelSize(i.areaId, i.labelId, o.w, o.h), t.scene.refresh()), !0;
4431
4434
  }
4432
- if (n.pending?.kind !== "drag") return Rt(t, e), !1;
4435
+ if (n.pending?.kind !== "drag") return zt(t, e), !1;
4433
4436
  let r = t.scene.getRenderRoom(n.pending.roomId);
4434
4437
  if (!r) return !0;
4435
4438
  let i = Z(t, e), a = {
4436
4439
  x: i.x - n.pending.offsetX,
4437
4440
  y: i.y - n.pending.offsetY
4438
4441
  }, o = n.snapToGrid ? {
4439
- x: Xe(a.x, n.gridStep),
4440
- y: Xe(a.y, n.gridStep)
4442
+ x: Ze(a.x, n.gridStep),
4443
+ y: Ze(a.y, n.gridStep)
4441
4444
  } : a, s = o.x - r.x, c = o.y - r.y;
4442
4445
  if (s !== 0 || c !== 0) {
4443
4446
  if (t.scene.reader.moveRoom(n.pending.roomId, o.x, o.y, r.z), n.pending.multiOrigins) for (let { id: e } of n.pending.multiOrigins) {
@@ -4461,29 +4464,29 @@ var ht = .15, gt = {
4461
4464
  t.container.releasePointerCapture(e.pointerId);
4462
4465
  } catch {}
4463
4466
  if (n.pending?.kind === "customLinePoint" && n.map) {
4464
- let e = n.pending, t = n.map.rooms[e.roomId], r = t?.customLines?.[e.exitName] ?? [], i = t?.customLinesColor?.[e.exitName] ?? {
4467
+ let e = n.pending, t = n.map.rooms[e.roomId], r = t?.customLines?.[e.exitName], i = r ? [...r] : [], a = t?.customLinesColor?.[e.exitName] ?? {
4465
4468
  spec: 1,
4466
4469
  alpha: 255,
4467
4470
  r: 255,
4468
4471
  g: 255,
4469
4472
  b: 255
4470
- }, a = t?.customLinesStyle?.[e.exitName] ?? 1, o = t?.customLinesArrow?.[e.exitName] ?? !1;
4471
- return r.length !== e.originPoints.length || r.some((t, n) => t[0] !== e.originPoints[n][0] || t[1] !== e.originPoints[n][1]) ? D.setState((t) => ({
4473
+ }, o = t?.customLinesStyle?.[e.exitName] ?? 1, s = t?.customLinesArrow?.[e.exitName] ?? !1;
4474
+ return i.length !== e.originPoints.length || i.some((t, n) => t[0] !== e.originPoints[n][0] || t[1] !== e.originPoints[n][1]) ? D.setState((t) => ({
4472
4475
  undo: [...t.undo, {
4473
4476
  kind: "setCustomLine",
4474
4477
  roomId: e.roomId,
4475
4478
  exitName: e.exitName,
4476
4479
  data: {
4477
- points: r,
4478
- color: i,
4479
- style: a,
4480
- arrow: o
4480
+ points: i,
4481
+ color: a,
4482
+ style: o,
4483
+ arrow: s
4481
4484
  },
4482
4485
  previous: {
4483
4486
  points: e.originPoints,
4484
- color: i,
4485
- style: a,
4486
- arrow: o
4487
+ color: a,
4488
+ style: o,
4489
+ arrow: s
4487
4490
  }
4488
4491
  }],
4489
4492
  redo: [],
@@ -4495,7 +4498,7 @@ var ht = .15, gt = {
4495
4498
  t.container.releasePointerCapture(e.pointerId);
4496
4499
  } catch {}
4497
4500
  let r = n.pending, i = Math.abs(r.currentX - r.startX), a = Math.abs(r.currentY - r.startY);
4498
- return i <= ht && a <= ht && !r.ctrlHeld && D.setState({ selection: null }), D.setState({ pending: null }), !0;
4501
+ return i <= gt && a <= gt && !r.ctrlHeld && D.setState({ selection: null }), D.setState({ pending: null }), !0;
4499
4502
  }
4500
4503
  if (n.pending?.kind === "labelDrag" && n.map) {
4501
4504
  let e = n.pending, r = t.scene.reader.getLabelSnapshot(e.areaId, e.labelId);
@@ -4597,9 +4600,9 @@ var ht = .15, gt = {
4597
4600
  onContextMenu(e, t) {
4598
4601
  let n = D.getState();
4599
4602
  if (!n.map) return !1;
4600
- let r = Z(t, e), i = mt();
4603
+ let r = Z(t, e), i = ht();
4601
4604
  if (i) {
4602
- let n = et(t.renderer, i.map, i.areaId, i.z, r.x, r.y, t.settings.roomSize, t.scene.reader).filter((e) => e.kind !== "exit" && e.kind !== "customLine");
4605
+ let n = tt(t.renderer, i.map, i.areaId, i.z, r.x, r.y, t.settings.roomSize, t.scene.reader).filter((e) => e.kind !== "exit" && e.kind !== "customLine");
4603
4606
  if (n.length > 1) return D.setState({ contextMenu: {
4604
4607
  kind: "disambiguate",
4605
4608
  hits: n,
@@ -4615,7 +4618,7 @@ var ht = .15, gt = {
4615
4618
  screenY: e.clientY
4616
4619
  } }), !0;
4617
4620
  if (i) {
4618
- let n = Qe(i.areaId, i.z, r.x, r.y, t.scene.reader);
4621
+ let n = $e(i.areaId, i.z, r.x, r.y, t.scene.reader);
4619
4622
  if (n) return D.setState({
4620
4623
  selection: {
4621
4624
  kind: "label",
@@ -4635,7 +4638,7 @@ var ht = .15, gt = {
4635
4638
  if (n.selection?.kind !== "customLine") return !1;
4636
4639
  let o = n.selection, s = n.map.rooms[o.roomId], c = s?.customLines?.[o.exitName];
4637
4640
  if (!s || !c) return !1;
4638
- let l = ut(t.renderer, o.roomId, o.exitName, r.x, r.y, t.settings.roomSize);
4641
+ let l = dt(t.renderer, o.roomId, o.exitName, r.x, r.y, t.settings.roomSize);
4639
4642
  if (l !== null) return D.setState({
4640
4643
  selection: {
4641
4644
  kind: "customLine",
@@ -4652,10 +4655,10 @@ var ht = .15, gt = {
4652
4655
  screenY: e.clientY
4653
4656
  }
4654
4657
  }), !0;
4655
- let u = lt(t.renderer, o.roomId, o.exitName, r.x, r.y, t.settings.roomSize);
4658
+ let u = ut(t.renderer, o.roomId, o.exitName, r.x, r.y, t.settings.roomSize);
4656
4659
  if (u !== null) {
4657
- let n = pt(t, e);
4658
- return vt(t, o.roomId, o.exitName, u.insertIndex, n.x, n.y), !0;
4660
+ let n = mt(t, e);
4661
+ return yt(t, o.roomId, o.exitName, u.insertIndex, n.x, n.y), !0;
4659
4662
  }
4660
4663
  return !1;
4661
4664
  },
@@ -4682,7 +4685,7 @@ var ht = .15, gt = {
4682
4685
  D.setState({ pending: null });
4683
4686
  }
4684
4687
  };
4685
- function _t(e, t, n, r) {
4688
+ function vt(e, t, n, r) {
4686
4689
  let i = D.getState();
4687
4690
  if (!i.map || i.currentAreaId == null) return [];
4688
4691
  let a = [];
@@ -4693,7 +4696,7 @@ function _t(e, t, n, r) {
4693
4696
  }
4694
4697
  return a;
4695
4698
  }
4696
- function vt(e, t, n, r, i, a) {
4699
+ function yt(e, t, n, r, i, a) {
4697
4700
  let o = D.getState();
4698
4701
  if (!o.map) return;
4699
4702
  let s = o.map.rooms[t], c = s?.customLines?.[n];
@@ -4733,7 +4736,7 @@ function vt(e, t, n, r, i, a) {
4733
4736
  status: `Added waypoint to '${n}' on room ${t}`
4734
4737
  });
4735
4738
  }
4736
- var yt = {
4739
+ var bt = {
4737
4740
  id: "connect",
4738
4741
  cursor: "crosshair",
4739
4742
  onPointerDown(e, t) {
@@ -4743,7 +4746,7 @@ var yt = {
4743
4746
  pending: null,
4744
4747
  status: "Connect cancelled."
4745
4748
  }), !0;
4746
- let r = Z(t, e), i = ot(r, {
4749
+ let r = Z(t, e), i = st(r, {
4747
4750
  x: n.x,
4748
4751
  y: n.y
4749
4752
  }, t.settings.roomSize);
@@ -4771,7 +4774,7 @@ var yt = {
4771
4774
  let n = D.getState(), r = Z(t, e), i = Q(t, e), a = i ? i.id : null;
4772
4775
  if (n.pending?.kind === "connect") {
4773
4776
  let e = null;
4774
- return i && i.id !== n.pending.sourceId && (e = ot(r, {
4777
+ return i && i.id !== n.pending.sourceId && (e = st(r, {
4775
4778
  x: i.x,
4776
4779
  y: i.y
4777
4780
  }, t.settings.roomSize)), D.setState({ pending: {
@@ -4781,7 +4784,7 @@ var yt = {
4781
4784
  targetDir: e
4782
4785
  } }), !0;
4783
4786
  }
4784
- return Rt(t, e), !1;
4787
+ return zt(t, e), !1;
4785
4788
  },
4786
4789
  onPointerUp(e, t) {
4787
4790
  let n = D.getState();
@@ -4790,20 +4793,20 @@ var yt = {
4790
4793
  try {
4791
4794
  t.container.releasePointerCapture(e.pointerId);
4792
4795
  } catch {}
4793
- return r.hoverTargetId != null && r.hoverTargetId !== r.sourceId ? bt(t, r.sourceId, r.hoverTargetId, r.sourceDir, r.targetDir, e.shiftKey) : D.setState({ status: "Connect cancelled." }), D.setState({ pending: null }), !0;
4796
+ return r.hoverTargetId != null && r.hoverTargetId !== r.sourceId ? xt(t, r.sourceId, r.hoverTargetId, r.sourceDir, r.targetDir, e.shiftKey) : D.setState({ status: "Connect cancelled." }), D.setState({ pending: null }), !0;
4794
4797
  },
4795
4798
  onCancel() {
4796
4799
  D.setState({ pending: null });
4797
4800
  }
4798
4801
  };
4799
- function bt(e, t, n, r, i, a) {
4802
+ function xt(e, t, n, r, i, a) {
4800
4803
  let o = e.scene.getRenderRoom(t), s = e.scene.getRenderRoom(n);
4801
4804
  if (!o || !s) return;
4802
- let c = r ?? xe(o.x, o.y, s.x, s.y);
4803
- if (!Ce(c)) return;
4805
+ let c = r ?? Se(o.x, o.y, s.x, s.y);
4806
+ if (!we(c)) return;
4804
4807
  let l = D.getState().map?.rooms[t], u = D.getState().map?.rooms[n];
4805
4808
  if (!l || !u) return;
4806
- let d = J(l, c), f = i ?? he[c], p = Ce(f), m = p ? J(u, f) : -1, h = a || !p ? null : m === -1 || m === t ? {
4809
+ let d = J(l, c), f = i ?? me[c], p = we(f), m = p ? J(u, f) : -1, h = a || !p ? null : m === -1 || m === t ? {
4807
4810
  fromId: n,
4808
4811
  dir: f,
4809
4812
  previous: m
@@ -4819,16 +4822,16 @@ function bt(e, t, n, r, i, a) {
4819
4822
  let g = h ? `Connected ${t}.${c} ↔ ${n}.${f}` : `Connected ${t}.${c} → ${n}`;
4820
4823
  D.setState({ status: g });
4821
4824
  }
4822
- var xt = {
4825
+ var St = {
4823
4826
  id: "unlink",
4824
4827
  cursor: "crosshair",
4825
4828
  onPointerDown(e, t) {
4826
4829
  if (e.button !== 0) return !1;
4827
- let n = mt();
4830
+ let n = ht();
4828
4831
  if (!n) return !1;
4829
4832
  let r = Z(t, e), i = Q(t, e), a = t.settings.roomSize / 2;
4830
4833
  if (!(i && Math.abs(r.x - i.x) <= a && Math.abs(r.y - i.y) <= a)) {
4831
- let e = ct(t.renderer, r.x, r.y, t.settings.roomSize);
4834
+ let e = lt(t.renderer, r.x, r.y, t.settings.roomSize);
4832
4835
  if (e) {
4833
4836
  let r = n.map.rooms[e.roomId], i = r?.customLines?.[e.exitName] ?? [], a = r?.customLinesColor?.[e.exitName] ?? {
4834
4837
  spec: 1,
@@ -4851,10 +4854,10 @@ var xt = {
4851
4854
  let c = D.getState();
4852
4855
  return c.selection?.kind === "customLine" && c.selection.roomId === e.roomId && c.selection.exitName === e.exitName && D.setState({ selection: null }), D.setState({ status: `Removed custom line '${e.exitName}' from room ${e.roomId}` }), !0;
4853
4856
  }
4854
- let i = st(t.renderer, r.x, r.y, t.settings.roomSize);
4857
+ let i = ct(t.renderer, r.x, r.y, t.settings.roomSize);
4855
4858
  if (i) {
4856
4859
  if (!n.map.rooms[i.fromId]) return !0;
4857
- let e = he[i.dir], r = n.map.rooms[i.toId], a = r && Ce(e) && J(r, e) === i.fromId ? {
4860
+ let e = me[i.dir], r = n.map.rooms[i.toId], a = r && we(e) && J(r, e) === i.fromId ? {
4858
4861
  fromId: i.toId,
4859
4862
  dir: e,
4860
4863
  was: i.fromId
@@ -4874,10 +4877,10 @@ var xt = {
4874
4877
  let o = n.map.rooms[i.id];
4875
4878
  if (!o) return !0;
4876
4879
  let s = [];
4877
- for (let e of me) {
4880
+ for (let e of pe) {
4878
4881
  let t = J(o, e);
4879
4882
  if (t === -1) continue;
4880
- let r = n.map.rooms[t], a = he[e], c = r && J(r, a) === i.id ? {
4883
+ let r = n.map.rooms[t], a = me[e], c = r && J(r, a) === i.id ? {
4881
4884
  fromId: t,
4882
4885
  dir: a,
4883
4886
  was: i.id
@@ -4900,22 +4903,22 @@ var xt = {
4900
4903
  }, t.scene), t.refresh(), D.bumpData(), D.setState({ status: `Removed all exits from room ${i.id}` }), !0);
4901
4904
  },
4902
4905
  onPointerMove(e, t) {
4903
- Rt(t, e);
4906
+ zt(t, e);
4904
4907
  }
4905
- }, St = {
4908
+ }, Ct = {
4906
4909
  id: "addRoom",
4907
4910
  cursor: "crosshair",
4908
4911
  onPointerDown(e, t) {
4909
4912
  if (e.button !== 0) return !1;
4910
- let n = mt();
4913
+ let n = ht();
4911
4914
  if (!n) return !1;
4912
- let { x: r, y: i } = pt(t, e), a = r, o = -i;
4913
- if (nt(n.map, n.areaId, a, o, n.z)) return D.setState({ status: "Cell is already occupied." }), !0;
4914
- let s = ye(n.map);
4915
+ let { x: r, y: i } = mt(t, e), a = r, o = -i;
4916
+ if (rt(n.map, n.areaId, a, o, n.z)) return D.setState({ status: "Cell is already occupied." }), !0;
4917
+ let s = be(n.map);
4915
4918
  return Y({
4916
4919
  kind: "addRoom",
4917
4920
  id: s,
4918
- room: be(s, n.areaId, a, o, n.z),
4921
+ room: xe(s, n.areaId, a, o, n.z),
4919
4922
  areaId: n.areaId
4920
4923
  }, t.scene), t.refresh(), D.bumpStructure(), e.ctrlKey || e.metaKey ? D.setState({ status: `Added room ${s} at (${a}, ${o}, ${n.z})` }) : D.setState({
4921
4924
  activeTool: "select",
@@ -4927,17 +4930,17 @@ var xt = {
4927
4930
  }), !0;
4928
4931
  },
4929
4932
  onPointerMove(e, t) {
4930
- let n = pt(t, e);
4931
- D.setState({ snapCursor: n }), Rt(t, e);
4933
+ let n = mt(t, e);
4934
+ D.setState({ snapCursor: n }), zt(t, e);
4932
4935
  }
4933
- }, Ct = {
4936
+ }, wt = {
4934
4937
  id: "delete",
4935
4938
  cursor: "not-allowed",
4936
4939
  onPointerDown(e, t) {
4937
4940
  if (e.button !== 0) return !1;
4938
- let n = mt();
4941
+ let n = ht();
4939
4942
  if (!n) return !1;
4940
- let r = Z(t, e), i = Qe(n.areaId, n.z, r.x, r.y, t.scene.reader);
4943
+ let r = Z(t, e), i = $e(n.areaId, n.z, r.x, r.y, t.scene.reader);
4941
4944
  if (i) {
4942
4945
  let e = t.scene.reader.getLabelSnapshot(i.areaId, i.id);
4943
4946
  if (e) {
@@ -4953,7 +4956,7 @@ var xt = {
4953
4956
  }
4954
4957
  let a = Q(t, e), o = t.settings.roomSize / 2;
4955
4958
  if (!(a && Math.abs(r.x - a.x) <= o && Math.abs(r.y - a.y) <= o)) {
4956
- let e = ct(t.renderer, r.x, r.y, t.settings.roomSize);
4959
+ let e = lt(t.renderer, r.x, r.y, t.settings.roomSize);
4957
4960
  if (e) {
4958
4961
  let r = n.map.rooms[e.roomId], i = r?.customLines?.[e.exitName] ?? [], a = r?.customLinesColor?.[e.exitName] ?? {
4959
4962
  spec: 1,
@@ -4976,10 +4979,10 @@ var xt = {
4976
4979
  let c = D.getState();
4977
4980
  return c.selection?.kind === "customLine" && c.selection.roomId === e.roomId && c.selection.exitName === e.exitName && D.setState({ selection: null }), D.setState({ status: `Removed custom line '${e.exitName}' from room ${e.roomId}` }), !0;
4978
4981
  }
4979
- let i = st(t.renderer, r.x, r.y, t.settings.roomSize);
4982
+ let i = ct(t.renderer, r.x, r.y, t.settings.roomSize);
4980
4983
  if (i) {
4981
4984
  if (!n.map.rooms[i.fromId]) return !0;
4982
- let e = he[i.dir], r = n.map.rooms[i.toId], a = r && Ce(e) && J(r, e) === i.fromId ? {
4985
+ let e = me[i.dir], r = n.map.rooms[i.toId], a = r && we(e) && J(r, e) === i.fromId ? {
4983
4986
  fromId: i.toId,
4984
4987
  dir: e,
4985
4988
  was: i.fromId
@@ -4998,7 +5001,7 @@ var xt = {
4998
5001
  if (!a) return D.setState({ status: "No exit, custom line, or room under cursor." }), !0;
4999
5002
  let s = n.map.rooms[a.id];
5000
5003
  if (!s) return !0;
5001
- let c = { ...s }, l = Ae(n.map, a.id);
5004
+ let c = { ...s }, l = je(n.map, a.id);
5002
5005
  Y({
5003
5006
  kind: "deleteRoom",
5004
5007
  id: a.id,
@@ -5010,37 +5013,37 @@ var xt = {
5010
5013
  return u.selection?.kind === "room" && u.selection.ids.includes(a.id) && D.setState({ selection: null }), D.setState({ status: `Deleted room ${a.id}` }), !0;
5011
5014
  },
5012
5015
  onPointerMove(e, t) {
5013
- Rt(t, e);
5016
+ zt(t, e);
5014
5017
  }
5015
- }, wt = !1, Tt = {
5018
+ }, Tt = !1, Et = {
5016
5019
  id: "pan",
5017
5020
  cursor: "grab",
5018
5021
  onPointerDown(e, t) {
5019
- return e.button !== 0 || e.pointerType !== "mouse" ? !1 : (t.renderer.backend.viewport.startDrag(e.clientX, e.clientY), wt = !0, !0);
5022
+ return e.button !== 0 || e.pointerType !== "mouse" ? !1 : (t.renderer.backend.viewport.startDrag(e.clientX, e.clientY), Tt = !0, !0);
5020
5023
  },
5021
5024
  onPointerMove(e, t) {
5022
5025
  if (e.pointerType === "mouse") {
5023
- if (!wt) {
5026
+ if (!Tt) {
5024
5027
  if (e.buttons === 0) return;
5025
- t.renderer.backend.viewport.startDrag(e.clientX, e.clientY), wt = !0;
5028
+ t.renderer.backend.viewport.startDrag(e.clientX, e.clientY), Tt = !0;
5026
5029
  }
5027
5030
  return t.renderer.backend.viewport.updateDrag(e.clientX, e.clientY), t.refresh(), !0;
5028
5031
  }
5029
5032
  },
5030
5033
  onPointerUp(e, t) {
5031
- return wt ? (t.renderer.backend.viewport.endDrag(), wt = !1, !0) : !1;
5034
+ return Tt ? (t.renderer.backend.viewport.endDrag(), Tt = !1, !0) : !1;
5032
5035
  },
5033
5036
  onCancel(e) {
5034
- wt &&= (e.renderer.backend.viewport.endDrag(), !1);
5037
+ Tt &&= (e.renderer.backend.viewport.endDrag(), !1);
5035
5038
  }
5036
- }, Et = {
5039
+ }, Dt = {
5037
5040
  id: "customLine",
5038
5041
  cursor: "crosshair",
5039
5042
  onPointerDown(e, t) {
5040
5043
  let n = D.getState();
5041
5044
  if (!n.pending || n.pending.kind !== "customLine" || e.button !== 0) return !1;
5042
- let r = pt(t, e), i = [...n.pending.points, [r.x, r.y]];
5043
- return Dt(n.pending, i, t), D.setState({ pending: {
5045
+ let r = mt(t, e), i = [...n.pending.points, [r.x, r.y]];
5046
+ return Ot(n.pending, i, t), D.setState({ pending: {
5044
5047
  ...n.pending,
5045
5048
  points: i,
5046
5049
  cursor: r
@@ -5048,31 +5051,31 @@ var xt = {
5048
5051
  },
5049
5052
  onContextMenu(e, t) {
5050
5053
  let n = D.getState();
5051
- return n.pending?.kind === "customLine" ? (kt(n.pending, t), !0) : !1;
5054
+ return n.pending?.kind === "customLine" ? (At(n.pending, t), !0) : !1;
5052
5055
  },
5053
5056
  onPointerMove(e, t) {
5054
- let n = D.getState(), r = pt(t, e);
5057
+ let n = D.getState(), r = mt(t, e);
5055
5058
  return n.pending?.kind === "customLine" ? (D.setState({ pending: {
5056
5059
  ...n.pending,
5057
5060
  cursor: r
5058
- } }), !0) : (Rt(t, e), !1);
5061
+ } }), !0) : (zt(t, e), !1);
5059
5062
  },
5060
5063
  onPointerUp() {
5061
5064
  return !1;
5062
5065
  },
5063
5066
  onCancel(e) {
5064
5067
  let t = D.getState();
5065
- t.pending?.kind === "customLine" && e && Ot(t.pending, e.scene), D.setState({
5068
+ t.pending?.kind === "customLine" && e && kt(t.pending, e.scene), D.setState({
5066
5069
  pending: null,
5067
5070
  status: "Custom line cancelled."
5068
5071
  }), D.bumpData();
5069
5072
  }
5070
5073
  };
5071
- function Dt(e, t, n) {
5074
+ function Ot(e, t, n) {
5072
5075
  let r = t.slice(1).map(([e, t]) => [e, -t]);
5073
5076
  n.scene.reader.setCustomLine(e.roomId, e.exitName, r, e.color, e.style, e.arrow), n.refresh();
5074
5077
  }
5075
- function Ot(e, t) {
5078
+ function kt(e, t) {
5076
5079
  if (e.previousSnapshot) {
5077
5080
  let n = e.previousSnapshot;
5078
5081
  t.reader.setCustomLine(e.roomId, e.exitName, n.points, n.color, n.style, n.arrow);
@@ -5086,10 +5089,10 @@ function Ot(e, t) {
5086
5089
  }
5087
5090
  t.refresh();
5088
5091
  }
5089
- function kt(e, t) {
5092
+ function At(e, t) {
5090
5093
  if (!D.getState().map) return;
5091
5094
  if (e.points.length < 2) {
5092
- t && Ot(e, t.scene), D.setState({
5095
+ t && kt(e, t.scene), D.setState({
5093
5096
  pending: null,
5094
5097
  activeTool: "select",
5095
5098
  status: "Need at least 1 waypoint — cancelled."
@@ -5128,7 +5131,7 @@ function kt(e, t) {
5128
5131
  status: `Custom line '${e.exitName}' saved on room ${e.roomId}`
5129
5132
  });
5130
5133
  }
5131
- function At(e, t, n, r, i, a, o, s) {
5134
+ function jt(e, t, n, r, i, a, o, s) {
5132
5135
  let c = t, l = t + r, u = n, d = n + i;
5133
5136
  switch (e) {
5134
5137
  case "nw":
@@ -5189,19 +5192,19 @@ function At(e, t, n, r, i, a, o, s) {
5189
5192
  h
5190
5193
  };
5191
5194
  }
5192
- function jt(e) {
5195
+ function Mt(e) {
5193
5196
  let t = 0;
5194
5197
  for (let n of Object.values(e.labels ?? {})) for (let e of n) e.id > t && (t = e.id);
5195
5198
  return t + 1;
5196
5199
  }
5197
- var Mt = {
5200
+ var Nt = {
5198
5201
  id: "addLabel",
5199
5202
  cursor: "crosshair",
5200
5203
  onPointerDown(e, t) {
5201
5204
  if (e.button !== 0) return !1;
5202
- let n = mt();
5205
+ let n = ht();
5203
5206
  if (!n) return !1;
5204
- let r = pt(t, e);
5207
+ let r = mt(t, e);
5205
5208
  return D.setState({ pending: {
5206
5209
  kind: "labelRect",
5207
5210
  areaId: n.areaId,
@@ -5222,8 +5225,8 @@ var Mt = {
5222
5225
  currentY: r.y
5223
5226
  } }), !0;
5224
5227
  }
5225
- let r = pt(t, e);
5226
- D.setState({ snapCursor: r }), Rt(t, e);
5228
+ let r = mt(t, e);
5229
+ D.setState({ snapCursor: r }), zt(t, e);
5227
5230
  },
5228
5231
  onPointerUp(e, t) {
5229
5232
  let n = D.getState();
@@ -5231,9 +5234,9 @@ var Mt = {
5231
5234
  try {
5232
5235
  t.container.releasePointerCapture(e.pointerId);
5233
5236
  } catch {}
5234
- let r = n.pending, i = mt();
5237
+ let r = n.pending, i = ht();
5235
5238
  if (!i) return D.setState({ pending: null }), !0;
5236
- let a = Math.abs(r.currentX - r.startX), o = Math.abs(r.currentY - r.startY), s = a < .5 ? 4 : a, c = o < .5 ? 1 : o, l = a < .5 ? r.startX : Math.min(r.startX, r.currentX), u = o < .5 ? r.startY : Math.min(r.startY, r.currentY), d = jt(i.map), f = {
5239
+ let a = Math.abs(r.currentX - r.startX), o = Math.abs(r.currentY - r.startY), s = a < .5 ? 4 : a, c = o < .5 ? 1 : o, l = a < .5 ? r.startX : Math.min(r.startX, r.currentX), u = o < .5 ? r.startY : Math.min(r.startY, r.currentY), d = Mt(i.map), f = {
5237
5240
  id: d,
5238
5241
  pos: [
5239
5242
  l,
@@ -5258,7 +5261,7 @@ var Mt = {
5258
5261
  },
5259
5262
  noScaling: !1,
5260
5263
  showOnTop: !1,
5261
- font: { ...pe },
5264
+ font: { ...fe },
5262
5265
  pixMap: ""
5263
5266
  };
5264
5267
  return Y({
@@ -5281,10 +5284,10 @@ var Mt = {
5281
5284
  D.setState({ pending: null });
5282
5285
  }
5283
5286
  };
5284
- function Nt(e) {
5287
+ function Pt(e) {
5285
5288
  return !e.activeSwatchSetId || !e.activeSwatchId ? null : [...e.swatchSets, ...e.pluginSwatchSets].find((t) => t.id === e.activeSwatchSetId)?.swatches.find((t) => t.id === e.activeSwatchId) ?? null;
5286
5289
  }
5287
- function Pt(e, t, n) {
5290
+ function Ft(e, t, n) {
5288
5291
  let r = D.getState();
5289
5292
  if (r.pending?.kind !== "paint") return;
5290
5293
  let i = Q(e, t);
@@ -5303,31 +5306,31 @@ function Pt(e, t, n) {
5303
5306
  painted: c
5304
5307
  } });
5305
5308
  }
5306
- var Ft = {
5307
- select: gt,
5308
- connect: yt,
5309
- unlink: xt,
5310
- addRoom: St,
5311
- delete: Ct,
5312
- pan: Tt,
5313
- customLine: Et,
5314
- addLabel: Mt,
5309
+ var It = {
5310
+ select: _t,
5311
+ connect: bt,
5312
+ unlink: St,
5313
+ addRoom: Ct,
5314
+ delete: wt,
5315
+ pan: Et,
5316
+ customLine: Dt,
5317
+ addLabel: Nt,
5315
5318
  paint: {
5316
5319
  id: "paint",
5317
5320
  cursor: "cell",
5318
5321
  onPointerDown(e, t) {
5319
5322
  if (e.button !== 0) return !1;
5320
- let n = Nt(D.getState());
5323
+ let n = Pt(D.getState());
5321
5324
  return n ? (D.setState({ pending: {
5322
5325
  kind: "paint",
5323
5326
  painted: []
5324
- } }), t.container.setPointerCapture(e.pointerId), Pt(t, e, n), !0) : (D.setState({ status: "No swatch selected — open the Swatches palette first." }), !0);
5327
+ } }), t.container.setPointerCapture(e.pointerId), Ft(t, e, n), !0) : (D.setState({ status: "No swatch selected — open the Swatches palette first." }), !0);
5325
5328
  },
5326
5329
  onPointerMove(e, t) {
5327
5330
  let n = D.getState();
5328
- if (n.pending?.kind !== "paint") return Rt(t, e), !1;
5329
- let r = Nt(n);
5330
- return r && Pt(t, e, r), !0;
5331
+ if (n.pending?.kind !== "paint") return zt(t, e), !1;
5332
+ let r = Pt(n);
5333
+ return r && Ft(t, e, r), !0;
5331
5334
  },
5332
5335
  onPointerUp(e, t) {
5333
5336
  let n = D.getState();
@@ -5335,7 +5338,7 @@ var Ft = {
5335
5338
  try {
5336
5339
  t.container.releasePointerCapture(e.pointerId);
5337
5340
  } catch {}
5338
- let r = n.pending.painted, i = Nt(n);
5341
+ let r = n.pending.painted, i = Pt(n);
5339
5342
  if (r.length > 0 && i) {
5340
5343
  let e = [];
5341
5344
  for (let { id: t, prevSymbol: n, prevEnv: a } of r) n !== i.symbol && e.push({
@@ -5374,7 +5377,7 @@ var Ft = {
5374
5377
  }
5375
5378
  }
5376
5379
  };
5377
- function It(e) {
5380
+ function Lt(e) {
5378
5381
  switch (e.kind) {
5379
5382
  case "room": return {
5380
5383
  kind: "room",
@@ -5398,7 +5401,7 @@ function It(e) {
5398
5401
  };
5399
5402
  }
5400
5403
  }
5401
- function Lt(e) {
5404
+ function Rt(e) {
5402
5405
  switch (e.kind) {
5403
5406
  case "room": return `room ${e.id}`;
5404
5407
  case "label": return `label ${e.id}`;
@@ -5406,12 +5409,12 @@ function Lt(e) {
5406
5409
  case "exit": return `exit ${e.dir} (${e.fromId}→${e.toId})`;
5407
5410
  }
5408
5411
  }
5409
- function Rt(e, t) {
5410
- let n = mt();
5412
+ function zt(e, t) {
5413
+ let n = ht();
5411
5414
  if (!n) return;
5412
5415
  let r = Z(e, t), i = Q(e, t), a = null;
5413
5416
  if (i) {
5414
- let t = ot(r, {
5417
+ let t = st(r, {
5415
5418
  x: i.x,
5416
5419
  y: i.y
5417
5420
  }, e.settings.roomSize);
@@ -5421,21 +5424,21 @@ function Rt(e, t) {
5421
5424
  handleDir: t
5422
5425
  };
5423
5426
  } else {
5424
- let t = Qe(n.areaId, n.z, r.x, r.y, e.scene.reader);
5427
+ let t = $e(n.areaId, n.z, r.x, r.y, e.scene.reader);
5425
5428
  if (t) a = {
5426
5429
  kind: "label",
5427
5430
  id: t.id,
5428
5431
  areaId: t.areaId
5429
5432
  };
5430
5433
  else {
5431
- let t = ct(e.renderer, r.x, r.y, e.settings.roomSize);
5434
+ let t = lt(e.renderer, r.x, r.y, e.settings.roomSize);
5432
5435
  if (t) a = {
5433
5436
  kind: "customLine",
5434
5437
  roomId: t.roomId,
5435
5438
  exitName: t.exitName
5436
5439
  };
5437
5440
  else {
5438
- let t = st(e.renderer, r.x, r.y, e.settings.roomSize);
5441
+ let t = ct(e.renderer, r.x, r.y, e.settings.roomSize);
5439
5442
  t && (a = {
5440
5443
  kind: "exit",
5441
5444
  ...t
@@ -5444,18 +5447,18 @@ function Rt(e, t) {
5444
5447
  }
5445
5448
  }
5446
5449
  let o = D.getState().hover;
5447
- zt(o, a) || D.setState({ hover: a });
5450
+ Bt(o, a) || D.setState({ hover: a });
5448
5451
  }
5449
- function zt(e, t) {
5452
+ function Bt(e, t) {
5450
5453
  return e === t ? !0 : !e || !t || e.kind !== t.kind ? !1 : e.kind === "room" && t.kind === "room" ? e.id === t.id && e.handleDir === t.handleDir : e.kind === "exit" && t.kind === "exit" ? e.fromId === t.fromId && e.toId === t.toId && e.dir === t.dir : e.kind === "customLine" && t.kind === "customLine" ? e.roomId === t.roomId && e.exitName === t.exitName : e.kind === "label" && t.kind === "label" ? e.id === t.id && e.areaId === t.areaId : !1;
5451
5454
  }
5452
5455
  //#endregion
5453
5456
  //#region src/components/panels/CustomLinePanel.tsx
5454
- function Bt({ pending: e, sceneRef: t }) {
5457
+ function Vt({ pending: e, sceneRef: t }) {
5455
5458
  let n = (t) => D.setState({ pending: {
5456
5459
  ...e,
5457
5460
  ...t
5458
- } }), r = Ie(e.color), i = (r) => {
5461
+ } }), r = Le(e.color), i = (r) => {
5459
5462
  n(r);
5460
5463
  let i = t.current;
5461
5464
  if (!i) return;
@@ -5510,7 +5513,7 @@ function Bt({ pending: e, sceneRef: t }) {
5510
5513
  }), /* @__PURE__ */ d("input", {
5511
5514
  type: "color",
5512
5515
  value: r,
5513
- onChange: (e) => i({ color: Le(e.target.value) })
5516
+ onChange: (e) => i({ color: Re(e.target.value) })
5514
5517
  })]
5515
5518
  }),
5516
5519
  /* @__PURE__ */ f("div", {
@@ -5571,14 +5574,14 @@ function Bt({ pending: e, sceneRef: t }) {
5571
5574
  },
5572
5575
  children: [/* @__PURE__ */ d("button", {
5573
5576
  type: "button",
5574
- onClick: () => kt(e),
5577
+ onClick: () => At(e),
5575
5578
  disabled: e.points.length < 2,
5576
5579
  style: { flex: 1 },
5577
5580
  children: "Finish"
5578
5581
  }), /* @__PURE__ */ d("button", {
5579
5582
  type: "button",
5580
5583
  onClick: () => {
5581
- t.current && Ot(e, t.current), D.setState({
5584
+ t.current && kt(e, t.current), D.setState({
5582
5585
  pending: null,
5583
5586
  activeTool: "select",
5584
5587
  status: "Custom line cancelled."
@@ -5592,10 +5595,10 @@ function Bt({ pending: e, sceneRef: t }) {
5592
5595
  })
5593
5596
  });
5594
5597
  }
5595
- function Vt({ selection: e, map: t, sceneRef: n }) {
5596
- let r = t.rooms[e.roomId], a = r?.customLines?.[e.exitName], o = r?.customLinesColor?.[e.exitName], s = r?.customLinesStyle?.[e.exitName] ?? 1, c = r?.customLinesArrow?.[e.exitName] ?? !1, l = r?.mSpecialExits?.[e.exitName], p = me.includes(e.exitName) && r ? J(r, e.exitName) : void 0, m = l ?? (p != null && p > 0 ? p : void 0), h = m == null ? null : t.rooms[m], [g, _] = i(o ? Ie(o) : "#ffffff"), [v, y] = i(s), [b, x] = i(c);
5598
+ function Ht({ selection: e, map: t, sceneRef: n }) {
5599
+ let r = t.rooms[e.roomId], a = r?.customLines?.[e.exitName], o = r?.customLinesColor?.[e.exitName], s = r?.customLinesStyle?.[e.exitName] ?? 1, c = r?.customLinesArrow?.[e.exitName] ?? !1, l = r?.mSpecialExits?.[e.exitName], p = J(r, he[e.exitName] ?? e.exitName), m = l ?? (p != null && p > 0 ? p : void 0), h = m == null ? null : t.rooms[m], [g, _] = i(o ? Le(o) : "#ffffff"), [v, y] = i(s), [b, x] = i(c), [S, C] = i(null);
5597
5600
  if (!r || !a) return /* @__PURE__ */ d("h3", { children: "Custom line not found" });
5598
- let S = (e) => ({
5601
+ let w = (e) => ({
5599
5602
  points: a,
5600
5603
  color: e.color ?? o ?? {
5601
5604
  spec: 1,
@@ -5606,7 +5609,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5606
5609
  },
5607
5610
  style: e.style ?? s,
5608
5611
  arrow: e.arrow ?? c
5609
- }), C = {
5612
+ }), T = {
5610
5613
  points: a,
5611
5614
  color: o ?? {
5612
5615
  spec: 1,
@@ -5617,14 +5620,71 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5617
5620
  },
5618
5621
  style: s,
5619
5622
  arrow: c
5620
- }, w = (t) => {
5623
+ }, E = (t) => {
5621
5624
  Y({
5622
5625
  kind: "setCustomLine",
5623
5626
  roomId: e.roomId,
5624
5627
  exitName: e.exitName,
5625
- data: S(t),
5626
- previous: C
5628
+ data: w(t),
5629
+ previous: T
5627
5630
  }, n.current), n.current?.refresh(), D.bumpData();
5631
+ }, O = () => {
5632
+ Y({
5633
+ kind: "removeCustomLine",
5634
+ roomId: e.roomId,
5635
+ exitName: e.exitName,
5636
+ snapshot: T
5637
+ }, n.current), n.current?.refresh(), D.bumpData(), D.setState({
5638
+ selection: null,
5639
+ status: `Custom line '${e.exitName}' removed`
5640
+ });
5641
+ }, k = (t) => {
5642
+ D.setState({ selection: {
5643
+ ...e,
5644
+ pointIndex: t
5645
+ } }), D.bumpData();
5646
+ }, A = (e, t) => {
5647
+ if (S && S.index === e && S.axis === t) return S.value;
5648
+ let n = a[e];
5649
+ return String(t === "x" ? n[0] : n[1]);
5650
+ }, j = (e, t, n) => {
5651
+ C({
5652
+ index: e,
5653
+ axis: t,
5654
+ value: n
5655
+ });
5656
+ }, M = (t, r, i) => {
5657
+ C(null);
5658
+ let l = parseFloat(i);
5659
+ if (isNaN(l)) return;
5660
+ let u = a[t], d = r === "x" ? l : u[0], f = r === "y" ? l : u[1];
5661
+ if (d === u[0] && f === u[1]) return;
5662
+ let p = o ?? {
5663
+ spec: 1,
5664
+ alpha: 255,
5665
+ r: 255,
5666
+ g: 255,
5667
+ b: 255
5668
+ }, m = a.map((e, n) => n === t ? [d, f] : [e[0], e[1]]);
5669
+ Y({
5670
+ kind: "setCustomLine",
5671
+ roomId: e.roomId,
5672
+ exitName: e.exitName,
5673
+ data: {
5674
+ points: m,
5675
+ color: p,
5676
+ style: s,
5677
+ arrow: c
5678
+ },
5679
+ previous: {
5680
+ points: [...a],
5681
+ color: p,
5682
+ style: s,
5683
+ arrow: c
5684
+ }
5685
+ }, n.current), n.current?.refresh(), D.bumpData();
5686
+ }, N = (e) => {
5687
+ e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (C(null), e.currentTarget.blur());
5628
5688
  };
5629
5689
  return /* @__PURE__ */ f(u, { children: [
5630
5690
  /* @__PURE__ */ d("h3", { children: "Custom Line" }),
@@ -5646,7 +5706,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5646
5706
  children: [/* @__PURE__ */ d("span", {
5647
5707
  className: "label",
5648
5708
  children: h == null ? "Room" : "From"
5649
- }), /* @__PURE__ */ d(Me, {
5709
+ }), /* @__PURE__ */ d(Ne, {
5650
5710
  id: e.roomId,
5651
5711
  name: r.name
5652
5712
  })]
@@ -5656,7 +5716,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5656
5716
  children: [/* @__PURE__ */ d("span", {
5657
5717
  className: "label",
5658
5718
  children: "To"
5659
- }), /* @__PURE__ */ d(Me, {
5719
+ }), /* @__PURE__ */ d(Ne, {
5660
5720
  id: m,
5661
5721
  name: h.name
5662
5722
  })]
@@ -5694,7 +5754,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5694
5754
  type: "color",
5695
5755
  value: g,
5696
5756
  onChange: (e) => _(e.target.value),
5697
- onBlur: (e) => w({ color: Le(e.target.value) })
5757
+ onBlur: (e) => E({ color: Re(e.target.value) })
5698
5758
  })]
5699
5759
  }),
5700
5760
  /* @__PURE__ */ f("div", {
@@ -5706,7 +5766,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5706
5766
  value: v,
5707
5767
  onChange: (e) => {
5708
5768
  let t = Number(e.target.value);
5709
- y(t), w({ style: t });
5769
+ y(t), E({ style: t });
5710
5770
  },
5711
5771
  children: [
5712
5772
  /* @__PURE__ */ d("option", {
@@ -5741,12 +5801,57 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5741
5801
  type: "checkbox",
5742
5802
  checked: b,
5743
5803
  onChange: (e) => {
5744
- x(e.target.checked), w({ arrow: e.target.checked });
5804
+ x(e.target.checked), E({ arrow: e.target.checked });
5745
5805
  }
5746
5806
  })]
5747
5807
  })
5748
5808
  ]
5749
5809
  }),
5810
+ /* @__PURE__ */ f("div", {
5811
+ className: "cl-waypoints",
5812
+ style: { marginTop: 12 },
5813
+ children: [/* @__PURE__ */ d("div", {
5814
+ className: "cl-waypoints-header",
5815
+ children: "Waypoints"
5816
+ }), a.map((t, n) => /* @__PURE__ */ f("div", {
5817
+ className: `cl-waypoint-row${e.pointIndex === n ? " active" : ""}`,
5818
+ onMouseDown: () => k(n),
5819
+ children: [
5820
+ /* @__PURE__ */ d("span", {
5821
+ className: "cl-waypoint-idx",
5822
+ children: n + 1
5823
+ }),
5824
+ /* @__PURE__ */ d("span", {
5825
+ className: "cl-waypoint-axis",
5826
+ children: "X"
5827
+ }),
5828
+ /* @__PURE__ */ d("input", {
5829
+ type: "number",
5830
+ step: "any",
5831
+ className: "cl-waypoint-input",
5832
+ value: A(n, "x"),
5833
+ onChange: (e) => j(n, "x", e.target.value),
5834
+ onFocus: () => k(n),
5835
+ onBlur: (e) => M(n, "x", e.target.value),
5836
+ onKeyDown: N
5837
+ }),
5838
+ /* @__PURE__ */ d("span", {
5839
+ className: "cl-waypoint-axis",
5840
+ children: "Y"
5841
+ }),
5842
+ /* @__PURE__ */ d("input", {
5843
+ type: "number",
5844
+ step: "any",
5845
+ className: "cl-waypoint-input",
5846
+ value: A(n, "y"),
5847
+ onChange: (e) => j(n, "y", e.target.value),
5848
+ onFocus: () => k(n),
5849
+ onBlur: (e) => M(n, "y", e.target.value),
5850
+ onKeyDown: N
5851
+ })
5852
+ ]
5853
+ }, n))]
5854
+ }),
5750
5855
  /* @__PURE__ */ d("button", {
5751
5856
  type: "button",
5752
5857
  style: {
@@ -5754,7 +5859,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5754
5859
  width: "100%"
5755
5860
  },
5756
5861
  onClick: () => {
5757
- let t = D.getState().gridStep, r = a.map(([e, n]) => [Xe(e, t), -Xe(-n, t)]);
5862
+ let t = D.getState().gridStep, r = a.map(([e, n]) => [Ze(e, t), -Ze(-n, t)]);
5758
5863
  if (!r.some((e, t) => e[0] !== a[t][0] || e[1] !== a[t][1])) {
5759
5864
  D.setState({ status: `Custom line '${e.exitName}' already on grid.` });
5760
5865
  return;
@@ -5775,7 +5880,7 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5775
5880
  style: s,
5776
5881
  arrow: c
5777
5882
  },
5778
- previous: C
5883
+ previous: T
5779
5884
  }, n.current), n.current?.refresh(), D.bumpData(), D.setState({ status: `Snapped custom line '${e.exitName}' to grid` });
5780
5885
  },
5781
5886
  disabled: a.length === 0,
@@ -5785,45 +5890,35 @@ function Vt({ selection: e, map: t, sceneRef: n }) {
5785
5890
  type: "button",
5786
5891
  className: "link-delete-btn",
5787
5892
  style: { marginTop: 8 },
5788
- onClick: () => {
5789
- Y({
5790
- kind: "removeCustomLine",
5791
- roomId: e.roomId,
5792
- exitName: e.exitName,
5793
- snapshot: C
5794
- }, n.current), n.current?.refresh(), D.bumpData(), D.setState({
5795
- selection: null,
5796
- status: `Custom line '${e.exitName}' removed`
5797
- });
5798
- },
5893
+ onClick: O,
5799
5894
  children: "Remove custom line"
5800
5895
  })
5801
5896
  ] });
5802
5897
  }
5803
5898
  //#endregion
5804
5899
  //#region src/editor/labelPixmap.ts
5805
- var Ht = 64;
5806
- function Ut(e) {
5900
+ var Ut = 64;
5901
+ function Wt(e) {
5807
5902
  return `rgba(${e.r},${e.g},${e.b},${(e.alpha / 255).toFixed(3)})`;
5808
5903
  }
5809
- function Wt(e) {
5904
+ function Gt(e) {
5810
5905
  let t = document.createElement("canvas"), n = t.getContext("2d");
5811
5906
  if (!n) return "";
5812
- let r = Math.max(1, Math.round(e.size[0] * Ht)), i = Math.max(1, Math.round(e.size[1] * Ht)), a = window.devicePixelRatio || 1;
5813
- if (t.width = r * a, t.height = i * a, n.scale(a, a), n.fillStyle = Ut(e.bgColor), n.fillRect(0, 0, r, i), !e.text) return t.toDataURL("image/png");
5907
+ let r = Math.max(1, Math.round(e.size[0] * Ut)), i = Math.max(1, Math.round(e.size[1] * Ut)), a = window.devicePixelRatio || 1;
5908
+ if (t.width = r * a, t.height = i * a, n.scale(a, a), n.fillStyle = Wt(e.bgColor), n.fillRect(0, 0, r, i), !e.text) return t.toDataURL("image/png");
5814
5909
  let { font: o } = e;
5815
5910
  n.font = [
5816
5911
  o.italic ? "italic" : "",
5817
5912
  o.bold ? "bold" : "",
5818
5913
  `${o.size}px`,
5819
5914
  `"${o.family}", sans-serif`
5820
- ].filter(Boolean).join(" "), n.fillStyle = Ut(e.fgColor), n.textBaseline = "middle", n.textAlign = "center";
5915
+ ].filter(Boolean).join(" "), n.fillStyle = Wt(e.fgColor), n.textBaseline = "middle", n.textAlign = "center";
5821
5916
  let s = e.text.split("\n"), c = o.size * 1.25, l = (i - s.length * c) / 2 + c / 2, u = r / 2;
5822
5917
  for (let t = 0; t < s.length; t++) {
5823
5918
  let i = l + t * c;
5824
- if (e.outlineColor && e.outlineColor.alpha > 0 && (n.strokeStyle = Ut(e.outlineColor), n.lineWidth = Math.max(1, o.size / 12), n.lineJoin = "round", n.strokeText(s[t], u, i, r)), n.fillText(s[t], u, i, r), o.underline || o.strikeout) {
5919
+ if (e.outlineColor && e.outlineColor.alpha > 0 && (n.strokeStyle = Wt(e.outlineColor), n.lineWidth = Math.max(1, o.size / 12), n.lineJoin = "round", n.strokeText(s[t], u, i, r)), n.fillText(s[t], u, i, r), o.underline || o.strikeout) {
5825
5920
  let r = n.measureText(s[t]).width, a = u - r / 2, c = u + r / 2;
5826
- if (n.strokeStyle = Ut(e.fgColor), n.lineWidth = Math.max(1, o.size / 14), o.underline) {
5921
+ if (n.strokeStyle = Wt(e.fgColor), n.lineWidth = Math.max(1, o.size / 14), o.underline) {
5827
5922
  let e = i + o.size * .6;
5828
5923
  n.beginPath(), n.moveTo(a, e), n.lineTo(c, e), n.stroke();
5829
5924
  }
@@ -5832,13 +5927,13 @@ function Wt(e) {
5832
5927
  }
5833
5928
  return t.toDataURL("image/png");
5834
5929
  }
5835
- function Gt(e) {
5930
+ function Kt(e) {
5836
5931
  let t = e.includes(",") ? e.split(",")[1] : e;
5837
5932
  return t ? re.from(t, "base64") : re.alloc(0);
5838
5933
  }
5839
5934
  //#endregion
5840
5935
  //#region src/components/FontPicker.tsx
5841
- function Kt({ value: e, options: n, onChange: a }) {
5936
+ function qt({ value: e, options: n, onChange: a }) {
5842
5937
  let [o, s] = i(!1), [c, p] = i(""), [m, h] = i(-1), [g, _] = i({}), v = r(null), y = r(null), b = r(null), x = c.trim() ? n.filter((e) => e.toLowerCase().includes(c.toLowerCase())) : n;
5843
5938
  t(() => {
5844
5939
  let t = x.findIndex((t) => t === e);
@@ -5941,7 +6036,7 @@ function Kt({ value: e, options: n, onChange: a }) {
5941
6036
  }
5942
6037
  //#endregion
5943
6038
  //#region src/components/panels/LabelPanel.tsx
5944
- var qt = [
6039
+ var Jt = [
5945
6040
  "Arial",
5946
6041
  "Arial Black",
5947
6042
  "Comic Sans MS",
@@ -5954,9 +6049,9 @@ var qt = [
5954
6049
  "Times New Roman",
5955
6050
  "Trebuchet MS",
5956
6051
  "Verdana"
5957
- ], Jt = (e, t) => e.r === t.r && e.g === t.g && e.b === t.b && e.alpha === t.alpha, Yt = (e, t) => e === void 0 && t === void 0 ? !0 : e === void 0 || t === void 0 ? !1 : Jt(e, t), Xt = 64;
5958
- function Zt({ selection: e, sceneRef: n }) {
5959
- let a = O((e) => e.dataVersion), o = O((e) => e.labelAspectRatioLocked), s = n.current?.reader.getLabelSnapshot(e.areaId, e.id), [c, l] = i(s?.text ?? ""), [p, m] = i(String(s?.size[0] ?? 4)), [h, g] = i(String(s?.size[1] ?? 1)), [_, v] = i(s?.bgColor.alpha ?? 255), [y, b] = i(s?.outlineColor?.alpha ?? 0), [x, S] = i(qt);
6052
+ ], Yt = (e, t) => e.r === t.r && e.g === t.g && e.b === t.b && e.alpha === t.alpha, Xt = (e, t) => e === void 0 && t === void 0 ? !0 : e === void 0 || t === void 0 ? !1 : Yt(e, t), Zt = 64;
6053
+ function Qt({ selection: e, sceneRef: n }) {
6054
+ let a = O((e) => e.dataVersion), o = O((e) => e.labelAspectRatioLocked), s = n.current?.reader.getLabelSnapshot(e.areaId, e.id), [c, l] = i(s?.text ?? ""), [p, m] = i(String(s?.size[0] ?? 4)), [h, g] = i(String(s?.size[1] ?? 1)), [_, v] = i(s?.bgColor.alpha ?? 255), [y, b] = i(s?.outlineColor?.alpha ?? 0), [x, S] = i(Jt);
5960
6055
  t(() => {
5961
6056
  "queryLocalFonts" in window && window.queryLocalFonts?.().then((e) => {
5962
6057
  let t = [...new Set(e.map((e) => e.family))].sort();
@@ -5985,7 +6080,7 @@ function Zt({ selection: e, sceneRef: n }) {
5985
6080
  })
5986
6081
  });
5987
6082
  let N = (t) => {
5988
- let n = Wt(t);
6083
+ let n = Gt(t);
5989
6084
  return n === t.pixMap ? [] : [{
5990
6085
  kind: "setLabelPixmap",
5991
6086
  areaId: e.areaId,
@@ -6002,7 +6097,7 @@ function Zt({ selection: e, sceneRef: n }) {
6002
6097
  ...r,
6003
6098
  text: E.current
6004
6099
  };
6005
- Ee([{
6100
+ De([{
6006
6101
  kind: "setLabelText",
6007
6102
  areaId: e.areaId,
6008
6103
  id: e.id,
@@ -6020,7 +6115,7 @@ function Zt({ selection: e, sceneRef: n }) {
6020
6115
  ...r,
6021
6116
  size: [i, a]
6022
6117
  };
6023
- Ee([{
6118
+ De([{
6024
6119
  kind: "setLabelSize",
6025
6120
  areaId: e.areaId,
6026
6121
  id: e.id,
@@ -6037,7 +6132,7 @@ function Zt({ selection: e, sceneRef: n }) {
6037
6132
  fg: s.fgColor,
6038
6133
  bg: s.bgColor
6039
6134
  };
6040
- if (j.current = null, !i || Jt(a.fg, t) && Jt(a.bg, r)) return;
6135
+ if (j.current = null, !i || Yt(a.fg, t) && Yt(a.bg, r)) return;
6041
6136
  let o = i.reader.getLabelSnapshot(e.areaId, e.id);
6042
6137
  if (!o) return;
6043
6138
  let c = {
@@ -6045,7 +6140,7 @@ function Zt({ selection: e, sceneRef: n }) {
6045
6140
  fgColor: t,
6046
6141
  bgColor: r
6047
6142
  };
6048
- Ee([{
6143
+ De([{
6049
6144
  kind: "setLabelColors",
6050
6145
  areaId: e.areaId,
6051
6146
  id: e.id,
@@ -6085,7 +6180,7 @@ function Zt({ selection: e, sceneRef: n }) {
6085
6180
  ...i.font,
6086
6181
  ...t
6087
6182
  };
6088
- Ee([{
6183
+ De([{
6089
6184
  kind: "setLabelFont",
6090
6185
  areaId: e.areaId,
6091
6186
  id: e.id,
@@ -6099,14 +6194,14 @@ function Zt({ selection: e, sceneRef: n }) {
6099
6194
  M.current ||= { color: s.outlineColor };
6100
6195
  }, V = (t) => {
6101
6196
  let r = n.current, i = M.current ?? { color: s.outlineColor };
6102
- if (M.current = null, !r || Yt(i.color, t)) return;
6197
+ if (M.current = null, !r || Xt(i.color, t)) return;
6103
6198
  let a = r.reader.getLabelSnapshot(e.areaId, e.id);
6104
6199
  if (!a) return;
6105
6200
  let o = {
6106
6201
  ...a,
6107
6202
  outlineColor: t
6108
6203
  };
6109
- Ee([{
6204
+ De([{
6110
6205
  kind: "setLabelOutlineColor",
6111
6206
  areaId: e.areaId,
6112
6207
  id: e.id,
@@ -6120,7 +6215,7 @@ function Zt({ selection: e, sceneRef: n }) {
6120
6215
  if (!r || !r.text) return;
6121
6216
  let i = document.createElement("canvas").getContext("2d");
6122
6217
  if (!i) return;
6123
- let a = Math.max(1, Math.round(r.size[0] * Xt)), o = Math.max(1, Math.round(r.size[1] * Xt)), s = a - 16, c = o - 16;
6218
+ let a = Math.max(1, Math.round(r.size[0] * Zt)), o = Math.max(1, Math.round(r.size[1] * Zt)), s = a - 16, c = o - 16;
6124
6219
  if (s <= 0 || c <= 0) return;
6125
6220
  let l = r.text.split("\n"), { font: u } = r, d = Math.floor(c / (l.length * 1.25)), f = 1, p = d, m = 1;
6126
6221
  for (; f <= p;) {
@@ -6138,7 +6233,7 @@ function Zt({ selection: e, sceneRef: n }) {
6138
6233
  if (!t) return;
6139
6234
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
6140
6235
  if (!r) return;
6141
- let i = Wt(r);
6236
+ let i = Gt(r);
6142
6237
  i !== r.pixMap && (Y({
6143
6238
  kind: "setLabelPixmap",
6144
6239
  areaId: e.areaId,
@@ -6159,8 +6254,8 @@ function Zt({ selection: e, sceneRef: n }) {
6159
6254
  if (!i) return;
6160
6255
  let a = i.reader.getLabelSnapshot(e.areaId, e.id);
6161
6256
  if (!a) return;
6162
- let o = Math.max(.1, Math.round(r.naturalWidth / Xt * 100) / 100), s = Math.max(.1, Math.round(r.naturalHeight / Xt * 100) / 100);
6163
- Ee([
6257
+ let o = Math.max(.1, Math.round(r.naturalWidth / Zt * 100) / 100), s = Math.max(.1, Math.round(r.naturalHeight / Zt * 100) / 100);
6258
+ De([
6164
6259
  {
6165
6260
  kind: "setLabelImageSrc",
6166
6261
  areaId: e.areaId,
@@ -6191,8 +6286,8 @@ function Zt({ selection: e, sceneRef: n }) {
6191
6286
  if (!t) return;
6192
6287
  let r = t.reader.getLabelSnapshot(e.areaId, e.id);
6193
6288
  if (!r || !r.imageSrc) return;
6194
- let i = Wt(r);
6195
- Ee([{
6289
+ let i = Gt(r);
6290
+ De([{
6196
6291
  kind: "setLabelImageSrc",
6197
6292
  areaId: e.areaId,
6198
6293
  id: e.id,
@@ -6205,14 +6300,14 @@ function Zt({ selection: e, sceneRef: n }) {
6205
6300
  from: r.pixMap,
6206
6301
  to: i
6207
6302
  }], t), t.refresh(), D.setState({ labelAspectRatioLocked: !1 }), D.bumpData();
6208
- }, H = !!s.imageSrc, ae = Ie(s.fgColor), U = Ie(s.bgColor), W = s.outlineColor ?? {
6303
+ }, H = !!s.imageSrc, U = Le(s.fgColor), W = Le(s.bgColor), G = s.outlineColor ?? {
6209
6304
  spec: 1,
6210
6305
  r: 0,
6211
6306
  g: 0,
6212
6307
  b: 0,
6213
6308
  alpha: 0,
6214
6309
  pad: 0
6215
- }, oe = Ie(W), se = (e) => ({
6310
+ }, ae = Le(G), oe = (e) => ({
6216
6311
  flex: 1,
6217
6312
  padding: "4px 0",
6218
6313
  fontSize: 12,
@@ -6247,14 +6342,14 @@ function Zt({ selection: e, sceneRef: n }) {
6247
6342
  overflow: "hidden"
6248
6343
  },
6249
6344
  children: [/* @__PURE__ */ d("button", {
6250
- style: se(!H),
6345
+ style: oe(!H),
6251
6346
  onClick: () => {
6252
6347
  H && ie();
6253
6348
  },
6254
6349
  children: "Text"
6255
6350
  }), /* @__PURE__ */ d("button", {
6256
6351
  style: {
6257
- ...se(H),
6352
+ ...oe(H),
6258
6353
  borderLeft: "1px solid var(--border, #444)"
6259
6354
  },
6260
6355
  onClick: () => {
@@ -6313,12 +6408,12 @@ function Zt({ selection: e, sceneRef: n }) {
6313
6408
  })
6314
6409
  ]
6315
6410
  }),
6316
- /* @__PURE__ */ d(Ne, {
6411
+ /* @__PURE__ */ d(Pe, {
6317
6412
  checked: s.showOnTop,
6318
6413
  onChange: ee,
6319
6414
  description: "Show on top (foreground)"
6320
6415
  }),
6321
- /* @__PURE__ */ d(Ne, {
6416
+ /* @__PURE__ */ d(Pe, {
6322
6417
  checked: !s.noScaling,
6323
6418
  onChange: (e) => R(!e),
6324
6419
  description: "Scale with zoom"
@@ -6373,22 +6468,22 @@ function Zt({ selection: e, sceneRef: n }) {
6373
6468
  as: "div",
6374
6469
  children: /* @__PURE__ */ d("input", {
6375
6470
  type: "color",
6376
- defaultValue: ae,
6471
+ defaultValue: U,
6377
6472
  onMouseDown: I,
6378
- onBlur: (e) => L(Le(e.target.value), s.bgColor)
6379
- }, `fg-${e.id}-${ae}`)
6473
+ onBlur: (e) => L(Re(e.target.value), s.bgColor)
6474
+ }, `fg-${e.id}-${U}`)
6380
6475
  }), /* @__PURE__ */ d(X, {
6381
6476
  label: "BG color",
6382
6477
  as: "div",
6383
6478
  children: /* @__PURE__ */ d("input", {
6384
6479
  type: "color",
6385
- defaultValue: U,
6480
+ defaultValue: W,
6386
6481
  onMouseDown: I,
6387
6482
  onBlur: (e) => L(s.fgColor, {
6388
- ...Le(e.target.value),
6483
+ ...Re(e.target.value),
6389
6484
  alpha: s.bgColor.alpha
6390
6485
  })
6391
- }, `bg-${e.id}-${U}`)
6486
+ }, `bg-${e.id}-${W}`)
6392
6487
  })]
6393
6488
  }),
6394
6489
  /* @__PURE__ */ d(X, {
@@ -6431,7 +6526,7 @@ function Zt({ selection: e, sceneRef: n }) {
6431
6526
  /* @__PURE__ */ d(X, {
6432
6527
  label: "Font",
6433
6528
  as: "div",
6434
- children: /* @__PURE__ */ d(Kt, {
6529
+ children: /* @__PURE__ */ d(qt, {
6435
6530
  value: s.font.family,
6436
6531
  options: x,
6437
6532
  onChange: (e) => z({ family: e })
@@ -6525,13 +6620,13 @@ function Zt({ selection: e, sceneRef: n }) {
6525
6620
  as: "div",
6526
6621
  children: /* @__PURE__ */ d("input", {
6527
6622
  type: "color",
6528
- defaultValue: oe,
6623
+ defaultValue: ae,
6529
6624
  onMouseDown: B,
6530
6625
  onBlur: (e) => V({
6531
- ...W,
6532
- ...Le(e.target.value)
6626
+ ...G,
6627
+ ...Re(e.target.value)
6533
6628
  })
6534
- }, `outline-${e.id}-${oe}`)
6629
+ }, `outline-${e.id}-${ae}`)
6535
6630
  }),
6536
6631
  /* @__PURE__ */ d(X, {
6537
6632
  label: "Outline alpha",
@@ -6554,14 +6649,14 @@ function Zt({ selection: e, sceneRef: n }) {
6554
6649
  onPointerUp: (e) => {
6555
6650
  let t = parseInt(e.target.value, 10);
6556
6651
  V(t === 0 ? void 0 : {
6557
- ...W,
6652
+ ...G,
6558
6653
  alpha: t
6559
6654
  });
6560
6655
  },
6561
6656
  onBlur: (e) => {
6562
6657
  let t = parseInt(e.target.value, 10);
6563
6658
  V(t === 0 ? void 0 : {
6564
- ...W,
6659
+ ...G,
6565
6660
  alpha: t
6566
6661
  });
6567
6662
  }
@@ -6609,7 +6704,7 @@ function Zt({ selection: e, sceneRef: n }) {
6609
6704
  }
6610
6705
  //#endregion
6611
6706
  //#region src/components/EnvPicker.tsx
6612
- function Qt({ map: e, sceneRef: n, currentEnvId: a, onSelect: o, onClose: s }) {
6707
+ function $t({ map: e, sceneRef: n, currentEnvId: a, onSelect: o, onClose: s }) {
6613
6708
  let c = r(null), [l, u] = i("");
6614
6709
  t(() => {
6615
6710
  let e = (e) => {
@@ -6684,7 +6779,7 @@ function Qt({ map: e, sceneRef: n, currentEnvId: a, onSelect: o, onClose: s }) {
6684
6779
  }
6685
6780
  //#endregion
6686
6781
  //#region src/components/icons.tsx
6687
- function $t() {
6782
+ function en() {
6688
6783
  return /* @__PURE__ */ f("svg", {
6689
6784
  width: "10",
6690
6785
  height: "12",
@@ -6707,7 +6802,7 @@ function $t() {
6707
6802
  })]
6708
6803
  });
6709
6804
  }
6710
- function en({ locked: e }) {
6805
+ function tn({ locked: e }) {
6711
6806
  return /* @__PURE__ */ f("svg", {
6712
6807
  width: "10",
6713
6808
  height: "12",
@@ -6744,7 +6839,7 @@ function en({ locked: e }) {
6744
6839
  ]
6745
6840
  });
6746
6841
  }
6747
- function tn() {
6842
+ function nn() {
6748
6843
  return /* @__PURE__ */ f("svg", {
6749
6844
  width: "12",
6750
6845
  height: "8",
@@ -6777,7 +6872,7 @@ function tn() {
6777
6872
  ]
6778
6873
  });
6779
6874
  }
6780
- function nn() {
6875
+ function rn() {
6781
6876
  return /* @__PURE__ */ f("svg", {
6782
6877
  width: "11",
6783
6878
  height: "11",
@@ -6798,7 +6893,7 @@ function nn() {
6798
6893
  })]
6799
6894
  });
6800
6895
  }
6801
- function rn() {
6896
+ function an() {
6802
6897
  return /* @__PURE__ */ f("svg", {
6803
6898
  width: "10",
6804
6899
  height: "10",
@@ -6854,7 +6949,7 @@ function rn() {
6854
6949
  }
6855
6950
  //#endregion
6856
6951
  //#region src/components/RoomPanel.tsx
6857
- var an = [
6952
+ var on = [
6858
6953
  "north",
6859
6954
  "northeast",
6860
6955
  "east",
@@ -6867,7 +6962,7 @@ var an = [
6867
6962
  "down",
6868
6963
  "in",
6869
6964
  "out"
6870
- ], on = [
6965
+ ], sn = [
6871
6966
  [
6872
6967
  "northwest",
6873
6968
  "north",
@@ -6883,7 +6978,7 @@ var an = [
6883
6978
  "south",
6884
6979
  "southeast"
6885
6980
  ]
6886
- ], sn = [[
6981
+ ], cn = [[
6887
6982
  "up",
6888
6983
  null,
6889
6984
  "down"
@@ -6891,7 +6986,7 @@ var an = [
6891
6986
  "in",
6892
6987
  null,
6893
6988
  "out"
6894
- ]], cn = {
6989
+ ]], ln = {
6895
6990
  north: "N",
6896
6991
  northeast: "NE",
6897
6992
  east: "E",
@@ -6904,20 +6999,20 @@ var an = [
6904
6999
  down: "Dn",
6905
7000
  in: "In",
6906
7001
  out: "Out"
6907
- }, ln = [
7002
+ }, un = [
6908
7003
  "No door (click to set)",
6909
7004
  "Open door",
6910
7005
  "Closed door",
6911
7006
  "Locked door"
6912
- ], un = [
7007
+ ], dn = [
6913
7008
  "",
6914
7009
  "door-open",
6915
7010
  "door-closed",
6916
7011
  "door-locked"
6917
7012
  ];
6918
- function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = [] }) {
7013
+ function fn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = [] }) {
6919
7014
  let l = n.ids[0], p = O((e) => e.pending), [m, h] = i(a.name ?? ""), [g, _] = i(String(a.weight ?? 1)), [v, y] = i(a.symbol ?? ""), [b, x] = i(a.userData?.["system.fallback_symbol_color"] ?? null), [S, C] = i(!1), [w, T] = i(""), [E, k] = i(""), [A, j] = i({}), [M, N] = i(null), [P, F] = i("#ffffff"), [I, L] = i(1), [R, ee] = i(!1), [z, B] = i(!1), V = r(k);
6920
- V.current = k, t(() => (ft((e) => V.current(String(e))), () => ft(null)), []);
7015
+ V.current = k, t(() => (pt((e) => V.current(String(e))), () => pt(null)), []);
6921
7016
  let te = r(m);
6922
7017
  te.current = m;
6923
7018
  let ne = r(g);
@@ -6978,7 +7073,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
6978
7073
  from: a.environment,
6979
7074
  to: e
6980
7075
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Room ${l} environment → ${e}` }));
6981
- }, ae = (e) => {
7076
+ }, U = (e) => {
6982
7077
  let t = "system.fallback_symbol_color", n = a.userData?.[t] ?? null, r = e;
6983
7078
  n !== r && (Y({
6984
7079
  kind: "setUserDataEntry",
@@ -6987,7 +7082,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
6987
7082
  from: n,
6988
7083
  to: r
6989
7084
  }, s.current), s.current?.refresh(), D.bumpData());
6990
- }, U = (e, t) => {
7085
+ }, W = (e, t) => {
6991
7086
  if (!o.rooms[t]) return;
6992
7087
  let n = a[e];
6993
7088
  Y({
@@ -6998,7 +7093,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
6998
7093
  previous: n,
6999
7094
  reverse: null
7000
7095
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Exit ${e} → room ${t} added.` });
7001
- }, W = (e, t, n) => {
7096
+ }, G = (e, t, n) => {
7002
7097
  Y({
7003
7098
  kind: "setDoor",
7004
7099
  roomId: l,
@@ -7006,7 +7101,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7006
7101
  from: t,
7007
7102
  to: n
7008
7103
  }, s.current), s.current?.refresh(), D.bumpData();
7009
- }, oe = (e, t, n) => {
7104
+ }, ae = (e, t, n) => {
7010
7105
  t !== n && (Y({
7011
7106
  kind: "setExitWeight",
7012
7107
  roomId: l,
@@ -7014,14 +7109,14 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7014
7109
  from: t,
7015
7110
  to: n
7016
7111
  }, s.current), s.current?.refresh(), D.bumpData());
7017
- }, se = (e, t) => {
7112
+ }, oe = (e, t) => {
7018
7113
  Y({
7019
7114
  kind: "setExitLock",
7020
7115
  roomId: l,
7021
7116
  dir: e,
7022
7117
  lock: !t
7023
7118
  }, s.current), s.current?.refresh(), D.bumpData();
7024
- }, ce = (e, t, n, r) => {
7119
+ }, se = (e, t, n, r) => {
7025
7120
  t ? Y({
7026
7121
  kind: "removeExit",
7027
7122
  fromId: l,
@@ -7034,7 +7129,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7034
7129
  dir: e,
7035
7130
  stub: !1
7036
7131
  }, s.current), s.current?.refresh(), D.bumpData();
7037
- }, le = (e, t, n) => {
7132
+ }, ce = (e, t, n) => {
7038
7133
  t ? Y({
7039
7134
  kind: "setStub",
7040
7135
  roomId: l,
@@ -7045,7 +7140,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7045
7140
  roomId: l,
7046
7141
  dir: e,
7047
7142
  stub: !0
7048
- }, s.current) : Ee([{
7143
+ }, s.current) : De([{
7049
7144
  kind: "removeExit",
7050
7145
  fromId: l,
7051
7146
  dir: e,
@@ -7057,7 +7152,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7057
7152
  dir: e,
7058
7153
  stub: !0
7059
7154
  }], s.current), s.current?.refresh(), D.bumpData();
7060
- }, ue = () => {
7155
+ }, le = () => {
7061
7156
  let e = w.trim(), t = parseInt(E, 10);
7062
7157
  !e || Number.isNaN(t) || t <= 0 || (Y({
7063
7158
  kind: "addSpecialExit",
@@ -7065,14 +7160,14 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7065
7160
  name: e,
7066
7161
  toId: t
7067
7162
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Special exit '${e}' → ${t} added` }), T(""), k(""));
7068
- }, de = (e, t) => {
7163
+ }, ue = (e, t) => {
7069
7164
  Y({
7070
7165
  kind: "removeSpecialExit",
7071
7166
  roomId: l,
7072
7167
  name: e,
7073
7168
  toId: t
7074
7169
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Special exit '${e}' removed` });
7075
- }, fe = (e, t, n) => {
7170
+ }, de = (e, t, n) => {
7076
7171
  Y({
7077
7172
  kind: "setSpecialExitDoor",
7078
7173
  roomId: l,
@@ -7080,7 +7175,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7080
7175
  from: t,
7081
7176
  to: n
7082
7177
  }, s.current), s.current?.refresh(), D.bumpData();
7083
- }, pe = (e, t, n) => {
7178
+ }, fe = (e, t, n) => {
7084
7179
  t !== n && (Y({
7085
7180
  kind: "setSpecialExitWeight",
7086
7181
  roomId: l,
@@ -7088,7 +7183,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7088
7183
  from: t,
7089
7184
  to: n
7090
7185
  }, s.current), s.current?.refresh(), D.bumpData());
7091
- }, me = (e) => {
7186
+ }, pe = (e) => {
7092
7187
  let t = o.rooms[l];
7093
7188
  t?.customLines?.[e] && (Y({
7094
7189
  kind: "removeCustomLine",
@@ -7107,7 +7202,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7107
7202
  arrow: t.customLinesArrow?.[e] ?? !1
7108
7203
  }
7109
7204
  }, s.current), s.current?.refresh(), D.bumpData(), D.setState({ status: `Custom line '${e}' removed` }));
7110
- }, q = (e) => {
7205
+ }, he = (e) => {
7111
7206
  let t = e.trim();
7112
7207
  if (!t) {
7113
7208
  D.setState({ status: "Enter exit name first." });
@@ -7115,7 +7210,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7115
7210
  }
7116
7211
  let n = s.current, r = n?.reader.getRoom(l);
7117
7212
  if (!n || !r) return;
7118
- let i = _e(t), a = o.rooms[l], c = a?.customLines?.[i] ? {
7213
+ let i = ve(t), a = o.rooms[l], c = a?.customLines?.[i] ? {
7119
7214
  points: a.customLines[i],
7120
7215
  color: a.customLinesColor?.[i] ?? {
7121
7216
  spec: 1,
@@ -7126,13 +7221,13 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7126
7221
  },
7127
7222
  style: a.customLinesStyle?.[i] ?? 1,
7128
7223
  arrow: a.customLinesArrow?.[i] ?? !1
7129
- } : null, u = Le(P), d = null, f = ge[i];
7224
+ } : null, u = Re(P), d = null, f = _e[i];
7130
7225
  if (z && f) {
7131
7226
  let e = a?.[f];
7132
7227
  if (e !== void 0 && e !== -1) {
7133
- let t = o.rooms[e], r = he[f];
7228
+ let t = o.rooms[e], r = me[f];
7134
7229
  if (t && t[r] === l) {
7135
- let i = G[r];
7230
+ let i = K[r];
7136
7231
  d = {
7137
7232
  roomId: e,
7138
7233
  exitName: i,
@@ -7168,14 +7263,14 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7168
7263
  },
7169
7264
  status: "Click canvas to add waypoints · double-click or Enter to finish · Esc cancels"
7170
7265
  }), D.bumpData(), N(null);
7171
- }, ve = (e) => {
7172
- let t = _e(e);
7266
+ }, ge = (e) => {
7267
+ let t = ve(e);
7173
7268
  return a.customLines?.[t] ? {
7174
7269
  key: t,
7175
7270
  color: a.customLinesColor?.[t]
7176
7271
  } : null;
7177
7272
  }, ye = (e) => {
7178
- let t = ve(e);
7273
+ let t = ge(e);
7179
7274
  if (t) {
7180
7275
  D.setState({ selection: {
7181
7276
  kind: "customLine",
@@ -7262,7 +7357,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7262
7357
  },
7263
7358
  children: [/* @__PURE__ */ d("button", {
7264
7359
  type: "button",
7265
- onClick: () => q(e),
7360
+ onClick: () => he(e),
7266
7361
  style: { flex: 1 },
7267
7362
  children: "Start Drawing"
7268
7363
  }), /* @__PURE__ */ d("button", {
@@ -7273,7 +7368,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7273
7368
  })
7274
7369
  ]
7275
7370
  }), xe = (e) => {
7276
- let t = e, n = a[e], r = n !== -1, i = G[t], o = K[t], s = a.stubs?.includes(o) ?? !1, c = r || s, u = a.doors?.[i] ?? 0, m = a.exitWeights?.[i] ?? 1, h = a.exitLocks?.includes(o) ?? !1, g = !!a.customLines?.[i], _ = p?.kind === "pickExit" && p.fromId === l && p.dir === t;
7371
+ let t = e, n = a[e], r = n !== -1, i = K[t], o = q[t], s = a.stubs?.includes(o) ?? !1, c = r || s, u = a.doors?.[i] ?? 0, m = a.exitWeights?.[i] ?? 1, h = a.exitLocks?.includes(o) ?? !1, g = !!a.customLines?.[i], _ = p?.kind === "pickExit" && p.fromId === l && p.dir === t;
7277
7372
  return /* @__PURE__ */ f("div", {
7278
7373
  className: `compass-cell${c ? " has-exit" : ""}${M === e ? " active" : ""}${_ ? " picking-exit" : ""}`,
7279
7374
  children: [
@@ -7281,7 +7376,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7281
7376
  className: "cc-header",
7282
7377
  children: [/* @__PURE__ */ d("span", {
7283
7378
  className: "cc-label",
7284
- children: cn[e]
7379
+ children: ln[e]
7285
7380
  }), /* @__PURE__ */ f("span", {
7286
7381
  className: "cc-header-btn-slot",
7287
7382
  children: [
@@ -7305,14 +7400,14 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7305
7400
  type: "button",
7306
7401
  className: `cc-icon-btn cc-stub-btn${s ? " stub-active" : ""}`,
7307
7402
  title: s ? "Remove stub" : r ? "Convert to stub" : "Add stub",
7308
- onClick: () => le(t, s, n),
7403
+ onClick: () => ce(t, s, n),
7309
7404
  children: "S"
7310
7405
  }),
7311
7406
  c && /* @__PURE__ */ d("button", {
7312
7407
  type: "button",
7313
7408
  className: "cc-icon-btn cc-delete-btn",
7314
7409
  title: r ? "Remove exit" : "Remove stub",
7315
- onClick: () => ce(t, r, n, s),
7410
+ onClick: () => se(t, r, n, s),
7316
7411
  children: "×"
7317
7412
  })
7318
7413
  ]
@@ -7321,7 +7416,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7321
7416
  /* @__PURE__ */ f("div", {
7322
7417
  className: "cc-middle",
7323
7418
  children: [
7324
- r && /* @__PURE__ */ d(Me, {
7419
+ r && /* @__PURE__ */ d(Ne, {
7325
7420
  id: n,
7326
7421
  className: "cc-target"
7327
7422
  }),
@@ -7342,7 +7437,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7342
7437
  })),
7343
7438
  onBlur: (n) => {
7344
7439
  let r = parseInt(n.target.value, 10);
7345
- isNaN(r) || (U(t, r), j((t) => ({
7440
+ isNaN(r) || (W(t, r), j((t) => ({
7346
7441
  ...t,
7347
7442
  [e]: ""
7348
7443
  })));
@@ -7359,7 +7454,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7359
7454
  fromId: l,
7360
7455
  dir: t
7361
7456
  } }),
7362
- children: /* @__PURE__ */ d(rn, {})
7457
+ children: /* @__PURE__ */ d(an, {})
7363
7458
  })]
7364
7459
  })
7365
7460
  ]
@@ -7369,30 +7464,30 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7369
7464
  children: [
7370
7465
  /* @__PURE__ */ d("button", {
7371
7466
  type: "button",
7372
- className: `cc-door-btn ${un[u]}${c ? "" : " cc-dim"}`,
7373
- title: c ? ln[u] : void 0,
7467
+ className: `cc-door-btn ${dn[u]}${c ? "" : " cc-dim"}`,
7468
+ title: c ? un[u] : void 0,
7374
7469
  disabled: !c,
7375
- onClick: c ? () => W(t, u, (u + 1) % 4) : void 0,
7376
- children: /* @__PURE__ */ d($t, {})
7470
+ onClick: c ? () => G(t, u, (u + 1) % 4) : void 0,
7471
+ children: /* @__PURE__ */ d(en, {})
7377
7472
  }),
7378
7473
  /* @__PURE__ */ d("button", {
7379
7474
  type: "button",
7380
7475
  className: `cc-icon-btn${h ? " lock-active" : ""}${c ? "" : " cc-dim"}`,
7381
7476
  title: c ? h ? "Locked — click to unlock" : "Unlocked — click to lock" : void 0,
7382
7477
  disabled: !c,
7383
- onClick: c ? () => se(t, h) : void 0,
7384
- children: /* @__PURE__ */ d(en, { locked: h })
7478
+ onClick: c ? () => oe(t, h) : void 0,
7479
+ children: /* @__PURE__ */ d(tn, { locked: h })
7385
7480
  }),
7386
7481
  /* @__PURE__ */ f("span", {
7387
7482
  className: `cc-weight-wrap${c ? "" : " cc-dim"}`,
7388
- children: [/* @__PURE__ */ d(tn, {}), /* @__PURE__ */ d("input", {
7483
+ children: [/* @__PURE__ */ d(nn, {}), /* @__PURE__ */ d("input", {
7389
7484
  type: "number",
7390
7485
  className: "cc-weight",
7391
7486
  min: 1,
7392
7487
  defaultValue: m,
7393
7488
  disabled: !c,
7394
7489
  title: "Exit weight",
7395
- onBlur: (e) => oe(t, m, Math.max(1, parseInt(e.target.value, 10) || 1)),
7490
+ onBlur: (e) => ae(t, m, Math.max(1, parseInt(e.target.value, 10) || 1)),
7396
7491
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7397
7492
  }, `${l}-${e}-${m}`)]
7398
7493
  })
@@ -7400,7 +7495,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7400
7495
  })
7401
7496
  ]
7402
7497
  }, e);
7403
- }, J = s.current?.reader.getColorValue(a.environment) ?? "rgb(114,1,0)", Se = Object.entries(a.mSpecialExits ?? {}), Ce = Object.entries(a.customLines ?? {});
7498
+ }, Se = s.current?.reader.getColorValue(a.environment) ?? "rgb(114,1,0)", J = Object.entries(a.mSpecialExits ?? {}), Ce = Object.entries(a.customLines ?? {});
7404
7499
  return /* @__PURE__ */ f("div", {
7405
7500
  className: "panel-content",
7406
7501
  children: [
@@ -7427,7 +7522,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7427
7522
  let e = s.current;
7428
7523
  e && (e.renderer.backend.viewport.panToMapPoint(a.x, -a.y), e.refresh());
7429
7524
  },
7430
- children: /* @__PURE__ */ d(nn, {})
7525
+ children: /* @__PURE__ */ d(rn, {})
7431
7526
  })]
7432
7527
  })]
7433
7528
  }),
@@ -7455,7 +7550,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7455
7550
  /* @__PURE__ */ d("button", {
7456
7551
  type: "button",
7457
7552
  className: "env-pick-btn",
7458
- style: { background: J },
7553
+ style: { background: Se },
7459
7554
  onClick: () => C((e) => !e),
7460
7555
  title: `Env ${a.environment} — click to change`
7461
7556
  }),
@@ -7463,7 +7558,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7463
7558
  className: "env-id-label",
7464
7559
  children: ["#", a.environment]
7465
7560
  }),
7466
- S && /* @__PURE__ */ d(Qt, {
7561
+ S && /* @__PURE__ */ d($t, {
7467
7562
  map: o,
7468
7563
  sceneRef: s,
7469
7564
  currentEnvId: a.environment,
@@ -7490,7 +7585,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7490
7585
  title: "Symbol color (stored in userData as system.fallback_symbol_color)",
7491
7586
  onChange: (e) => x(e.target.value),
7492
7587
  onBlur: () => {
7493
- b !== null && ae(b);
7588
+ b !== null && U(b);
7494
7589
  }
7495
7590
  }),
7496
7591
  /* @__PURE__ */ d("button", {
@@ -7499,7 +7594,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7499
7594
  style: { visibility: b === null ? "hidden" : "visible" },
7500
7595
  title: "Clear symbol color",
7501
7596
  onClick: () => {
7502
- x(null), ae(null);
7597
+ x(null), U(null);
7503
7598
  },
7504
7599
  children: "×"
7505
7600
  })
@@ -7510,7 +7605,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7510
7605
  /* @__PURE__ */ d("h4", { children: "Exits" }),
7511
7606
  /* @__PURE__ */ d("div", {
7512
7607
  className: "compass-rose",
7513
- children: on.flat().map((e, t) => e === null ? /* @__PURE__ */ f("div", {
7608
+ children: sn.flat().map((e, t) => e === null ? /* @__PURE__ */ f("div", {
7514
7609
  className: "compass-cell compass-center",
7515
7610
  children: [/* @__PURE__ */ d("button", {
7516
7611
  type: "button",
@@ -7523,7 +7618,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7523
7618
  lock: !a.isLocked
7524
7619
  }, s.current), s.current?.refresh(), D.bumpData();
7525
7620
  },
7526
- children: /* @__PURE__ */ d(en, { locked: a.isLocked })
7621
+ children: /* @__PURE__ */ d(tn, { locked: a.isLocked })
7527
7622
  }), /* @__PURE__ */ d("input", {
7528
7623
  type: "number",
7529
7624
  className: "cc-room-weight",
@@ -7538,13 +7633,13 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7538
7633
  }),
7539
7634
  /* @__PURE__ */ d("div", {
7540
7635
  className: "compass-extra",
7541
- children: sn.flat().map((e, t) => e === null ? /* @__PURE__ */ d("div", { className: "compass-vert-spacer" }, t) : xe(e))
7636
+ children: cn.flat().map((e, t) => e === null ? /* @__PURE__ */ d("div", { className: "compass-vert-spacer" }, t) : xe(e))
7542
7637
  }),
7543
- M !== null && an.includes(M) && be(M),
7638
+ M !== null && on.includes(M) && be(M),
7544
7639
  /* @__PURE__ */ d("h4", { children: "Special Exits" }),
7545
7640
  /* @__PURE__ */ f("div", {
7546
7641
  className: "special-exits-list",
7547
- children: [Se.map(([t, n]) => {
7642
+ children: [J.map(([t, n]) => {
7548
7643
  let r = a.doors?.[t] ?? 0, i = a.exitWeights?.[t] ?? 1, o = !!a.customLines?.[t];
7549
7644
  return /* @__PURE__ */ f(e, { children: [/* @__PURE__ */ f("div", {
7550
7645
  className: `compass-cell has-exit${M === t ? " active" : ""}`,
@@ -7577,7 +7672,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7577
7672
  }),
7578
7673
  /* @__PURE__ */ d("div", {
7579
7674
  className: "cc-middle",
7580
- children: /* @__PURE__ */ d(Me, {
7675
+ children: /* @__PURE__ */ d(Ne, {
7581
7676
  id: n,
7582
7677
  className: "cc-target"
7583
7678
  })
@@ -7587,20 +7682,20 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7587
7682
  children: [
7588
7683
  /* @__PURE__ */ d("button", {
7589
7684
  type: "button",
7590
- className: `cc-door-btn ${un[r]}`,
7591
- title: ln[r],
7592
- onClick: () => fe(t, r, (r + 1) % 4),
7593
- children: /* @__PURE__ */ d($t, {})
7685
+ className: `cc-door-btn ${dn[r]}`,
7686
+ title: un[r],
7687
+ onClick: () => de(t, r, (r + 1) % 4),
7688
+ children: /* @__PURE__ */ d(en, {})
7594
7689
  }),
7595
7690
  /* @__PURE__ */ f("span", {
7596
7691
  className: "cc-weight-wrap",
7597
- children: [/* @__PURE__ */ d(tn, {}), /* @__PURE__ */ d("input", {
7692
+ children: [/* @__PURE__ */ d(nn, {}), /* @__PURE__ */ d("input", {
7598
7693
  type: "number",
7599
7694
  className: "cc-weight",
7600
7695
  min: 1,
7601
7696
  defaultValue: i,
7602
7697
  title: "Exit weight",
7603
- onBlur: (e) => pe(t, i, Math.max(1, parseInt(e.target.value, 10) || 1)),
7698
+ onBlur: (e) => fe(t, i, Math.max(1, parseInt(e.target.value, 10) || 1)),
7604
7699
  onKeyDown: (e) => e.key === "Enter" && e.target.blur()
7605
7700
  }, `${l}-${t}-${i}`)]
7606
7701
  }),
@@ -7608,7 +7703,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7608
7703
  type: "button",
7609
7704
  className: "cc-icon-btn",
7610
7705
  title: "Remove special exit",
7611
- onClick: () => de(t, n),
7706
+ onClick: () => ue(t, n),
7612
7707
  children: "✕"
7613
7708
  })
7614
7709
  ]
@@ -7622,7 +7717,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7622
7717
  placeholder: "exit name",
7623
7718
  value: w,
7624
7719
  onChange: (e) => T(e.target.value),
7625
- onKeyDown: (e) => e.key === "Enter" && E && ue()
7720
+ onKeyDown: (e) => e.key === "Enter" && E && le()
7626
7721
  }),
7627
7722
  /* @__PURE__ */ f("div", {
7628
7723
  className: "cc-exit-add",
@@ -7632,7 +7727,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7632
7727
  placeholder: "#",
7633
7728
  value: E,
7634
7729
  onChange: (e) => k(e.target.value),
7635
- onKeyDown: (e) => e.key === "Enter" && w && ue()
7730
+ onKeyDown: (e) => e.key === "Enter" && w && le()
7636
7731
  }), /* @__PURE__ */ d("button", {
7637
7732
  type: "button",
7638
7733
  className: `cc-pick-btn${p?.kind === "pickSpecialExit" && p.fromId === l ? " picking" : ""}`,
@@ -7644,12 +7739,12 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7644
7739
  fromId: l
7645
7740
  } });
7646
7741
  },
7647
- children: /* @__PURE__ */ d(rn, {})
7742
+ children: /* @__PURE__ */ d(an, {})
7648
7743
  })]
7649
7744
  }),
7650
7745
  /* @__PURE__ */ d("button", {
7651
7746
  type: "button",
7652
- onClick: ue,
7747
+ onClick: le,
7653
7748
  disabled: !w.trim() || !E,
7654
7749
  children: "Add"
7655
7750
  })
@@ -7686,7 +7781,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7686
7781
  /* @__PURE__ */ d("button", {
7687
7782
  type: "button",
7688
7783
  className: "customline-remove",
7689
- onClick: () => me(e),
7784
+ onClick: () => pe(e),
7690
7785
  title: "Remove",
7691
7786
  children: "✕"
7692
7787
  })
@@ -7701,7 +7796,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7701
7796
  sceneRef: s
7702
7797
  }) }, t.id)),
7703
7798
  /* @__PURE__ */ d("h4", { children: "User Data" }),
7704
- /* @__PURE__ */ d(Fe, {
7799
+ /* @__PURE__ */ d(Ie, {
7705
7800
  data: a.userData,
7706
7801
  onCommit: (e, t, n) => {
7707
7802
  Y({
@@ -7718,7 +7813,7 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
7718
7813
  }
7719
7814
  //#endregion
7720
7815
  //#region src/components/SidePanel.tsx
7721
- var fn = [
7816
+ var pn = [
7722
7817
  {
7723
7818
  id: "selection",
7724
7819
  label: "Sel"
@@ -7740,11 +7835,11 @@ var fn = [
7740
7835
  label: "Map"
7741
7836
  }
7742
7837
  ];
7743
- function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7838
+ function mn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7744
7839
  let r = O((e) => e.selection), i = O((e) => e.map), a = O((e) => e.activeTool), o = O((e) => e.pending), s = O((e) => e.sidebarTab), c = O((e) => e.panelCollapsed), l = O((e) => e.undo.length);
7745
7840
  O((e) => e.dataVersion);
7746
7841
  let u = i ? Object.keys(i.mCustomEnvColors).length : 0, p = i ? Object.keys(i.areaNames).length : 0;
7747
- if (a === "customLine" && o?.kind === "customLine") return /* @__PURE__ */ d(Bt, {
7842
+ if (a === "customLine" && o?.kind === "customLine") return /* @__PURE__ */ d(Vt, {
7748
7843
  pending: o,
7749
7844
  sceneRef: e
7750
7845
  });
@@ -7758,7 +7853,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7758
7853
  children: "◀"
7759
7854
  }), /* @__PURE__ */ d("div", {
7760
7855
  className: "side-panel-tabs side-panel-tabs--vert",
7761
- children: [...fn, ...t].map((e) => /* @__PURE__ */ d("button", {
7856
+ children: [...pn, ...t].map((e) => /* @__PURE__ */ d("button", {
7762
7857
  type: "button",
7763
7858
  className: `side-panel-tab${s === e.id ? " active" : ""}`,
7764
7859
  onClick: () => D.setState({
@@ -7828,19 +7923,19 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7828
7923
  });
7829
7924
  if (s === "areas") return /* @__PURE__ */ f("div", {
7830
7925
  className: "side-panel",
7831
- children: [m, /* @__PURE__ */ d(Re, { sceneRef: e })]
7926
+ children: [m, /* @__PURE__ */ d(ze, { sceneRef: e })]
7832
7927
  });
7833
7928
  if (s === "envs") return /* @__PURE__ */ f("div", {
7834
7929
  className: "side-panel",
7835
- children: [m, /* @__PURE__ */ d(Ve, { sceneRef: e })]
7930
+ children: [m, /* @__PURE__ */ d(He, { sceneRef: e })]
7836
7931
  });
7837
7932
  if (s === "history") return /* @__PURE__ */ f("div", {
7838
7933
  className: "side-panel",
7839
- children: [m, /* @__PURE__ */ d(We, { sceneRef: e })]
7934
+ children: [m, /* @__PURE__ */ d(Ge, { sceneRef: e })]
7840
7935
  });
7841
7936
  if (s === "map") return /* @__PURE__ */ f("div", {
7842
7937
  className: "side-panel",
7843
- children: [m, /* @__PURE__ */ d(Je, { sceneRef: e })]
7938
+ children: [m, /* @__PURE__ */ d(Ye, { sceneRef: e })]
7844
7939
  });
7845
7940
  let h = t.find((e) => e.id === s);
7846
7941
  if (h) return /* @__PURE__ */ f("div", {
@@ -7852,7 +7947,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7852
7947
  });
7853
7948
  if (r?.kind === "label") return /* @__PURE__ */ f("div", {
7854
7949
  className: "side-panel",
7855
- children: [m, /* @__PURE__ */ d(Zt, {
7950
+ children: [m, /* @__PURE__ */ d(Qt, {
7856
7951
  selection: r,
7857
7952
  sceneRef: e
7858
7953
  })]
@@ -7861,7 +7956,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7861
7956
  className: "side-panel",
7862
7957
  children: [m, /* @__PURE__ */ d("div", {
7863
7958
  className: "panel-content",
7864
- children: /* @__PURE__ */ d(Ye, {
7959
+ children: /* @__PURE__ */ d(Xe, {
7865
7960
  selection: r,
7866
7961
  map: i,
7867
7962
  sceneRef: e
@@ -7872,7 +7967,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7872
7967
  className: "side-panel",
7873
7968
  children: [m, /* @__PURE__ */ d("div", {
7874
7969
  className: "panel-content",
7875
- children: /* @__PURE__ */ d(Vt, {
7970
+ children: /* @__PURE__ */ d(Ht, {
7876
7971
  selection: r,
7877
7972
  map: i,
7878
7973
  sceneRef: e
@@ -7900,12 +7995,12 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7900
7995
  className: "hint",
7901
7996
  children: "Select a room with the Select tool to edit its properties."
7902
7997
  }),
7903
- /* @__PURE__ */ d(Pe, { activeTool: a })
7998
+ /* @__PURE__ */ d(Fe, { activeTool: a })
7904
7999
  ]
7905
8000
  })]
7906
8001
  }) : /* @__PURE__ */ f("div", {
7907
8002
  className: "side-panel",
7908
- children: [m, /* @__PURE__ */ d(dn, {
8003
+ children: [m, /* @__PURE__ */ d(fn, {
7909
8004
  selection: r,
7910
8005
  room: g,
7911
8006
  map: i,
@@ -7916,7 +8011,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
7916
8011
  }
7917
8012
  //#endregion
7918
8013
  //#region src/components/ContextMenu.tsx
7919
- function mn({ sceneRef: e }) {
8014
+ function hn({ sceneRef: e }) {
7920
8015
  let n = O((e) => e.contextMenu), a = r(null), [o, s] = i(null), [c, l] = i(null);
7921
8016
  if (t(() => {
7922
8017
  if (!n) {
@@ -7974,7 +8069,7 @@ function mn({ sceneRef: e }) {
7974
8069
  if (n.kind === "disambiguate") {
7975
8070
  let t = D.getState(), r = (e) => {
7976
8071
  e.kind === "room" ? D.setState({
7977
- selection: It(e),
8072
+ selection: Lt(e),
7978
8073
  contextMenu: {
7979
8074
  kind: "room",
7980
8075
  roomId: e.id,
@@ -7983,7 +8078,7 @@ function mn({ sceneRef: e }) {
7983
8078
  },
7984
8079
  sidebarTab: "selection"
7985
8080
  }) : e.kind === "label" ? D.setState({
7986
- selection: It(e),
8081
+ selection: Lt(e),
7987
8082
  contextMenu: {
7988
8083
  kind: "label",
7989
8084
  areaId: e.areaId,
@@ -7993,10 +8088,10 @@ function mn({ sceneRef: e }) {
7993
8088
  },
7994
8089
  sidebarTab: "selection"
7995
8090
  }) : D.setState({
7996
- selection: It(e),
8091
+ selection: Lt(e),
7997
8092
  contextMenu: null,
7998
8093
  sidebarTab: "selection",
7999
- status: `Selected ${Lt(e)}`
8094
+ status: `Selected ${Rt(e)}`
8000
8095
  });
8001
8096
  }, i = (n) => {
8002
8097
  if (n.kind === "room") {
@@ -8007,7 +8102,7 @@ function mn({ sceneRef: e }) {
8007
8102
  let t = (e.current?.reader.getLabelSnapshot(n.areaId, n.id))?.text?.trim();
8008
8103
  return t ? `Label: "${t.length > 24 ? t.slice(0, 24) + "…" : t}"` : `Label ${n.id}`;
8009
8104
  }
8010
- return Lt(n);
8105
+ return Rt(n);
8011
8106
  };
8012
8107
  return /* @__PURE__ */ f("div", {
8013
8108
  ref: a,
@@ -8192,7 +8287,7 @@ function mn({ sceneRef: e }) {
8192
8287
  if (!t.map) return u();
8193
8288
  let r = t.map.rooms[n.roomId];
8194
8289
  if (!r) return u();
8195
- let i = { ...r }, a = Ae(t.map, n.roomId);
8290
+ let i = { ...r }, a = je(t.map, n.roomId);
8196
8291
  Y({
8197
8292
  kind: "deleteRoom",
8198
8293
  id: n.roomId,
@@ -8235,7 +8330,7 @@ function mn({ sceneRef: e }) {
8235
8330
  y: o,
8236
8331
  z: c
8237
8332
  }
8238
- }), a.push(...ke(m.map, t, e, n));
8333
+ }), a.push(...Ae(m.map, t, e, n));
8239
8334
  }
8240
8335
  } else {
8241
8336
  o.areaId !== h.area && a.push({
@@ -8258,9 +8353,9 @@ function mn({ sceneRef: e }) {
8258
8353
  y: r,
8259
8354
  z: i
8260
8355
  }
8261
- }), a.push(...ke(m.map, n.roomId, e, s));
8356
+ }), a.push(...Ae(m.map, n.roomId, e, s));
8262
8357
  }
8263
- a.length > 0 && (Ee(a, e.current), e.current?.refresh(), D.bumpStructure(), D.setState({ status: v ? `Moved ${v.length} rooms to area ${o.areaId} (${t}, ${r}, ${i})` : `Moved room ${n.roomId} to area ${o.areaId} (${t}, ${r}, ${i})` }));
8358
+ a.length > 0 && (De(a, e.current), e.current?.refresh(), D.bumpStructure(), D.setState({ status: v ? `Moved ${v.length} rooms to area ${o.areaId} (${t}, ${r}, ${i})` : `Moved room ${n.roomId} to area ${o.areaId} (${t}, ${r}, ${i})` }));
8264
8359
  let s = o.areaId !== (m.currentAreaId ?? h.area), c = i !== m.currentZ;
8265
8360
  D.setState({
8266
8361
  contextMenu: null,
@@ -8385,33 +8480,33 @@ function mn({ sceneRef: e }) {
8385
8480
  }
8386
8481
  //#endregion
8387
8482
  //#region src/editor/session.ts
8388
- var hn = "mudlet-map-editor", $ = "sessions", gn = 2;
8389
- function _n() {
8483
+ var gn = "mudlet-map-editor", $ = "sessions", _n = 2;
8484
+ function vn() {
8390
8485
  return new Promise((e, t) => {
8391
- let n = indexedDB.open(hn, gn);
8486
+ let n = indexedDB.open(gn, _n);
8392
8487
  n.onupgradeneeded = (e) => {
8393
8488
  let t = n.result;
8394
8489
  e.oldVersion < 2 && t.objectStoreNames.contains($) && t.deleteObjectStore($), t.createObjectStore($, { keyPath: "id" });
8395
8490
  }, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
8396
8491
  });
8397
8492
  }
8398
- function vn(e) {
8493
+ function yn(e) {
8399
8494
  let t = {};
8400
8495
  for (let n of Object.values(e.labels)) for (let e of n) e.imageSrc && (t[String(e.id)] = e.imageSrc);
8401
8496
  return t;
8402
8497
  }
8403
- async function yn(e, t, n, r, i, a) {
8498
+ async function bn(e, t, n, r, i, a) {
8404
8499
  let o = H(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
8405
8500
  id: c,
8406
8501
  fileName: e,
8407
8502
  mapBytes: s,
8408
- imageSrcs: vn(t),
8503
+ imageSrcs: yn(t),
8409
8504
  undoStack: n,
8410
8505
  currentAreaId: r,
8411
8506
  currentZ: i,
8412
8507
  savedAt: Date.now(),
8413
8508
  roomCount: Object.keys(t.rooms).length
8414
- }, u = await _n();
8509
+ }, u = await vn();
8415
8510
  return new Promise((e, t) => {
8416
8511
  let n = u.transaction($, "readwrite");
8417
8512
  n.objectStore($).put(l), n.oncomplete = () => {
@@ -8421,8 +8516,8 @@ async function yn(e, t, n, r, i, a) {
8421
8516
  };
8422
8517
  });
8423
8518
  }
8424
- async function bn() {
8425
- let e = await _n();
8519
+ async function xn() {
8520
+ let e = await vn();
8426
8521
  return new Promise((t, n) => {
8427
8522
  let r = e.transaction($, "readonly").objectStore($).getAll();
8428
8523
  r.onsuccess = () => {
@@ -8432,8 +8527,8 @@ async function bn() {
8432
8527
  };
8433
8528
  });
8434
8529
  }
8435
- async function xn() {
8436
- let e = await _n();
8530
+ async function Sn() {
8531
+ let e = await vn();
8437
8532
  return new Promise((t, n) => {
8438
8533
  let r = e.transaction($, "readwrite");
8439
8534
  r.objectStore($).clear(), r.oncomplete = () => {
@@ -8443,8 +8538,8 @@ async function xn() {
8443
8538
  };
8444
8539
  });
8445
8540
  }
8446
- async function Sn(e) {
8447
- let t = await _n();
8541
+ async function Cn(e) {
8542
+ let t = await vn();
8448
8543
  return new Promise((n, r) => {
8449
8544
  let i = t.transaction($, "readwrite");
8450
8545
  i.objectStore($).delete(e), i.oncomplete = () => {
@@ -8454,7 +8549,7 @@ async function Sn(e) {
8454
8549
  };
8455
8550
  });
8456
8551
  }
8457
- function Cn(e) {
8552
+ function wn(e) {
8458
8553
  let t = ie(e.mapBytes);
8459
8554
  if (Object.keys(e.imageSrcs).length > 0) for (let n of Object.values(t.labels)) for (let t of n) {
8460
8555
  let n = e.imageSrcs[String(t.id)];
@@ -8464,10 +8559,10 @@ function Cn(e) {
8464
8559
  }
8465
8560
  //#endregion
8466
8561
  //#region src/components/SessionsPanel.tsx
8467
- var wn = "mudlet-session-autodelete";
8468
- function Tn() {
8562
+ var Tn = "mudlet-session-autodelete";
8563
+ function En() {
8469
8564
  try {
8470
- let e = localStorage.getItem(wn);
8565
+ let e = localStorage.getItem(Tn);
8471
8566
  if (e) return JSON.parse(e);
8472
8567
  } catch {}
8473
8568
  return {
@@ -8475,24 +8570,24 @@ function Tn() {
8475
8570
  days: 30
8476
8571
  };
8477
8572
  }
8478
- function En(e) {
8479
- localStorage.setItem(wn, JSON.stringify(e));
8573
+ function Dn(e) {
8574
+ localStorage.setItem(Tn, JSON.stringify(e));
8480
8575
  }
8481
- function Dn(e, t) {
8576
+ function On(e, t) {
8482
8577
  let n = Date.now() - t * 24 * 60 * 60 * 1e3, r = [];
8483
- for (let t of e) t.savedAt < n ? Sn(t.id).catch(console.error) : r.push(t);
8578
+ for (let t of e) t.savedAt < n ? Cn(t.id).catch(console.error) : r.push(t);
8484
8579
  return r;
8485
8580
  }
8486
- function On() {
8487
- let [e, n] = i([]), [r, a] = i(!1), [o, s] = i(Tn);
8581
+ function kn() {
8582
+ let [e, n] = i([]), [r, a] = i(!1), [o, s] = i(En);
8488
8583
  t(() => {
8489
- let e = Tn();
8490
- bn().then((t) => {
8491
- n(e.enabled ? Dn(t, e.days) : t), a(!0);
8584
+ let e = En();
8585
+ xn().then((t) => {
8586
+ n(e.enabled ? On(t, e.days) : t), a(!0);
8492
8587
  }).catch(() => a(!0));
8493
8588
  }, []);
8494
8589
  let c = (e) => {
8495
- let t = Cn(e);
8590
+ let t = wn(e);
8496
8591
  D.setState({
8497
8592
  map: t,
8498
8593
  loaded: { fileName: e.fileName },
@@ -8508,21 +8603,21 @@ function On() {
8508
8603
  sessionId: e.id
8509
8604
  }), D.bumpStructure();
8510
8605
  }, l = (e) => {
8511
- Sn(e.id).catch(console.error), n((t) => t.filter((t) => t.id !== e.id));
8606
+ Cn(e.id).catch(console.error), n((t) => t.filter((t) => t.id !== e.id));
8512
8607
  }, u = () => {
8513
- xn().catch(console.error), n([]);
8608
+ Sn().catch(console.error), n([]);
8514
8609
  }, p = (e) => {
8515
8610
  let t = {
8516
8611
  ...o,
8517
8612
  enabled: e
8518
8613
  };
8519
- s(t), En(t), e && n((e) => Dn(e, t.days));
8614
+ s(t), Dn(t), e && n((e) => On(e, t.days));
8520
8615
  }, m = (e) => {
8521
8616
  let t = {
8522
8617
  ...o,
8523
8618
  days: e
8524
8619
  };
8525
- s(t), En(t), t.enabled && n((t) => Dn(t, e));
8620
+ s(t), Dn(t), t.enabled && n((t) => On(t, e));
8526
8621
  };
8527
8622
  return r ? e.length === 0 ? /* @__PURE__ */ f("div", {
8528
8623
  className: "empty-state",
@@ -8619,7 +8714,7 @@ function On() {
8619
8714
  }
8620
8715
  //#endregion
8621
8716
  //#region src/components/SwatchPalette.tsx
8622
- function kn({ sceneRef: e }) {
8717
+ function An({ sceneRef: e }) {
8623
8718
  let n = O((e) => e.swatchSets), a = O((e) => e.pluginSwatchSets), o = O((e) => e.activeSwatchSetId), s = O((e) => e.activeSwatchId), c = O((e) => e.map), l = O((e) => e.pending?.kind === "pickSwatch"), [p, m] = i({
8624
8719
  x: 12,
8625
8720
  y: 120
@@ -8685,9 +8780,9 @@ function kn({ sceneRef: e }) {
8685
8780
  E(e.id), A(e.name), M(e.symbol), P(e.environment), I(!1);
8686
8781
  }, H = () => {
8687
8782
  E("new"), A(""), M(""), P(-1), I(!1);
8688
- }, ae = () => {
8689
- E(null), I(!1);
8690
8783
  }, U = () => {
8784
+ E(null), I(!1);
8785
+ }, W = () => {
8691
8786
  if (!R || !T) return;
8692
8787
  let e = k.trim() || "Swatch", t = j.slice(0, 4);
8693
8788
  if (T === "new") {
@@ -8711,7 +8806,7 @@ function kn({ sceneRef: e }) {
8711
8806
  } : n)
8712
8807
  } : n));
8713
8808
  E(null), I(!1);
8714
- }, W = (e) => {
8809
+ }, G = (e) => {
8715
8810
  R && z(n.map((t) => t.id === R.id ? {
8716
8811
  ...t,
8717
8812
  swatches: t.swatches.filter((t) => t.id !== e)
@@ -8861,7 +8956,7 @@ function kn({ sceneRef: e }) {
8861
8956
  className: "swatch-chip-del",
8862
8957
  title: "Delete",
8863
8958
  onClick: (t) => {
8864
- t.stopPropagation(), W(e.id);
8959
+ t.stopPropagation(), G(e.id);
8865
8960
  },
8866
8961
  children: "×"
8867
8962
  })] })
@@ -8891,7 +8986,7 @@ function kn({ sceneRef: e }) {
8891
8986
  value: k,
8892
8987
  onChange: (e) => A(e.target.value),
8893
8988
  onKeyDown: (e) => {
8894
- e.key === "Enter" && U(), e.key === "Escape" && ae();
8989
+ e.key === "Enter" && W(), e.key === "Escape" && U();
8895
8990
  },
8896
8991
  autoFocus: !0
8897
8992
  }),
@@ -8902,7 +8997,7 @@ function kn({ sceneRef: e }) {
8902
8997
  value: j,
8903
8998
  onChange: (e) => M(e.target.value),
8904
8999
  onKeyDown: (e) => {
8905
- e.key === "Enter" && U(), e.key === "Escape" && ae();
9000
+ e.key === "Enter" && W(), e.key === "Escape" && U();
8906
9001
  }
8907
9002
  }),
8908
9003
  /* @__PURE__ */ f("div", {
@@ -8917,7 +9012,7 @@ function kn({ sceneRef: e }) {
8917
9012
  className: "swatch-env-id",
8918
9013
  children: N === -1 ? "−" : N
8919
9014
  })
8920
- }), F && c && /* @__PURE__ */ d(Qt, {
9015
+ }), F && c && /* @__PURE__ */ d($t, {
8921
9016
  map: c,
8922
9017
  sceneRef: e,
8923
9018
  currentEnvId: N,
@@ -8938,14 +9033,14 @@ function kn({ sceneRef: e }) {
8938
9033
  type: "button",
8939
9034
  className: "swatch-edit-ok",
8940
9035
  title: "Save",
8941
- onClick: U,
9036
+ onClick: W,
8942
9037
  children: "✓"
8943
9038
  }),
8944
9039
  /* @__PURE__ */ d("button", {
8945
9040
  type: "button",
8946
9041
  className: "swatch-edit-cancel",
8947
9042
  title: "Cancel",
8948
- onClick: ae,
9043
+ onClick: U,
8949
9044
  children: "✕"
8950
9045
  })
8951
9046
  ]
@@ -8959,14 +9054,14 @@ function kn({ sceneRef: e }) {
8959
9054
  }
8960
9055
  //#endregion
8961
9056
  //#region src/editor/reader/EditorMapReader.ts
8962
- var An = {
9057
+ var jn = {
8963
9058
  1: "solid line",
8964
9059
  2: "dash line",
8965
9060
  3: "dot line",
8966
9061
  4: "dash dot line",
8967
9062
  5: "dash dot dot line"
8968
9063
  };
8969
- function jn(e, t) {
9064
+ function Mn(e, t) {
8970
9065
  let n = {
8971
9066
  id: e,
8972
9067
  __raw: t
@@ -9021,7 +9116,7 @@ function jn(e, t) {
9021
9116
  }), Object.defineProperty(n, "exits", {
9022
9117
  get() {
9023
9118
  let e = {};
9024
- for (let n of me) {
9119
+ for (let n of pe) {
9025
9120
  let r = t[n];
9026
9121
  r !== void 0 && r !== -1 && (e[n] = r);
9027
9122
  }
@@ -9055,7 +9150,7 @@ function jn(e, t) {
9055
9150
  g: 255,
9056
9151
  b: 255
9057
9152
  },
9058
- style: An[t.customLinesStyle?.[r]] ?? "solid line",
9153
+ style: jn[t.customLinesStyle?.[r]] ?? "solid line",
9059
9154
  arrow: t.customLinesArrow?.[r] ?? !1
9060
9155
  }
9061
9156
  };
@@ -9066,7 +9161,7 @@ function jn(e, t) {
9066
9161
  configurable: !0
9067
9162
  }), n;
9068
9163
  }
9069
- function Mn(e) {
9164
+ function Nn(e) {
9070
9165
  let t = {
9071
9166
  north: "south",
9072
9167
  south: "north",
@@ -9132,7 +9227,7 @@ function Mn(e) {
9132
9227
  }
9133
9228
  return r;
9134
9229
  }
9135
- function Nn(e) {
9230
+ function Pn(e) {
9136
9231
  if (!e || e.length === 0) return "";
9137
9232
  if (typeof e == "string") return e.includes(",") ? e.split(",")[1] : e;
9138
9233
  try {
@@ -9141,10 +9236,10 @@ function Nn(e) {
9141
9236
  return "";
9142
9237
  }
9143
9238
  }
9144
- function Pn(e) {
9145
- e.pixMapBase64 === void 0 && (e.pixMapBase64 = Nn(e.pixMap));
9239
+ function Fn(e) {
9240
+ e.pixMapBase64 === void 0 && (e.pixMapBase64 = Pn(e.pixMap));
9146
9241
  }
9147
- function Fn(e, t) {
9242
+ function In(e, t) {
9148
9243
  let n = e.id;
9149
9244
  if (!e.font) {
9150
9245
  let r = t[`system.labelFont_${n}`];
@@ -9153,8 +9248,8 @@ function Fn(e, t) {
9153
9248
  if (t.length >= 4) {
9154
9249
  let n = parseInt(t[1], 10), r = parseInt(t[2], 10), i = r < 100 ? r >= 63 : r >= 600;
9155
9250
  e.font = {
9156
- family: t[0] || pe.family,
9157
- size: isNaN(n) || n <= 0 ? pe.size : n,
9251
+ family: t[0] || fe.family,
9252
+ size: isNaN(n) || n <= 0 ? fe.size : n,
9158
9253
  bold: i,
9159
9254
  italic: t[3] === "1",
9160
9255
  underline: !1,
@@ -9174,7 +9269,7 @@ function Fn(e, t) {
9174
9269
  });
9175
9270
  }
9176
9271
  }
9177
- function In(e, t) {
9272
+ function Ln(e, t) {
9178
9273
  let n = e.id, r = e.font;
9179
9274
  if (r?.family) {
9180
9275
  let e = r.bold ? 75 : 50;
@@ -9185,7 +9280,7 @@ function In(e, t) {
9185
9280
  t[`system.labelOutlineColor_${n}`] = `${r}|${i}|${a}|${o}`;
9186
9281
  } else t[`system.labelOutlineColor_${n}`] = "0|0|0|0";
9187
9282
  }
9188
- function Ln(e) {
9283
+ function Rn(e) {
9189
9284
  return {
9190
9285
  id: e.id,
9191
9286
  pos: [...e.pos],
@@ -9195,13 +9290,13 @@ function Ln(e) {
9195
9290
  bgColor: { ...e.bgColor },
9196
9291
  noScaling: e.noScaling ?? !1,
9197
9292
  showOnTop: e.showOnTop ?? !1,
9198
- font: e.font ? { ...e.font } : { ...pe },
9293
+ font: e.font ? { ...e.font } : { ...fe },
9199
9294
  outlineColor: e.outlineColor ? { ...e.outlineColor } : void 0,
9200
9295
  pixMap: e.pixMapBase64 ? `data:image/png;base64,${e.pixMapBase64}` : "",
9201
9296
  imageSrc: e.imageSrc
9202
9297
  };
9203
9298
  }
9204
- var Rn = class {
9299
+ var zn = class {
9205
9300
  constructor(e, t) {
9206
9301
  this.rooms = e, this.labels = t;
9207
9302
  }
@@ -9231,7 +9326,7 @@ var Rn = class {
9231
9326
  setLabels(e) {
9232
9327
  this.labels = e;
9233
9328
  }
9234
- }, zn = class {
9329
+ }, Bn = class {
9235
9330
  planes = {};
9236
9331
  exits = /* @__PURE__ */ new Map();
9237
9332
  version = 0;
@@ -9299,19 +9394,19 @@ var Rn = class {
9299
9394
  let t = {};
9300
9395
  for (let [n, r] of Object.entries(e)) {
9301
9396
  let e = Number(n);
9302
- t[e] = new Rn(r, this.labels.filter((t) => t.Z === e));
9397
+ t[e] = new zn(r, this.labels.filter((t) => t.Z === e));
9303
9398
  }
9304
9399
  this.planes = t;
9305
9400
  }
9306
9401
  rebuildExits() {
9307
- this.exits = Mn(this.rooms);
9402
+ this.exits = Nn(this.rooms);
9308
9403
  }
9309
9404
  };
9310
- function Bn(e) {
9405
+ function Vn(e) {
9311
9406
  let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
9312
9407
  return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
9313
9408
  }
9314
- var Vn = {
9409
+ var Hn = {
9315
9410
  rgb: [
9316
9411
  114,
9317
9412
  1,
@@ -9324,17 +9419,17 @@ var Vn = {
9324
9419
  225
9325
9420
  ],
9326
9421
  symbolColorValue: "rgb(225,225,225)"
9327
- }, Hn = class {
9422
+ }, Un = class {
9328
9423
  rooms = {};
9329
9424
  areas = {};
9330
9425
  colors = {};
9331
9426
  constructor(e) {
9332
9427
  this.raw = e;
9333
- let { colors: t } = ae(e);
9428
+ let { colors: t } = U(e);
9334
9429
  for (let e of t) this.colors[e.envId] = {
9335
9430
  rgb: e.colors,
9336
9431
  rgbValue: `rgb(${e.colors.join(",")})`,
9337
- symbolColor: Bn(e.colors) > .41 ? [
9432
+ symbolColor: Vn(e.colors) > .41 ? [
9338
9433
  25,
9339
9434
  25,
9340
9435
  25
@@ -9343,19 +9438,19 @@ var Vn = {
9343
9438
  255,
9344
9439
  255
9345
9440
  ],
9346
- symbolColorValue: Bn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9441
+ symbolColorValue: Vn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9347
9442
  };
9348
9443
  for (let [t, n] of Object.entries(e.areas)) {
9349
9444
  let r = Number(t), i = [];
9350
9445
  for (let t of n.rooms) {
9351
9446
  let n = e.rooms[t];
9352
9447
  if (!n) continue;
9353
- let r = jn(t, n);
9448
+ let r = Mn(t, n);
9354
9449
  this.rooms[t] = r, i.push(r);
9355
9450
  }
9356
9451
  let a = e.labels?.[r] ?? [], o = e.areas[r]?.userData ?? {};
9357
- for (let e of a) Pn(e), Fn(e, o);
9358
- this.areas[r] = new zn(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
9452
+ for (let e of a) Fn(e), In(e, o);
9453
+ this.areas[r] = new Bn(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
9359
9454
  }
9360
9455
  }
9361
9456
  toRendererLabel(e, t) {
@@ -9412,10 +9507,10 @@ var Vn = {
9412
9507
  return !1;
9413
9508
  }
9414
9509
  getColorValue(e) {
9415
- return this.colors[e]?.rgbValue ?? Vn.rgbValue;
9510
+ return this.colors[e]?.rgbValue ?? Hn.rgbValue;
9416
9511
  }
9417
9512
  getSymbolColor(e, t) {
9418
- let n = this.colors[e] ?? Vn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
9513
+ let n = this.colors[e] ?? Hn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
9419
9514
  return r === 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
9420
9515
  }
9421
9516
  moveRoom(e, t, n, r) {
@@ -9449,7 +9544,7 @@ var Vn = {
9449
9544
  this.raw.rooms[e] = t;
9450
9545
  let n = this.raw.areas[t.area];
9451
9546
  n && !n.rooms.includes(e) && n.rooms.push(e);
9452
- let r = jn(e, t);
9547
+ let r = Mn(e, t);
9453
9548
  this.rooms[e] = r, this.areas[t.area]?.addRoomLive(r);
9454
9549
  }
9455
9550
  setSpecialExit(e, t, n) {
@@ -9463,7 +9558,7 @@ var Vn = {
9463
9558
  setDoor(e, t, n) {
9464
9559
  let r = this.raw.rooms[e];
9465
9560
  if (!r) return;
9466
- let i = G[t];
9561
+ let i = K[t];
9467
9562
  n === 0 ? delete r.doors[i] : r.doors[i] = n, this.areas[r.area]?.markDirty();
9468
9563
  }
9469
9564
  setSpecialExitDoor(e, t, n) {
@@ -9473,7 +9568,7 @@ var Vn = {
9473
9568
  setExitWeight(e, t, n) {
9474
9569
  let r = this.raw.rooms[e];
9475
9570
  if (!r) return;
9476
- let i = G[t];
9571
+ let i = K[t];
9477
9572
  n <= 1 ? delete r.exitWeights[i] : r.exitWeights[i] = n, this.areas[r.area]?.markDirty();
9478
9573
  }
9479
9574
  setSpecialExitWeight(e, t, n) {
@@ -9483,7 +9578,7 @@ var Vn = {
9483
9578
  setExitLock(e, t, n) {
9484
9579
  let r = this.raw.rooms[e];
9485
9580
  if (!r) return;
9486
- let i = K[t];
9581
+ let i = q[t];
9487
9582
  if (n) r.exitLocks.includes(i) || r.exitLocks.push(i);
9488
9583
  else {
9489
9584
  let e = r.exitLocks.indexOf(i);
@@ -9494,7 +9589,7 @@ var Vn = {
9494
9589
  setStub(e, t, n) {
9495
9590
  let r = this.raw.rooms[e];
9496
9591
  if (!r) return;
9497
- let i = K[t];
9592
+ let i = q[t];
9498
9593
  if (n) r.stubs.includes(i) || r.stubs.push(i);
9499
9594
  else {
9500
9595
  let e = r.stubs.indexOf(i);
@@ -9510,7 +9605,7 @@ var Vn = {
9510
9605
  }
9511
9606
  setCustomLine(e, t, n, r, i, a) {
9512
9607
  let o = this.raw.rooms[e];
9513
- o && (o.customLines[t] = n, o.customLinesColor[t] = r, o.customLinesStyle[t] = i, o.customLinesArrow[t] = a, this.areas[o.area]?.markDirty());
9608
+ o && (o.customLines[t] = n.map((e) => [e[0], e[1]]), o.customLinesColor[t] = r, o.customLinesStyle[t] = i, o.customLinesArrow[t] = a, this.areas[o.area]?.markDirty());
9514
9609
  }
9515
9610
  removeCustomLine(e, t) {
9516
9611
  let n = this.raw.rooms[e];
@@ -9545,7 +9640,7 @@ var Vn = {
9545
9640
  isZone: !1,
9546
9641
  zoneAreaRef: -1,
9547
9642
  userData: {}
9548
- }, this.raw.areaNames[e] = t, this.areas[e] = new zn(e, t, [], []);
9643
+ }, this.raw.areaNames[e] = t, this.areas[e] = new Bn(e, t, [], []);
9549
9644
  }
9550
9645
  removeArea(e) {
9551
9646
  delete this.raw.areas[e], delete this.raw.areaNames[e], delete this.areas[e];
@@ -9573,11 +9668,11 @@ var Vn = {
9573
9668
  }
9574
9669
  setCustomEnvColor(e, t) {
9575
9670
  t === null ? delete this.raw.mCustomEnvColors[e] : this.raw.mCustomEnvColors[e] = t;
9576
- let { colors: n } = ae(this.raw);
9671
+ let { colors: n } = U(this.raw);
9577
9672
  for (let e of n) this.colors[e.envId] = {
9578
9673
  rgb: e.colors,
9579
9674
  rgbValue: `rgb(${e.colors.join(",")})`,
9580
- symbolColor: Bn(e.colors) > .41 ? [
9675
+ symbolColor: Vn(e.colors) > .41 ? [
9581
9676
  25,
9582
9677
  25,
9583
9678
  25
@@ -9586,17 +9681,17 @@ var Vn = {
9586
9681
  255,
9587
9682
  255
9588
9683
  ],
9589
- symbolColorValue: Bn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9684
+ symbolColorValue: Vn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
9590
9685
  };
9591
9686
  t === null && delete this.colors[e];
9592
9687
  }
9593
9688
  getLabelSnapshot(e, t) {
9594
9689
  let n = this.raw.labels[e]?.find((e) => e.id === t);
9595
- return n ? Ln(n) : null;
9690
+ return n ? Rn(n) : null;
9596
9691
  }
9597
9692
  addLabel(e, t) {
9598
9693
  this.raw.labels[e] || (this.raw.labels[e] = []);
9599
- let n = t.pixMap || Wt(t), r = {
9694
+ let n = t.pixMap || Gt(t), r = {
9600
9695
  id: t.id,
9601
9696
  labelId: t.id,
9602
9697
  areaId: e,
@@ -9605,7 +9700,7 @@ var Vn = {
9605
9700
  text: t.text,
9606
9701
  fgColor: { ...t.fgColor },
9607
9702
  bgColor: { ...t.bgColor },
9608
- pixMap: Gt(n),
9703
+ pixMap: Kt(n),
9609
9704
  pixMapBase64: n.includes(",") ? n.split(",")[1] : n,
9610
9705
  noScaling: t.noScaling,
9611
9706
  showOnTop: t.showOnTop,
@@ -9614,7 +9709,7 @@ var Vn = {
9614
9709
  };
9615
9710
  this.raw.labels[e].push(r);
9616
9711
  let i = this.raw.areas[e]?.userData;
9617
- i && In(r, i), this.syncRendererLabels(e);
9712
+ i && Ln(r, i), this.syncRendererLabels(e);
9618
9713
  }
9619
9714
  removeLabel(e, t) {
9620
9715
  if (!this.raw.labels[e]) return;
@@ -9636,7 +9731,7 @@ var Vn = {
9636
9731
  }
9637
9732
  setLabelPixmap(e, t, n) {
9638
9733
  let r = this.raw.labels[e]?.find((e) => e.id === t);
9639
- r && (r.pixMap = Gt(n), r.pixMapBase64 = n.includes(",") ? n.split(",")[1] : n, this.syncRendererLabels(e));
9734
+ r && (r.pixMap = Kt(n), r.pixMapBase64 = n.includes(",") ? n.split(",")[1] : n, this.syncRendererLabels(e));
9640
9735
  }
9641
9736
  setLabelImageSrc(e, t, n) {
9642
9737
  let r = this.raw.labels[e]?.find((e) => e.id === t);
@@ -9647,14 +9742,14 @@ var Vn = {
9647
9742
  if (!r) return;
9648
9743
  r.font = { ...n };
9649
9744
  let i = this.raw.areas[e]?.userData;
9650
- i && In(r, i), this.syncRendererLabels(e);
9745
+ i && Ln(r, i), this.syncRendererLabels(e);
9651
9746
  }
9652
9747
  setLabelOutlineColor(e, t, n) {
9653
9748
  let r = this.raw.labels[e]?.find((e) => e.id === t);
9654
9749
  if (!r) return;
9655
9750
  r.outlineColor = n ? { ...n } : void 0;
9656
9751
  let i = this.raw.areas[e]?.userData;
9657
- i && In(r, i), this.syncRendererLabels(e);
9752
+ i && Ln(r, i), this.syncRendererLabels(e);
9658
9753
  }
9659
9754
  setLabelNoScaling(e, t, n) {
9660
9755
  let r = this.raw.labels[e]?.find((e) => e.id === t);
@@ -9685,10 +9780,10 @@ var Vn = {
9685
9780
  restoreAreaWithRooms(e, t, n, r) {
9686
9781
  let i = [];
9687
9782
  for (let { id: e, room: t } of n) {
9688
- let n = jn(e, t);
9783
+ let n = Mn(e, t);
9689
9784
  this.rooms[e] = n, i.push(n);
9690
9785
  }
9691
- this.areas[e] = new zn(e, t, i, []);
9786
+ this.areas[e] = new Bn(e, t, i, []);
9692
9787
  for (let e of r) {
9693
9788
  let t = this.areas[e];
9694
9789
  t && (t.rebuildExits(), t.markDirty());
@@ -9699,7 +9794,7 @@ var Vn = {
9699
9794
  if (!t) return;
9700
9795
  for (let t of Object.keys(this.raw.rooms)) {
9701
9796
  let n = this.raw.rooms[Number(t)];
9702
- if (n) for (let t of me) n[t] === e && (n[t] = -1);
9797
+ if (n) for (let t of pe) n[t] === e && (n[t] = -1);
9703
9798
  }
9704
9799
  let n = t.area;
9705
9800
  delete this.raw.rooms[e];
@@ -9727,7 +9822,7 @@ var Vn = {
9727
9822
  }
9728
9823
  for (let e of this.getAreas()) n.has(e.getAreaId()) || e.rebuildExits();
9729
9824
  }
9730
- }, Un = class {
9825
+ }, Wn = class {
9731
9826
  rects = /* @__PURE__ */ new Map();
9732
9827
  layer;
9733
9828
  unsubscribe;
@@ -9771,7 +9866,7 @@ var Vn = {
9771
9866
  }
9772
9867
  this.layer.batchDraw();
9773
9868
  }
9774
- }, Wn = "#ffcc00", Gn = .9, Kn = .3, qn = .2, Jn = class {
9869
+ }, Gn = "#ffcc00", Kn = .9, qn = .3, Jn = .2, Yn = class {
9775
9870
  roomRect;
9776
9871
  linkGroup;
9777
9872
  layer;
@@ -9782,7 +9877,7 @@ var Vn = {
9782
9877
  }
9783
9878
  attach(e) {
9784
9879
  this.layer = e, this.roomRect = new h.Rect({
9785
- stroke: Wn,
9880
+ stroke: Gn,
9786
9881
  strokeWidth: .06,
9787
9882
  listening: !1,
9788
9883
  visible: !1,
@@ -9830,23 +9925,23 @@ var Vn = {
9830
9925
  }
9831
9926
  for (let t of e.data.lines) this.linkGroup.add(new h.Line({
9832
9927
  points: [...t.points],
9833
- stroke: Wn,
9928
+ stroke: Gn,
9834
9929
  strokeWidth: r,
9835
9930
  dash: t.dash ? [...t.dash] : void 0,
9836
9931
  listening: !1,
9837
9932
  lineCap: "round",
9838
- opacity: Gn
9933
+ opacity: Kn
9839
9934
  }));
9840
9935
  for (let t of e.data.arrows) this.linkGroup.add(new h.Arrow({
9841
9936
  points: [...t.points],
9842
- stroke: Wn,
9843
- fill: Wn,
9937
+ stroke: Gn,
9938
+ fill: Gn,
9844
9939
  strokeWidth: r,
9845
9940
  dash: t.dash ? [...t.dash] : void 0,
9846
9941
  pointerLength: t.pointerLength,
9847
9942
  pointerWidth: t.pointerWidth,
9848
9943
  listening: !1,
9849
- opacity: Gn
9944
+ opacity: Kn
9850
9945
  }));
9851
9946
  this.linkGroup.visible(!0);
9852
9947
  } else if (t.kind === "customLine") {
@@ -9857,33 +9952,33 @@ var Vn = {
9857
9952
  }
9858
9953
  let i = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
9859
9954
  points: [...e.points],
9860
- stroke: Wn,
9861
- fill: Wn,
9955
+ stroke: Gn,
9956
+ fill: Gn,
9862
9957
  strokeWidth: r,
9863
9958
  dash: e.dash ? [...e.dash] : void 0,
9864
- pointerLength: Kn,
9865
- pointerWidth: qn,
9959
+ pointerLength: qn,
9960
+ pointerWidth: Jn,
9866
9961
  listening: !1,
9867
9962
  lineCap: "round",
9868
9963
  lineJoin: "round",
9869
- opacity: Gn
9964
+ opacity: Kn
9870
9965
  }) : new h.Line({
9871
9966
  points: [...e.points],
9872
- stroke: Wn,
9967
+ stroke: Gn,
9873
9968
  strokeWidth: r,
9874
9969
  dash: e.dash ? [...e.dash] : void 0,
9875
9970
  listening: !1,
9876
9971
  lineCap: "round",
9877
9972
  lineJoin: "round",
9878
- opacity: Gn
9973
+ opacity: Kn
9879
9974
  });
9880
9975
  this.linkGroup.add(i), this.linkGroup.visible(!0);
9881
9976
  }
9882
9977
  this.layer.batchDraw();
9883
9978
  }
9884
- }, Yn = .6;
9885
- function Xn(e) {
9886
- for (let [t, n, r] of at) if (r === e) return {
9979
+ }, Xn = .6;
9980
+ function Zn(e) {
9981
+ for (let [t, n, r] of ot) if (r === e) return {
9887
9982
  ox: t,
9888
9983
  oy: n
9889
9984
  };
@@ -9892,7 +9987,7 @@ function Xn(e) {
9892
9987
  oy: 0
9893
9988
  };
9894
9989
  }
9895
- var Zn = class {
9990
+ var Qn = class {
9896
9991
  line;
9897
9992
  dirLabel;
9898
9993
  layer;
@@ -9939,22 +10034,22 @@ var Zn = class {
9939
10034
  }
9940
10035
  let r = n.getRenderRoom(t.sourceId);
9941
10036
  if (!r) return;
9942
- let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? Yn) / 2, o = r.x, s = r.y;
10037
+ let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? Xn) / 2, o = r.x, s = r.y;
9943
10038
  if (t.sourceDir) {
9944
- let { ox: e, oy: n } = Xn(t.sourceDir);
10039
+ let { ox: e, oy: n } = Zn(t.sourceDir);
9945
10040
  o = r.x + e * a, s = r.y + n * a;
9946
10041
  }
9947
10042
  let c, l;
9948
10043
  if (i && t.targetDir) {
9949
- let { ox: e, oy: n } = Xn(t.targetDir);
10044
+ let { ox: e, oy: n } = Zn(t.targetDir);
9950
10045
  c = i.x + e * a, l = i.y + n * a;
9951
10046
  } else i ? (c = i.x, l = i.y) : (c = t.cursorMap?.x ?? r.x, l = t.cursorMap?.y ?? r.y);
9952
10047
  let u = !0, d = "";
9953
10048
  if (i && i !== r) {
9954
- let n = t.sourceDir ?? xe(r.x, r.y, i.x, i.y);
9955
- if (!Ce(n)) u = !1, d = `${n}?`;
10049
+ let n = t.sourceDir ?? Se(r.x, r.y, i.x, i.y);
10050
+ if (!we(n)) u = !1, d = `${n}?`;
9956
10051
  else {
9957
- d = `${n} / ${t.targetDir ?? he[n]}`;
10052
+ d = `${n} / ${t.targetDir ?? me[n]}`;
9958
10053
  let r = e.map.rooms[t.sourceId], i = r ? J(r, n) : -1;
9959
10054
  i !== -1 && i !== t.hoverTargetId && (u = !1);
9960
10055
  }
@@ -9967,7 +10062,7 @@ var Zn = class {
9967
10062
  l
9968
10063
  ]), this.line.stroke(f), this.line.fill(f), this.line.visible(!0), d ? (this.dirLabel.text(d), this.dirLabel.fill(f), this.dirLabel.x((o + c) / 2 + .2), this.dirLabel.y((s + l) / 2 + .2), this.dirLabel.visible(!0)) : this.dirLabel.visible(!1), this.layer.batchDraw();
9969
10064
  }
9970
- }, Qn = class {
10065
+ }, $n = class {
9971
10066
  rect;
9972
10067
  layer;
9973
10068
  unsubscribe;
@@ -10003,7 +10098,7 @@ var Zn = class {
10003
10098
  }
10004
10099
  this.rect.x(t.x), this.rect.y(t.y), this.rect.visible(!0), this.layer.batchDraw();
10005
10100
  }
10006
- }, $n = class {
10101
+ }, er = class {
10007
10102
  source;
10008
10103
  target;
10009
10104
  layer;
@@ -10027,7 +10122,7 @@ var Zn = class {
10027
10122
  listening: !1,
10028
10123
  visible: !1
10029
10124
  }), t = /* @__PURE__ */ new Map();
10030
- for (let [, , n] of at) {
10125
+ for (let [, , n] of ot) {
10031
10126
  let r = new h.Circle({
10032
10127
  radius: this.roomSize * .12,
10033
10128
  fill: "rgba(143, 184, 255, 0.85)",
@@ -10044,7 +10139,7 @@ var Zn = class {
10044
10139
  }
10045
10140
  placeHandles(e, t, n, r) {
10046
10141
  let i = this.roomSize / 2, a = r === "drag-source" || r === "drag-target" ? "#7fff9f" : "#ffd27f", o = r === "drag-source" || r === "drag-target" ? "#ffffff" : "#cfe1ff";
10047
- for (let [r, s, c] of at) {
10142
+ for (let [r, s, c] of ot) {
10048
10143
  let l = e.handles.get(c);
10049
10144
  l.x(t.x + r * i), l.y(t.y + s * i), l.fill(c === n ? a : "rgba(143, 184, 255, 0.85)"), l.stroke(c === n ? o : "#cfe1ff");
10050
10145
  }
@@ -10081,7 +10176,7 @@ var Zn = class {
10081
10176
  }
10082
10177
  this.layer.batchDraw();
10083
10178
  }
10084
- }, er = "rgba(255, 220, 60, 0.9)", tr = .55, nr = class {
10179
+ }, tr = "rgba(255, 220, 60, 0.9)", nr = .55, rr = class {
10085
10180
  group;
10086
10181
  layer;
10087
10182
  unsubscribe;
@@ -10154,14 +10249,14 @@ var Zn = class {
10154
10249
  if (o) {
10155
10250
  let t = this.resolveTargetRoom(e, o.roomId, o.exitName);
10156
10251
  if (t) {
10157
- let { x: e, y: n } = t, r = tr, i = new h.Line({
10252
+ let { x: e, y: n } = t, r = nr, i = new h.Line({
10158
10253
  points: [
10159
10254
  e - r,
10160
10255
  n,
10161
10256
  e + r,
10162
10257
  n
10163
10258
  ],
10164
- stroke: er,
10259
+ stroke: tr,
10165
10260
  strokeWidth: a,
10166
10261
  listening: !1,
10167
10262
  lineCap: "round"
@@ -10172,7 +10267,7 @@ var Zn = class {
10172
10267
  e,
10173
10268
  n + r
10174
10269
  ],
10175
- stroke: er,
10270
+ stroke: tr,
10176
10271
  strokeWidth: a,
10177
10272
  listening: !1,
10178
10273
  lineCap: "round"
@@ -10187,7 +10282,7 @@ var Zn = class {
10187
10282
  if (!r || !i) return null;
10188
10283
  let a = i.rooms[t];
10189
10284
  if (!a) return null;
10190
- let o, s = ge[n];
10285
+ let o, s = _e[n];
10191
10286
  if (s) {
10192
10287
  let e = J(a, s);
10193
10288
  e > 0 && (o = e);
@@ -10202,11 +10297,11 @@ var Zn = class {
10202
10297
  y: c.y
10203
10298
  };
10204
10299
  }
10205
- }, rr = "#00e5ff", ir = {
10206
- shadowColor: rr,
10300
+ }, ir = "#00e5ff", ar = {
10301
+ shadowColor: ir,
10207
10302
  shadowBlur: 4,
10208
10303
  shadowOpacity: .8
10209
- }, ar = .3, or = .2, sr = class {
10304
+ }, or = .3, sr = .2, cr = class {
10210
10305
  group;
10211
10306
  layer;
10212
10307
  unsubscribe;
@@ -10244,22 +10339,22 @@ var Zn = class {
10244
10339
  }
10245
10340
  for (let t of e.data.lines) this.group.add(new h.Line({
10246
10341
  points: [...t.points],
10247
- stroke: rr,
10342
+ stroke: ir,
10248
10343
  strokeWidth: .08,
10249
10344
  dash: t.dash ? [...t.dash] : void 0,
10250
10345
  listening: !1,
10251
- ...ir
10346
+ ...ar
10252
10347
  }));
10253
10348
  for (let t of e.data.arrows) this.group.add(new h.Arrow({
10254
10349
  points: [...t.points],
10255
- stroke: rr,
10256
- fill: rr,
10350
+ stroke: ir,
10351
+ fill: ir,
10257
10352
  strokeWidth: .08,
10258
10353
  dash: t.dash ? [...t.dash] : void 0,
10259
10354
  pointerLength: t.pointerLength,
10260
10355
  pointerWidth: t.pointerWidth,
10261
10356
  listening: !1,
10262
- ...ir
10357
+ ...ar
10263
10358
  }));
10264
10359
  this.group.visible(!0), this.layer.batchDraw();
10265
10360
  return;
@@ -10272,28 +10367,28 @@ var Zn = class {
10272
10367
  }
10273
10368
  let r = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
10274
10369
  points: [...e.points],
10275
- stroke: rr,
10276
- fill: rr,
10370
+ stroke: ir,
10371
+ fill: ir,
10277
10372
  strokeWidth: .08,
10278
10373
  dash: e.dash ? [...e.dash] : void 0,
10279
- pointerLength: ar,
10280
- pointerWidth: or,
10374
+ pointerLength: or,
10375
+ pointerWidth: sr,
10281
10376
  listening: !1,
10282
- ...ir
10377
+ ...ar
10283
10378
  }) : new h.Line({
10284
10379
  points: [...e.points],
10285
- stroke: rr,
10380
+ stroke: ir,
10286
10381
  strokeWidth: .08,
10287
10382
  dash: e.dash ? [...e.dash] : void 0,
10288
10383
  listening: !1,
10289
- ...ir
10384
+ ...ar
10290
10385
  });
10291
10386
  this.group.add(r), this.group.add(new h.Circle({
10292
10387
  x: e.points[0],
10293
10388
  y: e.points[1],
10294
10389
  radius: .1,
10295
10390
  fill: "#1a2030",
10296
- stroke: rr,
10391
+ stroke: ir,
10297
10392
  strokeWidth: .04,
10298
10393
  listening: !1
10299
10394
  }));
@@ -10304,8 +10399,8 @@ var Zn = class {
10304
10399
  x: e.points[t],
10305
10400
  y: e.points[t + 1],
10306
10401
  radius: r ? .14 : .1,
10307
- fill: r ? "#ffffff" : rr,
10308
- stroke: r ? rr : "#ffffff",
10402
+ fill: r ? "#ffffff" : ir,
10403
+ stroke: r ? ir : "#ffffff",
10309
10404
  strokeWidth: r ? .06 : .04,
10310
10405
  listening: !1
10311
10406
  }));
@@ -10318,13 +10413,13 @@ var Zn = class {
10318
10413
  };
10319
10414
  //#endregion
10320
10415
  //#region src/editor/effects/GridOverlayEffect.ts
10321
- function cr(e, t) {
10416
+ function lr(e, t) {
10322
10417
  let n = e.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);
10323
10418
  if (!n) return e;
10324
10419
  let r = n[4] === void 0 ? 1 : parseFloat(n[4]);
10325
10420
  return `rgba(${n[1]}, ${n[2]}, ${n[3]}, ${Math.min(1, r * t)})`;
10326
10421
  }
10327
- var lr = class {
10422
+ var ur = class {
10328
10423
  gridShape;
10329
10424
  axisShape;
10330
10425
  labelShape;
@@ -10356,7 +10451,7 @@ var lr = class {
10356
10451
  }), this.axisShape = new h.Shape({
10357
10452
  listening: !1,
10358
10453
  visible: !1,
10359
- stroke: cr(this.gridColor, 2),
10454
+ stroke: lr(this.gridColor, 2),
10360
10455
  strokeWidth: this.gridLineWidth * 2,
10361
10456
  sceneFunc: (e, t) => {
10362
10457
  let { minX: n, maxX: r, minY: i, maxY: a } = this.bounds;
@@ -10370,7 +10465,7 @@ var lr = class {
10370
10465
  text: "(0,0)",
10371
10466
  fontSize: this.gridSize,
10372
10467
  fontFamily: "monospace",
10373
- fill: cr(this.gridColor, 2)
10468
+ fill: lr(this.gridColor, 2)
10374
10469
  }), e.add(this.gridShape), e.add(this.axisShape), e.add(this.labelShape), this.unsubscribe = D.subscribe(() => this.syncVisibility());
10375
10470
  }
10376
10471
  updateViewport(e, t, n) {
@@ -10384,7 +10479,7 @@ var lr = class {
10384
10479
  let e = this.getIsEmpty();
10385
10480
  e && (this.bounds = this.getViewportBounds()), this.gridShape.visible() !== e && (this.gridShape.visible(e), this.axisShape.visible(e), this.labelShape.visible(e), this.layer.batchDraw());
10386
10481
  }
10387
- }, ur = class {
10482
+ }, dr = class {
10388
10483
  rect;
10389
10484
  layer;
10390
10485
  unsubscribe;
@@ -10418,7 +10513,7 @@ var lr = class {
10418
10513
  };
10419
10514
  //#endregion
10420
10515
  //#region src/editor/effects/LabelHaloEffect.ts
10421
- function dr(e, t, n, r) {
10516
+ function fr(e, t, n, r) {
10422
10517
  return [
10423
10518
  {
10424
10519
  id: "nw",
@@ -10462,7 +10557,7 @@ function dr(e, t, n, r) {
10462
10557
  }
10463
10558
  ];
10464
10559
  }
10465
- var fr = class {
10560
+ var pr = class {
10466
10561
  selRect;
10467
10562
  hoverRect;
10468
10563
  previewRect;
@@ -10552,7 +10647,7 @@ var fr = class {
10552
10647
  for (let e of this.handles) e.visible(!1);
10553
10648
  return;
10554
10649
  }
10555
- let t = .05, n = e.x - t, r = e.y - t, i = e.w + t * 2, a = e.h + t * 2, o = this.handleSize, s = dr(n, r, i, a);
10650
+ let t = .05, n = e.x - t, r = e.y - t, i = e.w + t * 2, a = e.h + t * 2, o = this.handleSize, s = fr(n, r, i, a);
10556
10651
  for (let e = 0; e < this.handles.length; e++) {
10557
10652
  let t = this.handles[e], n = s[e];
10558
10653
  t.x(n.x - o / 2), t.y(n.y - o / 2), t.width(o), t.height(o), t.visible(!0);
@@ -10574,10 +10669,10 @@ var fr = class {
10574
10669
  };
10575
10670
  //#endregion
10576
10671
  //#region src/editor/pointerController.ts
10577
- function pr(e) {
10672
+ function mr(e) {
10578
10673
  let { container: t } = e, n = null, r = null, i = D.getState().spaceHeld, a = D.subscribe((r) => {
10579
10674
  if (!i && r.spaceHeld && n !== null) {
10580
- Ft[r.activeTool].onCancel?.(e);
10675
+ It[r.activeTool].onCancel?.(e);
10581
10676
  try {
10582
10677
  t.releasePointerCapture(n);
10583
10678
  } catch {}
@@ -10595,7 +10690,7 @@ function pr(e) {
10595
10690
  e.renderer.backend.viewport.startDrag(i.clientX - n.left, i.clientY - n.top), r = i.pointerId, t.setPointerCapture(i.pointerId), o(i);
10596
10691
  return;
10597
10692
  }
10598
- let a = D.getState().pending?.kind, l = Ft[a === "pickSwatch" || a === "pickExit" || a === "pickSpecialExit" ? "select" : s()];
10693
+ let a = D.getState().pending?.kind, l = It[a === "pickSwatch" || a === "pickExit" || a === "pickSpecialExit" ? "select" : s()];
10599
10694
  !l.onPointerDown || !c(i) || l.onPointerDown(i, e) && (n = i.pointerId, o(i));
10600
10695
  }, u = (i) => {
10601
10696
  if (r === i.pointerId) {
@@ -10603,7 +10698,7 @@ function pr(e) {
10603
10698
  e.renderer.backend.viewport.updateDrag(i.clientX - n.left, i.clientY - n.top), e.refresh(), o(i);
10604
10699
  return;
10605
10700
  }
10606
- (Ft[s()].onPointerMove?.(i, e) || n === i.pointerId) && o(i);
10701
+ (It[s()].onPointerMove?.(i, e) || n === i.pointerId) && o(i);
10607
10702
  }, d = (i) => {
10608
10703
  if (r === i.pointerId) {
10609
10704
  e.renderer.backend.viewport.endDrag();
@@ -10613,14 +10708,14 @@ function pr(e) {
10613
10708
  r = null, o(i);
10614
10709
  return;
10615
10710
  }
10616
- let a = Ft[s()].onPointerUp?.(i, e), c = n === i.pointerId;
10711
+ let a = It[s()].onPointerUp?.(i, e), c = n === i.pointerId;
10617
10712
  c && (n = null), (a || c) && o(i);
10618
10713
  }, f = (t) => {
10619
10714
  if (r === t.pointerId) {
10620
10715
  e.renderer.backend.viewport.endDrag(), r = null;
10621
10716
  return;
10622
10717
  }
10623
- Ft[s()].onCancel?.(e), n === t.pointerId && (n = null, o(t));
10718
+ It[s()].onCancel?.(e), n === t.pointerId && (n = null, o(t));
10624
10719
  }, p = () => {
10625
10720
  D.getState().hover && D.setState({ hover: null });
10626
10721
  }, m = (e) => {
@@ -10632,7 +10727,7 @@ function pr(e) {
10632
10727
  }, h = (e) => {
10633
10728
  e.button !== 1 && (e.button === 0 || e.button === 2) && s() !== "pan" && o(e);
10634
10729
  }, g = (t) => {
10635
- t.preventDefault(), Ft[s()].onContextMenu?.(t, e);
10730
+ t.preventDefault(), It[s()].onContextMenu?.(t, e);
10636
10731
  }, _ = { capture: !0 };
10637
10732
  return t.addEventListener("pointerdown", l, _), t.addEventListener("pointermove", u, _), t.addEventListener("pointerup", d, _), t.addEventListener("pointercancel", f, _), t.addEventListener("pointerleave", p), t.addEventListener("mousedown", m, _), t.addEventListener("mouseup", h, _), t.addEventListener("contextmenu", g), () => {
10638
10733
  a(), t.removeEventListener("pointerdown", l, _), t.removeEventListener("pointermove", u, _), t.removeEventListener("pointerup", d, _), t.removeEventListener("pointercancel", f, _), t.removeEventListener("pointerleave", p), t.removeEventListener("mousedown", m, _), t.removeEventListener("mouseup", h, _), t.removeEventListener("contextmenu", g);
@@ -10640,10 +10735,10 @@ function pr(e) {
10640
10735
  }
10641
10736
  //#endregion
10642
10737
  //#region src/editor/scene.ts
10643
- function mr(e, t) {
10738
+ function hr(e, t) {
10644
10739
  let n = m();
10645
10740
  n.gridEnabled = !0, n.highlightCurrentRoom = !1, n.areaName = !1, n.labelRenderMode = "image", t.dataset.editorCursor = "true";
10646
- let r = new Hn(e), i = new p(r, n, t), a = { current: null }, o = new ur(), s = new Un(n.roomSize, a), c = new Jn(n.roomSize, a), l = new Zn(a), u = new Qn(n.roomSize), d = new $n(n.roomSize, a), f = new nr(a), h = new sr(a, n.roomSize), g = new fr(a), _ = new lr(n.gridColor, n.gridLineWidth, n.gridSize, () => {
10741
+ let r = new Un(e), i = new p(r, n, t), a = { current: null }, o = new dr(), s = new Wn(n.roomSize, a), c = new Yn(n.roomSize, a), l = new Qn(a), u = new $n(n.roomSize), d = new er(n.roomSize, a), f = new rr(a), h = new cr(a, n.roomSize), g = new pr(a), _ = new ur(n.gridColor, n.gridLineWidth, n.gridSize, () => {
10647
10742
  let e = D.getState();
10648
10743
  if (e.currentAreaId == null) return !1;
10649
10744
  let t = r.getArea(e.currentAreaId);
@@ -10673,7 +10768,7 @@ function mr(e, t) {
10673
10768
  }
10674
10769
  };
10675
10770
  a.current = v;
10676
- let y = pr({
10771
+ let y = mr({
10677
10772
  renderer: i,
10678
10773
  container: t,
10679
10774
  settings: n,
@@ -10684,12 +10779,12 @@ function mr(e, t) {
10684
10779
  }
10685
10780
  //#endregion
10686
10781
  //#region src/App.tsx
10687
- var hr = {
10782
+ var gr = {
10688
10783
  top: 104,
10689
10784
  right: 464,
10690
10785
  bottom: 24,
10691
10786
  left: 24
10692
- }, gr = {
10787
+ }, _r = {
10693
10788
  1: "select",
10694
10789
  2: "connect",
10695
10790
  3: "unlink",
@@ -10698,7 +10793,7 @@ var hr = {
10698
10793
  6: "delete",
10699
10794
  7: "pan",
10700
10795
  8: "paint"
10701
- }, _r = {
10796
+ }, vr = {
10702
10797
  ArrowLeft: {
10703
10798
  dx: -1,
10704
10799
  dy: 0
@@ -10716,7 +10811,7 @@ var hr = {
10716
10811
  dy: -1
10717
10812
  }
10718
10813
  };
10719
- function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10814
+ function yr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10720
10815
  let s = r(null), c = r(null), l = O((e) => e.map), u = O((e) => e.swatchPaletteOpen), p = l != null, m = O((e) => e.currentAreaId), h = O((e) => e.currentZ), g = O((e) => e.activeTool), _ = O((e) => e.pending), v = O((e) => e.hover), y = O((e) => e.spaceHeld), b = O((e) => e.panelCollapsed), x = O((e) => e.dataVersion), C = O((e) => e.panRequest), [w, T] = i(!1), [E, k] = i(!1), [A, j] = i(() => new URLSearchParams(window.location.search).get("map")), M = n(() => a.flatMap((e) => e.swatchSets?.() ?? []), [a]), N = n(() => a.flatMap((e) => e.sidebarTabs?.() ?? []), [a]), P = n(() => a.flatMap((e) => e.roomPanelSections?.() ?? []), [a]);
10721
10816
  t(() => {
10722
10817
  D.setState({ pluginSwatchSets: M });
@@ -10732,17 +10827,17 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10732
10827
  else if (e && !l) for (let e of a) e.onMapClosed?.();
10733
10828
  }, [l]), t(() => {
10734
10829
  if (!l || !s.current) return;
10735
- let e = mr(l, s.current);
10830
+ let e = hr(l, s.current);
10736
10831
  c.current = e;
10737
10832
  let { currentAreaId: t, currentZ: n } = D.getState();
10738
- return t != null && e.setArea(t, n, hr), () => {
10833
+ return t != null && e.setArea(t, n, gr), () => {
10739
10834
  e.destroy(), c.current = null;
10740
10835
  };
10741
10836
  }, [l]), t(() => {
10742
10837
  let e = c.current;
10743
10838
  if (!e || !p || m == null) return;
10744
10839
  let t = D.getState().navigateTo;
10745
- t ? (D.setState({ navigateTo: null }), e.setAreaAt(m, h, t.mapX, t.mapY)) : e.setArea(m, h, hr);
10840
+ t ? (D.setState({ navigateTo: null }), e.setAreaAt(m, h, t.mapX, t.mapY)) : e.setArea(m, h, gr);
10746
10841
  }, [
10747
10842
  m,
10748
10843
  h,
@@ -10787,7 +10882,7 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10787
10882
  let { map: e, loaded: t, undo: n, currentAreaId: r, currentZ: i, sessionId: a } = D.getState();
10788
10883
  if (!e || !t) return;
10789
10884
  let o = setTimeout(() => {
10790
- yn(t.fileName, e, n, r, i, a ?? void 0).then((e) => {
10885
+ bn(t.fileName, e, n, r, i, a ?? void 0).then((e) => {
10791
10886
  a || D.setState({ sessionId: e });
10792
10887
  }).catch(console.error);
10793
10888
  }, 1500);
@@ -10816,12 +10911,12 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10816
10911
  }
10817
10912
  if (t.key === "Enter") {
10818
10913
  let e = D.getState();
10819
- e.pending?.kind === "customLine" && kt(e.pending);
10914
+ e.pending?.kind === "customLine" && At(e.pending);
10820
10915
  return;
10821
10916
  }
10822
10917
  if (t.key === "Escape") {
10823
10918
  let e = D.getState();
10824
- e.pending ? (e.pending.kind === "customLine" && c.current && Ot(e.pending, c.current), D.setState({
10919
+ e.pending ? (e.pending.kind === "customLine" && c.current && kt(e.pending, c.current), D.setState({
10825
10920
  pending: null,
10826
10921
  activeTool: e.pending.kind === "customLine" ? "select" : e.activeTool,
10827
10922
  status: "Cancelled."
@@ -10837,13 +10932,13 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10837
10932
  return;
10838
10933
  }
10839
10934
  if (t.key === "f" || t.key === "F") {
10840
- c.current?.renderer.fitArea(hr);
10935
+ c.current?.renderer.fitArea(gr);
10841
10936
  return;
10842
10937
  }
10843
- if (gr[t.key]) {
10938
+ if (_r[t.key]) {
10844
10939
  let e = D.getState();
10845
- e.pending?.kind === "customLine" && c.current && (Ot(e.pending, c.current), D.bumpData()), D.setState({
10846
- activeTool: gr[t.key],
10940
+ e.pending?.kind === "customLine" && c.current && (kt(e.pending, c.current), D.bumpData()), D.setState({
10941
+ activeTool: _r[t.key],
10847
10942
  pending: null
10848
10943
  });
10849
10944
  return;
@@ -10859,14 +10954,14 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10859
10954
  } });
10860
10955
  return;
10861
10956
  }
10862
- if (_r[t.key]) {
10957
+ if (vr[t.key]) {
10863
10958
  let e = D.getState();
10864
10959
  if (e.activeTool !== "select" || !e.selection || !e.map) return;
10865
10960
  if (e.selection.kind === "label") {
10866
10961
  let { id: n, areaId: r } = e.selection, i = c.current?.reader.getLabelSnapshot(r, n);
10867
10962
  if (!i) return;
10868
10963
  t.preventDefault();
10869
- let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = _r[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
10964
+ let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = vr[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
10870
10965
  i.pos[0] + s,
10871
10966
  i.pos[1] + l,
10872
10967
  i.pos[2]
@@ -10887,11 +10982,11 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10887
10982
  let n = e.selection.ids[0], r = e.map.rooms[n];
10888
10983
  if (!r) return;
10889
10984
  t.preventDefault();
10890
- let i = (t.shiftKey ? 5 : 1) * e.gridStep, a = _r[t.key], o = a.dx * i, s = a.dy * i, l = {
10985
+ let i = (t.shiftKey ? 5 : 1) * e.gridStep, a = vr[t.key], o = a.dx * i, s = a.dy * i, l = {
10891
10986
  x: r.x,
10892
10987
  y: r.y,
10893
10988
  z: r.z
10894
- }, u = ke(e.map, n, o, s);
10989
+ }, u = Ae(e.map, n, o, s);
10895
10990
  c.current?.reader.moveRoom(n, r.x + o, -(r.y + s), r.z);
10896
10991
  let d = {
10897
10992
  x: r.x,
@@ -10916,7 +11011,7 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10916
11011
  }
10917
11012
  };
10918
11013
  window.addEventListener("keydown", r), window.addEventListener("keyup", t), window.addEventListener("blur", n);
10919
- let i = () => c.current?.renderer.fitArea(hr);
11014
+ let i = () => c.current?.renderer.fitArea(gr);
10920
11015
  return window.addEventListener("editor:undo", L), window.addEventListener("editor:redo", R), window.addEventListener("editor:fit", i), () => {
10921
11016
  window.removeEventListener("keydown", r), window.removeEventListener("keyup", t), window.removeEventListener("blur", n), window.removeEventListener("editor:undo", L), window.removeEventListener("editor:redo", R), window.removeEventListener("editor:fit", i);
10922
11017
  };
@@ -10926,7 +11021,7 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10926
11021
  }, t = (e) => {
10927
11022
  e.preventDefault();
10928
11023
  let t = Array.from(e.dataTransfer?.files ?? []).find((e) => e.name.endsWith(".dat"));
10929
- t && oe(t);
11024
+ t && ae(t);
10930
11025
  };
10931
11026
  return window.addEventListener("dragover", e), window.addEventListener("drop", t), () => {
10932
11027
  window.removeEventListener("dragover", e), window.removeEventListener("drop", t);
@@ -10940,7 +11035,7 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10940
11035
  if (t.kind === "room") {
10941
11036
  if (e.currentAreaId == null) return;
10942
11037
  if (t.ids.length > 1) {
10943
- let n = je(e.map, t.ids), r = [];
11038
+ let n = Me(e.map, t.ids), r = [];
10944
11039
  for (let i of t.ids) {
10945
11040
  let t = e.map.rooms[i];
10946
11041
  t && r.push({
@@ -10963,7 +11058,7 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
10963
11058
  }
10964
11059
  let n = t.ids[0], r = e.map.rooms[n];
10965
11060
  if (!r) return;
10966
- let i = { ...r }, a = Ae(e.map, n);
11061
+ let i = { ...r }, a = je(e.map, n);
10967
11062
  Y({
10968
11063
  kind: "deleteRoom",
10969
11064
  id: n,
@@ -11078,10 +11173,10 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11078
11173
  }
11079
11174
  }
11080
11175
  }, L = () => {
11081
- let { changed: e, structural: t } = De(c.current);
11176
+ let { changed: e, structural: t } = Oe(c.current);
11082
11177
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Undone" }));
11083
11178
  }, R = () => {
11084
- let { changed: e, structural: t } = Oe(c.current);
11179
+ let { changed: e, structural: t } = ke(c.current);
11085
11180
  e && (c.current?.refresh(), t ? D.bumpStructure() : D.bumpData(), D.setState({ status: "Redone" }));
11086
11181
  };
11087
11182
  return /* @__PURE__ */ f("div", {
@@ -11094,8 +11189,8 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11094
11189
  ref: s,
11095
11190
  className: "map-container"
11096
11191
  }),
11097
- !p && /* @__PURE__ */ d(On, {}),
11098
- /* @__PURE__ */ d(de, {
11192
+ !p && /* @__PURE__ */ d(kn, {}),
11193
+ /* @__PURE__ */ d(ue, {
11099
11194
  title: o,
11100
11195
  onHelpClick: () => T(!0),
11101
11196
  onLoadFromUrl: () => k(!0),
@@ -11103,18 +11198,18 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11103
11198
  for (let t of a) t.onMapSave?.(e);
11104
11199
  }
11105
11200
  }),
11106
- /* @__PURE__ */ d(pn, {
11201
+ /* @__PURE__ */ d(mn, {
11107
11202
  sceneRef: c,
11108
11203
  extraTabs: N,
11109
11204
  pluginRoomSections: P
11110
11205
  })
11111
11206
  ]
11112
11207
  }),
11113
- /* @__PURE__ */ d(mn, { sceneRef: c }),
11114
- u && /* @__PURE__ */ d(kn, { sceneRef: c }),
11208
+ /* @__PURE__ */ d(hn, { sceneRef: c }),
11209
+ u && /* @__PURE__ */ d(An, { sceneRef: c }),
11115
11210
  a.map((t, n) => /* @__PURE__ */ d(e, { children: t.renderOverlay?.() }, n)),
11116
- w && /* @__PURE__ */ d(ue, { onClose: () => T(!1) }),
11117
- (E || A) && /* @__PURE__ */ d(fe, {
11211
+ w && /* @__PURE__ */ d(le, { onClose: () => T(!1) }),
11212
+ (E || A) && /* @__PURE__ */ d(de, {
11118
11213
  initialUrl: A ?? void 0,
11119
11214
  onClose: () => {
11120
11215
  k(!1), j(null);
@@ -11125,9 +11220,9 @@ function vr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
11125
11220
  }
11126
11221
  //#endregion
11127
11222
  //#region src/editor/mapBytes.ts
11128
- function yr() {
11223
+ function br() {
11129
11224
  let { map: e } = D.getState();
11130
11225
  return e ? H(e) : null;
11131
11226
  }
11132
11227
  //#endregion
11133
- export { vr as App, yr as getMapBytes, W as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };
11228
+ export { yr as App, br as getMapBytes, G as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };