@mlightcad/common 1.2.5 → 1.2.6

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 CHANGED
@@ -1,20 +1,21 @@
1
- function H(n, e) {
1
+ function z(r, e) {
2
2
  for (var t = 0; t < e.length; t++) {
3
- const r = e[t];
4
- if (typeof r != "string" && !Array.isArray(r)) {
5
- for (const o in r)
6
- if (o !== "default" && !(o in n)) {
7
- const i = Object.getOwnPropertyDescriptor(r, o);
8
- i && Object.defineProperty(n, o, i.get ? i : {
3
+ const s = e[t];
4
+ if (typeof s != "string" && !Array.isArray(s)) {
5
+ for (const n in s)
6
+ if (n !== "default" && !(n in r)) {
7
+ const i = Object.getOwnPropertyDescriptor(s, n);
8
+ i && Object.defineProperty(r, n, i.get ? i : {
9
9
  enumerable: !0,
10
- get: () => r[o]
10
+ get: () => s[n]
11
11
  });
12
12
  }
13
13
  }
14
14
  }
15
- return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
15
+ return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
16
16
  }
17
- const I = {
17
+ var o = /* @__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))(o || {});
18
+ const S = {
18
19
  aliceblue: 15792383,
19
20
  antiquewhite: 16444375,
20
21
  aqua: 65535,
@@ -159,7 +160,7 @@ const I = {
159
160
  whitesmoke: 16119285,
160
161
  yellow: 16776960,
161
162
  yellowgreen: 10145074
162
- }, T = [
163
+ }, x = [
163
164
  0,
164
165
  16711680,
165
166
  16776960,
@@ -418,266 +419,543 @@ const I = {
418
419
  16777215,
419
420
  0
420
421
  ];
421
- function w(n, e, t) {
422
- return Math.max(e, Math.min(t, n));
423
- }
424
- const C = class C {
422
+ class B {
425
423
  /**
426
- * Constructs a new AcCmColor instance.
427
- * Initializes the color to "ByLayer" (index 256) and null RGB values.
424
+ * Returns the RGB color value for a given AutoCAD color index.
425
+ *
426
+ * @param {number} index - The AutoCAD color index value (0-255).
427
+ * @returns {number} The RGB color value as a 24-bit integer.
428
+ *
429
+ * @example
430
+ * ```typescript
431
+ * // Get the RGB value for color index 1 (red)
432
+ * const redColor = AcCmColorUtil.getAcadColor(1); // returns 16711680 (0xFF0000)
433
+ * ```
434
+ *
435
+ * @example
436
+ * ```typescript
437
+ * // Get special inheritance colors
438
+ * const byBlock = AcCmColorUtil.getAcadColor(0); // "ByBlock" color
439
+ * const byLayer = AcCmColorUtil.getAcadColor(256); // "ByLayer" color
440
+ * ```
428
441
  */
429
- constructor() {
430
- this._colorIndex = 256, this._color = null, this._colorName = null;
442
+ static getColorByIndex(e) {
443
+ return x[e];
431
444
  }
432
445
  /**
433
- * Gets the current color value.
446
+ * Finds the AutoCAD color index associated with a given RGB value.
434
447
  *
435
- * @returns {number | null} The color value (RGB or index).
448
+ * @private
449
+ * @param {number} color - The RGB value to find an index for.
450
+ * @returns {number | undefined} The color index if found, undefined otherwise.
436
451
  */
437
- get color() {
438
- return this._color;
452
+ static getIndexByColor(e) {
453
+ const t = x.length - 1;
454
+ for (let s = 1; s < t; ++s)
455
+ if (x[s] === e)
456
+ return s;
439
457
  }
440
458
  /**
441
- * Sets the color value.
459
+ * Returns the RGB color value for a given CSS color name.
460
+ *
461
+ * @param {string} name - The CSS color name (e.g., "red", "blue", "aliceblue").
462
+ * @returns {number | undefined} The RGB color value as a 24-bit integer, or undefined if the name is not found.
463
+ *
464
+ * @example
465
+ * ```typescript
466
+ * // Get the RGB value for a standard color name
467
+ * const redColor = AcCmColorUtil.getColorByName("red"); // returns 16711680 (0xFF0000)
468
+ * const blueColor = AcCmColorUtil.getColorByName("blue"); // returns 255 (0x0000FF)
469
+ * ```
442
470
  *
443
- * @param {number | null} value - The color value to set (RGB or index).
471
+ * @example
472
+ * ```typescript
473
+ * // Handle undefined for unknown color names
474
+ * const unknownColor = AcCmColorUtil.getColorByName("unknown"); // returns undefined
475
+ * ```
444
476
  */
445
- set color(e) {
446
- e == null ? this._color = null : (this._color = Math.round(w(e, 0, 256 * 256 * 256 - 1)), this._colorIndex = this.getColorIndexByValue(this._color), this._colorName = this.getColorNameByValue(this._color));
477
+ static getColorByName(e) {
478
+ return S[e.toLowerCase()];
447
479
  }
448
480
  /**
449
- * Gets the hexadecimal representation of the current color.
481
+ * Finds the color name associated with a given RGB value.
450
482
  *
451
- * @returns {string} The hexadecimal color string (e.g., "0xFFFFFF").
483
+ * @param {number} rgb - The RGB value to find a name for.
484
+ * @returns {string | undefined} The color name if found, undefined otherwise.
452
485
  */
453
- get hexColor() {
454
- if (this._color && this._color > 0 && this._color <= 16777215) {
455
- let e = this._color.toString(16).toUpperCase();
456
- for (; e.length < 6; )
457
- e = "0" + e;
458
- return `0x${e}`;
459
- }
460
- return "";
486
+ static getNameByColor(e) {
487
+ for (const [t, s] of Object.entries(S))
488
+ if (s === e)
489
+ return t;
461
490
  }
462
491
  /**
463
- * Gets the CSS RGB color string representation.
492
+ * Finds the color name associated with a given color index.
464
493
  *
465
- * @returns {string} The CSS RGB color string (e.g., "rgb(255,255,255)").
494
+ * @param {number} index - The color index to find a name for.
495
+ * @returns {string | undefined} The color name if found, undefined otherwise.
466
496
  */
467
- get cssColor() {
468
- return `rgb(${this.red},${this.green},${this.blue})`;
497
+ static getNameByIndex(e) {
498
+ const t = this.getColorByIndex(e);
499
+ return this.getNameByColor(t);
469
500
  }
501
+ }
502
+ class v {
470
503
  /**
471
- * Gets the red component of the current color.
472
- *
473
- * @returns {number | null} The red component (0-255).
504
+ * Constructs a new AcCmColor.
505
+ * @param method Initial color method (defaults to `ByColor`)
506
+ * @param value Internal packed value
474
507
  */
475
- get red() {
476
- return this.color ? this.color >> 16 & 255 : null;
508
+ constructor(e = o.ByLayer, t) {
509
+ this._colorMethod = e, this._colorMethod == o.ByColor && t == null ? this._value = 16777215 : this._colorMethod == o.ByACI ? t == null ? this._value = 8 : t === 0 ? this._colorMethod = o.ByBlock : t === 256 ? this._colorMethod = o.ByLayer : this._value = Math.max(0, Math.min(t, 256)) : this._value = t;
510
+ }
511
+ // ---------------------------------------------------------------------
512
+ // Color method
513
+ // ---------------------------------------------------------------------
514
+ /** Gets the current color method. */
515
+ get colorMethod() {
516
+ return this._colorMethod;
477
517
  }
478
518
  /**
479
- * Gets the green component of the current color.
519
+ * Sets the color method.
480
520
  *
481
- * @returns {number | null} The green component (0-255).
521
+ * Note: Changing the method does not modify `_value`.
482
522
  */
523
+ set colorMethod(e) {
524
+ this._colorMethod = e;
525
+ }
526
+ // ---------------------------------------------------------------------
527
+ // RGB accessors (ByColor)
528
+ // ---------------------------------------------------------------------
529
+ /** Gets the red component (0–255). */
530
+ get red() {
531
+ const e = this.RGB;
532
+ return e != null ? e >> 16 & 255 : void 0;
533
+ }
534
+ /** Gets the green component (0–255). */
483
535
  get green() {
484
- return this.color ? this.color >> 8 & 255 : null;
536
+ const e = this.RGB;
537
+ return e != null ? e >> 8 & 255 : void 0;
538
+ }
539
+ /** Gets the blue component (0–255). */
540
+ get blue() {
541
+ const e = this.RGB;
542
+ return e != null ? e & 255 : void 0;
485
543
  }
486
544
  /**
487
- * Gets the blue component of the current color.
545
+ * Gets the packed RGB value (0xRRGGBB).
488
546
  *
489
- * @returns {number | null} The blue component (0-255).
490
- */
491
- get blue() {
492
- return this.color ? this.color & 255 : null;
547
+ * - For `ByColor`, returns `_value` directly
548
+ * - For `ByACI`, converts index to RGB via `AcCmColorUtil`
549
+ * - For `ByLayer` or `ByBlock`, returns `_value` directly
550
+ */
551
+ get RGB() {
552
+ switch (this._colorMethod) {
553
+ case o.ByColor:
554
+ case o.ByBlock:
555
+ case o.ByLayer:
556
+ return this._value;
557
+ case o.ByACI:
558
+ return this._value ? B.getColorByIndex(this._value) : this._value;
559
+ default:
560
+ return;
561
+ }
493
562
  }
494
563
  /**
495
- * Gets the AutoCAD color index value. The index value will be in the range 0 to 256.
496
- * 0 and 256 are special values.
564
+ * Sets the RGB color.
497
565
  *
498
- * @returns {number | null} The color index.
566
+ * @param r Red component (0–255)
567
+ * @param g Green component (0–255)
568
+ * @param b Blue component (0–255)
569
+ * @returns The current instance for chaining
499
570
  */
500
- get colorIndex() {
501
- return this._colorIndex;
571
+ setRGB(e, t, s) {
572
+ const n = 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 = n << 16 | i << 8 | a, this._colorMethod = o.ByColor, this;
502
574
  }
503
575
  /**
504
- * Sets the AutoCAD color index value. If value less than 0 is set, 0 will be used. If value greater than
505
- * 256 is set, 256 will be used.
506
- * - 0 indicates that the entity uses the color of the BlockReference that's displaying it. If the entity
507
- * is not displayed through a block reference (for example, it is directly owned by the model space
508
- * block table record) and its color is 0, then it will display as though its color were 7.
509
- * - 256 indicates that the entity uses the color specified in the layer table record it references.
576
+ * Sets the RGB color by a single packed number (0xRRGGBB).
510
577
  *
511
- * @param {number | null} value - The color index to set (0-256).
578
+ * @param value Packed RGB number
512
579
  */
513
- set colorIndex(e) {
514
- e == null ? this._colorIndex = null : (this._colorIndex = w(e, 0, 256), this._colorIndex > 0 && this._colorIndex < 256 ? (this._color = T[e], this._colorName = this.getColorNameByValue(this._color)) : (this._color = null, this._colorName = null));
580
+ setRGBValue(e) {
581
+ return e == null || !Number.isFinite(e) ? (console.warn("Invalid RGB value:", e), this) : (this._value = e & 16777215, this._colorMethod = o.ByColor, this);
515
582
  }
516
583
  /**
517
- * Gets the name of the current color.
584
+ * Sets the RGB color from a CSS color string.
518
585
  *
519
- * @returns {string | null} The color name.
520
- */
521
- get colorName() {
522
- return this._colorName;
586
+ * Examples:
587
+ * - "#FF00FF"
588
+ * - "#F0F"
589
+ * - "rgb(255,0,255)"
590
+ * - "rgba(255,0,255,0.5)"
591
+ * - "red" (named colors)
592
+ *
593
+ * @param cssString CSS color string
594
+ * @returns The current instance for chaining
595
+ */
596
+ setRGBFromCss(e) {
597
+ if (!e) return this;
598
+ const t = e.trim().toLowerCase();
599
+ if (t.startsWith("#")) {
600
+ let i = 0, a = 0, c = 0;
601
+ if (t.length === 7)
602
+ i = parseInt(t.substr(1, 2), 16), a = parseInt(t.substr(3, 2), 16), c = parseInt(t.substr(5, 2), 16);
603
+ else if (t.length === 4)
604
+ i = parseInt(t[1] + t[1], 16), a = parseInt(t[2] + t[2], 16), c = parseInt(t[3] + t[3], 16);
605
+ else
606
+ return console.warn("Invalid hex color:", e), this;
607
+ return this.setRGB(i, a, c);
608
+ }
609
+ const s = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
610
+ if (s) {
611
+ const i = parseInt(s[1], 10), a = parseInt(s[2], 10), c = parseInt(s[3], 10);
612
+ return this.setRGB(i, a, c);
613
+ }
614
+ const n = B.getColorByName(e);
615
+ return n !== void 0 ? this.setRGBValue(n) : (console.warn("Unknown CSS color string:", e), this);
523
616
  }
524
617
  /**
525
- * Sets the color by name.
618
+ * Sets the color as a scalar grayscale value.
526
619
  *
527
- * @param {string | null} value - The color name to set.
620
+ * @param scalar Scalar value (0–255)
621
+ * @returns The current instance for chaining
528
622
  */
529
- set colorName(e) {
530
- if (e) {
531
- const t = I[e.toLowerCase()];
532
- t !== void 0 ? (this._colorName = e, this._color = t, this._colorIndex = this.getColorIndexByValue(this._color)) : console.warn("Unknown color: " + e);
533
- } else
534
- this._colorName = null;
623
+ setScalar(e) {
624
+ return this.setRGB(e, e, e);
535
625
  }
536
626
  /**
537
- * Checks if the color has a name.
538
- *
539
- * @returns {boolean} True if the color has no name, false otherwise.
627
+ * Gets the hexadecimal representation of the color (e.g., "0xFF00FF").
540
628
  */
541
- get hasColorName() {
542
- return this._colorName == null;
629
+ get hexColor() {
630
+ const e = this.RGB;
631
+ return e == null ? void 0 : "0x" + e.toString(16).padStart(6, "0").toUpperCase();
543
632
  }
544
633
  /**
545
- * Checks if the color has an index.
546
- *
547
- * @returns {boolean} True if the color has no index, false otherwise.
634
+ * Gets the CSS RGB color string (e.g., "rgb(255,0,255)").
548
635
  */
549
- get hasColorIndex() {
550
- return this._colorIndex == null;
636
+ get cssColor() {
637
+ const e = this.RGB;
638
+ if (e != null)
639
+ return `rgb(${e >> 16 & 255},${e >> 8 & 255},${e & 255})`;
640
+ }
641
+ // ---------------------------------------------------------------------
642
+ // ACI accessors (ByACI)
643
+ // ---------------------------------------------------------------------
644
+ /** Gets the AutoCAD Color Index (ACI), or undefined if not ByACI, ByBlock, or ByLayer. */
645
+ get colorIndex() {
646
+ return this._colorMethod === o.ByACI ? this._value : this._colorMethod === o.ByLayer ? 256 : this._colorMethod === o.ByBlock ? 0 : void 0;
551
647
  }
552
648
  /**
553
- * Checks if the color is set to "ByLayer".
649
+ * Sets the AutoCAD Color Index (0–256).
650
+ *
651
+ * - 0 sets the color method to `ByBlock`
652
+ * - 256 sets the color method to `ByLayer`
653
+ * - 1–255 sets the color method to `ByACI`
554
654
  *
555
- * @returns {boolean} True if the color is "ByLayer", false otherwise.
655
+ * @param index ACI index
556
656
  */
557
- get isByLayer() {
558
- return this.colorIndex == 256;
657
+ set colorIndex(e) {
658
+ if (e == null) return;
659
+ const t = Math.max(0, Math.min(256, Math.round(e)));
660
+ t === 0 ? (this._colorMethod = o.ByBlock, this._value = void 0) : t === 256 ? (this._colorMethod = o.ByLayer, this._value = void 0) : (this._colorMethod = o.ByACI, this._value = t);
559
661
  }
560
662
  /**
561
- * Sets the color to "ByLayer".
562
- *
563
- * @returns {AcCmColor} The current instance.
663
+ * Returns true if the color method is ByColor (explicit RGB).
564
664
  */
565
- setByLayer() {
566
- return this.colorIndex = 256, this;
665
+ get isByColor() {
666
+ return this._colorMethod === o.ByColor;
567
667
  }
568
668
  /**
569
- * Checks if the color is set to "ByBlock".
570
- *
571
- * @returns {boolean} True if the color is "ByBlock", false otherwise.
669
+ * Returns true if the color method is ByACI.
572
670
  */
573
- get isByBlock() {
574
- return this.colorIndex == 0;
671
+ get isByACI() {
672
+ return this._colorMethod === o.ByACI;
673
+ }
674
+ // ---------------------------------------------------------------------
675
+ // Layer / Block helpers
676
+ // ---------------------------------------------------------------------
677
+ /** Returns true if the color method is ByLayer. */
678
+ get isByLayer() {
679
+ return this._colorMethod === o.ByLayer;
575
680
  }
576
681
  /**
577
- * Sets the color to "ByBlock".
578
- *
579
- * @returns {AcCmColor} The current instance.
682
+ * Sets the color to ByLayer.
683
+ * @param value - Option layer color value
580
684
  */
581
- setByBlock() {
582
- return this.colorIndex = 0, this;
685
+ setByLayer(e) {
686
+ return this._colorMethod = o.ByLayer, e == null ? this._value = 256 : this._value = e, this;
687
+ }
688
+ /** Returns true if the color method is ByBlock. */
689
+ get isByBlock() {
690
+ return this._colorMethod === o.ByBlock;
583
691
  }
584
692
  /**
585
- * Sets the color using a scalar value (RGB).
586
- *
587
- * @param {number} scalar - The scalar value (0-255).
588
- * @returns {AcCmColor} The current instance.
693
+ * Sets the color to ByBlock.
694
+ * @param value - Option layer color value
589
695
  */
590
- setScalar(e) {
591
- return this.setRGB(e, e, e), this;
696
+ setByBlock(e) {
697
+ return this._colorMethod = o.ByBlock, e == null ? this._value = 0 : this._value = e, this;
592
698
  }
699
+ // ---------------------------------------------------------------------
700
+ // Color name (dynamic)
701
+ // ---------------------------------------------------------------------
593
702
  /**
594
- * Sets the color using RGB values.
703
+ * Gets the color name.
595
704
  *
596
- * @param {number} r - The red component (0-255).
597
- * @param {number} g - The green component (0-255).
598
- * @param {number} b - The blue component (0-255).
599
- * @returns {AcCmColor} The current instance.
705
+ * For `ByColor` or `ByACI`, resolves the name via `AcCmColorUtil`.
706
+ * For `ByLayer` or `ByBlock`, returns the corresponding string.
600
707
  */
601
- setRGB(e, t, r) {
602
- const o = Math.round(w(e, 0, 255)), i = Math.round(w(t, 0, 255)), l = Math.round(w(r, 0, 255));
603
- return this.color = (o << 16) + (i << 8) + l, this;
708
+ get colorName() {
709
+ switch (this._colorMethod) {
710
+ case o.ByLayer:
711
+ return "ByLayer";
712
+ case o.ByBlock:
713
+ return "ByBlock";
714
+ case o.ByColor:
715
+ return this._value ? B.getNameByColor(this._value) : "";
716
+ case o.ByACI:
717
+ return this._value ? B.getNameByIndex(this._value) : "";
718
+ default:
719
+ return;
720
+ }
604
721
  }
605
722
  /**
606
723
  * Sets the color by name.
607
724
  *
608
- * @param {string} style - The color name to set.
609
- * @returns {AcCmColor} The current instance.
725
+ * Resolves the name to an RGB value via `AcCmColorUtil`.
726
+ *
727
+ * @param name Color name
610
728
  */
611
- setColorName(e) {
612
- const t = I[e.toLowerCase()];
613
- return t !== void 0 ? this.color = t : console.warn("Unknown color " + e), this;
729
+ set colorName(e) {
730
+ if (!e) return;
731
+ const t = B.getColorByName(e);
732
+ t !== void 0 ? (this._value = t, this._colorMethod = o.ByColor) : console.warn("Unknown color name:", e);
614
733
  }
734
+ // ---------------------------------------------------------------------
735
+ // Clone / Copy / Equals
736
+ // ---------------------------------------------------------------------
615
737
  /**
616
- * Clones the current AcCmColor instance.
738
+ * Creates a clone of this color instance.
617
739
  *
618
- * @returns {AcCmColor} A new AcCmColor instance with the same color and index.
740
+ * @returns A new AcCmColor instance with the same method and value
619
741
  */
620
742
  clone() {
621
- const e = new C();
622
- return e.colorIndex = this.colorIndex, e.color = this.color, e._colorName = this._colorName, this;
743
+ const e = new v();
744
+ return e._colorMethod = this._colorMethod, e._value = this._value, e;
623
745
  }
624
746
  /**
625
- * Copies the color from another AcCmColor instance.
747
+ * Copies color values from another AcCmColor instance.
626
748
  *
627
- * @param {AcCmColor} color - The color to copy from.
628
- * @returns {AcCmColor} The current instance.
749
+ * @param other The source color
750
+ * @returns The current instance
629
751
  */
630
752
  copy(e) {
631
- return this.colorIndex = e.colorIndex, this.color = e.color, this._colorName = e._colorName, this;
753
+ return this._colorMethod = e._colorMethod, this._value = e._value, this;
632
754
  }
633
755
  /**
634
- * Checks if two AcCmColor instances are equal.
756
+ * Checks equality with another color.
635
757
  *
636
- * @param {AcCmColor} c - The color to compare with.
637
- * @returns {boolean} True if the colors and their indices are the same.
758
+ * @param other The color to compare
759
+ * @returns True if color method and value are identical
638
760
  */
639
761
  equals(e) {
640
- return e.color == this.color && e.colorIndex == this.colorIndex && e._colorName == this._colorName;
762
+ return this._colorMethod === e._colorMethod && this._value === e._value;
641
763
  }
764
+ // ---------------------------------------------------------------------
765
+ // String representation
766
+ // ---------------------------------------------------------------------
642
767
  /**
643
768
  * Returns a string representation of the color.
644
769
  *
645
- * @returns {string} The color name or hexadecimal string.
770
+ * - "ByLayer" for ByLayer colors
771
+ * - "ByBlock" for ByBlock colors
772
+ * - One number for color index
773
+ * - Three comma-separated numbers for RGB color
646
774
  */
647
775
  toString() {
648
- return this.isByLayer ? "ByLayer" : this.isByBlock ? "ByBlock" : this.colorName ? this.colorName : this.hexColor;
776
+ switch (this._colorMethod) {
777
+ case o.ByLayer:
778
+ return "ByLayer";
779
+ case o.ByBlock:
780
+ return "ByBlock";
781
+ case o.ByACI:
782
+ return this._value !== void 0 ? String(this._value) : "";
783
+ case o.ByColor:
784
+ return this._value ? `${this.red},${this.green},${this.blue}` : "";
785
+ default:
786
+ return "";
787
+ }
649
788
  }
650
789
  /**
651
- * Finds the color name associated with a given RGB value.
790
+ * Creates one AcCmColor from one string
791
+ */
792
+ static fromString(e) {
793
+ if (!e) return;
794
+ const t = e.trim();
795
+ if (/^bylayer$/i.test(t))
796
+ return new v(o.ByLayer);
797
+ if (/^byblock$/i.test(t))
798
+ return new v(o.ByBlock);
799
+ if (/^\d{1,3},\d{1,3},\d{1,3}$/i.test(t)) {
800
+ const [n, i, a] = t.split(",").map(Number), c = new v(o.ByColor);
801
+ return c.setRGB(n, i, a), c;
802
+ }
803
+ if (/^\d+$/.test(t)) {
804
+ const n = parseInt(t, 10);
805
+ return new v(o.ByACI, n);
806
+ }
807
+ const s = B.getColorByName(t);
808
+ if (s != null)
809
+ return new v(o.ByColor, s);
810
+ console.warn("Unknown color name:", e);
811
+ }
812
+ }
813
+ class re {
814
+ /**
815
+ * Constructs a new `AcCmEntityColor`.
652
816
  *
653
- * @private
654
- * @param {number} target - The RGB value to find a name for.
655
- * @returns {string | null} The color name if found, null otherwise.
817
+ * @param method Initial color method (defaults to `ByColor`)
818
+ * @param value Internal packed value (defaults to `0`)
656
819
  */
657
- getColorNameByValue(e) {
658
- for (const [t, r] of Object.entries(I))
659
- if (r === e)
660
- return t;
661
- return null;
820
+ constructor(e = o.ByColor, t = 0) {
821
+ this._colorMethod = e, this._value = t;
662
822
  }
663
823
  /**
664
- * Finds the AutoCAD color index associated with a given RGB value.
824
+ * Gets the method used to determine the final color.
825
+ */
826
+ get colorMethd() {
827
+ return this._colorMethod;
828
+ }
829
+ // ---------------------------------------------------------------------
830
+ // RGB accessors
831
+ // ---------------------------------------------------------------------
832
+ /**
833
+ * Gets the red component (0–255). Only valid when colorMethod = ByColor.
834
+ */
835
+ get red() {
836
+ return this._value >> 16 & 255;
837
+ }
838
+ /**
839
+ * Sets the red component and updates the packed RGB value.
840
+ */
841
+ set red(e) {
842
+ this._colorMethod = o.ByColor, this._value = this._value & 65535 | (e & 255) << 16;
843
+ }
844
+ /**
845
+ * Gets the green component (0–255). Only valid when colorMethod = ByColor.
846
+ */
847
+ get green() {
848
+ return this._value >> 8 & 255;
849
+ }
850
+ /**
851
+ * Sets the green component and updates the packed RGB value.
852
+ */
853
+ set green(e) {
854
+ this._colorMethod = o.ByColor, this._value = this._value & 16711935 | (e & 255) << 8;
855
+ }
856
+ /**
857
+ * Gets the blue component (0–255). Only valid when colorMethod = ByColor.
858
+ */
859
+ get blue() {
860
+ return this._value & 255;
861
+ }
862
+ /**
863
+ * Sets the blue component and updates the packed RGB value.
864
+ */
865
+ set blue(e) {
866
+ this._colorMethod = o.ByColor, this._value = this._value & 16776960 | e & 255;
867
+ }
868
+ /**
869
+ * Sets all RGB components.
665
870
  *
666
- * @private
667
- * @param {number} target - The RGB value to find an index for.
668
- * @returns {number | null} The color index if found, null otherwise.
669
- */
670
- getColorIndexByValue(e) {
671
- const t = T.length - 1;
672
- for (let r = 1; r < t; ++r)
673
- if (T[r] === e)
674
- return r;
675
- return null;
871
+ * @param r Red (0–255)
872
+ * @param g Green (0–255)
873
+ * @param b Blue (0–255)
874
+ */
875
+ setRGB(e, t, s) {
876
+ this._colorMethod = o.ByColor, this._value = (e & 255) << 16 | (t & 255) << 8 | s & 255;
877
+ }
878
+ // ---------------------------------------------------------------------
879
+ // ACI accessors
880
+ // ---------------------------------------------------------------------
881
+ /**
882
+ * Gets the AutoCAD Color Index (ACI). Only valid when colorMethod = ByACI.
883
+ */
884
+ get colorIndex() {
885
+ return this._value;
886
+ }
887
+ /**
888
+ * Sets the AutoCAD Color Index (ACI).
889
+ */
890
+ set colorIndex(e) {
891
+ this._colorMethod = o.ByACI, this._value = e;
892
+ }
893
+ // ---------------------------------------------------------------------
894
+ // Layer index accessors
895
+ // ---------------------------------------------------------------------
896
+ /**
897
+ * Gets the referenced layer index. Only valid when colorMethod = ByLayer.
898
+ */
899
+ get layerIndex() {
900
+ return this._value;
901
+ }
902
+ /**
903
+ * Sets the layer index for ByLayer color mode.
904
+ */
905
+ set layerIndex(e) {
906
+ this._colorMethod = o.ByLayer, this._value = e;
907
+ }
908
+ // ---------------------------------------------------------------------
909
+ // Utility methods
910
+ // ---------------------------------------------------------------------
911
+ /**
912
+ * Returns true if the color method is ByColor (explicit RGB).
913
+ */
914
+ isByColor() {
915
+ return this._colorMethod === o.ByColor;
916
+ }
917
+ /**
918
+ * Returns true if the color method is ByLayer.
919
+ */
920
+ isByLayer() {
921
+ return this._colorMethod === o.ByLayer;
922
+ }
923
+ /**
924
+ * Returns true if the color method is ByBlock.
925
+ */
926
+ isByBlock() {
927
+ return this._colorMethod === o.ByBlock;
928
+ }
929
+ /**
930
+ * Returns true if the color method is ByACI.
931
+ */
932
+ isByACI() {
933
+ return this._colorMethod === o.ByACI;
676
934
  }
677
- };
678
- C.NAMES = I;
679
- let R = C;
680
- const te = {
935
+ /**
936
+ * Returns true if color is uninitialized or invalid.
937
+ */
938
+ isNone() {
939
+ return this._colorMethod === o.None;
940
+ }
941
+ /**
942
+ * Gets the packed internal value.
943
+ *
944
+ * - RGB → packed 24-bit integer
945
+ * - ACI → index
946
+ * - Layer → index
947
+ */
948
+ get rawValue() {
949
+ return this._value;
950
+ }
951
+ /**
952
+ * Sets a raw internal value. The meaning depends on `colorMethod`.
953
+ */
954
+ set rawValue(e) {
955
+ this._value = e;
956
+ }
957
+ }
958
+ const se = {
681
959
  /**
682
960
  * Throw error ILLEGAL_PARAMETERS when cannot instantiate from given parameter
683
961
  */
@@ -713,7 +991,7 @@ const te = {
713
991
  return new Error("Not implemented yet");
714
992
  }
715
993
  };
716
- class re {
994
+ class ne {
717
995
  /**
718
996
  * Creates {@link AcCmEventDispatcher} object.
719
997
  */
@@ -722,20 +1000,20 @@ class re {
722
1000
  }
723
1001
  addEventListener(e, t) {
724
1002
  this._listeners === void 0 && (this._listeners = {});
725
- const r = this._listeners;
726
- r[e] === void 0 && (r[e] = []), r[e].indexOf(t) === -1 && r[e].push(t);
1003
+ const s = this._listeners;
1004
+ s[e] === void 0 && (s[e] = []), s[e].indexOf(t) === -1 && s[e].push(t);
727
1005
  }
728
1006
  hasEventListener(e, t) {
729
1007
  if (this._listeners === void 0) return !1;
730
- const r = this._listeners;
731
- return r[e] !== void 0 && r[e].indexOf(t) !== -1;
1008
+ const s = this._listeners;
1009
+ return s[e] !== void 0 && s[e].indexOf(t) !== -1;
732
1010
  }
733
1011
  removeEventListener(e, t) {
734
1012
  if (this._listeners === void 0) return;
735
- const o = this._listeners[e];
736
- if (o !== void 0) {
737
- const i = o.indexOf(t);
738
- i !== -1 && o.splice(i, 1);
1013
+ const n = this._listeners[e];
1014
+ if (n !== void 0) {
1015
+ const i = n.indexOf(t);
1016
+ i !== -1 && n.splice(i, 1);
739
1017
  }
740
1018
  }
741
1019
  /**
@@ -744,12 +1022,12 @@ class re {
744
1022
  */
745
1023
  dispatchEvent(e) {
746
1024
  if (this._listeners === void 0) return;
747
- const r = this._listeners[e.type];
748
- if (r !== void 0) {
1025
+ const s = this._listeners[e.type];
1026
+ if (s !== void 0) {
749
1027
  e.target = this;
750
- const o = r.slice(0);
751
- for (let i = 0, l = o.length; i < l; i++)
752
- o[i].call(this, e);
1028
+ const n = s.slice(0);
1029
+ for (let i = 0, a = n.length; i < a; i++)
1030
+ n[i].call(this, e);
753
1031
  }
754
1032
  }
755
1033
  }
@@ -783,223 +1061,237 @@ class U {
783
1061
  * @param payload Input payload passed to listener
784
1062
  */
785
1063
  dispatch(e, ...t) {
786
- for (const r of this.listeners)
787
- r.call(null, e, ...t);
1064
+ for (const s of this.listeners)
1065
+ s.call(null, e, ...t);
788
1066
  }
789
1067
  }
790
1068
  var K = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
791
- function z(n) {
792
- return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
1069
+ function W(r) {
1070
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
793
1071
  }
794
- var q = { exports: {} };
795
- (function(n) {
1072
+ var D = { exports: {} };
1073
+ (function(r) {
796
1074
  (function(e, t) {
797
- n.exports ? n.exports = t() : e.log = t();
1075
+ r.exports ? r.exports = t() : e.log = t();
798
1076
  })(K, function() {
799
1077
  var e = function() {
800
- }, t = "undefined", r = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), o = [
1078
+ }, t = "undefined", s = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), n = [
801
1079
  "trace",
802
1080
  "debug",
803
1081
  "info",
804
1082
  "warn",
805
1083
  "error"
806
- ], i = {}, l = null;
807
- function g(a, h) {
808
- var s = a[h];
809
- if (typeof s.bind == "function")
810
- return s.bind(a);
1084
+ ], i = {}, a = null;
1085
+ function c(h, d) {
1086
+ var l = h[d];
1087
+ if (typeof l.bind == "function")
1088
+ return l.bind(h);
811
1089
  try {
812
- return Function.prototype.bind.call(s, a);
1090
+ return Function.prototype.bind.call(l, h);
813
1091
  } catch {
814
1092
  return function() {
815
- return Function.prototype.apply.apply(s, [a, arguments]);
1093
+ return Function.prototype.apply.apply(l, [h, arguments]);
816
1094
  };
817
1095
  }
818
1096
  }
819
- function L() {
1097
+ function M() {
820
1098
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
821
1099
  }
822
- function y(a) {
823
- return a === "debug" && (a = "log"), typeof console === t ? !1 : a === "trace" && r ? L : console[a] !== void 0 ? g(console, a) : console.log !== void 0 ? g(console, "log") : e;
1100
+ function _(h) {
1101
+ return h === "debug" && (h = "log"), typeof console === t ? !1 : h === "trace" && s ? M : console[h] !== void 0 ? c(console, h) : console.log !== void 0 ? c(console, "log") : e;
824
1102
  }
825
1103
  function p() {
826
- for (var a = this.getLevel(), h = 0; h < o.length; h++) {
827
- var s = o[h];
828
- this[s] = h < a ? e : this.methodFactory(s, a, this.name);
1104
+ for (var h = this.getLevel(), d = 0; d < n.length; d++) {
1105
+ var l = n[d];
1106
+ this[l] = d < h ? e : this.methodFactory(l, h, this.name);
829
1107
  }
830
- if (this.log = this.debug, typeof console === t && a < this.levels.SILENT)
1108
+ if (this.log = this.debug, typeof console === t && h < this.levels.SILENT)
831
1109
  return "No console available for logging";
832
1110
  }
833
- function O(a) {
1111
+ function A(h) {
834
1112
  return function() {
835
- typeof console !== t && (p.call(this), this[a].apply(this, arguments));
1113
+ typeof console !== t && (p.call(this), this[h].apply(this, arguments));
836
1114
  };
837
1115
  }
838
- function d(a, h, s) {
839
- return y(a) || O.apply(this, arguments);
1116
+ function f(h, d, l) {
1117
+ return _(h) || A.apply(this, arguments);
840
1118
  }
841
- function M(a, h) {
842
- var s = this, E, N, m, f = "loglevel";
843
- typeof a == "string" ? f += ":" + a : typeof a == "symbol" && (f = void 0);
844
- function V(c) {
845
- var u = (o[c] || "silent").toUpperCase();
846
- if (!(typeof window === t || !f)) {
1119
+ function R(h, d) {
1120
+ var l = this, k, O, w, y = "loglevel";
1121
+ typeof h == "string" ? y += ":" + h : typeof h == "symbol" && (y = void 0);
1122
+ function j(u) {
1123
+ var g = (n[u] || "silent").toUpperCase();
1124
+ if (!(typeof window === t || !y)) {
847
1125
  try {
848
- window.localStorage[f] = u;
1126
+ window.localStorage[y] = g;
849
1127
  return;
850
1128
  } catch {
851
1129
  }
852
1130
  try {
853
- window.document.cookie = encodeURIComponent(f) + "=" + u + ";";
1131
+ window.document.cookie = encodeURIComponent(y) + "=" + g + ";";
854
1132
  } catch {
855
1133
  }
856
1134
  }
857
1135
  }
858
- function B() {
859
- var c;
860
- if (!(typeof window === t || !f)) {
1136
+ function T() {
1137
+ var u;
1138
+ if (!(typeof window === t || !y)) {
861
1139
  try {
862
- c = window.localStorage[f];
1140
+ u = window.localStorage[y];
863
1141
  } catch {
864
1142
  }
865
- if (typeof c === t)
1143
+ if (typeof u === t)
866
1144
  try {
867
- var u = window.document.cookie, k = encodeURIComponent(f), S = u.indexOf(k + "=");
868
- S !== -1 && (c = /^([^;]+)/.exec(
869
- u.slice(S + k.length + 1)
1145
+ var g = window.document.cookie, I = encodeURIComponent(y), P = g.indexOf(I + "=");
1146
+ P !== -1 && (u = /^([^;]+)/.exec(
1147
+ g.slice(P + I.length + 1)
870
1148
  )[1]);
871
1149
  } catch {
872
1150
  }
873
- return s.levels[c] === void 0 && (c = void 0), c;
1151
+ return l.levels[u] === void 0 && (u = void 0), u;
874
1152
  }
875
1153
  }
876
- function $() {
877
- if (!(typeof window === t || !f)) {
1154
+ function V() {
1155
+ if (!(typeof window === t || !y)) {
878
1156
  try {
879
- window.localStorage.removeItem(f);
1157
+ window.localStorage.removeItem(y);
880
1158
  } catch {
881
1159
  }
882
1160
  try {
883
- window.document.cookie = encodeURIComponent(f) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
1161
+ window.document.cookie = encodeURIComponent(y) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
884
1162
  } catch {
885
1163
  }
886
1164
  }
887
1165
  }
888
- function v(c) {
889
- var u = c;
890
- if (typeof u == "string" && s.levels[u.toUpperCase()] !== void 0 && (u = s.levels[u.toUpperCase()]), typeof u == "number" && u >= 0 && u <= s.levels.SILENT)
891
- return u;
892
- throw new TypeError("log.setLevel() called with invalid level: " + c);
1166
+ function m(u) {
1167
+ var g = u;
1168
+ 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
+ return g;
1170
+ throw new TypeError("log.setLevel() called with invalid level: " + u);
893
1171
  }
894
- s.name = a, s.levels = {
1172
+ l.name = h, l.levels = {
895
1173
  TRACE: 0,
896
1174
  DEBUG: 1,
897
1175
  INFO: 2,
898
1176
  WARN: 3,
899
1177
  ERROR: 4,
900
1178
  SILENT: 5
901
- }, s.methodFactory = h || d, s.getLevel = function() {
902
- return m ?? N ?? E;
903
- }, s.setLevel = function(c, u) {
904
- return m = v(c), u !== !1 && V(m), p.call(s);
905
- }, s.setDefaultLevel = function(c) {
906
- N = v(c), B() || s.setLevel(c, !1);
907
- }, s.resetLevel = function() {
908
- m = null, $(), p.call(s);
909
- }, s.enableAll = function(c) {
910
- s.setLevel(s.levels.TRACE, c);
911
- }, s.disableAll = function(c) {
912
- s.setLevel(s.levels.SILENT, c);
913
- }, s.rebuild = function() {
914
- if (l !== s && (E = v(l.getLevel())), p.call(s), l === s)
915
- for (var c in i)
916
- i[c].rebuild();
917
- }, E = v(
918
- l ? l.getLevel() : "WARN"
1179
+ }, l.methodFactory = d || f, l.getLevel = function() {
1180
+ return w ?? O ?? k;
1181
+ }, l.setLevel = function(u, g) {
1182
+ return w = m(u), g !== !1 && j(w), p.call(l);
1183
+ }, l.setDefaultLevel = function(u) {
1184
+ O = m(u), T() || l.setLevel(u, !1);
1185
+ }, l.resetLevel = function() {
1186
+ w = null, V(), p.call(l);
1187
+ }, l.enableAll = function(u) {
1188
+ l.setLevel(l.levels.TRACE, u);
1189
+ }, l.disableAll = function(u) {
1190
+ l.setLevel(l.levels.SILENT, u);
1191
+ }, l.rebuild = function() {
1192
+ if (a !== l && (k = m(a.getLevel())), p.call(l), a === l)
1193
+ for (var u in i)
1194
+ i[u].rebuild();
1195
+ }, k = m(
1196
+ a ? a.getLevel() : "WARN"
919
1197
  );
920
- var P = B();
921
- P != null && (m = v(P)), p.call(s);
1198
+ var N = T();
1199
+ N != null && (w = m(N)), p.call(l);
922
1200
  }
923
- l = new M(), l.getLogger = function(h) {
924
- if (typeof h != "symbol" && typeof h != "string" || h === "")
1201
+ a = new R(), a.getLogger = function(d) {
1202
+ if (typeof d != "symbol" && typeof d != "string" || d === "")
925
1203
  throw new TypeError("You must supply a name when creating a logger.");
926
- var s = i[h];
927
- return s || (s = i[h] = new M(
928
- h,
929
- l.methodFactory
930
- )), s;
1204
+ var l = i[d];
1205
+ return l || (l = i[d] = new R(
1206
+ d,
1207
+ a.methodFactory
1208
+ )), l;
931
1209
  };
932
- var j = typeof window !== t ? window.log : void 0;
933
- return l.noConflict = function() {
934
- return typeof window !== t && window.log === l && (window.log = j), l;
935
- }, l.getLoggers = function() {
1210
+ var $ = typeof window !== t ? window.log : void 0;
1211
+ return a.noConflict = function() {
1212
+ return typeof window !== t && window.log === a && (window.log = $), a;
1213
+ }, a.getLoggers = function() {
936
1214
  return i;
937
- }, l.default = l, l;
1215
+ }, a.default = a, a;
938
1216
  });
939
- })(q);
940
- var D = q.exports;
941
- const W = /* @__PURE__ */ z(D), Y = /* @__PURE__ */ H({
1217
+ })(D);
1218
+ var F = D.exports;
1219
+ const Y = /* @__PURE__ */ W(F), Z = /* @__PURE__ */ z({
942
1220
  __proto__: null,
943
- default: W
944
- }, [D]), ne = !0, x = Y;
945
- x.setLevel("debug");
946
- const oe = (n) => {
1221
+ default: Y
1222
+ }, [F]), oe = !0, E = Z;
1223
+ E.setLevel("debug");
1224
+ const ie = (r) => {
947
1225
  try {
948
- x.setLevel(n);
1226
+ E.setLevel(r);
949
1227
  } catch (e) {
950
- x.setLevel("error"), x.error(e);
1228
+ E.setLevel("error"), E.error(e);
951
1229
  }
952
1230
  };
953
- function A(n) {
954
- return n === null || typeof n != "object" ? n : Array.isArray(n) ? [...n] : { ...n };
1231
+ function C(r) {
1232
+ return r === null || typeof r != "object" ? r : Array.isArray(r) ? [...r] : { ...r };
955
1233
  }
956
- function Z(n, ...e) {
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) {
957
1249
  for (const t of e)
958
1250
  if (t)
959
- for (const r in t)
960
- Object.prototype.hasOwnProperty.call(t, r) && n[r] === void 0 && (n[r] = t[r]);
961
- return n;
1251
+ for (const s in t)
1252
+ Object.prototype.hasOwnProperty.call(t, s) && r[s] === void 0 && (r[s] = t[s]);
1253
+ return r;
962
1254
  }
963
- function J(n, e) {
964
- return n != null && Object.prototype.hasOwnProperty.call(n, e);
1255
+ function X(r, e) {
1256
+ return r != null && Object.prototype.hasOwnProperty.call(r, e);
965
1257
  }
966
- function X(n) {
967
- return n == null ? !0 : Array.isArray(n) || typeof n == "string" ? n.length === 0 : n instanceof Map || n instanceof Set ? n.size === 0 : typeof n == "object" ? Object.keys(n).length === 0 : !1;
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;
968
1260
  }
969
- function _(n, e) {
970
- if (n === e)
1261
+ function L(r, e) {
1262
+ if (r === e)
971
1263
  return !0;
972
- if (n == null || e == null)
973
- return n === e;
974
- if (typeof n != typeof e)
1264
+ if (r == null || e == null)
1265
+ return r === e;
1266
+ if (typeof r != typeof e)
975
1267
  return !1;
976
- if (typeof n != "object")
977
- return n === e;
978
- if (Array.isArray(n) !== Array.isArray(e))
1268
+ if (typeof r != "object")
1269
+ return r === e;
1270
+ if (Array.isArray(r) !== Array.isArray(e))
979
1271
  return !1;
980
- if (Array.isArray(n)) {
981
- if (n.length !== e.length)
1272
+ if (Array.isArray(r)) {
1273
+ if (r.length !== e.length)
982
1274
  return !1;
983
- for (let o = 0; o < n.length; o++)
984
- if (!_(n[o], e[o]))
1275
+ for (let n = 0; n < r.length; n++)
1276
+ if (!L(r[n], e[n]))
985
1277
  return !1;
986
1278
  return !0;
987
1279
  }
988
- const t = Object.keys(n), r = Object.keys(e);
989
- if (t.length !== r.length)
1280
+ const t = Object.keys(r), s = Object.keys(e);
1281
+ if (t.length !== s.length)
990
1282
  return !1;
991
- for (const o of t)
1283
+ for (const n of t)
992
1284
  if (!Object.prototype.hasOwnProperty.call(
993
1285
  e,
994
- o
995
- ) || !_(
996
- n[o],
997
- e[o]
1286
+ n
1287
+ ) || !L(
1288
+ r[n],
1289
+ e[n]
998
1290
  ))
999
1291
  return !1;
1000
1292
  return !0;
1001
1293
  }
1002
- class F {
1294
+ class q {
1003
1295
  /**
1004
1296
  * Create one object to store attributes. For performance reason, values of attributes passed to constructor
1005
1297
  * will not be cloned to `attributes` property. So it means that value of `attributes` property in this object
@@ -1011,8 +1303,8 @@ class F {
1011
1303
  attrChanged: new U(),
1012
1304
  modelChanged: new U()
1013
1305
  }, this._changing = !1, this._previousAttributes = {}, this._pending = !1;
1014
- const r = e || {};
1015
- t && Z(r, t), this.attributes = r, this.changed = {};
1306
+ const s = e || {};
1307
+ t && J(s, t), this.attributes = s, this.changed = {};
1016
1308
  }
1017
1309
  /**
1018
1310
  * Gets the value of an attribute.
@@ -1043,31 +1335,31 @@ class F {
1043
1335
  get(e) {
1044
1336
  return this.attributes[e];
1045
1337
  }
1046
- set(e, t, r) {
1338
+ set(e, t, s) {
1047
1339
  if (e == null) return this;
1048
- let o;
1049
- typeof e == "object" ? (o = e, r = t) : (o = {}, o[e] = t), r || (r = {});
1050
- const i = r.unset, l = r.silent, g = [], L = this._changing;
1051
- this._changing = !0, L || (this._previousAttributes = A(this.attributes), this.changed = {});
1052
- const y = this.attributes, p = this.changed, O = this._previousAttributes;
1053
- for (const d in o)
1054
- t = o[d], _(y[d], t) || g.push(d), _(O[d], t) ? delete p[d] : p[d] = t, i ? delete y[d] : y[d] = t;
1055
- if (!l) {
1056
- g.length && (this._pending = r);
1057
- for (let d = 0; d < g.length; d++)
1340
+ let n;
1341
+ typeof e == "object" ? (n = e, s = t) : (n = {}, n[e] = t), s || (s = {});
1342
+ const i = s.unset, a = s.silent, c = [], M = this._changing;
1343
+ this._changing = !0, M || (this._previousAttributes = C(this.attributes), this.changed = {});
1344
+ const _ = this.attributes, p = this.changed, A = this._previousAttributes;
1345
+ for (const f in n)
1346
+ t = n[f], L(_[f], t) || c.push(f), L(A[f], t) ? delete p[f] : p[f] = t, i ? delete _[f] : _[f] = t;
1347
+ if (!a) {
1348
+ c.length && (this._pending = s);
1349
+ for (let f = 0; f < c.length; f++)
1058
1350
  this.events.attrChanged.dispatch({
1059
1351
  object: this,
1060
- attrName: g[d],
1061
- attrValue: y[g[d]],
1062
- options: r
1352
+ attrName: c[f],
1353
+ attrValue: _[c[f]],
1354
+ options: s
1063
1355
  });
1064
1356
  }
1065
- if (L) return this;
1066
- if (!l)
1357
+ if (M) return this;
1358
+ if (!a)
1067
1359
  for (; this._pending; )
1068
- r = this._pending, this._pending = !1, this.events.modelChanged.dispatch({
1360
+ s = this._pending, this._pending = !1, this.events.modelChanged.dispatch({
1069
1361
  object: this,
1070
- options: r
1362
+ options: s
1071
1363
  });
1072
1364
  return this._pending = !1, this._changing = !1, this;
1073
1365
  }
@@ -1079,7 +1371,7 @@ class F {
1079
1371
  * If you specify an attribute name, determine if that attribute has changed.
1080
1372
  */
1081
1373
  hasChanged(e) {
1082
- return e == null ? !X(this.changed) : J(this.changed, e);
1374
+ return e == null ? !Q(this.changed) : X(this.changed, e);
1083
1375
  }
1084
1376
  /**
1085
1377
  * Return an object containing all the attributes that have changed. Useful for determining what parts
@@ -1089,13 +1381,13 @@ class F {
1089
1381
  * the model, determining if there *would be* a change.
1090
1382
  */
1091
1383
  changedAttributes(e) {
1092
- if (!e) return this.hasChanged() ? A(this.changed) : {};
1093
- const t = this._changing ? this._previousAttributes : this.attributes, r = {};
1094
- for (const o in e) {
1095
- const i = e[o];
1096
- _(t[o], i) || (r[o] = i);
1384
+ if (!e) return this.hasChanged() ? C(this.changed) : {};
1385
+ const t = this._changing ? this._previousAttributes : this.attributes, s = {};
1386
+ for (const n in e) {
1387
+ const i = e[n];
1388
+ L(t[n], i) || (s[n] = i);
1097
1389
  }
1098
- return r;
1390
+ return s;
1099
1391
  }
1100
1392
  /**
1101
1393
  * Get the previous value of an attribute, recorded at the time the last `"change"` event was fired.
@@ -1107,14 +1399,14 @@ class F {
1107
1399
  * Get all of the attributes of the model at the time of the previous `"change"` event.
1108
1400
  */
1109
1401
  previousAttributes() {
1110
- return A(this._previousAttributes);
1402
+ return C(this._previousAttributes);
1111
1403
  }
1112
1404
  /**
1113
1405
  * Create a new model with identical attributes to this one.
1114
1406
  */
1115
1407
  clone() {
1116
- const e = A(this.attributes);
1117
- return new F(e);
1408
+ const e = C(this.attributes);
1409
+ return new q(e);
1118
1410
  }
1119
1411
  }
1120
1412
  class b {
@@ -1176,7 +1468,7 @@ class b {
1176
1468
  return this.entries.delete(e);
1177
1469
  }
1178
1470
  }
1179
- class se {
1471
+ class le {
1180
1472
  /**
1181
1473
  * Converts a byte count to a human-readable string using appropriate size units.
1182
1474
  *
@@ -1201,11 +1493,11 @@ class se {
1201
1493
  */
1202
1494
  static formatBytes(e, t = 2) {
1203
1495
  if (e === 0) return "0 B";
1204
- const r = 1024, o = Math.max(0, t), i = ["B", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(e) / Math.log(r)), g = e / Math.pow(r, l);
1205
- return `${parseFloat(g.toFixed(o))} ${i[l]}`;
1496
+ const s = 1024, n = 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(n))} ${i[a]}`;
1206
1498
  }
1207
1499
  }
1208
- class ie {
1500
+ class ae {
1209
1501
  /**
1210
1502
  * Creates a new task with the specified name.
1211
1503
  *
@@ -1228,7 +1520,7 @@ class ie {
1228
1520
  throw new Error("run() must be implemented by subclass");
1229
1521
  }
1230
1522
  }
1231
- class le {
1523
+ class he {
1232
1524
  constructor() {
1233
1525
  this.tasks = [], this.onProgress = () => {
1234
1526
  }, this.onComplete = () => {
@@ -1244,11 +1536,11 @@ class le {
1244
1536
  * @returns Promise that resolves with the result of the callback
1245
1537
  */
1246
1538
  scheduleTask(e) {
1247
- return new Promise((t, r) => {
1248
- const o = () => {
1249
- Promise.resolve(e()).then(t).catch(r);
1539
+ return new Promise((t, s) => {
1540
+ const n = () => {
1541
+ Promise.resolve(e()).then(t).catch(s);
1250
1542
  };
1251
- typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(o) : setTimeout(o, 0);
1543
+ typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(n) : setTimeout(n, 0);
1252
1544
  });
1253
1545
  }
1254
1546
  /**
@@ -1282,31 +1574,31 @@ class le {
1282
1574
  */
1283
1575
  async run(e) {
1284
1576
  const t = this.tasks.length;
1285
- let r = e;
1286
- for (let o = 0; o < t; o++) {
1287
- const i = this.tasks[o];
1577
+ let s = e;
1578
+ for (let n = 0; n < t; n++) {
1579
+ const i = this.tasks[n];
1288
1580
  try {
1289
- r = await this.scheduleTask(async () => {
1290
- const l = await i.run(r);
1291
- return this.onProgress((o + 1) / t, i), l;
1581
+ s = await this.scheduleTask(async () => {
1582
+ const a = await i.run(s);
1583
+ return this.onProgress((n + 1) / t, i), a;
1292
1584
  });
1293
- } catch (l) {
1294
- if (this.onError({ error: l, taskIndex: o, task: i }))
1585
+ } catch (a) {
1586
+ if (this.onError({ error: a, taskIndex: n, task: i }))
1295
1587
  break;
1296
1588
  }
1297
1589
  }
1298
- this.onComplete(r);
1590
+ this.onComplete(s);
1299
1591
  }
1300
1592
  }
1301
- class Q {
1593
+ class ee {
1302
1594
  /**
1303
1595
  * Create a new AcCmLoadingManager instance
1304
1596
  * @param onLoad this function will be called when all loaders are done.
1305
1597
  * @param onProgress this function will be called when an item is complete.
1306
1598
  * @param onError this function will be called a loader encounters errors.
1307
1599
  */
1308
- constructor(e, t, r) {
1309
- this.isLoading = !1, this.itemsLoaded = 0, this.itemsTotal = 0, this.urlModifier = void 0, this.handlers = [], this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = r;
1600
+ constructor(e, t, s) {
1601
+ this.isLoading = !1, this.itemsLoaded = 0, this.itemsTotal = 0, this.urlModifier = void 0, this.handlers = [], this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = s;
1310
1602
  }
1311
1603
  /**
1312
1604
  * This should be called by any loader using the manager when the loader starts loading an url.
@@ -1374,22 +1666,22 @@ class Q {
1374
1666
  * @returns Return the registered loader for the given file path.
1375
1667
  */
1376
1668
  getHandler(e) {
1377
- for (let t = 0, r = this.handlers.length; t < r; t += 2) {
1378
- const o = this.handlers[t], i = this.handlers[t + 1];
1379
- if (o.global && (o.lastIndex = 0), o.test(e))
1669
+ for (let t = 0, s = this.handlers.length; t < s; t += 2) {
1670
+ const n = this.handlers[t], i = this.handlers[t + 1];
1671
+ if (n.global && (n.lastIndex = 0), n.test(e))
1380
1672
  return i;
1381
1673
  }
1382
1674
  return null;
1383
1675
  }
1384
1676
  }
1385
- const ee = /* @__PURE__ */ new Q();
1386
- class ae {
1677
+ const te = /* @__PURE__ */ new ee();
1678
+ class ue {
1387
1679
  /**
1388
1680
  * Creates a new AcCmLoader instance.
1389
1681
  * @param manager The loadingManager for the loader to use. Default is DefaultLoadingManager.
1390
1682
  */
1391
1683
  constructor(e) {
1392
- this.manager = e !== void 0 ? e : ee, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
1684
+ this.manager = e !== void 0 ? e : te, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
1393
1685
  }
1394
1686
  /**
1395
1687
  * This method is equivalent to 'load', but returns a Promise.
@@ -1400,8 +1692,8 @@ class ae {
1400
1692
  * @returns Return a promise.
1401
1693
  */
1402
1694
  loadAsync(e, t) {
1403
- return new Promise((r, o) => {
1404
- this.load(e, r, t, o);
1695
+ return new Promise((s, n) => {
1696
+ this.load(e, s, t, n);
1405
1697
  });
1406
1698
  }
1407
1699
  /**
@@ -1455,24 +1747,28 @@ class ae {
1455
1747
  }
1456
1748
  }
1457
1749
  export {
1458
- R as AcCmColor,
1459
- te as AcCmErrors,
1460
- re as AcCmEventDispatcher,
1750
+ v as AcCmColor,
1751
+ o as AcCmColorMethod,
1752
+ B as AcCmColorUtil,
1753
+ re as AcCmEntityColor,
1754
+ se as AcCmErrors,
1755
+ ne as AcCmEventDispatcher,
1461
1756
  U as AcCmEventManager,
1462
- ae as AcCmLoader,
1463
- Q as AcCmLoadingManager,
1464
- F as AcCmObject,
1757
+ ue as AcCmLoader,
1758
+ ee as AcCmLoadingManager,
1759
+ q as AcCmObject,
1465
1760
  b as AcCmPerformanceCollector,
1466
- ie as AcCmTask,
1467
- le as AcCmTaskScheduler,
1468
- se as AcTrStringUtil,
1469
- ne as DEBUG_MODE,
1470
- ee as DefaultLoadingManager,
1471
- A as clone,
1472
- Z as defaults,
1473
- J as has,
1474
- X as isEmpty,
1475
- _ as isEqual,
1476
- x as log,
1477
- oe as setLogLevel
1761
+ ae as AcCmTask,
1762
+ he as AcCmTaskScheduler,
1763
+ le as AcTrStringUtil,
1764
+ oe as DEBUG_MODE,
1765
+ te as DefaultLoadingManager,
1766
+ C as clone,
1767
+ G as deepClone,
1768
+ J as defaults,
1769
+ X as has,
1770
+ Q as isEmpty,
1771
+ L as isEqual,
1772
+ E as log,
1773
+ ie as setLogLevel
1478
1774
  };