sldeditor 0.25.0 → 0.25.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/sldeditor.js CHANGED
@@ -767,10 +767,10 @@ const hr = "-", p_ = (e) => {
767
767
  }
768
768
  h = !1;
769
769
  }
770
- const b = v_(d).join(":"), y = m ? b + qa : b, v = y + f;
771
- if (i.includes(v))
770
+ const b = v_(d).join(":"), y = m ? b + qa : b, x = y + f;
771
+ if (i.includes(x))
772
772
  continue;
773
- i.push(v);
773
+ i.push(x);
774
774
  const $ = r(f, h);
775
775
  for (let C = 0; C < $.length; ++C) {
776
776
  const I = $[C];
@@ -823,7 +823,7 @@ const Se = (e) => {
823
823
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
824
824
  N_.test(e) && !T_.test(e)
825
825
  ), Ka = () => !1, H_ = (e) => I_.test(e), F_ = (e) => P_.test(e), W_ = () => {
826
- const e = Se("colors"), t = Se("spacing"), n = Se("blur"), o = Se("brightness"), r = Se("borderColor"), i = Se("borderRadius"), a = Se("borderSpacing"), l = Se("borderWidth"), s = Se("contrast"), c = Se("grayscale"), d = Se("hueRotate"), m = Se("invert"), p = Se("gap"), g = Se("gradientColorStops"), h = Se("gradientColorStopPositions"), f = Se("inset"), b = Se("margin"), y = Se("opacity"), v = Se("padding"), $ = Se("saturate"), C = Se("scale"), I = Se("sepia"), W = Se("skew"), oe = Se("space"), fe = Se("translate"), A = () => ["auto", "contain", "none"], L = () => ["auto", "hidden", "clip", "visible", "scroll"], H = () => ["auto", re, t], V = () => [re, t], F = () => ["", et, ct], K = () => ["auto", zt, re], se = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], ge = () => ["solid", "dashed", "dotted", "double", "none"], ce = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], be = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], ue = () => ["", "0", re], ve = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Ee = () => [zt, re];
826
+ const e = Se("colors"), t = Se("spacing"), n = Se("blur"), o = Se("brightness"), r = Se("borderColor"), i = Se("borderRadius"), a = Se("borderSpacing"), l = Se("borderWidth"), s = Se("contrast"), c = Se("grayscale"), d = Se("hueRotate"), m = Se("invert"), p = Se("gap"), g = Se("gradientColorStops"), h = Se("gradientColorStopPositions"), f = Se("inset"), b = Se("margin"), y = Se("opacity"), x = Se("padding"), $ = Se("saturate"), C = Se("scale"), I = Se("sepia"), W = Se("skew"), oe = Se("space"), fe = Se("translate"), A = () => ["auto", "contain", "none"], L = () => ["auto", "hidden", "clip", "visible", "scroll"], H = () => ["auto", re, t], V = () => [re, t], F = () => ["", et, ct], K = () => ["auto", zt, re], se = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], ge = () => ["solid", "dashed", "dotted", "double", "none"], ce = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], be = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], ue = () => ["", "0", re], ve = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Ee = () => [zt, re];
827
827
  return {
828
828
  cacheSize: 500,
829
829
  separator: ":",
@@ -1291,63 +1291,63 @@ const Se = (e) => {
1291
1291
  * @see https://tailwindcss.com/docs/padding
1292
1292
  */
1293
1293
  p: [{
1294
- p: [v]
1294
+ p: [x]
1295
1295
  }],
1296
1296
  /**
1297
1297
  * Padding X
1298
1298
  * @see https://tailwindcss.com/docs/padding
1299
1299
  */
1300
1300
  px: [{
1301
- px: [v]
1301
+ px: [x]
1302
1302
  }],
1303
1303
  /**
1304
1304
  * Padding Y
1305
1305
  * @see https://tailwindcss.com/docs/padding
1306
1306
  */
1307
1307
  py: [{
1308
- py: [v]
1308
+ py: [x]
1309
1309
  }],
1310
1310
  /**
1311
1311
  * Padding Start
1312
1312
  * @see https://tailwindcss.com/docs/padding
1313
1313
  */
1314
1314
  ps: [{
1315
- ps: [v]
1315
+ ps: [x]
1316
1316
  }],
1317
1317
  /**
1318
1318
  * Padding End
1319
1319
  * @see https://tailwindcss.com/docs/padding
1320
1320
  */
1321
1321
  pe: [{
1322
- pe: [v]
1322
+ pe: [x]
1323
1323
  }],
1324
1324
  /**
1325
1325
  * Padding Top
1326
1326
  * @see https://tailwindcss.com/docs/padding
1327
1327
  */
1328
1328
  pt: [{
1329
- pt: [v]
1329
+ pt: [x]
1330
1330
  }],
1331
1331
  /**
1332
1332
  * Padding Right
1333
1333
  * @see https://tailwindcss.com/docs/padding
1334
1334
  */
1335
1335
  pr: [{
1336
- pr: [v]
1336
+ pr: [x]
1337
1337
  }],
1338
1338
  /**
1339
1339
  * Padding Bottom
1340
1340
  * @see https://tailwindcss.com/docs/padding
1341
1341
  */
1342
1342
  pb: [{
1343
- pb: [v]
1343
+ pb: [x]
1344
1344
  }],
1345
1345
  /**
1346
1346
  * Padding Left
1347
1347
  * @see https://tailwindcss.com/docs/padding
1348
1348
  */
1349
1349
  pl: [{
1350
- pl: [v]
1350
+ pl: [x]
1351
1351
  }],
1352
1352
  /**
1353
1353
  * Margin
@@ -3065,7 +3065,7 @@ const Yr = (e) => {
3065
3065
  "view.zoomIn": "Acercar",
3066
3066
  "view.zoomInHint": "Acerca un nivel; también rueda ↑ o ⌘+",
3067
3067
  "view.fit": "Ajustar vista",
3068
- "view.fitHint": "Ajusta el zoom y centra todos los elementos automáticamente",
3068
+ "view.fitHint": "Ajusta el zoom y centra todo el dibujo automáticamente",
3069
3069
  "view.gridHide": "Ocultar cuadrícula",
3070
3070
  "view.gridShow": "Mostrar cuadrícula",
3071
3071
  "view.gridHotkey": "G",
@@ -3527,7 +3527,7 @@ const Yr = (e) => {
3527
3527
  "view.zoomIn": "Zoom avant",
3528
3528
  "view.zoomInHint": "Zoom avant par palier ; aussi molette ↑ ou ⌘+",
3529
3529
  "view.fit": "Ajuster la vue",
3530
- "view.fitHint": "Zoom automatique et centrage de tous les éléments",
3530
+ "view.fitHint": "Zoom automatique et centrage sur tout le schéma",
3531
3531
  "view.gridHide": "Masquer la grille",
3532
3532
  "view.gridShow": "Afficher la grille",
3533
3533
  "view.gridHotkey": "G",
@@ -3995,7 +3995,7 @@ const Yr = (e) => {
3995
3995
  "view.zoomIn": "Vergrößern",
3996
3996
  "view.zoomInHint": "Stufenweise vergrößern; auch Mausrad ↑ oder ⌘+",
3997
3997
  "view.fit": "Ansicht einpassen",
3998
- "view.fitHint": "Alle Elemente automatisch zoomen und zentrieren",
3998
+ "view.fitHint": "Die ganze Zeichnung automatisch zoomen und zentrieren",
3999
3999
  "view.gridHide": "Raster ausblenden",
4000
4000
  "view.gridShow": "Raster einblenden",
4001
4001
  "view.gridHotkey": "G",
@@ -4458,7 +4458,7 @@ const Yr = (e) => {
4458
4458
  "view.zoomIn": "Aumentar zoom",
4459
4459
  "view.zoomInHint": "Aumenta o zoom por etapas; também roda ↑ ou ⌘+",
4460
4460
  "view.fit": "Ajustar à tela",
4461
- "view.fitHint": "Aplica zoom automático e centraliza todos os elementos",
4461
+ "view.fitHint": "Aplica zoom automático e centraliza o desenho inteiro",
4462
4462
  "view.gridHide": "Ocultar grade",
4463
4463
  "view.gridShow": "Mostrar grade",
4464
4464
  "view.gridHotkey": "G",
@@ -4920,7 +4920,7 @@ const Yr = (e) => {
4920
4920
  "view.zoomIn": "ズームイン",
4921
4921
  "view.zoomInHint": "段階的にズームイン。ホイール ↑ や ⌘+ でも可",
4922
4922
  "view.fit": "全体表示",
4923
- "view.fitHint": "すべての要素を自動でズームして中央に配置",
4923
+ "view.fitHint": "図面全体を自動でズームして中央に配置",
4924
4924
  "view.gridHide": "グリッドを非表示",
4925
4925
  "view.gridShow": "グリッドを表示",
4926
4926
  "view.gridHotkey": "G",
@@ -5392,7 +5392,7 @@ const Yr = (e) => {
5392
5392
  "view.zoomIn": "Увеличить",
5393
5393
  "view.zoomInHint": "Увеличение на шаг; также колесо ↑ или ⌘+",
5394
5394
  "view.fit": "Вписать в экран",
5395
- "view.fitHint": "Автоматически масштабировать и центрировать все элементы",
5395
+ "view.fitHint": "Автоматически масштабировать и центрировать всю схему",
5396
5396
  "view.gridHide": "Скрыть сетку",
5397
5397
  "view.gridShow": "Показать сетку",
5398
5398
  "view.gridHotkey": "G",
@@ -5854,7 +5854,7 @@ const Yr = (e) => {
5854
5854
  "view.zoomIn": "بزرگ‌نمایی",
5855
5855
  "view.zoomInHint": "بزرگ‌نمایی پله‌ای؛ همچنین چرخ ماوس ↑ یا ⌘+",
5856
5856
  "view.fit": "تنظیم نما",
5857
- "view.fitHint": "بزرگ‌نمایی خودکار و وسط‌چین کردن همه عناصر",
5857
+ "view.fitHint": "بزرگ‌نمایی خودکار و وسط‌چین کردن کل نقشه",
5858
5858
  "view.gridHide": "پنهان کردن شبکه",
5859
5859
  "view.gridShow": "نمایش شبکه",
5860
5860
  "view.gridHotkey": "G",
@@ -6325,7 +6325,7 @@ const Yr = (e) => {
6325
6325
  "view.zoomIn": "تكبير",
6326
6326
  "view.zoomInHint": "تكبير تدريجي؛ أو عجلة الفأرة ↑ أو ⌘+",
6327
6327
  "view.fit": "احتواء العرض",
6328
- "view.fitHint": "تكبير/تصغير تلقائي وتوسيط كل العناصر",
6328
+ "view.fitHint": "تكبير/تصغير تلقائي وتوسيط المخطط بالكامل",
6329
6329
  "view.gridHide": "إخفاء الشبكة",
6330
6330
  "view.gridShow": "إظهار الشبكة",
6331
6331
  "view.gridHotkey": "G",
@@ -6796,7 +6796,7 @@ const Yr = (e) => {
6796
6796
  "view.zoomIn": "הגדל תצוגה",
6797
6797
  "view.zoomInHint": "הגדלה מדורגת; ניתן גם עם גלגלת ↑ או ⌘+",
6798
6798
  "view.fit": "התאם תצוגה",
6799
- "view.fitHint": "מתאים אוטומטית ומרכז את כל הרכיבים",
6799
+ "view.fitHint": "מתאים אוטומטית ומרכז את כל השרטוט",
6800
6800
  "view.gridHide": "הסתר רשת",
6801
6801
  "view.gridShow": "הצג רשת",
6802
6802
  "view.gridHotkey": "G",
@@ -7259,7 +7259,7 @@ const Yr = (e) => {
7259
7259
  "view.zoomIn": "放大",
7260
7260
  "view.zoomInHint": "按预设档位放大;也可滚轮 ↑ 或 ⌘+",
7261
7261
  "view.fit": "适配视图",
7262
- "view.fitHint": "自动缩放并居中所有元件",
7262
+ "view.fitHint": "自动缩放并居中,显示整张图纸",
7263
7263
  "view.gridHide": "隐藏网格",
7264
7264
  "view.gridShow": "显示网格",
7265
7265
  "view.gridHotkey": "G",
@@ -7512,7 +7512,7 @@ const Yr = (e) => {
7512
7512
  "view.zoomIn": "Zoom in",
7513
7513
  "view.zoomInHint": "Step zoom in; also wheel ↑ or ⌘+",
7514
7514
  "view.fit": "Fit view",
7515
- "view.fitHint": "Auto-zoom and center all elements",
7515
+ "view.fitHint": "Auto-zoom and center the whole drawing",
7516
7516
  "view.gridHide": "Hide grid",
7517
7517
  "view.gridShow": "Show grid",
7518
7518
  "view.gridHotkey": "G",
@@ -7815,7 +7815,7 @@ const Vo = (e) => (t) => {
7815
7815
  const f = () => {
7816
7816
  var b, y;
7817
7817
  if (!d) return;
7818
- const v = ++l;
7818
+ const x = ++l;
7819
7819
  a = !1, s.forEach((C) => {
7820
7820
  var I;
7821
7821
  return C((I = o()) != null ? I : g);
@@ -7839,7 +7839,7 @@ const Vo = (e) => (t) => {
7839
7839
  return [!1, void 0];
7840
7840
  }).then((C) => {
7841
7841
  var I;
7842
- if (v !== l)
7842
+ if (x !== l)
7843
7843
  return;
7844
7844
  const [W, oe] = C;
7845
7845
  if (h = i.merge(
@@ -7848,9 +7848,9 @@ const Vo = (e) => (t) => {
7848
7848
  ), n(h, !0), W)
7849
7849
  return m();
7850
7850
  }).then(() => {
7851
- v === l && ($ == null || $(o(), void 0), h = o(), a = !0, c.forEach((C) => C(h)));
7851
+ x === l && ($ == null || $(o(), void 0), h = o(), a = !0, c.forEach((C) => C(h)));
7852
7852
  }).catch((C) => {
7853
- v === l && ($ == null || $(void 0, C));
7853
+ x === l && ($ == null || $(void 0, C));
7854
7854
  });
7855
7855
  };
7856
7856
  return r.persist = {
@@ -7905,7 +7905,7 @@ function Ko(e) {
7905
7905
  function Qe(e) {
7906
7906
  return e.type ?? "text";
7907
7907
  }
7908
- function sP(e) {
7908
+ function cP(e) {
7909
7909
  return e.type === void 0 || e.type === "text";
7910
7910
  }
7911
7911
  const ns = "ammeter", os = "电流表 (A)", rs = "measurement", is = "-22 -42 44 44", as = 44, ss = 44, ls = '<ellipse cx="0" cy="-20" rx="20" ry="20" fill="none" stroke="black" stroke-width="1"/><text x="0" y="-15" text-anchor="middle" font-family="Liberation Sans, Arial, sans-serif" font-size="14">A</text>', cs = [{ id: "t_top", x: 0, y: -40, orientation: "n" }], ds = { kind: "inline" }, AC = {
@@ -10369,7 +10369,7 @@ unifilar` }, cE = {
10369
10369
  const Xo = new Map(
10370
10370
  Object.entries(_t)
10371
10371
  );
10372
- function lP(e) {
10372
+ function dP(e) {
10373
10373
  return _t[e];
10374
10374
  }
10375
10375
  const e6 = "custom:";
@@ -10523,46 +10523,46 @@ const Co = 320, En = 220, Zt = 260, $o = 720, Qt = 30, ri = 30, ut = 80, ii = 10
10523
10523
  function u6(e) {
10524
10524
  var Rr, Br, jr, Hr, Fr, Wr;
10525
10525
  const { elements: t, buses: n, junctions: o, wires: r, library: i, userLayout: a, userBusLayout: l } = e, s = new Map(a), c = new Map(l), d = /* @__PURE__ */ new Map(), m = new Set(a.keys()), p = new Set(l.keys()), g = /* @__PURE__ */ new Map();
10526
- for (const x of t) g.set(x.id, x);
10526
+ for (const v of t) g.set(v.id, v);
10527
10527
  const h = /* @__PURE__ */ new Map();
10528
- for (const x of n) h.set(x.id, x);
10529
- const f = (x) => {
10530
- const k = g.get(x);
10528
+ for (const v of n) h.set(v.id, v);
10529
+ const f = (v) => {
10530
+ const k = g.get(v);
10531
10531
  if (k)
10532
10532
  return i.get(k.kind);
10533
- }, b = new Set(n.map((x) => x.id)), y = (x) => b.has(x), v = new Set(o.map((x) => x.id)), $ = new Set(
10534
- o.filter((x) => {
10533
+ }, b = new Set(n.map((v) => v.id)), y = (v) => b.has(v), x = new Set(o.map((v) => v.id)), $ = new Set(
10534
+ o.filter((v) => {
10535
10535
  var k;
10536
- return (k = x.layout) == null ? void 0 : k.at;
10537
- }).map((x) => x.id)
10536
+ return (k = v.layout) == null ? void 0 : k.at;
10537
+ }).map((v) => v.id)
10538
10538
  ), C = new u2();
10539
- for (const x of r)
10540
- C.add(x.ends[0]), C.add(x.ends[1]), C.union(x.ends[0], x.ends[1]);
10541
- for (const x of t) {
10542
- const k = i.get(x.kind);
10539
+ for (const v of r)
10540
+ C.add(v.ends[0]), C.add(v.ends[1]), C.union(v.ends[0], v.ends[1]);
10541
+ for (const v of t) {
10542
+ const k = i.get(v.kind);
10543
10543
  if (k)
10544
- for (const _ of k.terminals) C.add(`${x.id}.${_.id}`);
10544
+ for (const _ of k.terminals) C.add(`${v.id}.${_.id}`);
10545
10545
  }
10546
- for (const x of n) C.add(x.id);
10546
+ for (const v of n) C.add(v.id);
10547
10547
  const I = [];
10548
- for (const [, x] of C.groups())
10549
- x.length >= 2 && I.push(x);
10548
+ for (const [, v] of C.groups())
10549
+ v.length >= 2 && I.push(v);
10550
10550
  const W = /* @__PURE__ */ new Map();
10551
- for (const x of I)
10552
- for (const k of x) W.set(k, [x]);
10551
+ for (const v of I)
10552
+ for (const k of v) W.set(k, [v]);
10553
10553
  const oe = /* @__PURE__ */ new Map();
10554
- for (const x of I) {
10555
- const k = x.filter(y);
10554
+ for (const v of I) {
10555
+ const k = v.filter(y);
10556
10556
  if (k.length !== 0)
10557
10557
  for (const _ of k) {
10558
- const N = x.filter((S) => S !== _), E = oe.get(_) ?? [];
10558
+ const N = v.filter((S) => S !== _), E = oe.get(_) ?? [];
10559
10559
  E.push(...N), oe.set(_, E);
10560
10560
  }
10561
10561
  }
10562
10562
  {
10563
10563
  const _ = (M) => g.has(M) && !!f(M), N = (M) => {
10564
10564
  if (y(M)) return null;
10565
- if (v.has(M)) return M;
10565
+ if (x.has(M)) return M;
10566
10566
  const T = M.indexOf(".");
10567
10567
  return T > 0 ? M.slice(0, T) : null;
10568
10568
  }, E = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set(), z = (M, T) => {
@@ -10582,7 +10582,7 @@ function u6(e) {
10582
10582
  const B = [...new Set(T)];
10583
10583
  for (const G of B)
10584
10584
  E.has(G) || E.set(G, /* @__PURE__ */ new Set()), R && S.add(G);
10585
- const q = B.filter((G) => v.has(G)), X = B.filter((G) => !v.has(G));
10585
+ const q = B.filter((G) => x.has(G)), X = B.filter((G) => !x.has(G));
10586
10586
  if (q.length > 0) {
10587
10587
  for (const G of q) for (const ee of X) z(G, ee);
10588
10588
  for (let G = 0; G < q.length; G++)
@@ -10633,7 +10633,7 @@ function u6(e) {
10633
10633
  Ae(q);
10634
10634
  for (const Z of te) {
10635
10635
  const ne = _e(Co + (we.get(Z) ?? 0) * 160), Me = _e(En + (G.get(Z) ?? 0) * 140);
10636
- if (v.has(Z)) {
10636
+ if (x.has(Z)) {
10637
10637
  d.set(Z, [ne, Me]);
10638
10638
  continue;
10639
10639
  }
@@ -10661,10 +10661,10 @@ function u6(e) {
10661
10661
  }
10662
10662
  }
10663
10663
  const fe = /* @__PURE__ */ new Map();
10664
- for (const x of I) {
10665
- const k = x.filter(y);
10664
+ for (const v of I) {
10665
+ const k = v.filter(y);
10666
10666
  if (k.length !== 0)
10667
- for (const _ of x) {
10667
+ for (const _ of v) {
10668
10668
  if (y(_)) continue;
10669
10669
  const N = _.indexOf(".");
10670
10670
  if (N < 0) continue;
@@ -10675,35 +10675,35 @@ function u6(e) {
10675
10675
  }
10676
10676
  }
10677
10677
  const A = [], L = /* @__PURE__ */ new Set();
10678
- for (const [x, k] of fe)
10678
+ for (const [v, k] of fe)
10679
10679
  if (new Set(k.map((N) => N.busId)).size >= 2) {
10680
- const N = ((Br = i.get(((Rr = g.get(x)) == null ? void 0 : Rr.kind) ?? "")) == null ? void 0 : Br.category) === "transformer" ? "vertical" : "horizontal";
10681
- A.push({ elementId: x, attachments: k, orientation: N }), N === "vertical" && L.add(x);
10680
+ const N = ((Br = i.get(((Rr = g.get(v)) == null ? void 0 : Rr.kind) ?? "")) == null ? void 0 : Br.category) === "transformer" ? "vertical" : "horizontal";
10681
+ A.push({ elementId: v, attachments: k, orientation: N }), N === "vertical" && L.add(v);
10682
10682
  }
10683
- const H = /* @__PURE__ */ new Map(), V = (x, k) => {
10684
- x !== k && (H.has(x) || H.set(x, /* @__PURE__ */ new Set()), H.has(k) || H.set(k, /* @__PURE__ */ new Set()), H.get(x).add(k), H.get(k).add(x));
10683
+ const H = /* @__PURE__ */ new Map(), V = (v, k) => {
10684
+ v !== k && (H.has(v) || H.set(v, /* @__PURE__ */ new Set()), H.has(k) || H.set(k, /* @__PURE__ */ new Set()), H.get(v).add(k), H.get(k).add(v));
10685
10685
  };
10686
- for (const x of r)
10687
- V(x.ends[0], x.ends[1]);
10688
- for (const x of t) {
10689
- const k = i.get(x.kind);
10686
+ for (const v of r)
10687
+ V(v.ends[0], v.ends[1]);
10688
+ for (const v of t) {
10689
+ const k = i.get(v.kind);
10690
10690
  if (!k || k.terminals.length < 2) continue;
10691
10691
  const _ = k.terminals.map(
10692
- (N) => `${x.id}.${N.id}`
10692
+ (N) => `${v.id}.${N.id}`
10693
10693
  );
10694
10694
  for (let N = 0; N < _.length; N++)
10695
10695
  for (let E = N + 1; E < _.length; E++)
10696
10696
  V(_[N], _[E]);
10697
10697
  }
10698
- for (const x of t) {
10699
- if (L.has(x.id)) continue;
10700
- const k = i.get(x.kind);
10698
+ for (const v of t) {
10699
+ if (L.has(v.id)) continue;
10700
+ const k = i.get(v.kind);
10701
10701
  if (!k || k.category !== "transformer" || k.terminals.length < 2) continue;
10702
10702
  const _ = k.terminals.map(
10703
- (S) => `${x.id}.${S.id}`
10703
+ (S) => `${v.id}.${S.id}`
10704
10704
  ), N = /* @__PURE__ */ new Map();
10705
10705
  for (const S of _) {
10706
- const z = S.slice(x.id.length + 1);
10706
+ const z = S.slice(v.id.length + 1);
10707
10707
  N.set(z, /* @__PURE__ */ new Set());
10708
10708
  const j = new Set(_.filter((M) => M !== S)), D = /* @__PURE__ */ new Set([S]), O = [S];
10709
10709
  for (; O.length > 0; ) {
@@ -10725,12 +10725,12 @@ function u6(e) {
10725
10725
  const S = [];
10726
10726
  for (const [z, j] of N)
10727
10727
  for (const D of j) S.push({ busId: D, pin: z });
10728
- A.push({ elementId: x.id, attachments: S, orientation: "vertical" }), L.add(x.id);
10728
+ A.push({ elementId: v.id, attachments: S, orientation: "vertical" }), L.add(v.id);
10729
10729
  }
10730
10730
  }
10731
- const F = (x, k) => {
10731
+ const F = (v, k) => {
10732
10732
  var j;
10733
- const _ = f(k), N = _ ? _.terminals.map((D) => `${k}.${D.id}`) : [], E = x, S = /* @__PURE__ */ new Set([E, ...N]), z = [E];
10733
+ const _ = f(k), N = _ ? _.terminals.map((D) => `${k}.${D.id}`) : [], E = v, S = /* @__PURE__ */ new Set([E, ...N]), z = [E];
10734
10734
  for (; z.length > 0; ) {
10735
10735
  const D = z.shift(), O = D.indexOf(".");
10736
10736
  if (O > 0) {
@@ -10747,23 +10747,23 @@ function u6(e) {
10747
10747
  }
10748
10748
  return !1;
10749
10749
  };
10750
- for (const x of A) {
10751
- if (x.orientation !== "horizontal") continue;
10752
- const k = new Set(x.attachments.map((N) => N.busId));
10750
+ for (const v of A) {
10751
+ if (v.orientation !== "horizontal") continue;
10752
+ const k = new Set(v.attachments.map((N) => N.busId));
10753
10753
  let _ = 0;
10754
10754
  for (const N of k)
10755
- F(N, x.elementId) && _++;
10756
- _ === 1 && (x.orientation = "vertical", L.add(x.elementId));
10755
+ F(N, v.elementId) && _++;
10756
+ _ === 1 && (v.orientation = "vertical", L.add(v.elementId));
10757
10757
  }
10758
- for (const x of t) {
10759
- if (L.has(x.id) || x.kind !== "breaker") continue;
10760
- const k = i.get(x.kind);
10758
+ for (const v of t) {
10759
+ if (L.has(v.id) || v.kind !== "breaker") continue;
10760
+ const k = i.get(v.kind);
10761
10761
  if (!k || k.terminals.length !== 2) continue;
10762
10762
  const _ = k.terminals.map(
10763
- (S) => `${x.id}.${S.id}`
10763
+ (S) => `${v.id}.${S.id}`
10764
10764
  ), N = /* @__PURE__ */ new Map();
10765
10765
  for (const S of _) {
10766
- const z = S.slice(x.id.length + 1), j = new Set(_.filter((M) => M !== S)), D = /* @__PURE__ */ new Set([S]), O = [S];
10766
+ const z = S.slice(v.id.length + 1), j = new Set(_.filter((M) => M !== S)), D = /* @__PURE__ */ new Set([S]), O = [S];
10767
10767
  for (; O.length > 0; ) {
10768
10768
  const M = O.shift();
10769
10769
  if (y(M)) {
@@ -10777,7 +10777,7 @@ function u6(e) {
10777
10777
  const B = R.indexOf(".");
10778
10778
  if (B > 0) {
10779
10779
  const q = R.slice(0, B);
10780
- if (q !== x.id) {
10780
+ if (q !== v.id) {
10781
10781
  const X = g.get(q), G = X ? i.get(X.kind) : void 0;
10782
10782
  if ((G == null ? void 0 : G.category) === "transformer") continue;
10783
10783
  }
@@ -10791,27 +10791,27 @@ function u6(e) {
10791
10791
  for (const [z, j] of N)
10792
10792
  S.push({ busId: j, pin: z });
10793
10793
  A.push({
10794
- elementId: x.id,
10794
+ elementId: v.id,
10795
10795
  attachments: S,
10796
10796
  orientation: "horizontal"
10797
10797
  });
10798
10798
  }
10799
10799
  }
10800
10800
  const K = /* @__PURE__ */ new Map();
10801
- for (const x of n) K.set(x.id, /* @__PURE__ */ new Map());
10802
- for (const x of A) {
10803
- const k = Array.from(new Set(x.attachments.map((_) => _.busId)));
10801
+ for (const v of n) K.set(v.id, /* @__PURE__ */ new Map());
10802
+ for (const v of A) {
10803
+ const k = Array.from(new Set(v.attachments.map((_) => _.busId)));
10804
10804
  for (const _ of k)
10805
10805
  for (const N of k)
10806
- _ !== N && ((jr = K.get(_)) == null || jr.set(N, x));
10806
+ _ !== N && ((jr = K.get(_)) == null || jr.set(N, v));
10807
10807
  }
10808
- const se = (x) => {
10808
+ const se = (v) => {
10809
10809
  var _;
10810
- const k = (_ = i.get(x)) == null ? void 0 : _.category;
10810
+ const k = (_ = i.get(v)) == null ? void 0 : _.category;
10811
10811
  return k ? si.has(k) : !1;
10812
10812
  }, ge = [];
10813
- for (const x of n) {
10814
- const k = oe.get(x.id);
10813
+ for (const v of n) {
10814
+ const k = oe.get(v.id);
10815
10815
  if (k)
10816
10816
  for (const _ of k) {
10817
10817
  if (y(_)) continue;
@@ -10819,41 +10819,41 @@ function u6(e) {
10819
10819
  if (N < 0) continue;
10820
10820
  const E = _.slice(0, N), S = g.get(E);
10821
10821
  if (S && se(S.kind)) {
10822
- ge.push(x.id);
10822
+ ge.push(v.id);
10823
10823
  break;
10824
10824
  }
10825
10825
  }
10826
10826
  }
10827
10827
  ge.length === 0 && n.length > 0 && ge.push(n[0].id);
10828
10828
  const ce = /* @__PURE__ */ new Map();
10829
- for (const x of ge) ce.set(x, 0);
10829
+ for (const v of ge) ce.set(v, 0);
10830
10830
  {
10831
- const x = [...ge];
10832
- for (; x.length > 0; ) {
10833
- const k = x.shift(), _ = ce.get(k), N = K.get(k);
10831
+ const v = [...ge];
10832
+ for (; v.length > 0; ) {
10833
+ const k = v.shift(), _ = ce.get(k), N = K.get(k);
10834
10834
  if (N)
10835
10835
  for (const [E, S] of N) {
10836
10836
  if (ce.has(E)) continue;
10837
10837
  const z = S.orientation === "horizontal" ? _ : _ + 1;
10838
- ce.set(E, z), x.push(E);
10838
+ ce.set(E, z), v.push(E);
10839
10839
  }
10840
10840
  }
10841
10841
  }
10842
- for (const x of n) {
10843
- if (ce.has(x.id)) continue;
10842
+ for (const v of n) {
10843
+ if (ce.has(v.id)) continue;
10844
10844
  const k = ce.size === 0 ? -1 : Math.max(...Array.from(ce.values()));
10845
- ce.set(x.id, k + 1);
10845
+ ce.set(v.id, k + 1);
10846
10846
  }
10847
10847
  const be = /* @__PURE__ */ new Map();
10848
- for (const x of n) {
10849
- const k = ce.get(x.id), _ = be.get(k) ?? [];
10850
- _.push(x.id), be.set(k, _);
10848
+ for (const v of n) {
10849
+ const k = ce.get(v.id), _ = be.get(k) ?? [];
10850
+ _.push(v.id), be.set(k, _);
10851
10851
  }
10852
- const ue = [...be.keys()].sort((x, k) => x - k), ve = (x, k, _) => {
10853
- const N = `${x.elementId}.${_}`, E = k, S = f(x.elementId), z = /* @__PURE__ */ new Set();
10852
+ const ue = [...be.keys()].sort((v, k) => v - k), ve = (v, k, _) => {
10853
+ const N = `${v.elementId}.${_}`, E = k, S = f(v.elementId), z = /* @__PURE__ */ new Set();
10854
10854
  if (S)
10855
10855
  for (const T of S.terminals)
10856
- T.id !== _ && z.add(`${x.elementId}.${T.id}`);
10856
+ T.id !== _ && z.add(`${v.elementId}.${T.id}`);
10857
10857
  const j = /* @__PURE__ */ new Set([N]), D = [
10858
10858
  { ref: N, dist: 0 }
10859
10859
  ], O = /* @__PURE__ */ new Map(), M = (T, R, B, q) => {
@@ -10868,7 +10868,7 @@ function u6(e) {
10868
10868
  const te = G.indexOf(".");
10869
10869
  if (te > 0) {
10870
10870
  const U = G.slice(0, te);
10871
- U !== x.elementId && (ee = U);
10871
+ U !== v.elementId && (ee = U);
10872
10872
  }
10873
10873
  }
10874
10874
  return { extent: R, head: ee };
@@ -10894,32 +10894,32 @@ function u6(e) {
10894
10894
  }
10895
10895
  }
10896
10896
  return { extent: 0 };
10897
- }, Ee = (x, k) => {
10897
+ }, Ee = (v, k) => {
10898
10898
  var T, R, B;
10899
- const _ = (T = K.get(x)) == null ? void 0 : T.get(k);
10899
+ const _ = (T = K.get(v)) == null ? void 0 : T.get(k);
10900
10900
  if (!_ || _.orientation === "horizontal") return Zt;
10901
10901
  const N = f(_.elementId);
10902
10902
  if (!N) return Zt;
10903
- const E = (R = _.attachments.find((q) => q.busId === x)) == null ? void 0 : R.pin, S = (B = _.attachments.find((q) => q.busId === k)) == null ? void 0 : B.pin;
10903
+ const E = (R = _.attachments.find((q) => q.busId === v)) == null ? void 0 : R.pin, S = (B = _.attachments.find((q) => q.busId === k)) == null ? void 0 : B.pin;
10904
10904
  if (!E || !S) return Zt;
10905
10905
  const z = N.terminals.find((q) => q.id === E), j = N.terminals.find((q) => q.id === S);
10906
10906
  if (!z || !j) return Zt;
10907
- const D = Math.abs(j.y - z.y), O = ve(_, x, E).extent, M = ve(_, k, S).extent;
10907
+ const D = Math.abs(j.y - z.y), O = ve(_, v, E).extent, M = ve(_, k, S).extent;
10908
10908
  return O + D + M;
10909
10909
  }, Fe = /* @__PURE__ */ new Map();
10910
- for (const x of A) {
10911
- if (x.orientation !== "vertical") continue;
10912
- const k = x.attachments.slice().sort(
10910
+ for (const v of A) {
10911
+ if (v.orientation !== "vertical") continue;
10912
+ const k = v.attachments.slice().sort(
10913
10913
  (j, D) => (ce.get(j.busId) ?? 0) - (ce.get(D.busId) ?? 0)
10914
10914
  );
10915
10915
  if (k.length < 2) continue;
10916
- const _ = k[0].busId, N = k[1].busId, E = k[0].pin, z = ve(x, _, E).head ?? x.elementId;
10916
+ const _ = k[0].busId, N = k[1].busId, E = k[0].pin, z = ve(v, _, E).head ?? v.elementId;
10917
10917
  Fe.set(z, { lowerBusId: N });
10918
10918
  }
10919
- const qt = 30, $r = (x) => {
10920
- const k = f(x);
10919
+ const qt = 30, $r = (v) => {
10920
+ const k = f(v);
10921
10921
  return Math.max((k == null ? void 0 : k.width) ?? ut, ut);
10922
- }, TS = 2, Ar = (x, k, _, N = 0) => {
10922
+ }, TS = 2, Ar = (v, k, _, N = 0) => {
10923
10923
  const E = f(k);
10924
10924
  let S = $r(k);
10925
10925
  if (E && !_.has(k) && N < TS) {
@@ -10927,7 +10927,7 @@ function u6(e) {
10927
10927
  let z = 0;
10928
10928
  for (const j of E.terminals) {
10929
10929
  const D = `${k}.${j.id}`;
10930
- if (D !== x)
10930
+ if (D !== v)
10931
10931
  for (const O of W.get(D) ?? []) {
10932
10932
  const M = /* @__PURE__ */ new Set();
10933
10933
  let T = !1;
@@ -10956,33 +10956,33 @@ function u6(e) {
10956
10956
  _.delete(k), S = Math.max(S, z);
10957
10957
  }
10958
10958
  return S;
10959
- }, Gt = 320, Ct = /* @__PURE__ */ new Map(), Er = (x, k) => {
10960
- if (!L.has(x)) return !1;
10961
- const _ = A.find((z) => z.elementId === x), N = _ == null ? void 0 : _.attachments.find((z) => z.busId !== k);
10959
+ }, Gt = 320, Ct = /* @__PURE__ */ new Map(), Er = (v, k) => {
10960
+ if (!L.has(v)) return !1;
10961
+ const _ = A.find((z) => z.elementId === v), N = _ == null ? void 0 : _.attachments.find((z) => z.busId !== k);
10962
10962
  if (!N) return !1;
10963
10963
  const E = ce.get(k) ?? 0;
10964
10964
  return (ce.get(N.busId) ?? 0) < E;
10965
- }, Vt = (x, k, _) => {
10966
- const N = Fe.get(x);
10965
+ }, Vt = (v, k, _) => {
10966
+ const N = Fe.get(v);
10967
10967
  if (N) {
10968
10968
  const S = Ct.get(N.lowerBusId);
10969
10969
  if (S !== void 0)
10970
10970
  return Math.max(k, S + ut);
10971
10971
  }
10972
10972
  let E = 0;
10973
- return _ && (E = Ar(_, x, /* @__PURE__ */ new Set())), Math.max(k, ut, E);
10974
- }, Nr = (x, k) => {
10975
- if (Ct.has(x)) return Ct.get(x);
10976
- if (k.has(x)) return Gt;
10977
- k.add(x);
10978
- const _ = oe.get(x) ?? [];
10973
+ return _ && (E = Ar(_, v, /* @__PURE__ */ new Set())), Math.max(k, ut, E);
10974
+ }, Nr = (v, k) => {
10975
+ if (Ct.has(v)) return Ct.get(v);
10976
+ if (k.has(v)) return Gt;
10977
+ k.add(v);
10978
+ const _ = oe.get(v) ?? [];
10979
10979
  let N = 0, E = 0;
10980
10980
  for (const z of _) {
10981
10981
  if (y(z)) continue;
10982
10982
  const j = z.indexOf(".");
10983
10983
  if (j < 0) continue;
10984
10984
  const D = z.slice(0, j), O = z.slice(j + 1);
10985
- if (Er(D, x)) continue;
10985
+ if (Er(D, v)) continue;
10986
10986
  const M = f(D);
10987
10987
  if (!M) continue;
10988
10988
  const T = M.terminals.find((q) => q.id === O);
@@ -11000,10 +11000,10 @@ function u6(e) {
11000
11000
  Gt,
11001
11001
  Math.max(N, E) + ut
11002
11002
  );
11003
- return Ct.set(x, S), k.delete(x), S;
11003
+ return Ct.set(v, S), k.delete(v), S;
11004
11004
  };
11005
- for (const x of n) Nr(x.id, /* @__PURE__ */ new Set());
11006
- const lt = /* @__PURE__ */ new Map(), IS = (x, k, _) => {
11005
+ for (const v of n) Nr(v.id, /* @__PURE__ */ new Set());
11006
+ const lt = /* @__PURE__ */ new Map(), IS = (v, k, _) => {
11007
11007
  const N = f(k);
11008
11008
  if (!N) return;
11009
11009
  const E = `${k}.${_}`, S = N.terminals.filter((D) => D.id !== _).map((D) => `${k}.${D.id}`);
@@ -11011,7 +11011,7 @@ function u6(e) {
11011
11011
  const z = /* @__PURE__ */ new Set([E, ...S]), j = S.slice();
11012
11012
  for (; j.length > 0; ) {
11013
11013
  const D = j.shift();
11014
- if (y(D) && D !== x) {
11014
+ if (y(D) && D !== v) {
11015
11015
  const M = c.get(D);
11016
11016
  return M ? M.at[0] : void 0;
11017
11017
  }
@@ -11031,10 +11031,10 @@ function u6(e) {
11031
11031
  }
11032
11032
  }
11033
11033
  }
11034
- }, PS = (x) => {
11035
- const k = oe.get(x);
11034
+ }, PS = (v) => {
11035
+ const k = oe.get(v);
11036
11036
  if (!k || k.length === 0) return;
11037
- const _ = c.get(x);
11037
+ const _ = c.get(v);
11038
11038
  if (!_) return;
11039
11039
  const N = k.flatMap((T) => {
11040
11040
  if (y(T)) return [];
@@ -11042,7 +11042,7 @@ function u6(e) {
11042
11042
  if (R < 0) return [];
11043
11043
  const B = T.slice(0, R), q = T.slice(R + 1);
11044
11044
  if (s.has(B)) return [];
11045
- if (Er(B, x)) return [];
11045
+ if (Er(B, v)) return [];
11046
11046
  const X = f(B);
11047
11047
  if (!X) return [];
11048
11048
  const G = X.terminals.find((ee) => ee.id === q);
@@ -11062,12 +11062,12 @@ function u6(e) {
11062
11062
  (R, B) => R + Vt(B.elId, B.lib.width, B.busFacingRef),
11063
11063
  0
11064
11064
  ), j = Math.max(z(E), z(S)) + ut, D = Math.max(_.span, j);
11065
- D !== _.span && !p.has(x) && c.set(x, { ..._, span: D });
11066
- const O = c.get(x), M = (T, R) => {
11065
+ D !== _.span && !p.has(v) && c.set(v, { ..._, span: D });
11066
+ const O = c.get(v), M = (T, R) => {
11067
11067
  if (T.length === 0) return;
11068
11068
  const B = /* @__PURE__ */ new Map();
11069
11069
  for (const Y of T) {
11070
- const J = IS(x, Y.elId, Y.localTerm.id);
11070
+ const J = IS(v, Y.elId, Y.localTerm.id);
11071
11071
  J !== void 0 && B.set(Y.elId, J);
11072
11072
  }
11073
11073
  T.sort((Y, J) => {
@@ -11091,11 +11091,11 @@ function u6(e) {
11091
11091
  }
11092
11092
  };
11093
11093
  M(E, -1), M(S, 1);
11094
- }, zS = (x) => {
11095
- if (s.has(x.elementId) || x.orientation === "horizontal") return;
11096
- const k = f(x.elementId);
11094
+ }, zS = (v) => {
11095
+ if (s.has(v.elementId) || v.orientation === "horizontal") return;
11096
+ const k = f(v.elementId);
11097
11097
  if (!k) return;
11098
- const _ = x.attachments.filter(
11098
+ const _ = v.attachments.filter(
11099
11099
  (te) => c.has(te.busId)
11100
11100
  );
11101
11101
  if (_.length < 2) return;
@@ -11108,16 +11108,16 @@ function u6(e) {
11108
11108
  ), B = [];
11109
11109
  let q = 0;
11110
11110
  for (const te of R) {
11111
- const U = ve(x, te.busId, te.pin);
11111
+ const U = ve(v, te.busId, te.pin);
11112
11112
  q = Math.max(q, U.extent);
11113
11113
  const Y = U.head ? s.get(U.head) : void 0;
11114
- Y ? B.push(Y.at[0]) : lt.has(x.elementId) ? B.push(lt.get(x.elementId)) : B.push(c.get(te.busId).at[0]);
11114
+ Y ? B.push(Y.at[0]) : lt.has(v.elementId) ? B.push(lt.get(v.elementId)) : B.push(c.get(te.busId).at[0]);
11115
11115
  }
11116
11116
  let X;
11117
- B.length > 0 ? X = B.reduce((te, U) => te + U, 0) / B.length : lt.has(x.elementId) ? X = lt.get(x.elementId) : X = S.at[0];
11117
+ B.length > 0 ? X = B.reduce((te, U) => te + U, 0) / B.length : lt.has(v.elementId) ? X = lt.get(v.elementId) : X = S.at[0];
11118
11118
  const G = S.at[1] + q, ee = M === 0 ? [_e(X - D.x), _e(G - D.y)] : [_e(X + D.x), _e(G + D.y)];
11119
- if (s.set(x.elementId, { at: ee, rot: M, mirror: !1 }), R.length > 1) {
11120
- const te = s.get(x.elementId), U = qe(
11119
+ if (s.set(v.elementId, { at: ee, rot: M, mirror: !1 }), R.length > 1) {
11120
+ const te = s.get(v.elementId), U = qe(
11121
11121
  [D.x, D.y],
11122
11122
  te
11123
11123
  ), Y = Hn(
@@ -11125,15 +11125,15 @@ function u6(e) {
11125
11125
  te
11126
11126
  );
11127
11127
  MS(
11128
- `${x.elementId}.${z}`,
11128
+ `${v.elementId}.${z}`,
11129
11129
  U,
11130
11130
  Y,
11131
11131
  X
11132
11132
  );
11133
11133
  }
11134
- }, MS = (x, k, _, N) => {
11135
- const E = /* @__PURE__ */ new Set([x]);
11136
- let S = x, z = k, j = _;
11134
+ }, MS = (v, k, _, N) => {
11135
+ const E = /* @__PURE__ */ new Set([v]);
11136
+ let S = v, z = k, j = _;
11137
11137
  for (; ; ) {
11138
11138
  const D = W.get(S) ?? [];
11139
11139
  let O, M = !1;
@@ -11180,34 +11180,34 @@ function u6(e) {
11180
11180
  const Z = { at: J, rot: U, mirror: !1 };
11181
11181
  z = qe([we.x, we.y], Z), j = Hn(we.orientation, Z), S = Ae;
11182
11182
  }
11183
- }, DS = (x) => {
11184
- if (s.has(x.elementId) || x.orientation !== "horizontal") return;
11185
- const k = f(x.elementId);
11183
+ }, DS = (v) => {
11184
+ if (s.has(v.elementId) || v.orientation !== "horizontal") return;
11185
+ const k = f(v.elementId);
11186
11186
  if (!k) return;
11187
- const _ = x.attachments.filter((R) => c.has(R.busId));
11187
+ const _ = v.attachments.filter((R) => c.has(R.busId));
11188
11188
  if (_.length < 2) return;
11189
11189
  const N = _.map((R) => {
11190
- const B = ve(x, R.busId, R.pin), q = B.head ? s.get(B.head) : void 0, X = q ? q.at[0] : c.get(R.busId).at[0];
11190
+ const B = ve(v, R.busId, R.pin), q = B.head ? s.get(B.head) : void 0, X = q ? q.at[0] : c.get(R.busId).at[0];
11191
11191
  return { att: R, x: X, extent: B.extent };
11192
11192
  });
11193
11193
  N.sort((R, B) => R.x - B.x);
11194
11194
  const E = N[0], S = N[N.length - 1], z = k.terminals.find((R) => R.id === E.att.pin), j = k.terminals.find((R) => R.id === S.att.pin);
11195
11195
  if (!z || !j) return;
11196
11196
  const D = z.y <= j.y ? 270 : 90, O = (E.x + S.x) / 2, T = c.get(E.att.busId).at[1] + Math.max(E.extent, S.extent);
11197
- s.set(x.elementId, {
11197
+ s.set(v.elementId, {
11198
11198
  at: [_e(O), _e(T)],
11199
11199
  rot: D,
11200
11200
  mirror: !1
11201
11201
  });
11202
11202
  }, Tr = 100;
11203
11203
  let Sn = En;
11204
- for (let x = 0; x < ue.length; x++) {
11205
- const k = ue[x], _ = be.get(k);
11204
+ for (let v = 0; v < ue.length; v++) {
11205
+ const k = ue[v], _ = be.get(k);
11206
11206
  let N;
11207
- if (x === 0)
11207
+ if (v === 0)
11208
11208
  N = En;
11209
11209
  else {
11210
- const S = be.get(ue[x - 1]);
11210
+ const S = be.get(ue[v - 1]);
11211
11211
  let z = 0;
11212
11212
  for (const j of S)
11213
11213
  for (const D of _)
@@ -11222,8 +11222,8 @@ function u6(e) {
11222
11222
  continue;
11223
11223
  }
11224
11224
  let z;
11225
- if (x > 0) {
11226
- const D = be.get(ue[x - 1]), O = [];
11225
+ if (v > 0) {
11226
+ const D = be.get(ue[v - 1]), O = [];
11227
11227
  for (const M of D) {
11228
11228
  const T = (Fr = K.get(M)) == null ? void 0 : Fr.get(S);
11229
11229
  if (!T || T.orientation !== "vertical") continue;
@@ -11250,7 +11250,7 @@ function u6(e) {
11250
11250
  }
11251
11251
  for (const S of _)
11252
11252
  PS(S);
11253
- if (x > 0)
11253
+ if (v > 0)
11254
11254
  for (const S of A)
11255
11255
  s.has(S.elementId) || !S.attachments.some(
11256
11256
  (j) => _.includes(j.busId)
@@ -11261,7 +11261,7 @@ function u6(e) {
11261
11261
  ) || DS(S);
11262
11262
  }
11263
11263
  if (n.length === 0 && s.size < t.length) {
11264
- const x = (E) => {
11264
+ const v = (E) => {
11265
11265
  const S = /* @__PURE__ */ new Set(), z = f(E);
11266
11266
  if (!z) return S;
11267
11267
  for (const j of z.terminals) {
@@ -11283,7 +11283,7 @@ function u6(e) {
11283
11283
  for (k.add(E.id); z.length > 0; ) {
11284
11284
  const j = z.pop();
11285
11285
  S.push(j);
11286
- for (const D of x(j))
11286
+ for (const D of v(j))
11287
11287
  k.has(D) || (k.add(D), z.push(D));
11288
11288
  }
11289
11289
  S.length >= 2 && _.push(S);
@@ -11295,7 +11295,7 @@ function u6(e) {
11295
11295
  var X, G;
11296
11296
  const T = se(((X = g.get(O)) == null ? void 0 : X.kind) ?? "") ? 0 : 1, R = se(((G = g.get(M)) == null ? void 0 : G.kind) ?? "") ? 0 : 1;
11297
11297
  if (T !== R) return T - R;
11298
- const B = x(O).size, q = x(M).size;
11298
+ const B = v(O).size, q = v(M).size;
11299
11299
  return B !== q ? B - q : O.localeCompare(M);
11300
11300
  });
11301
11301
  const S = E[0], z = f(S);
@@ -11312,18 +11312,18 @@ function u6(e) {
11312
11312
  }), N += Math.max($o, E.length * ut) + Tr;
11313
11313
  }
11314
11314
  }
11315
- const OS = (x) => {
11316
- if (y(x)) return c.has(x);
11317
- const k = x.indexOf(".");
11318
- return k < 0 ? !1 : s.has(x.slice(0, k));
11315
+ const OS = (v) => {
11316
+ if (y(v)) return c.has(v);
11317
+ const k = v.indexOf(".");
11318
+ return k < 0 ? !1 : s.has(v.slice(0, k));
11319
11319
  };
11320
11320
  let wo = !0, LS = t.length + 4;
11321
11321
  for (; wo && LS-- > 0; ) {
11322
11322
  wo = !1;
11323
- for (const x of I) {
11324
- if (x.length < 2) continue;
11323
+ for (const v of I) {
11324
+ if (v.length < 2) continue;
11325
11325
  const k = [], _ = /* @__PURE__ */ new Map();
11326
- for (const U of x) {
11326
+ for (const U of v) {
11327
11327
  if (y(U))
11328
11328
  continue;
11329
11329
  const Y = U.indexOf(".");
@@ -11396,8 +11396,8 @@ function u6(e) {
11396
11396
  }
11397
11397
  }
11398
11398
  }
11399
- const Kt = (x) => {
11400
- const k = s.get(x), _ = f(x);
11399
+ const Kt = (v) => {
11400
+ const k = s.get(v), _ = f(v);
11401
11401
  if (!k || !_) return null;
11402
11402
  const N = _.viewBox.split(/\s+/).map(Number);
11403
11403
  if (N.length < 4 || N.some((T) => Number.isNaN(T))) {
@@ -11416,23 +11416,23 @@ function u6(e) {
11416
11416
  O = Math.min(O, R[0]), M = Math.max(M, R[0]);
11417
11417
  }
11418
11418
  return { min: O, max: M };
11419
- }, vo = (x) => {
11420
- const k = /* @__PURE__ */ new Set(), _ = f(x);
11419
+ }, vo = (v) => {
11420
+ const k = /* @__PURE__ */ new Set(), _ = f(v);
11421
11421
  if (!_) return k;
11422
11422
  for (const N of _.terminals) {
11423
- const E = `${x}.${N.id}`;
11423
+ const E = `${v}.${N.id}`;
11424
11424
  for (const S of W.get(E) ?? [])
11425
11425
  for (const z of S) {
11426
11426
  if (z === E || y(z)) continue;
11427
11427
  const j = z.indexOf(".");
11428
11428
  if (j < 0) continue;
11429
11429
  const D = z.slice(0, j);
11430
- D !== x && k.add(D);
11430
+ D !== v && k.add(D);
11431
11431
  }
11432
11432
  }
11433
11433
  return k;
11434
- }, Ir = 40, xo = (x) => {
11435
- const k = s.get(x), _ = f(x);
11434
+ }, Ir = 40, xo = (v) => {
11435
+ const k = s.get(v), _ = f(v);
11436
11436
  if (!k || !_) return null;
11437
11437
  const N = _.viewBox.split(/\s+/).map(Number);
11438
11438
  if (N.length < 4 || N.some((T) => Number.isNaN(T))) {
@@ -11451,9 +11451,9 @@ function u6(e) {
11451
11451
  O = Math.min(O, R[1]), M = Math.max(M, R[1]);
11452
11452
  }
11453
11453
  return { min: O, max: M };
11454
- }, RS = (x, k) => {
11454
+ }, RS = (v, k) => {
11455
11455
  const _ = /* @__PURE__ */ new Set(), N = [];
11456
- for (const E of oe.get(x) ?? []) {
11456
+ for (const E of oe.get(v) ?? []) {
11457
11457
  if (y(E)) continue;
11458
11458
  const S = E.indexOf(".");
11459
11459
  if (S < 0) continue;
@@ -11469,21 +11469,21 @@ function u6(e) {
11469
11469
  }
11470
11470
  }
11471
11471
  return _;
11472
- }, Pr = (x, k, _) => {
11473
- const N = /* @__PURE__ */ new Set([x]), E = [x];
11472
+ }, Pr = (v, k, _) => {
11473
+ const N = /* @__PURE__ */ new Set([v]), E = [v];
11474
11474
  for (; E.length > 0; ) {
11475
11475
  const S = E.pop();
11476
11476
  for (const z of vo(S))
11477
11477
  z === k || N.has(z) || !_.has(z) || (N.add(z), E.push(z));
11478
11478
  }
11479
11479
  return N;
11480
- }, zr = (x, k) => {
11481
- let _ = x.length * x.length + 8, N = !1, E = !0;
11480
+ }, zr = (v, k) => {
11481
+ let _ = v.length * v.length + 8, N = !1, E = !0;
11482
11482
  for (; E && _-- > 0; ) {
11483
11483
  E = !1;
11484
- for (let S = 0; S < x.length && !E; S++)
11485
- for (let z = S + 1; z < x.length; z++) {
11486
- const j = x[S], D = x[z], O = Kt(j), M = Kt(D), T = xo(j), R = xo(D);
11484
+ for (let S = 0; S < v.length && !E; S++)
11485
+ for (let z = S + 1; z < v.length; z++) {
11486
+ const j = v[S], D = v[z], O = Kt(j), M = Kt(D), T = xo(j), R = xo(D);
11487
11487
  if (!O || !M || !T || !R) continue;
11488
11488
  const B = Math.min(O.max, M.max) - Math.max(O.min, M.min), q = Math.min(T.max, R.max) - Math.max(T.min, R.min);
11489
11489
  if (B <= 0 || q <= 0) continue;
@@ -11510,10 +11510,10 @@ function u6(e) {
11510
11510
  }
11511
11511
  return N;
11512
11512
  };
11513
- for (const x of n) {
11514
- const k = c.get(x.id);
11513
+ for (const v of n) {
11514
+ const k = c.get(v.id);
11515
11515
  if (!k) continue;
11516
- const _ = RS(x.id, k.at[1]);
11516
+ const _ = RS(v.id, k.at[1]);
11517
11517
  if (_.size < 2) continue;
11518
11518
  const N = [..._];
11519
11519
  if (zr(N, _)) {
@@ -11533,9 +11533,9 @@ function u6(e) {
11533
11533
  });
11534
11534
  }
11535
11535
  const O = z - S + Ir;
11536
- if (O > k.span && !p.has(x.id)) {
11537
- const M = c.get(x.id);
11538
- c.set(x.id, { ...M, span: O });
11536
+ if (O > k.span && !p.has(v.id)) {
11537
+ const M = c.get(v.id);
11538
+ c.set(v.id, { ...M, span: O });
11539
11539
  }
11540
11540
  }
11541
11541
  }
@@ -11550,13 +11550,13 @@ function u6(e) {
11550
11550
  }
11551
11551
  return _;
11552
11552
  }, BS = Mr(), Dr = /* @__PURE__ */ new Map();
11553
- for (const [x, k] of s) Dr.set(x, { ...k, at: [...k.at] });
11553
+ for (const [v, k] of s) Dr.set(v, { ...k, at: [...k.at] });
11554
11554
  const Or = /* @__PURE__ */ new Map();
11555
- for (const [x, k] of c)
11556
- Or.set(x, { ...k, at: [...k.at] });
11555
+ for (const [v, k] of c)
11556
+ Or.set(v, { ...k, at: [...k.at] });
11557
11557
  const ko = 120, Lr = /* @__PURE__ */ new Map();
11558
11558
  {
11559
- const x = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), _ = [];
11559
+ const v = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), _ = [];
11560
11560
  for (const E of n)
11561
11561
  for (const S of oe.get(E.id) ?? []) {
11562
11562
  if (y(S)) continue;
@@ -11568,21 +11568,21 @@ function u6(e) {
11568
11568
  _.sort((E, S) => E.d - S.d);
11569
11569
  let N = 0;
11570
11570
  for (; N < _.length; ) {
11571
- const { el: E, bus: S, d: z } = _[N++], j = x.get(E);
11571
+ const { el: E, bus: S, d: z } = _[N++], j = v.get(E);
11572
11572
  if (j === void 0)
11573
- x.set(E, z), k.set(E, S);
11573
+ v.set(E, z), k.set(E, S);
11574
11574
  else if (z === j && k.get(E) !== S) {
11575
11575
  k.set(E, null);
11576
11576
  continue;
11577
11577
  } else
11578
11578
  continue;
11579
11579
  for (const D of vo(E))
11580
- s.has(D) && (x.has(D) || _.push({ el: D, bus: S, d: z + 1 }));
11580
+ s.has(D) && (v.has(D) || _.push({ el: D, bus: S, d: z + 1 }));
11581
11581
  }
11582
11582
  for (const [E, S] of k) S && Lr.set(E, S);
11583
11583
  }
11584
- for (const x of ue) {
11585
- const k = (be.get(x) ?? []).filter(
11584
+ for (const v of ue) {
11585
+ const k = (be.get(v) ?? []).filter(
11586
11586
  (O) => c.has(O)
11587
11587
  );
11588
11588
  if (k.length < 2 || k.some((O) => p.has(O))) continue;
@@ -11626,20 +11626,20 @@ function u6(e) {
11626
11626
  }
11627
11627
  }
11628
11628
  {
11629
- const x = t.map((_) => _.id).filter((_) => s.has(_)), k = new Set(x);
11630
- zr(x, k);
11629
+ const v = t.map((_) => _.id).filter((_) => s.has(_)), k = new Set(v);
11630
+ zr(v, k);
11631
11631
  }
11632
11632
  if (Mr() > BS) {
11633
11633
  s.clear();
11634
- for (const [x, k] of Dr) s.set(x, k);
11634
+ for (const [v, k] of Dr) s.set(v, k);
11635
11635
  c.clear();
11636
- for (const [x, k] of Or) c.set(x, k);
11636
+ for (const [v, k] of Or) c.set(v, k);
11637
11637
  }
11638
11638
  let So = 0;
11639
- for (const x of t) {
11640
- if (s.has(x.id)) continue;
11639
+ for (const v of t) {
11640
+ if (s.has(v.id)) continue;
11641
11641
  const k = So % ai, _ = Math.floor(So / ai);
11642
- s.set(x.id, {
11642
+ s.set(v.id, {
11643
11643
  at: [
11644
11644
  _e(s6 + k * c6),
11645
11645
  _e(l6 + _ * d6)
@@ -11911,10 +11911,10 @@ function wt(e) {
11911
11911
  world: g.get(A) ?? [0, 0],
11912
11912
  degree: y.get(A) ?? 0
11913
11913
  });
11914
- const v = new u2();
11914
+ const x = new u2();
11915
11915
  for (const A of d)
11916
- v.add(A.ends[0]), v.add(A.ends[1]), v.union(A.ends[0], A.ends[1]);
11917
- for (const [, A] of v.groups()) {
11916
+ x.add(A.ends[0]), x.add(A.ends[1]), x.union(A.ends[0], A.ends[1]);
11917
+ for (const [, A] of x.groups()) {
11918
11918
  const L = p6(A);
11919
11919
  t.nodes.set(L, { id: L, terminals: A });
11920
11920
  for (const H of A) t.terminalToNode.set(H, L);
@@ -12122,14 +12122,14 @@ function v6(e, t) {
12122
12122
  }
12123
12123
  return n;
12124
12124
  }
12125
- function cP(e, t) {
12125
+ function uP(e, t) {
12126
12126
  return (e.bindings ?? []).filter((n) => n.target === t);
12127
12127
  }
12128
- function dP(e, t) {
12128
+ function mP(e, t) {
12129
12129
  const n = e.bindings ?? [], o = n.findIndex((i) => i.target === t.target && i.prop === t.prop), r = o < 0 ? [...n, t] : n.map((i, a) => a === o ? t : i);
12130
12130
  return { ...e, bindings: r };
12131
12131
  }
12132
- function uP(e, t, n) {
12132
+ function pP(e, t, n) {
12133
12133
  const o = e.bindings;
12134
12134
  if (!o || o.length === 0) return e;
12135
12135
  const r = o.filter(
@@ -12388,10 +12388,10 @@ const p2 = (e, t) => ({
12388
12388
  return;
12389
12389
  }
12390
12390
  const s = new Set(n), c = r.elements.filter((b) => s.has(b.id)).map((b) => structuredClone(b)), d = (r.buses ?? []).filter((b) => s.has(b.id)).map((b) => structuredClone(b)), m = (r.junctions ?? []).filter((b) => s.has(b.id)).map((b) => {
12391
- var v;
12391
+ var x;
12392
12392
  const y = structuredClone(b);
12393
12393
  if (!y.layout) {
12394
- const $ = (v = i.junctions.get(b.id)) == null ? void 0 : v.world;
12394
+ const $ = (x = i.junctions.get(b.id)) == null ? void 0 : x.world;
12395
12395
  $ && (y.layout = { at: [$[0], $[1]] });
12396
12396
  }
12397
12397
  return y;
@@ -12403,8 +12403,8 @@ const p2 = (e, t) => ({
12403
12403
  p[b] = structuredClone(y);
12404
12404
  continue;
12405
12405
  }
12406
- const v = i.layout.get(b);
12407
- v && (p[b] = $t(v));
12406
+ const x = i.layout.get(b);
12407
+ x && (p[b] = $t(x));
12408
12408
  }
12409
12409
  const g = {};
12410
12410
  for (const b of n) {
@@ -12440,13 +12440,13 @@ const p2 = (e, t) => ({
12440
12440
  const g = o + 1, h = No * g, f = [];
12441
12441
  t().dispatch((b) => {
12442
12442
  let y = b;
12443
- for (const v of p) {
12443
+ for (const x of p) {
12444
12444
  const $ = Nn(y);
12445
12445
  f.push($);
12446
12446
  const C = {
12447
- ...structuredClone(v),
12447
+ ...structuredClone(x),
12448
12448
  id: $,
12449
- at: [v.at[0] + h, v.at[1] + h]
12449
+ at: [x.at[0] + h, x.at[1] + h]
12450
12450
  };
12451
12451
  y = {
12452
12452
  ...y,
@@ -12537,13 +12537,13 @@ const p2 = (e, t) => ({
12537
12537
  ends: C,
12538
12538
  ...$.label ? { label: $.label } : {}
12539
12539
  };
12540
- }), v = wi(p.wires ?? [], y);
12540
+ }), x = wi(p.wires ?? [], y);
12541
12541
  return {
12542
12542
  ...p,
12543
12543
  elements: [...p.elements, ...g],
12544
12544
  buses: h.length ? [...p.buses ?? [], ...h] : p.buses,
12545
12545
  junctions: f.length ? [...p.junctions ?? [], ...f] : p.junctions,
12546
- wires: v.length ? v : void 0,
12546
+ wires: x.length ? x : void 0,
12547
12547
  layout: Object.keys(b).length ? b : void 0,
12548
12548
  annotations: d.length ? [...p.annotations ?? [], ...d] : p.annotations
12549
12549
  };
@@ -12793,8 +12793,8 @@ const p2 = (e, t) => ({
12793
12793
  for (const g of o) {
12794
12794
  if (r.junctions.has(g)) continue;
12795
12795
  if (r.buses.has(g)) {
12796
- const b = r.buses.get(g), v = (((((m = (d = (c = i.buses) == null ? void 0 : c.find(($) => $.id === g)) == null ? void 0 : d.layout) == null ? void 0 : m.rot) ?? b.geometry.rot ?? 0) + n) % 360 + 360) % 360;
12797
- l.set(g, v);
12796
+ const b = r.buses.get(g), x = (((((m = (d = (c = i.buses) == null ? void 0 : c.find(($) => $.id === g)) == null ? void 0 : d.layout) == null ? void 0 : m.rot) ?? b.geometry.rot ?? 0) + n) % 360 + 360) % 360;
12797
+ l.set(g, x);
12798
12798
  continue;
12799
12799
  }
12800
12800
  const h = a[g] ?? { at: ((p = r.layout.get(g)) == null ? void 0 : p.at) ?? [0, 0] }, f = (((h.rot ?? 0) + n) % 360 + 360) % 360;
@@ -12826,15 +12826,15 @@ const p2 = (e, t) => ({
12826
12826
  const { selection: o, selectedAnnotations: r, selectedWire: i } = t();
12827
12827
  if (o.length === 0 && r.length === 0 && i == null)
12828
12828
  return;
12829
- const a = new Set(o), l = new Set(r), s = (v) => {
12829
+ const a = new Set(o), l = new Set(r), s = (x) => {
12830
12830
  if (n === "default") {
12831
- if (v.color === void 0) return v;
12832
- const { color: $, ...C } = v;
12831
+ if (x.color === void 0) return x;
12832
+ const { color: $, ...C } = x;
12833
12833
  return C;
12834
12834
  }
12835
- return v.color === n ? v : { ...v, color: n };
12836
- }, c = t().diagram, d = a.size ? c.elements.map((v) => a.has(v.id) ? s(v) : v) : c.elements, m = a.size ? (f = c.buses) == null ? void 0 : f.map((v) => a.has(v.id) ? s(v) : v) : c.buses, p = i ? (b = c.wires) == null ? void 0 : b.map((v) => v.id === i ? s(v) : v) : c.wires, g = l.size ? (y = c.annotations) == null ? void 0 : y.map((v) => l.has(v.id) ? s(v) : v) : c.annotations, h = (v, $) => v === $ || (v == null ? void 0 : v.length) === ($ == null ? void 0 : $.length) && (v ?? []).every((C, I) => C === ($ == null ? void 0 : $[I]));
12837
- h(d, c.elements) && h(m, c.buses) && h(p, c.wires) && h(g, c.annotations) || t().dispatch((v) => ({ ...v, elements: d, buses: m, wires: p, annotations: g }));
12835
+ return x.color === n ? x : { ...x, color: n };
12836
+ }, c = t().diagram, d = a.size ? c.elements.map((x) => a.has(x.id) ? s(x) : x) : c.elements, m = a.size ? (f = c.buses) == null ? void 0 : f.map((x) => a.has(x.id) ? s(x) : x) : c.buses, p = i ? (b = c.wires) == null ? void 0 : b.map((x) => x.id === i ? s(x) : x) : c.wires, g = l.size ? (y = c.annotations) == null ? void 0 : y.map((x) => l.has(x.id) ? s(x) : x) : c.annotations, h = (x, $) => x === $ || (x == null ? void 0 : x.length) === ($ == null ? void 0 : $.length) && (x ?? []).every((C, I) => C === ($ == null ? void 0 : $[I]));
12837
+ h(d, c.elements) && h(m, c.buses) && h(p, c.wires) && h(g, c.annotations) || t().dispatch((x) => ({ ...x, elements: d, buses: m, wires: p, annotations: g }));
12838
12838
  },
12839
12839
  resetSelectionLabelOffset: () => {
12840
12840
  const n = new Set(t().selection);
@@ -12922,7 +12922,7 @@ const p2 = (e, t) => ({
12922
12922
  if ("junctionAt" in h) return s(h.junctionAt);
12923
12923
  const f = (i.wires ?? []).find(($) => $.id === h.onWire), b = s(h.at);
12924
12924
  if (!f) return b;
12925
- const y = (i.wires ?? []).filter(($) => $.id !== h.onWire), v = ($, C) => ({
12925
+ const y = (i.wires ?? []).filter(($) => $.id !== h.onWire), x = ($, C) => ({
12926
12926
  id: It($, C),
12927
12927
  ends: [$, C],
12928
12928
  ...f.label ? { label: f.label } : {}
@@ -12930,8 +12930,8 @@ const p2 = (e, t) => ({
12930
12930
  return i = {
12931
12931
  ...i,
12932
12932
  wires: wi(y, [
12933
- v(f.ends[0], b),
12934
- v(b, f.ends[1])
12933
+ x(f.ends[0], b),
12934
+ x(b, f.ends[1])
12935
12935
  ])
12936
12936
  }, b;
12937
12937
  }, d = c(n), m = c(o);
@@ -13144,9 +13144,9 @@ function w2(e, t) {
13144
13144
  }
13145
13145
  const { busId: a, busAt: l, axis: s } = i, c = E6(n, s), d = Xn(r, e), m = n.terminals.find((f) => f.id === c), p = s === "x" ? t[0] : l[0], g = s === "y" ? t[1] : l[1], h = m ? [me(p) - m.x, me(g) - m.y] : [me(t[0]), me(t[1])];
13146
13146
  return o.dispatch((f) => {
13147
- const b = { id: d, kind: e }, y = { at: h }, v = `${d}.${c}`, $ = {
13148
- id: It(a, v),
13149
- ends: [a, v]
13147
+ const b = { id: d, kind: e }, y = { at: h }, x = `${d}.${c}`, $ = {
13148
+ id: It(a, x),
13149
+ ends: [a, x]
13150
13150
  };
13151
13151
  return {
13152
13152
  ...f,
@@ -13237,9 +13237,9 @@ function T6(e, t, n) {
13237
13237
  me(p[1] - m.y)
13238
13238
  ], h = Xn(i, e);
13239
13239
  return r.dispatch((f) => {
13240
- const b = { id: h, kind: e }, y = { at: g }, v = `${h}.${m.id}`, $ = a.isBus && a.busId ? a.busId : t, C = {
13241
- id: It($, v),
13242
- ends: [$, v]
13240
+ const b = { id: h, kind: e }, y = { at: g }, x = `${h}.${m.id}`, $ = a.isBus && a.busId ? a.busId : t, C = {
13241
+ id: It($, x),
13242
+ ends: [$, x]
13243
13243
  };
13244
13244
  return {
13245
13245
  ...f,
@@ -13413,7 +13413,7 @@ function A2() {
13413
13413
  style: { "--ole-label-font-size": `${r}px` },
13414
13414
  children: [
13415
13415
  Array.from(e.values()).map((s) => {
13416
- var v;
13416
+ var x;
13417
13417
  const c = t.get(s.element.id);
13418
13418
  if (!c || !s.libraryDef) return null;
13419
13419
  const d = a[s.element.id];
@@ -13431,7 +13431,7 @@ function A2() {
13431
13431
  O6,
13432
13432
  {
13433
13433
  elementId: s.element.id,
13434
- currentName: ((v = s.element.name) == null ? void 0 : v.trim()) || s.element.id,
13434
+ currentName: ((x = s.element.name) == null ? void 0 : x.trim()) || s.element.id,
13435
13435
  world: g,
13436
13436
  anchor: h,
13437
13437
  fontSize: r
@@ -13481,6 +13481,7 @@ function A2() {
13481
13481
  return d ? /* @__PURE__ */ u(
13482
13482
  "text",
13483
13483
  {
13484
+ "data-wire-label": s.wireId,
13484
13485
  x: d.world[0],
13485
13486
  y: d.world[1],
13486
13487
  textAnchor: d.textAnchor,
@@ -13517,7 +13518,7 @@ function O6({
13517
13518
  }, [e]);
13518
13519
  function c() {
13519
13520
  var y;
13520
- const p = w.getState(), g = p.diagram.elements.find((v) => v.id === e);
13521
+ const p = w.getState(), g = p.diagram.elements.find((x) => x.id === e);
13521
13522
  if (!g) {
13522
13523
  p.setEditingElement(null);
13523
13524
  return;
@@ -13926,7 +13927,7 @@ function V6({
13926
13927
  for (let f = 0; f < e.colWidths.length; f++) {
13927
13928
  const b = ((g = e.cells[h]) == null ? void 0 : g[f]) ?? "";
13928
13929
  if (b === "") continue;
13929
- const y = e.colWidths[f], v = o + l[f] + cn, $ = r + s[h] + e.rowHeights[h] / 2 + c * 0.35, C = b.length * c * 0.55 > y - 2 * cn, I = `ole-ann-clip-${e.id}-${h}-${f}`;
13930
+ const y = e.colWidths[f], x = o + l[f] + cn, $ = r + s[h] + e.rowHeights[h] / 2 + c * 0.35, C = b.length * c * 0.55 > y - 2 * cn, I = `ole-ann-clip-${e.id}-${h}-${f}`;
13930
13931
  C && p.push(
13931
13932
  /* @__PURE__ */ u("clipPath", { id: I, children: /* @__PURE__ */ u(
13932
13933
  "rect",
@@ -13942,7 +13943,7 @@ function V6({
13942
13943
  "text",
13943
13944
  {
13944
13945
  className: "ole-ann-table-text",
13945
- x: v,
13946
+ x,
13946
13947
  y: $,
13947
13948
  fontSize: c,
13948
13949
  clipPath: C ? `url(#${I})` : void 0,
@@ -13983,7 +13984,7 @@ function K6({
13983
13984
  var b;
13984
13985
  const h = w.getState(), f = ((b = r.current) == null ? void 0 : b.value) ?? "";
13985
13986
  if (f !== s) {
13986
- const y = e.cells.map((v) => [...v]);
13987
+ const y = e.cells.map((x) => [...x]);
13987
13988
  for (; y.length <= n; ) y.push([]);
13988
13989
  y[n][o] = f, h.updateAnnotation(e.id, { cells: y });
13989
13990
  }
@@ -14232,9 +14233,9 @@ function Z6() {
14232
14233
  case "ellipse":
14233
14234
  return /* @__PURE__ */ u(Q6, { ann: i, model: r });
14234
14235
  case "table":
14235
- return /* @__PURE__ */ u(e4, { ann: i, model: r });
14236
+ return /* @__PURE__ */ u(eN, { ann: i, model: r });
14236
14237
  case "line":
14237
- return /* @__PURE__ */ u(r4, { ann: i, model: r });
14238
+ return /* @__PURE__ */ u(rN, { ann: i, model: r });
14238
14239
  default:
14239
14240
  return null;
14240
14241
  }
@@ -14344,18 +14345,18 @@ function J6({
14344
14345
  }
14345
14346
  );
14346
14347
  }
14347
- function e4({
14348
+ function eN({
14348
14349
  ann: e,
14349
14350
  model: t
14350
14351
  }) {
14351
14352
  const n = it(e), o = Ft(e), r = Wt(e);
14352
14353
  return /* @__PURE__ */ P("g", { className: "ole-annotation-handles", pointerEvents: "auto", children: [
14353
- o.slice(1, -1).map((i, a) => /* @__PURE__ */ u(n4, { index: a, x: e.at[0] + i, ann: e, model: t }, `c${a}`)),
14354
- r.slice(1, -1).map((i, a) => /* @__PURE__ */ u(o4, { index: a, y: e.at[1] + i, ann: e, model: t }, `r${a}`)),
14355
- B2.map((i, a) => /* @__PURE__ */ u(t4, { grip: i, ann: e, model: t, size: n }, a))
14354
+ o.slice(1, -1).map((i, a) => /* @__PURE__ */ u(nN, { index: a, x: e.at[0] + i, ann: e, model: t }, `c${a}`)),
14355
+ r.slice(1, -1).map((i, a) => /* @__PURE__ */ u(oN, { index: a, y: e.at[1] + i, ann: e, model: t }, `r${a}`)),
14356
+ B2.map((i, a) => /* @__PURE__ */ u(tN, { grip: i, ann: e, model: t, size: n }, a))
14356
14357
  ] });
14357
14358
  }
14358
- function t4({
14359
+ function tN({
14359
14360
  grip: e,
14360
14361
  ann: t,
14361
14362
  model: n,
@@ -14397,7 +14398,7 @@ function t4({
14397
14398
  function Ai(e, t, n) {
14398
14399
  return e.map((o) => Math.max(n, Math.round(o * t)));
14399
14400
  }
14400
- function n4({
14401
+ function nN({
14401
14402
  index: e,
14402
14403
  x: t,
14403
14404
  ann: n,
@@ -14427,7 +14428,7 @@ function n4({
14427
14428
  }
14428
14429
  );
14429
14430
  }
14430
- function o4({
14431
+ function oN({
14431
14432
  index: e,
14432
14433
  y: t,
14433
14434
  ann: n,
@@ -14457,14 +14458,14 @@ function o4({
14457
14458
  }
14458
14459
  );
14459
14460
  }
14460
- function r4({
14461
+ function rN({
14461
14462
  ann: e,
14462
14463
  model: t
14463
14464
  }) {
14464
14465
  const n = yn(e);
14465
- return /* @__PURE__ */ u("g", { className: "ole-annotation-handles", pointerEvents: "auto", children: n.map((o, r) => /* @__PURE__ */ u(i4, { index: r, pos: o, model: t }, r)) });
14466
+ return /* @__PURE__ */ u("g", { className: "ole-annotation-handles", pointerEvents: "auto", children: n.map((o, r) => /* @__PURE__ */ u(iN, { index: r, pos: o, model: t }, r)) });
14466
14467
  }
14467
- function i4({
14468
+ function iN({
14468
14469
  index: e,
14469
14470
  pos: t,
14470
14471
  model: n
@@ -14500,8 +14501,8 @@ function i4({
14500
14501
  }
14501
14502
  );
14502
14503
  }
14503
- const a4 = 20;
14504
- function s4() {
14504
+ const aN = 20;
14505
+ function sN() {
14505
14506
  const e = w((d) => d.selection), t = w((d) => d.internal);
14506
14507
  if (e.length !== 1) return null;
14507
14508
  const n = e[0], o = t.buses.get(n);
@@ -14550,7 +14551,7 @@ function Ei({
14550
14551
  const m = a.current;
14551
14552
  if (!m || d.pointerId !== m.pointerId || !i) return;
14552
14553
  const p = i.screenToSvg(d.clientX, d.clientY), g = r === "x" ? p[0] - m.startSvg[0] : p[1] - m.startSvg[1], h = y2() ? Math.round(g / Un) * Un : g, f = m.startSpan + (o === "end" ? h : -h);
14553
- if (f < a4) return;
14554
+ if (f < aN) return;
14554
14555
  const b = r === "x" ? [m.startAt[0] + h / 2, m.startAt[1]] : [m.startAt[0], m.startAt[1] + h / 2];
14555
14556
  w.getState().updateBus(n, { span: f, at: b });
14556
14557
  }, c = (d) => {
@@ -14576,7 +14577,7 @@ const er = 0.5;
14576
14577
  function rn(e, t) {
14577
14578
  return Math.abs(e[1] - t[1]) < er ? "h" : "v";
14578
14579
  }
14579
- function l4() {
14580
+ function lN() {
14580
14581
  const e = w((l) => l.selectedWire), t = w((l) => l.internal.wireRenders);
14581
14582
  if (!e) return null;
14582
14583
  const n = t.get(e);
@@ -14586,7 +14587,7 @@ function l4() {
14586
14587
  const s = rn(o[l - 1], o[l]), c = rn(o[l], o[l + 1]), d = l - 1 === 0, m = l + 1 === r - 1, p = d && s === "v" || m && c === "v", g = d && s === "h" || m && c === "h";
14587
14588
  p && g || i.push(
14588
14589
  /* @__PURE__ */ u(
14589
- c4,
14590
+ cN,
14590
14591
  {
14591
14592
  wireId: e,
14592
14593
  index: l,
@@ -14602,7 +14603,7 @@ function l4() {
14602
14603
  const s = o[l], c = o[l + 1];
14603
14604
  Math.abs(s[0] - c[0]) < er && Math.abs(s[1] - c[1]) < er || a.push(
14604
14605
  /* @__PURE__ */ u(
14605
- d4,
14606
+ dN,
14606
14607
  {
14607
14608
  wireId: e,
14608
14609
  segIndex: l,
@@ -14617,7 +14618,7 @@ function l4() {
14617
14618
  i
14618
14619
  ] });
14619
14620
  }
14620
- function c4({
14621
+ function cN({
14621
14622
  wireId: e,
14622
14623
  index: t,
14623
14624
  xLocked: n,
@@ -14642,19 +14643,19 @@ function c4({
14642
14643
  }, m = (h) => {
14643
14644
  const f = i.current;
14644
14645
  if (!f || h.pointerId !== f.pointerId || !r) return;
14645
- const b = r.screenToSvg(h.clientX, h.clientY), y = f.startPath, v = f.index;
14646
- if (v <= 0 || v >= y.length - 1) return;
14647
- const $ = y[v], C = [
14646
+ const b = r.screenToSvg(h.clientX, h.clientY), y = f.startPath, x = f.index;
14647
+ if (x <= 0 || x >= y.length - 1) return;
14648
+ const $ = y[x], C = [
14648
14649
  f.xLocked ? $[0] : me($[0] + (b[0] - f.startSvg[0])),
14649
14650
  f.yLocked ? $[1] : me($[1] + (b[1] - f.startSvg[1]))
14650
14651
  ];
14651
14652
  if (C[0] === $[0] && C[1] === $[1]) return;
14652
14653
  const I = y.map((fe) => [fe[0], fe[1]]);
14653
- I[v] = C;
14654
- const W = rn(y[v - 1], y[v]);
14655
- v - 1 > 0 && (W === "h" ? I[v - 1] = [y[v - 1][0], C[1]] : I[v - 1] = [C[0], y[v - 1][1]]);
14656
- const oe = rn(y[v], y[v + 1]);
14657
- v + 1 < y.length - 1 && (oe === "h" ? I[v + 1] = [y[v + 1][0], C[1]] : I[v + 1] = [C[0], y[v + 1][1]]), w.getState().updateWirePath(e, I);
14654
+ I[x] = C;
14655
+ const W = rn(y[x - 1], y[x]);
14656
+ x - 1 > 0 && (W === "h" ? I[x - 1] = [y[x - 1][0], C[1]] : I[x - 1] = [C[0], y[x - 1][1]]);
14657
+ const oe = rn(y[x], y[x + 1]);
14658
+ x + 1 < y.length - 1 && (oe === "h" ? I[x + 1] = [y[x + 1][0], C[1]] : I[x + 1] = [C[0], y[x + 1][1]]), w.getState().updateWirePath(e, I);
14658
14659
  }, p = (h) => {
14659
14660
  const f = i.current;
14660
14661
  !f || h.pointerId !== f.pointerId || (h.target.hasPointerCapture(h.pointerId) && h.target.releasePointerCapture(h.pointerId), i.current = null, document.body.style.cursor = "");
@@ -14675,13 +14676,13 @@ function c4({
14675
14676
  h.stopPropagation(), h.preventDefault();
14676
14677
  const f = w.getState().internal.wireRenders.get(e);
14677
14678
  if (!f || f.path.length <= 2 || t <= 0 || t >= f.path.length - 1) return;
14678
- const b = f.path.filter((y, v) => v !== t);
14679
+ const b = f.path.filter((y, x) => x !== t);
14679
14680
  w.getState().updateWirePath(e, b);
14680
14681
  }
14681
14682
  }
14682
14683
  );
14683
14684
  }
14684
- function d4({
14685
+ function dN({
14685
14686
  wireId: e,
14686
14687
  segIndex: t,
14687
14688
  axis: n
@@ -14704,10 +14705,10 @@ function d4({
14704
14705
  }, p = (h) => {
14705
14706
  const f = r.current;
14706
14707
  if (!f || h.pointerId !== f.pointerId || !o) return;
14707
- const b = o.screenToSvg(h.clientX, h.clientY), y = f.startPath, v = f.segIndex;
14708
- if (v >= y.length - 1) return;
14709
- const $ = y[v], C = y[v + 1], I = [];
14710
- for (let W = 0; W <= v; W++) I.push(y[W]);
14708
+ const b = o.screenToSvg(h.clientX, h.clientY), y = f.startPath, x = f.segIndex;
14709
+ if (x >= y.length - 1) return;
14710
+ const $ = y[x], C = y[x + 1], I = [];
14711
+ for (let W = 0; W <= x; W++) I.push(y[W]);
14711
14712
  if (f.axis === "h") {
14712
14713
  const W = me($[1] + (b[1] - f.startSvg[1]));
14713
14714
  I.push([$[0], W]), I.push([C[0], W]);
@@ -14715,7 +14716,7 @@ function d4({
14715
14716
  const W = me($[0] + (b[0] - f.startSvg[0]));
14716
14717
  I.push([W, $[1]]), I.push([W, C[1]]);
14717
14718
  }
14718
- for (let W = v + 1; W < y.length; W++) I.push(y[W]);
14719
+ for (let W = x + 1; W < y.length; W++) I.push(y[W]);
14719
14720
  w.getState().updateWirePath(e, I);
14720
14721
  }, g = (h) => {
14721
14722
  const f = r.current;
@@ -14755,7 +14756,7 @@ function d4({
14755
14756
  }
14756
14757
  );
14757
14758
  }
14758
- const u4 = 3, Io = 12;
14759
+ const uN = 3, Io = 12;
14759
14760
  function F2() {
14760
14761
  const e = de((s) => s.internal.buses), t = de((s) => s.selection), n = de((s) => s.selectedNode), o = de((s) => s.internal.nodes), r = de((s) => s.internal.terminalToNode), i = jt().props, a = new Set(t), l = /* @__PURE__ */ new Set();
14761
14762
  if (n) {
@@ -14765,7 +14766,7 @@ function F2() {
14765
14766
  !c.includes(".") && e.has(c) && l.add(c);
14766
14767
  }
14767
14768
  return /* @__PURE__ */ u("g", { className: "ole-bus-layer", children: Array.from(e.values()).map(({ bus: s, geometry: c }) => {
14768
- const { axis: d, at: m, span: p } = c, g = p / 2, h = d === "x" ? m[0] - g : m[0], f = d === "x" ? m[1] : m[1] - g, b = d === "x" ? m[0] + g : m[0], y = d === "x" ? m[1] : m[1] + g, v = a.has(s.id), $ = l.has(s.id), C = i[s.id];
14769
+ const { axis: d, at: m, span: p } = c, g = p / 2, h = d === "x" ? m[0] - g : m[0], f = d === "x" ? m[1] : m[1] - g, b = d === "x" ? m[0] + g : m[0], y = d === "x" ? m[1] : m[1] + g, x = a.has(s.id), $ = l.has(s.id), C = i[s.id];
14769
14770
  if ((C == null ? void 0 : C.visible) === !1) return null;
14770
14771
  const I = r.get(s.id) ?? void 0, W = Io / 2, oe = d === "x" ? m[0] - g : m[0] - W, fe = d === "x" ? m[1] - W : m[1] - g, A = d === "x" ? p : Io, L = d === "x" ? Io : p;
14771
14772
  return /* @__PURE__ */ P(
@@ -14774,7 +14775,7 @@ function F2() {
14774
14775
  "data-bus-id": s.id,
14775
14776
  "data-element-id": s.id,
14776
14777
  "data-node-id": I,
14777
- "data-selected": v ? "true" : void 0,
14778
+ "data-selected": x ? "true" : void 0,
14778
14779
  "data-node-related": $ ? "true" : void 0,
14779
14780
  "data-alarm": wr(C),
14780
14781
  "data-quality": $2(C),
@@ -14799,7 +14800,7 @@ function F2() {
14799
14800
  x2: b,
14800
14801
  y2: y,
14801
14802
  stroke: "currentColor",
14802
- strokeWidth: u4,
14803
+ strokeWidth: uN,
14803
14804
  strokeLinecap: "round",
14804
14805
  fill: "none"
14805
14806
  }
@@ -14810,7 +14811,7 @@ function F2() {
14810
14811
  );
14811
14812
  }) });
14812
14813
  }
14813
- function m4() {
14814
+ function mN() {
14814
14815
  const e = w((l) => l.busbarDrawStart), t = w((l) => l.cursorSvg);
14815
14816
  if (!e || !t) return null;
14816
14817
  const n = t[0] - e[0], o = t[1] - e[1], r = Math.abs(n) >= Math.abs(o), i = r ? t[0] : e[0], a = r ? e[1] : t[1];
@@ -14845,7 +14846,7 @@ function m4() {
14845
14846
  )
14846
14847
  ] });
14847
14848
  }
14848
- const p4 = 2.5, h4 = 9, f4 = 13, g4 = -13, b4 = 4.5, y4 = 8;
14849
+ const pN = 2.5, hN = 9, fN = 13, gN = -13, bN = 4.5, yN = 8;
14849
14850
  function W2() {
14850
14851
  const e = de((l) => l.internal.junctions), t = de((l) => l.selection), n = de((l) => l.selectedNode), o = de((l) => l.internal.nodes), r = de((l) => l.internal.terminalToNode), i = new Set(t), a = /* @__PURE__ */ new Set();
14851
14852
  if (n) {
@@ -14853,7 +14854,7 @@ function W2() {
14853
14854
  if (l) for (const s of l.terminals) a.add(s);
14854
14855
  }
14855
14856
  return /* @__PURE__ */ u("g", { className: "ole-junction-layer", children: Array.from(e.values()).map(({ junction: l, world: s, degree: c }) => {
14856
- const d = r.get(l.id) ?? void 0, m = t.length === 1 && t[0] === l.id, p = s[0] + f4, g = s[1] + g4;
14857
+ const d = r.get(l.id) ?? void 0, m = t.length === 1 && t[0] === l.id, p = s[0] + fN, g = s[1] + gN;
14857
14858
  return /* @__PURE__ */ P(
14858
14859
  "g",
14859
14860
  {
@@ -14865,12 +14866,12 @@ function W2() {
14865
14866
  "data-node-related": a.has(l.id) ? "true" : void 0,
14866
14867
  className: "ole-junction",
14867
14868
  children: [
14868
- /* @__PURE__ */ u("circle", { cx: s[0], cy: s[1], r: h4, fill: "transparent", className: "ole-junction-hit" }),
14869
- /* @__PURE__ */ u("circle", { cx: s[0], cy: s[1], r: p4, className: "ole-junction-dot" }),
14869
+ /* @__PURE__ */ u("circle", { cx: s[0], cy: s[1], r: hN, fill: "transparent", className: "ole-junction-hit" }),
14870
+ /* @__PURE__ */ u("circle", { cx: s[0], cy: s[1], r: pN, className: "ole-junction-dot" }),
14870
14871
  m && /* @__PURE__ */ P("g", { className: "ole-junction-wire-handle-group", children: [
14871
14872
  /* @__PURE__ */ u("line", { x1: s[0], y1: s[1], x2: p, y2: g, className: "ole-junction-wire-handle-stem" }),
14872
- /* @__PURE__ */ u("circle", { cx: p, cy: g, r: y4, fill: "transparent", className: "ole-junction-wire-handle" }),
14873
- /* @__PURE__ */ u("circle", { cx: p, cy: g, r: b4, className: "ole-junction-wire-handle-dot" })
14873
+ /* @__PURE__ */ u("circle", { cx: p, cy: g, r: yN, fill: "transparent", className: "ole-junction-wire-handle" }),
14874
+ /* @__PURE__ */ u("circle", { cx: p, cy: g, r: bN, className: "ole-junction-wire-handle-dot" })
14874
14875
  ] })
14875
14876
  ]
14876
14877
  },
@@ -14892,19 +14893,19 @@ function q2(e, t) {
14892
14893
  if (r !== void 0) return r;
14893
14894
  const i = e.replace(
14894
14895
  /stroke-width="([0-9.]+)"/g,
14895
- (a, l) => `stroke-width="${w4(Number(l) / n)}"`
14896
+ (a, l) => `stroke-width="${wN(Number(l) / n)}"`
14896
14897
  );
14897
14898
  return Pn.size > 500 && Pn.clear(), Pn.set(o, i), i;
14898
14899
  }
14899
- function w4(e) {
14900
+ function wN(e) {
14900
14901
  return Math.round(e * 1e4) / 1e4;
14901
14902
  }
14902
- function v4(e) {
14903
+ function vN(e) {
14903
14904
  const t = e.trim().split(/\s+/).map(Number);
14904
14905
  return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
14905
14906
  }
14906
- function x4({ lib: e }) {
14907
- const t = v4(e.viewBox);
14907
+ function xN({ lib: e }) {
14908
+ const t = vN(e.viewBox);
14908
14909
  return t ? /* @__PURE__ */ u(
14909
14910
  "rect",
14910
14911
  {
@@ -14941,7 +14942,7 @@ function G2() {
14941
14942
  transform: ht(c),
14942
14943
  className: He(s.element.color) ? `ole-element ${He(s.element.color)}` : "ole-element",
14943
14944
  children: [
14944
- /* @__PURE__ */ u(x4, { lib: s.libraryDef }),
14945
+ /* @__PURE__ */ u(xN, { lib: s.libraryDef }),
14945
14946
  /* @__PURE__ */ u(
14946
14947
  "g",
14947
14948
  {
@@ -15009,17 +15010,17 @@ function zn(e) {
15009
15010
  V2 = e;
15010
15011
  for (const t of tr) t(e);
15011
15012
  }
15012
- function k4() {
15013
+ function kN() {
15013
15014
  return V2;
15014
15015
  }
15015
- function S4(e) {
15016
+ function SN(e) {
15016
15017
  return tr.add(e), () => {
15017
15018
  tr.delete(e);
15018
15019
  };
15019
15020
  }
15020
- function _4() {
15021
- const [e, t] = ye(k4());
15022
- return Q(() => S4(t), []), !e || e.w === 0 && e.h === 0 ? null : /* @__PURE__ */ u(
15021
+ function _N() {
15022
+ const [e, t] = ye(kN());
15023
+ return Q(() => SN(t), []), !e || e.w === 0 && e.h === 0 ? null : /* @__PURE__ */ u(
15023
15024
  "rect",
15024
15025
  {
15025
15026
  className: "ole-marquee",
@@ -15031,7 +15032,7 @@ function _4() {
15031
15032
  }
15032
15033
  );
15033
15034
  }
15034
- function C4() {
15035
+ function CN() {
15035
15036
  const e = w((d) => d.activeTool), t = w((d) => d.placeKind), n = w((d) => d.cursorSvg), o = w((d) => d.placeFromTerminal), r = w((d) => d.internal.library);
15036
15037
  if (e !== "place" || !t || !n) return null;
15037
15038
  const i = r.get(t);
@@ -15099,7 +15100,7 @@ function K2() {
15099
15100
  }
15100
15101
  const l = t.get(i), s = n.get(i);
15101
15102
  if (!(l != null && l.libraryDef) || !s) return null;
15102
- const c = $4(l.libraryDef.viewBox);
15103
+ const c = $N(l.libraryDef.viewBox);
15103
15104
  return c ? /* @__PURE__ */ u(
15104
15105
  "rect",
15105
15106
  {
@@ -15115,11 +15116,11 @@ function K2() {
15115
15116
  ) : null;
15116
15117
  }) });
15117
15118
  }
15118
- function $4(e) {
15119
+ function $N(e) {
15119
15120
  const t = e.trim().split(/\s+/).map(Number);
15120
15121
  return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
15121
15122
  }
15122
- function A4() {
15123
+ function AN() {
15123
15124
  const e = w((i) => i.internal.terminals), t = w((i) => i.internal.terminalToNode), n = w((i) => i.wireFromTerminal), o = w((i) => i.selection), r = new Set(o);
15124
15125
  return /* @__PURE__ */ u("g", { className: "ole-terminal-layer", children: Array.from(e.values()).map((i) => {
15125
15126
  const a = t.get(i.ref), l = a !== void 0, s = n === i.ref, c = r.has(i.elementId);
@@ -15142,13 +15143,13 @@ function A4() {
15142
15143
  }) });
15143
15144
  }
15144
15145
  const Ni = 4;
15145
- function E4(e, t, n, o) {
15146
+ function EN(e, t, n, o) {
15146
15147
  const r = t[0] - e[0], i = t[1] - e[1], a = o[0] - n[0], l = o[1] - n[1], s = r * l - i * a;
15147
15148
  if (Math.abs(s) < 1e-9) return null;
15148
15149
  const c = ((n[0] - e[0]) * l - (n[1] - e[1]) * a) / s, d = ((n[0] - e[0]) * i - (n[1] - e[1]) * r) / s, m = 1e-6;
15149
15150
  return c <= m || c >= 1 - m || d <= m || d >= 1 - m ? null : [e[0] + c * r, e[1] + c * i];
15150
15151
  }
15151
- function N4(e, t) {
15152
+ function NN(e, t) {
15152
15153
  const n = [];
15153
15154
  let o = [e[0]];
15154
15155
  for (let r = 0; r < e.length - 1; r++) {
@@ -15159,8 +15160,8 @@ function N4(e, t) {
15159
15160
  }
15160
15161
  const s = a[0] - i[0], c = a[1] - i[1], d = Math.hypot(s, c) || 1, m = s / d, p = c / d, g = (f) => (f[0] - i[0]) * m + (f[1] - i[1]) * p, h = l.slice().sort((f, b) => g(f) - g(b));
15161
15162
  for (const f of h) {
15162
- const b = g(f), y = Math.max(0, b - Ni), v = Math.min(d, b + Ni);
15163
- o.push([i[0] + m * y, i[1] + p * y]), n.push(o), o = [[i[0] + m * v, i[1] + p * v]];
15163
+ const b = g(f), y = Math.max(0, b - Ni), x = Math.min(d, b + Ni);
15164
+ o.push([i[0] + m * y, i[1] + p * y]), n.push(o), o = [[i[0] + m * x, i[1] + p * x]];
15164
15165
  }
15165
15166
  o.push(a);
15166
15167
  }
@@ -15189,16 +15190,16 @@ function X2() {
15189
15190
  for (let h = g + 1; h < c.length; h++) {
15190
15191
  const f = c[g], b = c[h];
15191
15192
  if (f.wireId === b.wireId || !(f.node && b.node && f.node !== b.node)) continue;
15192
- const y = E4(f.a, f.b, b.a, b.b);
15193
+ const y = EN(f.a, f.b, b.a, b.b);
15193
15194
  if (!y) continue;
15194
- const v = f.wireId < b.wireId ? f : b;
15195
- let $ = d.get(v.wireId);
15196
- $ || ($ = /* @__PURE__ */ new Map(), d.set(v.wireId, $));
15197
- const C = $.get(v.i) ?? [];
15198
- C.push(y), $.set(v.i, C);
15195
+ const x = f.wireId < b.wireId ? f : b;
15196
+ let $ = d.get(x.wireId);
15197
+ $ || ($ = /* @__PURE__ */ new Map(), d.set(x.wireId, $));
15198
+ const C = $.get(x.i) ?? [];
15199
+ C.push(y), $.set(x.i, C);
15199
15200
  }
15200
15201
  return /* @__PURE__ */ u("g", { className: "ole-wire-layer", fill: "none", stroke: "currentColor", strokeWidth: 1, children: s.flatMap((g) => {
15201
- const h = g.path, f = h.map((W) => `${W[0]},${W[1]}`).join(" "), b = a.get(g.wireId), y = o === g.wireId, v = r != null && r === b, $ = y || v ? "true" : void 0, C = d.get(g.wireId), I = C ? N4(h, C) : [h];
15202
+ const h = g.path, f = h.map((W) => `${W[0]},${W[1]}`).join(" "), b = a.get(g.wireId), y = o === g.wireId, x = r != null && r === b, $ = y || x ? "true" : void 0, C = d.get(g.wireId), I = C ? NN(h, C) : [h];
15202
15203
  return [
15203
15204
  /* @__PURE__ */ u(
15204
15205
  "polyline",
@@ -15234,17 +15235,17 @@ function pt(e) {
15234
15235
  for (const t of nr) t(e);
15235
15236
  }
15236
15237
  }
15237
- function T4() {
15238
+ function TN() {
15238
15239
  return vt;
15239
15240
  }
15240
- function I4(e) {
15241
+ function IN(e) {
15241
15242
  return nr.add(e), () => {
15242
15243
  nr.delete(e);
15243
15244
  };
15244
15245
  }
15245
- function P4() {
15246
- const e = w((s) => s.wireDragFrom), t = w((s) => s.cursorSvg), [n, o] = ye(T4());
15247
- if (Q(() => I4(o), []), !e || !t) return null;
15246
+ function PN() {
15247
+ const e = w((s) => s.wireDragFrom), t = w((s) => s.cursorSvg), [n, o] = ye(TN());
15248
+ if (Q(() => IN(o), []), !e || !t) return null;
15248
15249
  const r = e.world, i = (n == null ? void 0 : n.world[0]) ?? t[0], a = (n == null ? void 0 : n.world[1]) ?? t[1], l = (n == null ? void 0 : n.create) === "junction";
15249
15250
  return /* @__PURE__ */ P("g", { className: "ole-wire-preview", pointerEvents: "none", children: [
15250
15251
  /* @__PURE__ */ u(
@@ -15296,11 +15297,11 @@ function ft(e) {
15296
15297
  var t;
15297
15298
  return ((t = gt(e, "data-element-id")) == null ? void 0 : t.getAttribute("data-element-id")) ?? null;
15298
15299
  }
15299
- function z4(e) {
15300
+ function zN(e) {
15300
15301
  var t;
15301
15302
  return ((t = gt(e, "data-bus-id")) == null ? void 0 : t.getAttribute("data-bus-id")) ?? null;
15302
15303
  }
15303
- function M4(e) {
15304
+ function MN(e) {
15304
15305
  var t;
15305
15306
  return ((t = gt(e, "data-junction-id")) == null ? void 0 : t.getAttribute("data-junction-id")) ?? null;
15306
15307
  }
@@ -15308,9 +15309,9 @@ function go(e) {
15308
15309
  var r;
15309
15310
  const t = (r = gt(e, "data-terminal-id")) == null ? void 0 : r.getAttribute("data-terminal-id");
15310
15311
  if (t) return t;
15311
- const n = M4(e);
15312
+ const n = MN(e);
15312
15313
  if (n) return n;
15313
- const o = z4(e);
15314
+ const o = zN(e);
15314
15315
  return o || null;
15315
15316
  }
15316
15317
  function bo(e) {
@@ -15342,7 +15343,7 @@ function U2(e, t) {
15342
15343
  } catch {
15343
15344
  }
15344
15345
  }
15345
- function D4(e) {
15346
+ function DN(e) {
15346
15347
  if (!(e instanceof HTMLElement)) return !1;
15347
15348
  const t = e.tagName;
15348
15349
  return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable;
@@ -15369,10 +15370,10 @@ function Y2() {
15369
15370
  }
15370
15371
  (e.selectedNode || e.selectedWire || e.selection.length > 0 || e.selectedAnnotations.length > 0) && e.clearSelection();
15371
15372
  }
15372
- function O4() {
15373
+ function ON() {
15373
15374
  Q(() => {
15374
15375
  const e = (t) => {
15375
- if (D4(t.target) || w.getState().readOnly) return;
15376
+ if (DN(t.target) || w.getState().readOnly) return;
15376
15377
  const n = t.metaKey || t.ctrlKey, o = w.getState();
15377
15378
  if (n && t.key.toLowerCase() === "z") {
15378
15379
  t.preventDefault(), t.shiftKey ? o.redo() : o.undo();
@@ -15476,22 +15477,22 @@ function O4() {
15476
15477
  }
15477
15478
  let rr = null;
15478
15479
  const ir = /* @__PURE__ */ new Set();
15479
- function L4(e) {
15480
+ function LN(e) {
15480
15481
  if (e !== rr) {
15481
15482
  rr = e;
15482
15483
  for (const t of ir) t(e);
15483
15484
  }
15484
15485
  }
15485
- function R4() {
15486
+ function RN() {
15486
15487
  return rr;
15487
15488
  }
15488
- function B4(e) {
15489
+ function BN(e) {
15489
15490
  return ir.add(e), () => {
15490
15491
  ir.delete(e);
15491
15492
  };
15492
15493
  }
15493
- const Ti = "ole-hover-element-host", j4 = "ole-hover-terminal-on", H4 = "ole-hover-node-on";
15494
- function F4(e) {
15494
+ const Ti = "ole-hover-element-host", jN = "ole-hover-terminal-on", HN = "ole-hover-node-on";
15495
+ function FN(e) {
15495
15496
  const t = g2();
15496
15497
  Q(() => {
15497
15498
  const n = e.current;
@@ -15511,7 +15512,7 @@ function F4(e) {
15511
15512
  `.ole-terminal[data-element-id="${Mn(p)}"]`
15512
15513
  )
15513
15514
  ) : [];
15514
- l(i, g, j4), o = p, p ? n.setAttribute("data-hover-element", "") : n.removeAttribute("data-hover-element"), L4(p);
15515
+ l(i, g, jN), o = p, p ? n.setAttribute("data-hover-element", "") : n.removeAttribute("data-hover-element"), LN(p);
15515
15516
  }, c = (p) => {
15516
15517
  if (p === r) return;
15517
15518
  const g = p ? Array.from(
@@ -15519,7 +15520,7 @@ function F4(e) {
15519
15520
  `[data-node-id="${Mn(p)}"]`
15520
15521
  )
15521
15522
  ) : [];
15522
- l(a, g, H4), r = p, p ? n.setAttribute("data-hover-node", "") : n.removeAttribute("data-hover-node");
15523
+ l(a, g, HN), r = p, p ? n.setAttribute("data-hover-node", "") : n.removeAttribute("data-hover-node");
15523
15524
  }, d = (p) => {
15524
15525
  s(ft(p.target));
15525
15526
  const g = go(p.target);
@@ -15536,20 +15537,20 @@ function F4(e) {
15536
15537
  function Mn(e) {
15537
15538
  return e.replace(/(["\\])/g, "\\$1");
15538
15539
  }
15539
- function W4(e, t, n) {
15540
+ function WN(e, t, n) {
15540
15541
  const o = [];
15541
15542
  for (const i of e.elements.values()) {
15542
15543
  if (!i.libraryDef) continue;
15543
15544
  const a = e.layout.get(i.element.id);
15544
15545
  if (!a) continue;
15545
- const l = G4(i.libraryDef.viewBox);
15546
+ const l = GN(i.libraryDef.viewBox);
15546
15547
  if (!l) continue;
15547
15548
  const s = [
15548
15549
  [l.x, l.y],
15549
15550
  [l.x + l.w, l.y],
15550
15551
  [l.x, l.y + l.h],
15551
15552
  [l.x + l.w, l.y + l.h]
15552
- ].map(([g, h]) => q4([g, h], a));
15553
+ ].map(([g, h]) => qN([g, h], a));
15553
15554
  let c = 1 / 0, d = -1 / 0, m = 1 / 0, p = -1 / 0;
15554
15555
  for (const [g, h] of s)
15555
15556
  g < c && (c = g), g > d && (d = g), h < m && (m = h), h > p && (p = h);
@@ -15571,7 +15572,7 @@ function W4(e, t, n) {
15571
15572
  function Dn(e, t, n, o, r) {
15572
15573
  return o >= e.x && t <= e.x + e.w && r >= e.y && n <= e.y + e.h;
15573
15574
  }
15574
- function q4(e, t) {
15575
+ function qN(e, t) {
15575
15576
  const n = t.scale ?? 1;
15576
15577
  let o = e[0] * n, r = e[1] * n;
15577
15578
  switch (t.mirror && (o = -o), t.rot) {
@@ -15589,11 +15590,11 @@ function q4(e, t) {
15589
15590
  }
15590
15591
  return [o + t.at[0], r + t.at[1]];
15591
15592
  }
15592
- function G4(e) {
15593
+ function GN(e) {
15593
15594
  const t = e.trim().split(/\s+/).map(Number);
15594
15595
  return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
15595
15596
  }
15596
- function V4(e, t) {
15597
+ function VN(e, t) {
15597
15598
  const n = w.getState().internal;
15598
15599
  if (!e.includes(".")) {
15599
15600
  const r = n.buses.get(e);
@@ -15612,7 +15613,7 @@ function V4(e, t) {
15612
15613
  const o = n.terminals.get(e);
15613
15614
  return o ? { ref: e, world: o.world, isBus: !1 } : null;
15614
15615
  }
15615
- const Ii = 10, On = (e) => Math.round(e / Ii) * Ii, K4 = 16;
15616
+ const Ii = 10, On = (e) => Math.round(e / Ii) * Ii, KN = 16;
15616
15617
  function Z2(e, t) {
15617
15618
  let n = e[0], o = 1 / 0;
15618
15619
  for (let r = 0; r < e.length - 1; r++) {
@@ -15624,7 +15625,7 @@ function Z2(e, t) {
15624
15625
  function Jn(e, t) {
15625
15626
  return typeof document < "u" ? document.elementFromPoint(e, t) : null;
15626
15627
  }
15627
- function X4(e, t) {
15628
+ function XN(e, t) {
15628
15629
  const n = w.getState().internal.wireRenders;
15629
15630
  let o = null, r = t;
15630
15631
  for (const i of n.values()) {
@@ -15637,7 +15638,7 @@ function X4(e, t) {
15637
15638
  function an(e, t, n) {
15638
15639
  const o = e ? go(e) : null;
15639
15640
  if (o) {
15640
- const l = V4(o, t);
15641
+ const l = VN(o, t);
15641
15642
  if (l) return { spec: { end: o }, world: l.world, ref: o, isBus: l.isBus, create: !1 };
15642
15643
  }
15643
15644
  let r = e ? or(e) : null, i = null;
@@ -15645,7 +15646,7 @@ function an(e, t, n) {
15645
15646
  const l = w.getState().internal.wireRenders.get(r);
15646
15647
  i = l ? Z2(l.path, t) : t;
15647
15648
  } else {
15648
- const l = X4(t, n);
15649
+ const l = XN(t, n);
15649
15650
  l && (r = l.wireId, i = l.at);
15650
15651
  }
15651
15652
  if (r && i) {
@@ -15656,7 +15657,7 @@ function an(e, t, n) {
15656
15657
  return { spec: { junctionAt: a }, world: a, ref: null, isBus: !1, create: !0 };
15657
15658
  }
15658
15659
  function sn(e, t, n) {
15659
- const o = e.viewport.screenToSvg(t, n), r = e.viewport.screenToSvg(t + K4, n);
15660
+ const o = e.viewport.screenToSvg(t, n), r = e.viewport.screenToSvg(t + KN, n);
15660
15661
  return Math.hypot(r[0] - o[0], r[1] - o[1]);
15661
15662
  }
15662
15663
  function Q2(e) {
@@ -15677,11 +15678,11 @@ function Po(e, t) {
15677
15678
  );
15678
15679
  }
15679
15680
  let he = null, Oe = null, Le = null, xe = null, Ce = null;
15680
- const U4 = {
15681
+ const UN = {
15681
15682
  id: "select",
15682
15683
  cursor: "default",
15683
15684
  onPointerDown(e, t) {
15684
- var p, g, h, f, b, y, v, $, C, I, W, oe, fe, A;
15685
+ var p, g, h, f, b, y, x, $, C, I, W, oe, fe, A;
15685
15686
  if (e.button !== 0 || e.target instanceof Element && e.target.closest(".ole-bus-handle, .ole-wire-handle, .ole-annotation-handle"))
15686
15687
  return;
15687
15688
  const n = w.getState(), o = mn(e.target);
@@ -15727,7 +15728,7 @@ const U4 = {
15727
15728
  const L = (f = i.closest("[data-junction-id]")) == null ? void 0 : f.getAttribute("data-junction-id");
15728
15729
  if (L) {
15729
15730
  e.preventDefault(), e.stopPropagation(), e.target instanceof Element && ((y = (b = e.target).hasPointerCapture) != null && y.call(b, e.pointerId)) && e.target.releasePointerCapture(e.pointerId), t.hostEl.classList.add("tool-wire"), n.setWireFromTerminal(L);
15730
- const H = (v = n.internal.junctions.get(L)) == null ? void 0 : v.world;
15731
+ const H = (x = n.internal.junctions.get(L)) == null ? void 0 : x.world;
15731
15732
  H && n.setWireDragFrom({ spec: { end: L }, world: H, ref: L }), n.setCursorSvg(t.viewport.screenToSvg(e.clientX, e.clientY)), Le = { pointerId: e.pointerId, fromRef: L };
15732
15733
  return;
15733
15734
  }
@@ -15936,7 +15937,7 @@ const U4 = {
15936
15937
  t.hostEl.hasPointerCapture(e.pointerId) && t.hostEl.releasePointerCapture(e.pointerId);
15937
15938
  const o = t.viewport.screenToSvg(e.clientX, e.clientY), r = Di(Oe.startSvg, o);
15938
15939
  if (r.w >= Pi || r.h >= Pi) {
15939
- const i = w.getState(), a = W4(i.internal, i.diagram.annotations, r);
15940
+ const i = w.getState(), a = WN(i.internal, i.diagram.annotations, r);
15940
15941
  Oe.shiftKey ? i.setSelection(
15941
15942
  Oi(Oe.baseSelection, a.elements),
15942
15943
  Oi(Oe.baseAnnotations, a.annotations)
@@ -16086,9 +16087,9 @@ function Oi(e, t) {
16086
16087
  function Re(e) {
16087
16088
  return e.replace(/(["\\])/g, "\\$1");
16088
16089
  }
16089
- const Y4 = 4;
16090
+ const YN = 4;
16090
16091
  let pe = null;
16091
- const Z4 = {
16092
+ const ZN = {
16092
16093
  id: "pan",
16093
16094
  cursor: "grab",
16094
16095
  onPointerDown(e, t) {
@@ -16128,7 +16129,7 @@ const Z4 = {
16128
16129
  onPointerMove(e, t) {
16129
16130
  if (!pe || e.pointerId !== pe.pointerId) return;
16130
16131
  const n = e.clientX - pe.startX, o = e.clientY - pe.startY;
16131
- if (!pe.moved && Math.hypot(n, o) > Y4) {
16132
+ if (!pe.moved && Math.hypot(n, o) > YN) {
16132
16133
  pe.moved = !0;
16133
16134
  try {
16134
16135
  t.hostEl.setPointerCapture(e.pointerId);
@@ -16178,7 +16179,7 @@ const Z4 = {
16178
16179
  );
16179
16180
  a && a.removeAttribute("transform");
16180
16181
  }
16181
- } else !pe.moved && !w.getState().readOnly && Q4(pe.startTarget);
16182
+ } else !pe.moved && !w.getState().readOnly && QN(pe.startTarget);
16182
16183
  pe = null;
16183
16184
  }
16184
16185
  },
@@ -16203,7 +16204,7 @@ const Z4 = {
16203
16204
  pe = null;
16204
16205
  }
16205
16206
  };
16206
- function Q4(e) {
16207
+ function QN(e) {
16207
16208
  if (!e) return;
16208
16209
  const t = w.getState(), n = pn(e);
16209
16210
  if (n) {
@@ -16240,14 +16241,14 @@ const nn = {
16240
16241
  function Ke(e, t) {
16241
16242
  return Li[e] >= Li[t];
16242
16243
  }
16243
- function J4(e) {
16244
+ function JN(e) {
16244
16245
  return e >= nn.tight ? "full" : e >= nn.compact ? "tight" : e >= nn.dense ? "compact" : e >= nn.mini ? "dense" : "mini";
16245
16246
  }
16246
16247
  const J2 = oo("full");
16247
16248
  function bt() {
16248
16249
  return ro(J2);
16249
16250
  }
16250
- function eN(e) {
16251
+ function e4(e) {
16251
16252
  const [t, n] = ye(null);
16252
16253
  return Dt(() => {
16253
16254
  const o = e.current;
@@ -16273,10 +16274,10 @@ function eS() {
16273
16274
  function yt() {
16274
16275
  eS() && w.getState().setActiveTool("pan");
16275
16276
  }
16276
- function tN() {
16277
+ function t4() {
16277
16278
  eS() && w.getState().setPlaceKind(null);
16278
16279
  }
16279
- const nN = {
16280
+ const n4 = {
16280
16281
  id: "wire",
16281
16282
  cursor: "crosshair",
16282
16283
  onActivate(e) {
@@ -16325,9 +16326,9 @@ const nN = {
16325
16326
  }, Ri = 10;
16326
16327
  let tn = !1;
16327
16328
  function Bi() {
16328
- setTimeout(() => tN(), 0);
16329
+ setTimeout(() => t4(), 0);
16329
16330
  }
16330
- const oN = {
16331
+ const o4 = {
16331
16332
  id: "place",
16332
16333
  cursor: "copy",
16333
16334
  onActivate(e) {
@@ -16386,7 +16387,7 @@ const Hi = 10, Fi = 20;
16386
16387
  function Et(e) {
16387
16388
  return Math.round(e / Hi) * Hi;
16388
16389
  }
16389
- const rN = {
16390
+ const r4 = {
16390
16391
  id: "busbar",
16391
16392
  cursor: "crosshair",
16392
16393
  onPointerDown(e, t) {
@@ -16425,7 +16426,7 @@ const rN = {
16425
16426
  const e = w.getState();
16426
16427
  e.setBusbarDrawStart(null), e.setCursorSvg(null);
16427
16428
  }
16428
- }, Wi = 10, qi = (e) => Math.round(e / Wi) * Wi, iN = {
16429
+ }, Wi = 10, qi = (e) => Math.round(e / Wi) * Wi, i4 = {
16429
16430
  id: "junction",
16430
16431
  cursor: "crosshair",
16431
16432
  onPointerDown(e, t) {
@@ -16434,7 +16435,7 @@ const rN = {
16434
16435
  const n = t.viewport.screenToSvg(e.clientX, e.clientY);
16435
16436
  w.getState().addJunction([qi(n[0]), qi(n[1])]), yt();
16436
16437
  }
16437
- }, aN = {
16438
+ }, a4 = {
16438
16439
  id: "text",
16439
16440
  cursor: "text",
16440
16441
  onPointerDown(e, t) {
@@ -16448,7 +16449,7 @@ const rN = {
16448
16449
  const r = t.viewport.screenToSvg(e.clientX, e.clientY), i = n.addAnnotation([r[0], r[1]], "");
16449
16450
  n.setEditingAnnotation(i), yt();
16450
16451
  }
16451
- }, sN = {
16452
+ }, s4 = {
16452
16453
  id: "rect",
16453
16454
  cursor: "crosshair",
16454
16455
  onPointerDown(e, t) {
@@ -16492,7 +16493,7 @@ const rN = {
16492
16493
  onDeactivate() {
16493
16494
  w.getState().setAnnotationDraft(null);
16494
16495
  }
16495
- }, lN = {
16496
+ }, l4 = {
16496
16497
  id: "ellipse",
16497
16498
  cursor: "crosshair",
16498
16499
  onPointerDown(e, t) {
@@ -16531,7 +16532,7 @@ const rN = {
16531
16532
  onDeactivate() {
16532
16533
  w.getState().setAnnotationDraft(null);
16533
16534
  }
16534
- }, cN = {
16535
+ }, c4 = {
16535
16536
  id: "line",
16536
16537
  cursor: "crosshair",
16537
16538
  onPointerDown(e, t) {
@@ -16577,7 +16578,7 @@ const rN = {
16577
16578
  onDeactivate() {
16578
16579
  w.getState().setAnnotationDraft(null);
16579
16580
  }
16580
- }, Gi = 15, dN = 3, uN = 3, mN = {
16581
+ }, Gi = 15, d4 = 3, u4 = 3, m4 = {
16581
16582
  id: "table",
16582
16583
  cursor: "crosshair",
16583
16584
  onPointerDown(e, t) {
@@ -16601,7 +16602,7 @@ const rN = {
16601
16602
  onPointerUp(e, t) {
16602
16603
  const n = w.getState(), o = n.annotationDraft;
16603
16604
  if (n.setAnnotationDraft(null), !o) return;
16604
- const r = Ve(t.viewport.screenToSvg(e.clientX, e.clientY)), i = Math.abs(r[0] - o.start[0]), a = Math.abs(r[1] - o.start[1]), l = i < Gi && a < Gi, { at: s, cols: c, rows: d } = l ? { at: o.start, cols: dN, rows: uN } : z2({ ...o, current: r }), m = n.insertAnnotation({
16605
+ const r = Ve(t.viewport.screenToSvg(e.clientX, e.clientY)), i = Math.abs(r[0] - o.start[0]), a = Math.abs(r[1] - o.start[1]), l = i < Gi && a < Gi, { at: s, cols: c, rows: d } = l ? { at: o.start, cols: d4, rows: u4 } : z2({ ...o, current: r }), m = n.insertAnnotation({
16605
16606
  type: "table",
16606
16607
  at: s,
16607
16608
  ...M2(c, d)
@@ -16618,19 +16619,19 @@ const rN = {
16618
16619
  w.getState().setAnnotationDraft(null);
16619
16620
  }
16620
16621
  }, Vi = {
16621
- select: U4,
16622
- pan: Z4,
16623
- wire: nN,
16624
- place: oN,
16625
- busbar: rN,
16626
- junction: iN,
16627
- text: aN,
16628
- rect: sN,
16629
- ellipse: lN,
16630
- line: cN,
16631
- table: mN
16622
+ select: UN,
16623
+ pan: ZN,
16624
+ wire: n4,
16625
+ place: o4,
16626
+ busbar: r4,
16627
+ junction: i4,
16628
+ text: a4,
16629
+ rect: s4,
16630
+ ellipse: l4,
16631
+ line: c4,
16632
+ table: m4
16632
16633
  };
16633
- function pN(e, t) {
16634
+ function p4(e, t) {
16634
16635
  const n = w((r) => r.activeTool), o = w((r) => r.readOnly);
16635
16636
  Q(() => {
16636
16637
  var h;
@@ -16665,28 +16666,28 @@ function pN(e, t) {
16665
16666
  }
16666
16667
  let ar = 1;
16667
16668
  const sr = /* @__PURE__ */ new Set();
16668
- function hN(e) {
16669
+ function h4(e) {
16669
16670
  if (e !== ar) {
16670
16671
  ar = e;
16671
16672
  for (const t of sr) t(e);
16672
16673
  }
16673
16674
  }
16674
- function fN() {
16675
+ function f4() {
16675
16676
  return ar;
16676
16677
  }
16677
- function gN(e) {
16678
+ function g4(e) {
16678
16679
  return sr.add(e), () => {
16679
16680
  sr.delete(e);
16680
16681
  };
16681
16682
  }
16682
- const zo = 0.1, Mo = 8, bN = 1.0015, yN = 1.02;
16683
+ const zo = 0.1, Mo = 8, b4 = 1.0015, y4 = 1.02;
16683
16684
  function tS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
16684
16685
  const r = o.shared ?? !0, i = ie({ ...n }), a = ie(/* @__PURE__ */ new Set()), l = () => {
16685
16686
  const s = t.current, c = e.current;
16686
16687
  if (s && s.setAttribute(
16687
16688
  "transform",
16688
16689
  `translate(${i.current.tx} ${i.current.ty}) scale(${i.current.scale})`
16689
- ), c && c.style.setProperty("--canvas-scale", String(i.current.scale)), r && hN(i.current.scale), a.current.size > 0) {
16690
+ ), c && c.style.setProperty("--canvas-scale", String(i.current.scale)), r && h4(i.current.scale), a.current.size > 0) {
16690
16691
  const d = { ...i.current };
16691
16692
  for (const m of a.current) m(d);
16692
16693
  }
@@ -16696,7 +16697,7 @@ function tS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
16696
16697
  if (!s) return;
16697
16698
  let c = !1, d = -1, m = 0, p = 0, g = 0, h = 0, f = !1;
16698
16699
  const b = /* @__PURE__ */ new Map();
16699
- let y = null, v = !1;
16700
+ let y = null, x = !1;
16700
16701
  const $ = () => {
16701
16702
  if (b.size < 2) {
16702
16703
  y = null;
@@ -16713,13 +16714,13 @@ function tS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
16713
16714
  };
16714
16715
  }, C = (F) => {
16715
16716
  if (F.pointerType === "touch") {
16716
- if (b.set(F.pointerId, { x: F.clientX, y: F.clientY }), b.size >= 2 && !v) {
16717
- v = !0;
16717
+ if (b.set(F.pointerId, { x: F.clientX, y: F.clientY }), b.size >= 2 && !x) {
16718
+ x = !0;
16718
16719
  for (const K of b.keys())
16719
16720
  K !== F.pointerId && U2(s, K);
16720
16721
  $();
16721
16722
  }
16722
- if (v) {
16723
+ if (x) {
16723
16724
  F.stopPropagation(), F.preventDefault();
16724
16725
  try {
16725
16726
  s.setPointerCapture(F.pointerId);
@@ -16728,7 +16729,7 @@ function tS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
16728
16729
  }
16729
16730
  }
16730
16731
  }, I = (F) => {
16731
- if (F.pointerType !== "touch" || !b.has(F.pointerId) || (b.set(F.pointerId, { x: F.clientX, y: F.clientY }), !v || !y)) return;
16732
+ if (F.pointerType !== "touch" || !b.has(F.pointerId) || (b.set(F.pointerId, { x: F.clientX, y: F.clientY }), !x || !y)) return;
16732
16733
  F.stopPropagation();
16733
16734
  const K = [...b.values()];
16734
16735
  if (K.length < 2) return;
@@ -16736,19 +16737,19 @@ function tS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
16736
16737
  i.current.tx = y.startMidX - (y.startMidX - y.startTx) * qt + (ue - y.startMidX), i.current.ty = y.startMidY - (y.startMidY - y.startTy) * qt + (ve - y.startMidY), i.current.scale = Fe, l();
16737
16738
  }, W = (F) => {
16738
16739
  var K;
16739
- if (F.pointerType === "touch" && b.has(F.pointerId) && (b.delete(F.pointerId), v)) {
16740
+ if (F.pointerType === "touch" && b.has(F.pointerId) && (b.delete(F.pointerId), x)) {
16740
16741
  if (F.stopPropagation(), (K = s.hasPointerCapture) != null && K.call(s, F.pointerId))
16741
16742
  try {
16742
16743
  s.releasePointerCapture(F.pointerId);
16743
16744
  } catch {
16744
16745
  }
16745
- b.size >= 2 ? $() : y = null, b.size === 0 && (v = !1);
16746
+ b.size >= 2 ? $() : y = null, b.size === 0 && (x = !1);
16746
16747
  }
16747
16748
  }, oe = (F) => {
16748
16749
  F.preventDefault();
16749
16750
  const K = s.getBoundingClientRect(), se = F.clientX - K.left, ge = F.clientY - K.top, ce = F.ctrlKey || F.metaKey;
16750
16751
  if (F.deltaX === 0 || ce) {
16751
- const ve = Math.pow(ce ? yN : bN, -F.deltaY), Ee = Do(i.current.scale * ve, zo, Mo), Fe = Ee / i.current.scale;
16752
+ const ve = Math.pow(ce ? y4 : b4, -F.deltaY), Ee = Do(i.current.scale * ve, zo, Mo), Fe = Ee / i.current.scale;
16752
16753
  i.current.tx = se - (se - i.current.tx) * Fe, i.current.ty = ge - (ge - i.current.ty) * Fe, i.current.scale = Ee;
16753
16754
  } else
16754
16755
  i.current.tx -= F.deltaX, i.current.ty -= F.deltaY;
@@ -16796,19 +16797,19 @@ function tS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
16796
16797
  function Do(e, t, n) {
16797
16798
  return e < t ? t : e > n ? n : e;
16798
16799
  }
16799
- const nS = typeof navigator < "u" && /Mac|iP(ad|hone|od)/.test(navigator.platform), Nt = nS ? "⌘" : "Ctrl+", wN = nS ? "⇧" : "Shift+", Oo = [10, 20, 50, 100, 200, 500, 1e3, 2e3, 5e3, 1e4], vN = 18;
16800
- function xN(e) {
16800
+ const nS = typeof navigator < "u" && /Mac|iP(ad|hone|od)/.test(navigator.platform), Nt = nS ? "⌘" : "Ctrl+", w4 = nS ? "⇧" : "Shift+", Oo = [10, 20, 50, 100, 200, 500, 1e3, 2e3, 5e3, 1e4], v4 = 18;
16801
+ function x4(e) {
16801
16802
  for (const t of Oo)
16802
- if (t * e >= vN) return t;
16803
+ if (t * e >= v4) return t;
16803
16804
  return Oo[Oo.length - 1];
16804
16805
  }
16805
- function kN() {
16806
+ function k4() {
16806
16807
  const e = ae(), t = ie(null), n = ie(null), o = ie(null), r = tS(t, n);
16807
- pN(t, r), F4(t), Q(() => (vi(r), () => vi(null)), [r]), Q(() => {
16808
+ p4(t, r), FN(t), Q(() => (vi(r), () => vi(null)), [r]), Q(() => {
16808
16809
  const d = (m) => {
16809
16810
  const p = o.current;
16810
16811
  if (!p) return;
16811
- const h = xN(m.scale) * m.scale;
16812
+ const h = x4(m.scale) * m.scale;
16812
16813
  p.setAttribute("width", String(h)), p.setAttribute("height", String(h)), p.setAttribute("patternTransform", `translate(${m.tx} ${m.ty})`);
16813
16814
  };
16814
16815
  return d(r.getViewport()), r.subscribe(d);
@@ -16831,7 +16832,7 @@ function kN() {
16831
16832
  const H = bo(p);
16832
16833
  H && g.selectedNode !== H && g.setSelectedNode(H);
16833
16834
  }
16834
- const y = w.getState(), v = y.selection.length > 0, $ = y.selectedAnnotations.length > 0, C = v || $, I = y.selectedNode != null, W = !!y.clipboard, oe = y.diagram.elements.length > 0, fe = new Set(y.selection), A = y.diagram.elements.some(
16835
+ const y = w.getState(), x = y.selection.length > 0, $ = y.selectedAnnotations.length > 0, C = x || $, I = y.selectedNode != null, W = !!y.clipboard, oe = y.diagram.elements.length > 0, fe = new Set(y.selection), A = y.diagram.elements.some(
16835
16836
  (H) => fe.has(H.id) && H.labelOffset !== void 0
16836
16837
  ), L = [
16837
16838
  {
@@ -16843,7 +16844,7 @@ function kN() {
16843
16844
  },
16844
16845
  {
16845
16846
  label: e("menu.redo"),
16846
- shortcut: `${Nt}${wN}Z`,
16847
+ shortcut: `${Nt}${w4}Z`,
16847
16848
  icon: pr,
16848
16849
  onSelect: () => w.getState().redo(),
16849
16850
  disabled: y.future.length === 0
@@ -16876,14 +16877,14 @@ function kN() {
16876
16877
  shortcut: "R",
16877
16878
  icon: Oa,
16878
16879
  onSelect: () => w.getState().rotateSelection(90),
16879
- disabled: !v
16880
+ disabled: !x
16880
16881
  },
16881
16882
  {
16882
16883
  label: e("menu.mirror"),
16883
16884
  shortcut: "M",
16884
16885
  icon: za,
16885
16886
  onSelect: () => w.getState().mirrorSelection(),
16886
- disabled: !v
16887
+ disabled: !x
16887
16888
  },
16888
16889
  {
16889
16890
  label: e("menu.resetLabel"),
@@ -16940,11 +16941,11 @@ function kN() {
16940
16941
  if (!h || $.pointerId !== h.pointerId) return;
16941
16942
  const C = $.clientX - h.x, I = $.clientY - h.y;
16942
16943
  Math.hypot(C, I) > p && f();
16943
- }, v = ($) => {
16944
+ }, x = ($) => {
16944
16945
  !h || $.pointerId !== h.pointerId || f();
16945
16946
  };
16946
- return d.addEventListener("pointerdown", b), d.addEventListener("pointermove", y), d.addEventListener("pointerup", v), d.addEventListener("pointercancel", v), () => {
16947
- f(), d.removeEventListener("pointerdown", b), d.removeEventListener("pointermove", y), d.removeEventListener("pointerup", v), d.removeEventListener("pointercancel", v);
16947
+ return d.addEventListener("pointerdown", b), d.addEventListener("pointermove", y), d.addEventListener("pointerup", x), d.addEventListener("pointercancel", x), () => {
16948
+ f(), d.removeEventListener("pointerdown", b), d.removeEventListener("pointermove", y), d.removeEventListener("pointerup", x), d.removeEventListener("pointercancel", x);
16948
16949
  };
16949
16950
  }, [a]), /* @__PURE__ */ u(
16950
16951
  "div",
@@ -16991,15 +16992,15 @@ function kN() {
16991
16992
  /* @__PURE__ */ u(A2, {}),
16992
16993
  /* @__PURE__ */ u(O2, {}),
16993
16994
  /* @__PURE__ */ u(K2, {}),
16994
- /* @__PURE__ */ u(s4, {}),
16995
- /* @__PURE__ */ u(l4, {}),
16995
+ /* @__PURE__ */ u(sN, {}),
16996
+ /* @__PURE__ */ u(lN, {}),
16996
16997
  /* @__PURE__ */ u(Z6, {}),
16997
- /* @__PURE__ */ u(A4, {}),
16998
- /* @__PURE__ */ u(P4, {}),
16999
- /* @__PURE__ */ u(m4, {}),
16998
+ /* @__PURE__ */ u(AN, {}),
16999
+ /* @__PURE__ */ u(PN, {}),
17000
+ /* @__PURE__ */ u(mN, {}),
17000
17001
  /* @__PURE__ */ u(Y6, {}),
17001
- /* @__PURE__ */ u(C4, {}),
17002
- /* @__PURE__ */ u(_4, {})
17002
+ /* @__PURE__ */ u(CN, {}),
17003
+ /* @__PURE__ */ u(_N, {})
17003
17004
  ] })
17004
17005
  ]
17005
17006
  }
@@ -17007,70 +17008,80 @@ function kN() {
17007
17008
  }
17008
17009
  );
17009
17010
  }
17010
- const Ki = 60, SN = 0.1, _N = 8, CN = 8;
17011
- function $N(e, t, n) {
17011
+ const Ki = 60, S4 = 0.1, _4 = 8, C4 = 8, $4 = [
17012
+ "[data-element-id]",
17013
+ "[data-wire-id]",
17014
+ "[data-element-label]",
17015
+ "[data-wire-label]",
17016
+ "[data-annotation-id]"
17017
+ ].join(", ");
17018
+ function A4(e) {
17019
+ let t = 1 / 0, n = 1 / 0, o = -1 / 0, r = -1 / 0;
17020
+ for (const i of e)
17021
+ i.width === 0 && i.height === 0 || (i.left < t && (t = i.left), i.top < n && (n = i.top), i.right > o && (o = i.right), i.bottom > r && (r = i.bottom));
17022
+ return t === 1 / 0 ? null : { left: t, top: n, right: o, bottom: r };
17023
+ }
17024
+ function E4(e, t, n) {
17012
17025
  return e < t ? t : e > n ? n : e;
17013
17026
  }
17014
- function AN() {
17027
+ function N4() {
17015
17028
  return document.querySelector(".ole-canvas-root");
17016
17029
  }
17017
17030
  function oS() {
17018
- const e = ot(), t = AN();
17031
+ const e = ot(), t = N4();
17019
17032
  return !e || !t ? !1 : Fn(e, t);
17020
17033
  }
17021
17034
  function Fn(e, t) {
17022
17035
  const n = t.getBoundingClientRect();
17023
17036
  if (n.width === 0 || n.height === 0) return !1;
17024
- const o = t.querySelectorAll("[data-element-id]");
17037
+ const o = t.querySelectorAll($4);
17025
17038
  if (o.length === 0)
17026
17039
  return e.setViewport({ tx: n.width / 2, ty: n.height / 2, scale: 1 }), !0;
17027
- let r = 1 / 0, i = 1 / 0, a = -1 / 0, l = -1 / 0;
17028
- for (const y of o) {
17029
- const v = y.getBoundingClientRect();
17030
- v.width === 0 && v.height === 0 || (v.left < r && (r = v.left), v.top < i && (i = v.top), v.right > a && (a = v.right), v.bottom > l && (l = v.bottom));
17031
- }
17032
- if (r === 1 / 0) return !1;
17033
- const [s, c] = e.screenToSvg(r, i), [d, m] = e.screenToSvg(a, l), p = Math.max(d - s, 1), g = Math.max(m - c, 1), h = $N(
17040
+ const r = A4(
17041
+ Array.from(o, (x) => x.getBoundingClientRect())
17042
+ );
17043
+ if (!r) return !1;
17044
+ const { left: i, top: a, right: l, bottom: s } = r, [c, d] = e.screenToSvg(i, a), [m, p] = e.screenToSvg(l, s), g = Math.max(m - c, 1), h = Math.max(p - d, 1), f = E4(
17034
17045
  Math.min(
17035
- (n.width - Ki * 2) / p,
17036
- (n.height - Ki * 2) / g
17046
+ (n.width - Ki * 2) / g,
17047
+ (n.height - Ki * 2) / h
17037
17048
  ),
17038
- SN,
17039
- _N
17040
- ), f = (s + d) / 2, b = (c + m) / 2;
17049
+ S4,
17050
+ _4
17051
+ ), b = (c + m) / 2, y = (d + p) / 2;
17041
17052
  return e.setViewport({
17042
- tx: n.width / 2 - h * f,
17043
- ty: n.height / 2 - h * b,
17044
- scale: h
17053
+ tx: n.width / 2 - f * b,
17054
+ ty: n.height / 2 - f * y,
17055
+ scale: f
17045
17056
  }), !0;
17046
17057
  }
17047
17058
  function rS() {
17048
- let e = CN;
17059
+ let e = C4;
17049
17060
  const t = () => {
17050
17061
  oS() || --e > 0 && requestAnimationFrame(t);
17051
17062
  };
17052
17063
  requestAnimationFrame(t);
17053
17064
  }
17054
- const Xi = 10, EN = 100;
17055
- function NN() {
17065
+ const Xi = 10, T4 = 100;
17066
+ function I4() {
17056
17067
  return typeof window > "u" || !window.matchMedia ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
17057
17068
  }
17058
17069
  function Ui() {
17059
- const [e, t] = ye(R4()), [n, o] = ye(!1), [r, i] = ye(null), a = ie(null), l = ie(void 0), [s] = ye(NN);
17060
- Q(() => B4((h) => t(h)), []), Q(() => {
17070
+ const [e, t] = ye(RN()), [n, o] = ye(!1), [r, i] = ye(null), a = ie(null), l = ie(void 0), [s] = ye(I4);
17071
+ Q(() => BN((h) => t(h)), []), Q(() => {
17061
17072
  if (window.clearTimeout(l.current), o(!1), i(null), !!e)
17062
- return l.current = window.setTimeout(() => o(!0), EN), () => window.clearTimeout(l.current);
17073
+ return l.current = window.setTimeout(() => o(!0), T4), () => window.clearTimeout(l.current);
17063
17074
  }, [e]);
17064
17075
  const c = w((h) => e ? h.diagram.elements.find((f) => f.id === e) ?? null : null);
17065
17076
  if (Dt(() => {
17066
17077
  if (!n || !e) return;
17067
17078
  let h = 0, f = -1, b = -1;
17068
17079
  const y = () => {
17069
- const v = document.querySelector(
17070
- `[data-element-id="${TN(e)}"]`
17080
+ const x = document.querySelector(
17081
+ `[data-element-id="${P4(e)}"]`
17071
17082
  ), $ = a.current;
17072
- if (v && $) {
17073
- const C = v.getBoundingClientRect();
17083
+ if (x && $) {
17084
+ const C = x.getBoundingClientRect();
17074
17085
  let I = C.bottom + Xi;
17075
17086
  I + $.offsetHeight > window.innerHeight - 4 && (I = C.top - $.offsetHeight - Xi);
17076
17087
  let W = C.left + C.width / 2 - $.offsetWidth / 2;
@@ -17105,14 +17116,14 @@ function Ui() {
17105
17116
  document.body
17106
17117
  );
17107
17118
  }
17108
- function TN(e) {
17119
+ function P4(e) {
17109
17120
  return e.replace(/(["\\])/g, "\\$1");
17110
17121
  }
17111
- function IN({
17122
+ function z4({
17112
17123
  width: e,
17113
17124
  children: t
17114
17125
  }) {
17115
- const n = e == null ? "full" : J4(e);
17126
+ const n = e == null ? "full" : JN(e);
17116
17127
  return /* @__PURE__ */ u(J2.Provider, { value: n, children: t });
17117
17128
  }
17118
17129
  function Yi(e, t) {
@@ -17120,7 +17131,7 @@ function Yi(e, t) {
17120
17131
  return e(t);
17121
17132
  e != null && (e.current = t);
17122
17133
  }
17123
- function PN(...e) {
17134
+ function M4(...e) {
17124
17135
  return (t) => {
17125
17136
  let n = !1;
17126
17137
  const o = e.map((r) => {
@@ -17136,19 +17147,19 @@ function PN(...e) {
17136
17147
  };
17137
17148
  };
17138
17149
  }
17139
- var zN = Symbol.for("react.lazy"), to = Pe[" use ".trim().toString()];
17140
- function MN(e) {
17150
+ var D4 = Symbol.for("react.lazy"), to = Pe[" use ".trim().toString()];
17151
+ function O4(e) {
17141
17152
  return typeof e == "object" && e !== null && "then" in e;
17142
17153
  }
17143
17154
  function iS(e) {
17144
- return e != null && typeof e == "object" && "$$typeof" in e && e.$$typeof === zN && "_payload" in e && MN(e._payload);
17155
+ return e != null && typeof e == "object" && "$$typeof" in e && e.$$typeof === D4 && "_payload" in e && O4(e._payload);
17145
17156
  }
17146
17157
  // @__NO_SIDE_EFFECTS__
17147
- function DN(e) {
17148
- const t = /* @__PURE__ */ LN(e), n = Pe.forwardRef((o, r) => {
17158
+ function L4(e) {
17159
+ const t = /* @__PURE__ */ B4(e), n = Pe.forwardRef((o, r) => {
17149
17160
  let { children: i, ...a } = o;
17150
17161
  iS(i) && typeof to == "function" && (i = to(i._payload));
17151
- const l = Pe.Children.toArray(i), s = l.find(BN);
17162
+ const l = Pe.Children.toArray(i), s = l.find(H4);
17152
17163
  if (s) {
17153
17164
  const c = s.props.children, d = l.map((m) => m === s ? Pe.Children.count(c) > 1 ? Pe.Children.only(null) : Pe.isValidElement(c) ? c.props.children : null : m);
17154
17165
  return /* @__PURE__ */ u(t, { ...a, ref: r, children: Pe.isValidElement(c) ? Pe.cloneElement(c, void 0, d) : null });
@@ -17157,24 +17168,24 @@ function DN(e) {
17157
17168
  });
17158
17169
  return n.displayName = `${e}.Slot`, n;
17159
17170
  }
17160
- var ON = /* @__PURE__ */ DN("Slot");
17171
+ var R4 = /* @__PURE__ */ L4("Slot");
17161
17172
  // @__NO_SIDE_EFFECTS__
17162
- function LN(e) {
17173
+ function B4(e) {
17163
17174
  const t = Pe.forwardRef((n, o) => {
17164
17175
  let { children: r, ...i } = n;
17165
17176
  if (iS(r) && typeof to == "function" && (r = to(r._payload)), Pe.isValidElement(r)) {
17166
- const a = HN(r), l = jN(i, r.props);
17167
- return r.type !== Pe.Fragment && (l.ref = o ? PN(o, a) : a), Pe.cloneElement(r, l);
17177
+ const a = W4(r), l = F4(i, r.props);
17178
+ return r.type !== Pe.Fragment && (l.ref = o ? M4(o, a) : a), Pe.cloneElement(r, l);
17168
17179
  }
17169
17180
  return Pe.Children.count(r) > 1 ? Pe.Children.only(null) : null;
17170
17181
  });
17171
17182
  return t.displayName = `${e}.SlotClone`, t;
17172
17183
  }
17173
- var RN = Symbol("radix.slottable");
17174
- function BN(e) {
17175
- return Pe.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === RN;
17184
+ var j4 = Symbol("radix.slottable");
17185
+ function H4(e) {
17186
+ return Pe.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === j4;
17176
17187
  }
17177
- function jN(e, t) {
17188
+ function F4(e, t) {
17178
17189
  const n = { ...t };
17179
17190
  for (const o in t) {
17180
17191
  const r = e[o], i = t[o];
@@ -17185,12 +17196,12 @@ function jN(e, t) {
17185
17196
  }
17186
17197
  return { ...e, ...n };
17187
17198
  }
17188
- function HN(e) {
17199
+ function W4(e) {
17189
17200
  var o, r;
17190
17201
  let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
17191
17202
  return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
17192
17203
  }
17193
- const Zi = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Qi = Fa, FN = (e, t) => (n) => {
17204
+ const Zi = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Qi = Fa, q4 = (e, t) => (n) => {
17194
17205
  var o;
17195
17206
  if ((t == null ? void 0 : t.variants) == null) return Qi(e, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
17196
17207
  const { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((c) => {
@@ -17219,7 +17230,7 @@ const Zi = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Qi = Fa, F
17219
17230
  ] : c;
17220
17231
  }, []);
17221
17232
  return Qi(e, a, s, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
17222
- }, WN = FN(
17233
+ }, G4 = q4(
17223
17234
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
17224
17235
  {
17225
17236
  variants: {
@@ -17245,21 +17256,21 @@ const Zi = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Qi = Fa, F
17245
17256
  }
17246
17257
  ), Be = Pe.forwardRef(
17247
17258
  ({ className: e, variant: t, size: n, asChild: o = !1, ...r }, i) => /* @__PURE__ */ u(
17248
- o ? ON : "button",
17259
+ o ? R4 : "button",
17249
17260
  {
17250
- className: $e(WN({ variant: t, size: n, className: e })),
17261
+ className: $e(G4({ variant: t, size: n, className: e })),
17251
17262
  ref: i,
17252
17263
  ...r
17253
17264
  }
17254
17265
  )
17255
17266
  );
17256
17267
  Be.displayName = "Button";
17257
- const qN = 350;
17268
+ const V4 = 350;
17258
17269
  function ze({
17259
17270
  content: e,
17260
17271
  children: t,
17261
17272
  disabled: n,
17262
- delayMs: o = qN
17273
+ delayMs: o = V4
17263
17274
  }) {
17264
17275
  const r = ie(null), i = ie(null), [a, l] = ye(!1), [s, c] = ye(null), d = FS(), m = ie(void 0), p = () => {
17265
17276
  n || (window.clearTimeout(m.current), m.current = window.setTimeout(() => l(!0), o));
@@ -17268,41 +17279,41 @@ function ze({
17268
17279
  };
17269
17280
  Dt(() => {
17270
17281
  if (!a || !r.current || !i.current) return;
17271
- const y = r.current.getBoundingClientRect(), v = i.current.getBoundingClientRect(), $ = 8;
17272
- let C = "top", I = y.top - v.height - $;
17282
+ const y = r.current.getBoundingClientRect(), x = i.current.getBoundingClientRect(), $ = 8;
17283
+ let C = "top", I = y.top - x.height - $;
17273
17284
  I < 4 && (C = "bottom", I = y.bottom + $);
17274
- let W = y.left + y.width / 2 - v.width / 2;
17275
- W = Math.max(4, Math.min(W, window.innerWidth - v.width - 4)), c({ top: I, left: W, side: C });
17285
+ let W = y.left + y.width / 2 - x.width / 2;
17286
+ W = Math.max(4, Math.min(W, window.innerWidth - x.width - 4)), c({ top: I, left: W, side: C });
17276
17287
  }, [a, e]), Q(() => () => window.clearTimeout(m.current), []), Q(() => {
17277
17288
  if (!a) return;
17278
17289
  const y = ($) => {
17279
17290
  $.key === "Escape" && l(!1);
17280
- }, v = () => l(!1);
17281
- return window.addEventListener("keydown", y), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v), () => {
17282
- window.removeEventListener("keydown", y), window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v);
17291
+ }, x = () => l(!1);
17292
+ return window.addEventListener("keydown", y), window.addEventListener("scroll", x, !0), window.addEventListener("resize", x), () => {
17293
+ window.removeEventListener("keydown", y), window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x);
17283
17294
  };
17284
17295
  }, [a]);
17285
17296
  const h = t, f = h.props, b = WS(h, {
17286
17297
  ref: (y) => {
17287
17298
  r.current = y;
17288
- const v = h.ref;
17289
- typeof v == "function" ? v(y) : v && typeof v == "object" && (v.current = y);
17299
+ const x = h.ref;
17300
+ typeof x == "function" ? x(y) : x && typeof x == "object" && (x.current = y);
17290
17301
  },
17291
17302
  onPointerEnter: (y) => {
17292
- var v;
17293
- (v = f.onPointerEnter) == null || v.call(f, y), p();
17303
+ var x;
17304
+ (x = f.onPointerEnter) == null || x.call(f, y), p();
17294
17305
  },
17295
17306
  onPointerLeave: (y) => {
17296
- var v;
17297
- (v = f.onPointerLeave) == null || v.call(f, y), g();
17307
+ var x;
17308
+ (x = f.onPointerLeave) == null || x.call(f, y), g();
17298
17309
  },
17299
17310
  onFocus: (y) => {
17300
- var v;
17301
- (v = f.onFocus) == null || v.call(f, y), p();
17311
+ var x;
17312
+ (x = f.onFocus) == null || x.call(f, y), p();
17302
17313
  },
17303
17314
  onBlur: (y) => {
17304
- var v;
17305
- (v = f.onBlur) == null || v.call(f, y), g();
17315
+ var x;
17316
+ (x = f.onBlur) == null || x.call(f, y), g();
17306
17317
  },
17307
17318
  "aria-describedby": a ? d : f["aria-describedby"]
17308
17319
  });
@@ -17337,8 +17348,8 @@ const Ji = {
17337
17348
  green: "ctx.colorGreen",
17338
17349
  blue: "ctx.colorBlue",
17339
17350
  gray: "ctx.colorGray"
17340
- }, ea = 12, GN = 56;
17341
- function VN() {
17351
+ }, ea = 12, K4 = 56;
17352
+ function X4() {
17342
17353
  var C;
17343
17354
  const e = ae(), t = w((I) => I.selection), n = w((I) => I.selectedNode), o = w((I) => I.selectedWire), r = w((I) => I.activeTool), i = w((I) => I.rotateSelection), a = w((I) => I.mirrorSelection), l = w((I) => I.deleteSelection), s = w((I) => I.setSelectionColor), c = w((I) => I.selectedAnnotations), d = w((I) => I.deleteSelectedNode), m = w((I) => I.deleteSelectedWire), p = w((I) => I.resetWirePath), g = w((I) => I.internal.wireRenders), h = o != null && ((C = g.get(o)) == null ? void 0 : C.userEdited) === !0, f = ie(null);
17344
17355
  Q(() => {
@@ -17377,7 +17388,7 @@ function VN() {
17377
17388
  if (ce) {
17378
17389
  const ue = (F + K) / 2;
17379
17390
  let ve = se - ea, Ee = "-100%";
17380
- ve < GN && (ve = ge + ea, Ee = "0%");
17391
+ ve < K4 && (ve = ge + ea, Ee = "0%");
17381
17392
  const Fe = `translate3d(${ue}px, ${ve}px, 0) translate(-50%, ${Ee})`;
17382
17393
  Fe !== H && (I.style.transform = Fe, H = Fe);
17383
17394
  }
@@ -17385,7 +17396,7 @@ function VN() {
17385
17396
  };
17386
17397
  return L = requestAnimationFrame(V), () => cancelAnimationFrame(L);
17387
17398
  }, [t, n, o, r]);
17388
- const b = t.length === 0 && o != null, y = t.length === 0 && !b && n != null, v = y || b, $ = !y && (t.length > 0 || o != null || c.length > 0);
17399
+ const b = t.length === 0 && o != null, y = t.length === 0 && !b && n != null, x = y || b, $ = !y && (t.length > 0 || o != null || c.length > 0);
17389
17400
  return /* @__PURE__ */ P(
17390
17401
  "div",
17391
17402
  {
@@ -17417,7 +17428,7 @@ function VN() {
17417
17428
  ),
17418
17429
  /* @__PURE__ */ u("div", { "aria-hidden": !0, className: "mx-0.5 h-4 w-px bg-border" })
17419
17430
  ] }),
17420
- !v && /* @__PURE__ */ P(Ge, { children: [
17431
+ !x && /* @__PURE__ */ P(Ge, { children: [
17421
17432
  /* @__PURE__ */ u(
17422
17433
  ze,
17423
17434
  {
@@ -17520,11 +17531,11 @@ function VN() {
17520
17531
  }
17521
17532
  );
17522
17533
  }
17523
- const ta = 8, KN = 56, lr = ".ole-ann-cell-edit-fo", cr = ".ole-free-annotation-edit-fo";
17534
+ const ta = 8, U4 = 56, lr = ".ole-ann-cell-edit-fo", cr = ".ole-free-annotation-edit-fo";
17524
17535
  function na() {
17525
17536
  return document.querySelector(`${lr} input`) ?? document.querySelector(`${cr} [contenteditable]`);
17526
17537
  }
17527
- function XN() {
17538
+ function Y4() {
17528
17539
  const e = ae(), t = w((a) => a.editingAnnotation), n = w((a) => a.editingCell), o = ie(null);
17529
17540
  Q(() => {
17530
17541
  const a = o.current;
@@ -17540,7 +17551,7 @@ function XN() {
17540
17551
  if (d) {
17541
17552
  const m = d.getBoundingClientRect();
17542
17553
  let p = m.top - ta, g = "-100%";
17543
- p < KN && (p = m.bottom + ta, g = "0%");
17554
+ p < U4 && (p = m.bottom + ta, g = "0%");
17544
17555
  const h = `translate3d(${m.left}px, ${p}px, 0) translate(0, ${g})`;
17545
17556
  h !== s && (a.style.transform = h, s = h);
17546
17557
  }
@@ -17645,7 +17656,7 @@ function xn({
17645
17656
  ] });
17646
17657
  }
17647
17658
  const aS = "ole-panel-open";
17648
- function UN() {
17659
+ function Z4() {
17649
17660
  if (typeof window > "u") return { outlineOpen: !1 };
17650
17661
  try {
17651
17662
  const e = window.localStorage.getItem(aS);
@@ -17664,7 +17675,7 @@ function oa(e) {
17664
17675
  }
17665
17676
  }
17666
17677
  const hn = fn((e, t) => ({
17667
- ...UN(),
17678
+ ...Z4(),
17668
17679
  setOutlineOpen: (n) => {
17669
17680
  e({ outlineOpen: n }), oa(t());
17670
17681
  },
@@ -17672,7 +17683,7 @@ const hn = fn((e, t) => ({
17672
17683
  e((n) => ({ outlineOpen: !n.outlineOpen })), oa(t());
17673
17684
  }
17674
17685
  })), Wn = [0.1, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4, 6, 8], sS = 0.1, lS = 8, cS = "ole-grid";
17675
- function YN() {
17686
+ function Q4() {
17676
17687
  try {
17677
17688
  const e = window.localStorage.getItem(cS);
17678
17689
  return e == null ? !0 : e === "1";
@@ -17680,13 +17691,13 @@ function YN() {
17680
17691
  return !0;
17681
17692
  }
17682
17693
  }
17683
- function ZN(e) {
17694
+ function J4(e) {
17684
17695
  try {
17685
17696
  window.localStorage.setItem(cS, e ? "1" : "0");
17686
17697
  } catch {
17687
17698
  }
17688
17699
  }
17689
- function QN(e, t, n) {
17700
+ function eT(e, t, n) {
17690
17701
  return e < t ? t : e > n ? n : e;
17691
17702
  }
17692
17703
  function dS() {
@@ -17695,20 +17706,20 @@ function dS() {
17695
17706
  function kr(e) {
17696
17707
  const t = ot(), n = dS();
17697
17708
  if (!t || !n) return;
17698
- const o = n.getBoundingClientRect(), r = o.width / 2, i = o.height / 2, a = t.getViewport(), l = QN(e, sS, lS), s = l / a.scale;
17709
+ const o = n.getBoundingClientRect(), r = o.width / 2, i = o.height / 2, a = t.getViewport(), l = eT(e, sS, lS), s = l / a.scale;
17699
17710
  t.setViewport({
17700
17711
  tx: r - (r - a.tx) * s,
17701
17712
  ty: i - (i - a.ty) * s,
17702
17713
  scale: l
17703
17714
  });
17704
17715
  }
17705
- function JN() {
17716
+ function tT() {
17706
17717
  const e = ot();
17707
17718
  if (!e) return;
17708
17719
  const t = e.getViewport().scale, n = Wn.find((o) => o > t + 1e-6) ?? lS;
17709
17720
  kr(n);
17710
17721
  }
17711
- function eT() {
17722
+ function nT() {
17712
17723
  const e = ot();
17713
17724
  if (!e) return;
17714
17725
  const t = e.getViewport().scale;
@@ -17735,7 +17746,7 @@ const Ln = [
17735
17746
  28,
17736
17747
  lo
17737
17748
  ];
17738
- function tT(e) {
17749
+ function oT(e) {
17739
17750
  w.getState().dispatch((t) => {
17740
17751
  const n = { ...t.meta ?? {}, labelMode: e };
17741
17752
  return { ...t, meta: n };
@@ -17767,10 +17778,10 @@ function ra(e) {
17767
17778
  dr(n);
17768
17779
  }
17769
17780
  function uS() {
17770
- const [e, t] = ye(() => YN());
17781
+ const [e, t] = ye(() => Q4());
17771
17782
  return Q(() => {
17772
17783
  const n = dS();
17773
- n == null || n.classList.toggle("hide-grid", !e), ZN(e);
17784
+ n == null || n.classList.toggle("hide-grid", !e), J4(e);
17774
17785
  }, [e]), Q(() => {
17775
17786
  const n = (o) => {
17776
17787
  if (o.metaKey || o.ctrlKey || o.altKey || o.key !== "g" && o.key !== "G") return;
@@ -17794,7 +17805,7 @@ function mS() {
17794
17805
  {
17795
17806
  variant: "ghost",
17796
17807
  size: "icon",
17797
- onClick: eT,
17808
+ onClick: nT,
17798
17809
  "aria-label": e("view.zoomOut"),
17799
17810
  children: /* @__PURE__ */ u(mr, {})
17800
17811
  }
@@ -17816,7 +17827,7 @@ function pS() {
17816
17827
  {
17817
17828
  variant: "ghost",
17818
17829
  size: "icon",
17819
- onClick: JN,
17830
+ onClick: tT,
17820
17831
  "aria-label": e("view.zoomIn"),
17821
17832
  children: /* @__PURE__ */ u(Da, {})
17822
17833
  }
@@ -17825,8 +17836,8 @@ function pS() {
17825
17836
  );
17826
17837
  }
17827
17838
  function hS() {
17828
- const e = ae(), [t, n] = ye(fN);
17829
- return Q(() => gN(n), []), /* @__PURE__ */ u(
17839
+ const e = ae(), [t, n] = ye(f4);
17840
+ return Q(() => g4(n), []), /* @__PURE__ */ u(
17830
17841
  ze,
17831
17842
  {
17832
17843
  content: /* @__PURE__ */ P("div", { className: "space-y-0.5", children: [
@@ -17924,7 +17935,7 @@ function bS() {
17924
17935
  {
17925
17936
  type: "button",
17926
17937
  "aria-pressed": t === r.value,
17927
- onClick: () => tT(r.value),
17938
+ onClick: () => oT(r.value),
17928
17939
  className: $e(
17929
17940
  // No truncation: the popover is shrink-to-fit, so a long
17930
17941
  // translation widens the menu instead of ellipsing "ID + params".
@@ -17974,7 +17985,7 @@ function bS() {
17974
17985
  ] })
17975
17986
  ] });
17976
17987
  }
17977
- function nT(e) {
17988
+ function rT(e) {
17978
17989
  w.getState().dispatch((t) => {
17979
17990
  const n = { ...t.meta ?? {} };
17980
17991
  return e === "iec" ? delete n.symbolStandard : n.symbolStandard = e, { ...t, meta: n };
@@ -17997,7 +18008,7 @@ function yS() {
17997
18008
  {
17998
18009
  type: "button",
17999
18010
  "aria-pressed": t === o.value,
18000
- onClick: () => nT(o.value),
18011
+ onClick: () => rT(o.value),
18001
18012
  className: $e(
18002
18013
  "h-7 flex-1 whitespace-nowrap px-1.5 text-[11px] transition-colors",
18003
18014
  t === o.value ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground"
@@ -18009,7 +18020,7 @@ function yS() {
18009
18020
  /* @__PURE__ */ u("div", { className: "max-w-[210px] text-[10px] leading-snug text-muted-foreground", children: e("view.standardHint") })
18010
18021
  ] });
18011
18022
  }
18012
- function oT() {
18023
+ function iT() {
18013
18024
  const e = ae(), [t, n] = ye(!1), o = w(
18014
18025
  (r) => {
18015
18026
  var i;
@@ -18050,7 +18061,7 @@ function oT() {
18050
18061
  }
18051
18062
  );
18052
18063
  }
18053
- function rT({ stacked: e } = {}) {
18064
+ function aT({ stacked: e } = {}) {
18054
18065
  const t = ae(), [n, o] = ye(!1), [r, i] = uS(), a = /* @__PURE__ */ P("div", { className: "space-y-0.5", children: [
18055
18066
  /* @__PURE__ */ u("div", { className: "font-medium", children: t("view.menu") }),
18056
18067
  /* @__PURE__ */ u("div", { className: "text-muted-foreground", children: t("view.menuHint") })
@@ -18108,9 +18119,9 @@ function rT({ stacked: e } = {}) {
18108
18119
  }
18109
18120
  function ia() {
18110
18121
  const e = bt();
18111
- return !w((n) => n.readOnly) && Ke(e, "dense") ? null : /* @__PURE__ */ u(iT, { tier: e });
18122
+ return !w((n) => n.readOnly) && Ke(e, "dense") ? null : /* @__PURE__ */ u(sT, { tier: e });
18112
18123
  }
18113
- function iT({ tier: e }) {
18124
+ function sT({ tier: e }) {
18114
18125
  const t = Ke(e, "tight"), n = w((i) => i.readOnly), [o, r] = uS();
18115
18126
  return (
18116
18127
  // z-50, not z-20: this container is its own stacking context, so the
@@ -18136,7 +18147,7 @@ function iT({ tier: e }) {
18136
18147
  /* @__PURE__ */ u("div", { "aria-hidden": !0, className: "mx-1 h-4 w-px bg-border" }),
18137
18148
  /* @__PURE__ */ u(fS, {}),
18138
18149
  /* @__PURE__ */ u(gS, { grid: o, setGrid: r }),
18139
- !n && /* @__PURE__ */ u(oT, {})
18150
+ !n && /* @__PURE__ */ u(iT, {})
18140
18151
  ] })
18141
18152
  }
18142
18153
  )
@@ -18248,7 +18259,7 @@ const wS = [
18248
18259
  drawing: !0
18249
18260
  }
18250
18261
  ], aa = wS.filter((e) => e.drawing), sa = wS.filter((e) => !e.drawing);
18251
- function aT() {
18262
+ function lT() {
18252
18263
  const e = ae(), t = w((p) => p.activeTool), n = w((p) => p.placeKind), o = w((p) => p.placeFromTerminal), r = w((p) => p.wireDragFrom), i = w((p) => p.busbarDrawStart), a = w(
18253
18264
  (p) => p.selection.length > 0 || p.selectedNode != null
18254
18265
  ), l = w((p) => p.editingAnnotation), s = w((p) => {
@@ -18310,7 +18321,7 @@ function aT() {
18310
18321
  ] })
18311
18322
  ] });
18312
18323
  }
18313
- function sT() {
18324
+ function cT() {
18314
18325
  const e = ae(), t = w((y) => y.activeTool), n = w((y) => y.placeKind), o = w((y) => y.setActiveTool), r = w((y) => y.past.length), i = w((y) => y.future.length), a = w((y) => y.undo), l = w((y) => y.redo), s = bt(), c = Ke(s, "tight"), d = !Ke(s, "dense"), m = Ke(s, "dense"), p = /* @__PURE__ */ new Set(["select"]), g = m ? sa.filter((y) => !p.has(y.id)) : sa, h = (y) => t === y.switchTo, [f, b] = ye(!1);
18315
18326
  return /* @__PURE__ */ P(
18316
18327
  "div",
@@ -18325,7 +18336,7 @@ function sT() {
18325
18336
  "transition-opacity duration-150",
18326
18337
  f && "pointer-events-none opacity-0"
18327
18338
  ),
18328
- children: /* @__PURE__ */ u(aT, {})
18339
+ children: /* @__PURE__ */ u(lT, {})
18329
18340
  }
18330
18341
  ),
18331
18342
  /* @__PURE__ */ P(
@@ -18338,14 +18349,14 @@ function sT() {
18338
18349
  m ? "gap-0.5 p-1" : "gap-0.5 p-1.5"
18339
18350
  ),
18340
18351
  children: [
18341
- m && /* @__PURE__ */ u(lT, { stacked: !0 }),
18352
+ m && /* @__PURE__ */ u(dT, { stacked: !0 }),
18342
18353
  g.map((y) => {
18343
- const v = y.icon, $ = h(y), C = y.id === "place" && $ && n == null ? e("tool.placeNoKindTooltip") : e(y.descriptionKey);
18354
+ const x = y.icon, $ = h(y), C = y.id === "place" && $ && n == null ? e("tool.placeNoKindTooltip") : e(y.descriptionKey);
18344
18355
  return /* @__PURE__ */ P(qS, { children: [
18345
18356
  /* @__PURE__ */ u(
18346
18357
  St,
18347
18358
  {
18348
- icon: v,
18359
+ icon: x,
18349
18360
  label: e(y.labelKey),
18350
18361
  hotkey: y.hotkey,
18351
18362
  active: $,
@@ -18362,9 +18373,9 @@ function sT() {
18362
18373
  y.groupBreakAfter && !m && /* @__PURE__ */ u("div", { "aria-hidden": !0, className: "mx-1 h-5 w-px bg-border" })
18363
18374
  ] }, y.id);
18364
18375
  }),
18365
- /* @__PURE__ */ u(uT, { stacked: m }),
18376
+ /* @__PURE__ */ u(pT, { stacked: m }),
18366
18377
  !m && /* @__PURE__ */ u("div", { "aria-hidden": !0, className: "mx-1 h-5 w-px bg-border" }),
18367
- m ? /* @__PURE__ */ u(mT, { stacked: !0 }) : /* @__PURE__ */ P(Ge, { children: [
18378
+ m ? /* @__PURE__ */ u(hT, { stacked: !0 }) : /* @__PURE__ */ P(Ge, { children: [
18368
18379
  /* @__PURE__ */ u(
18369
18380
  St,
18370
18381
  {
@@ -18390,9 +18401,9 @@ function sT() {
18390
18401
  }
18391
18402
  ),
18392
18403
  /* @__PURE__ */ u("div", { "aria-hidden": !0, className: "mx-1 h-5 w-px bg-border" }),
18393
- /* @__PURE__ */ u(cT, { iconOnly: c })
18404
+ /* @__PURE__ */ u(uT, { iconOnly: c })
18394
18405
  ] }),
18395
- m && /* @__PURE__ */ u(rT, { stacked: !0 })
18406
+ m && /* @__PURE__ */ u(aT, { stacked: !0 })
18396
18407
  ]
18397
18408
  }
18398
18409
  )
@@ -18400,7 +18411,7 @@ function sT() {
18400
18411
  }
18401
18412
  );
18402
18413
  }
18403
- function lT({ stacked: e }) {
18414
+ function dT({ stacked: e }) {
18404
18415
  const t = ae(), n = hn((r) => r.outlineOpen), o = hn((r) => r.toggleOutline);
18405
18416
  return /* @__PURE__ */ u(
18406
18417
  St,
@@ -18501,7 +18512,7 @@ function vS() {
18501
18512
  selectionHasGaps: n.some((r) => !o[r])
18502
18513
  };
18503
18514
  }
18504
- function cT({ iconOnly: e }) {
18515
+ function uT({ iconOnly: e }) {
18505
18516
  const t = ae(), [n, o] = ye(!1), r = vS(), i = (a) => () => {
18506
18517
  o(!1), a();
18507
18518
  };
@@ -18563,7 +18574,7 @@ function cT({ iconOnly: e }) {
18563
18574
  }
18564
18575
  );
18565
18576
  }
18566
- function dT({ className: e }) {
18577
+ function mT({ className: e }) {
18567
18578
  return /* @__PURE__ */ P(
18568
18579
  "svg",
18569
18580
  {
@@ -18581,8 +18592,8 @@ function dT({ className: e }) {
18581
18592
  }
18582
18593
  );
18583
18594
  }
18584
- function uT({ stacked: e }) {
18585
- const t = ae(), [n, o] = ye(!1), r = w((s) => s.activeTool), i = w((s) => s.setActiveTool), a = aa.find((s) => s.switchTo === r), l = (a == null ? void 0 : a.icon) ?? dT;
18595
+ function pT({ stacked: e }) {
18596
+ const t = ae(), [n, o] = ye(!1), r = w((s) => s.activeTool), i = w((s) => s.setActiveTool), a = aa.find((s) => s.switchTo === r), l = (a == null ? void 0 : a.icon) ?? mT;
18586
18597
  return /* @__PURE__ */ u(
18587
18598
  xn,
18588
18599
  {
@@ -18621,7 +18632,7 @@ function uT({ stacked: e }) {
18621
18632
  }
18622
18633
  );
18623
18634
  }
18624
- function mT({ stacked: e }) {
18635
+ function hT({ stacked: e }) {
18625
18636
  const t = ae(), [n, o] = ye(!1), r = w((p) => p.past.length), i = w((p) => p.future.length), a = w((p) => p.undo), l = w((p) => p.redo), s = w((p) => p.selection.length > 0), c = w((p) => p.clipboard != null), d = vS(), m = (p) => () => {
18626
18637
  o(!1), p();
18627
18638
  };
@@ -18759,7 +18770,7 @@ function je({
18759
18770
  }
18760
18771
  );
18761
18772
  }
18762
- function pT() {
18773
+ function fT() {
18763
18774
  const e = hn((r) => r.outlineOpen), t = hn((r) => r.setOutlineOpen), n = bt();
18764
18775
  return Ke(n, "dense") ? e ? /* @__PURE__ */ u(
18765
18776
  "div",
@@ -18781,11 +18792,11 @@ function pT() {
18781
18792
  left: "calc(0.75rem + var(--ole-left-inset, 0px) + var(--ole-safe-left, 0px))",
18782
18793
  maxHeight: "calc(100% - 1.5rem)"
18783
18794
  },
18784
- children: e ? /* @__PURE__ */ u(la, { onClose: () => t(!1) }) : /* @__PURE__ */ u(hT, { onClick: () => t(!0) })
18795
+ children: e ? /* @__PURE__ */ u(la, { onClose: () => t(!1) }) : /* @__PURE__ */ u(gT, { onClick: () => t(!0) })
18785
18796
  }
18786
18797
  );
18787
18798
  }
18788
- function hT({ onClick: e }) {
18799
+ function gT({ onClick: e }) {
18789
18800
  const t = ae(), n = bt(), o = Ke(n, "compact");
18790
18801
  return /* @__PURE__ */ P(
18791
18802
  "button",
@@ -18829,17 +18840,17 @@ function la({
18829
18840
  className: "flex items-center gap-1.5 border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-muted/40",
18830
18841
  children: [
18831
18842
  /* @__PURE__ */ u("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: n("outline.title") }),
18832
- !l && /* @__PURE__ */ u(gT, { children: o.length }),
18843
+ !l && /* @__PURE__ */ u(yT, { children: o.length }),
18833
18844
  /* @__PURE__ */ u(a_, { className: "size-3.5 text-muted-foreground" })
18834
18845
  ]
18835
18846
  }
18836
18847
  ),
18837
- /* @__PURE__ */ u("div", { className: "flex-1 overflow-y-auto px-2 pb-2", children: o.length === 0 ? /* @__PURE__ */ u("p", { className: "px-2 py-2 text-xs italic text-muted-foreground", children: n("outline.empty") }) : /* @__PURE__ */ u("ul", { className: "space-y-px", children: o.map((c) => /* @__PURE__ */ u(fT, { element: c }, c.id)) }) })
18848
+ /* @__PURE__ */ u("div", { className: "flex-1 overflow-y-auto px-2 pb-2", children: o.length === 0 ? /* @__PURE__ */ u("p", { className: "px-2 py-2 text-xs italic text-muted-foreground", children: n("outline.empty") }) : /* @__PURE__ */ u("ul", { className: "space-y-px", children: o.map((c) => /* @__PURE__ */ u(bT, { element: c }, c.id)) }) })
18838
18849
  ]
18839
18850
  }
18840
18851
  );
18841
18852
  }
18842
- function fT({ element: e }) {
18853
+ function bT({ element: e }) {
18843
18854
  const t = w((s) => s.internal.library.get(e.kind)), n = w((s) => s.selection.includes(e.id)), o = w((s) => s.setSelection), r = w((s) => s.toggleInSelection), i = bt(), a = !Ke(i, "compact"), l = (s) => {
18844
18855
  s.shiftKey || s.metaKey || s.ctrlKey ? r(e.id) : o([e.id]);
18845
18856
  };
@@ -18867,10 +18878,10 @@ function fT({ element: e }) {
18867
18878
  }
18868
18879
  );
18869
18880
  }
18870
- function gT({ children: e }) {
18881
+ function yT({ children: e }) {
18871
18882
  return /* @__PURE__ */ u("span", { className: "rounded bg-muted/50 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-muted-foreground/80", children: e });
18872
18883
  }
18873
- const bT = {
18884
+ const wT = {
18874
18885
  // Names — the JSON `name` field is already Chinese, so we only need them
18875
18886
  // here for symmetry / one-stop translation. English is the value-add.
18876
18887
  "arc-suppression-coil.name": "消弧线圈",
@@ -18996,7 +19007,7 @@ const bT = {
18996
19007
  "breaker.param.Icu": "分断能力",
18997
19008
  "disconnector.param.In": "额定电流",
18998
19009
  "fuse.param.In": "额定电流"
18999
- }, yT = {
19010
+ }, vT = {
19000
19011
  "arc-suppression-coil.name": "Arc-suppression coil",
19001
19012
  "arrester.name": "Surge arrester (FBL)",
19002
19013
  "async-motor.name": "Asynchronous motor",
@@ -19221,8 +19232,8 @@ const bT = {
19221
19232
  "busduct-tap.param.In": "Rated current",
19222
19233
  "busduct-tap.param.Itap": "Tap-off current"
19223
19234
  }, ca = {
19224
- zh: bT,
19225
- en: yT,
19235
+ zh: wT,
19236
+ en: vT,
19226
19237
  es: Ne.es.library,
19227
19238
  fr: Ne.fr.library,
19228
19239
  de: Ne.de.library,
@@ -19233,27 +19244,27 @@ const bT = {
19233
19244
  ar: Ne.ar.library,
19234
19245
  he: Ne.he.library
19235
19246
  };
19236
- function wT(e, t) {
19247
+ function xT(e, t) {
19237
19248
  return ca[e][t] ?? ca.en[t];
19238
19249
  }
19239
19250
  function kn() {
19240
19251
  const e = ao((t) => t.locale);
19241
- return (t, n) => wT(e, t) ?? n ?? t;
19252
+ return (t, n) => xT(e, t) ?? n ?? t;
19242
19253
  }
19243
19254
  const xS = fn((e) => ({
19244
19255
  onCreateComponent: null,
19245
19256
  setHostActions: (t) => e(t)
19246
- })), kS = "ole-palette-collapsed", vT = /* @__PURE__ */ new Set(["busbar"]), ln = "__custom__";
19247
- function xT(e) {
19257
+ })), kS = "ole-palette-collapsed", kT = /* @__PURE__ */ new Set(["busbar"]), ln = "__custom__";
19258
+ function ST(e) {
19248
19259
  const t = {};
19249
19260
  for (const n of e.values()) {
19250
- if (vT.has(n.id)) continue;
19261
+ if (kT.has(n.id)) continue;
19251
19262
  const o = fr(n.id) ? ln : n.category;
19252
19263
  (t[o] ?? (t[o] = [])).push(n);
19253
19264
  }
19254
19265
  return t;
19255
19266
  }
19256
- function kT(e) {
19267
+ function _T(e) {
19257
19268
  var o;
19258
19269
  const t = /* @__PURE__ */ new Set([...ei, ln]), n = Object.keys(e).filter((r) => !t.has(r));
19259
19270
  return [
@@ -19267,7 +19278,7 @@ function kT(e) {
19267
19278
  ...n
19268
19279
  ];
19269
19280
  }
19270
- function ST() {
19281
+ function CT() {
19271
19282
  try {
19272
19283
  const e = window.localStorage.getItem(kS);
19273
19284
  if (!e) return /* @__PURE__ */ new Set();
@@ -19277,7 +19288,7 @@ function ST() {
19277
19288
  return /* @__PURE__ */ new Set();
19278
19289
  }
19279
19290
  }
19280
- function _T(e) {
19291
+ function $T(e) {
19281
19292
  try {
19282
19293
  window.localStorage.setItem(
19283
19294
  kS,
@@ -19286,7 +19297,7 @@ function _T(e) {
19286
19297
  } catch {
19287
19298
  }
19288
19299
  }
19289
- function CT() {
19300
+ function AT() {
19290
19301
  const e = ae(), t = w((m) => m.activeTool === "place"), n = w((m) => m.placeKind), o = w((m) => m.setActiveTool), r = hn((m) => m.outlineOpen), i = bt(), a = Ke(i, "dense"), l = 68, c = a ? void 0 : `calc(100vh - ${l}px - ${r ? "calc(40vh + 20px)" : "68px"})`;
19291
19302
  if (!t || a && n != null) return null;
19292
19303
  const d = a ? {
@@ -19322,22 +19333,22 @@ function CT() {
19322
19333
  }
19323
19334
  )
19324
19335
  ] }),
19325
- /* @__PURE__ */ u($T, { sheet: a })
19336
+ /* @__PURE__ */ u(ET, { sheet: a })
19326
19337
  ]
19327
19338
  }
19328
19339
  )
19329
19340
  }
19330
19341
  );
19331
19342
  }
19332
- function $T({ sheet: e }) {
19343
+ function ET({ sheet: e }) {
19333
19344
  const t = ae(), n = kn(), [o, r] = ye(""), [i, a] = ye(
19334
- () => ST()
19335
- ), l = w((f) => f.internal.library), s = xS((f) => f.onCreateComponent), c = Pt(() => xT(l), [l]), d = Pt(() => kT(c), [c]), m = Pt(() => {
19345
+ () => CT()
19346
+ ), l = w((f) => f.internal.library), s = xS((f) => f.onCreateComponent), c = Pt(() => ST(l), [l]), d = Pt(() => _T(c), [c]), m = Pt(() => {
19336
19347
  const f = o.trim().toLowerCase();
19337
19348
  if (!f) return c;
19338
19349
  const b = {};
19339
- for (const [y, v] of Object.entries(c)) {
19340
- const $ = v.filter((C) => {
19350
+ for (const [y, x] of Object.entries(c)) {
19351
+ const $ = x.filter((C) => {
19341
19352
  const I = n(`${C.id}.name`, C.name).toLowerCase(), W = n(`${C.id}.desc`, C.description ?? "").toLowerCase();
19342
19353
  return I.includes(f) || C.id.toLowerCase().includes(f) || W.includes(f);
19343
19354
  });
@@ -19346,13 +19357,13 @@ function $T({ sheet: e }) {
19346
19357
  return b;
19347
19358
  }, [o, n, c]), p = o.trim().length > 0, g = p && Object.values(m).every((f) => !(f != null && f.length)), h = Mt((f, b) => {
19348
19359
  a((y) => {
19349
- const v = new Set(y);
19350
- return b ? v.delete(f) : v.add(f), _T(v), v;
19360
+ const x = new Set(y);
19361
+ return b ? x.delete(f) : x.add(f), $T(x), x;
19351
19362
  });
19352
19363
  }, []);
19353
19364
  return /* @__PURE__ */ P(Ge, { children: [
19354
19365
  /* @__PURE__ */ P("div", { className: "space-y-1.5 px-2 pb-1.5 pt-2", children: [
19355
- /* @__PURE__ */ u(AT, { value: o, onChange: r }),
19366
+ /* @__PURE__ */ u(NT, { value: o, onChange: r }),
19356
19367
  s && /* Offered here rather than in a menu because the moment you need it
19357
19368
  is the moment you have searched the palette and come up empty. */
19358
19369
  /* @__PURE__ */ P(
@@ -19372,7 +19383,7 @@ function $T({ sheet: e }) {
19372
19383
  var C;
19373
19384
  const b = m[f];
19374
19385
  if (!(b != null && b.length)) return null;
19375
- const y = ((C = c[f]) == null ? void 0 : C.length) ?? b.length, v = t(f === ln ? "cat.custom" : `cat.${f}`), $ = p || !i.has(f);
19386
+ const y = ((C = c[f]) == null ? void 0 : C.length) ?? b.length, x = t(f === ln ? "cat.custom" : `cat.${f}`), $ = p || !i.has(f);
19376
19387
  return /* @__PURE__ */ P(
19377
19388
  "details",
19378
19389
  {
@@ -19387,10 +19398,10 @@ function $T({ sheet: e }) {
19387
19398
  children: [
19388
19399
  /* @__PURE__ */ P("summary", { className: "flex cursor-pointer select-none items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:bg-accent hover:text-accent-foreground", children: [
19389
19400
  /* @__PURE__ */ u(Ta, { className: "size-3 transition-transform [details:not([open])>summary>&]:-rotate-90" }),
19390
- /* @__PURE__ */ u("span", { className: "flex-1", children: v }),
19391
- /* @__PURE__ */ u(NT, { children: p && b.length !== y ? `${b.length}/${y}` : y })
19401
+ /* @__PURE__ */ u("span", { className: "flex-1", children: x }),
19402
+ /* @__PURE__ */ u(IT, { children: p && b.length !== y ? `${b.length}/${y}` : y })
19392
19403
  ] }),
19393
- /* @__PURE__ */ u("ul", { className: "mt-0.5 space-y-px", children: b.map((I) => /* @__PURE__ */ u(ET, { entry: I, sheet: e }, I.id)) })
19404
+ /* @__PURE__ */ u("ul", { className: "mt-0.5 space-y-px", children: b.map((I) => /* @__PURE__ */ u(TT, { entry: I, sheet: e }, I.id)) })
19394
19405
  ]
19395
19406
  },
19396
19407
  f
@@ -19398,7 +19409,7 @@ function $T({ sheet: e }) {
19398
19409
  }) })
19399
19410
  ] });
19400
19411
  }
19401
- function AT({
19412
+ function NT({
19402
19413
  value: e,
19403
19414
  onChange: t
19404
19415
  }) {
@@ -19428,7 +19439,7 @@ function AT({
19428
19439
  )
19429
19440
  ] });
19430
19441
  }
19431
- function ET({
19442
+ function TT({
19432
19443
  entry: e,
19433
19444
  sheet: t
19434
19445
  }) {
@@ -19494,11 +19505,11 @@ function ET({
19494
19505
  }
19495
19506
  );
19496
19507
  }
19497
- function NT({ children: e }) {
19508
+ function IT({ children: e }) {
19498
19509
  return /* @__PURE__ */ u("span", { className: "rounded bg-muted/50 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-muted-foreground/80", children: e });
19499
19510
  }
19500
19511
  const ur = "ole-onboarding-dismissed";
19501
- function TT() {
19512
+ function PT() {
19502
19513
  if (typeof window > "u") return !1;
19503
19514
  try {
19504
19515
  return window.localStorage.getItem(ur) === "1";
@@ -19513,7 +19524,7 @@ function da(e) {
19513
19524
  }
19514
19525
  }
19515
19526
  const ua = fn((e) => ({
19516
- dismissed: TT(),
19527
+ dismissed: PT(),
19517
19528
  dismiss: () => {
19518
19529
  da(!0), e({ dismissed: !0 });
19519
19530
  },
@@ -19521,7 +19532,7 @@ const ua = fn((e) => ({
19521
19532
  da(!1), e({ dismissed: !1 });
19522
19533
  }
19523
19534
  }));
19524
- function IT() {
19535
+ function zT() {
19525
19536
  const e = ae(), t = ua((o) => o.dismissed), n = ua((o) => o.dismiss);
19526
19537
  return t ? null : /* @__PURE__ */ P(
19527
19538
  "div",
@@ -19609,20 +19620,20 @@ function Lo({
19609
19620
  ] })
19610
19621
  ] });
19611
19622
  }
19612
- function PT() {
19623
+ function MT() {
19613
19624
  const e = ae(), t = w((f) => f.selection), n = w((f) => f.diagram.elements), o = w((f) => f.diagram.buses), r = w((f) => f.diagram.junctions), i = w((f) => f.selectedNode), a = w((f) => f.selectedWire), l = w((f) => f.selectedAnnotations), s = w(gn);
19614
- if (a) return /* @__PURE__ */ u(GT, { wireId: a });
19615
- if (i) return /* @__PURE__ */ u(KT, { nodeId: i });
19616
- if (s) return /* @__PURE__ */ u(RT, { annId: s });
19625
+ if (a) return /* @__PURE__ */ u(KT, { wireId: a });
19626
+ if (i) return /* @__PURE__ */ u(UT, { nodeId: i });
19627
+ if (s) return /* @__PURE__ */ u(jT, { annId: s });
19617
19628
  const c = t.length + l.length;
19618
19629
  if (c === 0)
19619
19630
  return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: e("props.empty") });
19620
19631
  if (c > 1)
19621
19632
  return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: e("props.multi", { n: c }) });
19622
19633
  const d = t[0], m = (o ?? []).find((f) => f.id === d);
19623
- if (m) return /* @__PURE__ */ u(OT, { bus: m });
19634
+ if (m) return /* @__PURE__ */ u(RT, { bus: m });
19624
19635
  const p = (r ?? []).find((f) => f.id === d);
19625
- if (p) return /* @__PURE__ */ u(VT, { junction: p });
19636
+ if (p) return /* @__PURE__ */ u(XT, { junction: p });
19626
19637
  const g = n.find((f) => f.id === d);
19627
19638
  if (!g) return null;
19628
19639
  const h = _t[g.kind];
@@ -19658,10 +19669,10 @@ function PT() {
19658
19669
  onChange: (f) => w.getState().updateElement(d, { color: f === "default" ? void 0 : f })
19659
19670
  }
19660
19671
  ),
19661
- h && /* @__PURE__ */ u(HT, { id: d }),
19662
- (h == null ? void 0 : h.state) && h.state.length > 0 && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-col gap-1.5 border-t border-border/40 pt-2.5", children: h.state.map((f) => /* @__PURE__ */ u(YT, { id: d, element: g, field: f }, f.name)) }),
19672
+ h && /* @__PURE__ */ u(WT, { id: d }),
19673
+ (h == null ? void 0 : h.state) && h.state.length > 0 && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-col gap-1.5 border-t border-border/40 pt-2.5", children: h.state.map((f) => /* @__PURE__ */ u(QT, { id: d, element: g, field: f }, f.name)) }),
19663
19674
  /* @__PURE__ */ u(
19664
- zT,
19675
+ DT,
19665
19676
  {
19666
19677
  id: d,
19667
19678
  element: g,
@@ -19670,7 +19681,7 @@ function PT() {
19670
19681
  )
19671
19682
  ] });
19672
19683
  }
19673
- function zT({
19684
+ function DT({
19674
19685
  id: e,
19675
19686
  element: t,
19676
19687
  schema: n
@@ -19678,7 +19689,7 @@ function zT({
19678
19689
  const o = new Set(n.map((i) => i.name)), r = t.params ? Object.entries(t.params).filter(([i]) => !o.has(i)) : [];
19679
19690
  return n.length === 0 && r.length === 0 ? null : /* @__PURE__ */ P("div", { className: "mt-1 flex flex-col gap-1.5 border-t border-border/40 pt-2.5", children: [
19680
19691
  n.map((i) => /* @__PURE__ */ u(
19681
- MT,
19692
+ OT,
19682
19693
  {
19683
19694
  id: e,
19684
19695
  element: t,
@@ -19687,7 +19698,7 @@ function zT({
19687
19698
  i.name
19688
19699
  )),
19689
19700
  r.map(([i, a]) => /* @__PURE__ */ u(
19690
- DT,
19701
+ LT,
19691
19702
  {
19692
19703
  id: e,
19693
19704
  element: t,
@@ -19698,7 +19709,7 @@ function zT({
19698
19709
  ))
19699
19710
  ] });
19700
19711
  }
19701
- function MT({
19712
+ function OT({
19702
19713
  id: e,
19703
19714
  element: t,
19704
19715
  field: n
@@ -19728,7 +19739,7 @@ function MT({
19728
19739
  }
19729
19740
  );
19730
19741
  }
19731
- function DT({
19742
+ function LT({
19732
19743
  id: e,
19733
19744
  element: t,
19734
19745
  fieldKey: n,
@@ -19749,7 +19760,7 @@ function DT({
19749
19760
  }
19750
19761
  );
19751
19762
  }
19752
- function OT({ bus: e }) {
19763
+ function RT({ bus: e }) {
19753
19764
  const t = ae(), n = e.id, o = (r) => {
19754
19765
  const i = r.trim();
19755
19766
  qn(n, { name: i === "" ? void 0 : i });
@@ -19781,10 +19792,10 @@ function OT({ bus: e }) {
19781
19792
  onChange: (r) => qn(n, { color: r === "default" ? void 0 : r })
19782
19793
  }
19783
19794
  ),
19784
- /* @__PURE__ */ u(LT, { bus: e })
19795
+ /* @__PURE__ */ u(BT, { bus: e })
19785
19796
  ] });
19786
19797
  }
19787
- function LT({ bus: e }) {
19798
+ function BT({ bus: e }) {
19788
19799
  const t = (o, r) => {
19789
19800
  const i = { ...e.params ?? {} };
19790
19801
  r === void 0 || r === "" ? delete i[o] : i[o] = r, qn(e.id, {
@@ -19807,7 +19818,7 @@ function qn(e, t) {
19807
19818
  return { ...n, buses: o };
19808
19819
  });
19809
19820
  }
19810
- function RT({ annId: e }) {
19821
+ function jT({ annId: e }) {
19811
19822
  const t = ae(), n = w(
19812
19823
  (i) => (i.diagram.annotations ?? []).find((a) => a.id === e)
19813
19824
  );
@@ -19905,7 +19916,7 @@ function RT({ annId: e }) {
19905
19916
  label: t("props.annRows"),
19906
19917
  value: i.rowHeights.length,
19907
19918
  min: 1,
19908
- onChange: (a) => o(BT(i, a))
19919
+ onChange: (a) => o(HT(i, a))
19909
19920
  }
19910
19921
  ),
19911
19922
  /* @__PURE__ */ u(
@@ -19914,7 +19925,7 @@ function RT({ annId: e }) {
19914
19925
  label: t("props.annCols"),
19915
19926
  value: i.colWidths.length,
19916
19927
  min: 1,
19917
- onChange: (a) => o(jT(i, a))
19928
+ onChange: (a) => o(FT(i, a))
19918
19929
  }
19919
19930
  ),
19920
19931
  /* @__PURE__ */ u(
@@ -19958,14 +19969,14 @@ function RT({ annId: e }) {
19958
19969
  }
19959
19970
  }
19960
19971
  }
19961
- function BT(e, t) {
19972
+ function HT(e, t) {
19962
19973
  const n = e.colWidths.length, o = e.rowHeights[e.rowHeights.length - 1] ?? un, r = e.rowHeights.slice(0, t);
19963
19974
  for (; r.length < t; ) r.push(o);
19964
19975
  const i = e.cells.slice(0, t).map((a) => [...a]);
19965
19976
  for (; i.length < t; ) i.push(M2(n, 1).cells[0]);
19966
19977
  return { rowHeights: r, cells: i };
19967
19978
  }
19968
- function jT(e, t) {
19979
+ function FT(e, t) {
19969
19980
  const n = e.colWidths[e.colWidths.length - 1] ?? dn, o = e.colWidths.slice(0, t);
19970
19981
  for (; o.length < t; ) o.push(n);
19971
19982
  const r = e.cells.map((i) => {
@@ -20082,7 +20093,7 @@ function Tt({ width: e, dash: t }) {
20082
20093
  ) });
20083
20094
  }
20084
20095
  const pa = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 4];
20085
- function HT({ id: e }) {
20096
+ function WT({ id: e }) {
20086
20097
  const t = ae(), n = w((l) => {
20087
20098
  var s;
20088
20099
  return ((s = l.internal.layout.get(e)) == null ? void 0 : s.scale) ?? 1;
@@ -20158,7 +20169,7 @@ function ha({
20158
20169
  )
20159
20170
  ] }) });
20160
20171
  }
20161
- const FT = 5, WT = 32, qT = 8;
20172
+ const qT = 5, GT = 32, VT = 8;
20162
20173
  function fa({
20163
20174
  label: e,
20164
20175
  value: t,
@@ -20169,7 +20180,7 @@ function fa({
20169
20180
  {
20170
20181
  label: e,
20171
20182
  value: t != null ? String(t) : "",
20172
- placeholder: String(qT),
20183
+ placeholder: String(VT),
20173
20184
  unit: "px",
20174
20185
  onCommit: (o) => {
20175
20186
  const r = o.trim();
@@ -20178,12 +20189,12 @@ function fa({
20178
20189
  return;
20179
20190
  }
20180
20191
  const i = Number(r);
20181
- Number.isFinite(i) && n(Math.min(WT, Math.max(FT, Math.round(i))));
20192
+ Number.isFinite(i) && n(Math.min(GT, Math.max(qT, Math.round(i))));
20182
20193
  }
20183
20194
  }
20184
20195
  );
20185
20196
  }
20186
- function GT({ wireId: e }) {
20197
+ function KT({ wireId: e }) {
20187
20198
  const t = ae(), n = w((b) => b.diagram.wires), o = w((b) => b.diagram.elements), r = w((b) => b.diagram.buses), i = w((b) => b.diagram.junctions), a = w((b) => b.internal.terminalToNode), l = w((b) => b.setSelectedNode), s = (n ?? []).find((b) => b.id === e);
20188
20199
  if (!s)
20189
20200
  return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: t("props.wireNotFound", { id: e }) });
@@ -20194,8 +20205,8 @@ function GT({ wireId: e }) {
20194
20205
  const W = p.get(b);
20195
20206
  return { id: b, label: (W == null ? void 0 : W.name) ?? b };
20196
20207
  }
20197
- const y = b.indexOf("."), v = b.slice(0, y), $ = b.slice(y + 1), C = d.get(v);
20198
- return { id: v, label: (C == null ? void 0 : C.name) ?? v, pin: $ };
20208
+ const y = b.indexOf("."), x = b.slice(0, y), $ = b.slice(y + 1), C = d.get(x);
20209
+ return { id: x, label: (C == null ? void 0 : C.name) ?? x, pin: $ };
20199
20210
  }, h = g(s.ends[0]), f = g(s.ends[1]);
20200
20211
  return /* @__PURE__ */ P("div", { className: "flex flex-col gap-3 px-3 py-3 text-xs", children: [
20201
20212
  /* @__PURE__ */ P("div", { className: "space-y-1", children: [
@@ -20243,7 +20254,7 @@ function GT({ wireId: e }) {
20243
20254
  )
20244
20255
  ] });
20245
20256
  }
20246
- function VT({ junction: e }) {
20257
+ function XT({ junction: e }) {
20247
20258
  var r;
20248
20259
  const t = ae(), n = w((i) => {
20249
20260
  var a;
@@ -20282,7 +20293,7 @@ function VT({ junction: e }) {
20282
20293
  ] })
20283
20294
  ] });
20284
20295
  }
20285
- function KT({ nodeId: e }) {
20296
+ function UT({ nodeId: e }) {
20286
20297
  const t = ae(), n = w((l) => l.internal.nodes.get(e)), o = w((l) => l.diagram.elements), r = w((l) => l.setSelection);
20287
20298
  if (!n)
20288
20299
  return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: t("props.nodeNotFound", { id: e }) });
@@ -20331,7 +20342,7 @@ function Je({
20331
20342
  /* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: t })
20332
20343
  ] });
20333
20344
  }
20334
- const XT = 6;
20345
+ const YT = 6;
20335
20346
  function at({
20336
20347
  label: e,
20337
20348
  value: t,
@@ -20361,7 +20372,7 @@ function at({
20361
20372
  {
20362
20373
  ref: s,
20363
20374
  rows: Math.min(
20364
- XT,
20375
+ YT,
20365
20376
  Math.max(1, a.split(`
20366
20377
  `).length)
20367
20378
  ),
@@ -20386,7 +20397,7 @@ function at({
20386
20397
  o && /* @__PURE__ */ u("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: o })
20387
20398
  ] }) });
20388
20399
  }
20389
- const UT = 350;
20400
+ const ZT = 350;
20390
20401
  function Sr({
20391
20402
  label: e,
20392
20403
  value: t,
@@ -20414,7 +20425,7 @@ function Sr({
20414
20425
  onChange: (m) => {
20415
20426
  r(m.target.value), a.current !== null && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
20416
20427
  a.current = null, d.current();
20417
- }, UT);
20428
+ }, ZT);
20418
20429
  },
20419
20430
  onBlur: () => {
20420
20431
  i.current = !1, c();
@@ -20476,7 +20487,7 @@ function _r({
20476
20487
  }
20477
20488
  );
20478
20489
  }
20479
- function YT({
20490
+ function QT({
20480
20491
  id: e,
20481
20492
  element: t,
20482
20493
  field: n
@@ -20504,7 +20515,7 @@ function YT({
20504
20515
  }
20505
20516
  );
20506
20517
  }
20507
- function ZT() {
20518
+ function JT() {
20508
20519
  const e = ae(), t = kn(), n = w((h) => h.selection), o = w((h) => h.selectedNode), r = w((h) => h.selectedWire), i = w((h) => h.selectedAnnotations), a = w(gn), l = w((h) => h.diagram.annotations), s = w((h) => h.diagram.elements), c = w((h) => h.diagram.buses), d = bt(), m = Ke(d, "dense");
20509
20520
  if (n.length === 0 && i.length === 0 && !o && !r)
20510
20521
  return null;
@@ -20552,12 +20563,12 @@ function ZT() {
20552
20563
  /* @__PURE__ */ u("span", { className: "flex-1 truncate text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: p }),
20553
20564
  g != null && /* @__PURE__ */ u("span", { className: "rounded bg-muted/50 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-muted-foreground/80", children: e("props.nSelected", { n: g }) })
20554
20565
  ] }),
20555
- /* @__PURE__ */ u(PT, {})
20566
+ /* @__PURE__ */ u(MT, {})
20556
20567
  ]
20557
20568
  }
20558
20569
  );
20559
20570
  }
20560
- function QT() {
20571
+ function eI() {
20561
20572
  Q(() => {
20562
20573
  const e = (n) => {
20563
20574
  const o = n.target;
@@ -20576,16 +20587,16 @@ function QT() {
20576
20587
  };
20577
20588
  }, []);
20578
20589
  }
20579
- function JT() {
20580
- QT();
20581
- const e = w((o) => o.readOnly), t = ie(null), n = eN(t);
20590
+ function tI() {
20591
+ eI();
20592
+ const e = w((o) => o.readOnly), t = ie(null), n = e4(t);
20582
20593
  return /* @__PURE__ */ u(V_, { children: /* @__PURE__ */ u(
20583
20594
  "div",
20584
20595
  {
20585
20596
  ref: t,
20586
20597
  className: "relative h-full w-full overflow-hidden bg-background text-foreground",
20587
- children: /* @__PURE__ */ P(IN, { width: n, children: [
20588
- /* @__PURE__ */ u(kN, {}),
20598
+ children: /* @__PURE__ */ P(z4, { width: n, children: [
20599
+ /* @__PURE__ */ u(k4, {}),
20589
20600
  e ? (
20590
20601
  // View-only: canvas + zoom/fit controls + hover labels, no editing
20591
20602
  // chrome (panels, tools, contextual/library popovers, onboarding).
@@ -20594,39 +20605,39 @@ function JT() {
20594
20605
  /* @__PURE__ */ u(Ui, {})
20595
20606
  ] })
20596
20607
  ) : /* @__PURE__ */ P(Ge, { children: [
20597
- /* @__PURE__ */ u(pT, {}),
20598
- /* @__PURE__ */ u(ZT, {}),
20599
- /* @__PURE__ */ u(sT, {}),
20608
+ /* @__PURE__ */ u(fT, {}),
20609
+ /* @__PURE__ */ u(JT, {}),
20610
+ /* @__PURE__ */ u(cT, {}),
20600
20611
  /* @__PURE__ */ u(ia, {}),
20601
- /* @__PURE__ */ u(VN, {}),
20602
- /* @__PURE__ */ u(XN, {}),
20603
- /* @__PURE__ */ u(CT, {}),
20604
- /* @__PURE__ */ u(IT, {}),
20612
+ /* @__PURE__ */ u(X4, {}),
20613
+ /* @__PURE__ */ u(Y4, {}),
20614
+ /* @__PURE__ */ u(AT, {}),
20615
+ /* @__PURE__ */ u(zT, {}),
20605
20616
  /* @__PURE__ */ u(Ui, {})
20606
20617
  ] })
20607
20618
  ] })
20608
20619
  }
20609
20620
  ) });
20610
20621
  }
20611
- const eI = "ole-theme";
20612
- function tI() {
20622
+ const nI = "ole-theme";
20623
+ function oI() {
20613
20624
  try {
20614
- const e = window.localStorage.getItem(eI);
20625
+ const e = window.localStorage.getItem(nI);
20615
20626
  return e === "light" || e === "dark" ? e : null;
20616
20627
  } catch {
20617
20628
  return null;
20618
20629
  }
20619
20630
  }
20620
- function nI() {
20631
+ function rI() {
20621
20632
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: dark)").matches;
20622
20633
  }
20623
- function mP() {
20624
- return typeof window > "u" ? "light" : tI() ?? (nI() ? "dark" : "light");
20634
+ function hP() {
20635
+ return typeof window > "u" ? "light" : oI() ?? (rI() ? "dark" : "light");
20625
20636
  }
20626
- function oI(e) {
20637
+ function iI(e) {
20627
20638
  typeof document > "u" || document.documentElement.classList.toggle("dark", e === "dark");
20628
20639
  }
20629
- function pP({
20640
+ function fP({
20630
20641
  className: e,
20631
20642
  diagram: t,
20632
20643
  readOnly: n,
@@ -20650,18 +20661,18 @@ function pP({
20650
20661
  }, [t, n]), Q(() => {
20651
20662
  o && ao.getState().setLocale(o);
20652
20663
  }, [o]), Q(() => {
20653
- r && oI(r);
20664
+ r && iI(r);
20654
20665
  }, [r]), Q(() => {
20655
20666
  rS();
20656
- }, []), O4(), /* @__PURE__ */ u("div", { className: `ole-root ${e ?? "h-full w-full"}`, children: /* @__PURE__ */ u(JT, {}) });
20667
+ }, []), ON(), /* @__PURE__ */ u("div", { className: `ole-root ${e ?? "h-full w-full"}`, children: /* @__PURE__ */ u(tI, {}) });
20657
20668
  }
20658
- const SS = 6, rI = 3, Ro = SS + 3, iI = 3, ga = 4, ba = 2;
20659
- function aI(e) {
20669
+ const SS = 6, aI = 3, Ro = SS + 3, sI = 3, ga = 4, ba = 2;
20670
+ function lI(e) {
20660
20671
  const t = e.trim().split(/\s+/).map(Number);
20661
20672
  return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : [t[0], t[1], t[2], t[3]];
20662
20673
  }
20663
- function sI(e, t) {
20664
- const n = aI(e);
20674
+ function cI(e, t) {
20675
+ const n = lI(e);
20665
20676
  if (!n) return null;
20666
20677
  const [o, r, i, a] = n, l = [
20667
20678
  [o, r],
@@ -20675,24 +20686,24 @@ function sI(e, t) {
20675
20686
  }
20676
20687
  return s;
20677
20688
  }
20678
- function lI(e) {
20689
+ function dI(e) {
20679
20690
  return e == null ? "" : typeof e == "number" ? Number.isInteger(e) ? String(e) : e.toFixed(2).replace(/\.?0+$/, "") : typeof e == "boolean" ? e ? "ON" : "OFF" : String(e);
20680
20691
  }
20681
- function cI({
20692
+ function uI({
20682
20693
  id: e,
20683
20694
  box: t,
20684
20695
  rt: n,
20685
20696
  unit: o
20686
20697
  }) {
20687
- const r = n.quality === "bad" || n.quality === "stale", i = n.value !== void 0 && n.value !== null ? `${lI(n.value)}${o ? ` ${o}` : ""}` : "", a = n.badge ?? "";
20698
+ const r = n.quality === "bad" || n.quality === "stale", i = n.value !== void 0 && n.value !== null ? `${dI(n.value)}${o ? ` ${o}` : ""}` : "", a = n.badge ?? "";
20688
20699
  if (!r && !i && !a) return null;
20689
- const l = a.length * SS * 0.6 + rI * 2;
20700
+ const l = a.length * SS * 0.6 + aI * 2;
20690
20701
  return /* @__PURE__ */ P("g", { className: "ole-rt", "data-rt-for": e, "data-alarm": wr(n), children: [
20691
20702
  i && /* @__PURE__ */ u(
20692
20703
  "text",
20693
20704
  {
20694
20705
  className: "ole-rt-value",
20695
- x: t.maxX + iI,
20706
+ x: t.maxX + sI,
20696
20707
  y: t.maxY,
20697
20708
  textAnchor: "start",
20698
20709
  children: i
@@ -20733,7 +20744,7 @@ function cI({
20733
20744
  )
20734
20745
  ] });
20735
20746
  }
20736
- function dI() {
20747
+ function mI() {
20737
20748
  const { props: e, units: t } = jt(), n = de((a) => a.internal.elements), o = de((a) => a.internal.layout), r = de((a) => a.internal.buses), i = Object.keys(e);
20738
20749
  return i.length === 0 ? null : /* @__PURE__ */ u("g", { className: "ole-rt-layer", pointerEvents: "none", children: i.map((a) => {
20739
20750
  const l = e[a];
@@ -20741,7 +20752,7 @@ function dI() {
20741
20752
  let s = null;
20742
20753
  const c = n.get(a), d = o.get(a);
20743
20754
  if (c != null && c.libraryDef && d)
20744
- s = sI(c.libraryDef.viewBox, d);
20755
+ s = cI(c.libraryDef.viewBox, d);
20745
20756
  else {
20746
20757
  const m = r.get(a);
20747
20758
  if (m) {
@@ -20749,11 +20760,11 @@ function dI() {
20749
20760
  s = p === "x" ? { minX: g[0] - f, maxX: g[0] + f, minY: g[1] - 4, maxY: g[1] + 4 } : { minX: g[0] - 4, maxX: g[0] + 4, minY: g[1] - f, maxY: g[1] + f };
20750
20761
  }
20751
20762
  }
20752
- return s ? /* @__PURE__ */ u(cI, { id: a, box: s, rt: l, unit: t[a] }, a) : null;
20763
+ return s ? /* @__PURE__ */ u(uI, { id: a, box: s, rt: l, unit: t[a] }, a) : null;
20753
20764
  }) });
20754
20765
  }
20755
- const uI = 100, mI = 8, pI = 4, hI = 1.5;
20756
- function fI(e) {
20766
+ const pI = 100, hI = 8, fI = 4, gI = 1.5;
20767
+ function bI(e) {
20757
20768
  const t = {}, n = e.bindings, o = e.tags;
20758
20769
  if (!n || !o) return t;
20759
20770
  const r = /* @__PURE__ */ new Map();
@@ -20765,7 +20776,7 @@ function fI(e) {
20765
20776
  }
20766
20777
  return t;
20767
20778
  }
20768
- function gI(e, t) {
20779
+ function yI(e, t) {
20769
20780
  const [n, o] = ye(Zo);
20770
20781
  return Q(() => {
20771
20782
  const r = e.bindings ?? [];
@@ -20773,20 +20784,20 @@ function gI(e, t) {
20773
20784
  o(Zo);
20774
20785
  return;
20775
20786
  }
20776
- const i = fI(e), a = () => o({ props: v6(e, t), units: i });
20787
+ const i = bI(e), a = () => o({ props: v6(e, t), units: i });
20777
20788
  a();
20778
20789
  let l = null;
20779
20790
  const s = Array.from(new Set(r.map((d) => d.tag))), c = t.subscribe(s, () => {
20780
20791
  l === null && (l = window.setTimeout(() => {
20781
20792
  l = null, a();
20782
- }, uI));
20793
+ }, pI));
20783
20794
  });
20784
20795
  return () => {
20785
20796
  c(), l !== null && window.clearTimeout(l);
20786
20797
  };
20787
20798
  }, [e, t]), n;
20788
20799
  }
20789
- function hP({
20800
+ function gP({
20790
20801
  diagram: e,
20791
20802
  tags: t,
20792
20803
  selectedIds: n,
@@ -20809,14 +20820,14 @@ function hP({
20809
20820
  }, [e, p]), Dt(() => {
20810
20821
  n !== void 0 && p.getState().setSelection(n);
20811
20822
  }, [n, e, p]);
20812
- const g = gI(e, t), h = [
20823
+ const g = yI(e, t), h = [
20813
20824
  "ole-root",
20814
20825
  "ole-viewer",
20815
20826
  l === "dark" ? "dark" : "",
20816
20827
  s ?? "h-full w-full"
20817
20828
  ].filter(Boolean).join(" ");
20818
20829
  return /* @__PURE__ */ u("div", { className: h, style: c, children: /* @__PURE__ */ u(f2.Provider, { value: p, children: /* @__PURE__ */ u(C2.Provider, { value: g, children: /* @__PURE__ */ u("div", { className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ u(
20819
- bI,
20830
+ wI,
20820
20831
  {
20821
20832
  store: p,
20822
20833
  diagram: e,
@@ -20830,7 +20841,7 @@ function hP({
20830
20841
  }
20831
20842
  ) }) }) }) });
20832
20843
  }
20833
- function bI({
20844
+ function wI({
20834
20845
  store: e,
20835
20846
  diagram: t,
20836
20847
  hoveredId: n,
@@ -20842,8 +20853,8 @@ function bI({
20842
20853
  onReady: s
20843
20854
  }) {
20844
20855
  const c = ie(null), d = ie(null), m = tS(c, d, void 0, { shared: !1 });
20845
- wI(c, n, i);
20846
- const p = vI(c, m), g = ie(o);
20856
+ xI(c, n, i);
20857
+ const p = kI(c, m), g = ie(o);
20847
20858
  g.current = o;
20848
20859
  const h = Pt(
20849
20860
  () => ({
@@ -20852,11 +20863,11 @@ function bI({
20852
20863
  y && Fn(m, y);
20853
20864
  },
20854
20865
  focus(y) {
20855
- const v = c.current;
20856
- if (!v) return;
20857
- const $ = yI(e.getState(), y);
20866
+ const x = c.current;
20867
+ if (!x) return;
20868
+ const $ = vI(e.getState(), y);
20858
20869
  if (!$) return;
20859
- const C = v.getBoundingClientRect(), I = Math.max(m.getViewport().scale, hI);
20870
+ const C = x.getBoundingClientRect(), I = Math.max(m.getViewport().scale, gI);
20860
20871
  m.setViewport({
20861
20872
  scale: I,
20862
20873
  tx: C.width / 2 - I * $[0],
@@ -20871,19 +20882,19 @@ function bI({
20871
20882
  );
20872
20883
  Q(() => {
20873
20884
  if (!l) return;
20874
- let y = mI, v = 0;
20885
+ let y = hI, x = 0;
20875
20886
  const $ = () => {
20876
20887
  const C = c.current;
20877
- C && Fn(m, C) || --y > 0 && (v = requestAnimationFrame($));
20888
+ C && Fn(m, C) || --y > 0 && (x = requestAnimationFrame($));
20878
20889
  };
20879
- return v = requestAnimationFrame($), () => cancelAnimationFrame(v);
20890
+ return x = requestAnimationFrame($), () => cancelAnimationFrame(x);
20880
20891
  }, [l, t, m]), Q(() => {
20881
20892
  const y = c.current;
20882
20893
  if (!l || !y || typeof ResizeObserver > "u") return;
20883
- const v = new ResizeObserver(() => {
20894
+ const x = new ResizeObserver(() => {
20884
20895
  Fn(m, y);
20885
20896
  });
20886
- return v.observe(y), () => v.disconnect();
20897
+ return x.observe(y), () => x.disconnect();
20887
20898
  }, [l, m]);
20888
20899
  const f = ie(s);
20889
20900
  f.current = s, Q(() => {
@@ -20896,8 +20907,8 @@ function bI({
20896
20907
  p.current = !1;
20897
20908
  return;
20898
20909
  }
20899
- const v = ft(y.target) ?? mn(y.target);
20900
- v ? r == null || r(v, y) : a == null || a();
20910
+ const x = ft(y.target) ?? mn(y.target);
20911
+ x ? r == null || r(x, y) : a == null || a();
20901
20912
  },
20902
20913
  [r, a, p]
20903
20914
  );
@@ -20916,12 +20927,12 @@ function bI({
20916
20927
  /* @__PURE__ */ u(A2, {}),
20917
20928
  /* @__PURE__ */ u(O2, {}),
20918
20929
  /* @__PURE__ */ u(K2, {}),
20919
- /* @__PURE__ */ u(dI, {})
20930
+ /* @__PURE__ */ u(mI, {})
20920
20931
  ] }) })
20921
20932
  }
20922
20933
  );
20923
20934
  }
20924
- function yI(e, t) {
20935
+ function vI(e, t) {
20925
20936
  const n = e.internal.layout.get(t);
20926
20937
  if (n) return n.at;
20927
20938
  const o = e.internal.buses.get(t);
@@ -20933,7 +20944,7 @@ const ya = "ole-hover-element-host";
20933
20944
  function wa(e) {
20934
20945
  return e.replace(/(["\\])/g, "\\$1");
20935
20946
  }
20936
- function wI(e, t, n) {
20947
+ function xI(e, t, n) {
20937
20948
  const o = ie(null), r = ie(null), i = ie(t);
20938
20949
  i.current = t;
20939
20950
  const a = ie(n);
@@ -20960,7 +20971,7 @@ function wI(e, t, n) {
20960
20971
  };
20961
20972
  }, [e, l]);
20962
20973
  }
20963
- function vI(e, t) {
20974
+ function kI(e, t) {
20964
20975
  const n = ie(!1);
20965
20976
  return Q(() => {
20966
20977
  const o = e.current;
@@ -20981,7 +20992,7 @@ function vI(e, t) {
20981
20992
  if (!r || s.pointerId !== r.pointerId) return;
20982
20993
  const c = s.clientX - r.startX, d = s.clientY - r.startY;
20983
20994
  if (!r.moved) {
20984
- if (Math.hypot(c, d) <= pI) return;
20995
+ if (Math.hypot(c, d) <= fI) return;
20985
20996
  r.moved = !0, n.current = !0, o.classList.add("ole-viewer-panning");
20986
20997
  try {
20987
20998
  o.setPointerCapture(s.pointerId);
@@ -21008,7 +21019,7 @@ function vI(e, t) {
21008
21019
  function Bo(e) {
21009
21020
  return e !== null && typeof e == "object" && "v" in e ? e : { v: e };
21010
21021
  }
21011
- function fP(e = {}) {
21022
+ function bP(e = {}) {
21012
21023
  const t = /* @__PURE__ */ new Map();
21013
21024
  for (const [r, i] of Object.entries(e)) t.set(r, Bo(i));
21014
21025
  const n = /* @__PURE__ */ new Set(), o = (r) => {
@@ -21041,7 +21052,7 @@ function fP(e = {}) {
21041
21052
  }
21042
21053
  };
21043
21054
  }
21044
- const xI = /* @__PURE__ */ new Set([
21055
+ const SI = /* @__PURE__ */ new Set([
21045
21056
  "g",
21046
21057
  "line",
21047
21058
  "rect",
@@ -21052,7 +21063,7 @@ const xI = /* @__PURE__ */ new Set([
21052
21063
  "path",
21053
21064
  "text",
21054
21065
  "tspan"
21055
- ]), kI = /* @__PURE__ */ new Set([
21066
+ ]), _I = /* @__PURE__ */ new Set([
21056
21067
  "fill",
21057
21068
  "stroke",
21058
21069
  "stroke-width",
@@ -21084,7 +21095,7 @@ const xI = /* @__PURE__ */ new Set([
21084
21095
  "text-anchor",
21085
21096
  "dominant-baseline"
21086
21097
  ]);
21087
- function gP(e) {
21098
+ function yP(e) {
21088
21099
  const t = /* @__PURE__ */ new Set(), n = new DOMParser().parseFromString(
21089
21100
  `<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,
21090
21101
  "image/svg+xml"
@@ -21094,13 +21105,13 @@ function gP(e) {
21094
21105
  const r = (i) => {
21095
21106
  for (const a of [...i.children]) {
21096
21107
  const l = a.tagName.toLowerCase();
21097
- if (!xI.has(l)) {
21108
+ if (!SI.has(l)) {
21098
21109
  t.add(`element:${l}`), a.remove();
21099
21110
  continue;
21100
21111
  }
21101
21112
  for (const s of [...a.attributes]) {
21102
21113
  const c = (s.localName ?? s.name).toLowerCase();
21103
- kI.has(c) || (t.add(`attr:${s.name.toLowerCase()}`), a.removeAttribute(s.name));
21114
+ _I.has(c) || (t.add(`attr:${s.name.toLowerCase()}`), a.removeAttribute(s.name));
21104
21115
  }
21105
21116
  r(a);
21106
21117
  }
@@ -21108,7 +21119,7 @@ function gP(e) {
21108
21119
  return r(o), { svg: o.innerHTML.trim(), removed: [...t].sort() };
21109
21120
  }
21110
21121
  const Rn = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
21111
- function bP(e) {
21122
+ function wP(e) {
21112
21123
  var l, s, c, d, m;
21113
21124
  const t = [], n = (p, g) => t.push({ field: p, message: g });
21114
21125
  (l = e.id) != null && l.startsWith("custom:") || n("id", "a document-defined kind must have a `custom:` id so it can never shadow a built-in"), (s = e.name) != null && s.trim() || n("name", "name is required — it is what the user sees in the palette"), (c = e.category) != null && c.trim() || n("category", "category is required for palette grouping");
@@ -21160,11 +21171,11 @@ function va(e) {
21160
21171
  throw new Error(Te("io.elementsMissing"));
21161
21172
  return n;
21162
21173
  }
21163
- function SI(e) {
21174
+ function CI(e) {
21164
21175
  return JSON.stringify(e, null, 2) + `
21165
21176
  `;
21166
21177
  }
21167
- async function _I() {
21178
+ async function $I() {
21168
21179
  if (CS()) {
21169
21180
  let e;
21170
21181
  try {
@@ -21200,7 +21211,7 @@ async function _I() {
21200
21211
  });
21201
21212
  }
21202
21213
  async function xa(e, t, n = {}) {
21203
- const o = SI(e);
21214
+ const o = CI(e);
21204
21215
  if (!n.saveAs && (t != null && t.handle)) {
21205
21216
  const a = await t.handle.createWritable();
21206
21217
  return await a.write(o), await a.close(), t;
@@ -21222,8 +21233,8 @@ async function xa(e, t, n = {}) {
21222
21233
  const r = URL.createObjectURL(new Blob([o], { type: "application/json" })), i = document.createElement("a");
21223
21234
  return i.href = r, i.download = (t == null ? void 0 : t.name) ?? "diagram.json", i.click(), URL.revokeObjectURL(r), t ?? { name: "diagram.json" };
21224
21235
  }
21225
- function yP() {
21226
- const e = ae(), t = w((m) => m.fileSession), n = (t == null ? void 0 : t.name) ?? e("common.unnamed"), { onNew: o, onOpen: r, onSave: i, onSaveAs: a } = CI(), [l, s] = ye(!1), c = ie(null);
21236
+ function vP() {
21237
+ const e = ae(), t = w((m) => m.fileSession), n = (t == null ? void 0 : t.name) ?? e("common.unnamed"), { onNew: o, onOpen: r, onSave: i, onSaveAs: a } = AI(), [l, s] = ye(!1), c = ie(null);
21227
21238
  Q(() => {
21228
21239
  const m = (p) => {
21229
21240
  if (!(p.metaKey || p.ctrlKey)) return;
@@ -21298,14 +21309,14 @@ function Bn({
21298
21309
  }
21299
21310
  );
21300
21311
  }
21301
- function CI() {
21312
+ function AI() {
21302
21313
  const e = ae(), t = w((s) => s.loadDiagramFromFile), n = w((s) => s.setFileSession), o = w((s) => s.setDiagram);
21303
21314
  return { onNew: () => {
21304
21315
  const { diagram: s } = w.getState();
21305
21316
  s.elements.length > 0 && !confirm(e("topbar.file.newConfirm")) || (o({ version: "1", elements: [] }), n(null));
21306
21317
  }, onOpen: async () => {
21307
21318
  try {
21308
- const s = await _I();
21319
+ const s = await $I();
21309
21320
  s && (t(s.diagram, s.session), rS());
21310
21321
  } catch (s) {
21311
21322
  alert(e("topbar.file.openFailed", { err: s.message }));
@@ -21326,10 +21337,10 @@ function CI() {
21326
21337
  }
21327
21338
  } };
21328
21339
  }
21329
- const jo = "WIRES", st = "ELEMENTS", Ho = "LABELS", We = "ANNOTATIONS", ka = 32, Sa = 64, $I = 8, AI = 1.25, EI = 6;
21330
- function NI(e, t = {}) {
21340
+ const jo = "WIRES", st = "ELEMENTS", Ho = "LABELS", We = "ANNOTATIONS", ka = 32, Sa = 64, EI = 8, NI = 1.25, TI = 6;
21341
+ function II(e, t = {}) {
21331
21342
  var a, l;
21332
- const n = new WI(t.precision ?? 6);
21343
+ const n = new GI(t.precision ?? 6);
21333
21344
  n.header(t.title), n.tables([
21334
21345
  { name: jo, color: 7 },
21335
21346
  { name: st, color: 7 },
@@ -21346,7 +21357,7 @@ function NI(e, t = {}) {
21346
21357
  n.setColor(void 0);
21347
21358
  for (const s of e.elements.values()) {
21348
21359
  const c = e.layout.get(s.element.id), d = s.libraryDef;
21349
- !c || !d || (n.setColor(Jt(s.element.color)), II(n, d.svg, c));
21360
+ !c || !d || (n.setColor(Jt(s.element.color)), zI(n, d.svg, c));
21350
21361
  }
21351
21362
  n.setColor(void 0);
21352
21363
  const o = t.labelMode ?? "all", r = Bt(t.labelFontSize), i = bn(r);
@@ -21369,8 +21380,8 @@ function NI(e, t = {}) {
21369
21380
  s.element.labelOffset
21370
21381
  );
21371
21382
  for (let b = 0; b < d.length; b++) {
21372
- const [y, v] = ke([p, g + f + b * i]);
21373
- n.text(Ho, [y, v], d[b], r, 0, !1, h);
21383
+ const [y, x] = ke([p, g + f + b * i]);
21384
+ n.text(Ho, [y, x], d[b], r, 0, !1, h);
21374
21385
  }
21375
21386
  }
21376
21387
  for (const s of e.wireRenders.values()) {
@@ -21453,11 +21464,11 @@ function NI(e, t = {}) {
21453
21464
  ke([d + p, m + f[y]])
21454
21465
  );
21455
21466
  for (let y = 0; y < c.rowHeights.length; y++)
21456
- for (let v = 0; v < c.colWidths.length; v++) {
21457
- const $ = ((l = c.cells[y]) == null ? void 0 : l[v]) ?? "";
21467
+ for (let x = 0; x < c.colWidths.length; x++) {
21468
+ const $ = ((l = c.cells[y]) == null ? void 0 : l[x]) ?? "";
21458
21469
  if ($ === "") continue;
21459
21470
  const C = ke([
21460
- d + h[v] + cn,
21471
+ d + h[x] + cn,
21461
21472
  m + f[y] + c.rowHeights[y] / 2 + b * 0.35
21462
21473
  ]);
21463
21474
  n.text(We, C, $, b, 0, !1);
@@ -21467,12 +21478,12 @@ function NI(e, t = {}) {
21467
21478
  default: {
21468
21479
  const c = s;
21469
21480
  if (!c.text) break;
21470
- const d = c.fontSize ?? $I, m = c.text.split(`
21481
+ const d = c.fontSize ?? EI, m = c.text.split(`
21471
21482
  `);
21472
21483
  for (let p = 0; p < m.length; p++) {
21473
21484
  const [g, h] = ke([
21474
21485
  c.at[0],
21475
- c.at[1] + (p + 1) * d * AI
21486
+ c.at[1] + (p + 1) * d * NI
21476
21487
  ]);
21477
21488
  n.text(We, [g, h], m[p], d, 0, !1);
21478
21489
  }
@@ -21481,19 +21492,19 @@ function NI(e, t = {}) {
21481
21492
  }
21482
21493
  return n.endEntities(), n.toString();
21483
21494
  }
21484
- async function TI(e, t = "diagram.dxf", n) {
21485
- const o = NI(e, n), r = URL.createObjectURL(
21495
+ async function PI(e, t = "diagram.dxf", n) {
21496
+ const o = II(e, n), r = URL.createObjectURL(
21486
21497
  new Blob([o], { type: "application/dxf;charset=utf-8" })
21487
21498
  ), i = document.createElement("a");
21488
21499
  i.href = r, i.download = t, i.click(), URL.revokeObjectURL(r);
21489
21500
  }
21490
- function II(e, t, n) {
21501
+ function zI(e, t, n) {
21491
21502
  const o = `<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`, i = new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
21492
21503
  if (!(!i || i.querySelector("parsererror")))
21493
21504
  for (const a of Array.from(i.children))
21494
21505
  switch (a.tagName.toLowerCase()) {
21495
21506
  case "line":
21496
- PI(e, a, n);
21507
+ MI(e, a, n);
21497
21508
  break;
21498
21509
  case "polyline":
21499
21510
  _a(e, a, n, !1);
@@ -21502,33 +21513,33 @@ function II(e, t, n) {
21502
21513
  _a(e, a, n, !0);
21503
21514
  break;
21504
21515
  case "rect":
21505
- zI(e, a, n);
21516
+ DI(e, a, n);
21506
21517
  break;
21507
21518
  case "circle":
21508
- MI(e, a, n);
21519
+ OI(e, a, n);
21509
21520
  break;
21510
21521
  case "ellipse":
21511
- DI(e, a, n);
21522
+ LI(e, a, n);
21512
21523
  break;
21513
21524
  case "path":
21514
- BI(e, a, n);
21525
+ HI(e, a, n);
21515
21526
  break;
21516
21527
  case "text":
21517
- RI(e, a, n);
21528
+ jI(e, a, n);
21518
21529
  break;
21519
21530
  }
21520
21531
  }
21521
- function PI(e, t, n) {
21532
+ function MI(e, t, n) {
21522
21533
  const o = Ie(t, "x1"), r = Ie(t, "y1"), i = Ie(t, "x2"), a = Ie(t, "y2"), l = ke(rt([o, r], n)), s = ke(rt([i, a], n));
21523
21534
  e.line(st, l, s);
21524
21535
  }
21525
21536
  function _a(e, t, n, o) {
21526
- const r = FI(t.getAttribute("points") ?? "");
21537
+ const r = qI(t.getAttribute("points") ?? "");
21527
21538
  if (r.length < 2) return;
21528
21539
  const i = r.map((a) => ke(rt(a, n)));
21529
21540
  e.polyline(st, i, o);
21530
21541
  }
21531
- function zI(e, t, n) {
21542
+ function DI(e, t, n) {
21532
21543
  const o = Ie(t, "x"), r = Ie(t, "y"), i = Ie(t, "width"), a = Ie(t, "height"), s = [
21533
21544
  [o, r],
21534
21545
  [o + i, r],
@@ -21537,23 +21548,23 @@ function zI(e, t, n) {
21537
21548
  ].map((c) => ke(rt(c, n)));
21538
21549
  e.polyline(st, s, !0);
21539
21550
  }
21540
- function MI(e, t, n) {
21551
+ function OI(e, t, n) {
21541
21552
  const o = Ie(t, "cx"), r = Ie(t, "cy"), i = Ie(t, "r"), a = ke(rt([o, r], n));
21542
21553
  e.circle(st, a, i * (n.scale ?? 1));
21543
21554
  }
21544
- function DI(e, t, n) {
21555
+ function LI(e, t, n) {
21545
21556
  const o = Ie(t, "cx"), r = Ie(t, "cy"), i = Ie(t, "rx"), a = Ie(t, "ry");
21546
21557
  if (Math.abs(i - a) < 1e-6) {
21547
- OI(e, o, r, i, n);
21558
+ RI(e, o, r, i, n);
21548
21559
  return;
21549
21560
  }
21550
- LI(e, o, r, i, a, n);
21561
+ BI(e, o, r, i, a, n);
21551
21562
  }
21552
- function OI(e, t, n, o, r) {
21563
+ function RI(e, t, n, o, r) {
21553
21564
  const i = ke(rt([t, n], r));
21554
21565
  e.circle(st, i, o * (r.scale ?? 1));
21555
21566
  }
21556
- function LI(e, t, n, o, r, i) {
21567
+ function BI(e, t, n, o, r, i) {
21557
21568
  const a = [];
21558
21569
  for (let l = 0; l < Sa; l++) {
21559
21570
  const s = l / Sa * Math.PI * 2;
@@ -21565,14 +21576,14 @@ function LI(e, t, n, o, r, i) {
21565
21576
  }
21566
21577
  e.polyline(st, a, !0);
21567
21578
  }
21568
- function RI(e, t, n) {
21569
- const o = Ie(t, "x"), r = Ie(t, "y"), i = parseFloat(t.getAttribute("font-size") ?? "") || EI, a = (t.textContent ?? "").trim();
21579
+ function jI(e, t, n) {
21580
+ const o = Ie(t, "x"), r = Ie(t, "y"), i = parseFloat(t.getAttribute("font-size") ?? "") || TI, a = (t.textContent ?? "").trim();
21570
21581
  if (!a) return;
21571
21582
  const l = ke(rt([o, r], n));
21572
21583
  e.text(st, l, a, i * (n.scale ?? 1), n.rot, n.mirror);
21573
21584
  }
21574
- function BI(e, t, n) {
21575
- const o = t.getAttribute("d") ?? "", r = jI(o);
21585
+ function HI(e, t, n) {
21586
+ const o = t.getAttribute("d") ?? "", r = FI(o);
21576
21587
  if (r.length === 0) return;
21577
21588
  let i = null, a = [];
21578
21589
  const l = () => {
@@ -21586,7 +21597,7 @@ function BI(e, t, n) {
21586
21597
  if (s.cmd === "M")
21587
21598
  l(), i = [s.args[0], s.args[1]], a.push(i);
21588
21599
  else if (s.cmd === "A" && i) {
21589
- const [c, d, , m, p, g, h] = s.args, f = HI(
21600
+ const [c, d, , m, p, g, h] = s.args, f = WI(
21590
21601
  i,
21591
21602
  [g, h],
21592
21603
  c,
@@ -21608,7 +21619,7 @@ function BI(e, t, n) {
21608
21619
  }
21609
21620
  l();
21610
21621
  }
21611
- function jI(e) {
21622
+ function FI(e) {
21612
21623
  const t = [], n = /([MmAa])([^MmAa]*)/g;
21613
21624
  let o;
21614
21625
  for (; (o = n.exec(e)) !== null; ) {
@@ -21617,7 +21628,7 @@ function jI(e) {
21617
21628
  }
21618
21629
  return t;
21619
21630
  }
21620
- function HI(e, t, n, o, r, i) {
21631
+ function WI(e, t, n, o, r, i) {
21621
21632
  if (n <= 0 || o <= 0) return null;
21622
21633
  const [a, l] = e, [s, c] = t;
21623
21634
  if (a === s && l === c) return null;
@@ -21628,7 +21639,7 @@ function HI(e, t, n, o, r, i) {
21628
21639
  const V = Math.sqrt(b);
21629
21640
  p *= V, g *= V;
21630
21641
  }
21631
- const y = r === i ? -1 : 1, v = p * p * g * g - p * p * m * m - g * g * d * d, $ = p * p * m * m + g * g * d * d, C = y * Math.sqrt(Math.max(0, v / $)), I = C * (p * m) / g, W = C * -(g * d) / p, oe = I + (a + s) / 2, fe = W + (l + c) / 2, A = (V, F, K, se) => {
21642
+ const y = r === i ? -1 : 1, x = p * p * g * g - p * p * m * m - g * g * d * d, $ = p * p * m * m + g * g * d * d, C = y * Math.sqrt(Math.max(0, x / $)), I = C * (p * m) / g, W = C * -(g * d) / p, oe = I + (a + s) / 2, fe = W + (l + c) / 2, A = (V, F, K, se) => {
21632
21643
  const ge = V * K + F * se, ce = Math.hypot(V, F) * Math.hypot(K, se);
21633
21644
  let be = Math.acos(Math.max(-1, Math.min(1, ge / ce)));
21634
21645
  return V * se - F * K < 0 && (be = -be), be;
@@ -21651,12 +21662,12 @@ function Ie(e, t) {
21651
21662
  const n = parseFloat(e.getAttribute(t) ?? "");
21652
21663
  return Number.isFinite(n) ? n : 0;
21653
21664
  }
21654
- function FI(e) {
21665
+ function qI(e) {
21655
21666
  const t = e.trim().split(/[\s,]+/).map(Number).filter((o) => Number.isFinite(o)), n = [];
21656
21667
  for (let o = 0; o + 1 < t.length; o += 2) n.push([t[o], t[o + 1]]);
21657
21668
  return n;
21658
21669
  }
21659
- class WI {
21670
+ class GI {
21660
21671
  constructor(t) {
21661
21672
  Xe(this, "out", []);
21662
21673
  // Explicit field + assignment rather than a constructor parameter
@@ -21775,23 +21786,23 @@ ${this.fmt(n)}
21775
21786
  function Ca(e) {
21776
21787
  return e.replace(/[\r\n]+/g, " ").slice(0, 250);
21777
21788
  }
21778
- const qI = "http://www.w3.org/2000/svg", jn = 24, GI = 1.25;
21789
+ const VI = "http://www.w3.org/2000/svg", jn = 24, KI = 1.25;
21779
21790
  function AS(e, t = {}) {
21780
21791
  var g;
21781
- const n = QI(e, t), o = Math.floor(n.minX - jn), r = Math.floor(n.minY - jn), i = Math.ceil(n.maxX + jn) - o, a = Math.ceil(n.maxY + jn) - r, l = t.background ?? "#FFFFFF", s = [];
21792
+ const n = eP(e, t), o = Math.floor(n.minX - jn), r = Math.floor(n.minY - jn), i = Math.ceil(n.maxX + jn) - o, a = Math.ceil(n.maxY + jn) - r, l = t.background ?? "#FFFFFF", s = [];
21782
21793
  s.push('<?xml version="1.0" encoding="UTF-8"?>'), s.push(
21783
- `<svg xmlns="${qI}" viewBox="${o} ${r} ${i} ${a}" width="${i}" height="${a}">`
21794
+ `<svg xmlns="${VI}" viewBox="${o} ${r} ${i} ${a}" width="${i}" height="${a}">`
21784
21795
  ), t.title && s.push(` <title>${nt(t.title)}</title>`), l !== "transparent" && s.push(
21785
21796
  ` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="${l}"/>`
21786
21797
  ), s.push(' <g fill="none" stroke="black" stroke-width="1">');
21787
21798
  for (const h of e.wireRenders.values()) {
21788
21799
  if (h.path.length < 2) continue;
21789
- const f = h.path.map(([y, v]) => `${y},${v}`).join(" "), b = h.color ? ` stroke="${Ye(h.color)}"` : "";
21800
+ const f = h.path.map(([y, x]) => `${y},${x}`).join(" "), b = h.color ? ` stroke="${Ye(h.color)}"` : "";
21790
21801
  s.push(` <polyline points="${f}"${b}/>`);
21791
21802
  }
21792
21803
  s.push(" </g>");
21793
21804
  for (const { bus: h, geometry: f } of e.buses.values()) {
21794
- const { axis: b, at: y, span: v } = f, $ = v / 2, C = b === "x" ? y[0] - $ : y[0], I = b === "x" ? y[1] : y[1] - $, W = b === "x" ? y[0] + $ : y[0], oe = b === "x" ? y[1] : y[1] + $;
21805
+ const { axis: b, at: y, span: x } = f, $ = x / 2, C = b === "x" ? y[0] - $ : y[0], I = b === "x" ? y[1] : y[1] - $, W = b === "x" ? y[0] + $ : y[0], oe = b === "x" ? y[1] : y[1] + $;
21795
21806
  s.push(
21796
21807
  ` <line id="${nt(h.id)}" x1="${C}" y1="${I}" x2="${W}" y2="${oe}" stroke="${Ye(h.color)}" stroke-width="3" stroke-linecap="round" fill="none"/>`
21797
21808
  );
@@ -21806,7 +21817,7 @@ function AS(e, t = {}) {
21806
21817
  f && (s.push(
21807
21818
  ` <g id="${nt(h.element.id)}" transform="${ht(f)}">`
21808
21819
  ), s.push(
21809
- ` ${VI(q2(h.libraryDef.svg, f.scale), h.element.color)}`
21820
+ ` ${XI(q2(h.libraryDef.svg, f.scale), h.element.color)}`
21810
21821
  ), s.push(" </g>"));
21811
21822
  }
21812
21823
  const c = t.labelMode ?? "all", d = Bt(t.labelFontSize), m = bn(d);
@@ -21820,12 +21831,12 @@ function AS(e, t = {}) {
21820
21831
  if (!b || !f.libraryDef) continue;
21821
21832
  const y = uo(f, c);
21822
21833
  if (y.length === 0) continue;
21823
- const v = f.libraryDef.label ?? mo(f.libraryDef, d), {
21834
+ const x = f.libraryDef.label ?? mo(f.libraryDef, d), {
21824
21835
  world: [$, C],
21825
21836
  textAnchor: I,
21826
21837
  dy: W
21827
21838
  } = po(
21828
- v,
21839
+ x,
21829
21840
  f.libraryDef,
21830
21841
  b,
21831
21842
  y.length,
@@ -21842,9 +21853,9 @@ function AS(e, t = {}) {
21842
21853
  if (!b) continue;
21843
21854
  const y = ho(f.path, d);
21844
21855
  if (!y) continue;
21845
- const v = f.color ? ` fill="${Ye(f.color)}"` : "";
21856
+ const x = f.color ? ` fill="${Ye(f.color)}"` : "";
21846
21857
  s.push(
21847
- ` <text x="${y.world[0]}" y="${y.world[1]}" text-anchor="${y.textAnchor}"${v}>${nt(b)}</text>`
21858
+ ` <text x="${y.world[0]}" y="${y.world[1]}" text-anchor="${y.textAnchor}"${x}>${nt(b)}</text>`
21848
21859
  );
21849
21860
  }
21850
21861
  s.push(" </g>");
@@ -21855,26 +21866,26 @@ function AS(e, t = {}) {
21855
21866
  for (const y of p)
21856
21867
  switch (Qe(y)) {
21857
21868
  case "rect":
21858
- XI(s, y, b);
21869
+ YI(s, y, b);
21859
21870
  break;
21860
21871
  case "ellipse":
21861
- UI(s, y, b);
21872
+ ZI(s, y, b);
21862
21873
  break;
21863
21874
  case "line":
21864
- YI(s, y);
21875
+ QI(s, y);
21865
21876
  break;
21866
21877
  case "table":
21867
- ZI(s, y, f);
21878
+ JI(s, y, f);
21868
21879
  break;
21869
21880
  default:
21870
- KI(s, y, b);
21881
+ UI(s, y, b);
21871
21882
  break;
21872
21883
  }
21873
21884
  }
21874
21885
  return s.push("</svg>"), s.join(`
21875
21886
  `);
21876
21887
  }
21877
- function VI(e, t) {
21888
+ function XI(e, t) {
21878
21889
  if (!t || t === "default") return e;
21879
21890
  const n = Ye(t);
21880
21891
  return e.replace(
@@ -21882,20 +21893,20 @@ function VI(e, t) {
21882
21893
  (o, r) => `${r}="${n}"`
21883
21894
  );
21884
21895
  }
21885
- function KI(e, t, n) {
21896
+ function UI(e, t, n) {
21886
21897
  if (!t.text) return;
21887
21898
  const o = t.fontSize ?? Ue, r = t.text.split(`
21888
21899
  `);
21889
21900
  e.push(` <g fill="${Ye(t.color)}" ${n}>`);
21890
21901
  for (let i = 0; i < r.length; i++) {
21891
- const a = t.at[1] + o * 0.85 + i * o * GI;
21902
+ const a = t.at[1] + o * 0.85 + i * o * KI;
21892
21903
  e.push(
21893
21904
  ` <text x="${t.at[0]}" y="${a}" font-size="${o}">${nt(r[i])}</text>`
21894
21905
  );
21895
21906
  }
21896
21907
  e.push(" </g>");
21897
21908
  }
21898
- function XI(e, t, n) {
21909
+ function YI(e, t, n) {
21899
21910
  const [o, r] = t.at, [i, a] = t.size, l = Ye(t.color);
21900
21911
  t.fill === "tint" && e.push(
21901
21912
  ` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="${l}" fill-opacity="${N2}"/>`
@@ -21903,7 +21914,7 @@ function XI(e, t, n) {
21903
21914
  ` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="none" stroke="${l}" stroke-width="${Ht(t.strokeWidth)}"${Cr(t.stroke ?? "dashed")}/>`
21904
21915
  ), ES(e, t, n);
21905
21916
  }
21906
- function UI(e, t, n) {
21917
+ function ZI(e, t, n) {
21907
21918
  const { cx: o, cy: r, rx: i, ry: a } = xr(t), l = Ye(t.color);
21908
21919
  t.fill === "tint" && e.push(
21909
21920
  ` <ellipse cx="${o}" cy="${r}" rx="${i}" ry="${a}" fill="${l}" fill-opacity="${N2}"/>`
@@ -21922,7 +21933,7 @@ function Cr(e) {
21922
21933
  const t = fo(e);
21923
21934
  return t ? ` stroke-dasharray="${t}"` : "";
21924
21935
  }
21925
- function YI(e, t) {
21936
+ function QI(e, t) {
21926
21937
  const n = yn(t);
21927
21938
  if (n.length < 2) return;
21928
21939
  const o = Ye(t.color), r = n.map(([i, a]) => `${i},${a}`).join(" ");
@@ -21934,7 +21945,7 @@ function YI(e, t) {
21934
21945
  ` <polygon points="${i.map(([a, l]) => `${a},${l}`).join(" ")}" fill="${o}"/>`
21935
21946
  );
21936
21947
  }
21937
- function ZI(e, t, n) {
21948
+ function JI(e, t, n) {
21938
21949
  var g;
21939
21950
  const [o, r] = t.at, i = Ye(t.color), [a, l] = it(t), s = Ft(t), c = Wt(t), d = t.fontSize ?? Ue;
21940
21951
  n !== "none" && e.push(
@@ -21953,16 +21964,16 @@ function ZI(e, t, n) {
21953
21964
  for (let f = 0; f < t.colWidths.length; f++) {
21954
21965
  const b = ((g = t.cells[h]) == null ? void 0 : g[f]) ?? "";
21955
21966
  if (b === "") continue;
21956
- const y = o + s[f] + cn, v = r + c[h] + t.rowHeights[h] / 2 + d * 0.35;
21967
+ const y = o + s[f] + cn, x = r + c[h] + t.rowHeights[h] / 2 + d * 0.35;
21957
21968
  p.push(
21958
- ` <text x="${y}" y="${v}" font-size="${d}">${nt(b)}</text>`
21969
+ ` <text x="${y}" y="${x}" font-size="${d}">${nt(b)}</text>`
21959
21970
  );
21960
21971
  }
21961
21972
  p.length > 0 && (e.push(
21962
21973
  ` <g fill="${i}" font-family="ui-sans-serif, system-ui, sans-serif">`
21963
21974
  ), e.push(...p), e.push(" </g>"));
21964
21975
  }
21965
- function QI(e, t) {
21976
+ function eP(e, t) {
21966
21977
  var d;
21967
21978
  let n = 1 / 0, o = 1 / 0, r = -1 / 0, i = -1 / 0;
21968
21979
  const a = (m, p) => {
@@ -21973,7 +21984,7 @@ function QI(e, t) {
21973
21984
  for (const m of e.elements.values()) {
21974
21985
  const p = e.layout.get(m.element.id), g = m.libraryDef;
21975
21986
  if (!p || !g) continue;
21976
- const h = JI(g.viewBox);
21987
+ const h = tP(g.viewBox);
21977
21988
  if (!h) {
21978
21989
  a(p.at[0], p.at[1]);
21979
21990
  continue;
@@ -21985,8 +21996,8 @@ function QI(e, t) {
21985
21996
  [h.x + h.w, h.y + h.h]
21986
21997
  ];
21987
21998
  for (const b of f) {
21988
- const [y, v] = qe(b, p);
21989
- a(y, v);
21999
+ const [y, x] = qe(b, p);
22000
+ a(y, x);
21990
22001
  }
21991
22002
  }
21992
22003
  for (const { geometry: m } of e.buses.values()) {
@@ -22005,7 +22016,7 @@ function QI(e, t) {
22005
22016
  const h = m.libraryDef.label ?? mo(m.libraryDef, s), {
22006
22017
  world: [f, b],
22007
22018
  textAnchor: y,
22008
- dy: v
22019
+ dy: x
22009
22020
  } = po(
22010
22021
  h,
22011
22022
  m.libraryDef,
@@ -22014,7 +22025,7 @@ function QI(e, t) {
22014
22025
  s,
22015
22026
  m.element.labelOffset
22016
22027
  ), $ = Yo(g, s), C = g.length * c, I = y === "middle" ? f - $ / 2 : y === "end" ? f - $ : f;
22017
- a(I, b + v - s), a(I + $, b + v + C);
22028
+ a(I, b + x - s), a(I + $, b + x + C);
22018
22029
  }
22019
22030
  for (const m of e.wireRenders.values()) {
22020
22031
  const p = (d = m.label) == null ? void 0 : d.trim();
@@ -22033,26 +22044,26 @@ function QI(e, t) {
22033
22044
  }
22034
22045
  return n === 1 / 0 && (n = 0, o = 0, r = 0, i = 0), { minX: n, minY: o, maxX: r, maxY: i };
22035
22046
  }
22036
- function JI(e) {
22047
+ function tP(e) {
22037
22048
  const t = e.trim().split(/\s+/).map(Number);
22038
22049
  return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
22039
22050
  }
22040
22051
  function nt(e) {
22041
22052
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
22042
22053
  }
22043
- async function eP(e, t = "diagram.svg", n) {
22054
+ async function nP(e, t = "diagram.svg", n) {
22044
22055
  const o = AS(e, n);
22045
22056
  NS(
22046
22057
  new Blob([o], { type: "image/svg+xml;charset=utf-8" }),
22047
22058
  t
22048
22059
  );
22049
22060
  }
22050
- async function tP(e, t = "diagram.png", n) {
22061
+ async function oP(e, t = "diagram.png", n) {
22051
22062
  const o = AS(e, n), r = (n == null ? void 0 : n.scale) ?? 2, i = URL.createObjectURL(
22052
22063
  new Blob([o], { type: "image/svg+xml;charset=utf-8" })
22053
22064
  );
22054
22065
  try {
22055
- const a = await nP(i), l = document.createElement("canvas");
22066
+ const a = await rP(i), l = document.createElement("canvas");
22056
22067
  l.width = Math.round(a.naturalWidth * r), l.height = Math.round(a.naturalHeight * r);
22057
22068
  const s = l.getContext("2d");
22058
22069
  if (!s) throw new Error("canvas 2d context unavailable");
@@ -22065,7 +22076,7 @@ async function tP(e, t = "diagram.png", n) {
22065
22076
  URL.revokeObjectURL(i);
22066
22077
  }
22067
22078
  }
22068
- function nP(e) {
22079
+ function rP(e) {
22069
22080
  return new Promise((t, n) => {
22070
22081
  const o = new Image();
22071
22082
  o.onload = () => t(o), o.onerror = () => n(new Error("failed to load SVG into image")), o.src = e;
@@ -22075,7 +22086,7 @@ function NS(e, t) {
22075
22086
  const n = URL.createObjectURL(e), o = document.createElement("a");
22076
22087
  o.href = n, o.download = t, o.click(), URL.revokeObjectURL(n);
22077
22088
  }
22078
- function wP() {
22089
+ function xP() {
22079
22090
  const e = ae(), [t, n] = ye(!1), o = ie(null);
22080
22091
  Q(() => {
22081
22092
  if (!t) return;
@@ -22097,9 +22108,9 @@ function wP() {
22097
22108
  labelFontSize: (f = l.meta) == null ? void 0 : f.labelFontSize,
22098
22109
  annotations: l.annotations
22099
22110
  };
22100
- i === "svg" ? eP(a, `${c}.svg`, d) : i === "png" ? tP(a, `${c}.png`, { ...d, scale: 2 }).catch((b) => {
22111
+ i === "svg" ? nP(a, `${c}.svg`, d) : i === "png" ? oP(a, `${c}.png`, { ...d, scale: 2 }).catch((b) => {
22101
22112
  console.error(b), alert(e("topbar.export.pngFailed", { err: b.message }));
22102
- }) : TI(a, `${c}.dxf`, d).catch((b) => {
22113
+ }) : PI(a, `${c}.dxf`, d).catch((b) => {
22103
22114
  console.error(b), alert(e("topbar.export.dxfFailed", { err: b.message }));
22104
22115
  });
22105
22116
  };
@@ -22170,56 +22181,56 @@ function wP() {
22170
22181
  ] });
22171
22182
  }
22172
22183
  export {
22173
- kI as ALLOWED_ATTRS,
22174
- xI as ALLOWED_ELEMENTS,
22184
+ _I as ALLOWED_ATTRS,
22185
+ SI as ALLOWED_ELEMENTS,
22175
22186
  _2 as COLOR_ORDER,
22176
22187
  e6 as CUSTOM_KIND_PREFIX,
22177
- wP as ExportMenu,
22178
- yP as FileMenu,
22188
+ xP as ExportMenu,
22189
+ vP as FileMenu,
22179
22190
  Xo as LIBRARY,
22180
22191
  br as NAMED_COLORS,
22181
- pP as OneLineEditor,
22182
- hP as OneLineViewer,
22192
+ fP as OneLineEditor,
22193
+ gP as OneLineViewer,
22183
22194
  Qe as annotationKind,
22184
- oI as applyTheme,
22185
- cP as bindingsOf,
22186
- NI as buildExportDxf,
22195
+ iI as applyTheme,
22196
+ uP as bindingsOf,
22197
+ II as buildExportDxf,
22187
22198
  AS as buildExportSvg,
22188
22199
  wt as compile,
22189
22200
  _6 as createEditorStore,
22190
- fP as createStaticTagSource,
22191
- TI as downloadDxf,
22192
- tP as downloadPng,
22193
- eP as downloadSvg,
22201
+ bP as createStaticTagSource,
22202
+ PI as downloadDxf,
22203
+ oP as downloadPng,
22204
+ nP as downloadSvg,
22194
22205
  Jt as dxfColor,
22195
22206
  o6 as emptyInternalModel,
22196
22207
  Ye as exportInk,
22197
22208
  oS as fitToContent,
22198
22209
  rS as fitToContentSoon,
22199
- mP as getInitialTheme,
22200
- lP as getLibraryEntry,
22210
+ hP as getInitialTheme,
22211
+ dP as getLibraryEntry,
22201
22212
  He as inkClass,
22202
22213
  fr as isCustomKind,
22203
- sP as isTextAnnotation,
22214
+ cP as isTextAnnotation,
22204
22215
  t6 as mergeCustomKinds,
22205
22216
  Nn as newAnnotationId,
22206
22217
  pi as newBusId,
22207
22218
  Xn as newElementId,
22208
22219
  hi as newJunctionId,
22209
22220
  ti as orientationVec,
22210
- uP as removeBindings,
22221
+ pP as removeBindings,
22211
22222
  v6 as resolveBindings,
22212
22223
  r6 as resolvePlacement,
22213
- gP as sanitizeSymbolSvg,
22224
+ yP as sanitizeSymbolSvg,
22214
22225
  gn as soleSelectedAnnotation,
22215
22226
  Bo as toTagValue,
22216
22227
  Hn as transformOrientation,
22217
22228
  qe as transformPoint,
22218
- dP as upsertBinding,
22229
+ mP as upsertBinding,
22219
22230
  w as useEditorStore,
22220
22231
  xS as useHostActions,
22221
22232
  ao as useLocale,
22222
- bP as validateCustomKind,
22233
+ wP as validateCustomKind,
22223
22234
  It as wireIdFromEnds
22224
22235
  };
22225
22236
  //# sourceMappingURL=sldeditor.js.map