@mlightcad/common 1.1.3 → 1.2.0

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
@@ -418,10 +418,10 @@ const I = {
418
418
  16777215,
419
419
  0
420
420
  ];
421
- function b(n, e, t) {
421
+ function w(n, e, t) {
422
422
  return Math.max(e, Math.min(t, n));
423
423
  }
424
- const O = class O {
424
+ const x = class x {
425
425
  /**
426
426
  * Constructs a new AcCmColor instance.
427
427
  * Initializes the color to "ByLayer" (index 256) and null RGB values.
@@ -431,7 +431,7 @@ const O = class O {
431
431
  }
432
432
  /**
433
433
  * Gets the current color value.
434
- *
434
+ *
435
435
  * @returns {number | null} The color value (RGB or index).
436
436
  */
437
437
  get color() {
@@ -439,15 +439,15 @@ const O = class O {
439
439
  }
440
440
  /**
441
441
  * Sets the color value.
442
- *
442
+ *
443
443
  * @param {number | null} value - The color value to set (RGB or index).
444
444
  */
445
445
  set color(e) {
446
- e == null ? this._color = null : (this._color = Math.round(b(e, 0, 256 * 256 * 256 - 1)), this._colorIndex = this.getColorIndexByValue(this._color), this._colorName = this.getColorNameByValue(this._color));
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));
447
447
  }
448
448
  /**
449
449
  * Gets the hexadecimal representation of the current color.
450
- *
450
+ *
451
451
  * @returns {string} The hexadecimal color string (e.g., "0xFFFFFF").
452
452
  */
453
453
  get hexColor() {
@@ -461,7 +461,7 @@ const O = class O {
461
461
  }
462
462
  /**
463
463
  * Gets the CSS RGB color string representation.
464
- *
464
+ *
465
465
  * @returns {string} The CSS RGB color string (e.g., "rgb(255,255,255)").
466
466
  */
467
467
  get cssColor() {
@@ -469,7 +469,7 @@ const O = class O {
469
469
  }
470
470
  /**
471
471
  * Gets the red component of the current color.
472
- *
472
+ *
473
473
  * @returns {number | null} The red component (0-255).
474
474
  */
475
475
  get red() {
@@ -477,7 +477,7 @@ const O = class O {
477
477
  }
478
478
  /**
479
479
  * Gets the green component of the current color.
480
- *
480
+ *
481
481
  * @returns {number | null} The green component (0-255).
482
482
  */
483
483
  get green() {
@@ -485,7 +485,7 @@ const O = class O {
485
485
  }
486
486
  /**
487
487
  * Gets the blue component of the current color.
488
- *
488
+ *
489
489
  * @returns {number | null} The blue component (0-255).
490
490
  */
491
491
  get blue() {
@@ -494,7 +494,7 @@ const O = class O {
494
494
  /**
495
495
  * Gets the AutoCAD color index value. The index value will be in the range 0 to 256.
496
496
  * 0 and 256 are special values.
497
- *
497
+ *
498
498
  * @returns {number | null} The color index.
499
499
  */
500
500
  get colorIndex() {
@@ -507,15 +507,15 @@ const O = class O {
507
507
  * is not displayed through a block reference (for example, it is directly owned by the model space
508
508
  * block table record) and its color is 0, then it will display as though its color were 7.
509
509
  * - 256 indicates that the entity uses the color specified in the layer table record it references.
510
- *
510
+ *
511
511
  * @param {number | null} value - The color index to set (0-256).
512
512
  */
513
513
  set colorIndex(e) {
514
- e == null ? this._colorIndex = null : (this._colorIndex = b(e, 0, 256), this._color = T[e], this._colorName = this.getColorNameByValue(this._color));
514
+ e == null ? this._colorIndex = null : (this._colorIndex = w(e, 0, 256), this._color = T[e], this._colorName = this.getColorNameByValue(this._color));
515
515
  }
516
516
  /**
517
517
  * Gets the name of the current color.
518
- *
518
+ *
519
519
  * @returns {string | null} The color name.
520
520
  */
521
521
  get colorName() {
@@ -523,7 +523,7 @@ const O = class O {
523
523
  }
524
524
  /**
525
525
  * Sets the color by name.
526
- *
526
+ *
527
527
  * @param {string | null} value - The color name to set.
528
528
  */
529
529
  set colorName(e) {
@@ -535,7 +535,7 @@ const O = class O {
535
535
  }
536
536
  /**
537
537
  * Checks if the color has a name.
538
- *
538
+ *
539
539
  * @returns {boolean} True if the color has no name, false otherwise.
540
540
  */
541
541
  get hasColorName() {
@@ -543,7 +543,7 @@ const O = class O {
543
543
  }
544
544
  /**
545
545
  * Checks if the color has an index.
546
- *
546
+ *
547
547
  * @returns {boolean} True if the color has no index, false otherwise.
548
548
  */
549
549
  get hasColorIndex() {
@@ -551,7 +551,7 @@ const O = class O {
551
551
  }
552
552
  /**
553
553
  * Checks if the color is set to "ByLayer".
554
- *
554
+ *
555
555
  * @returns {boolean} True if the color is "ByLayer", false otherwise.
556
556
  */
557
557
  get isByLayer() {
@@ -559,7 +559,7 @@ const O = class O {
559
559
  }
560
560
  /**
561
561
  * Sets the color to "ByLayer".
562
- *
562
+ *
563
563
  * @returns {AcCmColor} The current instance.
564
564
  */
565
565
  setByLayer() {
@@ -567,7 +567,7 @@ const O = class O {
567
567
  }
568
568
  /**
569
569
  * Checks if the color is set to "ByBlock".
570
- *
570
+ *
571
571
  * @returns {boolean} True if the color is "ByBlock", false otherwise.
572
572
  */
573
573
  get isByBlock() {
@@ -575,7 +575,7 @@ const O = class O {
575
575
  }
576
576
  /**
577
577
  * Sets the color to "ByBlock".
578
- *
578
+ *
579
579
  * @returns {AcCmColor} The current instance.
580
580
  */
581
581
  setByBlock() {
@@ -583,7 +583,7 @@ const O = class O {
583
583
  }
584
584
  /**
585
585
  * Sets the color using a scalar value (RGB).
586
- *
586
+ *
587
587
  * @param {number} scalar - The scalar value (0-255).
588
588
  * @returns {AcCmColor} The current instance.
589
589
  */
@@ -592,19 +592,19 @@ const O = class O {
592
592
  }
593
593
  /**
594
594
  * Sets the color using RGB values.
595
- *
595
+ *
596
596
  * @param {number} r - The red component (0-255).
597
597
  * @param {number} g - The green component (0-255).
598
598
  * @param {number} b - The blue component (0-255).
599
599
  * @returns {AcCmColor} The current instance.
600
600
  */
601
601
  setRGB(e, t, r) {
602
- const o = Math.round(b(e, 0, 255)), i = Math.round(b(t, 0, 255)), l = Math.round(b(r, 0, 255));
602
+ const o = Math.round(w(e, 0, 255)), i = Math.round(w(t, 0, 255)), l = Math.round(w(r, 0, 255));
603
603
  return this.color = (o << 16) + (i << 8) + l, this;
604
604
  }
605
605
  /**
606
606
  * Sets the color by name.
607
- *
607
+ *
608
608
  * @param {string} style - The color name to set.
609
609
  * @returns {AcCmColor} The current instance.
610
610
  */
@@ -614,16 +614,16 @@ const O = class O {
614
614
  }
615
615
  /**
616
616
  * Clones the current AcCmColor instance.
617
- *
617
+ *
618
618
  * @returns {AcCmColor} A new AcCmColor instance with the same color and index.
619
619
  */
620
620
  clone() {
621
- const e = new O();
621
+ const e = new x();
622
622
  return e.colorIndex = this.colorIndex, e.color = this.color, e._colorName = this._colorName, this;
623
623
  }
624
624
  /**
625
625
  * Copies the color from another AcCmColor instance.
626
- *
626
+ *
627
627
  * @param {AcCmColor} color - The color to copy from.
628
628
  * @returns {AcCmColor} The current instance.
629
629
  */
@@ -632,7 +632,7 @@ const O = class O {
632
632
  }
633
633
  /**
634
634
  * Checks if two AcCmColor instances are equal.
635
- *
635
+ *
636
636
  * @param {AcCmColor} c - The color to compare with.
637
637
  * @returns {boolean} True if the colors and their indices are the same.
638
638
  */
@@ -641,7 +641,7 @@ const O = class O {
641
641
  }
642
642
  /**
643
643
  * Returns a string representation of the color.
644
- *
644
+ *
645
645
  * @returns {string} The color name or hexadecimal string.
646
646
  */
647
647
  toString() {
@@ -649,7 +649,7 @@ const O = class O {
649
649
  }
650
650
  /**
651
651
  * Finds the color name associated with a given RGB value.
652
- *
652
+ *
653
653
  * @private
654
654
  * @param {number} target - The RGB value to find a name for.
655
655
  * @returns {string | null} The color name if found, null otherwise.
@@ -662,7 +662,7 @@ const O = class O {
662
662
  }
663
663
  /**
664
664
  * Finds the AutoCAD color index associated with a given RGB value.
665
- *
665
+ *
666
666
  * @private
667
667
  * @param {number} target - The RGB value to find an index for.
668
668
  * @returns {number | null} The color index if found, null otherwise.
@@ -675,8 +675,8 @@ const O = class O {
675
675
  return null;
676
676
  }
677
677
  };
678
- O.NAMES = I;
679
- let R = O;
678
+ x.NAMES = I;
679
+ let R = x;
680
680
  const te = {
681
681
  /**
682
682
  * Throw error ILLEGAL_PARAMETERS when cannot instantiate from given parameter
@@ -791,7 +791,7 @@ var K = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : ty
791
791
  function z(n) {
792
792
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
793
793
  }
794
- var D = { exports: {} };
794
+ var q = { exports: {} };
795
795
  (function(n) {
796
796
  (function(e, t) {
797
797
  n.exports ? n.exports = t() : e.log = t();
@@ -804,7 +804,7 @@ var D = { exports: {} };
804
804
  "warn",
805
805
  "error"
806
806
  ], i = {}, l = null;
807
- function g(a, h) {
807
+ function f(a, h) {
808
808
  var s = a[h];
809
809
  if (typeof s.bind == "function")
810
810
  return s.bind(a);
@@ -816,13 +816,13 @@ var D = { exports: {} };
816
816
  };
817
817
  }
818
818
  }
819
- function p() {
819
+ function L() {
820
820
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
821
821
  }
822
- function m(a) {
823
- return a === "debug" && (a = "log"), typeof console === t ? !1 : a === "trace" && r ? p : console[a] !== void 0 ? g(console, a) : console.log !== void 0 ? g(console, "log") : e;
822
+ function y(a) {
823
+ return a === "debug" && (a = "log"), typeof console === t ? !1 : a === "trace" && r ? L : console[a] !== void 0 ? f(console, a) : console.log !== void 0 ? f(console, "log") : e;
824
824
  }
825
- function y() {
825
+ function p() {
826
826
  for (var a = this.getLevel(), h = 0; h < o.length; h++) {
827
827
  var s = o[h];
828
828
  this[s] = h < a ? e : this.methodFactory(s, a, this.name);
@@ -830,43 +830,43 @@ var D = { exports: {} };
830
830
  if (this.log = this.debug, typeof console === t && a < this.levels.SILENT)
831
831
  return "No console available for logging";
832
832
  }
833
- function x(a) {
833
+ function O(a) {
834
834
  return function() {
835
- typeof console !== t && (y.call(this), this[a].apply(this, arguments));
835
+ typeof console !== t && (p.call(this), this[a].apply(this, arguments));
836
836
  };
837
837
  }
838
838
  function d(a, h, s) {
839
- return m(a) || x.apply(this, arguments);
839
+ return y(a) || O.apply(this, arguments);
840
840
  }
841
841
  function M(a, h) {
842
- var s = this, E, N, v, f = "loglevel";
843
- typeof a == "string" ? f += ":" + a : typeof a == "symbol" && (f = void 0);
842
+ var s = this, E, N, m, g = "loglevel";
843
+ typeof a == "string" ? g += ":" + a : typeof a == "symbol" && (g = void 0);
844
844
  function V(c) {
845
845
  var u = (o[c] || "silent").toUpperCase();
846
- if (!(typeof window === t || !f)) {
846
+ if (!(typeof window === t || !g)) {
847
847
  try {
848
- window.localStorage[f] = u;
848
+ window.localStorage[g] = u;
849
849
  return;
850
850
  } catch {
851
851
  }
852
852
  try {
853
- window.document.cookie = encodeURIComponent(f) + "=" + u + ";";
853
+ window.document.cookie = encodeURIComponent(g) + "=" + u + ";";
854
854
  } catch {
855
855
  }
856
856
  }
857
857
  }
858
858
  function B() {
859
859
  var c;
860
- if (!(typeof window === t || !f)) {
860
+ if (!(typeof window === t || !g)) {
861
861
  try {
862
- c = window.localStorage[f];
862
+ c = window.localStorage[g];
863
863
  } catch {
864
864
  }
865
865
  if (typeof c === t)
866
866
  try {
867
- var u = window.document.cookie, k = encodeURIComponent(f), P = u.indexOf(k + "=");
868
- P !== -1 && (c = /^([^;]+)/.exec(
869
- u.slice(P + k.length + 1)
867
+ var u = window.document.cookie, k = encodeURIComponent(g), S = u.indexOf(k + "=");
868
+ S !== -1 && (c = /^([^;]+)/.exec(
869
+ u.slice(S + k.length + 1)
870
870
  )[1]);
871
871
  } catch {
872
872
  }
@@ -874,18 +874,18 @@ var D = { exports: {} };
874
874
  }
875
875
  }
876
876
  function $() {
877
- if (!(typeof window === t || !f)) {
877
+ if (!(typeof window === t || !g)) {
878
878
  try {
879
- window.localStorage.removeItem(f);
879
+ window.localStorage.removeItem(g);
880
880
  } catch {
881
881
  }
882
882
  try {
883
- window.document.cookie = encodeURIComponent(f) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
883
+ window.document.cookie = encodeURIComponent(g) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
884
884
  } catch {
885
885
  }
886
886
  }
887
887
  }
888
- function w(c) {
888
+ function v(c) {
889
889
  var u = c;
890
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
891
  return u;
@@ -899,26 +899,26 @@ var D = { exports: {} };
899
899
  ERROR: 4,
900
900
  SILENT: 5
901
901
  }, s.methodFactory = h || d, s.getLevel = function() {
902
- return v ?? N ?? E;
902
+ return m ?? N ?? E;
903
903
  }, s.setLevel = function(c, u) {
904
- return v = w(c), u !== !1 && V(v), y.call(s);
904
+ return m = v(c), u !== !1 && V(m), p.call(s);
905
905
  }, s.setDefaultLevel = function(c) {
906
- N = w(c), B() || s.setLevel(c, !1);
906
+ N = v(c), B() || s.setLevel(c, !1);
907
907
  }, s.resetLevel = function() {
908
- v = null, $(), y.call(s);
908
+ m = null, $(), p.call(s);
909
909
  }, s.enableAll = function(c) {
910
910
  s.setLevel(s.levels.TRACE, c);
911
911
  }, s.disableAll = function(c) {
912
912
  s.setLevel(s.levels.SILENT, c);
913
913
  }, s.rebuild = function() {
914
- if (l !== s && (E = w(l.getLevel())), y.call(s), l === s)
914
+ if (l !== s && (E = v(l.getLevel())), p.call(s), l === s)
915
915
  for (var c in i)
916
916
  i[c].rebuild();
917
- }, E = w(
917
+ }, E = v(
918
918
  l ? l.getLevel() : "WARN"
919
919
  );
920
- var S = B();
921
- S != null && (v = w(S)), y.call(s);
920
+ var P = B();
921
+ P != null && (m = v(P)), p.call(s);
922
922
  }
923
923
  l = new M(), l.getLogger = function(h) {
924
924
  if (typeof h != "symbol" && typeof h != "string" || h === "")
@@ -936,12 +936,12 @@ var D = { exports: {} };
936
936
  return i;
937
937
  }, l.default = l, l;
938
938
  });
939
- })(D);
940
- var q = D.exports;
941
- const W = /* @__PURE__ */ z(q), Y = /* @__PURE__ */ H({
939
+ })(q);
940
+ var D = q.exports;
941
+ const W = /* @__PURE__ */ z(D), Y = /* @__PURE__ */ H({
942
942
  __proto__: null,
943
943
  default: W
944
- }, [q]), ne = !0, C = Y;
944
+ }, [D]), ne = !0, C = Y;
945
945
  C.setLevel("debug");
946
946
  const oe = (n) => {
947
947
  try {
@@ -966,7 +966,7 @@ function J(n, e) {
966
966
  function X(n) {
967
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;
968
968
  }
969
- function L(n, e) {
969
+ function _(n, e) {
970
970
  if (n === e)
971
971
  return !0;
972
972
  if (n == null || e == null)
@@ -981,7 +981,7 @@ function L(n, e) {
981
981
  if (n.length !== e.length)
982
982
  return !1;
983
983
  for (let o = 0; o < n.length; o++)
984
- if (!L(n[o], e[o]))
984
+ if (!_(n[o], e[o]))
985
985
  return !1;
986
986
  return !0;
987
987
  }
@@ -992,7 +992,7 @@ function L(n, e) {
992
992
  if (!Object.prototype.hasOwnProperty.call(
993
993
  e,
994
994
  o
995
- ) || !L(
995
+ ) || !_(
996
996
  n[o],
997
997
  e[o]
998
998
  ))
@@ -1016,24 +1016,24 @@ class F {
1016
1016
  }
1017
1017
  /**
1018
1018
  * Gets the value of an attribute.
1019
- *
1019
+ *
1020
1020
  * For strongly-typed access to attributes, use the `get` method privately in public getter properties.
1021
- *
1021
+ *
1022
1022
  * @template A - The key type extending string keys of T.
1023
1023
  * @param {A} key - The attribute key to retrieve.
1024
1024
  * @returns {T[A] | undefined} The attribute value or undefined if not set.
1025
- *
1025
+ *
1026
1026
  * @example
1027
1027
  * ```typescript
1028
1028
  * // Get a single attribute value
1029
1029
  * const name = obj.get('name')
1030
1030
  * const visible = obj.get('visible')
1031
- *
1031
+ *
1032
1032
  * // Check if attribute exists
1033
1033
  * if (obj.get('name') !== undefined) {
1034
1034
  * console.log('Name is set')
1035
1035
  * }
1036
- *
1036
+ *
1037
1037
  * // For strongly-typed subclasses
1038
1038
  * get name(): string {
1039
1039
  * return super.get("name")
@@ -1047,22 +1047,22 @@ class F {
1047
1047
  if (e == null) return this;
1048
1048
  let o;
1049
1049
  typeof e == "object" ? (o = e, r = t) : (o = {}, o[e] = t), r || (r = {});
1050
- const i = r.unset, l = r.silent, g = [], p = this._changing;
1051
- this._changing = !0, p || (this._previousAttributes = A(this.attributes), this.changed = {});
1052
- const m = this.attributes, y = this.changed, x = this._previousAttributes;
1050
+ const i = r.unset, l = r.silent, f = [], 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
1053
  for (const d in o)
1054
- t = o[d], L(m[d], t) || g.push(d), L(x[d], t) ? delete y[d] : y[d] = t, i ? delete m[d] : m[d] = t;
1054
+ t = o[d], _(y[d], t) || f.push(d), _(O[d], t) ? delete p[d] : p[d] = t, i ? delete y[d] : y[d] = t;
1055
1055
  if (!l) {
1056
- g.length && (this._pending = r);
1057
- for (let d = 0; d < g.length; d++)
1056
+ f.length && (this._pending = r);
1057
+ for (let d = 0; d < f.length; d++)
1058
1058
  this.events.attrChanged.dispatch({
1059
1059
  object: this,
1060
- attrName: g[d],
1061
- attrValue: m[g[d]],
1060
+ attrName: f[d],
1061
+ attrValue: y[f[d]],
1062
1062
  options: r
1063
1063
  });
1064
1064
  }
1065
- if (p) return this;
1065
+ if (L) return this;
1066
1066
  if (!l)
1067
1067
  for (; this._pending; )
1068
1068
  r = this._pending, this._pending = !1, this.events.modelChanged.dispatch({
@@ -1093,7 +1093,7 @@ class F {
1093
1093
  const t = this._changing ? this._previousAttributes : this.attributes, r = {};
1094
1094
  for (const o in e) {
1095
1095
  const i = e[o];
1096
- L(t[o], i) || (r[o] = i);
1096
+ _(t[o], i) || (r[o] = i);
1097
1097
  }
1098
1098
  return r;
1099
1099
  }
@@ -1117,7 +1117,7 @@ class F {
1117
1117
  return new F(e);
1118
1118
  }
1119
1119
  }
1120
- class _ {
1120
+ class b {
1121
1121
  /**
1122
1122
  * Private constructor to enforce singleton pattern.
1123
1123
  */
@@ -1129,7 +1129,7 @@ class _ {
1129
1129
  * @returns The shared AcCmPerformanceCollector instance.
1130
1130
  */
1131
1131
  static getInstance() {
1132
- return _.instance || (_.instance = new _()), _.instance;
1132
+ return b.instance || (b.instance = new b()), b.instance;
1133
1133
  }
1134
1134
  /**
1135
1135
  * Adds or replaces a performance entry by name.
@@ -1179,21 +1179,21 @@ class _ {
1179
1179
  class se {
1180
1180
  /**
1181
1181
  * Converts a byte count to a human-readable string using appropriate size units.
1182
- *
1182
+ *
1183
1183
  * Automatically selects the most appropriate unit (B, KB, MB, GB, TB) based on the size
1184
1184
  * and formats the result with the specified number of decimal places.
1185
1185
  *
1186
1186
  * @param {number} bytes - The number of bytes to format.
1187
1187
  * @param {number} [decimals=2] - Number of decimal places to include in the result.
1188
1188
  * @returns {string} A formatted string with the appropriate unit.
1189
- *
1189
+ *
1190
1190
  * @example
1191
1191
  * ```typescript
1192
1192
  * import { AcTrStringUtil } from './AcCmStringUtil'
1193
- *
1193
+ *
1194
1194
  * // Format different byte sizes
1195
1195
  * AcTrStringUtil.formatBytes(0) // "0 B"
1196
- * AcTrStringUtil.formatBytes(1024) // "1 KB"
1196
+ * AcTrStringUtil.formatBytes(1024) // "1 KB"
1197
1197
  * AcTrStringUtil.formatBytes(1024 * 1024) // "1 MB"
1198
1198
  * AcTrStringUtil.formatBytes(1536, 1) // "1.5 KB"
1199
1199
  * AcTrStringUtil.formatBytes(2048000, 0) // "2 MB"
@@ -1201,14 +1201,14 @@ class se {
1201
1201
  */
1202
1202
  static formatBytes(e, t = 2) {
1203
1203
  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]}`;
1204
+ const r = 1024, o = Math.max(0, t), i = ["B", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(e) / Math.log(r)), f = e / Math.pow(r, l);
1205
+ return `${parseFloat(f.toFixed(o))} ${i[l]}`;
1206
1206
  }
1207
1207
  }
1208
1208
  class ie {
1209
1209
  /**
1210
1210
  * Creates a new task with the specified name.
1211
- *
1211
+ *
1212
1212
  * @param {string} name - The name identifier for this task.
1213
1213
  */
1214
1214
  constructor(e) {
@@ -1216,10 +1216,10 @@ class ie {
1216
1216
  }
1217
1217
  /**
1218
1218
  * Executes the task with the given input.
1219
- *
1219
+ *
1220
1220
  * This method must be implemented by subclasses to define the actual work
1221
1221
  * performed by the task. Can return either a synchronous result or a Promise.
1222
- *
1222
+ *
1223
1223
  * @param {TIn} _input - The input data for the task.
1224
1224
  * @returns {TOut | Promise<TOut>} The task result, either synchronous or asynchronous.
1225
1225
  * @throws {Error} When the method is not implemented by a subclass.
@@ -1235,6 +1235,23 @@ class le {
1235
1235
  }, this.onError = () => {
1236
1236
  };
1237
1237
  }
1238
+ /**
1239
+ * Schedules a task to be executed asynchronously.
1240
+ *
1241
+ * This method uses requestAnimationFrame in browser environments or setTimeout
1242
+ * in Node.js environments to schedule the task.
1243
+ *
1244
+ * @param callback - The callback function to schedule
1245
+ * @returns Promise that resolves with the result of the callback
1246
+ */
1247
+ scheduleTask(e) {
1248
+ return new Promise((t, r) => {
1249
+ const o = () => {
1250
+ Promise.resolve(e()).then(t).catch(r);
1251
+ };
1252
+ typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(o) : setTimeout(o, 0);
1253
+ });
1254
+ }
1238
1255
  /**
1239
1256
  * Adds a task to the execution queue.
1240
1257
  *
@@ -1270,15 +1287,9 @@ class le {
1270
1287
  for (let o = 0; o < t; o++) {
1271
1288
  const i = this.tasks[o];
1272
1289
  try {
1273
- r = await new Promise((l, g) => {
1274
- setTimeout(async () => {
1275
- try {
1276
- const p = await i.run(r);
1277
- this.onProgress((o + 1) / t, i), l(p);
1278
- } catch (p) {
1279
- g(p);
1280
- }
1281
- }, 0);
1290
+ r = await this.scheduleTask(async () => {
1291
+ const l = await i.run(r);
1292
+ return this.onProgress((o + 1) / t, i), l;
1282
1293
  });
1283
1294
  } catch (l) {
1284
1295
  this.onError(l, o, i);
@@ -1452,7 +1463,7 @@ export {
1452
1463
  ae as AcCmLoader,
1453
1464
  Q as AcCmLoadingManager,
1454
1465
  F as AcCmObject,
1455
- _ as AcCmPerformanceCollector,
1466
+ b as AcCmPerformanceCollector,
1456
1467
  ie as AcCmTask,
1457
1468
  le as AcCmTaskScheduler,
1458
1469
  se as AcTrStringUtil,
@@ -1462,7 +1473,7 @@ export {
1462
1473
  Z as defaults,
1463
1474
  J as has,
1464
1475
  X as isEmpty,
1465
- L as isEqual,
1476
+ _ as isEqual,
1466
1477
  C as log,
1467
1478
  oe as setLogLevel
1468
1479
  };
@@ -1 +1 @@
1
- (function(a,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(a=typeof globalThis<"u"?globalThis:a||self,L(a.common={}))})(this,function(a){"use strict";function L(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in n)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const I={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},M=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function E(n,e,t){return Math.max(e,Math.min(t,n))}const O=class O{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(e){e==null?this._color=null:(this._color=Math.round(E(e,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let e=this._color.toString(16).toUpperCase();for(;e.length<6;)e="0"+e;return`0x${e}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(e){e==null?this._colorIndex=null:(this._colorIndex=E(e,0,256),this._color=M[e],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(e){if(e){const t=I[e.toLowerCase()];t!==void 0?(this._colorName=e,this._color=t,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+e)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(e){return this.setRGB(e,e,e),this}setRGB(e,t,r){const o=Math.round(E(e,0,255)),s=Math.round(E(t,0,255)),l=Math.round(E(r,0,255));return this.color=(o<<16)+(s<<8)+l,this}setColorName(e){const t=I[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new O;return e.colorIndex=this.colorIndex,e.color=this.color,e._colorName=this._colorName,this}copy(e){return this.colorIndex=e.colorIndex,this.color=e.color,this._colorName=e._colorName,this}equals(e){return e.color==this.color&&e.colorIndex==this.colorIndex&&e._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(e){for(const[t,r]of Object.entries(I))if(r===e)return t;return null}getColorIndexByValue(e){const t=M.length-1;for(let r=1;r<t;++r)if(M[r]===e)return r;return null}};O.NAMES=I;let B=O;const W={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};class Y{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const o=this._listeners[e];if(o!==void 0){const s=o.indexOf(t);s!==-1&&o.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const o=r.slice(0);for(let s=0,l=o.length;s<l;s++)o[s].call(this,e)}}}class S{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const r of this.listeners)r.call(null,e,...t)}}var Z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var U={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(Z,function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],s={},l=null;function f(c,u){var i=c[u];if(typeof i.bind=="function")return i.bind(c);try{return Function.prototype.bind.call(i,c)}catch{return function(){return Function.prototype.apply.apply(i,[c,arguments])}}}function y(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function b(c){return c==="debug"&&(c="log"),typeof console===t?!1:c==="trace"&&r?y:console[c]!==void 0?f(console,c):console.log!==void 0?f(console,"log"):e}function m(){for(var c=this.getLevel(),u=0;u<o.length;u++){var i=o[u];this[i]=u<c?e:this.methodFactory(i,c,this.name)}if(this.log=this.debug,typeof console===t&&c<this.levels.SILENT)return"No console available for logging"}function x(c){return function(){typeof console!==t&&(m.call(this),this[c].apply(this,arguments))}}function g(c,u,i){return b(c)||x.apply(this,arguments)}function G(c,u){var i=this,N,R,_,p="loglevel";typeof c=="string"?p+=":"+c:typeof c=="symbol"&&(p=void 0);function se(h){var d=(o[h]||"silent").toUpperCase();if(!(typeof window===t||!p)){try{window.localStorage[p]=d;return}catch{}try{window.document.cookie=encodeURIComponent(p)+"="+d+";"}catch{}}}function H(){var h;if(!(typeof window===t||!p)){try{h=window.localStorage[p]}catch{}if(typeof h===t)try{var d=window.document.cookie,T=encodeURIComponent(p),z=d.indexOf(T+"=");z!==-1&&(h=/^([^;]+)/.exec(d.slice(z+T.length+1))[1])}catch{}return i.levels[h]===void 0&&(h=void 0),h}}function le(){if(!(typeof window===t||!p)){try{window.localStorage.removeItem(p)}catch{}try{window.document.cookie=encodeURIComponent(p)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function k(h){var d=h;if(typeof d=="string"&&i.levels[d.toUpperCase()]!==void 0&&(d=i.levels[d.toUpperCase()]),typeof d=="number"&&d>=0&&d<=i.levels.SILENT)return d;throw new TypeError("log.setLevel() called with invalid level: "+h)}i.name=c,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=u||g,i.getLevel=function(){return _??R??N},i.setLevel=function(h,d){return _=k(h),d!==!1&&se(_),m.call(i)},i.setDefaultLevel=function(h){R=k(h),H()||i.setLevel(h,!1)},i.resetLevel=function(){_=null,le(),m.call(i)},i.enableAll=function(h){i.setLevel(i.levels.TRACE,h)},i.disableAll=function(h){i.setLevel(i.levels.SILENT,h)},i.rebuild=function(){if(l!==i&&(N=k(l.getLevel())),m.call(i),l===i)for(var h in s)s[h].rebuild()},N=k(l?l.getLevel():"WARN");var K=H();K!=null&&(_=k(K)),m.call(i)}l=new G,l.getLogger=function(u){if(typeof u!="symbol"&&typeof u!="string"||u==="")throw new TypeError("You must supply a name when creating a logger.");var i=s[u];return i||(i=s[u]=new G(u,l.methodFactory)),i};var ie=typeof window!==t?window.log:void 0;return l.noConflict=function(){return typeof window!==t&&window.log===l&&(window.log=ie),l},l.getLoggers=function(){return s},l.default=l,l})})(U);var D=U.exports;const X=L({__proto__:null,default:J(D)},[D]),Q=!0,A=X;A.setLevel("debug");const ee=n=>{try{A.setLevel(n)}catch(e){A.setLevel("error"),A.error(e)}};function C(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function q(n,...e){for(const t of e)if(t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&n[r]===void 0&&(n[r]=t[r]);return n}function F(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function j(n){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}function v(n,e){if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(let o=0;o<n.length;o++)if(!v(n[o],e[o]))return!1;return!0}const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const o of t)if(!Object.prototype.hasOwnProperty.call(e,o)||!v(n[o],e[o]))return!1;return!0}class P{constructor(e,t){this.events={attrChanged:new S,modelChanged:new S},this._changing=!1,this._previousAttributes={},this._pending=!1;const r=e||{};t&&q(r,t),this.attributes=r,this.changed={}}get(e){return this.attributes[e]}set(e,t,r){if(e==null)return this;let o;typeof e=="object"?(o=e,r=t):(o={},o[e]=t),r||(r={});const s=r.unset,l=r.silent,f=[],y=this._changing;this._changing=!0,y||(this._previousAttributes=C(this.attributes),this.changed={});const b=this.attributes,m=this.changed,x=this._previousAttributes;for(const g in o)t=o[g],v(b[g],t)||f.push(g),v(x[g],t)?delete m[g]:m[g]=t,s?delete b[g]:b[g]=t;if(!l){f.length&&(this._pending=r);for(let g=0;g<f.length;g++)this.events.attrChanged.dispatch({object:this,attrName:f[g],attrValue:b[f[g]],options:r})}if(y)return this;if(!l)for(;this._pending;)r=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:r});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!j(this.changed):F(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?C(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,r={};for(const o in e){const s=e[o];v(t[o],s)||(r[o]=s)}return r}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return C(this._previousAttributes)}clone(){const e=C(this.attributes);return new P(e)}}class w{constructor(){this.entries=new Map}static getInstance(){return w.instance||(w.instance=new w),w.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries)console.log(`${e}:`),console.log(t.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}}class te{static formatBytes(e,t=2){if(e===0)return"0 B";const r=1024,o=Math.max(0,t),s=["B","KB","MB","GB","TB"],l=Math.floor(Math.log(e)/Math.log(r)),f=e/Math.pow(r,l);return`${parseFloat(f.toFixed(o))} ${s[l]}`}}class re{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class ne{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let r=e;for(let o=0;o<t;o++){const s=this.tasks[o];try{r=await new Promise((l,f)=>{setTimeout(async()=>{try{const y=await s.run(r);this.onProgress((o+1)/t,s),l(y)}catch(y){f(y)}},0)})}catch(l){this.onError(l,o,s);return}}this.onComplete(r)}}class V{constructor(e,t,r){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}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,r=this.handlers.length;t<r;t+=2){const o=this.handlers[t],s=this.handlers[t+1];if(o.global&&(o.lastIndex=0),o.test(e))return s}return null}}const $=new V;class oe{constructor(e){this.manager=e!==void 0?e:$,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((r,o)=>{this.load(e,r,t,o)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}a.AcCmColor=B,a.AcCmErrors=W,a.AcCmEventDispatcher=Y,a.AcCmEventManager=S,a.AcCmLoader=oe,a.AcCmLoadingManager=V,a.AcCmObject=P,a.AcCmPerformanceCollector=w,a.AcCmTask=re,a.AcCmTaskScheduler=ne,a.AcTrStringUtil=te,a.DEBUG_MODE=Q,a.DefaultLoadingManager=$,a.clone=C,a.defaults=q,a.has=F,a.isEmpty=j,a.isEqual=v,a.log=A,a.setLogLevel=ee,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(a,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(a=typeof globalThis<"u"?globalThis:a||self,_(a.common={}))})(this,function(a){"use strict";function _(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in n)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const k={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},M=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function L(n,e,t){return Math.max(e,Math.min(t,n))}const I=class I{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(e){e==null?this._color=null:(this._color=Math.round(L(e,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let e=this._color.toString(16).toUpperCase();for(;e.length<6;)e="0"+e;return`0x${e}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(e){e==null?this._colorIndex=null:(this._colorIndex=L(e,0,256),this._color=M[e],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(e){if(e){const t=k[e.toLowerCase()];t!==void 0?(this._colorName=e,this._color=t,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+e)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(e){return this.setRGB(e,e,e),this}setRGB(e,t,r){const o=Math.round(L(e,0,255)),s=Math.round(L(t,0,255)),l=Math.round(L(r,0,255));return this.color=(o<<16)+(s<<8)+l,this}setColorName(e){const t=k[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new I;return e.colorIndex=this.colorIndex,e.color=this.color,e._colorName=this._colorName,this}copy(e){return this.colorIndex=e.colorIndex,this.color=e.color,this._colorName=e._colorName,this}equals(e){return e.color==this.color&&e.colorIndex==this.colorIndex&&e._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(e){for(const[t,r]of Object.entries(k))if(r===e)return t;return null}getColorIndexByValue(e){const t=M.length-1;for(let r=1;r<t;++r)if(M[r]===e)return r;return null}};I.NAMES=k;let B=I;const W={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};class Y{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const o=this._listeners[e];if(o!==void 0){const s=o.indexOf(t);s!==-1&&o.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const o=r.slice(0);for(let s=0,l=o.length;s<l;s++)o[s].call(this,e)}}}class S{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const r of this.listeners)r.call(null,e,...t)}}var Z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var U={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(Z,function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],s={},l=null;function p(c,h){var i=c[h];if(typeof i.bind=="function")return i.bind(c);try{return Function.prototype.bind.call(i,c)}catch{return function(){return Function.prototype.apply.apply(i,[c,arguments])}}}function O(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function w(c){return c==="debug"&&(c="log"),typeof console===t?!1:c==="trace"&&r?O:console[c]!==void 0?p(console,c):console.log!==void 0?p(console,"log"):e}function y(){for(var c=this.getLevel(),h=0;h<o.length;h++){var i=o[h];this[i]=h<c?e:this.methodFactory(i,c,this.name)}if(this.log=this.debug,typeof console===t&&c<this.levels.SILENT)return"No console available for logging"}function x(c){return function(){typeof console!==t&&(y.call(this),this[c].apply(this,arguments))}}function g(c,h,i){return w(c)||x.apply(this,arguments)}function G(c,h){var i=this,T,R,b,f="loglevel";typeof c=="string"?f+=":"+c:typeof c=="symbol"&&(f=void 0);function se(u){var d=(o[u]||"silent").toUpperCase();if(!(typeof window===t||!f)){try{window.localStorage[f]=d;return}catch{}try{window.document.cookie=encodeURIComponent(f)+"="+d+";"}catch{}}}function H(){var u;if(!(typeof window===t||!f)){try{u=window.localStorage[f]}catch{}if(typeof u===t)try{var d=window.document.cookie,N=encodeURIComponent(f),z=d.indexOf(N+"=");z!==-1&&(u=/^([^;]+)/.exec(d.slice(z+N.length+1))[1])}catch{}return i.levels[u]===void 0&&(u=void 0),u}}function le(){if(!(typeof window===t||!f)){try{window.localStorage.removeItem(f)}catch{}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function C(u){var d=u;if(typeof d=="string"&&i.levels[d.toUpperCase()]!==void 0&&(d=i.levels[d.toUpperCase()]),typeof d=="number"&&d>=0&&d<=i.levels.SILENT)return d;throw new TypeError("log.setLevel() called with invalid level: "+u)}i.name=c,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=h||g,i.getLevel=function(){return b??R??T},i.setLevel=function(u,d){return b=C(u),d!==!1&&se(b),y.call(i)},i.setDefaultLevel=function(u){R=C(u),H()||i.setLevel(u,!1)},i.resetLevel=function(){b=null,le(),y.call(i)},i.enableAll=function(u){i.setLevel(i.levels.TRACE,u)},i.disableAll=function(u){i.setLevel(i.levels.SILENT,u)},i.rebuild=function(){if(l!==i&&(T=C(l.getLevel())),y.call(i),l===i)for(var u in s)s[u].rebuild()},T=C(l?l.getLevel():"WARN");var K=H();K!=null&&(b=C(K)),y.call(i)}l=new G,l.getLogger=function(h){if(typeof h!="symbol"&&typeof h!="string"||h==="")throw new TypeError("You must supply a name when creating a logger.");var i=s[h];return i||(i=s[h]=new G(h,l.methodFactory)),i};var ie=typeof window!==t?window.log:void 0;return l.noConflict=function(){return typeof window!==t&&window.log===l&&(window.log=ie),l},l.getLoggers=function(){return s},l.default=l,l})})(U);var D=U.exports;const X=_({__proto__:null,default:J(D)},[D]),Q=!0,E=X;E.setLevel("debug");const ee=n=>{try{E.setLevel(n)}catch(e){E.setLevel("error"),E.error(e)}};function A(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function q(n,...e){for(const t of e)if(t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&n[r]===void 0&&(n[r]=t[r]);return n}function F(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function j(n){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}function m(n,e){if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(let o=0;o<n.length;o++)if(!m(n[o],e[o]))return!1;return!0}const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const o of t)if(!Object.prototype.hasOwnProperty.call(e,o)||!m(n[o],e[o]))return!1;return!0}class P{constructor(e,t){this.events={attrChanged:new S,modelChanged:new S},this._changing=!1,this._previousAttributes={},this._pending=!1;const r=e||{};t&&q(r,t),this.attributes=r,this.changed={}}get(e){return this.attributes[e]}set(e,t,r){if(e==null)return this;let o;typeof e=="object"?(o=e,r=t):(o={},o[e]=t),r||(r={});const s=r.unset,l=r.silent,p=[],O=this._changing;this._changing=!0,O||(this._previousAttributes=A(this.attributes),this.changed={});const w=this.attributes,y=this.changed,x=this._previousAttributes;for(const g in o)t=o[g],m(w[g],t)||p.push(g),m(x[g],t)?delete y[g]:y[g]=t,s?delete w[g]:w[g]=t;if(!l){p.length&&(this._pending=r);for(let g=0;g<p.length;g++)this.events.attrChanged.dispatch({object:this,attrName:p[g],attrValue:w[p[g]],options:r})}if(O)return this;if(!l)for(;this._pending;)r=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:r});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!j(this.changed):F(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?A(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,r={};for(const o in e){const s=e[o];m(t[o],s)||(r[o]=s)}return r}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return A(this._previousAttributes)}clone(){const e=A(this.attributes);return new P(e)}}class v{constructor(){this.entries=new Map}static getInstance(){return v.instance||(v.instance=new v),v.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries)console.log(`${e}:`),console.log(t.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}}class te{static formatBytes(e,t=2){if(e===0)return"0 B";const r=1024,o=Math.max(0,t),s=["B","KB","MB","GB","TB"],l=Math.floor(Math.log(e)/Math.log(r)),p=e/Math.pow(r,l);return`${parseFloat(p.toFixed(o))} ${s[l]}`}}class re{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class ne{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}scheduleTask(e){return new Promise((t,r)=>{const o=()=>{Promise.resolve(e()).then(t).catch(r)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let r=e;for(let o=0;o<t;o++){const s=this.tasks[o];try{r=await this.scheduleTask(async()=>{const l=await s.run(r);return this.onProgress((o+1)/t,s),l})}catch(l){this.onError(l,o,s);return}}this.onComplete(r)}}class V{constructor(e,t,r){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}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,r=this.handlers.length;t<r;t+=2){const o=this.handlers[t],s=this.handlers[t+1];if(o.global&&(o.lastIndex=0),o.test(e))return s}return null}}const $=new V;class oe{constructor(e){this.manager=e!==void 0?e:$,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((r,o)=>{this.load(e,r,t,o)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}a.AcCmColor=B,a.AcCmErrors=W,a.AcCmEventDispatcher=Y,a.AcCmEventManager=S,a.AcCmLoader=oe,a.AcCmLoadingManager=V,a.AcCmObject=P,a.AcCmPerformanceCollector=v,a.AcCmTask=re,a.AcCmTaskScheduler=ne,a.AcTrStringUtil=te,a.DEBUG_MODE=Q,a.DefaultLoadingManager=$,a.clone=A,a.defaults=q,a.has=F,a.isEmpty=j,a.isEqual=m,a.log=E,a.setLogLevel=ee,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
@@ -112,6 +112,16 @@ export declare class AcCmTaskScheduler<TInitial, TFinal = TInitial> {
112
112
  private onProgress;
113
113
  private onComplete;
114
114
  private onError;
115
+ /**
116
+ * Schedules a task to be executed asynchronously.
117
+ *
118
+ * This method uses requestAnimationFrame in browser environments or setTimeout
119
+ * in Node.js environments to schedule the task.
120
+ *
121
+ * @param callback - The callback function to schedule
122
+ * @returns Promise that resolves with the result of the callback
123
+ */
124
+ private scheduleTask;
115
125
  /**
116
126
  * Adds a task to the execution queue.
117
127
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AcCmTaskScheduler.d.ts","sourceRoot":"","sources":["../src/AcCmTaskScheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,QAAQ,CAAC,GAAG,EAAE,IAAI;IAC7B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;OAIG;gBACS,IAAI,EAAE,MAAM;IAIxB;;;;;;;;;OASG;IACH,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvC;AAED;;;;;GAKG;AACH,KAAK,oBAAoB,GAAG,CAC1B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAA;AAET;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,IAAI,CAAA;AAE9D;;;;;;GAMG;AACH,KAAK,iBAAiB,GAAG,CACvB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,QAAQ,CAAC,OAAO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AA;AAET;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,IAAI,CAAA;AAE9D;;;;;;GAMG;AACH,KAAK,iBAAiB,GAAG,CACvB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAA;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ;IACxD,OAAO,CAAC,KAAK,CAAmC;IAChD,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,UAAU,CAAyC;IAC3D,OAAO,CAAC,OAAO,CAA8B;IAE7C;;;;;;;;OAQG;IACH,OAAO,CAAC,YAAY;IAoBpB;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI;IAInD;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAIzD;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,IAAI;IAIjE;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAInD;;OAEG;IACG,GAAG,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBhD"}
@@ -130,6 +130,32 @@ var AcCmTaskScheduler = /** @class */ (function () {
130
130
  this.onComplete = function () { };
131
131
  this.onError = function () { };
132
132
  }
133
+ /**
134
+ * Schedules a task to be executed asynchronously.
135
+ *
136
+ * This method uses requestAnimationFrame in browser environments or setTimeout
137
+ * in Node.js environments to schedule the task.
138
+ *
139
+ * @param callback - The callback function to schedule
140
+ * @returns Promise that resolves with the result of the callback
141
+ */
142
+ AcCmTaskScheduler.prototype.scheduleTask = function (callback) {
143
+ return new Promise(function (resolve, reject) {
144
+ var executeCallback = function () {
145
+ // Execute the callback and handle the result
146
+ Promise.resolve(callback()).then(resolve).catch(reject);
147
+ };
148
+ if (typeof window !== 'undefined' &&
149
+ typeof window.requestAnimationFrame === 'function') {
150
+ // Browser environment with requestAnimationFrame
151
+ window.requestAnimationFrame(executeCallback);
152
+ }
153
+ else {
154
+ // Node.js or fallback to setTimeout
155
+ setTimeout(executeCallback, 0);
156
+ }
157
+ });
158
+ };
133
159
  /**
134
160
  * Adds a task to the execution queue.
135
161
  *
@@ -177,28 +203,18 @@ var AcCmTaskScheduler = /** @class */ (function () {
177
203
  _b.label = 1;
178
204
  case 1:
179
205
  _b.trys.push([1, 3, , 4]);
180
- return [4 /*yield*/, new Promise(function (resolve, reject) {
181
- setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
182
- var output, err_1;
183
- return __generator(this, function (_a) {
184
- switch (_a.label) {
185
- case 0:
186
- _a.trys.push([0, 2, , 3]);
187
- return [4 /*yield*/, task.run(result)];
188
- case 1:
189
- output = _a.sent();
190
- this.onProgress((i + 1) / total, task);
191
- resolve(output);
192
- return [3 /*break*/, 3];
193
- case 2:
194
- err_1 = _a.sent();
195
- reject(err_1);
196
- return [3 /*break*/, 3];
197
- case 3: return [2 /*return*/];
198
- }
199
- });
200
- }); }, 0);
201
- })];
206
+ return [4 /*yield*/, this_1.scheduleTask(function () { return __awaiter(_this, void 0, void 0, function () {
207
+ var output;
208
+ return __generator(this, function (_a) {
209
+ switch (_a.label) {
210
+ case 0: return [4 /*yield*/, task.run(result)];
211
+ case 1:
212
+ output = _a.sent();
213
+ this.onProgress((i + 1) / total, task);
214
+ return [2 /*return*/, output];
215
+ }
216
+ });
217
+ }); })];
202
218
  case 2:
203
219
  result = _b.sent();
204
220
  return [3 /*break*/, 4];
@@ -1 +1 @@
1
- {"version":3,"file":"AcCmTaskScheduler.js","sourceRoot":"","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