mudlet-map-editor 0.2.0 → 0.2.1

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