sldeditor 0.20.0 → 0.20.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.cjs +26 -10
- package/dist/sldeditor.cjs.map +1 -1
- package/dist/sldeditor.js +370 -326
- package/dist/sldeditor.js.map +1 -1
- package/package.json +2 -1
package/dist/sldeditor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var n2 = Object.defineProperty;
|
|
2
2
|
var o2 = (e, t, n) => t in e ? n2(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { jsxs as z, jsx as m, Fragment as
|
|
3
|
+
var He = (e, t, n) => o2(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { jsxs as z, jsx as m, Fragment as Ye } from "react/jsx-runtime";
|
|
5
5
|
import * as Ee from "react";
|
|
6
6
|
import an, { forwardRef as Ri, createElement as bo, useState as we, useRef as pe, useCallback as _n, useMemo as ji, useLayoutEffect as Dn, useEffect as ie, createContext as Hi, useContext as Fi, useId as r2, cloneElement as i2, Fragment as a2 } from "react";
|
|
7
7
|
import { createPortal as Wi } from "react-dom";
|
|
@@ -805,7 +805,7 @@ function F2(e, ...t) {
|
|
|
805
805
|
const ye = (e) => {
|
|
806
806
|
const t = (n) => n[e] || [];
|
|
807
807
|
return t.isThemeGetter = !0, t;
|
|
808
|
-
}, aa = /^\[(?:([a-z-]+):)?(.+)\]$/i, W2 = /^\d+\/\d+$/, q2 = /* @__PURE__ */ new Set(["px", "full", "screen"]), G2 = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, V2 = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, K2 = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, U2 = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, X2 = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,
|
|
808
|
+
}, aa = /^\[(?:([a-z-]+):)?(.+)\]$/i, W2 = /^\d+\/\d+$/, q2 = /* @__PURE__ */ new Set(["px", "full", "screen"]), G2 = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, V2 = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, K2 = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, U2 = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, X2 = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, Ge = (e) => vt(e) || q2.has(e) || W2.test(e), ot = (e) => Ct(e, "length", oS), vt = (e) => !!e && !Number.isNaN(Number(e)), to = (e) => Ct(e, "number", vt), zt = (e) => !!e && Number.isInteger(Number(e)), Y2 = (e) => e.endsWith("%") && vt(e.slice(0, -1)), oe = (e) => aa.test(e), rt = (e) => G2.test(e), Z2 = /* @__PURE__ */ new Set(["length", "size", "percentage"]), Q2 = (e) => Ct(e, Z2, sa), J2 = (e) => Ct(e, "position", sa), eS = /* @__PURE__ */ new Set(["image", "url"]), tS = (e) => Ct(e, eS, iS), nS = (e) => Ct(e, "", rS), Mt = () => !0, Ct = (e, t, n) => {
|
|
809
809
|
const o = aa.exec(e);
|
|
810
810
|
return o ? o[1] ? typeof t == "string" ? o[1] === t : t.has(o[1]) : n(o[2]) : !1;
|
|
811
811
|
}, oS = (e) => (
|
|
@@ -814,17 +814,17 @@ const ye = (e) => {
|
|
|
814
814
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
815
815
|
V2.test(e) && !K2.test(e)
|
|
816
816
|
), sa = () => !1, rS = (e) => U2.test(e), iS = (e) => X2.test(e), aS = () => {
|
|
817
|
-
const e = ye("colors"), t = ye("spacing"), n = ye("blur"), o = ye("brightness"), r = ye("borderColor"), i = ye("borderRadius"), a = ye("borderSpacing"), s = ye("borderWidth"), l = ye("contrast"), c = ye("grayscale"), d = ye("hueRotate"), u = ye("invert"), h = ye("gap"), g = ye("gradientColorStops"), p = ye("gradientColorStopPositions"), f = ye("inset"), b = ye("margin"), w = ye("opacity"), x = ye("padding"), I = ye("saturate"), P = ye("scale"), j = ye("sepia"), V = ye("skew"), S = ye("space"), H = ye("translate"), F = () => ["auto", "contain", "none"], Z = () => ["auto", "hidden", "clip", "visible", "scroll"], L = () => ["auto", oe, t], W = () => [oe, t], ae = () => ["",
|
|
817
|
+
const e = ye("colors"), t = ye("spacing"), n = ye("blur"), o = ye("brightness"), r = ye("borderColor"), i = ye("borderRadius"), a = ye("borderSpacing"), s = ye("borderWidth"), l = ye("contrast"), c = ye("grayscale"), d = ye("hueRotate"), u = ye("invert"), h = ye("gap"), g = ye("gradientColorStops"), p = ye("gradientColorStopPositions"), f = ye("inset"), b = ye("margin"), w = ye("opacity"), x = ye("padding"), I = ye("saturate"), P = ye("scale"), j = ye("sepia"), V = ye("skew"), S = ye("space"), H = ye("translate"), F = () => ["auto", "contain", "none"], Z = () => ["auto", "hidden", "clip", "visible", "scroll"], L = () => ["auto", oe, t], W = () => [oe, t], ae = () => ["", Ge, ot], de = () => ["auto", vt, oe], he = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], J = () => ["solid", "dashed", "dotted", "double", "none"], se = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], ge = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], ke = () => ["", "0", oe], Ne = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Oe = () => [vt, oe];
|
|
818
818
|
return {
|
|
819
819
|
cacheSize: 500,
|
|
820
820
|
separator: ":",
|
|
821
821
|
theme: {
|
|
822
822
|
colors: [Mt],
|
|
823
|
-
spacing: [
|
|
824
|
-
blur: ["none", "",
|
|
823
|
+
spacing: [Ge, ot],
|
|
824
|
+
blur: ["none", "", rt, oe],
|
|
825
825
|
brightness: Oe(),
|
|
826
826
|
borderColor: [e],
|
|
827
|
-
borderRadius: ["none", "", "full",
|
|
827
|
+
borderRadius: ["none", "", "full", rt, oe],
|
|
828
828
|
borderSpacing: W(),
|
|
829
829
|
borderWidth: ae(),
|
|
830
830
|
contrast: Oe(),
|
|
@@ -833,7 +833,7 @@ const ye = (e) => {
|
|
|
833
833
|
invert: ke(),
|
|
834
834
|
gap: W(),
|
|
835
835
|
gradientColorStops: [e],
|
|
836
|
-
gradientColorStopPositions: [Y2,
|
|
836
|
+
gradientColorStopPositions: [Y2, ot],
|
|
837
837
|
inset: L(),
|
|
838
838
|
margin: L(),
|
|
839
839
|
opacity: Oe(),
|
|
@@ -864,7 +864,7 @@ const ye = (e) => {
|
|
|
864
864
|
* @see https://tailwindcss.com/docs/columns
|
|
865
865
|
*/
|
|
866
866
|
columns: [{
|
|
867
|
-
columns: [
|
|
867
|
+
columns: [rt]
|
|
868
868
|
}],
|
|
869
869
|
/**
|
|
870
870
|
* Break After
|
|
@@ -1448,8 +1448,8 @@ const ye = (e) => {
|
|
|
1448
1448
|
*/
|
|
1449
1449
|
"max-w": [{
|
|
1450
1450
|
"max-w": [oe, t, "none", "full", "min", "max", "fit", "prose", {
|
|
1451
|
-
screen: [
|
|
1452
|
-
},
|
|
1451
|
+
screen: [rt]
|
|
1452
|
+
}, rt]
|
|
1453
1453
|
}],
|
|
1454
1454
|
/**
|
|
1455
1455
|
* Height
|
|
@@ -1485,7 +1485,7 @@ const ye = (e) => {
|
|
|
1485
1485
|
* @see https://tailwindcss.com/docs/font-size
|
|
1486
1486
|
*/
|
|
1487
1487
|
"font-size": [{
|
|
1488
|
-
text: ["base",
|
|
1488
|
+
text: ["base", rt, ot]
|
|
1489
1489
|
}],
|
|
1490
1490
|
/**
|
|
1491
1491
|
* Font Smoothing
|
|
@@ -1553,14 +1553,14 @@ const ye = (e) => {
|
|
|
1553
1553
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
1554
1554
|
*/
|
|
1555
1555
|
"line-clamp": [{
|
|
1556
|
-
"line-clamp": ["none",
|
|
1556
|
+
"line-clamp": ["none", vt, to]
|
|
1557
1557
|
}],
|
|
1558
1558
|
/**
|
|
1559
1559
|
* Line Height
|
|
1560
1560
|
* @see https://tailwindcss.com/docs/line-height
|
|
1561
1561
|
*/
|
|
1562
1562
|
leading: [{
|
|
1563
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose",
|
|
1563
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", Ge, oe]
|
|
1564
1564
|
}],
|
|
1565
1565
|
/**
|
|
1566
1566
|
* List Style Image
|
|
@@ -1636,14 +1636,14 @@ const ye = (e) => {
|
|
|
1636
1636
|
* @see https://tailwindcss.com/docs/text-decoration-thickness
|
|
1637
1637
|
*/
|
|
1638
1638
|
"text-decoration-thickness": [{
|
|
1639
|
-
decoration: ["auto", "from-font",
|
|
1639
|
+
decoration: ["auto", "from-font", Ge, ot]
|
|
1640
1640
|
}],
|
|
1641
1641
|
/**
|
|
1642
1642
|
* Text Underline Offset
|
|
1643
1643
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1644
1644
|
*/
|
|
1645
1645
|
"underline-offset": [{
|
|
1646
|
-
"underline-offset": ["auto",
|
|
1646
|
+
"underline-offset": ["auto", Ge, oe]
|
|
1647
1647
|
}],
|
|
1648
1648
|
/**
|
|
1649
1649
|
* Text Decoration Color
|
|
@@ -2125,14 +2125,14 @@ const ye = (e) => {
|
|
|
2125
2125
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
2126
2126
|
*/
|
|
2127
2127
|
"outline-offset": [{
|
|
2128
|
-
"outline-offset": [
|
|
2128
|
+
"outline-offset": [Ge, oe]
|
|
2129
2129
|
}],
|
|
2130
2130
|
/**
|
|
2131
2131
|
* Outline Width
|
|
2132
2132
|
* @see https://tailwindcss.com/docs/outline-width
|
|
2133
2133
|
*/
|
|
2134
2134
|
"outline-w": [{
|
|
2135
|
-
outline: [
|
|
2135
|
+
outline: [Ge, ot]
|
|
2136
2136
|
}],
|
|
2137
2137
|
/**
|
|
2138
2138
|
* Outline Color
|
|
@@ -2172,7 +2172,7 @@ const ye = (e) => {
|
|
|
2172
2172
|
* @see https://tailwindcss.com/docs/ring-offset-width
|
|
2173
2173
|
*/
|
|
2174
2174
|
"ring-offset-w": [{
|
|
2175
|
-
"ring-offset": [
|
|
2175
|
+
"ring-offset": [Ge, ot]
|
|
2176
2176
|
}],
|
|
2177
2177
|
/**
|
|
2178
2178
|
* Ring Offset Color
|
|
@@ -2187,7 +2187,7 @@ const ye = (e) => {
|
|
|
2187
2187
|
* @see https://tailwindcss.com/docs/box-shadow
|
|
2188
2188
|
*/
|
|
2189
2189
|
shadow: [{
|
|
2190
|
-
shadow: ["", "inner", "none",
|
|
2190
|
+
shadow: ["", "inner", "none", rt, nS]
|
|
2191
2191
|
}],
|
|
2192
2192
|
/**
|
|
2193
2193
|
* Box Shadow Color
|
|
@@ -2252,7 +2252,7 @@ const ye = (e) => {
|
|
|
2252
2252
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
2253
2253
|
*/
|
|
2254
2254
|
"drop-shadow": [{
|
|
2255
|
-
"drop-shadow": ["", "none",
|
|
2255
|
+
"drop-shadow": ["", "none", rt, oe]
|
|
2256
2256
|
}],
|
|
2257
2257
|
/**
|
|
2258
2258
|
* Grayscale
|
|
@@ -2767,7 +2767,7 @@ const ye = (e) => {
|
|
|
2767
2767
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2768
2768
|
*/
|
|
2769
2769
|
"stroke-w": [{
|
|
2770
|
-
stroke: [
|
|
2770
|
+
stroke: [Ge, ot, to]
|
|
2771
2771
|
}],
|
|
2772
2772
|
/**
|
|
2773
2773
|
* Stroke
|
|
@@ -7468,27 +7468,27 @@ const xo = (e) => (t) => {
|
|
|
7468
7468
|
c.delete(b);
|
|
7469
7469
|
})
|
|
7470
7470
|
}, i.skipHydration || f(), p || g;
|
|
7471
|
-
}, WS = FS,
|
|
7471
|
+
}, WS = FS, Ve = 0.5;
|
|
7472
7472
|
function pa(e) {
|
|
7473
7473
|
if (e.length < 2) return e.map((r) => [r[0], r[1]]);
|
|
7474
7474
|
const t = [[e[0][0], e[0][1]]];
|
|
7475
7475
|
for (let r = 1; r < e.length; r++) {
|
|
7476
7476
|
const i = t[t.length - 1];
|
|
7477
|
-
Math.abs(i[0] - e[r][0]) <
|
|
7477
|
+
Math.abs(i[0] - e[r][0]) < Ve && Math.abs(i[1] - e[r][1]) < Ve || t.push([e[r][0], e[r][1]]);
|
|
7478
7478
|
}
|
|
7479
7479
|
if (t.length < 2) return t;
|
|
7480
7480
|
const n = [t[0]];
|
|
7481
7481
|
for (let r = 1; r < t.length; r++) {
|
|
7482
7482
|
const i = n[n.length - 1], a = t[r], s = Math.abs(i[0] - a[0]), l = Math.abs(i[1] - a[1]);
|
|
7483
|
-
if (s >
|
|
7484
|
-
const d = (n.length >= 2 ? Math.abs(n[n.length - 2][1] - i[1]) <
|
|
7483
|
+
if (s > Ve && l > Ve) {
|
|
7484
|
+
const d = (n.length >= 2 ? Math.abs(n[n.length - 2][1] - i[1]) < Ve ? "h" : "v" : null) === "h" ? [a[0], i[1]] : [i[0], a[1]];
|
|
7485
7485
|
n.push(d);
|
|
7486
7486
|
}
|
|
7487
7487
|
n.push(a);
|
|
7488
7488
|
}
|
|
7489
7489
|
const o = [n[0]];
|
|
7490
7490
|
for (let r = 1; r < n.length - 1; r++) {
|
|
7491
|
-
const i = o[o.length - 1], a = n[r], s = n[r + 1], l = Math.abs(i[0] - a[0]) <
|
|
7491
|
+
const i = o[o.length - 1], a = n[r], s = n[r + 1], l = Math.abs(i[0] - a[0]) < Ve && Math.abs(a[0] - s[0]) < Ve, c = Math.abs(i[1] - a[1]) < Ve && Math.abs(a[1] - s[1]) < Ve;
|
|
7492
7492
|
l || c || o.push(a);
|
|
7493
7493
|
}
|
|
7494
7494
|
return o.push(n[n.length - 1]), o;
|
|
@@ -7565,8 +7565,8 @@ function kr(e) {
|
|
|
7565
7565
|
}
|
|
7566
7566
|
class ha {
|
|
7567
7567
|
constructor() {
|
|
7568
|
-
|
|
7569
|
-
|
|
7568
|
+
He(this, "parent", /* @__PURE__ */ new Map());
|
|
7569
|
+
He(this, "rank", /* @__PURE__ */ new Map());
|
|
7570
7570
|
}
|
|
7571
7571
|
add(t) {
|
|
7572
7572
|
this.parent.has(t) || (this.parent.set(t, t), this.rank.set(t, 0));
|
|
@@ -7606,7 +7606,7 @@ function ln(e, t) {
|
|
|
7606
7606
|
const n = Sr.indexOf(e), r = ((Sr.indexOf(t) - n) % 4 + 4) % 4;
|
|
7607
7607
|
return [0, 90, 180, 270][r];
|
|
7608
7608
|
}
|
|
7609
|
-
const no = 320, cn = 220, Dt = 260, oo = 720, Ot = 30, Cr = 30,
|
|
7609
|
+
const no = 320, cn = 220, Dt = 260, oo = 720, Ot = 30, Cr = 30, it = 80, $r = 10, US = 60, XS = 520, YS = 80, ZS = 80, Ar = 8, Er = /* @__PURE__ */ new Set(["source", "renewable"]);
|
|
7610
7610
|
function QS(e) {
|
|
7611
7611
|
var ar, sr, lr, cr, dr, ur;
|
|
7612
7612
|
const { elements: t, buses: n, junctions: o, wires: r, library: i, userLayout: a, userBusLayout: s } = e, l = new Map(a), c = new Map(s), d = /* @__PURE__ */ new Map(), u = new Set(a.keys()), h = new Set(s.keys()), g = /* @__PURE__ */ new Map();
|
|
@@ -7727,10 +7727,10 @@ function QS(e) {
|
|
|
7727
7727
|
let Pe = 0;
|
|
7728
7728
|
const rn = K.get(Y) ?? null;
|
|
7729
7729
|
if (rn) {
|
|
7730
|
-
const
|
|
7731
|
-
|
|
7730
|
+
const It = R(Y, rn);
|
|
7731
|
+
It && (Pe = ln(It.orientation, "n"));
|
|
7732
7732
|
} else {
|
|
7733
|
-
const
|
|
7733
|
+
const It = (ee.get(Y) ?? [])[0], mr = It ? R(Y, It) : null;
|
|
7734
7734
|
mr && (Pe = ln(mr.orientation, "s"));
|
|
7735
7735
|
}
|
|
7736
7736
|
l.set(Y, { at: [ne, Te], rot: Pe, mirror: !1 }), u.add(Y);
|
|
@@ -8005,7 +8005,7 @@ function QS(e) {
|
|
|
8005
8005
|
}
|
|
8006
8006
|
const Ko = 30, Uo = (v) => {
|
|
8007
8007
|
const k = f(v);
|
|
8008
|
-
return Math.max((k == null ? void 0 : k.width) ??
|
|
8008
|
+
return Math.max((k == null ? void 0 : k.width) ?? it, it);
|
|
8009
8009
|
}, Vk = 2, Xo = (v, k, C, A = 0) => {
|
|
8010
8010
|
const $ = f(k);
|
|
8011
8011
|
let _ = Uo(k);
|
|
@@ -8043,24 +8043,24 @@ function QS(e) {
|
|
|
8043
8043
|
C.delete(k), _ = Math.max(_, N);
|
|
8044
8044
|
}
|
|
8045
8045
|
return _;
|
|
8046
|
-
},
|
|
8046
|
+
}, Nt = 320, ft = /* @__PURE__ */ new Map(), Yo = (v, k) => {
|
|
8047
8047
|
if (!Z.has(v)) return !1;
|
|
8048
8048
|
const C = F.find((N) => N.elementId === v), A = C == null ? void 0 : C.attachments.find((N) => N.busId !== k);
|
|
8049
8049
|
if (!A) return !1;
|
|
8050
8050
|
const $ = se.get(k) ?? 0;
|
|
8051
8051
|
return (se.get(A.busId) ?? 0) < $;
|
|
8052
|
-
},
|
|
8052
|
+
}, Tt = (v, k, C) => {
|
|
8053
8053
|
const A = Xn.get(v);
|
|
8054
8054
|
if (A) {
|
|
8055
|
-
const _ =
|
|
8055
|
+
const _ = ft.get(A.lowerBusId);
|
|
8056
8056
|
if (_ !== void 0)
|
|
8057
|
-
return Math.max(k, _ +
|
|
8057
|
+
return Math.max(k, _ + it);
|
|
8058
8058
|
}
|
|
8059
8059
|
let $ = 0;
|
|
8060
|
-
return C && ($ = Xo(C, v, /* @__PURE__ */ new Set())), Math.max(k,
|
|
8060
|
+
return C && ($ = Xo(C, v, /* @__PURE__ */ new Set())), Math.max(k, it, $);
|
|
8061
8061
|
}, Zo = (v, k) => {
|
|
8062
|
-
if (
|
|
8063
|
-
if (k.has(v)) return
|
|
8062
|
+
if (ft.has(v)) return ft.get(v);
|
|
8063
|
+
if (k.has(v)) return Nt;
|
|
8064
8064
|
k.add(v);
|
|
8065
8065
|
const C = S.get(v) ?? [];
|
|
8066
8066
|
let A = 0, $ = 0;
|
|
@@ -8076,7 +8076,7 @@ function QS(e) {
|
|
|
8076
8076
|
if (!E) continue;
|
|
8077
8077
|
const O = Xn.get(M);
|
|
8078
8078
|
O && Zo(O.lowerBusId, k);
|
|
8079
|
-
const B =
|
|
8079
|
+
const B = Tt(
|
|
8080
8080
|
M,
|
|
8081
8081
|
T.width,
|
|
8082
8082
|
`${M}.${D}`
|
|
@@ -8084,13 +8084,13 @@ function QS(e) {
|
|
|
8084
8084
|
E.y > 0 ? A += B : $ += B;
|
|
8085
8085
|
}
|
|
8086
8086
|
const _ = Math.max(
|
|
8087
|
-
|
|
8088
|
-
Math.max(A, $) +
|
|
8087
|
+
Nt,
|
|
8088
|
+
Math.max(A, $) + it
|
|
8089
8089
|
);
|
|
8090
|
-
return
|
|
8090
|
+
return ft.set(v, _), k.delete(v), _;
|
|
8091
8091
|
};
|
|
8092
8092
|
for (const v of n) Zo(v.id, /* @__PURE__ */ new Set());
|
|
8093
|
-
const
|
|
8093
|
+
const nt = /* @__PURE__ */ new Map(), Kk = (v, k, C) => {
|
|
8094
8094
|
const A = f(k);
|
|
8095
8095
|
if (!A) return;
|
|
8096
8096
|
const $ = `${k}.${C}`, _ = A.terminals.filter((M) => M.id !== C).map((M) => `${k}.${M.id}`);
|
|
@@ -8146,9 +8146,9 @@ function QS(e) {
|
|
|
8146
8146
|
for (const E of A)
|
|
8147
8147
|
E.localTerm.y > 0 ? $.push(E) : _.push(E);
|
|
8148
8148
|
const N = (E) => E.reduce(
|
|
8149
|
-
(O, B) => O +
|
|
8149
|
+
(O, B) => O + Tt(B.elId, B.lib.width, B.busFacingRef),
|
|
8150
8150
|
0
|
|
8151
|
-
), R = Math.max(N($), N(_)) +
|
|
8151
|
+
), R = Math.max(N($), N(_)) + it, M = Math.max(C.span, R);
|
|
8152
8152
|
M !== C.span && !h.has(v) && c.set(v, { ...C, span: M });
|
|
8153
8153
|
const D = c.get(v), T = (E, O) => {
|
|
8154
8154
|
if (E.length === 0) return;
|
|
@@ -8160,17 +8160,17 @@ function QS(e) {
|
|
|
8160
8160
|
E.sort((X, Q) => {
|
|
8161
8161
|
const fe = B.get(X.elId) ?? D.at[0], Se = B.get(Q.elId) ?? D.at[0];
|
|
8162
8162
|
if (fe !== Se) return fe - Se;
|
|
8163
|
-
const Y =
|
|
8164
|
-
return
|
|
8163
|
+
const Y = Tt(X.elId, X.lib.width, X.busFacingRef);
|
|
8164
|
+
return Tt(Q.elId, Q.lib.width, Q.busFacingRef) - Y;
|
|
8165
8165
|
});
|
|
8166
8166
|
const q = E.map(
|
|
8167
|
-
(X) =>
|
|
8167
|
+
(X) => Tt(X.elId, X.lib.width, X.busFacingRef)
|
|
8168
8168
|
), K = q.reduce((X, Q) => X + Q, 0), G = Math.max(M, K), ee = (G - K) / (E.length + 1);
|
|
8169
8169
|
let te = D.at[0] - G / 2 + ee;
|
|
8170
8170
|
const U = D.at[1] + O * Cr;
|
|
8171
8171
|
for (let X = 0; X < E.length; X++) {
|
|
8172
8172
|
const Q = E[X], fe = q[X], Se = te + fe / 2;
|
|
8173
|
-
Q.isLinker ?
|
|
8173
|
+
Q.isLinker ? nt.has(Q.elId) || nt.set(Q.elId, Se) : l.set(Q.elId, {
|
|
8174
8174
|
at: [xe(Se - Q.localTerm.x), xe(U - Q.localTerm.y)],
|
|
8175
8175
|
rot: 0,
|
|
8176
8176
|
mirror: !1
|
|
@@ -8198,10 +8198,10 @@ function QS(e) {
|
|
|
8198
8198
|
const U = Ne(v, te.busId, te.pin);
|
|
8199
8199
|
q = Math.max(q, U.extent);
|
|
8200
8200
|
const X = U.head ? l.get(U.head) : void 0;
|
|
8201
|
-
X ? B.push(X.at[0]) :
|
|
8201
|
+
X ? B.push(X.at[0]) : nt.has(v.elementId) ? B.push(nt.get(v.elementId)) : B.push(c.get(te.busId).at[0]);
|
|
8202
8202
|
}
|
|
8203
8203
|
let K;
|
|
8204
|
-
B.length > 0 ? K = B.reduce((te, U) => te + U, 0) / B.length :
|
|
8204
|
+
B.length > 0 ? K = B.reduce((te, U) => te + U, 0) / B.length : nt.has(v.elementId) ? K = nt.get(v.elementId) : K = _.at[0];
|
|
8205
8205
|
const G = _.at[1] + q, ee = T === 0 ? [xe(K - M.x), xe(G - M.y)] : [xe(K + M.x), xe(G + M.y)];
|
|
8206
8206
|
if (l.set(v.elementId, { at: ee, rot: T, mirror: !1 }), O.length > 1) {
|
|
8207
8207
|
const te = l.get(v.elementId), U = je(
|
|
@@ -8319,15 +8319,15 @@ function QS(e) {
|
|
|
8319
8319
|
)) == null ? void 0 : ur.pin;
|
|
8320
8320
|
if (!O) continue;
|
|
8321
8321
|
const B = Ne(E, T, O);
|
|
8322
|
-
B.head && l.has(B.head) ? D.push(l.get(B.head).at[0]) :
|
|
8322
|
+
B.head && l.has(B.head) ? D.push(l.get(B.head).at[0]) : nt.has(E.elementId) ? D.push(nt.get(E.elementId)) : D.push(c.get(T).at[0]);
|
|
8323
8323
|
}
|
|
8324
8324
|
D.length > 0 && (N = D.reduce((T, E) => T + E, 0) / D.length);
|
|
8325
8325
|
}
|
|
8326
8326
|
if (N === void 0) {
|
|
8327
|
-
const M =
|
|
8327
|
+
const M = ft.get(_) ?? oo;
|
|
8328
8328
|
N = $ + M / 2, $ += M + Qo;
|
|
8329
8329
|
}
|
|
8330
|
-
const R =
|
|
8330
|
+
const R = ft.get(_) ?? oo;
|
|
8331
8331
|
c.set(_, {
|
|
8332
8332
|
at: [xe(N), xe(A)],
|
|
8333
8333
|
rot: 0,
|
|
@@ -8396,7 +8396,7 @@ function QS(e) {
|
|
|
8396
8396
|
at: [xe(A - M[0]), xe(cn - M[1])],
|
|
8397
8397
|
rot: 0,
|
|
8398
8398
|
mirror: !1
|
|
8399
|
-
}), A += Math.max(oo, $.length *
|
|
8399
|
+
}), A += Math.max(oo, $.length * it) + Qo;
|
|
8400
8400
|
}
|
|
8401
8401
|
}
|
|
8402
8402
|
const Qk = (v) => {
|
|
@@ -8460,7 +8460,7 @@ function QS(e) {
|
|
|
8460
8460
|
), q = kr(B), K = [-q[1], q[0]];
|
|
8461
8461
|
A.sort((U, X) => U.elId.localeCompare(X.elId));
|
|
8462
8462
|
const G = A.map(
|
|
8463
|
-
(U) => Math.max(U.lib.width,
|
|
8463
|
+
(U) => Math.max(U.lib.width, it)
|
|
8464
8464
|
);
|
|
8465
8465
|
let te = -G.reduce((U, X) => U + X, 0) / 2;
|
|
8466
8466
|
for (let U = 0; U < A.length; U++) {
|
|
@@ -8483,7 +8483,7 @@ function QS(e) {
|
|
|
8483
8483
|
}
|
|
8484
8484
|
}
|
|
8485
8485
|
}
|
|
8486
|
-
const
|
|
8486
|
+
const Pt = (v) => {
|
|
8487
8487
|
const k = l.get(v), C = f(v);
|
|
8488
8488
|
if (!k || !C) return null;
|
|
8489
8489
|
const A = C.viewBox.split(/\s+/).map(Number);
|
|
@@ -8570,7 +8570,7 @@ function QS(e) {
|
|
|
8570
8570
|
$ = !1;
|
|
8571
8571
|
for (let _ = 0; _ < v.length && !$; _++)
|
|
8572
8572
|
for (let N = _ + 1; N < v.length; N++) {
|
|
8573
|
-
const R = v[_], M = v[N], D =
|
|
8573
|
+
const R = v[_], M = v[N], D = Pt(R), T = Pt(M), E = Qn(R), O = Qn(M);
|
|
8574
8574
|
if (!D || !T || !E || !O) continue;
|
|
8575
8575
|
const B = Math.min(D.max, T.max) - Math.max(D.min, T.min), q = Math.min(E.max, O.max) - Math.max(E.min, O.min);
|
|
8576
8576
|
if (B <= 0 || q <= 0) continue;
|
|
@@ -8606,7 +8606,7 @@ function QS(e) {
|
|
|
8606
8606
|
if (tr(A, C)) {
|
|
8607
8607
|
let _ = 1 / 0, N = -1 / 0;
|
|
8608
8608
|
for (const R of A) {
|
|
8609
|
-
const M =
|
|
8609
|
+
const M = Pt(R);
|
|
8610
8610
|
M && (_ = Math.min(_, M.min), N = Math.max(N, M.max));
|
|
8611
8611
|
}
|
|
8612
8612
|
if (Number.isFinite(_)) {
|
|
@@ -8628,7 +8628,7 @@ function QS(e) {
|
|
|
8628
8628
|
}
|
|
8629
8629
|
}
|
|
8630
8630
|
const nr = () => {
|
|
8631
|
-
const k = t.map((A) => A.id).filter((A) => l.has(A)).map((A) => ({ x:
|
|
8631
|
+
const k = t.map((A) => A.id).filter((A) => l.has(A)).map((A) => ({ x: Pt(A), y: Qn(A) })).filter((A) => A.x && A.y);
|
|
8632
8632
|
let C = 0;
|
|
8633
8633
|
for (let A = 0; A < k.length; A++)
|
|
8634
8634
|
for (let $ = A + 1; $ < k.length; $++) {
|
|
@@ -8680,10 +8680,10 @@ function QS(e) {
|
|
|
8680
8680
|
let O = 1 / 0, B = -1 / 0;
|
|
8681
8681
|
for (const [q, K] of ir) {
|
|
8682
8682
|
if (K !== D) continue;
|
|
8683
|
-
const G =
|
|
8683
|
+
const G = Pt(q);
|
|
8684
8684
|
G && (E.push(q), O = Math.min(O, G.min), B = Math.max(B, G.max));
|
|
8685
8685
|
}
|
|
8686
|
-
Number.isFinite(O) || (O = T.at[0] -
|
|
8686
|
+
Number.isFinite(O) || (O = T.at[0] - Nt / 2, B = T.at[0] + Nt / 2), C.push({ busId: D, min: O, max: B, members: E }), A += B - O;
|
|
8687
8687
|
}
|
|
8688
8688
|
if (C.some((D) => D.members.some((T) => u.has(T))))
|
|
8689
8689
|
continue;
|
|
@@ -8708,7 +8708,7 @@ function QS(e) {
|
|
|
8708
8708
|
M = D.max + Jn;
|
|
8709
8709
|
}
|
|
8710
8710
|
for (const D of C) {
|
|
8711
|
-
const T = c.get(D.busId), E = Math.max(
|
|
8711
|
+
const T = c.get(D.busId), E = Math.max(Nt, D.max - D.min);
|
|
8712
8712
|
E < T.span && c.set(D.busId, { ...T, span: E });
|
|
8713
8713
|
}
|
|
8714
8714
|
}
|
|
@@ -11167,7 +11167,7 @@ unifilar` }, I$ = {
|
|
|
11167
11167
|
"./zener-diode.json": xA
|
|
11168
11168
|
}), Zx = Object.values(kA).map(
|
|
11169
11169
|
(e) => e.default
|
|
11170
|
-
),
|
|
11170
|
+
), lt = Object.fromEntries(
|
|
11171
11171
|
Zx.map((e) => [e.id, e])
|
|
11172
11172
|
), Ir = [
|
|
11173
11173
|
"busbar",
|
|
@@ -11192,10 +11192,10 @@ unifilar` }, I$ = {
|
|
|
11192
11192
|
(e[t = n.category] ?? (e[t] = [])).push(n);
|
|
11193
11193
|
return e;
|
|
11194
11194
|
})(), zr = new Map(
|
|
11195
|
-
Object.entries(
|
|
11195
|
+
Object.entries(lt)
|
|
11196
11196
|
);
|
|
11197
11197
|
function _A(e) {
|
|
11198
|
-
return
|
|
11198
|
+
return lt[e];
|
|
11199
11199
|
}
|
|
11200
11200
|
function CA(e) {
|
|
11201
11201
|
const n = [...e].sort().join("|");
|
|
@@ -11205,7 +11205,7 @@ function CA(e) {
|
|
|
11205
11205
|
return `n_${(o >>> 0).toString(36)}`;
|
|
11206
11206
|
}
|
|
11207
11207
|
const $A = 320;
|
|
11208
|
-
function
|
|
11208
|
+
function ut(e) {
|
|
11209
11209
|
var x, I, P, j, V;
|
|
11210
11210
|
const t = qS(), n = /* @__PURE__ */ new Map();
|
|
11211
11211
|
e.elements.forEach((S, H) => {
|
|
@@ -11509,7 +11509,7 @@ function dn(e) {
|
|
|
11509
11509
|
for (; t.has(`a${n}`); ) n++;
|
|
11510
11510
|
return `a${n}`;
|
|
11511
11511
|
}
|
|
11512
|
-
function
|
|
11512
|
+
function wt(e, t) {
|
|
11513
11513
|
const n = [e, t].sort(), o = `${n[0]}|${n[1]}`;
|
|
11514
11514
|
let r = 2166136261;
|
|
11515
11515
|
for (let i = 0; i < o.length; i++)
|
|
@@ -11558,7 +11558,7 @@ const y = Ln()(
|
|
|
11558
11558
|
WS(
|
|
11559
11559
|
(e, t) => ({
|
|
11560
11560
|
diagram: Br,
|
|
11561
|
-
internal:
|
|
11561
|
+
internal: ut(Br),
|
|
11562
11562
|
fileSession: null,
|
|
11563
11563
|
activeTool: TA(),
|
|
11564
11564
|
placeKind: null,
|
|
@@ -11584,7 +11584,7 @@ const y = Ln()(
|
|
|
11584
11584
|
clipboardPasteIndex: 0,
|
|
11585
11585
|
setDiagram: (n) => e({
|
|
11586
11586
|
diagram: n,
|
|
11587
|
-
internal:
|
|
11587
|
+
internal: ut(n),
|
|
11588
11588
|
past: [],
|
|
11589
11589
|
future: [],
|
|
11590
11590
|
selection: [],
|
|
@@ -11604,7 +11604,7 @@ const y = Ln()(
|
|
|
11604
11604
|
setReadOnly: (n) => e({ readOnly: n }),
|
|
11605
11605
|
loadDiagramFromFile: (n, o) => e({
|
|
11606
11606
|
diagram: n,
|
|
11607
|
-
internal:
|
|
11607
|
+
internal: ut(n),
|
|
11608
11608
|
fileSession: o,
|
|
11609
11609
|
past: [],
|
|
11610
11610
|
future: [],
|
|
@@ -11627,7 +11627,7 @@ const y = Ln()(
|
|
|
11627
11627
|
const a = r.length >= NA ? r.slice(1) : r;
|
|
11628
11628
|
e({
|
|
11629
11629
|
diagram: i,
|
|
11630
|
-
internal:
|
|
11630
|
+
internal: ut(i),
|
|
11631
11631
|
past: [...a, o],
|
|
11632
11632
|
future: [],
|
|
11633
11633
|
// A committed document change invalidates any in-flight geometry
|
|
@@ -11645,7 +11645,7 @@ const y = Ln()(
|
|
|
11645
11645
|
const i = n[n.length - 1];
|
|
11646
11646
|
e({
|
|
11647
11647
|
diagram: i,
|
|
11648
|
-
internal:
|
|
11648
|
+
internal: ut(i),
|
|
11649
11649
|
past: n.slice(0, -1),
|
|
11650
11650
|
future: [...o, r],
|
|
11651
11651
|
wireFromTerminal: null,
|
|
@@ -11660,7 +11660,7 @@ const y = Ln()(
|
|
|
11660
11660
|
const i = o[o.length - 1];
|
|
11661
11661
|
e({
|
|
11662
11662
|
diagram: i,
|
|
11663
|
-
internal:
|
|
11663
|
+
internal: ut(i),
|
|
11664
11664
|
past: [...n, r],
|
|
11665
11665
|
future: o.slice(0, -1),
|
|
11666
11666
|
wireFromTerminal: null,
|
|
@@ -11808,7 +11808,7 @@ const y = Ln()(
|
|
|
11808
11808
|
const g = {};
|
|
11809
11809
|
for (const b of n) {
|
|
11810
11810
|
const w = i.buses.get(b);
|
|
11811
|
-
w && (g[b] =
|
|
11811
|
+
w && (g[b] = gt(w.geometry));
|
|
11812
11812
|
}
|
|
11813
11813
|
const p = (r.wires ?? []).filter(
|
|
11814
11814
|
(b) => b.ends.every((w) => l.has(Ht(w)))
|
|
@@ -11932,7 +11932,7 @@ const y = Ln()(
|
|
|
11932
11932
|
u(I.ends[1])
|
|
11933
11933
|
];
|
|
11934
11934
|
return {
|
|
11935
|
-
id:
|
|
11935
|
+
id: wt(P[0], P[1]),
|
|
11936
11936
|
ends: P,
|
|
11937
11937
|
...I.label ? { label: I.label } : {}
|
|
11938
11938
|
};
|
|
@@ -12013,7 +12013,7 @@ const y = Ln()(
|
|
|
12013
12013
|
let s = o.buses;
|
|
12014
12014
|
return a.length > 0 && s && (s = s.map((l) => {
|
|
12015
12015
|
const c = n.buses.get(l.id);
|
|
12016
|
-
return !l.layout && c ? { ...l, layout:
|
|
12016
|
+
return !l.layout && c ? { ...l, layout: gt(c.geometry) } : l;
|
|
12017
12017
|
})), {
|
|
12018
12018
|
...o,
|
|
12019
12019
|
layout: { ...r, ...i },
|
|
@@ -12029,7 +12029,7 @@ const y = Ln()(
|
|
|
12029
12029
|
for (const d of n)
|
|
12030
12030
|
if (o.buses.has(d)) {
|
|
12031
12031
|
const u = o.buses.get(d);
|
|
12032
|
-
(c = r.buses) != null && c.find((h) => h.id === d && h.layout) || s.set(d,
|
|
12032
|
+
(c = r.buses) != null && c.find((h) => h.id === d && h.layout) || s.set(d, gt(u.geometry));
|
|
12033
12033
|
} else {
|
|
12034
12034
|
if (i[d]) continue;
|
|
12035
12035
|
const u = o.layout.get(d);
|
|
@@ -12071,7 +12071,7 @@ const y = Ln()(
|
|
|
12071
12071
|
s.size > 0 && (c = (i.buses ?? []).map((g) => {
|
|
12072
12072
|
const p = s.get(g.id);
|
|
12073
12073
|
if (!p) return g;
|
|
12074
|
-
const f = g.layout ??
|
|
12074
|
+
const f = g.layout ?? gt(r.buses.get(g.id).geometry);
|
|
12075
12075
|
return {
|
|
12076
12076
|
...g,
|
|
12077
12077
|
layout: {
|
|
@@ -12203,7 +12203,7 @@ const y = Ln()(
|
|
|
12203
12203
|
let l = i.buses;
|
|
12204
12204
|
return s.size > 0 && (l = (i.buses ?? []).map((g) => {
|
|
12205
12205
|
if (!s.has(g.id)) return g;
|
|
12206
|
-
const p = g.layout ??
|
|
12206
|
+
const p = g.layout ?? gt(r.buses.get(g.id).geometry);
|
|
12207
12207
|
return { ...g, layout: { ...p, rot: s.get(g.id) } };
|
|
12208
12208
|
})), { ...i, layout: a, buses: l };
|
|
12209
12209
|
});
|
|
@@ -12264,7 +12264,7 @@ const y = Ln()(
|
|
|
12264
12264
|
},
|
|
12265
12265
|
addWire: (n, o) => {
|
|
12266
12266
|
if (n === o) return;
|
|
12267
|
-
const r =
|
|
12267
|
+
const r = wt(n, o);
|
|
12268
12268
|
t().dispatch((i) => {
|
|
12269
12269
|
const a = i.wires ?? [];
|
|
12270
12270
|
return a.some((s) => s.id === r) ? i : {
|
|
@@ -12297,7 +12297,7 @@ const y = Ln()(
|
|
|
12297
12297
|
const f = (i.wires ?? []).find((I) => I.id === p.onWire), b = l(p.at);
|
|
12298
12298
|
if (!f) return b;
|
|
12299
12299
|
const w = (i.wires ?? []).filter((I) => I.id !== p.onWire), x = (I, P) => ({
|
|
12300
|
-
id:
|
|
12300
|
+
id: wt(I, P),
|
|
12301
12301
|
ends: [I, P],
|
|
12302
12302
|
...f.label ? { label: f.label } : {}
|
|
12303
12303
|
});
|
|
@@ -12310,7 +12310,7 @@ const y = Ln()(
|
|
|
12310
12310
|
}, b;
|
|
12311
12311
|
}, d = c(n), u = c(o);
|
|
12312
12312
|
if (d === null || u === null || d === u) return i;
|
|
12313
|
-
const h =
|
|
12313
|
+
const h = wt(d, u), g = i.wires ?? [];
|
|
12314
12314
|
return g.some((p) => p.id === h) ? i : { ...i, wires: [...g, { id: h, ends: [d, u] }] };
|
|
12315
12315
|
});
|
|
12316
12316
|
},
|
|
@@ -12363,7 +12363,7 @@ const y = Ln()(
|
|
|
12363
12363
|
t().dispatch((r) => {
|
|
12364
12364
|
const i = (r.buses ?? []).map((a) => {
|
|
12365
12365
|
if (a.id !== n) return a;
|
|
12366
|
-
const s = t().internal, l = a.layout ?? (s.buses.has(n) ?
|
|
12366
|
+
const s = t().internal, l = a.layout ?? (s.buses.has(n) ? gt(s.buses.get(n).geometry) : { at: [0, 0], span: 320 }), c = {
|
|
12367
12367
|
at: o.at ?? l.at,
|
|
12368
12368
|
span: o.span ?? l.span,
|
|
12369
12369
|
...o.rot !== void 0 ? { rot: o.rot } : l.rot ? { rot: l.rot } : {}
|
|
@@ -12430,7 +12430,7 @@ const y = Ln()(
|
|
|
12430
12430
|
lastPlaceKind: e.lastPlaceKind
|
|
12431
12431
|
}),
|
|
12432
12432
|
onRehydrateStorage: () => (e) => {
|
|
12433
|
-
e != null && e.diagram && (e.internal =
|
|
12433
|
+
e != null && e.diagram && (e.internal = ut(e.diagram));
|
|
12434
12434
|
}
|
|
12435
12435
|
}
|
|
12436
12436
|
)
|
|
@@ -12454,7 +12454,7 @@ function un(e) {
|
|
|
12454
12454
|
...e.mirror ? { mirror: e.mirror } : {}
|
|
12455
12455
|
};
|
|
12456
12456
|
}
|
|
12457
|
-
function
|
|
12457
|
+
function gt(e) {
|
|
12458
12458
|
return {
|
|
12459
12459
|
at: [e.at[0], e.at[1]],
|
|
12460
12460
|
span: e.span,
|
|
@@ -12465,7 +12465,7 @@ let Qx = null;
|
|
|
12465
12465
|
function Hr(e) {
|
|
12466
12466
|
Qx = e;
|
|
12467
12467
|
}
|
|
12468
|
-
function
|
|
12468
|
+
function Ze() {
|
|
12469
12469
|
return Qx;
|
|
12470
12470
|
}
|
|
12471
12471
|
const En = 10;
|
|
@@ -12477,12 +12477,12 @@ function Jx() {
|
|
|
12477
12477
|
function me(e) {
|
|
12478
12478
|
return Jx() ? Math.round(e / En) * En : e;
|
|
12479
12479
|
}
|
|
12480
|
-
function
|
|
12480
|
+
function Ue(e) {
|
|
12481
12481
|
return [me(e[0]), me(e[1])];
|
|
12482
12482
|
}
|
|
12483
12483
|
const PA = 30, IA = 144;
|
|
12484
12484
|
function ek(e, t) {
|
|
12485
|
-
const n =
|
|
12485
|
+
const n = lt[e], o = y.getState(), r = o.diagram;
|
|
12486
12486
|
if (!n || e === "busbar")
|
|
12487
12487
|
return { newElementId: o.addElement(e, t), attachedToBus: !1 };
|
|
12488
12488
|
const i = zA(r, t);
|
|
@@ -12493,7 +12493,7 @@ function ek(e, t) {
|
|
|
12493
12493
|
const { busId: a, busAt: s, axis: l } = i, c = MA(n, l), d = An(r, e), u = n.terminals.find((f) => f.id === c), h = l === "x" ? t[0] : s[0], g = l === "y" ? t[1] : s[1], p = u ? [me(h) - u.x, me(g) - u.y] : [me(t[0]), me(t[1])];
|
|
12494
12494
|
return o.dispatch((f) => {
|
|
12495
12495
|
const b = { id: d, kind: e }, w = { at: p }, x = `${d}.${c}`, I = {
|
|
12496
|
-
id:
|
|
12496
|
+
id: wt(a, x),
|
|
12497
12497
|
ends: [a, x]
|
|
12498
12498
|
};
|
|
12499
12499
|
return {
|
|
@@ -12576,7 +12576,7 @@ function Fr(e, t, n) {
|
|
|
12576
12576
|
return o * o + r * r;
|
|
12577
12577
|
}
|
|
12578
12578
|
function OA(e, t, n) {
|
|
12579
|
-
const o =
|
|
12579
|
+
const o = lt[e], r = y.getState(), i = r.diagram;
|
|
12580
12580
|
if (!o) return null;
|
|
12581
12581
|
const a = nk(t, n);
|
|
12582
12582
|
if (!a) return null;
|
|
@@ -12586,7 +12586,7 @@ function OA(e, t, n) {
|
|
|
12586
12586
|
], p = An(i, e);
|
|
12587
12587
|
return r.dispatch((f) => {
|
|
12588
12588
|
const b = { id: p, kind: e }, w = { at: g }, x = `${p}.${u.id}`, I = a.isBus && a.busId ? a.busId : t, P = {
|
|
12589
|
-
id:
|
|
12589
|
+
id: wt(I, x),
|
|
12590
12590
|
ends: [I, x]
|
|
12591
12591
|
};
|
|
12592
12592
|
return {
|
|
@@ -12597,12 +12597,12 @@ function OA(e, t, n) {
|
|
|
12597
12597
|
};
|
|
12598
12598
|
}), r.setSelection([p]), { newElementId: p, attachedToBus: a.isBus };
|
|
12599
12599
|
}
|
|
12600
|
-
const LA = 9,
|
|
12601
|
-
function
|
|
12602
|
-
return typeof e != "number" || !Number.isFinite(e) ?
|
|
12600
|
+
const LA = 9, We = 7, Rn = 5, jn = 32;
|
|
12601
|
+
function $t(e) {
|
|
12602
|
+
return typeof e != "number" || !Number.isFinite(e) ? We : Math.min(jn, Math.max(Rn, e));
|
|
12603
12603
|
}
|
|
12604
|
-
function Qt(e =
|
|
12605
|
-
return e * LA /
|
|
12604
|
+
function Qt(e = We) {
|
|
12605
|
+
return e * LA / We;
|
|
12606
12606
|
}
|
|
12607
12607
|
function Hn(e, t) {
|
|
12608
12608
|
var i, a;
|
|
@@ -12616,7 +12616,7 @@ function Hn(e, t) {
|
|
|
12616
12616
|
}
|
|
12617
12617
|
return n;
|
|
12618
12618
|
}
|
|
12619
|
-
function Fn(e, t =
|
|
12619
|
+
function Fn(e, t = We) {
|
|
12620
12620
|
const n = rk(e.viewBox);
|
|
12621
12621
|
return n ? {
|
|
12622
12622
|
x: n.x + n.w + 2,
|
|
@@ -12639,7 +12639,7 @@ function BA(e, t) {
|
|
|
12639
12639
|
}
|
|
12640
12640
|
return [n + t.at[0], o + t.at[1]];
|
|
12641
12641
|
}
|
|
12642
|
-
function Wn(e, t, n, o, r =
|
|
12642
|
+
function Wn(e, t, n, o, r = We) {
|
|
12643
12643
|
const i = BA(e, n), a = e.anchor ?? "start", s = rk(t.viewBox);
|
|
12644
12644
|
let l = e.x - (s ? s.x + s.w / 2 : 0), c = e.y - (s ? s.y + s.h / 2 : 0);
|
|
12645
12645
|
switch (n.mirror && (l = -l), n.rot) {
|
|
@@ -12664,7 +12664,7 @@ function rk(e) {
|
|
|
12664
12664
|
return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
|
|
12665
12665
|
}
|
|
12666
12666
|
const RA = 8;
|
|
12667
|
-
function qn(e, t =
|
|
12667
|
+
function qn(e, t = We) {
|
|
12668
12668
|
if (e.length < 2) return null;
|
|
12669
12669
|
let n = -1, o = 0;
|
|
12670
12670
|
for (let u = 0; u < e.length - 1; u++) {
|
|
@@ -12675,7 +12675,7 @@ function qn(e, t = Fe) {
|
|
|
12675
12675
|
h > o && (o = h, n = u);
|
|
12676
12676
|
}
|
|
12677
12677
|
if (n < 0 || o <= 0) return null;
|
|
12678
|
-
const [r, i] = e[n], [a, s] = e[n + 1], l = (r + a) / 2, c = (i + s) / 2, d = RA * t /
|
|
12678
|
+
const [r, i] = e[n], [a, s] = e[n + 1], l = (r + a) / 2, c = (i + s) / 2, d = RA * t / We;
|
|
12679
12679
|
return Math.abs(a - r) >= Math.abs(s - i) ? { world: [l, c - d], textAnchor: "middle" } : {
|
|
12680
12680
|
world: [l + d, c + t / 3],
|
|
12681
12681
|
textAnchor: "start"
|
|
@@ -12690,7 +12690,7 @@ function jA() {
|
|
|
12690
12690
|
), r = y(
|
|
12691
12691
|
(s) => {
|
|
12692
12692
|
var l;
|
|
12693
|
-
return
|
|
12693
|
+
return $t((l = s.diagram.meta) == null ? void 0 : l.labelFontSize);
|
|
12694
12694
|
}
|
|
12695
12695
|
), i = y((s) => s.editingElement), a = Qt(r);
|
|
12696
12696
|
return /* @__PURE__ */ z(
|
|
@@ -12836,13 +12836,13 @@ function FA({
|
|
|
12836
12836
|
}
|
|
12837
12837
|
);
|
|
12838
12838
|
}
|
|
12839
|
-
function
|
|
12839
|
+
function qe(e) {
|
|
12840
12840
|
return e.type ?? "text";
|
|
12841
12841
|
}
|
|
12842
12842
|
function WN(e) {
|
|
12843
12843
|
return e.type === void 0 || e.type === "text";
|
|
12844
12844
|
}
|
|
12845
|
-
const
|
|
12845
|
+
const Xe = 8, WA = 1.25, Jt = "6 4", qA = 0.05, Wr = 8, mn = 3, kt = 4, Vt = 3, Kt = 60, Ut = 20, So = 16, _o = 12, Nn = 10, GA = 10;
|
|
12846
12846
|
function VA(e, t) {
|
|
12847
12847
|
const n = e === "" ? [""] : e.split(`
|
|
12848
12848
|
`);
|
|
@@ -12864,19 +12864,19 @@ function qr(e, t) {
|
|
|
12864
12864
|
[s - c * mn, l - d * mn]
|
|
12865
12865
|
];
|
|
12866
12866
|
}
|
|
12867
|
-
function
|
|
12867
|
+
function Je(e) {
|
|
12868
12868
|
return [Vr(e.colWidths), Vr(e.rowHeights)];
|
|
12869
12869
|
}
|
|
12870
|
-
function
|
|
12870
|
+
function At(e) {
|
|
12871
12871
|
return ik(e.colWidths);
|
|
12872
12872
|
}
|
|
12873
|
-
function
|
|
12873
|
+
function Et(e) {
|
|
12874
12874
|
return ik(e.rowHeights);
|
|
12875
12875
|
}
|
|
12876
12876
|
function KA(e, t) {
|
|
12877
|
-
const n = t[0] - e.at[0], o = t[1] - e.at[1], [r, i] =
|
|
12877
|
+
const n = t[0] - e.at[0], o = t[1] - e.at[1], [r, i] = Je(e);
|
|
12878
12878
|
if (n < 0 || o < 0 || n > r || o > i) return null;
|
|
12879
|
-
const a = Gr(
|
|
12879
|
+
const a = Gr(At(e), n), s = Gr(Et(e), o);
|
|
12880
12880
|
return a === null || s === null ? null : [s, a];
|
|
12881
12881
|
}
|
|
12882
12882
|
function Gr(e, t) {
|
|
@@ -12952,7 +12952,7 @@ function uk(e) {
|
|
|
12952
12952
|
};
|
|
12953
12953
|
}
|
|
12954
12954
|
case "table": {
|
|
12955
|
-
const t = e, [n, o] =
|
|
12955
|
+
const t = e, [n, o] = Je(t);
|
|
12956
12956
|
return {
|
|
12957
12957
|
minX: t.at[0],
|
|
12958
12958
|
minY: t.at[1],
|
|
@@ -12961,7 +12961,7 @@ function uk(e) {
|
|
|
12961
12961
|
};
|
|
12962
12962
|
}
|
|
12963
12963
|
default: {
|
|
12964
|
-
const t = e, n = t.fontSize ??
|
|
12964
|
+
const t = e, n = t.fontSize ?? Xe, [o, r] = VA(t.text, n);
|
|
12965
12965
|
return {
|
|
12966
12966
|
minX: t.at[0],
|
|
12967
12967
|
minY: t.at[1],
|
|
@@ -12971,14 +12971,14 @@ function uk(e) {
|
|
|
12971
12971
|
}
|
|
12972
12972
|
}
|
|
12973
12973
|
}
|
|
12974
|
-
const
|
|
12974
|
+
const St = Xe, Tn = 1.25;
|
|
12975
12975
|
function UA() {
|
|
12976
12976
|
const e = y((a) => a.diagram.annotations), t = y((a) => a.selectedAnnotations), n = y((a) => a.editingAnnotation), o = y((a) => a.editingCell), r = y((a) => a.annotationPreview);
|
|
12977
12977
|
if (!e || e.length === 0) return null;
|
|
12978
12978
|
const i = new Set(t);
|
|
12979
12979
|
return /* @__PURE__ */ m("g", { className: "ole-free-annotation-layer", children: e.map((a) => {
|
|
12980
12980
|
const s = (r == null ? void 0 : r.id) === a.id ? r : a, l = i.has(a.id);
|
|
12981
|
-
switch (
|
|
12981
|
+
switch (qe(s)) {
|
|
12982
12982
|
case "rect":
|
|
12983
12983
|
return /* @__PURE__ */ m(
|
|
12984
12984
|
XA,
|
|
@@ -13048,9 +13048,9 @@ function XA({
|
|
|
13048
13048
|
"text",
|
|
13049
13049
|
{
|
|
13050
13050
|
className: "ole-ann-label",
|
|
13051
|
-
x: n +
|
|
13052
|
-
y: o +
|
|
13053
|
-
fontSize:
|
|
13051
|
+
x: n + kt,
|
|
13052
|
+
y: o + kt + St * 0.85,
|
|
13053
|
+
fontSize: St,
|
|
13054
13054
|
children: e.label
|
|
13055
13055
|
}
|
|
13056
13056
|
)
|
|
@@ -13097,7 +13097,7 @@ function ZA({
|
|
|
13097
13097
|
editingCell: n
|
|
13098
13098
|
}) {
|
|
13099
13099
|
var g;
|
|
13100
|
-
const [o, r] = e.at, [i, a] =
|
|
13100
|
+
const [o, r] = e.at, [i, a] = Je(e), s = At(e), l = Et(e), c = e.fontSize ?? St;
|
|
13101
13101
|
let d = "";
|
|
13102
13102
|
for (let p = 1; p < e.colWidths.length; p++)
|
|
13103
13103
|
d += `M${o + s[p]} ${r}V${r + a}`;
|
|
@@ -13156,7 +13156,7 @@ function QA({
|
|
|
13156
13156
|
cell: t
|
|
13157
13157
|
}) {
|
|
13158
13158
|
var g;
|
|
13159
|
-
const [n, o] = t, r = pe(null), i =
|
|
13159
|
+
const [n, o] = t, r = pe(null), i = At(e), a = Et(e), s = e.fontSize ?? St, l = ((g = e.cells[n]) == null ? void 0 : g[o]) ?? "";
|
|
13160
13160
|
ie(() => {
|
|
13161
13161
|
const p = r.current;
|
|
13162
13162
|
p && (p.focus(), p.select());
|
|
@@ -13236,7 +13236,7 @@ function JA({
|
|
|
13236
13236
|
ann: e,
|
|
13237
13237
|
isSelected: t
|
|
13238
13238
|
}) {
|
|
13239
|
-
const n = e.fontSize ??
|
|
13239
|
+
const n = e.fontSize ?? St, o = e.text === "" ? [""] : e.text.split(`
|
|
13240
13240
|
`), r = Math.max(
|
|
13241
13241
|
20,
|
|
13242
13242
|
...o.map((a) => a.length * n * 0.55)
|
|
@@ -13285,7 +13285,7 @@ function JA({
|
|
|
13285
13285
|
);
|
|
13286
13286
|
}
|
|
13287
13287
|
function e6({ ann: e }) {
|
|
13288
|
-
const t = pe(null), n = e.fontSize ??
|
|
13288
|
+
const t = pe(null), n = e.fontSize ?? St;
|
|
13289
13289
|
ie(() => {
|
|
13290
13290
|
const s = t.current;
|
|
13291
13291
|
if (!s) return;
|
|
@@ -13395,7 +13395,7 @@ function n6() {
|
|
|
13395
13395
|
const r = (t ?? []).find((a) => a.id === e);
|
|
13396
13396
|
if (!r) return null;
|
|
13397
13397
|
const i = (n == null ? void 0 : n.id) === e ? n : r;
|
|
13398
|
-
switch (
|
|
13398
|
+
switch (qe(i)) {
|
|
13399
13399
|
case "rect":
|
|
13400
13400
|
return /* @__PURE__ */ m(o6, { ann: i, model: r });
|
|
13401
13401
|
case "table":
|
|
@@ -13411,14 +13411,14 @@ function tn(e, t, n) {
|
|
|
13411
13411
|
return { onPointerDown: (l) => {
|
|
13412
13412
|
if (l.button !== 0) return;
|
|
13413
13413
|
l.stopPropagation(), l.preventDefault();
|
|
13414
|
-
const c =
|
|
13414
|
+
const c = Ze();
|
|
13415
13415
|
c && (o.current = {
|
|
13416
13416
|
pointerId: l.pointerId,
|
|
13417
13417
|
startSvg: c.screenToSvg(l.clientX, l.clientY),
|
|
13418
13418
|
orig: structuredClone(e)
|
|
13419
13419
|
}, l.target.setPointerCapture(l.pointerId));
|
|
13420
13420
|
}, onPointerMove: (l) => {
|
|
13421
|
-
const c = o.current, d =
|
|
13421
|
+
const c = o.current, d = Ze();
|
|
13422
13422
|
if (!c || l.pointerId !== c.pointerId || !d) return;
|
|
13423
13423
|
const u = d.screenToSvg(l.clientX, l.clientY), h = me(u[0] - c.startSvg[0]), g = me(u[1] - c.startSvg[1]);
|
|
13424
13424
|
y.getState().setAnnotationPreview(t(c.orig, h, g, l.nativeEvent));
|
|
@@ -13515,7 +13515,7 @@ function i6({
|
|
|
13515
13515
|
ann: e,
|
|
13516
13516
|
model: t
|
|
13517
13517
|
}) {
|
|
13518
|
-
const n =
|
|
13518
|
+
const n = Je(e), o = At(e), r = Et(e);
|
|
13519
13519
|
return /* @__PURE__ */ z("g", { className: "ole-annotation-handles", pointerEvents: "auto", children: [
|
|
13520
13520
|
o.slice(1, -1).map((i, a) => /* @__PURE__ */ m(s6, { index: a, x: e.at[0] + i, ann: e, model: t }, `c${a}`)),
|
|
13521
13521
|
r.slice(1, -1).map((i, a) => /* @__PURE__ */ m(l6, { index: a, y: e.at[1] + i, ann: e, model: t }, `r${a}`)),
|
|
@@ -13531,7 +13531,7 @@ function a6({
|
|
|
13531
13531
|
const r = tn(
|
|
13532
13532
|
n,
|
|
13533
13533
|
(i, a, s) => {
|
|
13534
|
-
const l =
|
|
13534
|
+
const l = Je(i), c = mk(
|
|
13535
13535
|
i.at,
|
|
13536
13536
|
l,
|
|
13537
13537
|
e.dirX,
|
|
@@ -13570,7 +13570,7 @@ function s6({
|
|
|
13570
13570
|
ann: n,
|
|
13571
13571
|
model: o
|
|
13572
13572
|
}) {
|
|
13573
|
-
const [, r] =
|
|
13573
|
+
const [, r] = Je(n), i = tn(
|
|
13574
13574
|
o,
|
|
13575
13575
|
(a, s) => {
|
|
13576
13576
|
const l = [...a.colWidths];
|
|
@@ -13600,7 +13600,7 @@ function l6({
|
|
|
13600
13600
|
ann: n,
|
|
13601
13601
|
model: o
|
|
13602
13602
|
}) {
|
|
13603
|
-
const [r] =
|
|
13603
|
+
const [r] = Je(n), i = tn(
|
|
13604
13604
|
o,
|
|
13605
13605
|
(a, s, l) => {
|
|
13606
13606
|
const c = [...a.rowHeights];
|
|
@@ -13704,7 +13704,7 @@ function Ur({
|
|
|
13704
13704
|
side: o,
|
|
13705
13705
|
axis: r
|
|
13706
13706
|
}) {
|
|
13707
|
-
const i =
|
|
13707
|
+
const i = Ze(), a = pe(null), s = (d) => {
|
|
13708
13708
|
if (d.button !== 0 || (d.stopPropagation(), d.preventDefault(), !i)) return;
|
|
13709
13709
|
const u = y.getState().internal.buses.get(n);
|
|
13710
13710
|
u && (a.current = {
|
|
@@ -13790,7 +13790,7 @@ function h6({
|
|
|
13790
13790
|
xLocked: n,
|
|
13791
13791
|
yLocked: o
|
|
13792
13792
|
}) {
|
|
13793
|
-
const r =
|
|
13793
|
+
const r = Ze(), i = pe(null), a = y((p) => {
|
|
13794
13794
|
var f;
|
|
13795
13795
|
return (f = p.internal.wireRenders.get(e)) == null ? void 0 : f.path;
|
|
13796
13796
|
});
|
|
@@ -13853,7 +13853,7 @@ function f6({
|
|
|
13853
13853
|
segIndex: t,
|
|
13854
13854
|
axis: n
|
|
13855
13855
|
}) {
|
|
13856
|
-
const o =
|
|
13856
|
+
const o = Ze(), r = pe(null), i = y((p) => {
|
|
13857
13857
|
var f;
|
|
13858
13858
|
return (f = p.internal.wireRenders.get(e)) == null ? void 0 : f.path;
|
|
13859
13859
|
});
|
|
@@ -14041,7 +14041,7 @@ function C6() {
|
|
|
14041
14041
|
);
|
|
14042
14042
|
}) });
|
|
14043
14043
|
}
|
|
14044
|
-
function
|
|
14044
|
+
function st(e) {
|
|
14045
14045
|
const t = [`translate(${e.at[0]} ${e.at[1]})`];
|
|
14046
14046
|
return e.rot && t.push(`rotate(${e.rot})`), e.mirror && t.push("scale(-1 1)"), t.join(" ");
|
|
14047
14047
|
}
|
|
@@ -14082,7 +14082,7 @@ function E6() {
|
|
|
14082
14082
|
"data-element-id": s.element.id,
|
|
14083
14083
|
"data-selected": c ? "true" : void 0,
|
|
14084
14084
|
"data-node-related": d ? "true" : void 0,
|
|
14085
|
-
transform:
|
|
14085
|
+
transform: st(l),
|
|
14086
14086
|
className: "ole-element",
|
|
14087
14087
|
children: [
|
|
14088
14088
|
/* @__PURE__ */ m(A6, { lib: s.libraryDef }),
|
|
@@ -14106,7 +14106,7 @@ function E6() {
|
|
|
14106
14106
|
"data-element-id": s.element.id,
|
|
14107
14107
|
"data-selected": c ? "true" : void 0,
|
|
14108
14108
|
"data-node-related": d ? "true" : void 0,
|
|
14109
|
-
transform:
|
|
14109
|
+
transform: st(l),
|
|
14110
14110
|
className: "ole-element ole-element--unknown",
|
|
14111
14111
|
children: [
|
|
14112
14112
|
/* @__PURE__ */ m(
|
|
@@ -14181,7 +14181,7 @@ function I6() {
|
|
|
14181
14181
|
i = tk(r);
|
|
14182
14182
|
const s = n[0] - ((i == null ? void 0 : i.x) ?? 0), l = n[1] - ((i == null ? void 0 : i.y) ?? 0);
|
|
14183
14183
|
return /* @__PURE__ */ z("g", { className: "ole-place-ghost-group", pointerEvents: "none", children: [
|
|
14184
|
-
a && /* @__PURE__ */ z(
|
|
14184
|
+
a && /* @__PURE__ */ z(Ye, { children: [
|
|
14185
14185
|
/* @__PURE__ */ m(
|
|
14186
14186
|
"line",
|
|
14187
14187
|
{
|
|
@@ -14244,7 +14244,7 @@ function z6() {
|
|
|
14244
14244
|
height: l.h,
|
|
14245
14245
|
fill: "none",
|
|
14246
14246
|
className: "ole-selection-rect",
|
|
14247
|
-
transform:
|
|
14247
|
+
transform: st(s)
|
|
14248
14248
|
},
|
|
14249
14249
|
r
|
|
14250
14250
|
) : null;
|
|
@@ -14354,16 +14354,16 @@ function B6() {
|
|
|
14354
14354
|
];
|
|
14355
14355
|
}) });
|
|
14356
14356
|
}
|
|
14357
|
-
let
|
|
14357
|
+
let mt = null;
|
|
14358
14358
|
const Ao = /* @__PURE__ */ new Set();
|
|
14359
|
-
function
|
|
14360
|
-
if (!(e === null &&
|
|
14361
|
-
|
|
14359
|
+
function at(e) {
|
|
14360
|
+
if (!(e === null && mt === null || e && mt && e.ref === mt.ref && e.world[0] === mt.world[0] && e.world[1] === mt.world[1])) {
|
|
14361
|
+
mt = e;
|
|
14362
14362
|
for (const t of Ao) t(e);
|
|
14363
14363
|
}
|
|
14364
14364
|
}
|
|
14365
14365
|
function R6() {
|
|
14366
|
-
return
|
|
14366
|
+
return mt;
|
|
14367
14367
|
}
|
|
14368
14368
|
function j6(e) {
|
|
14369
14369
|
return Ao.add(e), () => {
|
|
@@ -14394,7 +14394,7 @@ function H6() {
|
|
|
14394
14394
|
className: "ole-wire-preview-anchor"
|
|
14395
14395
|
}
|
|
14396
14396
|
),
|
|
14397
|
-
n && /* @__PURE__ */ z(
|
|
14397
|
+
n && /* @__PURE__ */ z(Ye, { children: [
|
|
14398
14398
|
/* @__PURE__ */ m(
|
|
14399
14399
|
"circle",
|
|
14400
14400
|
{
|
|
@@ -14417,24 +14417,24 @@ function H6() {
|
|
|
14417
14417
|
] })
|
|
14418
14418
|
] });
|
|
14419
14419
|
}
|
|
14420
|
-
function
|
|
14420
|
+
function pt(e, t) {
|
|
14421
14421
|
return e instanceof Element ? e.closest(`[${t}]`) : null;
|
|
14422
14422
|
}
|
|
14423
|
-
function
|
|
14423
|
+
function _t(e) {
|
|
14424
14424
|
var t;
|
|
14425
|
-
return ((t =
|
|
14425
|
+
return ((t = pt(e, "data-element-id")) == null ? void 0 : t.getAttribute("data-element-id")) ?? null;
|
|
14426
14426
|
}
|
|
14427
14427
|
function F6(e) {
|
|
14428
14428
|
var t;
|
|
14429
|
-
return ((t =
|
|
14429
|
+
return ((t = pt(e, "data-bus-id")) == null ? void 0 : t.getAttribute("data-bus-id")) ?? null;
|
|
14430
14430
|
}
|
|
14431
14431
|
function W6(e) {
|
|
14432
14432
|
var t;
|
|
14433
|
-
return ((t =
|
|
14433
|
+
return ((t = pt(e, "data-junction-id")) == null ? void 0 : t.getAttribute("data-junction-id")) ?? null;
|
|
14434
14434
|
}
|
|
14435
14435
|
function Gn(e) {
|
|
14436
14436
|
var r;
|
|
14437
|
-
const t = (r =
|
|
14437
|
+
const t = (r = pt(e, "data-terminal-id")) == null ? void 0 : r.getAttribute("data-terminal-id");
|
|
14438
14438
|
if (t) return t;
|
|
14439
14439
|
const n = W6(e);
|
|
14440
14440
|
if (n) return n;
|
|
@@ -14443,15 +14443,15 @@ function Gn(e) {
|
|
|
14443
14443
|
}
|
|
14444
14444
|
function Vn(e) {
|
|
14445
14445
|
var t;
|
|
14446
|
-
return ((t =
|
|
14446
|
+
return ((t = pt(e, "data-node-id")) == null ? void 0 : t.getAttribute("data-node-id")) ?? null;
|
|
14447
14447
|
}
|
|
14448
14448
|
function Eo(e) {
|
|
14449
14449
|
var t;
|
|
14450
|
-
return ((t =
|
|
14450
|
+
return ((t = pt(e, "data-wire-id")) == null ? void 0 : t.getAttribute("data-wire-id")) ?? null;
|
|
14451
14451
|
}
|
|
14452
14452
|
function Xt(e) {
|
|
14453
14453
|
var t;
|
|
14454
|
-
return ((t =
|
|
14454
|
+
return ((t = pt(e, "data-annotation-id")) == null ? void 0 : t.getAttribute("data-annotation-id")) ?? null;
|
|
14455
14455
|
}
|
|
14456
14456
|
function bk(e, t) {
|
|
14457
14457
|
try {
|
|
@@ -14640,7 +14640,7 @@ function Z6(e) {
|
|
|
14640
14640
|
) : [];
|
|
14641
14641
|
a(i, h, Y6), o = u, u ? t.setAttribute("data-hover-node", "") : t.removeAttribute("data-hover-node");
|
|
14642
14642
|
}, c = (u) => {
|
|
14643
|
-
s(
|
|
14643
|
+
s(_t(u.target));
|
|
14644
14644
|
const h = Gn(u.target);
|
|
14645
14645
|
let g = null;
|
|
14646
14646
|
h ? g = y.getState().internal.terminalToNode.get(h) ?? null : g = Vn(u.target), l(g);
|
|
@@ -14843,7 +14843,7 @@ const rE = {
|
|
|
14843
14843
|
return;
|
|
14844
14844
|
}
|
|
14845
14845
|
}
|
|
14846
|
-
let s =
|
|
14846
|
+
let s = _t(e.target);
|
|
14847
14847
|
if (!s) {
|
|
14848
14848
|
const S = Eo(e.target);
|
|
14849
14849
|
if (S && typeof document < "u") {
|
|
@@ -14902,7 +14902,7 @@ const rE = {
|
|
|
14902
14902
|
world: [0, 0],
|
|
14903
14903
|
ref: ze.fromRef
|
|
14904
14904
|
};
|
|
14905
|
-
|
|
14905
|
+
at(zn(i, r) ? null : vk(r));
|
|
14906
14906
|
return;
|
|
14907
14907
|
}
|
|
14908
14908
|
if (ue && e.pointerId === ue.pointerId) {
|
|
@@ -14917,7 +14917,7 @@ const rE = {
|
|
|
14917
14917
|
...a,
|
|
14918
14918
|
at: [a.at[0] + o, a.at[1] + r]
|
|
14919
14919
|
};
|
|
14920
|
-
s.setAttribute("transform",
|
|
14920
|
+
s.setAttribute("transform", st(l));
|
|
14921
14921
|
}
|
|
14922
14922
|
for (const i of ue.busOriginals.keys()) {
|
|
14923
14923
|
const a = t.hostEl.querySelector(
|
|
@@ -14965,7 +14965,7 @@ const rE = {
|
|
|
14965
14965
|
}
|
|
14966
14966
|
if (ze && e.pointerId === ze.pointerId) {
|
|
14967
14967
|
const o = y.getState(), r = ze.fromRef;
|
|
14968
|
-
ze = null, t.hostEl.classList.remove("tool-wire"), o.setWireFromTerminal(null), o.setWireDragFrom(null), o.setCursorSvg(null),
|
|
14968
|
+
ze = null, t.hostEl.classList.remove("tool-wire"), o.setWireFromTerminal(null), o.setWireDragFrom(null), o.setCursorSvg(null), at(null);
|
|
14969
14969
|
const i = t.viewport.screenToSvg(e.clientX, e.clientY), a = In(e.clientX, e.clientY) ?? (e.target instanceof Element ? e.target : null), s = Wt(a, i, qt(t, e.clientX, e.clientY));
|
|
14970
14970
|
if (zn({
|
|
14971
14971
|
world: [0, 0],
|
|
@@ -15040,7 +15040,7 @@ const rE = {
|
|
|
15040
15040
|
const d = t.hostEl.querySelector(
|
|
15041
15041
|
`[data-element-id="${Le(l)}"]`
|
|
15042
15042
|
);
|
|
15043
|
-
d && d.setAttribute("transform",
|
|
15043
|
+
d && d.setAttribute("transform", st(c));
|
|
15044
15044
|
}
|
|
15045
15045
|
for (const l of ue.busOriginals.keys()) {
|
|
15046
15046
|
const c = t.hostEl.querySelector(
|
|
@@ -15070,7 +15070,7 @@ const rE = {
|
|
|
15070
15070
|
if (ze && e.pointerId === ze.pointerId) {
|
|
15071
15071
|
t.hostEl.classList.remove("tool-wire");
|
|
15072
15072
|
const l = y.getState();
|
|
15073
|
-
l.setWireFromTerminal(null), l.setWireDragFrom(null), l.setCursorSvg(null),
|
|
15073
|
+
l.setWireFromTerminal(null), l.setWireDragFrom(null), l.setCursorSvg(null), at(null), ze = null;
|
|
15074
15074
|
}
|
|
15075
15075
|
if (Ie && e.pointerId === Ie.pointerId) {
|
|
15076
15076
|
if ((s = (a = t.hostEl).hasPointerCapture) != null && s.call(a, e.pointerId))
|
|
@@ -15091,14 +15091,14 @@ const rE = {
|
|
|
15091
15091
|
n.setSelectedAnnotation(o), ei(n, a, t.viewport.screenToSvg(e.clientX, e.clientY));
|
|
15092
15092
|
return;
|
|
15093
15093
|
}
|
|
15094
|
-
const r =
|
|
15094
|
+
const r = _t(e.target);
|
|
15095
15095
|
r && (e.preventDefault(), e.stopPropagation(), n.setEditingElement(r));
|
|
15096
15096
|
},
|
|
15097
15097
|
onDeactivate(e) {
|
|
15098
15098
|
if (ue = null, Ie = null, be = null, ze) {
|
|
15099
15099
|
e.hostEl.classList.remove("tool-wire");
|
|
15100
15100
|
const t = y.getState();
|
|
15101
|
-
t.setWireFromTerminal(null), t.setWireDragFrom(null), t.setCursorSvg(null),
|
|
15101
|
+
t.setWireFromTerminal(null), t.setWireDragFrom(null), t.setCursorSvg(null), at(null), ze = null;
|
|
15102
15102
|
}
|
|
15103
15103
|
hn(null);
|
|
15104
15104
|
}
|
|
@@ -15135,7 +15135,7 @@ function Jr(e, t, n, o) {
|
|
|
15135
15135
|
}, !0);
|
|
15136
15136
|
}
|
|
15137
15137
|
function ei(e, t, n) {
|
|
15138
|
-
const o =
|
|
15138
|
+
const o = qe(t);
|
|
15139
15139
|
if (o === "table") {
|
|
15140
15140
|
const r = KA(t, n);
|
|
15141
15141
|
r && (e.setEditingAnnotation(t.id), e.setEditingCell(r));
|
|
@@ -15161,7 +15161,7 @@ const aE = {
|
|
|
15161
15161
|
cursor: "grab",
|
|
15162
15162
|
onPointerDown(e, t) {
|
|
15163
15163
|
if (e.button !== 0) return;
|
|
15164
|
-
const n = t.viewport.getViewport(), o = y.getState().readOnly ? null :
|
|
15164
|
+
const n = t.viewport.getViewport(), o = y.getState().readOnly ? null : _t(e.target);
|
|
15165
15165
|
let r = null;
|
|
15166
15166
|
if (o) {
|
|
15167
15167
|
const i = y.getState();
|
|
@@ -15215,7 +15215,7 @@ const aE = {
|
|
|
15215
15215
|
...l,
|
|
15216
15216
|
at: [l.at[0] + i, l.at[1] + a]
|
|
15217
15217
|
};
|
|
15218
|
-
c.setAttribute("transform",
|
|
15218
|
+
c.setAttribute("transform", st(d));
|
|
15219
15219
|
}
|
|
15220
15220
|
for (const s of ce.elementDrag.busOriginals.keys()) {
|
|
15221
15221
|
const l = t.hostEl.querySelector(
|
|
@@ -15256,7 +15256,7 @@ const aE = {
|
|
|
15256
15256
|
const r = t.hostEl.querySelector(
|
|
15257
15257
|
`[data-element-id="${Lt(n)}"]`
|
|
15258
15258
|
);
|
|
15259
|
-
r && r.setAttribute("transform",
|
|
15259
|
+
r && r.setAttribute("transform", st(o));
|
|
15260
15260
|
}
|
|
15261
15261
|
for (const n of ce.elementDrag.busOriginals.keys()) {
|
|
15262
15262
|
const o = t.hostEl.querySelector(
|
|
@@ -15278,7 +15278,7 @@ function sE(e) {
|
|
|
15278
15278
|
t.setSelectedAnnotation(n);
|
|
15279
15279
|
return;
|
|
15280
15280
|
}
|
|
15281
|
-
const o =
|
|
15281
|
+
const o = _t(e);
|
|
15282
15282
|
if (o) {
|
|
15283
15283
|
t.setSelection([o]);
|
|
15284
15284
|
return;
|
|
@@ -15312,7 +15312,7 @@ function lE(e) {
|
|
|
15312
15312
|
return e >= Rt.tight ? "full" : e >= Rt.compact ? "tight" : e >= Rt.dense ? "compact" : e >= Rt.mini ? "dense" : "mini";
|
|
15313
15313
|
}
|
|
15314
15314
|
const xk = Hi("full");
|
|
15315
|
-
function
|
|
15315
|
+
function ct() {
|
|
15316
15316
|
return Fi(xk);
|
|
15317
15317
|
}
|
|
15318
15318
|
function cE(e) {
|
|
@@ -15338,7 +15338,7 @@ function kk() {
|
|
|
15338
15338
|
}
|
|
15339
15339
|
return window.innerWidth < Rt.dense;
|
|
15340
15340
|
}
|
|
15341
|
-
function
|
|
15341
|
+
function ht() {
|
|
15342
15342
|
kk() && y.getState().setActiveTool("pan");
|
|
15343
15343
|
}
|
|
15344
15344
|
function dE() {
|
|
@@ -15353,7 +15353,7 @@ const uE = {
|
|
|
15353
15353
|
onDeactivate(e) {
|
|
15354
15354
|
e.hostEl.classList.remove("tool-wire");
|
|
15355
15355
|
const t = y.getState();
|
|
15356
|
-
t.setWireFromTerminal(null), t.setWireDragFrom(null), t.setCursorSvg(null),
|
|
15356
|
+
t.setWireFromTerminal(null), t.setWireDragFrom(null), t.setCursorSvg(null), at(null);
|
|
15357
15357
|
},
|
|
15358
15358
|
onPointerDown(e, t) {
|
|
15359
15359
|
var a, s;
|
|
@@ -15373,22 +15373,22 @@ const uE = {
|
|
|
15373
15373
|
ref: o.ref,
|
|
15374
15374
|
create: !o.ref
|
|
15375
15375
|
};
|
|
15376
|
-
|
|
15376
|
+
at(zn(s, a) ? null : vk(a));
|
|
15377
15377
|
},
|
|
15378
15378
|
onPointerUp(e, t) {
|
|
15379
15379
|
const n = y.getState(), o = n.wireDragFrom;
|
|
15380
|
-
if (n.setWireFromTerminal(null), n.setWireDragFrom(null), n.setCursorSvg(null),
|
|
15380
|
+
if (n.setWireFromTerminal(null), n.setWireDragFrom(null), n.setCursorSvg(null), at(null), !o) return;
|
|
15381
15381
|
const r = t.viewport.screenToSvg(e.clientX, e.clientY), i = In(e.clientX, e.clientY) ?? (e.target instanceof Element ? e.target : null), a = Wt(i, r, qt(t, e.clientX, e.clientY)), s = {
|
|
15382
15382
|
spec: o.spec,
|
|
15383
15383
|
world: o.world,
|
|
15384
15384
|
ref: o.ref,
|
|
15385
15385
|
create: !o.ref
|
|
15386
15386
|
};
|
|
15387
|
-
zn(s, a) || (n.connectWire(o.spec, a.spec),
|
|
15387
|
+
zn(s, a) || (n.connectWire(o.spec, a.spec), ht());
|
|
15388
15388
|
},
|
|
15389
15389
|
onPointerLeave() {
|
|
15390
15390
|
const e = y.getState();
|
|
15391
|
-
e.setWireFromTerminal(null), e.setWireDragFrom(null), e.setCursorSvg(null),
|
|
15391
|
+
e.setWireFromTerminal(null), e.setWireDragFrom(null), e.setCursorSvg(null), at(null);
|
|
15392
15392
|
}
|
|
15393
15393
|
}, ri = 10;
|
|
15394
15394
|
let Bt = !1;
|
|
@@ -15451,7 +15451,7 @@ function ai(e) {
|
|
|
15451
15451
|
return Math.round(e / ri) * ri;
|
|
15452
15452
|
}
|
|
15453
15453
|
const si = 10, li = 20;
|
|
15454
|
-
function
|
|
15454
|
+
function bt(e) {
|
|
15455
15455
|
return Math.round(e / si) * si;
|
|
15456
15456
|
}
|
|
15457
15457
|
const pE = {
|
|
@@ -15460,17 +15460,17 @@ const pE = {
|
|
|
15460
15460
|
onPointerDown(e, t) {
|
|
15461
15461
|
if (e.button !== 0) return;
|
|
15462
15462
|
e.preventDefault();
|
|
15463
|
-
const n = t.viewport.screenToSvg(e.clientX, e.clientY), o = [
|
|
15463
|
+
const n = t.viewport.screenToSvg(e.clientX, e.clientY), o = [bt(n[0]), bt(n[1])];
|
|
15464
15464
|
y.getState().setBusbarDrawStart(o), y.getState().setCursorSvg(o);
|
|
15465
15465
|
},
|
|
15466
15466
|
onPointerMove(e, t) {
|
|
15467
15467
|
const n = t.viewport.screenToSvg(e.clientX, e.clientY);
|
|
15468
|
-
y.getState().setCursorSvg([
|
|
15468
|
+
y.getState().setCursorSvg([bt(n[0]), bt(n[1])]);
|
|
15469
15469
|
},
|
|
15470
15470
|
onPointerUp(e, t) {
|
|
15471
15471
|
const n = y.getState().busbarDrawStart;
|
|
15472
15472
|
if (y.getState().setBusbarDrawStart(null), !n) return;
|
|
15473
|
-
const o = t.viewport.screenToSvg(e.clientX, e.clientY), r =
|
|
15473
|
+
const o = t.viewport.screenToSvg(e.clientX, e.clientY), r = bt(o[0]), i = bt(o[1]), a = r - n[0], s = i - n[1], l = Math.abs(a) >= Math.abs(s);
|
|
15474
15474
|
let c, d, u;
|
|
15475
15475
|
if (l) {
|
|
15476
15476
|
if (d = Math.abs(a), d < li) return;
|
|
@@ -15479,7 +15479,7 @@ const pE = {
|
|
|
15479
15479
|
if (d = Math.abs(s), d < li) return;
|
|
15480
15480
|
c = 90, u = [n[0], (n[1] + i) / 2];
|
|
15481
15481
|
}
|
|
15482
|
-
y.getState().addBus(u, d, c),
|
|
15482
|
+
y.getState().addBus(u, d, c), ht();
|
|
15483
15483
|
},
|
|
15484
15484
|
onPointerLeave() {
|
|
15485
15485
|
const e = y.getState();
|
|
@@ -15500,7 +15500,7 @@ const pE = {
|
|
|
15500
15500
|
if (e.button !== 0) return;
|
|
15501
15501
|
e.preventDefault(), e.stopPropagation();
|
|
15502
15502
|
const n = t.viewport.screenToSvg(e.clientX, e.clientY);
|
|
15503
|
-
y.getState().addJunction([di(n[0]), di(n[1])]),
|
|
15503
|
+
y.getState().addJunction([di(n[0]), di(n[1])]), ht();
|
|
15504
15504
|
}
|
|
15505
15505
|
}, fE = {
|
|
15506
15506
|
id: "text",
|
|
@@ -15514,7 +15514,7 @@ const pE = {
|
|
|
15514
15514
|
}
|
|
15515
15515
|
e.preventDefault();
|
|
15516
15516
|
const r = t.viewport.screenToSvg(e.clientX, e.clientY), i = n.addAnnotation([r[0], r[1]], "");
|
|
15517
|
-
n.setEditingAnnotation(i),
|
|
15517
|
+
n.setEditingAnnotation(i), ht();
|
|
15518
15518
|
}
|
|
15519
15519
|
}, gE = {
|
|
15520
15520
|
id: "rect",
|
|
@@ -15522,7 +15522,7 @@ const pE = {
|
|
|
15522
15522
|
onPointerDown(e, t) {
|
|
15523
15523
|
if (e.button !== 0) return;
|
|
15524
15524
|
e.preventDefault();
|
|
15525
|
-
const n =
|
|
15525
|
+
const n = Ue(t.viewport.screenToSvg(e.clientX, e.clientY));
|
|
15526
15526
|
y.getState().setAnnotationDraft({
|
|
15527
15527
|
kind: "rect",
|
|
15528
15528
|
start: n,
|
|
@@ -15534,14 +15534,14 @@ const pE = {
|
|
|
15534
15534
|
const n = y.getState(), o = n.annotationDraft;
|
|
15535
15535
|
o && n.setAnnotationDraft({
|
|
15536
15536
|
...o,
|
|
15537
|
-
current:
|
|
15537
|
+
current: Ue(t.viewport.screenToSvg(e.clientX, e.clientY)),
|
|
15538
15538
|
constrain: e.shiftKey
|
|
15539
15539
|
});
|
|
15540
15540
|
},
|
|
15541
15541
|
onPointerUp(e, t) {
|
|
15542
15542
|
const n = y.getState(), o = n.annotationDraft;
|
|
15543
15543
|
if (n.setAnnotationDraft(null), !o) return;
|
|
15544
|
-
const r =
|
|
15544
|
+
const r = Ue(t.viewport.screenToSvg(e.clientX, e.clientY)), { at: i, size: a } = ak({ ...o, current: r, constrain: e.shiftKey });
|
|
15545
15545
|
if (a[0] < Nn || a[1] < Nn) return;
|
|
15546
15546
|
const s = n.insertAnnotation({
|
|
15547
15547
|
type: "rect",
|
|
@@ -15549,7 +15549,7 @@ const pE = {
|
|
|
15549
15549
|
size: a,
|
|
15550
15550
|
stroke: "dashed"
|
|
15551
15551
|
});
|
|
15552
|
-
n.setSelectedAnnotation(s), n.setActiveTool("select"),
|
|
15552
|
+
n.setSelectedAnnotation(s), n.setActiveTool("select"), ht();
|
|
15553
15553
|
},
|
|
15554
15554
|
onPointerLeave() {
|
|
15555
15555
|
y.getState().setAnnotationDraft(null);
|
|
@@ -15566,7 +15566,7 @@ const pE = {
|
|
|
15566
15566
|
onPointerDown(e, t) {
|
|
15567
15567
|
if (e.button !== 0) return;
|
|
15568
15568
|
e.preventDefault();
|
|
15569
|
-
const n =
|
|
15569
|
+
const n = Ue(t.viewport.screenToSvg(e.clientX, e.clientY));
|
|
15570
15570
|
y.getState().setAnnotationDraft({
|
|
15571
15571
|
kind: "line",
|
|
15572
15572
|
start: n,
|
|
@@ -15578,14 +15578,14 @@ const pE = {
|
|
|
15578
15578
|
const n = y.getState(), o = n.annotationDraft;
|
|
15579
15579
|
o && n.setAnnotationDraft({
|
|
15580
15580
|
...o,
|
|
15581
|
-
current:
|
|
15581
|
+
current: Ue(t.viewport.screenToSvg(e.clientX, e.clientY)),
|
|
15582
15582
|
constrain: e.shiftKey
|
|
15583
15583
|
});
|
|
15584
15584
|
},
|
|
15585
15585
|
onPointerUp(e, t) {
|
|
15586
15586
|
const n = y.getState(), o = n.annotationDraft;
|
|
15587
15587
|
if (n.setAnnotationDraft(null), !o) return;
|
|
15588
|
-
const r =
|
|
15588
|
+
const r = Ue(t.viewport.screenToSvg(e.clientX, e.clientY)), i = sk({ ...o, current: r, constrain: e.shiftKey }), a = i[0] - o.start[0], s = i[1] - o.start[1];
|
|
15589
15589
|
if (Math.hypot(a, s) < GA) return;
|
|
15590
15590
|
const l = n.insertAnnotation({
|
|
15591
15591
|
type: "line",
|
|
@@ -15595,7 +15595,7 @@ const pE = {
|
|
|
15595
15595
|
[a, s]
|
|
15596
15596
|
]
|
|
15597
15597
|
});
|
|
15598
|
-
n.setSelectedAnnotation(l), n.setActiveTool("select"),
|
|
15598
|
+
n.setSelectedAnnotation(l), n.setActiveTool("select"), ht();
|
|
15599
15599
|
},
|
|
15600
15600
|
onPointerLeave() {
|
|
15601
15601
|
y.getState().setAnnotationDraft(null);
|
|
@@ -15612,7 +15612,7 @@ const pE = {
|
|
|
15612
15612
|
onPointerDown(e, t) {
|
|
15613
15613
|
if (e.button !== 0) return;
|
|
15614
15614
|
e.preventDefault();
|
|
15615
|
-
const n =
|
|
15615
|
+
const n = Ue(t.viewport.screenToSvg(e.clientX, e.clientY));
|
|
15616
15616
|
y.getState().setAnnotationDraft({
|
|
15617
15617
|
kind: "table",
|
|
15618
15618
|
start: n,
|
|
@@ -15624,18 +15624,18 @@ const pE = {
|
|
|
15624
15624
|
const n = y.getState(), o = n.annotationDraft;
|
|
15625
15625
|
o && n.setAnnotationDraft({
|
|
15626
15626
|
...o,
|
|
15627
|
-
current:
|
|
15627
|
+
current: Ue(t.viewport.screenToSvg(e.clientX, e.clientY))
|
|
15628
15628
|
});
|
|
15629
15629
|
},
|
|
15630
15630
|
onPointerUp(e, t) {
|
|
15631
15631
|
const n = y.getState(), o = n.annotationDraft;
|
|
15632
15632
|
if (n.setAnnotationDraft(null), !o) return;
|
|
15633
|
-
const r =
|
|
15633
|
+
const r = Ue(t.viewport.screenToSvg(e.clientX, e.clientY)), i = Math.abs(r[0] - o.start[0]), a = Math.abs(r[1] - o.start[1]), s = i < ui && a < ui, { at: l, cols: c, rows: d } = s ? { at: o.start, cols: yE, rows: wE } : ck({ ...o, current: r }), u = n.insertAnnotation({
|
|
15634
15634
|
type: "table",
|
|
15635
15635
|
at: l,
|
|
15636
15636
|
...dk(c, d)
|
|
15637
15637
|
});
|
|
15638
|
-
n.setSelectedAnnotation(u), n.setActiveTool("select"),
|
|
15638
|
+
n.setSelectedAnnotation(u), n.setActiveTool("select"), ht();
|
|
15639
15639
|
},
|
|
15640
15640
|
onPointerLeave() {
|
|
15641
15641
|
y.getState().setAnnotationDraft(null);
|
|
@@ -15823,7 +15823,7 @@ function AE(e, t, n = { tx: 0, ty: 0, scale: 1 }) {
|
|
|
15823
15823
|
function mo(e, t, n) {
|
|
15824
15824
|
return e < t ? t : e > n ? n : e;
|
|
15825
15825
|
}
|
|
15826
|
-
const Sk = typeof navigator < "u" && /Mac|iP(ad|hone|od)/.test(navigator.platform),
|
|
15826
|
+
const Sk = typeof navigator < "u" && /Mac|iP(ad|hone|od)/.test(navigator.platform), yt = Sk ? "⌘" : "Ctrl+", EE = Sk ? "⇧" : "Shift+", po = [10, 20, 50, 100, 200, 500, 1e3, 2e3, 5e3, 1e4], NE = 18;
|
|
15827
15827
|
function TE(e) {
|
|
15828
15828
|
for (const t of po)
|
|
15829
15829
|
if (t * e >= NE) return t;
|
|
@@ -15849,7 +15849,7 @@ function PE() {
|
|
|
15849
15849
|
yk();
|
|
15850
15850
|
return;
|
|
15851
15851
|
}
|
|
15852
|
-
const f = Xt(h), b = f ? null :
|
|
15852
|
+
const f = Xt(h), b = f ? null : _t(h);
|
|
15853
15853
|
if (f)
|
|
15854
15854
|
g.selectedAnnotations.includes(f) || g.setSelectedAnnotation(f);
|
|
15855
15855
|
else if (b)
|
|
@@ -15861,14 +15861,14 @@ function PE() {
|
|
|
15861
15861
|
const w = y.getState(), x = w.selection.length > 0, I = w.selectedAnnotations.length > 0, P = x || I, j = w.selectedNode != null, V = !!w.clipboard, S = w.diagram.elements.length > 0, H = [
|
|
15862
15862
|
{
|
|
15863
15863
|
label: e("menu.undo"),
|
|
15864
|
-
shortcut: `${
|
|
15864
|
+
shortcut: `${yt}Z`,
|
|
15865
15865
|
icon: jo,
|
|
15866
15866
|
onSelect: () => y.getState().undo(),
|
|
15867
15867
|
disabled: w.past.length === 0
|
|
15868
15868
|
},
|
|
15869
15869
|
{
|
|
15870
15870
|
label: e("menu.redo"),
|
|
15871
|
-
shortcut: `${
|
|
15871
|
+
shortcut: `${yt}${EE}Z`,
|
|
15872
15872
|
icon: Ro,
|
|
15873
15873
|
onSelect: () => y.getState().redo(),
|
|
15874
15874
|
disabled: w.future.length === 0
|
|
@@ -15876,21 +15876,21 @@ function PE() {
|
|
|
15876
15876
|
{ type: "separator" },
|
|
15877
15877
|
{
|
|
15878
15878
|
label: e("menu.cut"),
|
|
15879
|
-
shortcut: `${
|
|
15879
|
+
shortcut: `${yt}X`,
|
|
15880
15880
|
icon: Zi,
|
|
15881
15881
|
onSelect: () => y.getState().cutSelection(),
|
|
15882
15882
|
disabled: !P
|
|
15883
15883
|
},
|
|
15884
15884
|
{
|
|
15885
15885
|
label: e("menu.copy"),
|
|
15886
|
-
shortcut: `${
|
|
15886
|
+
shortcut: `${yt}C`,
|
|
15887
15887
|
icon: Ki,
|
|
15888
15888
|
onSelect: () => y.getState().copySelection(),
|
|
15889
15889
|
disabled: !P
|
|
15890
15890
|
},
|
|
15891
15891
|
{
|
|
15892
15892
|
label: e("menu.paste"),
|
|
15893
|
-
shortcut: `${
|
|
15893
|
+
shortcut: `${yt}V`,
|
|
15894
15894
|
icon: Vi,
|
|
15895
15895
|
onSelect: () => y.getState().pasteClipboard(),
|
|
15896
15896
|
disabled: !V
|
|
@@ -15913,7 +15913,7 @@ function PE() {
|
|
|
15913
15913
|
{ type: "separator" },
|
|
15914
15914
|
{
|
|
15915
15915
|
label: e("menu.selectAll"),
|
|
15916
|
-
shortcut: `${
|
|
15916
|
+
shortcut: `${yt}A`,
|
|
15917
15917
|
icon: A2,
|
|
15918
15918
|
onSelect: () => {
|
|
15919
15919
|
const F = y.getState();
|
|
@@ -16034,7 +16034,7 @@ function OE() {
|
|
|
16034
16034
|
return document.querySelector(".ole-canvas-root");
|
|
16035
16035
|
}
|
|
16036
16036
|
function _k() {
|
|
16037
|
-
const e =
|
|
16037
|
+
const e = Ze(), t = OE();
|
|
16038
16038
|
if (!e || !t) return !1;
|
|
16039
16039
|
const n = t.getBoundingClientRect();
|
|
16040
16040
|
if (n.width === 0 || n.height === 0) return !1;
|
|
@@ -16097,7 +16097,7 @@ function fi() {
|
|
|
16097
16097
|
};
|
|
16098
16098
|
return p = requestAnimationFrame(w), () => cancelAnimationFrame(p);
|
|
16099
16099
|
}, [n, e]), l || !n || !e || !c) return null;
|
|
16100
|
-
const d =
|
|
16100
|
+
const d = lt[c.kind], u = c.name ?? c.id, h = (d == null ? void 0 : d.name) ?? c.kind, g = c.name && c.name !== c.id;
|
|
16101
16101
|
return typeof document > "u" ? null : Wi(
|
|
16102
16102
|
/* @__PURE__ */ z(
|
|
16103
16103
|
"div",
|
|
@@ -16323,7 +16323,7 @@ function De({
|
|
|
16323
16323
|
},
|
|
16324
16324
|
"aria-describedby": a ? d : f["aria-describedby"]
|
|
16325
16325
|
});
|
|
16326
|
-
return /* @__PURE__ */ z(
|
|
16326
|
+
return /* @__PURE__ */ z(Ye, { children: [
|
|
16327
16327
|
b,
|
|
16328
16328
|
a && typeof document < "u" && Wi(
|
|
16329
16329
|
/* @__PURE__ */ m(
|
|
@@ -16404,7 +16404,7 @@ function t4() {
|
|
|
16404
16404
|
"aria-label": e(p ? "ctx.ariaWire" : f ? "ctx.ariaNode" : "ctx.ariaElement"),
|
|
16405
16405
|
className: "ole-glass pointer-events-auto fixed left-0 top-0 z-30 hidden items-center gap-0.5 rounded-2xl border border-border p-1 shadow-md",
|
|
16406
16406
|
children: [
|
|
16407
|
-
p && h && o && /* @__PURE__ */ z(
|
|
16407
|
+
p && h && o && /* @__PURE__ */ z(Ye, { children: [
|
|
16408
16408
|
/* @__PURE__ */ m(
|
|
16409
16409
|
De,
|
|
16410
16410
|
{
|
|
@@ -16427,7 +16427,7 @@ function t4() {
|
|
|
16427
16427
|
),
|
|
16428
16428
|
/* @__PURE__ */ m("div", { "aria-hidden": !0, className: "mx-0.5 h-4 w-px bg-border" })
|
|
16429
16429
|
] }),
|
|
16430
|
-
!b && /* @__PURE__ */ z(
|
|
16430
|
+
!b && /* @__PURE__ */ z(Ye, { children: [
|
|
16431
16431
|
/* @__PURE__ */ m(
|
|
16432
16432
|
De,
|
|
16433
16433
|
{
|
|
@@ -16541,7 +16541,7 @@ function o4() {
|
|
|
16541
16541
|
a.setEditingAnnotation(null);
|
|
16542
16542
|
return;
|
|
16543
16543
|
}
|
|
16544
|
-
if (
|
|
16544
|
+
if (qe(l) === "table" && a.editingCell) {
|
|
16545
16545
|
const u = document.querySelector(`${zo} input`), [h, g] = a.editingCell;
|
|
16546
16546
|
if (u) {
|
|
16547
16547
|
u.value = ((d = l.cells[h]) == null ? void 0 : d[g]) ?? "", u.blur();
|
|
@@ -16676,7 +16676,7 @@ function Pk() {
|
|
|
16676
16676
|
return document.querySelector(".ole-canvas-root");
|
|
16677
16677
|
}
|
|
16678
16678
|
function qo(e) {
|
|
16679
|
-
const t =
|
|
16679
|
+
const t = Ze(), n = Pk();
|
|
16680
16680
|
if (!t || !n) return;
|
|
16681
16681
|
const o = n.getBoundingClientRect(), r = o.width / 2, i = o.height / 2, a = t.getViewport(), s = s4(e, Ek, Nk), l = s / a.scale;
|
|
16682
16682
|
t.setViewport({
|
|
@@ -16686,13 +16686,13 @@ function qo(e) {
|
|
|
16686
16686
|
});
|
|
16687
16687
|
}
|
|
16688
16688
|
function l4() {
|
|
16689
|
-
const e =
|
|
16689
|
+
const e = Ze();
|
|
16690
16690
|
if (!e) return;
|
|
16691
16691
|
const t = e.getViewport().scale, n = Sn.find((o) => o > t + 1e-6) ?? Nk;
|
|
16692
16692
|
qo(n);
|
|
16693
16693
|
}
|
|
16694
16694
|
function c4() {
|
|
16695
|
-
const e =
|
|
16695
|
+
const e = Ze();
|
|
16696
16696
|
if (!e) return;
|
|
16697
16697
|
const t = e.getViewport().scale;
|
|
16698
16698
|
let n = Ek;
|
|
@@ -16706,7 +16706,7 @@ function c4() {
|
|
|
16706
16706
|
const yn = [
|
|
16707
16707
|
Rn,
|
|
16708
16708
|
6,
|
|
16709
|
-
|
|
16709
|
+
We,
|
|
16710
16710
|
8,
|
|
16711
16711
|
9,
|
|
16712
16712
|
10,
|
|
@@ -16727,12 +16727,12 @@ function d4(e) {
|
|
|
16727
16727
|
function Do(e) {
|
|
16728
16728
|
y.getState().dispatch((t) => {
|
|
16729
16729
|
const n = { ...t.meta ?? {} };
|
|
16730
|
-
return e ===
|
|
16730
|
+
return e === We ? delete n.labelFontSize : n.labelFontSize = e, { ...t, meta: n };
|
|
16731
16731
|
});
|
|
16732
16732
|
}
|
|
16733
16733
|
function Si(e) {
|
|
16734
16734
|
var o;
|
|
16735
|
-
const t =
|
|
16735
|
+
const t = $t(
|
|
16736
16736
|
(o = y.getState().diagram.meta) == null ? void 0 : o.labelFontSize
|
|
16737
16737
|
);
|
|
16738
16738
|
if (e > 0) {
|
|
@@ -16893,7 +16893,7 @@ function Bk() {
|
|
|
16893
16893
|
), n = y(
|
|
16894
16894
|
(r) => {
|
|
16895
16895
|
var i;
|
|
16896
|
-
return
|
|
16896
|
+
return $t((i = r.diagram.meta) == null ? void 0 : i.labelFontSize);
|
|
16897
16897
|
}
|
|
16898
16898
|
), o = [
|
|
16899
16899
|
{ value: "off", label: e("view.labelOff") },
|
|
@@ -16937,7 +16937,7 @@ function Bk() {
|
|
|
16937
16937
|
{
|
|
16938
16938
|
type: "button",
|
|
16939
16939
|
"aria-label": e("view.labelSizeReset"),
|
|
16940
|
-
onClick: () => Do(
|
|
16940
|
+
onClick: () => Do(We),
|
|
16941
16941
|
className: "w-9 rounded-md py-1 text-center font-mono text-[11px] tabular-nums hover:bg-accent hover:text-accent-foreground",
|
|
16942
16942
|
children: n
|
|
16943
16943
|
}
|
|
@@ -17049,7 +17049,7 @@ function m4({ stacked: e } = {}) {
|
|
|
17049
17049
|
);
|
|
17050
17050
|
}
|
|
17051
17051
|
function _i() {
|
|
17052
|
-
const e =
|
|
17052
|
+
const e = ct();
|
|
17053
17053
|
return !y((n) => n.readOnly) && Re(e, "dense") ? null : /* @__PURE__ */ m(p4, { tier: e });
|
|
17054
17054
|
}
|
|
17055
17055
|
function p4({ tier: e }) {
|
|
@@ -17184,7 +17184,7 @@ function h4() {
|
|
|
17184
17184
|
const g = Zt(h);
|
|
17185
17185
|
if (!g) return null;
|
|
17186
17186
|
const p = (f = h.diagram.annotations) == null ? void 0 : f.find((b) => b.id === g);
|
|
17187
|
-
return p ?
|
|
17187
|
+
return p ? qe(p) : null;
|
|
17188
17188
|
});
|
|
17189
17189
|
if (s)
|
|
17190
17190
|
return /* @__PURE__ */ m("div", { className: "ole-glass pointer-events-none flex items-center gap-2 rounded-full border border-border px-3 py-1 text-xs text-muted-foreground shadow-sm", children: /* @__PURE__ */ m("span", { children: e("mode.annEditing") }) });
|
|
@@ -17236,7 +17236,7 @@ function h4() {
|
|
|
17236
17236
|
] });
|
|
17237
17237
|
}
|
|
17238
17238
|
function f4() {
|
|
17239
|
-
const e = le(), t = y((w) => w.activeTool), n = y((w) => w.placeKind), o = y((w) => w.setActiveTool), r = y((w) => w.past.length), i = y((w) => w.future.length), a = y((w) => w.undo), s = y((w) => w.redo), l =
|
|
17239
|
+
const e = le(), t = y((w) => w.activeTool), n = y((w) => w.placeKind), o = y((w) => w.setActiveTool), r = y((w) => w.past.length), i = y((w) => w.future.length), a = y((w) => w.undo), s = y((w) => w.redo), l = ct(), c = Re(l, "tight"), d = !Re(l, "dense"), u = Re(l, "dense"), h = /* @__PURE__ */ new Set(["select", "text", "rect", "line", "table"]), g = u ? Ci.filter((w) => !h.has(w.id)) : Ci, p = (w) => t === w.switchTo, [f, b] = we(!1);
|
|
17240
17240
|
return /* @__PURE__ */ z(
|
|
17241
17241
|
"div",
|
|
17242
17242
|
{
|
|
@@ -17268,7 +17268,7 @@ function f4() {
|
|
|
17268
17268
|
const x = w.icon, I = p(w), P = w.id === "place" && I && n == null ? e("tool.placeNoKindTooltip") : e(w.descriptionKey);
|
|
17269
17269
|
return /* @__PURE__ */ z(a2, { children: [
|
|
17270
17270
|
/* @__PURE__ */ m(
|
|
17271
|
-
|
|
17271
|
+
xt,
|
|
17272
17272
|
{
|
|
17273
17273
|
icon: x,
|
|
17274
17274
|
label: e(w.labelKey),
|
|
@@ -17288,9 +17288,9 @@ function f4() {
|
|
|
17288
17288
|
] }, w.id);
|
|
17289
17289
|
}),
|
|
17290
17290
|
!u && /* @__PURE__ */ m("div", { "aria-hidden": !0, className: "mx-1 h-5 w-px bg-border" }),
|
|
17291
|
-
u ? /* @__PURE__ */ m(y4, { stacked: !0 }) : /* @__PURE__ */ z(
|
|
17291
|
+
u ? /* @__PURE__ */ m(y4, { stacked: !0 }) : /* @__PURE__ */ z(Ye, { children: [
|
|
17292
17292
|
/* @__PURE__ */ m(
|
|
17293
|
-
|
|
17293
|
+
xt,
|
|
17294
17294
|
{
|
|
17295
17295
|
icon: jo,
|
|
17296
17296
|
label: e("tool.undo"),
|
|
@@ -17302,7 +17302,7 @@ function f4() {
|
|
|
17302
17302
|
}
|
|
17303
17303
|
),
|
|
17304
17304
|
/* @__PURE__ */ m(
|
|
17305
|
-
|
|
17305
|
+
xt,
|
|
17306
17306
|
{
|
|
17307
17307
|
icon: Ro,
|
|
17308
17308
|
label: e("tool.redo"),
|
|
@@ -17327,7 +17327,7 @@ function f4() {
|
|
|
17327
17327
|
function g4({ stacked: e }) {
|
|
17328
17328
|
const t = le(), n = Yt((r) => r.outlineOpen), o = Yt((r) => r.toggleOutline);
|
|
17329
17329
|
return /* @__PURE__ */ m(
|
|
17330
|
-
|
|
17330
|
+
xt,
|
|
17331
17331
|
{
|
|
17332
17332
|
icon: Xi,
|
|
17333
17333
|
label: t("outline.title"),
|
|
@@ -17338,7 +17338,7 @@ function g4({ stacked: e }) {
|
|
|
17338
17338
|
}
|
|
17339
17339
|
);
|
|
17340
17340
|
}
|
|
17341
|
-
function
|
|
17341
|
+
function xt({
|
|
17342
17342
|
icon: e,
|
|
17343
17343
|
label: t,
|
|
17344
17344
|
hotkey: n,
|
|
@@ -17411,7 +17411,7 @@ function b4({ iconOnly: e }) {
|
|
|
17411
17411
|
open: n,
|
|
17412
17412
|
onOpenChange: o,
|
|
17413
17413
|
trigger: /* @__PURE__ */ m(
|
|
17414
|
-
|
|
17414
|
+
xt,
|
|
17415
17415
|
{
|
|
17416
17416
|
icon: jt,
|
|
17417
17417
|
label: t("layout.label"),
|
|
@@ -17473,7 +17473,7 @@ function y4({ stacked: e }) {
|
|
|
17473
17473
|
open: n,
|
|
17474
17474
|
onOpenChange: o,
|
|
17475
17475
|
trigger: /* @__PURE__ */ m(
|
|
17476
|
-
|
|
17476
|
+
xt,
|
|
17477
17477
|
{
|
|
17478
17478
|
icon: yo,
|
|
17479
17479
|
label: t("tool.more"),
|
|
@@ -17597,7 +17597,7 @@ function Be({
|
|
|
17597
17597
|
);
|
|
17598
17598
|
}
|
|
17599
17599
|
function w4() {
|
|
17600
|
-
const e = Yt((r) => r.outlineOpen), t = Yt((r) => r.setOutlineOpen), n =
|
|
17600
|
+
const e = Yt((r) => r.outlineOpen), t = Yt((r) => r.setOutlineOpen), n = ct();
|
|
17601
17601
|
return Re(n, "dense") ? e ? /* @__PURE__ */ m(
|
|
17602
17602
|
"div",
|
|
17603
17603
|
{
|
|
@@ -17623,7 +17623,7 @@ function w4() {
|
|
|
17623
17623
|
);
|
|
17624
17624
|
}
|
|
17625
17625
|
function v4({ onClick: e }) {
|
|
17626
|
-
const t = le(), n =
|
|
17626
|
+
const t = le(), n = ct(), o = Re(n, "compact");
|
|
17627
17627
|
return /* @__PURE__ */ z(
|
|
17628
17628
|
"button",
|
|
17629
17629
|
{
|
|
@@ -17646,7 +17646,7 @@ function $i({
|
|
|
17646
17646
|
onClose: e,
|
|
17647
17647
|
sheet: t
|
|
17648
17648
|
}) {
|
|
17649
|
-
const n = le(), o = y((c) => c.diagram.elements), r = y((c) => c.activeTool === "place"), i =
|
|
17649
|
+
const n = le(), o = y((c) => c.diagram.elements), r = y((c) => c.activeTool === "place"), i = ct(), a = Re(i, "compact"), s = Re(i, "dense"), l = t ? "min(50vh, calc(100vh - 9rem))" : r ? "min(40vh, calc(100vh - 200px))" : "min(70vh, calc(100vh - 100px))";
|
|
17650
17650
|
return /* @__PURE__ */ z(
|
|
17651
17651
|
"aside",
|
|
17652
17652
|
{
|
|
@@ -17677,7 +17677,7 @@ function $i({
|
|
|
17677
17677
|
);
|
|
17678
17678
|
}
|
|
17679
17679
|
function x4({ element: e }) {
|
|
17680
|
-
const t =
|
|
17680
|
+
const t = lt[e.kind], n = y((l) => l.selection.includes(e.id)), o = y((l) => l.setSelection), r = y((l) => l.toggleInSelection), i = ct(), a = !Re(i, "compact"), s = (l) => {
|
|
17681
17681
|
l.shiftKey || l.metaKey || l.ctrlKey ? r(e.id) : o([e.id]);
|
|
17682
17682
|
};
|
|
17683
17683
|
return /* @__PURE__ */ z(
|
|
@@ -18098,7 +18098,7 @@ function N4(e) {
|
|
|
18098
18098
|
}
|
|
18099
18099
|
}
|
|
18100
18100
|
function T4() {
|
|
18101
|
-
const e = le(), t = y((u) => u.activeTool === "place"), n = y((u) => u.placeKind), o = y((u) => u.setActiveTool), r = Yt((u) => u.outlineOpen), i =
|
|
18101
|
+
const e = le(), t = y((u) => u.activeTool === "place"), n = y((u) => u.placeKind), o = y((u) => u.setActiveTool), r = Yt((u) => u.outlineOpen), i = ct(), a = Re(i, "dense"), s = 68, c = a ? void 0 : `calc(100vh - ${s}px - ${r ? "calc(40vh + 20px)" : "68px"})`;
|
|
18102
18102
|
if (!t || a && n != null) return null;
|
|
18103
18103
|
const d = a ? {
|
|
18104
18104
|
top: `calc(${s}px + var(--ole-top-inset, 0px) + var(--ole-safe-top, 0px))`,
|
|
@@ -18161,7 +18161,7 @@ function P4({ sheet: e }) {
|
|
|
18161
18161
|
return h ? p.delete(u) : p.add(u), N4(p), p;
|
|
18162
18162
|
});
|
|
18163
18163
|
}, []);
|
|
18164
|
-
return /* @__PURE__ */ z(
|
|
18164
|
+
return /* @__PURE__ */ z(Ye, { children: [
|
|
18165
18165
|
/* @__PURE__ */ m("div", { className: "px-2 pb-1.5 pt-2", children: /* @__PURE__ */ m(I4, { value: o, onChange: r }) }),
|
|
18166
18166
|
/* @__PURE__ */ m("div", { className: "flex-1 overflow-y-auto px-2 pb-2", children: c ? /* @__PURE__ */ m("p", { className: "px-3 py-6 text-center text-xs text-muted-foreground", children: t("library.empty") }) : A4.map((u) => {
|
|
18167
18167
|
var b;
|
|
@@ -18409,10 +18409,10 @@ function L4() {
|
|
|
18409
18409
|
if (h) return /* @__PURE__ */ m(Y4, { junction: h });
|
|
18410
18410
|
const g = n.find((f) => f.id === d);
|
|
18411
18411
|
if (!g) return null;
|
|
18412
|
-
const p =
|
|
18412
|
+
const p = lt[g.kind];
|
|
18413
18413
|
return /* @__PURE__ */ z("div", { className: "flex flex-col gap-2.5 overflow-y-auto px-3 py-3 text-xs", children: [
|
|
18414
18414
|
/* @__PURE__ */ m(
|
|
18415
|
-
|
|
18415
|
+
et,
|
|
18416
18416
|
{
|
|
18417
18417
|
label: e("props.name"),
|
|
18418
18418
|
value: g.name ?? "",
|
|
@@ -18480,7 +18480,7 @@ function R4({
|
|
|
18480
18480
|
params: Object.keys(d).length > 0 ? d : void 0
|
|
18481
18481
|
});
|
|
18482
18482
|
};
|
|
18483
|
-
return n.type === "boolean" ? /* @__PURE__ */ m(
|
|
18483
|
+
return n.type === "boolean" ? /* @__PURE__ */ m(dt, { label: a, children: /* @__PURE__ */ m(Vo, { active: !!i, onClick: () => s(!i), children: o(i ? "common.yes" : "common.no") }) }) : n.type === "number" ? /* @__PURE__ */ m(
|
|
18484
18484
|
Un,
|
|
18485
18485
|
{
|
|
18486
18486
|
label: a,
|
|
@@ -18489,7 +18489,7 @@ function R4({
|
|
|
18489
18489
|
onCommit: s
|
|
18490
18490
|
}
|
|
18491
18491
|
) : /* @__PURE__ */ m(
|
|
18492
|
-
|
|
18492
|
+
et,
|
|
18493
18493
|
{
|
|
18494
18494
|
label: a,
|
|
18495
18495
|
value: typeof i == "string" ? i : "",
|
|
@@ -18510,8 +18510,8 @@ function j4({
|
|
|
18510
18510
|
params: Object.keys(s).length > 0 ? s : void 0
|
|
18511
18511
|
});
|
|
18512
18512
|
};
|
|
18513
|
-
return typeof o == "boolean" ? /* @__PURE__ */ m(
|
|
18514
|
-
|
|
18513
|
+
return typeof o == "boolean" ? /* @__PURE__ */ m(dt, { label: n, children: /* @__PURE__ */ m(Vo, { active: o, onClick: () => i(!o), children: r(o ? "common.yes" : "common.no") }) }) : typeof o == "number" ? /* @__PURE__ */ m(Un, { label: n, value: o, onCommit: i }) : /* @__PURE__ */ m(
|
|
18514
|
+
et,
|
|
18515
18515
|
{
|
|
18516
18516
|
label: n,
|
|
18517
18517
|
value: o,
|
|
@@ -18526,7 +18526,7 @@ function H4({ bus: e }) {
|
|
|
18526
18526
|
};
|
|
18527
18527
|
return /* @__PURE__ */ z("div", { className: "flex flex-col gap-2.5 overflow-y-auto px-3 py-3 text-xs", children: [
|
|
18528
18528
|
/* @__PURE__ */ m(
|
|
18529
|
-
|
|
18529
|
+
et,
|
|
18530
18530
|
{
|
|
18531
18531
|
label: t("props.name"),
|
|
18532
18532
|
value: e.name ?? "",
|
|
@@ -18576,12 +18576,12 @@ function W4({ annId: e }) {
|
|
|
18576
18576
|
if (!n)
|
|
18577
18577
|
return /* @__PURE__ */ m("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: t("props.annNotFound", { id: e }) });
|
|
18578
18578
|
const o = (r) => y.getState().updateAnnotation(e, r);
|
|
18579
|
-
switch (
|
|
18579
|
+
switch (qe(n)) {
|
|
18580
18580
|
case "rect": {
|
|
18581
18581
|
const r = n;
|
|
18582
18582
|
return /* @__PURE__ */ z("div", { className: "flex flex-col gap-2.5 px-3 py-3 text-xs", children: [
|
|
18583
18583
|
/* @__PURE__ */ m(
|
|
18584
|
-
|
|
18584
|
+
et,
|
|
18585
18585
|
{
|
|
18586
18586
|
label: t("props.annLabel"),
|
|
18587
18587
|
value: r.label ?? "",
|
|
@@ -18712,7 +18712,7 @@ function wn({
|
|
|
18712
18712
|
options: n,
|
|
18713
18713
|
onChange: o
|
|
18714
18714
|
}) {
|
|
18715
|
-
return /* @__PURE__ */ m(
|
|
18715
|
+
return /* @__PURE__ */ m(dt, { label: e, children: /* @__PURE__ */ m("div", { className: "flex overflow-hidden rounded-md border border-border/60", children: n.map((r) => /* @__PURE__ */ m(
|
|
18716
18716
|
"button",
|
|
18717
18717
|
{
|
|
18718
18718
|
type: "button",
|
|
@@ -18733,7 +18733,7 @@ function Ti({
|
|
|
18733
18733
|
min: n,
|
|
18734
18734
|
onChange: o
|
|
18735
18735
|
}) {
|
|
18736
|
-
return /* @__PURE__ */ m(
|
|
18736
|
+
return /* @__PURE__ */ m(dt, { label: e, children: /* @__PURE__ */ z("div", { className: "flex items-center gap-1", children: [
|
|
18737
18737
|
/* @__PURE__ */ m(
|
|
18738
18738
|
"button",
|
|
18739
18739
|
{
|
|
@@ -18765,7 +18765,7 @@ function Pi({
|
|
|
18765
18765
|
onCommit: n
|
|
18766
18766
|
}) {
|
|
18767
18767
|
return /* @__PURE__ */ m(
|
|
18768
|
-
|
|
18768
|
+
et,
|
|
18769
18769
|
{
|
|
18770
18770
|
label: e,
|
|
18771
18771
|
value: t != null ? String(t) : "",
|
|
@@ -18803,7 +18803,7 @@ function X4({ wireId: e }) {
|
|
|
18803
18803
|
/* @__PURE__ */ m("div", { className: "font-mono text-[12px]", children: l.id })
|
|
18804
18804
|
] }),
|
|
18805
18805
|
/* @__PURE__ */ m(
|
|
18806
|
-
|
|
18806
|
+
et,
|
|
18807
18807
|
{
|
|
18808
18808
|
label: t("props.label"),
|
|
18809
18809
|
value: l.label ?? "",
|
|
@@ -18847,7 +18847,7 @@ function Y4({ junction: e }) {
|
|
|
18847
18847
|
/* @__PURE__ */ m("div", { className: "font-mono text-[12px]", children: e.id })
|
|
18848
18848
|
] }),
|
|
18849
18849
|
/* @__PURE__ */ m(
|
|
18850
|
-
|
|
18850
|
+
et,
|
|
18851
18851
|
{
|
|
18852
18852
|
label: t("props.name"),
|
|
18853
18853
|
value: e.name ?? "",
|
|
@@ -18914,7 +18914,7 @@ function Z4({ nodeId: e }) {
|
|
|
18914
18914
|
}) })
|
|
18915
18915
|
] });
|
|
18916
18916
|
}
|
|
18917
|
-
function
|
|
18917
|
+
function dt({
|
|
18918
18918
|
label: e,
|
|
18919
18919
|
children: t
|
|
18920
18920
|
}) {
|
|
@@ -18923,7 +18923,7 @@ function ct({
|
|
|
18923
18923
|
/* @__PURE__ */ m("div", { className: "min-w-0 flex-1", children: t })
|
|
18924
18924
|
] });
|
|
18925
18925
|
}
|
|
18926
|
-
function
|
|
18926
|
+
function et({
|
|
18927
18927
|
label: e,
|
|
18928
18928
|
value: t,
|
|
18929
18929
|
placeholder: n,
|
|
@@ -18931,7 +18931,7 @@ function Je({
|
|
|
18931
18931
|
onCommit: r
|
|
18932
18932
|
}) {
|
|
18933
18933
|
const [i, a] = we(t), s = pe(null);
|
|
18934
|
-
return ie(() => a(t), [t]), /* @__PURE__ */ m(
|
|
18934
|
+
return ie(() => a(t), [t]), /* @__PURE__ */ m(dt, { label: e, children: /* @__PURE__ */ z("div", { className: "relative", children: [
|
|
18935
18935
|
/* @__PURE__ */ m(
|
|
18936
18936
|
"input",
|
|
18937
18937
|
{
|
|
@@ -18973,7 +18973,7 @@ function Go({
|
|
|
18973
18973
|
const u = s.current;
|
|
18974
18974
|
u.local === u.value || u.local === l.current || (l.current = u.local, u.onCommit(u.local));
|
|
18975
18975
|
}, d = pe(c);
|
|
18976
|
-
return d.current = c, ie(() => () => d.current(), []), /* @__PURE__ */ m(
|
|
18976
|
+
return d.current = c, ie(() => () => d.current(), []), /* @__PURE__ */ m(dt, { label: e, children: /* @__PURE__ */ m(
|
|
18977
18977
|
"textarea",
|
|
18978
18978
|
{
|
|
18979
18979
|
rows: 2,
|
|
@@ -19001,7 +19001,7 @@ function Un({
|
|
|
19001
19001
|
onCommit: r
|
|
19002
19002
|
}) {
|
|
19003
19003
|
const [i, a] = we(String(t)), s = pe(null);
|
|
19004
|
-
return ie(() => a(String(t)), [t]), /* @__PURE__ */ m(
|
|
19004
|
+
return ie(() => a(String(t)), [t]), /* @__PURE__ */ m(dt, { label: e, children: /* @__PURE__ */ z("div", { className: "relative", children: [
|
|
19005
19005
|
/* @__PURE__ */ m(
|
|
19006
19006
|
"input",
|
|
19007
19007
|
{
|
|
@@ -19058,7 +19058,7 @@ function J4({
|
|
|
19058
19058
|
state: Object.keys(d).length > 0 ? d : void 0
|
|
19059
19059
|
});
|
|
19060
19060
|
};
|
|
19061
|
-
return n.type === "boolean" ? /* @__PURE__ */ m(
|
|
19061
|
+
return n.type === "boolean" ? /* @__PURE__ */ m(dt, { label: i, children: /* @__PURE__ */ m(Vo, { active: !!a, onClick: () => s(!a), children: o(a ? "common.yes" : "common.no") }) }) : n.type === "number" ? /* @__PURE__ */ m(
|
|
19062
19062
|
Un,
|
|
19063
19063
|
{
|
|
19064
19064
|
label: i,
|
|
@@ -19066,7 +19066,7 @@ function J4({
|
|
|
19066
19066
|
onCommit: s
|
|
19067
19067
|
}
|
|
19068
19068
|
) : /* @__PURE__ */ m(
|
|
19069
|
-
|
|
19069
|
+
et,
|
|
19070
19070
|
{
|
|
19071
19071
|
label: i,
|
|
19072
19072
|
value: typeof a == "string" ? a : "",
|
|
@@ -19075,7 +19075,7 @@ function J4({
|
|
|
19075
19075
|
);
|
|
19076
19076
|
}
|
|
19077
19077
|
function eN() {
|
|
19078
|
-
const e = le(), t = nn(), n = y((p) => p.selection), o = y((p) => p.selectedNode), r = y((p) => p.selectedWire), i = y((p) => p.selectedAnnotations), a = y(Zt), s = y((p) => p.diagram.annotations), l = y((p) => p.diagram.elements), c = y((p) => p.diagram.buses), d =
|
|
19078
|
+
const e = le(), t = nn(), n = y((p) => p.selection), o = y((p) => p.selectedNode), r = y((p) => p.selectedWire), i = y((p) => p.selectedAnnotations), a = y(Zt), s = y((p) => p.diagram.annotations), l = y((p) => p.diagram.elements), c = y((p) => p.diagram.buses), d = ct(), u = Re(d, "dense");
|
|
19079
19079
|
if (n.length === 0 && i.length === 0 && !o && !r)
|
|
19080
19080
|
return null;
|
|
19081
19081
|
let h = e("props.title"), g = null;
|
|
@@ -19084,7 +19084,7 @@ function eN() {
|
|
|
19084
19084
|
else if (o)
|
|
19085
19085
|
h = e("props.node");
|
|
19086
19086
|
else if (a) {
|
|
19087
|
-
const p = (s ?? []).find((b) => b.id === a), f = p ?
|
|
19087
|
+
const p = (s ?? []).find((b) => b.id === a), f = p ? qe(p) : "text";
|
|
19088
19088
|
h = e(f === "rect" ? "props.annRect" : f === "line" ? "props.annLine" : f === "table" ? "props.annTable" : "props.annText");
|
|
19089
19089
|
} else if (n.length === 1 && i.length === 0) {
|
|
19090
19090
|
const p = n[0], f = (c ?? []).find((b) => b.id === p);
|
|
@@ -19093,7 +19093,7 @@ function eN() {
|
|
|
19093
19093
|
else {
|
|
19094
19094
|
const b = l.find((w) => w.id === p);
|
|
19095
19095
|
if (b) {
|
|
19096
|
-
const w =
|
|
19096
|
+
const w = lt[b.kind];
|
|
19097
19097
|
h = w ? t(`${w.id}.name`, w.name) : b.kind;
|
|
19098
19098
|
}
|
|
19099
19099
|
}
|
|
@@ -19153,11 +19153,11 @@ function nN() {
|
|
|
19153
19153
|
e ? (
|
|
19154
19154
|
// View-only: canvas + zoom/fit controls + hover labels, no editing
|
|
19155
19155
|
// chrome (panels, tools, contextual/library popovers, onboarding).
|
|
19156
|
-
/* @__PURE__ */ z(
|
|
19156
|
+
/* @__PURE__ */ z(Ye, { children: [
|
|
19157
19157
|
/* @__PURE__ */ m(_i, {}),
|
|
19158
19158
|
/* @__PURE__ */ m(fi, {})
|
|
19159
19159
|
] })
|
|
19160
|
-
) : /* @__PURE__ */ z(
|
|
19160
|
+
) : /* @__PURE__ */ z(Ye, { children: [
|
|
19161
19161
|
/* @__PURE__ */ m(w4, {}),
|
|
19162
19162
|
/* @__PURE__ */ m(eN, {}),
|
|
19163
19163
|
/* @__PURE__ */ m(f4, {}),
|
|
@@ -19391,27 +19391,27 @@ function cN() {
|
|
|
19391
19391
|
}
|
|
19392
19392
|
} };
|
|
19393
19393
|
}
|
|
19394
|
-
const fo = "WIRES",
|
|
19394
|
+
const fo = "WIRES", tt = "ELEMENTS", go = "LABELS", Fe = "ANNOTATIONS", Mi = 32, Di = 64, dN = 8, uN = 1.25, mN = 6;
|
|
19395
19395
|
function pN(e, t = {}) {
|
|
19396
19396
|
var a, s;
|
|
19397
19397
|
const n = new AN(t.precision ?? 6);
|
|
19398
19398
|
n.header(t.title), n.tables([
|
|
19399
19399
|
{ name: fo, color: 7 },
|
|
19400
|
-
{ name:
|
|
19400
|
+
{ name: tt, color: 7 },
|
|
19401
19401
|
{ name: go, color: 8 },
|
|
19402
|
-
{ name:
|
|
19402
|
+
{ name: Fe, color: 3 }
|
|
19403
19403
|
]), n.beginEntities();
|
|
19404
19404
|
for (const l of e.wireRenders.values())
|
|
19405
|
-
l.path.length < 2 || n.
|
|
19405
|
+
l.path.length < 2 || n.polyline(fo, l.path.map(ve), !1);
|
|
19406
19406
|
for (const { geometry: l } of e.buses.values()) {
|
|
19407
19407
|
const { axis: c, at: d, span: u } = l, h = u / 2, g = c === "x" ? [d[0] - h, d[1]] : [d[0], d[1] - h], p = c === "x" ? [d[0] + h, d[1]] : [d[0], d[1] + h];
|
|
19408
|
-
n.
|
|
19408
|
+
n.polyline(fo, [g, p].map(ve), !1);
|
|
19409
19409
|
}
|
|
19410
19410
|
for (const l of e.elements.values()) {
|
|
19411
19411
|
const c = e.layout.get(l.element.id), d = l.libraryDef;
|
|
19412
19412
|
!c || !d || fN(n, d.svg, c);
|
|
19413
19413
|
}
|
|
19414
|
-
const o = t.labelMode ?? "all", r =
|
|
19414
|
+
const o = t.labelMode ?? "all", r = $t(t.labelFontSize), i = Qt(r);
|
|
19415
19415
|
if (o !== "off") {
|
|
19416
19416
|
for (const l of e.elements.values()) {
|
|
19417
19417
|
const c = e.layout.get(l.element.id);
|
|
@@ -19438,11 +19438,11 @@ function pN(e, t = {}) {
|
|
|
19438
19438
|
}
|
|
19439
19439
|
}
|
|
19440
19440
|
for (const l of t.annotations ?? [])
|
|
19441
|
-
switch (
|
|
19441
|
+
switch (qe(l)) {
|
|
19442
19442
|
case "rect": {
|
|
19443
19443
|
const c = l, [d, u] = c.at, [h, g] = c.size;
|
|
19444
|
-
if (n.
|
|
19445
|
-
|
|
19444
|
+
if (n.polyline(
|
|
19445
|
+
Fe,
|
|
19446
19446
|
[
|
|
19447
19447
|
[d, u],
|
|
19448
19448
|
[d + h, u],
|
|
@@ -19452,25 +19452,25 @@ function pN(e, t = {}) {
|
|
|
19452
19452
|
!0
|
|
19453
19453
|
), c.label) {
|
|
19454
19454
|
const p = ve([
|
|
19455
|
-
d +
|
|
19456
|
-
u +
|
|
19455
|
+
d + kt,
|
|
19456
|
+
u + kt + Xe
|
|
19457
19457
|
]);
|
|
19458
|
-
n.text(
|
|
19458
|
+
n.text(Fe, p, c.label, Xe, 0, !1);
|
|
19459
19459
|
}
|
|
19460
19460
|
break;
|
|
19461
19461
|
}
|
|
19462
19462
|
case "line": {
|
|
19463
19463
|
const c = l, d = en(c);
|
|
19464
19464
|
if (d.length < 2) break;
|
|
19465
|
-
n.
|
|
19465
|
+
n.polyline(Fe, d.map(ve), !1);
|
|
19466
19466
|
for (const u of Wo(d, c.arrow))
|
|
19467
|
-
n.
|
|
19467
|
+
n.polyline(Fe, u.map(ve), !0);
|
|
19468
19468
|
break;
|
|
19469
19469
|
}
|
|
19470
19470
|
case "table": {
|
|
19471
|
-
const c = l, [d, u] = c.at, [h, g] =
|
|
19472
|
-
n.
|
|
19473
|
-
|
|
19471
|
+
const c = l, [d, u] = c.at, [h, g] = Je(c), p = At(c), f = Et(c), b = c.fontSize ?? Xe;
|
|
19472
|
+
n.polyline(
|
|
19473
|
+
Fe,
|
|
19474
19474
|
[
|
|
19475
19475
|
[d, u],
|
|
19476
19476
|
[d + h, u],
|
|
@@ -19481,13 +19481,13 @@ function pN(e, t = {}) {
|
|
|
19481
19481
|
);
|
|
19482
19482
|
for (let w = 1; w < c.colWidths.length; w++)
|
|
19483
19483
|
n.line(
|
|
19484
|
-
|
|
19484
|
+
Fe,
|
|
19485
19485
|
ve([d + p[w], u]),
|
|
19486
19486
|
ve([d + p[w], u + g])
|
|
19487
19487
|
);
|
|
19488
19488
|
for (let w = 1; w < c.rowHeights.length; w++)
|
|
19489
19489
|
n.line(
|
|
19490
|
-
|
|
19490
|
+
Fe,
|
|
19491
19491
|
ve([d, u + f[w]]),
|
|
19492
19492
|
ve([d + h, u + f[w]])
|
|
19493
19493
|
);
|
|
@@ -19499,7 +19499,7 @@ function pN(e, t = {}) {
|
|
|
19499
19499
|
d + p[x] + Vt,
|
|
19500
19500
|
u + f[w] + c.rowHeights[w] / 2 + b * 0.35
|
|
19501
19501
|
]);
|
|
19502
|
-
n.text(
|
|
19502
|
+
n.text(Fe, P, I, b, 0, !1);
|
|
19503
19503
|
}
|
|
19504
19504
|
break;
|
|
19505
19505
|
}
|
|
@@ -19513,7 +19513,7 @@ function pN(e, t = {}) {
|
|
|
19513
19513
|
c.at[0],
|
|
19514
19514
|
c.at[1] + (h + 1) * d * uN
|
|
19515
19515
|
]);
|
|
19516
|
-
n.text(
|
|
19516
|
+
n.text(Fe, [g, p], u[h], d, 0, !1);
|
|
19517
19517
|
}
|
|
19518
19518
|
break;
|
|
19519
19519
|
}
|
|
@@ -19558,14 +19558,14 @@ function fN(e, t, n) {
|
|
|
19558
19558
|
}
|
|
19559
19559
|
}
|
|
19560
19560
|
function gN(e, t, n) {
|
|
19561
|
-
const o = Ae(t, "x1"), r = Ae(t, "y1"), i = Ae(t, "x2"), a = Ae(t, "y2"), s = ve(
|
|
19562
|
-
e.line(
|
|
19561
|
+
const o = Ae(t, "x1"), r = Ae(t, "y1"), i = Ae(t, "x2"), a = Ae(t, "y2"), s = ve(Qe([o, r], n)), l = ve(Qe([i, a], n));
|
|
19562
|
+
e.line(tt, s, l);
|
|
19563
19563
|
}
|
|
19564
19564
|
function Oi(e, t, n, o) {
|
|
19565
19565
|
const r = $N(t.getAttribute("points") ?? "");
|
|
19566
19566
|
if (r.length < 2) return;
|
|
19567
|
-
const i = r.map((a) => ve(
|
|
19568
|
-
e.
|
|
19567
|
+
const i = r.map((a) => ve(Qe(a, n)));
|
|
19568
|
+
e.polyline(tt, i, o);
|
|
19569
19569
|
}
|
|
19570
19570
|
function bN(e, t, n) {
|
|
19571
19571
|
const o = Ae(t, "x"), r = Ae(t, "y"), i = Ae(t, "width"), a = Ae(t, "height"), l = [
|
|
@@ -19573,12 +19573,12 @@ function bN(e, t, n) {
|
|
|
19573
19573
|
[o + i, r],
|
|
19574
19574
|
[o + i, r + a],
|
|
19575
19575
|
[o, r + a]
|
|
19576
|
-
].map((c) => ve(
|
|
19577
|
-
e.
|
|
19576
|
+
].map((c) => ve(Qe(c, n)));
|
|
19577
|
+
e.polyline(tt, l, !0);
|
|
19578
19578
|
}
|
|
19579
19579
|
function yN(e, t, n) {
|
|
19580
|
-
const o = Ae(t, "cx"), r = Ae(t, "cy"), i = Ae(t, "r"), a = ve(
|
|
19581
|
-
e.circle(
|
|
19580
|
+
const o = Ae(t, "cx"), r = Ae(t, "cy"), i = Ae(t, "r"), a = ve(Qe([o, r], n));
|
|
19581
|
+
e.circle(tt, a, i);
|
|
19582
19582
|
}
|
|
19583
19583
|
function wN(e, t, n) {
|
|
19584
19584
|
const o = Ae(t, "cx"), r = Ae(t, "cy"), i = Ae(t, "rx"), a = Ae(t, "ry");
|
|
@@ -19589,8 +19589,8 @@ function wN(e, t, n) {
|
|
|
19589
19589
|
xN(e, o, r, i, a, n);
|
|
19590
19590
|
}
|
|
19591
19591
|
function vN(e, t, n, o, r) {
|
|
19592
|
-
const i = ve(
|
|
19593
|
-
e.circle(
|
|
19592
|
+
const i = ve(Qe([t, n], r));
|
|
19593
|
+
e.circle(tt, i, o);
|
|
19594
19594
|
}
|
|
19595
19595
|
function xN(e, t, n, o, r, i) {
|
|
19596
19596
|
const a = [];
|
|
@@ -19598,26 +19598,26 @@ function xN(e, t, n, o, r, i) {
|
|
|
19598
19598
|
const l = s / Di * Math.PI * 2;
|
|
19599
19599
|
a.push(
|
|
19600
19600
|
ve(
|
|
19601
|
-
|
|
19601
|
+
Qe([t + o * Math.cos(l), n + r * Math.sin(l)], i)
|
|
19602
19602
|
)
|
|
19603
19603
|
);
|
|
19604
19604
|
}
|
|
19605
|
-
e.
|
|
19605
|
+
e.polyline(tt, a, !0);
|
|
19606
19606
|
}
|
|
19607
19607
|
function kN(e, t, n) {
|
|
19608
19608
|
const o = Ae(t, "x"), r = Ae(t, "y"), i = parseFloat(t.getAttribute("font-size") ?? "") || mN, a = (t.textContent ?? "").trim();
|
|
19609
19609
|
if (!a) return;
|
|
19610
|
-
const s = ve(
|
|
19611
|
-
e.text(
|
|
19610
|
+
const s = ve(Qe([o, r], n));
|
|
19611
|
+
e.text(tt, s, a, i, n.rot, n.mirror);
|
|
19612
19612
|
}
|
|
19613
19613
|
function SN(e, t, n) {
|
|
19614
19614
|
const o = t.getAttribute("d") ?? "", r = _N(o);
|
|
19615
19615
|
if (r.length === 0) return;
|
|
19616
19616
|
let i = null, a = [];
|
|
19617
19617
|
const s = () => {
|
|
19618
|
-
a.length >= 2 && e.
|
|
19619
|
-
|
|
19620
|
-
a.map((l) => ve(
|
|
19618
|
+
a.length >= 2 && e.polyline(
|
|
19619
|
+
tt,
|
|
19620
|
+
a.map((l) => ve(Qe(l, n))),
|
|
19621
19621
|
!1
|
|
19622
19622
|
), a = [];
|
|
19623
19623
|
};
|
|
@@ -19680,7 +19680,7 @@ function CN(e, t, n, o, r, i) {
|
|
|
19680
19680
|
);
|
|
19681
19681
|
return !i && L > 0 ? L -= 2 * Math.PI : i && L < 0 && (L += 2 * Math.PI), { cx: S, cy: H, theta1: Z, delta: L };
|
|
19682
19682
|
}
|
|
19683
|
-
function
|
|
19683
|
+
function Qe(e, t) {
|
|
19684
19684
|
return je(e, t);
|
|
19685
19685
|
}
|
|
19686
19686
|
function ve(e) {
|
|
@@ -19697,16 +19697,42 @@ function $N(e) {
|
|
|
19697
19697
|
}
|
|
19698
19698
|
class AN {
|
|
19699
19699
|
constructor(t) {
|
|
19700
|
-
|
|
19700
|
+
He(this, "out", []);
|
|
19701
19701
|
// Explicit field + assignment rather than a constructor parameter
|
|
19702
19702
|
// property — embedding consumers (load-survey) compile this file
|
|
19703
19703
|
// through their own tsconfig with `erasableSyntaxOnly: true`, which
|
|
19704
19704
|
// rejects non-erasable TS syntax like ``private readonly precision``.
|
|
19705
|
-
|
|
19705
|
+
He(this, "precision");
|
|
19706
|
+
/** Drawing extents, accumulated as entities are written. */
|
|
19707
|
+
He(this, "minX", 1 / 0);
|
|
19708
|
+
He(this, "minY", 1 / 0);
|
|
19709
|
+
He(this, "maxX", -1 / 0);
|
|
19710
|
+
He(this, "maxY", -1 / 0);
|
|
19711
|
+
/** Index in `out` reserved by `header()` for the extents group codes. */
|
|
19712
|
+
He(this, "extentsSlot", -1);
|
|
19706
19713
|
this.precision = t;
|
|
19707
19714
|
}
|
|
19715
|
+
track(t, n) {
|
|
19716
|
+
!Number.isFinite(t) || !Number.isFinite(n) || (t < this.minX && (this.minX = t), t > this.maxX && (this.maxX = t), n < this.minY && (this.minY = n), n > this.maxY && (this.maxY = n));
|
|
19717
|
+
}
|
|
19708
19718
|
toString() {
|
|
19709
|
-
return this.
|
|
19719
|
+
return this.extentsSlot >= 0 && Number.isFinite(this.minX) && (this.out[this.extentsSlot] = `9
|
|
19720
|
+
$EXTMIN
|
|
19721
|
+
10
|
|
19722
|
+
${this.fmt(this.minX)}
|
|
19723
|
+
20
|
|
19724
|
+
${this.fmt(this.minY)}
|
|
19725
|
+
30
|
|
19726
|
+
0
|
|
19727
|
+
9
|
|
19728
|
+
$EXTMAX
|
|
19729
|
+
10
|
|
19730
|
+
${this.fmt(this.maxX)}
|
|
19731
|
+
20
|
|
19732
|
+
${this.fmt(this.maxY)}
|
|
19733
|
+
30
|
|
19734
|
+
0
|
|
19735
|
+
`), this.out.join("");
|
|
19710
19736
|
}
|
|
19711
19737
|
g(t, n) {
|
|
19712
19738
|
this.out.push(`${t}
|
|
@@ -19717,7 +19743,7 @@ ${this.fmt(n)}
|
|
|
19717
19743
|
return typeof t == "number" ? Number.isFinite(t) ? Number.isInteger(t) ? String(t) : t.toFixed(this.precision) : "0" : t;
|
|
19718
19744
|
}
|
|
19719
19745
|
header(t) {
|
|
19720
|
-
this.g(0, "SECTION"), this.g(2, "HEADER"), this.g(9, "$ACADVER"), this.g(1, "AC1009"), this.g(9, "$INSUNITS"), this.g(70, 0), t && (this.g(9, "$PROJECTNAME"), this.g(1, Li(t))), this.g(0, "ENDSEC");
|
|
19746
|
+
this.g(0, "SECTION"), this.g(2, "HEADER"), this.g(9, "$ACADVER"), this.g(1, "AC1009"), this.g(9, "$INSUNITS"), this.g(70, 0), this.extentsSlot = this.out.length, this.out.push(""), t && (this.g(9, "$PROJECTNAME"), this.g(1, Li(t))), this.g(0, "ENDSEC");
|
|
19721
19747
|
}
|
|
19722
19748
|
tables(t) {
|
|
19723
19749
|
this.g(0, "SECTION"), this.g(2, "TABLES"), this.g(0, "TABLE"), this.g(2, "LAYER"), this.g(70, t.length);
|
|
@@ -19732,20 +19758,38 @@ ${this.fmt(n)}
|
|
|
19732
19758
|
this.g(0, "ENDSEC"), this.g(0, "EOF");
|
|
19733
19759
|
}
|
|
19734
19760
|
line(t, n, o) {
|
|
19735
|
-
this.g(0, "LINE"), this.g(8, t), this.g(10, n[0]), this.g(20, n[1]), this.g(30, 0), this.g(11, o[0]), this.g(21, o[1]), this.g(31, 0);
|
|
19761
|
+
this.g(0, "LINE"), this.g(8, t), this.g(10, n[0]), this.g(20, n[1]), this.g(30, 0), this.g(11, o[0]), this.g(21, o[1]), this.g(31, 0), this.track(n[0], n[1]), this.track(o[0], o[1]);
|
|
19736
19762
|
}
|
|
19737
|
-
|
|
19763
|
+
/**
|
|
19764
|
+
* Polyline, as R12 `POLYLINE` / `VERTEX` / `SEQEND`.
|
|
19765
|
+
*
|
|
19766
|
+
* This used to emit `LWPOLYLINE`, which is a bug that made every exported
|
|
19767
|
+
* file unopenable: the header declares `$ACADVER = AC1009` (R12), and
|
|
19768
|
+
* `LWPOLYLINE` did not exist until R14. A reader that honours the header
|
|
19769
|
+
* skips the entity — and since every wire and bus is one, the electrical
|
|
19770
|
+
* content simply vanished. A reader that goes by entity type instead hit a
|
|
19771
|
+
* `LWPOLYLINE` with no `AcDbEntity`/`AcDbPolyline` subclass markers (R13+
|
|
19772
|
+
* requires them) and rejected the whole file; `ezdxf` cannot even recover it.
|
|
19773
|
+
* Reported in the field as "dxf downloaded is blank".
|
|
19774
|
+
*
|
|
19775
|
+
* R12 is the right target — the rest of this writer is R12-shaped (no BLOCKS
|
|
19776
|
+
* section, no handles), so promoting `$ACADVER` instead would mean adding
|
|
19777
|
+
* handles to every entity. `POLYLINE` is R12's own polyline and is read by
|
|
19778
|
+
* everything from AutoCAD R12 to current.
|
|
19779
|
+
*/
|
|
19780
|
+
polyline(t, n, o) {
|
|
19738
19781
|
if (!(n.length < 2)) {
|
|
19739
|
-
this.g(0, "
|
|
19782
|
+
this.g(0, "POLYLINE"), this.g(8, t), this.g(66, 1), this.g(70, o ? 1 : 0), this.g(10, 0), this.g(20, 0), this.g(30, 0);
|
|
19740
19783
|
for (const [r, i] of n)
|
|
19741
|
-
this.g(10, r), this.g(20, i);
|
|
19784
|
+
this.g(0, "VERTEX"), this.g(8, t), this.g(10, r), this.g(20, i), this.g(30, 0), this.track(r, i);
|
|
19785
|
+
this.g(0, "SEQEND"), this.g(8, t);
|
|
19742
19786
|
}
|
|
19743
19787
|
}
|
|
19744
19788
|
circle(t, n, o) {
|
|
19745
|
-
this.g(0, "CIRCLE"), this.g(8, t), this.g(10, n[0]), this.g(20, n[1]), this.g(30, 0), this.g(40, o);
|
|
19789
|
+
this.g(0, "CIRCLE"), this.g(8, t), this.g(10, n[0]), this.g(20, n[1]), this.g(30, 0), this.g(40, o), this.track(n[0] - o, n[1] - o), this.track(n[0] + o, n[1] + o);
|
|
19746
19790
|
}
|
|
19747
19791
|
text(t, n, o, r, i, a, s = "start") {
|
|
19748
|
-
this.g(0, "TEXT"), this.g(8, t), this.g(10, n[0]), this.g(20, n[1]), this.g(30, 0), this.g(40, r), this.g(1, Li(o)), i !== 0 && this.g(50, i), a && this.g(71, 2), s !== "start" && (this.g(72, s === "middle" ? 1 : 2), this.g(11, n[0]), this.g(21, n[1]), this.g(31, 0));
|
|
19792
|
+
this.g(0, "TEXT"), this.g(8, t), this.g(10, n[0]), this.g(20, n[1]), this.g(30, 0), this.g(40, r), this.g(1, Li(o)), this.track(n[0], n[1]), this.track(n[0], n[1] + r), i !== 0 && this.g(50, i), a && this.g(71, 2), s !== "start" && (this.g(72, s === "middle" ? 1 : 2), this.g(11, n[0]), this.g(21, n[1]), this.g(31, 0));
|
|
19749
19793
|
}
|
|
19750
19794
|
}
|
|
19751
19795
|
function Li(e) {
|
|
@@ -19757,7 +19801,7 @@ function qk(e, t = {}) {
|
|
|
19757
19801
|
const n = MN(e, t), o = Math.floor(n.minX - xn), r = Math.floor(n.minY - xn), i = Math.ceil(n.maxX + xn) - o, a = Math.ceil(n.maxY + xn) - r, s = t.background ?? "#FFFFFF", l = [];
|
|
19758
19802
|
l.push('<?xml version="1.0" encoding="UTF-8"?>'), l.push(
|
|
19759
19803
|
`<svg xmlns="${EN}" viewBox="${o} ${r} ${i} ${a}" width="${i}" height="${a}">`
|
|
19760
|
-
), t.title && l.push(` <title>${
|
|
19804
|
+
), t.title && l.push(` <title>${Ke(t.title)}</title>`), s !== "transparent" && l.push(
|
|
19761
19805
|
` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="${s}"/>`
|
|
19762
19806
|
), l.push(' <g fill="none" stroke="black" stroke-width="1">');
|
|
19763
19807
|
for (const p of e.wireRenders.values()) {
|
|
@@ -19769,21 +19813,21 @@ function qk(e, t = {}) {
|
|
|
19769
19813
|
for (const { bus: p, geometry: f } of e.buses.values()) {
|
|
19770
19814
|
const { axis: b, at: w, span: x } = f, I = x / 2, P = b === "x" ? w[0] - I : w[0], j = b === "x" ? w[1] : w[1] - I, V = b === "x" ? w[0] + I : w[0], S = b === "x" ? w[1] : w[1] + I;
|
|
19771
19815
|
l.push(
|
|
19772
|
-
` <line id="${
|
|
19816
|
+
` <line id="${Ke(p.id)}" x1="${P}" y1="${j}" x2="${V}" y2="${S}" stroke="black" stroke-width="3" stroke-linecap="round" fill="none"/>`
|
|
19773
19817
|
);
|
|
19774
19818
|
}
|
|
19775
19819
|
for (const { junction: p, world: f, degree: b } of e.junctions.values())
|
|
19776
19820
|
b < 3 || l.push(
|
|
19777
|
-
` <circle id="${
|
|
19821
|
+
` <circle id="${Ke(p.id)}" cx="${f[0]}" cy="${f[1]}" r="3.5" fill="black"/>`
|
|
19778
19822
|
);
|
|
19779
19823
|
for (const p of e.elements.values()) {
|
|
19780
19824
|
if (!p.libraryDef) continue;
|
|
19781
19825
|
const f = e.layout.get(p.element.id);
|
|
19782
19826
|
f && (l.push(
|
|
19783
|
-
` <g id="${
|
|
19827
|
+
` <g id="${Ke(p.element.id)}" transform="${st(f)}">`
|
|
19784
19828
|
), l.push(` ${p.libraryDef.svg}`), l.push(" </g>"));
|
|
19785
19829
|
}
|
|
19786
|
-
const c = t.labelMode ?? "all", d =
|
|
19830
|
+
const c = t.labelMode ?? "all", d = $t(t.labelFontSize), u = Qt(d);
|
|
19787
19831
|
if (c !== "off") {
|
|
19788
19832
|
const p = s === "transparent" ? "#FFFFFF" : s;
|
|
19789
19833
|
l.push(
|
|
@@ -19801,7 +19845,7 @@ function qk(e, t = {}) {
|
|
|
19801
19845
|
} = Wn(x, f.libraryDef, b, w.length, d);
|
|
19802
19846
|
for (let S = 0; S < w.length; S++)
|
|
19803
19847
|
l.push(
|
|
19804
|
-
` <text x="${I}" y="${P + V + S * u}" text-anchor="${j}">${
|
|
19848
|
+
` <text x="${I}" y="${P + V + S * u}" text-anchor="${j}">${Ke(w[S])}</text>`
|
|
19805
19849
|
);
|
|
19806
19850
|
}
|
|
19807
19851
|
for (const f of e.wireRenders.values()) {
|
|
@@ -19809,7 +19853,7 @@ function qk(e, t = {}) {
|
|
|
19809
19853
|
if (!b) continue;
|
|
19810
19854
|
const w = qn(f.path, d);
|
|
19811
19855
|
w && l.push(
|
|
19812
|
-
` <text x="${w.world[0]}" y="${w.world[1]}" text-anchor="${w.textAnchor}">${
|
|
19856
|
+
` <text x="${w.world[0]}" y="${w.world[1]}" text-anchor="${w.textAnchor}">${Ke(b)}</text>`
|
|
19813
19857
|
);
|
|
19814
19858
|
}
|
|
19815
19859
|
l.push(" </g>");
|
|
@@ -19818,7 +19862,7 @@ function qk(e, t = {}) {
|
|
|
19818
19862
|
if (h.length > 0) {
|
|
19819
19863
|
const p = s === "transparent" ? "#FFFFFF" : s, f = s === "transparent" ? "none" : s, b = `font-family="ui-sans-serif, system-ui, sans-serif" paint-order="stroke" stroke="${p}" stroke-width="2" stroke-linejoin="round"`;
|
|
19820
19864
|
for (const w of h)
|
|
19821
|
-
switch (
|
|
19865
|
+
switch (qe(w)) {
|
|
19822
19866
|
case "rect":
|
|
19823
19867
|
PN(l, w, b);
|
|
19824
19868
|
break;
|
|
@@ -19838,13 +19882,13 @@ function qk(e, t = {}) {
|
|
|
19838
19882
|
}
|
|
19839
19883
|
function TN(e, t, n) {
|
|
19840
19884
|
if (!t.text) return;
|
|
19841
|
-
const o = t.fontSize ??
|
|
19885
|
+
const o = t.fontSize ?? Xe, r = t.text.split(`
|
|
19842
19886
|
`);
|
|
19843
19887
|
e.push(` <g fill="black" ${n}>`);
|
|
19844
19888
|
for (let i = 0; i < r.length; i++) {
|
|
19845
19889
|
const a = t.at[1] + o * 0.85 + i * o * NN;
|
|
19846
19890
|
e.push(
|
|
19847
|
-
` <text x="${t.at[0]}" y="${a}" font-size="${o}">${
|
|
19891
|
+
` <text x="${t.at[0]}" y="${a}" font-size="${o}">${Ke(r[i])}</text>`
|
|
19848
19892
|
);
|
|
19849
19893
|
}
|
|
19850
19894
|
e.push(" </g>");
|
|
@@ -19856,7 +19900,7 @@ function PN(e, t, n) {
|
|
|
19856
19900
|
), e.push(
|
|
19857
19901
|
` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="none" stroke="black" stroke-width="1"${s}/>`
|
|
19858
19902
|
), t.label && (e.push(` <g fill="black" ${n}>`), e.push(
|
|
19859
|
-
` <text x="${o +
|
|
19903
|
+
` <text x="${o + kt}" y="${r + kt + Xe * 0.85}" font-size="${Xe}">${Ke(t.label)}</text>`
|
|
19860
19904
|
), e.push(" </g>"));
|
|
19861
19905
|
}
|
|
19862
19906
|
function IN(e, t) {
|
|
@@ -19873,7 +19917,7 @@ function IN(e, t) {
|
|
|
19873
19917
|
}
|
|
19874
19918
|
function zN(e, t, n) {
|
|
19875
19919
|
var h;
|
|
19876
|
-
const [o, r] = t.at, [i, a] =
|
|
19920
|
+
const [o, r] = t.at, [i, a] = Je(t), s = At(t), l = Et(t), c = t.fontSize ?? Xe;
|
|
19877
19921
|
n !== "none" && e.push(
|
|
19878
19922
|
` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="${n}"/>`
|
|
19879
19923
|
);
|
|
@@ -19892,7 +19936,7 @@ function zN(e, t, n) {
|
|
|
19892
19936
|
if (f === "") continue;
|
|
19893
19937
|
const b = o + s[p] + Vt, w = r + l[g] + t.rowHeights[g] / 2 + c * 0.35;
|
|
19894
19938
|
u.push(
|
|
19895
|
-
` <text x="${b}" y="${w}" font-size="${c}">${
|
|
19939
|
+
` <text x="${b}" y="${w}" font-size="${c}">${Ke(f)}</text>`
|
|
19896
19940
|
);
|
|
19897
19941
|
}
|
|
19898
19942
|
u.length > 0 && (e.push(
|
|
@@ -19932,7 +19976,7 @@ function MN(e, t) {
|
|
|
19932
19976
|
}
|
|
19933
19977
|
for (const u of e.wireRenders.values())
|
|
19934
19978
|
for (const [h, g] of u.path) a(h, g);
|
|
19935
|
-
const s = t.labelMode ?? "all", l =
|
|
19979
|
+
const s = t.labelMode ?? "all", l = $t(t.labelFontSize), c = Qt(l);
|
|
19936
19980
|
if (s !== "off") {
|
|
19937
19981
|
for (const u of e.elements.values()) {
|
|
19938
19982
|
const h = e.layout.get(u.element.id);
|
|
@@ -19956,7 +20000,7 @@ function MN(e, t) {
|
|
|
19956
20000
|
}
|
|
19957
20001
|
}
|
|
19958
20002
|
for (const u of t.annotations ?? []) {
|
|
19959
|
-
if (
|
|
20003
|
+
if (qe(u) === "text" && !u.text)
|
|
19960
20004
|
continue;
|
|
19961
20005
|
const h = uk(u);
|
|
19962
20006
|
a(h.minX, h.minY), a(h.maxX, h.maxY);
|
|
@@ -19975,7 +20019,7 @@ function DN(e) {
|
|
|
19975
20019
|
const t = e.trim().split(/\s+/).map(Number);
|
|
19976
20020
|
return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
|
|
19977
20021
|
}
|
|
19978
|
-
function
|
|
20022
|
+
function Ke(e) {
|
|
19979
20023
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
19980
20024
|
}
|
|
19981
20025
|
async function ON(e, t = "diagram.svg", n) {
|
|
@@ -20112,11 +20156,11 @@ export {
|
|
|
20112
20156
|
VN as FileMenu,
|
|
20113
20157
|
zr as LIBRARY,
|
|
20114
20158
|
GN as OneLineEditor,
|
|
20115
|
-
|
|
20159
|
+
qe as annotationKind,
|
|
20116
20160
|
aN as applyTheme,
|
|
20117
20161
|
pN as buildExportDxf,
|
|
20118
20162
|
qk as buildExportSvg,
|
|
20119
|
-
|
|
20163
|
+
ut as compile,
|
|
20120
20164
|
hN as downloadDxf,
|
|
20121
20165
|
LN as downloadPng,
|
|
20122
20166
|
ON as downloadSvg,
|
|
@@ -20137,6 +20181,6 @@ export {
|
|
|
20137
20181
|
je as transformPoint,
|
|
20138
20182
|
y as useEditorStore,
|
|
20139
20183
|
Bn as useLocale,
|
|
20140
|
-
|
|
20184
|
+
wt as wireIdFromEnds
|
|
20141
20185
|
};
|
|
20142
20186
|
//# sourceMappingURL=sldeditor.js.map
|