@mlightcad/common 1.2.6 → 1.2.7
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/common.js +503 -259
- package/dist/common.umd.cjs +1 -1
- package/lib/AcCmTransparency.d.ts +201 -0
- package/lib/AcCmTransparency.d.ts.map +1 -0
- package/lib/AcCmTransparency.js +315 -0
- package/lib/AcCmTransparency.js.map +1 -0
- package/lib/AcCmTransparencyMethod.d.ts +16 -0
- package/lib/AcCmTransparencyMethod.d.ts.map +1 -0
- package/lib/AcCmTransparencyMethod.js +17 -0
- package/lib/AcCmTransparencyMethod.js.map +1 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist/common.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
function
|
|
1
|
+
function W(r, e) {
|
|
2
2
|
for (var t = 0; t < e.length; t++) {
|
|
3
3
|
const s = e[t];
|
|
4
4
|
if (typeof s != "string" && !Array.isArray(s)) {
|
|
5
|
-
for (const
|
|
6
|
-
if (
|
|
7
|
-
const i = Object.getOwnPropertyDescriptor(s,
|
|
8
|
-
i && Object.defineProperty(r,
|
|
5
|
+
for (const o in s)
|
|
6
|
+
if (o !== "default" && !(o in r)) {
|
|
7
|
+
const i = Object.getOwnPropertyDescriptor(s, o);
|
|
8
|
+
i && Object.defineProperty(r, o, i.get ? i : {
|
|
9
9
|
enumerable: !0,
|
|
10
|
-
get: () => s[
|
|
10
|
+
get: () => s[o]
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
const
|
|
17
|
+
var n = /* @__PURE__ */ ((r) => (r[r.ByColor = 1] = "ByColor", r[r.ByACI = 2] = "ByACI", r[r.ByLayer = 3] = "ByLayer", r[r.ByBlock = 4] = "ByBlock", r[r.None = 0] = "None", r))(n || {});
|
|
18
|
+
const G = {
|
|
19
19
|
aliceblue: 15792383,
|
|
20
20
|
antiquewhite: 16444375,
|
|
21
21
|
aqua: 65535,
|
|
@@ -160,7 +160,7 @@ const S = {
|
|
|
160
160
|
whitesmoke: 16119285,
|
|
161
161
|
yellow: 16776960,
|
|
162
162
|
yellowgreen: 10145074
|
|
163
|
-
},
|
|
163
|
+
}, N = [
|
|
164
164
|
0,
|
|
165
165
|
16711680,
|
|
166
166
|
16776960,
|
|
@@ -419,7 +419,7 @@ const S = {
|
|
|
419
419
|
16777215,
|
|
420
420
|
0
|
|
421
421
|
];
|
|
422
|
-
class
|
|
422
|
+
class b {
|
|
423
423
|
/**
|
|
424
424
|
* Returns the RGB color value for a given AutoCAD color index.
|
|
425
425
|
*
|
|
@@ -440,7 +440,7 @@ class B {
|
|
|
440
440
|
* ```
|
|
441
441
|
*/
|
|
442
442
|
static getColorByIndex(e) {
|
|
443
|
-
return
|
|
443
|
+
return N[e];
|
|
444
444
|
}
|
|
445
445
|
/**
|
|
446
446
|
* Finds the AutoCAD color index associated with a given RGB value.
|
|
@@ -450,9 +450,9 @@ class B {
|
|
|
450
450
|
* @returns {number | undefined} The color index if found, undefined otherwise.
|
|
451
451
|
*/
|
|
452
452
|
static getIndexByColor(e) {
|
|
453
|
-
const t =
|
|
453
|
+
const t = N.length - 1;
|
|
454
454
|
for (let s = 1; s < t; ++s)
|
|
455
|
-
if (
|
|
455
|
+
if (N[s] === e)
|
|
456
456
|
return s;
|
|
457
457
|
}
|
|
458
458
|
/**
|
|
@@ -475,7 +475,7 @@ class B {
|
|
|
475
475
|
* ```
|
|
476
476
|
*/
|
|
477
477
|
static getColorByName(e) {
|
|
478
|
-
return
|
|
478
|
+
return G[e.toLowerCase()];
|
|
479
479
|
}
|
|
480
480
|
/**
|
|
481
481
|
* Finds the color name associated with a given RGB value.
|
|
@@ -484,7 +484,7 @@ class B {
|
|
|
484
484
|
* @returns {string | undefined} The color name if found, undefined otherwise.
|
|
485
485
|
*/
|
|
486
486
|
static getNameByColor(e) {
|
|
487
|
-
for (const [t, s] of Object.entries(
|
|
487
|
+
for (const [t, s] of Object.entries(G))
|
|
488
488
|
if (s === e)
|
|
489
489
|
return t;
|
|
490
490
|
}
|
|
@@ -499,14 +499,14 @@ class B {
|
|
|
499
499
|
return this.getNameByColor(t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
class
|
|
502
|
+
class B {
|
|
503
503
|
/**
|
|
504
504
|
* Constructs a new AcCmColor.
|
|
505
505
|
* @param method Initial color method (defaults to `ByColor`)
|
|
506
506
|
* @param value Internal packed value
|
|
507
507
|
*/
|
|
508
|
-
constructor(e =
|
|
509
|
-
this._colorMethod = e, this._colorMethod ==
|
|
508
|
+
constructor(e = n.ByLayer, t) {
|
|
509
|
+
this._colorMethod = e, this._colorMethod == n.ByColor && t == null ? this._value = 16777215 : this._colorMethod == n.ByACI ? t == null ? this._value = 8 : t === 0 ? this._colorMethod = n.ByBlock : t === 256 ? this._colorMethod = n.ByLayer : this._value = Math.max(0, Math.min(t, 256)) : this._value = t;
|
|
510
510
|
}
|
|
511
511
|
// ---------------------------------------------------------------------
|
|
512
512
|
// Color method
|
|
@@ -550,12 +550,12 @@ class v {
|
|
|
550
550
|
*/
|
|
551
551
|
get RGB() {
|
|
552
552
|
switch (this._colorMethod) {
|
|
553
|
-
case
|
|
554
|
-
case
|
|
555
|
-
case
|
|
553
|
+
case n.ByColor:
|
|
554
|
+
case n.ByBlock:
|
|
555
|
+
case n.ByLayer:
|
|
556
556
|
return this._value;
|
|
557
|
-
case
|
|
558
|
-
return this._value ?
|
|
557
|
+
case n.ByACI:
|
|
558
|
+
return this._value ? b.getColorByIndex(this._value) : this._value;
|
|
559
559
|
default:
|
|
560
560
|
return;
|
|
561
561
|
}
|
|
@@ -569,8 +569,8 @@ class v {
|
|
|
569
569
|
* @returns The current instance for chaining
|
|
570
570
|
*/
|
|
571
571
|
setRGB(e, t, s) {
|
|
572
|
-
const
|
|
573
|
-
return this._value =
|
|
572
|
+
const o = Math.max(0, Math.min(255, Math.round(e))), i = Math.max(0, Math.min(255, Math.round(t))), a = Math.max(0, Math.min(255, Math.round(s)));
|
|
573
|
+
return this._value = o << 16 | i << 8 | a, this._colorMethod = n.ByColor, this;
|
|
574
574
|
}
|
|
575
575
|
/**
|
|
576
576
|
* Sets the RGB color by a single packed number (0xRRGGBB).
|
|
@@ -578,7 +578,7 @@ class v {
|
|
|
578
578
|
* @param value Packed RGB number
|
|
579
579
|
*/
|
|
580
580
|
setRGBValue(e) {
|
|
581
|
-
return e == null || !Number.isFinite(e) ? (console.warn("Invalid RGB value:", e), this) : (this._value = e & 16777215, this._colorMethod =
|
|
581
|
+
return e == null || !Number.isFinite(e) ? (console.warn("Invalid RGB value:", e), this) : (this._value = e & 16777215, this._colorMethod = n.ByColor, this);
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
584
584
|
* Sets the RGB color from a CSS color string.
|
|
@@ -611,8 +611,8 @@ class v {
|
|
|
611
611
|
const i = parseInt(s[1], 10), a = parseInt(s[2], 10), c = parseInt(s[3], 10);
|
|
612
612
|
return this.setRGB(i, a, c);
|
|
613
613
|
}
|
|
614
|
-
const
|
|
615
|
-
return
|
|
614
|
+
const o = b.getColorByName(e);
|
|
615
|
+
return o !== void 0 ? this.setRGBValue(o) : (console.warn("Unknown CSS color string:", e), this);
|
|
616
616
|
}
|
|
617
617
|
/**
|
|
618
618
|
* Sets the color as a scalar grayscale value.
|
|
@@ -643,7 +643,7 @@ class v {
|
|
|
643
643
|
// ---------------------------------------------------------------------
|
|
644
644
|
/** Gets the AutoCAD Color Index (ACI), or undefined if not ByACI, ByBlock, or ByLayer. */
|
|
645
645
|
get colorIndex() {
|
|
646
|
-
return this._colorMethod ===
|
|
646
|
+
return this._colorMethod === n.ByACI ? this._value : this._colorMethod === n.ByLayer ? 256 : this._colorMethod === n.ByBlock ? 0 : void 0;
|
|
647
647
|
}
|
|
648
648
|
/**
|
|
649
649
|
* Sets the AutoCAD Color Index (0–256).
|
|
@@ -657,44 +657,44 @@ class v {
|
|
|
657
657
|
set colorIndex(e) {
|
|
658
658
|
if (e == null) return;
|
|
659
659
|
const t = Math.max(0, Math.min(256, Math.round(e)));
|
|
660
|
-
t === 0 ? (this._colorMethod =
|
|
660
|
+
t === 0 ? (this._colorMethod = n.ByBlock, this._value = void 0) : t === 256 ? (this._colorMethod = n.ByLayer, this._value = void 0) : (this._colorMethod = n.ByACI, this._value = t);
|
|
661
661
|
}
|
|
662
662
|
/**
|
|
663
663
|
* Returns true if the color method is ByColor (explicit RGB).
|
|
664
664
|
*/
|
|
665
665
|
get isByColor() {
|
|
666
|
-
return this._colorMethod ===
|
|
666
|
+
return this._colorMethod === n.ByColor;
|
|
667
667
|
}
|
|
668
668
|
/**
|
|
669
669
|
* Returns true if the color method is ByACI.
|
|
670
670
|
*/
|
|
671
671
|
get isByACI() {
|
|
672
|
-
return this._colorMethod ===
|
|
672
|
+
return this._colorMethod === n.ByACI;
|
|
673
673
|
}
|
|
674
674
|
// ---------------------------------------------------------------------
|
|
675
675
|
// Layer / Block helpers
|
|
676
676
|
// ---------------------------------------------------------------------
|
|
677
677
|
/** Returns true if the color method is ByLayer. */
|
|
678
678
|
get isByLayer() {
|
|
679
|
-
return this._colorMethod ===
|
|
679
|
+
return this._colorMethod === n.ByLayer;
|
|
680
680
|
}
|
|
681
681
|
/**
|
|
682
682
|
* Sets the color to ByLayer.
|
|
683
683
|
* @param value - Option layer color value
|
|
684
684
|
*/
|
|
685
685
|
setByLayer(e) {
|
|
686
|
-
return this._colorMethod =
|
|
686
|
+
return this._colorMethod = n.ByLayer, e == null ? this._value = 256 : this._value = e, this;
|
|
687
687
|
}
|
|
688
688
|
/** Returns true if the color method is ByBlock. */
|
|
689
689
|
get isByBlock() {
|
|
690
|
-
return this._colorMethod ===
|
|
690
|
+
return this._colorMethod === n.ByBlock;
|
|
691
691
|
}
|
|
692
692
|
/**
|
|
693
693
|
* Sets the color to ByBlock.
|
|
694
694
|
* @param value - Option layer color value
|
|
695
695
|
*/
|
|
696
696
|
setByBlock(e) {
|
|
697
|
-
return this._colorMethod =
|
|
697
|
+
return this._colorMethod = n.ByBlock, e == null ? this._value = 0 : this._value = e, this;
|
|
698
698
|
}
|
|
699
699
|
// ---------------------------------------------------------------------
|
|
700
700
|
// Color name (dynamic)
|
|
@@ -707,14 +707,14 @@ class v {
|
|
|
707
707
|
*/
|
|
708
708
|
get colorName() {
|
|
709
709
|
switch (this._colorMethod) {
|
|
710
|
-
case
|
|
710
|
+
case n.ByLayer:
|
|
711
711
|
return "ByLayer";
|
|
712
|
-
case
|
|
712
|
+
case n.ByBlock:
|
|
713
713
|
return "ByBlock";
|
|
714
|
-
case
|
|
715
|
-
return this._value ?
|
|
716
|
-
case
|
|
717
|
-
return this._value ?
|
|
714
|
+
case n.ByColor:
|
|
715
|
+
return this._value ? b.getNameByColor(this._value) : "";
|
|
716
|
+
case n.ByACI:
|
|
717
|
+
return this._value ? b.getNameByIndex(this._value) : "";
|
|
718
718
|
default:
|
|
719
719
|
return;
|
|
720
720
|
}
|
|
@@ -728,8 +728,8 @@ class v {
|
|
|
728
728
|
*/
|
|
729
729
|
set colorName(e) {
|
|
730
730
|
if (!e) return;
|
|
731
|
-
const t =
|
|
732
|
-
t !== void 0 ? (this._value = t, this._colorMethod =
|
|
731
|
+
const t = b.getColorByName(e);
|
|
732
|
+
t !== void 0 ? (this._value = t, this._colorMethod = n.ByColor) : console.warn("Unknown color name:", e);
|
|
733
733
|
}
|
|
734
734
|
// ---------------------------------------------------------------------
|
|
735
735
|
// Clone / Copy / Equals
|
|
@@ -740,7 +740,7 @@ class v {
|
|
|
740
740
|
* @returns A new AcCmColor instance with the same method and value
|
|
741
741
|
*/
|
|
742
742
|
clone() {
|
|
743
|
-
const e = new
|
|
743
|
+
const e = new B();
|
|
744
744
|
return e._colorMethod = this._colorMethod, e._value = this._value, e;
|
|
745
745
|
}
|
|
746
746
|
/**
|
|
@@ -774,13 +774,13 @@ class v {
|
|
|
774
774
|
*/
|
|
775
775
|
toString() {
|
|
776
776
|
switch (this._colorMethod) {
|
|
777
|
-
case
|
|
777
|
+
case n.ByLayer:
|
|
778
778
|
return "ByLayer";
|
|
779
|
-
case
|
|
779
|
+
case n.ByBlock:
|
|
780
780
|
return "ByBlock";
|
|
781
|
-
case
|
|
781
|
+
case n.ByACI:
|
|
782
782
|
return this._value !== void 0 ? String(this._value) : "";
|
|
783
|
-
case
|
|
783
|
+
case n.ByColor:
|
|
784
784
|
return this._value ? `${this.red},${this.green},${this.blue}` : "";
|
|
785
785
|
default:
|
|
786
786
|
return "";
|
|
@@ -793,31 +793,31 @@ class v {
|
|
|
793
793
|
if (!e) return;
|
|
794
794
|
const t = e.trim();
|
|
795
795
|
if (/^bylayer$/i.test(t))
|
|
796
|
-
return new
|
|
796
|
+
return new B(n.ByLayer);
|
|
797
797
|
if (/^byblock$/i.test(t))
|
|
798
|
-
return new
|
|
798
|
+
return new B(n.ByBlock);
|
|
799
799
|
if (/^\d{1,3},\d{1,3},\d{1,3}$/i.test(t)) {
|
|
800
|
-
const [
|
|
801
|
-
return c.setRGB(
|
|
800
|
+
const [o, i, a] = t.split(",").map(Number), c = new B(n.ByColor);
|
|
801
|
+
return c.setRGB(o, i, a), c;
|
|
802
802
|
}
|
|
803
803
|
if (/^\d+$/.test(t)) {
|
|
804
|
-
const
|
|
805
|
-
return new
|
|
804
|
+
const o = parseInt(t, 10);
|
|
805
|
+
return new B(n.ByACI, o);
|
|
806
806
|
}
|
|
807
|
-
const s =
|
|
807
|
+
const s = b.getColorByName(t);
|
|
808
808
|
if (s != null)
|
|
809
|
-
return new
|
|
809
|
+
return new B(n.ByColor, s);
|
|
810
810
|
console.warn("Unknown color name:", e);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
-
class
|
|
813
|
+
class oe {
|
|
814
814
|
/**
|
|
815
815
|
* Constructs a new `AcCmEntityColor`.
|
|
816
816
|
*
|
|
817
817
|
* @param method Initial color method (defaults to `ByColor`)
|
|
818
818
|
* @param value Internal packed value (defaults to `0`)
|
|
819
819
|
*/
|
|
820
|
-
constructor(e =
|
|
820
|
+
constructor(e = n.ByColor, t = 0) {
|
|
821
821
|
this._colorMethod = e, this._value = t;
|
|
822
822
|
}
|
|
823
823
|
/**
|
|
@@ -839,7 +839,7 @@ class re {
|
|
|
839
839
|
* Sets the red component and updates the packed RGB value.
|
|
840
840
|
*/
|
|
841
841
|
set red(e) {
|
|
842
|
-
this._colorMethod =
|
|
842
|
+
this._colorMethod = n.ByColor, this._value = this._value & 65535 | (e & 255) << 16;
|
|
843
843
|
}
|
|
844
844
|
/**
|
|
845
845
|
* Gets the green component (0–255). Only valid when colorMethod = ByColor.
|
|
@@ -851,7 +851,7 @@ class re {
|
|
|
851
851
|
* Sets the green component and updates the packed RGB value.
|
|
852
852
|
*/
|
|
853
853
|
set green(e) {
|
|
854
|
-
this._colorMethod =
|
|
854
|
+
this._colorMethod = n.ByColor, this._value = this._value & 16711935 | (e & 255) << 8;
|
|
855
855
|
}
|
|
856
856
|
/**
|
|
857
857
|
* Gets the blue component (0–255). Only valid when colorMethod = ByColor.
|
|
@@ -863,7 +863,7 @@ class re {
|
|
|
863
863
|
* Sets the blue component and updates the packed RGB value.
|
|
864
864
|
*/
|
|
865
865
|
set blue(e) {
|
|
866
|
-
this._colorMethod =
|
|
866
|
+
this._colorMethod = n.ByColor, this._value = this._value & 16776960 | e & 255;
|
|
867
867
|
}
|
|
868
868
|
/**
|
|
869
869
|
* Sets all RGB components.
|
|
@@ -873,7 +873,7 @@ class re {
|
|
|
873
873
|
* @param b Blue (0–255)
|
|
874
874
|
*/
|
|
875
875
|
setRGB(e, t, s) {
|
|
876
|
-
this._colorMethod =
|
|
876
|
+
this._colorMethod = n.ByColor, this._value = (e & 255) << 16 | (t & 255) << 8 | s & 255;
|
|
877
877
|
}
|
|
878
878
|
// ---------------------------------------------------------------------
|
|
879
879
|
// ACI accessors
|
|
@@ -888,7 +888,7 @@ class re {
|
|
|
888
888
|
* Sets the AutoCAD Color Index (ACI).
|
|
889
889
|
*/
|
|
890
890
|
set colorIndex(e) {
|
|
891
|
-
this._colorMethod =
|
|
891
|
+
this._colorMethod = n.ByACI, this._value = e;
|
|
892
892
|
}
|
|
893
893
|
// ---------------------------------------------------------------------
|
|
894
894
|
// Layer index accessors
|
|
@@ -903,7 +903,7 @@ class re {
|
|
|
903
903
|
* Sets the layer index for ByLayer color mode.
|
|
904
904
|
*/
|
|
905
905
|
set layerIndex(e) {
|
|
906
|
-
this._colorMethod =
|
|
906
|
+
this._colorMethod = n.ByLayer, this._value = e;
|
|
907
907
|
}
|
|
908
908
|
// ---------------------------------------------------------------------
|
|
909
909
|
// Utility methods
|
|
@@ -912,31 +912,31 @@ class re {
|
|
|
912
912
|
* Returns true if the color method is ByColor (explicit RGB).
|
|
913
913
|
*/
|
|
914
914
|
isByColor() {
|
|
915
|
-
return this._colorMethod ===
|
|
915
|
+
return this._colorMethod === n.ByColor;
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
918
918
|
* Returns true if the color method is ByLayer.
|
|
919
919
|
*/
|
|
920
920
|
isByLayer() {
|
|
921
|
-
return this._colorMethod ===
|
|
921
|
+
return this._colorMethod === n.ByLayer;
|
|
922
922
|
}
|
|
923
923
|
/**
|
|
924
924
|
* Returns true if the color method is ByBlock.
|
|
925
925
|
*/
|
|
926
926
|
isByBlock() {
|
|
927
|
-
return this._colorMethod ===
|
|
927
|
+
return this._colorMethod === n.ByBlock;
|
|
928
928
|
}
|
|
929
929
|
/**
|
|
930
930
|
* Returns true if the color method is ByACI.
|
|
931
931
|
*/
|
|
932
932
|
isByACI() {
|
|
933
|
-
return this._colorMethod ===
|
|
933
|
+
return this._colorMethod === n.ByACI;
|
|
934
934
|
}
|
|
935
935
|
/**
|
|
936
936
|
* Returns true if color is uninitialized or invalid.
|
|
937
937
|
*/
|
|
938
938
|
isNone() {
|
|
939
|
-
return this._colorMethod ===
|
|
939
|
+
return this._colorMethod === n.None;
|
|
940
940
|
}
|
|
941
941
|
/**
|
|
942
942
|
* Gets the packed internal value.
|
|
@@ -955,7 +955,7 @@ class re {
|
|
|
955
955
|
this._value = e;
|
|
956
956
|
}
|
|
957
957
|
}
|
|
958
|
-
const
|
|
958
|
+
const ne = {
|
|
959
959
|
/**
|
|
960
960
|
* Throw error ILLEGAL_PARAMETERS when cannot instantiate from given parameter
|
|
961
961
|
*/
|
|
@@ -991,7 +991,7 @@ const se = {
|
|
|
991
991
|
return new Error("Not implemented yet");
|
|
992
992
|
}
|
|
993
993
|
};
|
|
994
|
-
class
|
|
994
|
+
class ie {
|
|
995
995
|
/**
|
|
996
996
|
* Creates {@link AcCmEventDispatcher} object.
|
|
997
997
|
*/
|
|
@@ -1010,10 +1010,10 @@ class ne {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
removeEventListener(e, t) {
|
|
1012
1012
|
if (this._listeners === void 0) return;
|
|
1013
|
-
const
|
|
1014
|
-
if (
|
|
1015
|
-
const i =
|
|
1016
|
-
i !== -1 &&
|
|
1013
|
+
const o = this._listeners[e];
|
|
1014
|
+
if (o !== void 0) {
|
|
1015
|
+
const i = o.indexOf(t);
|
|
1016
|
+
i !== -1 && o.splice(i, 1);
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
1019
|
/**
|
|
@@ -1025,13 +1025,13 @@ class ne {
|
|
|
1025
1025
|
const s = this._listeners[e.type];
|
|
1026
1026
|
if (s !== void 0) {
|
|
1027
1027
|
e.target = this;
|
|
1028
|
-
const
|
|
1029
|
-
for (let i = 0, a =
|
|
1030
|
-
|
|
1028
|
+
const o = s.slice(0);
|
|
1029
|
+
for (let i = 0, a = o.length; i < a; i++)
|
|
1030
|
+
o[i].call(this, e);
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
1034
|
-
class
|
|
1034
|
+
class D {
|
|
1035
1035
|
constructor() {
|
|
1036
1036
|
this.listeners = [];
|
|
1037
1037
|
}
|
|
@@ -1065,17 +1065,80 @@ class U {
|
|
|
1065
1065
|
s.call(null, e, ...t);
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1068
|
+
function C(r) {
|
|
1069
|
+
return r === null || typeof r != "object" ? r : Array.isArray(r) ? [...r] : { ...r };
|
|
1070
|
+
}
|
|
1071
|
+
function F(r) {
|
|
1072
|
+
if (r === null || typeof r != "object")
|
|
1073
|
+
return r;
|
|
1074
|
+
if (r instanceof Date)
|
|
1075
|
+
return new Date(r.getTime());
|
|
1076
|
+
if (r instanceof RegExp)
|
|
1077
|
+
return new RegExp(r.source, r.flags);
|
|
1078
|
+
if (Array.isArray(r))
|
|
1079
|
+
return r.map(F);
|
|
1080
|
+
const e = {};
|
|
1081
|
+
for (const t in r)
|
|
1082
|
+
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = F(r[t]));
|
|
1083
|
+
return e;
|
|
1084
|
+
}
|
|
1085
|
+
function Y(r, ...e) {
|
|
1086
|
+
for (const t of e)
|
|
1087
|
+
if (t)
|
|
1088
|
+
for (const s in t)
|
|
1089
|
+
Object.prototype.hasOwnProperty.call(t, s) && r[s] === void 0 && (r[s] = t[s]);
|
|
1090
|
+
return r;
|
|
1091
|
+
}
|
|
1092
|
+
function Z(r, e) {
|
|
1093
|
+
return r != null && Object.prototype.hasOwnProperty.call(r, e);
|
|
1094
|
+
}
|
|
1095
|
+
function J(r) {
|
|
1096
|
+
return r == null ? !0 : Array.isArray(r) || typeof r == "string" ? r.length === 0 : r instanceof Map || r instanceof Set ? r.size === 0 : typeof r == "object" ? Object.keys(r).length === 0 : !1;
|
|
1097
|
+
}
|
|
1098
|
+
function M(r, e) {
|
|
1099
|
+
if (r === e)
|
|
1100
|
+
return !0;
|
|
1101
|
+
if (r == null || e == null)
|
|
1102
|
+
return r === e;
|
|
1103
|
+
if (typeof r != typeof e)
|
|
1104
|
+
return !1;
|
|
1105
|
+
if (typeof r != "object")
|
|
1106
|
+
return r === e;
|
|
1107
|
+
if (Array.isArray(r) !== Array.isArray(e))
|
|
1108
|
+
return !1;
|
|
1109
|
+
if (Array.isArray(r)) {
|
|
1110
|
+
if (r.length !== e.length)
|
|
1111
|
+
return !1;
|
|
1112
|
+
for (let o = 0; o < r.length; o++)
|
|
1113
|
+
if (!M(r[o], e[o]))
|
|
1114
|
+
return !1;
|
|
1115
|
+
return !0;
|
|
1116
|
+
}
|
|
1117
|
+
const t = Object.keys(r), s = Object.keys(e);
|
|
1118
|
+
if (t.length !== s.length)
|
|
1119
|
+
return !1;
|
|
1120
|
+
for (const o of t)
|
|
1121
|
+
if (!Object.prototype.hasOwnProperty.call(
|
|
1122
|
+
e,
|
|
1123
|
+
o
|
|
1124
|
+
) || !M(
|
|
1125
|
+
r[o],
|
|
1126
|
+
e[o]
|
|
1127
|
+
))
|
|
1128
|
+
return !1;
|
|
1129
|
+
return !0;
|
|
1130
|
+
}
|
|
1131
|
+
var X = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1132
|
+
function Q(r) {
|
|
1070
1133
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
1071
1134
|
}
|
|
1072
|
-
var
|
|
1135
|
+
var q = { exports: {} };
|
|
1073
1136
|
(function(r) {
|
|
1074
1137
|
(function(e, t) {
|
|
1075
1138
|
r.exports ? r.exports = t() : e.log = t();
|
|
1076
|
-
})(
|
|
1139
|
+
})(X, function() {
|
|
1077
1140
|
var e = function() {
|
|
1078
|
-
}, t = "undefined", s = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent),
|
|
1141
|
+
}, t = "undefined", s = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), o = [
|
|
1079
1142
|
"trace",
|
|
1080
1143
|
"debug",
|
|
1081
1144
|
"info",
|
|
@@ -1094,76 +1157,76 @@ var D = { exports: {} };
|
|
|
1094
1157
|
};
|
|
1095
1158
|
}
|
|
1096
1159
|
}
|
|
1097
|
-
function
|
|
1160
|
+
function I() {
|
|
1098
1161
|
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
1099
1162
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return h === "debug" && (h = "log"), typeof console === t ? !1 : h === "trace" && s ?
|
|
1163
|
+
function m(h) {
|
|
1164
|
+
return h === "debug" && (h = "log"), typeof console === t ? !1 : h === "trace" && s ? I : console[h] !== void 0 ? c(console, h) : console.log !== void 0 ? c(console, "log") : e;
|
|
1102
1165
|
}
|
|
1103
|
-
function
|
|
1104
|
-
for (var h = this.getLevel(), d = 0; d <
|
|
1105
|
-
var l =
|
|
1166
|
+
function _() {
|
|
1167
|
+
for (var h = this.getLevel(), d = 0; d < o.length; d++) {
|
|
1168
|
+
var l = o[d];
|
|
1106
1169
|
this[l] = d < h ? e : this.methodFactory(l, h, this.name);
|
|
1107
1170
|
}
|
|
1108
1171
|
if (this.log = this.debug, typeof console === t && h < this.levels.SILENT)
|
|
1109
1172
|
return "No console available for logging";
|
|
1110
1173
|
}
|
|
1111
|
-
function
|
|
1174
|
+
function x(h) {
|
|
1112
1175
|
return function() {
|
|
1113
|
-
typeof console !== t && (
|
|
1176
|
+
typeof console !== t && (_.call(this), this[h].apply(this, arguments));
|
|
1114
1177
|
};
|
|
1115
1178
|
}
|
|
1116
1179
|
function f(h, d, l) {
|
|
1117
|
-
return
|
|
1180
|
+
return m(h) || x.apply(this, arguments);
|
|
1118
1181
|
}
|
|
1119
|
-
function
|
|
1120
|
-
var l = this,
|
|
1121
|
-
typeof h == "string" ?
|
|
1122
|
-
function
|
|
1123
|
-
var g = (
|
|
1124
|
-
if (!(typeof window === t || !
|
|
1182
|
+
function S(h, d) {
|
|
1183
|
+
var l = this, E, R, w, p = "loglevel";
|
|
1184
|
+
typeof h == "string" ? p += ":" + h : typeof h == "symbol" && (p = void 0);
|
|
1185
|
+
function z(u) {
|
|
1186
|
+
var g = (o[u] || "silent").toUpperCase();
|
|
1187
|
+
if (!(typeof window === t || !p)) {
|
|
1125
1188
|
try {
|
|
1126
|
-
window.localStorage[
|
|
1189
|
+
window.localStorage[p] = g;
|
|
1127
1190
|
return;
|
|
1128
1191
|
} catch {
|
|
1129
1192
|
}
|
|
1130
1193
|
try {
|
|
1131
|
-
window.document.cookie = encodeURIComponent(
|
|
1194
|
+
window.document.cookie = encodeURIComponent(p) + "=" + g + ";";
|
|
1132
1195
|
} catch {
|
|
1133
1196
|
}
|
|
1134
1197
|
}
|
|
1135
1198
|
}
|
|
1136
|
-
function
|
|
1199
|
+
function P() {
|
|
1137
1200
|
var u;
|
|
1138
|
-
if (!(typeof window === t || !
|
|
1201
|
+
if (!(typeof window === t || !p)) {
|
|
1139
1202
|
try {
|
|
1140
|
-
u = window.localStorage[
|
|
1203
|
+
u = window.localStorage[p];
|
|
1141
1204
|
} catch {
|
|
1142
1205
|
}
|
|
1143
1206
|
if (typeof u === t)
|
|
1144
1207
|
try {
|
|
1145
|
-
var g = window.document.cookie,
|
|
1146
|
-
|
|
1147
|
-
g.slice(
|
|
1208
|
+
var g = window.document.cookie, A = encodeURIComponent(p), U = g.indexOf(A + "=");
|
|
1209
|
+
U !== -1 && (u = /^([^;]+)/.exec(
|
|
1210
|
+
g.slice(U + A.length + 1)
|
|
1148
1211
|
)[1]);
|
|
1149
1212
|
} catch {
|
|
1150
1213
|
}
|
|
1151
1214
|
return l.levels[u] === void 0 && (u = void 0), u;
|
|
1152
1215
|
}
|
|
1153
1216
|
}
|
|
1154
|
-
function
|
|
1155
|
-
if (!(typeof window === t || !
|
|
1217
|
+
function H() {
|
|
1218
|
+
if (!(typeof window === t || !p)) {
|
|
1156
1219
|
try {
|
|
1157
|
-
window.localStorage.removeItem(
|
|
1220
|
+
window.localStorage.removeItem(p);
|
|
1158
1221
|
} catch {
|
|
1159
1222
|
}
|
|
1160
1223
|
try {
|
|
1161
|
-
window.document.cookie = encodeURIComponent(
|
|
1224
|
+
window.document.cookie = encodeURIComponent(p) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
1162
1225
|
} catch {
|
|
1163
1226
|
}
|
|
1164
1227
|
}
|
|
1165
1228
|
}
|
|
1166
|
-
function
|
|
1229
|
+
function L(u) {
|
|
1167
1230
|
var g = u;
|
|
1168
1231
|
if (typeof g == "string" && l.levels[g.toUpperCase()] !== void 0 && (g = l.levels[g.toUpperCase()]), typeof g == "number" && g >= 0 && g <= l.levels.SILENT)
|
|
1169
1232
|
return g;
|
|
@@ -1177,121 +1240,58 @@ var D = { exports: {} };
|
|
|
1177
1240
|
ERROR: 4,
|
|
1178
1241
|
SILENT: 5
|
|
1179
1242
|
}, l.methodFactory = d || f, l.getLevel = function() {
|
|
1180
|
-
return w ??
|
|
1243
|
+
return w ?? R ?? E;
|
|
1181
1244
|
}, l.setLevel = function(u, g) {
|
|
1182
|
-
return w =
|
|
1245
|
+
return w = L(u), g !== !1 && z(w), _.call(l);
|
|
1183
1246
|
}, l.setDefaultLevel = function(u) {
|
|
1184
|
-
|
|
1247
|
+
R = L(u), P() || l.setLevel(u, !1);
|
|
1185
1248
|
}, l.resetLevel = function() {
|
|
1186
|
-
w = null,
|
|
1249
|
+
w = null, H(), _.call(l);
|
|
1187
1250
|
}, l.enableAll = function(u) {
|
|
1188
1251
|
l.setLevel(l.levels.TRACE, u);
|
|
1189
1252
|
}, l.disableAll = function(u) {
|
|
1190
1253
|
l.setLevel(l.levels.SILENT, u);
|
|
1191
1254
|
}, l.rebuild = function() {
|
|
1192
|
-
if (a !== l && (
|
|
1255
|
+
if (a !== l && (E = L(a.getLevel())), _.call(l), a === l)
|
|
1193
1256
|
for (var u in i)
|
|
1194
1257
|
i[u].rebuild();
|
|
1195
|
-
},
|
|
1258
|
+
}, E = L(
|
|
1196
1259
|
a ? a.getLevel() : "WARN"
|
|
1197
1260
|
);
|
|
1198
|
-
var
|
|
1199
|
-
|
|
1261
|
+
var T = P();
|
|
1262
|
+
T != null && (w = L(T)), _.call(l);
|
|
1200
1263
|
}
|
|
1201
|
-
a = new
|
|
1264
|
+
a = new S(), a.getLogger = function(d) {
|
|
1202
1265
|
if (typeof d != "symbol" && typeof d != "string" || d === "")
|
|
1203
1266
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
1204
1267
|
var l = i[d];
|
|
1205
|
-
return l || (l = i[d] = new
|
|
1268
|
+
return l || (l = i[d] = new S(
|
|
1206
1269
|
d,
|
|
1207
1270
|
a.methodFactory
|
|
1208
1271
|
)), l;
|
|
1209
1272
|
};
|
|
1210
|
-
var
|
|
1273
|
+
var j = typeof window !== t ? window.log : void 0;
|
|
1211
1274
|
return a.noConflict = function() {
|
|
1212
|
-
return typeof window !== t && window.log === a && (window.log =
|
|
1275
|
+
return typeof window !== t && window.log === a && (window.log = j), a;
|
|
1213
1276
|
}, a.getLoggers = function() {
|
|
1214
1277
|
return i;
|
|
1215
1278
|
}, a.default = a, a;
|
|
1216
1279
|
});
|
|
1217
|
-
})(
|
|
1218
|
-
var
|
|
1219
|
-
const
|
|
1280
|
+
})(q);
|
|
1281
|
+
var $ = q.exports;
|
|
1282
|
+
const ee = /* @__PURE__ */ Q($), te = /* @__PURE__ */ W({
|
|
1220
1283
|
__proto__: null,
|
|
1221
|
-
default:
|
|
1222
|
-
}, [
|
|
1223
|
-
|
|
1224
|
-
const
|
|
1284
|
+
default: ee
|
|
1285
|
+
}, [$]), le = !0, O = te;
|
|
1286
|
+
O.setLevel("debug");
|
|
1287
|
+
const ae = (r) => {
|
|
1225
1288
|
try {
|
|
1226
|
-
|
|
1289
|
+
O.setLevel(r);
|
|
1227
1290
|
} catch (e) {
|
|
1228
|
-
|
|
1291
|
+
O.setLevel("error"), O.error(e);
|
|
1229
1292
|
}
|
|
1230
1293
|
};
|
|
1231
|
-
|
|
1232
|
-
return r === null || typeof r != "object" ? r : Array.isArray(r) ? [...r] : { ...r };
|
|
1233
|
-
}
|
|
1234
|
-
function G(r) {
|
|
1235
|
-
if (r === null || typeof r != "object")
|
|
1236
|
-
return r;
|
|
1237
|
-
if (r instanceof Date)
|
|
1238
|
-
return new Date(r.getTime());
|
|
1239
|
-
if (r instanceof RegExp)
|
|
1240
|
-
return new RegExp(r.source, r.flags);
|
|
1241
|
-
if (Array.isArray(r))
|
|
1242
|
-
return r.map(G);
|
|
1243
|
-
const e = {};
|
|
1244
|
-
for (const t in r)
|
|
1245
|
-
Object.prototype.hasOwnProperty.call(r, t) && (e[t] = G(r[t]));
|
|
1246
|
-
return e;
|
|
1247
|
-
}
|
|
1248
|
-
function J(r, ...e) {
|
|
1249
|
-
for (const t of e)
|
|
1250
|
-
if (t)
|
|
1251
|
-
for (const s in t)
|
|
1252
|
-
Object.prototype.hasOwnProperty.call(t, s) && r[s] === void 0 && (r[s] = t[s]);
|
|
1253
|
-
return r;
|
|
1254
|
-
}
|
|
1255
|
-
function X(r, e) {
|
|
1256
|
-
return r != null && Object.prototype.hasOwnProperty.call(r, e);
|
|
1257
|
-
}
|
|
1258
|
-
function Q(r) {
|
|
1259
|
-
return r == null ? !0 : Array.isArray(r) || typeof r == "string" ? r.length === 0 : r instanceof Map || r instanceof Set ? r.size === 0 : typeof r == "object" ? Object.keys(r).length === 0 : !1;
|
|
1260
|
-
}
|
|
1261
|
-
function L(r, e) {
|
|
1262
|
-
if (r === e)
|
|
1263
|
-
return !0;
|
|
1264
|
-
if (r == null || e == null)
|
|
1265
|
-
return r === e;
|
|
1266
|
-
if (typeof r != typeof e)
|
|
1267
|
-
return !1;
|
|
1268
|
-
if (typeof r != "object")
|
|
1269
|
-
return r === e;
|
|
1270
|
-
if (Array.isArray(r) !== Array.isArray(e))
|
|
1271
|
-
return !1;
|
|
1272
|
-
if (Array.isArray(r)) {
|
|
1273
|
-
if (r.length !== e.length)
|
|
1274
|
-
return !1;
|
|
1275
|
-
for (let n = 0; n < r.length; n++)
|
|
1276
|
-
if (!L(r[n], e[n]))
|
|
1277
|
-
return !1;
|
|
1278
|
-
return !0;
|
|
1279
|
-
}
|
|
1280
|
-
const t = Object.keys(r), s = Object.keys(e);
|
|
1281
|
-
if (t.length !== s.length)
|
|
1282
|
-
return !1;
|
|
1283
|
-
for (const n of t)
|
|
1284
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
1285
|
-
e,
|
|
1286
|
-
n
|
|
1287
|
-
) || !L(
|
|
1288
|
-
r[n],
|
|
1289
|
-
e[n]
|
|
1290
|
-
))
|
|
1291
|
-
return !1;
|
|
1292
|
-
return !0;
|
|
1293
|
-
}
|
|
1294
|
-
class q {
|
|
1294
|
+
class V {
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Create one object to store attributes. For performance reason, values of attributes passed to constructor
|
|
1297
1297
|
* will not be cloned to `attributes` property. So it means that value of `attributes` property in this object
|
|
@@ -1300,11 +1300,11 @@ class q {
|
|
|
1300
1300
|
*/
|
|
1301
1301
|
constructor(e, t) {
|
|
1302
1302
|
this.events = {
|
|
1303
|
-
attrChanged: new
|
|
1304
|
-
modelChanged: new
|
|
1303
|
+
attrChanged: new D(),
|
|
1304
|
+
modelChanged: new D()
|
|
1305
1305
|
}, this._changing = !1, this._previousAttributes = {}, this._pending = !1;
|
|
1306
1306
|
const s = e || {};
|
|
1307
|
-
t &&
|
|
1307
|
+
t && Y(s, t), this.attributes = s, this.changed = {};
|
|
1308
1308
|
}
|
|
1309
1309
|
/**
|
|
1310
1310
|
* Gets the value of an attribute.
|
|
@@ -1337,24 +1337,24 @@ class q {
|
|
|
1337
1337
|
}
|
|
1338
1338
|
set(e, t, s) {
|
|
1339
1339
|
if (e == null) return this;
|
|
1340
|
-
let
|
|
1341
|
-
typeof e == "object" ? (
|
|
1342
|
-
const i = s.unset, a = s.silent, c = [],
|
|
1343
|
-
this._changing = !0,
|
|
1344
|
-
const
|
|
1345
|
-
for (const f in
|
|
1346
|
-
t =
|
|
1340
|
+
let o;
|
|
1341
|
+
typeof e == "object" ? (o = e, s = t) : (o = {}, o[e] = t), s || (s = {});
|
|
1342
|
+
const i = s.unset, a = s.silent, c = [], I = this._changing;
|
|
1343
|
+
this._changing = !0, I || (this._previousAttributes = C(this.attributes), this.changed = {});
|
|
1344
|
+
const m = this.attributes, _ = this.changed, x = this._previousAttributes;
|
|
1345
|
+
for (const f in o)
|
|
1346
|
+
t = o[f], M(m[f], t) || c.push(f), M(x[f], t) ? delete _[f] : _[f] = t, i ? delete m[f] : m[f] = t;
|
|
1347
1347
|
if (!a) {
|
|
1348
1348
|
c.length && (this._pending = s);
|
|
1349
1349
|
for (let f = 0; f < c.length; f++)
|
|
1350
1350
|
this.events.attrChanged.dispatch({
|
|
1351
1351
|
object: this,
|
|
1352
1352
|
attrName: c[f],
|
|
1353
|
-
attrValue:
|
|
1353
|
+
attrValue: m[c[f]],
|
|
1354
1354
|
options: s
|
|
1355
1355
|
});
|
|
1356
1356
|
}
|
|
1357
|
-
if (
|
|
1357
|
+
if (I) return this;
|
|
1358
1358
|
if (!a)
|
|
1359
1359
|
for (; this._pending; )
|
|
1360
1360
|
s = this._pending, this._pending = !1, this.events.modelChanged.dispatch({
|
|
@@ -1371,7 +1371,7 @@ class q {
|
|
|
1371
1371
|
* If you specify an attribute name, determine if that attribute has changed.
|
|
1372
1372
|
*/
|
|
1373
1373
|
hasChanged(e) {
|
|
1374
|
-
return e == null ? !
|
|
1374
|
+
return e == null ? !J(this.changed) : Z(this.changed, e);
|
|
1375
1375
|
}
|
|
1376
1376
|
/**
|
|
1377
1377
|
* Return an object containing all the attributes that have changed. Useful for determining what parts
|
|
@@ -1383,9 +1383,9 @@ class q {
|
|
|
1383
1383
|
changedAttributes(e) {
|
|
1384
1384
|
if (!e) return this.hasChanged() ? C(this.changed) : {};
|
|
1385
1385
|
const t = this._changing ? this._previousAttributes : this.attributes, s = {};
|
|
1386
|
-
for (const
|
|
1387
|
-
const i = e[
|
|
1388
|
-
|
|
1386
|
+
for (const o in e) {
|
|
1387
|
+
const i = e[o];
|
|
1388
|
+
M(t[o], i) || (s[o] = i);
|
|
1389
1389
|
}
|
|
1390
1390
|
return s;
|
|
1391
1391
|
}
|
|
@@ -1406,10 +1406,10 @@ class q {
|
|
|
1406
1406
|
*/
|
|
1407
1407
|
clone() {
|
|
1408
1408
|
const e = C(this.attributes);
|
|
1409
|
-
return new
|
|
1409
|
+
return new V(e);
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
|
-
class
|
|
1412
|
+
class k {
|
|
1413
1413
|
/**
|
|
1414
1414
|
* Private constructor to enforce singleton pattern.
|
|
1415
1415
|
*/
|
|
@@ -1421,7 +1421,7 @@ class b {
|
|
|
1421
1421
|
* @returns The shared AcCmPerformanceCollector instance.
|
|
1422
1422
|
*/
|
|
1423
1423
|
static getInstance() {
|
|
1424
|
-
return
|
|
1424
|
+
return k.instance || (k.instance = new k()), k.instance;
|
|
1425
1425
|
}
|
|
1426
1426
|
/**
|
|
1427
1427
|
* Adds or replaces a performance entry by name.
|
|
@@ -1468,7 +1468,7 @@ class b {
|
|
|
1468
1468
|
return this.entries.delete(e);
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
class
|
|
1471
|
+
class he {
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Converts a byte count to a human-readable string using appropriate size units.
|
|
1474
1474
|
*
|
|
@@ -1493,11 +1493,253 @@ class le {
|
|
|
1493
1493
|
*/
|
|
1494
1494
|
static formatBytes(e, t = 2) {
|
|
1495
1495
|
if (e === 0) return "0 B";
|
|
1496
|
-
const s = 1024,
|
|
1497
|
-
return `${parseFloat(c.toFixed(
|
|
1496
|
+
const s = 1024, o = Math.max(0, t), i = ["B", "KB", "MB", "GB", "TB"], a = Math.floor(Math.log(e) / Math.log(s)), c = e / Math.pow(s, a);
|
|
1497
|
+
return `${parseFloat(c.toFixed(o))} ${i[a]}`;
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
|
|
1500
|
+
var y = /* @__PURE__ */ ((r) => (r[r.ByLayer = 0] = "ByLayer", r[r.ByBlock = 1] = "ByBlock", r[r.ByAlpha = 2] = "ByAlpha", r[r.ErrorValue = 3] = "ErrorValue", r))(y || {});
|
|
1501
|
+
class v {
|
|
1502
|
+
/**
|
|
1503
|
+
* Creates a new transparency object.
|
|
1504
|
+
*
|
|
1505
|
+
* @param alpha
|
|
1506
|
+
* When provided, constructs with `ByAlpha` method and sets alpha.
|
|
1507
|
+
* Must be between 0 and 255.
|
|
1508
|
+
*/
|
|
1509
|
+
constructor(e) {
|
|
1510
|
+
e !== void 0 ? (this._method = y.ByAlpha, this._alpha = v.clampAlpha(e)) : (this._method = y.ByLayer, this._alpha = 255);
|
|
1511
|
+
}
|
|
1512
|
+
/** Gets the current transparency method */
|
|
1513
|
+
get method() {
|
|
1514
|
+
return this._method;
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Sets the transparency method.
|
|
1518
|
+
* If setting to ByAlpha with no prior alpha, alpha stays 255 (opaque).
|
|
1519
|
+
*
|
|
1520
|
+
* @param method The new transparency method
|
|
1521
|
+
*/
|
|
1522
|
+
set method(e) {
|
|
1523
|
+
this._method = e;
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Gets the alpha value.
|
|
1527
|
+
* Only meaningful if `method === ByAlpha`.
|
|
1528
|
+
*/
|
|
1529
|
+
get alpha() {
|
|
1530
|
+
return this._alpha;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Sets the alpha value and force the method to `ByAlpha`.
|
|
1534
|
+
*
|
|
1535
|
+
* @param alpha 0–255 alpha, clamped internally if out of range
|
|
1536
|
+
*/
|
|
1537
|
+
set alpha(e) {
|
|
1538
|
+
this._alpha = v.clampAlpha(e), this._method = y.ByAlpha;
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Gets the AutoCAD-style transparency percentage.
|
|
1542
|
+
*
|
|
1543
|
+
* Mapping rules:
|
|
1544
|
+
* - 0% = fully opaque (alpha = 255)
|
|
1545
|
+
* - 100% = fully transparent (alpha = 0)
|
|
1546
|
+
*
|
|
1547
|
+
* This matches how AutoCAD displays and stores transparency
|
|
1548
|
+
* values in UI and DXF files.
|
|
1549
|
+
*
|
|
1550
|
+
* If the transparency method is not `ByAlpha`,
|
|
1551
|
+
* this method returns `undefined`, because AutoCAD
|
|
1552
|
+
* does not define a percentage for ByLayer or ByBlock.
|
|
1553
|
+
*
|
|
1554
|
+
* @returns Transparency percentage (0–100), or undefined
|
|
1555
|
+
*/
|
|
1556
|
+
get percentage() {
|
|
1557
|
+
if (this._method === y.ByAlpha)
|
|
1558
|
+
return Math.round((1 - this._alpha / 255) * 100);
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Sets the transparency using an AutoCAD-style percentage.
|
|
1562
|
+
*
|
|
1563
|
+
* Mapping rules (AutoCAD compatible):
|
|
1564
|
+
* - 0% → fully opaque (alpha = 255)
|
|
1565
|
+
* - 100% → fully transparent (alpha = 0)
|
|
1566
|
+
*
|
|
1567
|
+
* Internally, the alpha value is calculated as:
|
|
1568
|
+
* alpha = round(255 × (1 − percentage / 100))
|
|
1569
|
+
*
|
|
1570
|
+
* This method:
|
|
1571
|
+
* - Forces the transparency method to `ByAlpha`
|
|
1572
|
+
* - Clamps the percentage to the range 0–100
|
|
1573
|
+
* - Preserves ObjectARX value semantics
|
|
1574
|
+
*
|
|
1575
|
+
* @param percentage Transparency percentage (0–100)
|
|
1576
|
+
* @returns This instance (for fluent chaining)
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* const t = new AcCmTransparency();
|
|
1580
|
+
* t.setPercentage(50); // ≈ alpha 128
|
|
1581
|
+
*
|
|
1582
|
+
* t.setPercentage(0); // alpha = 255 (opaque)
|
|
1583
|
+
* t.setPercentage(100); // alpha = 0 (clear)
|
|
1584
|
+
*/
|
|
1585
|
+
set percentage(e) {
|
|
1586
|
+
const t = Math.max(0, Math.min(100, e)), s = Math.round(255 * (1 - t / 100));
|
|
1587
|
+
this.alpha = s;
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Ensures alpha always stays within 0–255.
|
|
1591
|
+
*/
|
|
1592
|
+
static clampAlpha(e) {
|
|
1593
|
+
return Math.max(0, Math.min(255, Math.floor(e)));
|
|
1594
|
+
}
|
|
1595
|
+
/**
|
|
1596
|
+
* True if the method is `ByAlpha`.
|
|
1597
|
+
*/
|
|
1598
|
+
get isByAlpha() {
|
|
1599
|
+
return this._method === y.ByAlpha;
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* True if the method is `ByBlock`.
|
|
1603
|
+
*/
|
|
1604
|
+
get isByBlock() {
|
|
1605
|
+
return this._method === y.ByBlock;
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* True if the method is `ByLayer`.
|
|
1609
|
+
*/
|
|
1610
|
+
get isByLayer() {
|
|
1611
|
+
return this._method === y.ByLayer;
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* True if transparency is exactly clear (alpha==0 and ByAlpha).
|
|
1615
|
+
*/
|
|
1616
|
+
get isClear() {
|
|
1617
|
+
return this.isByAlpha && this._alpha === 0;
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* True if transparency is solid (alpha==255 and ByAlpha).
|
|
1621
|
+
*/
|
|
1622
|
+
get isSolid() {
|
|
1623
|
+
return this.isByAlpha && this._alpha === 255;
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* True if current state is invalid (ErrorValue).
|
|
1627
|
+
*/
|
|
1628
|
+
get isInvalid() {
|
|
1629
|
+
return this._method === y.ErrorValue;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Convert this transparency to an integer suitable for storage.
|
|
1633
|
+
* Uses a simple bit-encoding: highbits for method and lowbits for alpha.
|
|
1634
|
+
*
|
|
1635
|
+
* 31 24 23 8 7 0
|
|
1636
|
+
* +-------------+--------------+------------+
|
|
1637
|
+
* | flags | reserved | alpha |
|
|
1638
|
+
* +-------------+--------------+------------+
|
|
1639
|
+
*/
|
|
1640
|
+
serialize() {
|
|
1641
|
+
return this._method << 24 | this._alpha;
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Creates a deep copy of this transparency object.
|
|
1645
|
+
*
|
|
1646
|
+
* This mirrors the value-semantics of ObjectARX `AcCmTransparency`,
|
|
1647
|
+
* where copying results in an independent object with the same
|
|
1648
|
+
* transparency method and alpha value.
|
|
1649
|
+
*
|
|
1650
|
+
* @returns A new `AcCmTransparency` instance with identical state.
|
|
1651
|
+
*/
|
|
1652
|
+
clone() {
|
|
1653
|
+
const e = new v();
|
|
1654
|
+
return e._method = this._method, e._alpha = this._alpha, e;
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Compares this transparency with another one for equality.
|
|
1658
|
+
*
|
|
1659
|
+
* Two `AcCmTransparency` objects are considered equal if:
|
|
1660
|
+
* - Their transparency methods are identical
|
|
1661
|
+
* - Their alpha values are identical
|
|
1662
|
+
*
|
|
1663
|
+
* This mirrors the value semantics of ObjectARX
|
|
1664
|
+
* `AcCmTransparency`.
|
|
1665
|
+
*
|
|
1666
|
+
* @param other The transparency to compare with
|
|
1667
|
+
* @returns True if both represent the same transparency
|
|
1668
|
+
*
|
|
1669
|
+
* @example
|
|
1670
|
+
* const a = new AcCmTransparency(128);
|
|
1671
|
+
* const b = new AcCmTransparency(128);
|
|
1672
|
+
* a.equals(b); // true
|
|
1673
|
+
*/
|
|
1674
|
+
equals(e) {
|
|
1675
|
+
return this._method === e._method && this._alpha === e._alpha;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Returns a human-readable string representation of the transparency.
|
|
1679
|
+
*
|
|
1680
|
+
* Behavior:
|
|
1681
|
+
* - `"ByLayer"` if transparency is inherited from layer
|
|
1682
|
+
* - `"ByBlock"` if transparency is inherited from block
|
|
1683
|
+
* - Numeric alpha value (`"0"`–`"255"`) if method is `ByAlpha`
|
|
1684
|
+
*
|
|
1685
|
+
* This format is intentionally simple and mirrors common
|
|
1686
|
+
* AutoCAD UI and DXF text usage.
|
|
1687
|
+
*
|
|
1688
|
+
* @returns String representation of the transparency
|
|
1689
|
+
*
|
|
1690
|
+
* @example
|
|
1691
|
+
* new AcCmTransparency().toString(); // "ByLayer"
|
|
1692
|
+
* new AcCmTransparency(128).toString(); // "128"
|
|
1693
|
+
*/
|
|
1694
|
+
toString() {
|
|
1695
|
+
return this.isByLayer ? "ByLayer" : this.isByBlock ? "ByBlock" : this._alpha.toString();
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Creates an `AcCmTransparency` instance from a string representation.
|
|
1699
|
+
*
|
|
1700
|
+
* Accepted formats:
|
|
1701
|
+
* - `"ByLayer"` (case-insensitive)
|
|
1702
|
+
* - `"ByBlock"` (case-insensitive)
|
|
1703
|
+
* - Numeric alpha value `"0"`–`"255"`
|
|
1704
|
+
*
|
|
1705
|
+
* Invalid or out-of-range values will produce an
|
|
1706
|
+
* `ErrorValue` transparency.
|
|
1707
|
+
*
|
|
1708
|
+
* @param value String to parse
|
|
1709
|
+
* @returns Parsed `AcCmTransparency` instance
|
|
1710
|
+
*
|
|
1711
|
+
* @example
|
|
1712
|
+
* AcCmTransparency.fromString("ByLayer");
|
|
1713
|
+
* AcCmTransparency.fromString("128");
|
|
1714
|
+
* AcCmTransparency.fromString("ByBlock");
|
|
1715
|
+
*/
|
|
1716
|
+
static fromString(e) {
|
|
1717
|
+
const t = e.trim();
|
|
1718
|
+
if (/^bylayer$/i.test(t)) {
|
|
1719
|
+
const i = new v();
|
|
1720
|
+
return i._method = y.ByLayer, i;
|
|
1721
|
+
}
|
|
1722
|
+
if (/^byblock$/i.test(t)) {
|
|
1723
|
+
const i = new v();
|
|
1724
|
+
return i._method = y.ByBlock, i;
|
|
1725
|
+
}
|
|
1726
|
+
const s = Number(t);
|
|
1727
|
+
if (Number.isInteger(s) && s >= 0 && s <= 255)
|
|
1728
|
+
return new v(s);
|
|
1729
|
+
const o = new v();
|
|
1730
|
+
return o._method = y.ErrorValue, o;
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Deserialize an integer back into a transparency object.
|
|
1734
|
+
*
|
|
1735
|
+
* @param value 32-bit stored transparency representation
|
|
1736
|
+
*/
|
|
1737
|
+
static deserialize(e) {
|
|
1738
|
+
const t = e >>> 24 & 255, s = e & 255, o = Object.values(y)[t] ?? y.ErrorValue, i = new v();
|
|
1739
|
+
return i._method = o, i._alpha = v.clampAlpha(s), i;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
class ue {
|
|
1501
1743
|
/**
|
|
1502
1744
|
* Creates a new task with the specified name.
|
|
1503
1745
|
*
|
|
@@ -1520,7 +1762,7 @@ class ae {
|
|
|
1520
1762
|
throw new Error("run() must be implemented by subclass");
|
|
1521
1763
|
}
|
|
1522
1764
|
}
|
|
1523
|
-
class
|
|
1765
|
+
class ce {
|
|
1524
1766
|
constructor() {
|
|
1525
1767
|
this.tasks = [], this.onProgress = () => {
|
|
1526
1768
|
}, this.onComplete = () => {
|
|
@@ -1537,10 +1779,10 @@ class he {
|
|
|
1537
1779
|
*/
|
|
1538
1780
|
scheduleTask(e) {
|
|
1539
1781
|
return new Promise((t, s) => {
|
|
1540
|
-
const
|
|
1782
|
+
const o = () => {
|
|
1541
1783
|
Promise.resolve(e()).then(t).catch(s);
|
|
1542
1784
|
};
|
|
1543
|
-
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(
|
|
1785
|
+
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(o) : setTimeout(o, 0);
|
|
1544
1786
|
});
|
|
1545
1787
|
}
|
|
1546
1788
|
/**
|
|
@@ -1575,22 +1817,22 @@ class he {
|
|
|
1575
1817
|
async run(e) {
|
|
1576
1818
|
const t = this.tasks.length;
|
|
1577
1819
|
let s = e;
|
|
1578
|
-
for (let
|
|
1579
|
-
const i = this.tasks[
|
|
1820
|
+
for (let o = 0; o < t; o++) {
|
|
1821
|
+
const i = this.tasks[o];
|
|
1580
1822
|
try {
|
|
1581
1823
|
s = await this.scheduleTask(async () => {
|
|
1582
1824
|
const a = await i.run(s);
|
|
1583
|
-
return this.onProgress((
|
|
1825
|
+
return this.onProgress((o + 1) / t, i), a;
|
|
1584
1826
|
});
|
|
1585
1827
|
} catch (a) {
|
|
1586
|
-
if (this.onError({ error: a, taskIndex:
|
|
1828
|
+
if (this.onError({ error: a, taskIndex: o, task: i }))
|
|
1587
1829
|
break;
|
|
1588
1830
|
}
|
|
1589
1831
|
}
|
|
1590
1832
|
this.onComplete(s);
|
|
1591
1833
|
}
|
|
1592
1834
|
}
|
|
1593
|
-
class
|
|
1835
|
+
class re {
|
|
1594
1836
|
/**
|
|
1595
1837
|
* Create a new AcCmLoadingManager instance
|
|
1596
1838
|
* @param onLoad this function will be called when all loaders are done.
|
|
@@ -1667,21 +1909,21 @@ class ee {
|
|
|
1667
1909
|
*/
|
|
1668
1910
|
getHandler(e) {
|
|
1669
1911
|
for (let t = 0, s = this.handlers.length; t < s; t += 2) {
|
|
1670
|
-
const
|
|
1671
|
-
if (
|
|
1912
|
+
const o = this.handlers[t], i = this.handlers[t + 1];
|
|
1913
|
+
if (o.global && (o.lastIndex = 0), o.test(e))
|
|
1672
1914
|
return i;
|
|
1673
1915
|
}
|
|
1674
1916
|
return null;
|
|
1675
1917
|
}
|
|
1676
1918
|
}
|
|
1677
|
-
const
|
|
1678
|
-
class
|
|
1919
|
+
const se = /* @__PURE__ */ new re();
|
|
1920
|
+
class de {
|
|
1679
1921
|
/**
|
|
1680
1922
|
* Creates a new AcCmLoader instance.
|
|
1681
1923
|
* @param manager The loadingManager for the loader to use. Default is DefaultLoadingManager.
|
|
1682
1924
|
*/
|
|
1683
1925
|
constructor(e) {
|
|
1684
|
-
this.manager = e !== void 0 ? e :
|
|
1926
|
+
this.manager = e !== void 0 ? e : se, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
|
|
1685
1927
|
}
|
|
1686
1928
|
/**
|
|
1687
1929
|
* This method is equivalent to 'load', but returns a Promise.
|
|
@@ -1692,8 +1934,8 @@ class ue {
|
|
|
1692
1934
|
* @returns Return a promise.
|
|
1693
1935
|
*/
|
|
1694
1936
|
loadAsync(e, t) {
|
|
1695
|
-
return new Promise((s,
|
|
1696
|
-
this.load(e, s, t,
|
|
1937
|
+
return new Promise((s, o) => {
|
|
1938
|
+
this.load(e, s, t, o);
|
|
1697
1939
|
});
|
|
1698
1940
|
}
|
|
1699
1941
|
/**
|
|
@@ -1747,28 +1989,30 @@ class ue {
|
|
|
1747
1989
|
}
|
|
1748
1990
|
}
|
|
1749
1991
|
export {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1992
|
+
B as AcCmColor,
|
|
1993
|
+
n as AcCmColorMethod,
|
|
1994
|
+
b as AcCmColorUtil,
|
|
1995
|
+
oe as AcCmEntityColor,
|
|
1996
|
+
ne as AcCmErrors,
|
|
1997
|
+
ie as AcCmEventDispatcher,
|
|
1998
|
+
D as AcCmEventManager,
|
|
1999
|
+
de as AcCmLoader,
|
|
2000
|
+
re as AcCmLoadingManager,
|
|
2001
|
+
V as AcCmObject,
|
|
2002
|
+
k as AcCmPerformanceCollector,
|
|
2003
|
+
ue as AcCmTask,
|
|
2004
|
+
ce as AcCmTaskScheduler,
|
|
2005
|
+
v as AcCmTransparency,
|
|
2006
|
+
y as AcCmTransparencyMethod,
|
|
2007
|
+
he as AcTrStringUtil,
|
|
2008
|
+
le as DEBUG_MODE,
|
|
2009
|
+
se as DefaultLoadingManager,
|
|
1766
2010
|
C as clone,
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
2011
|
+
F as deepClone,
|
|
2012
|
+
Y as defaults,
|
|
2013
|
+
Z as has,
|
|
2014
|
+
J as isEmpty,
|
|
2015
|
+
M as isEqual,
|
|
2016
|
+
O as log,
|
|
2017
|
+
ae as setLogLevel
|
|
1774
2018
|
};
|