@endge/utils 0.26.1 → 0.27.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/events/EventBus.d.ts +7 -1
- package/dist/utils.js +97 -81
- package/package.json +1 -1
|
@@ -5,6 +5,10 @@ import { OneOrMany } from '../tools/tools.types';
|
|
|
5
5
|
*/
|
|
6
6
|
export type EventCallback<T = any> = (payload: T) => void;
|
|
7
7
|
export type EventList = Record<string, any>;
|
|
8
|
+
export interface EventBusOptions {
|
|
9
|
+
/** При наличии изолирует ошибки подписчиков, включая rejected Promise. */
|
|
10
|
+
onListenerError?: (error: unknown, event: string) => void;
|
|
11
|
+
}
|
|
8
12
|
/**
|
|
9
13
|
* EventBus реализует паттерн подписки на события.
|
|
10
14
|
*
|
|
@@ -36,11 +40,12 @@ export type EventList = Record<string, any>;
|
|
|
36
40
|
* ```
|
|
37
41
|
*/
|
|
38
42
|
export declare class EventBus<StaticEvents extends Record<string, any>, CustomEventMap extends Record<string, any> = Record<string, any>> {
|
|
43
|
+
private readonly _options;
|
|
39
44
|
private _listeners;
|
|
40
45
|
/**
|
|
41
46
|
* Создает экземпляр EventBus и подготавливает базовое состояние.
|
|
42
47
|
*/
|
|
43
|
-
constructor(predefinedEvents?: Array<keyof StaticEvents
|
|
48
|
+
constructor(predefinedEvents?: Array<keyof StaticEvents>, _options?: EventBusOptions);
|
|
44
49
|
/**
|
|
45
50
|
* Обрабатывает входящее событие EventBus.
|
|
46
51
|
*/
|
|
@@ -93,6 +98,7 @@ export declare class EventBus<StaticEvents extends Record<string, any>, CustomEv
|
|
|
93
98
|
* Публикует событие во внутренний event bus EventBus.
|
|
94
99
|
*/
|
|
95
100
|
private _emit;
|
|
101
|
+
private _reportListenerError;
|
|
96
102
|
/**
|
|
97
103
|
* Выполняет действие hasListeners в рамках ответственности EventBus.
|
|
98
104
|
*/
|
package/dist/utils.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var V = Object.defineProperty;
|
|
2
2
|
var G = (r, t, e) => t in r ? V(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
3
|
var o = (r, t, e) => G(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { Transform as
|
|
4
|
+
import { Transform as h, TransformationType as _, plainToInstance as b, instanceToPlain as T, Expose as J } from "class-transformer";
|
|
5
5
|
import { IsOptional as Z } from "class-validator";
|
|
6
6
|
import "reflect-metadata";
|
|
7
7
|
import { v4 as W } from "uuid";
|
|
8
8
|
import { DateTime as Y } from "ts-luxon";
|
|
9
|
-
import { differenceInSeconds as z, format as g, differenceInCalendarDays as q, isAfter as
|
|
10
|
-
import { utcToZonedTime as
|
|
9
|
+
import { differenceInSeconds as z, format as g, differenceInCalendarDays as q, isAfter as D, isEqual as Q, isBefore as P, startOfDay as p, endOfDay as X } from "date-fns";
|
|
10
|
+
import { utcToZonedTime as I, getTimezoneOffset as w, zonedTimeToUtc as v } from "date-fns-tz";
|
|
11
11
|
import { fetchEventSource as tt, EventStreamContentType as et } from "@microsoft/fetch-event-source";
|
|
12
12
|
var m = /* @__PURE__ */ ((r) => (r.Add = "add", r.Remove = "remove", r.Update = "update", r.IndexCreate = "indexCreate", r))(m || {});
|
|
13
13
|
class H {
|
|
14
14
|
/**
|
|
15
15
|
* Создает экземпляр EventBus и подготавливает базовое состояние.
|
|
16
16
|
*/
|
|
17
|
-
constructor(t = []) {
|
|
17
|
+
constructor(t = [], e = {}) {
|
|
18
18
|
o(this, "_listeners", /* @__PURE__ */ new Map());
|
|
19
|
-
t.forEach((
|
|
20
|
-
this._listeners.set(
|
|
19
|
+
this._options = e, t.forEach((n) => {
|
|
20
|
+
this._listeners.set(n, /* @__PURE__ */ new Set());
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
// ---- Типизированные события ----
|
|
@@ -43,8 +43,7 @@ class H {
|
|
|
43
43
|
* Выполняет действие offAll в рамках ответственности EventBus.
|
|
44
44
|
*/
|
|
45
45
|
offAll() {
|
|
46
|
-
|
|
47
|
-
t.clear();
|
|
46
|
+
this._listeners.clear();
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* Публикует событие во внутренний event bus EventBus.
|
|
@@ -101,10 +100,11 @@ class H {
|
|
|
101
100
|
* Выполняет внутренний шаг _off для EventBus.
|
|
102
101
|
*/
|
|
103
102
|
_off(t, e) {
|
|
104
|
-
var i;
|
|
105
103
|
const n = Array.isArray(t) ? t : [t];
|
|
106
|
-
for (const
|
|
107
|
-
|
|
104
|
+
for (const i of n) {
|
|
105
|
+
const s = this._listeners.get(i);
|
|
106
|
+
s == null || s.delete(e), (s == null ? void 0 : s.size) === 0 && this._listeners.delete(i);
|
|
107
|
+
}
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Публикует событие во внутренний event bus EventBus.
|
|
@@ -112,8 +112,25 @@ class H {
|
|
|
112
112
|
_emit(t, e) {
|
|
113
113
|
const n = this._listeners.get(t);
|
|
114
114
|
if (n)
|
|
115
|
-
for (const i of n)
|
|
116
|
-
|
|
115
|
+
for (const i of [...n]) {
|
|
116
|
+
if (!this._options.onListenerError) {
|
|
117
|
+
i(e);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const s = i(e);
|
|
122
|
+
s && typeof s.then == "function" && Promise.resolve(s).catch((a) => this._reportListenerError(a, t));
|
|
123
|
+
} catch (s) {
|
|
124
|
+
this._reportListenerError(s, t);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
_reportListenerError(t, e) {
|
|
129
|
+
var n, i;
|
|
130
|
+
try {
|
|
131
|
+
(i = (n = this._options).onListenerError) == null || i.call(n, t, e);
|
|
132
|
+
} catch {
|
|
133
|
+
}
|
|
117
134
|
}
|
|
118
135
|
/**
|
|
119
136
|
* Выполняет действие hasListeners в рамках ответственности EventBus.
|
|
@@ -132,8 +149,7 @@ class H {
|
|
|
132
149
|
* Очищает накопленное состояние EventBus.
|
|
133
150
|
*/
|
|
134
151
|
clear(t) {
|
|
135
|
-
|
|
136
|
-
t ? (e = this._listeners.get(t)) == null || e.clear() : this._listeners.clear();
|
|
152
|
+
t ? this._listeners.delete(t) : this._listeners.clear();
|
|
137
153
|
}
|
|
138
154
|
}
|
|
139
155
|
const wt = new H(Object.keys({}));
|
|
@@ -251,7 +267,7 @@ class xt extends U {
|
|
|
251
267
|
this._bus.off(e, n);
|
|
252
268
|
}
|
|
253
269
|
}
|
|
254
|
-
class
|
|
270
|
+
class Et {
|
|
255
271
|
/**
|
|
256
272
|
* Создает экземпляр IndexedCollection и подготавливает базовое состояние.
|
|
257
273
|
*/
|
|
@@ -488,7 +504,7 @@ class Dt {
|
|
|
488
504
|
this._list.pop(), this._indexById.delete(t);
|
|
489
505
|
}
|
|
490
506
|
}
|
|
491
|
-
class
|
|
507
|
+
class Dt {
|
|
492
508
|
constructor(t) {
|
|
493
509
|
o(this, "_cap");
|
|
494
510
|
o(this, "_buf");
|
|
@@ -519,7 +535,7 @@ class It {
|
|
|
519
535
|
return t;
|
|
520
536
|
}
|
|
521
537
|
}
|
|
522
|
-
class
|
|
538
|
+
class It {
|
|
523
539
|
constructor(t) {
|
|
524
540
|
o(this, "_baseUrl");
|
|
525
541
|
this._baseUrl = t.baseUrl.replace(/\/+$/, "");
|
|
@@ -635,7 +651,7 @@ function x(r) {
|
|
|
635
651
|
var t;
|
|
636
652
|
return r == null ? String(r) : typeof r == "string" ? `string(${r.length})` : typeof r != "object" ? `${typeof r}(${String(r)})` : Array.isArray(r) ? `Array(${r.length})` : r instanceof Map ? `Map(${r.size})` : r instanceof Set ? `Set(${r.size})` : ((t = r.constructor) == null ? void 0 : t.name) || "Object";
|
|
637
653
|
}
|
|
638
|
-
function
|
|
654
|
+
function E(r) {
|
|
639
655
|
return r instanceof Error ? `${r.name}: ${r.message}` : x(r);
|
|
640
656
|
}
|
|
641
657
|
class At {
|
|
@@ -675,7 +691,7 @@ class At {
|
|
|
675
691
|
const e = this._callbacks.get(t);
|
|
676
692
|
e && e();
|
|
677
693
|
} catch (e) {
|
|
678
|
-
console.error(`[NamedExecutor] flush error: ${
|
|
694
|
+
console.error(`[NamedExecutor] flush error: ${E(e)}`);
|
|
679
695
|
}
|
|
680
696
|
this._clear(t);
|
|
681
697
|
}
|
|
@@ -701,7 +717,7 @@ class At {
|
|
|
701
717
|
}
|
|
702
718
|
function Ot() {
|
|
703
719
|
return function(r, t) {
|
|
704
|
-
|
|
720
|
+
h(
|
|
705
721
|
({ value: e }) => {
|
|
706
722
|
if (typeof e == "string")
|
|
707
723
|
try {
|
|
@@ -712,7 +728,7 @@ function Ot() {
|
|
|
712
728
|
return e;
|
|
713
729
|
},
|
|
714
730
|
{ toClassOnly: !0 }
|
|
715
|
-
)(r, t),
|
|
731
|
+
)(r, t), h(
|
|
716
732
|
({ value: e }) => {
|
|
717
733
|
try {
|
|
718
734
|
return JSON.stringify(e);
|
|
@@ -726,7 +742,7 @@ function Ot() {
|
|
|
726
742
|
}
|
|
727
743
|
function Mt() {
|
|
728
744
|
return function(r, t) {
|
|
729
|
-
|
|
745
|
+
h(
|
|
730
746
|
({ value: e }) => {
|
|
731
747
|
if (e == null)
|
|
732
748
|
return "{}";
|
|
@@ -739,7 +755,7 @@ function Mt() {
|
|
|
739
755
|
return e;
|
|
740
756
|
},
|
|
741
757
|
{ toClassOnly: !0 }
|
|
742
|
-
)(r, t),
|
|
758
|
+
)(r, t), h(
|
|
743
759
|
({ value: e }) => {
|
|
744
760
|
if (!e)
|
|
745
761
|
return {};
|
|
@@ -756,7 +772,7 @@ function Mt() {
|
|
|
756
772
|
};
|
|
757
773
|
}
|
|
758
774
|
const K = Symbol("onDeserialized");
|
|
759
|
-
function
|
|
775
|
+
function Lt() {
|
|
760
776
|
return function(r, t) {
|
|
761
777
|
Reflect.defineMetadata(K, t, r);
|
|
762
778
|
};
|
|
@@ -768,19 +784,19 @@ function rt(r) {
|
|
|
768
784
|
);
|
|
769
785
|
return t ? r[t].bind(r) : null;
|
|
770
786
|
}
|
|
771
|
-
function
|
|
787
|
+
function $t() {
|
|
772
788
|
return function(r, t) {
|
|
773
|
-
|
|
789
|
+
h(
|
|
774
790
|
({ value: e }) => typeof e == "string" ? e.trim() : String(e ?? ""),
|
|
775
791
|
{ toClassOnly: !0 }
|
|
776
|
-
)(r, t),
|
|
792
|
+
)(r, t), h(
|
|
777
793
|
({ value: e }) => typeof e == "string" ? e : String(e ?? ""),
|
|
778
794
|
{ toPlainOnly: !0 }
|
|
779
795
|
)(r, t);
|
|
780
796
|
};
|
|
781
797
|
}
|
|
782
798
|
function Ft(r, t) {
|
|
783
|
-
return
|
|
799
|
+
return h(({ value: e, type: n }) => {
|
|
784
800
|
if (!e)
|
|
785
801
|
return /* @__PURE__ */ new Map();
|
|
786
802
|
if (n === _.PLAIN_TO_CLASS) {
|
|
@@ -807,8 +823,8 @@ function Ft(r, t) {
|
|
|
807
823
|
return n === _.CLASS_TO_PLAIN ? e instanceof Map ? Array.from(e.values()).map((i) => T(i)) : (console.warn(`[TypeMap] Expected Map, got ${x(e)}`), t ? [] : {}) : (console.warn(`[TypeMap] Unexpected transformation type: ${String(n)}`), e);
|
|
808
824
|
});
|
|
809
825
|
}
|
|
810
|
-
function
|
|
811
|
-
return
|
|
826
|
+
function kt(r) {
|
|
827
|
+
return h(({ value: t, type: e }) => {
|
|
812
828
|
if (!t || typeof t != "object")
|
|
813
829
|
return {};
|
|
814
830
|
if (e === _.PLAIN_TO_CLASS) {
|
|
@@ -863,23 +879,23 @@ function Ht(r, t, e) {
|
|
|
863
879
|
}
|
|
864
880
|
function Ut(r) {
|
|
865
881
|
return function(t, e) {
|
|
866
|
-
|
|
882
|
+
h(({ value: n }) => n === null ? void 0 : n, { toPlainOnly: !0 })(t, e), Z(r)(t, e);
|
|
867
883
|
};
|
|
868
884
|
}
|
|
869
885
|
function Kt() {
|
|
870
|
-
return
|
|
886
|
+
return h(({ value: r, type: t }) => t === _.PLAIN_TO_CLASS ? r == null ? void 0 : r.id : r);
|
|
871
887
|
}
|
|
872
888
|
function Rt(r) {
|
|
873
|
-
return
|
|
889
|
+
return h(({ value: t, type: e }) => e === _.PLAIN_TO_CLASS ? t == null ? void 0 : t.map((n) => n == null ? void 0 : n[r]) : t);
|
|
874
890
|
}
|
|
875
891
|
function jt() {
|
|
876
|
-
return
|
|
892
|
+
return h(({ value: r, type: t }) => t === _.CLASS_TO_PLAIN && (r == null ? void 0 : r.id) || r);
|
|
877
893
|
}
|
|
878
894
|
function Bt() {
|
|
879
|
-
return
|
|
895
|
+
return h(({ value: r, type: t }) => t === _.CLASS_TO_PLAIN ? r.map((e) => e.id) : r);
|
|
880
896
|
}
|
|
881
897
|
function Vt() {
|
|
882
|
-
return
|
|
898
|
+
return h(({ value: r, type: t }) => t === _.CLASS_TO_PLAIN ? void 0 : r, { toPlainOnly: !0 });
|
|
883
899
|
}
|
|
884
900
|
function Gt(r, t) {
|
|
885
901
|
return b(r, t, {
|
|
@@ -902,11 +918,11 @@ const Yt = !1;
|
|
|
902
918
|
function qt(r, t) {
|
|
903
919
|
return t();
|
|
904
920
|
}
|
|
905
|
-
const Qt = () => W(),
|
|
921
|
+
const Qt = () => W(), L = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
906
922
|
function Xt(r) {
|
|
907
923
|
let t = "";
|
|
908
924
|
for (let e = 0; e < r; ++e)
|
|
909
|
-
t +=
|
|
925
|
+
t += L[Math.floor(L.length * Math.random())];
|
|
910
926
|
return t;
|
|
911
927
|
}
|
|
912
928
|
class vt {
|
|
@@ -998,7 +1014,7 @@ function te(r, t) {
|
|
|
998
1014
|
return n && i && s && a && l;
|
|
999
1015
|
}) : !1;
|
|
1000
1016
|
}
|
|
1001
|
-
const
|
|
1017
|
+
const $ = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new Set([
|
|
1002
1018
|
"Alt",
|
|
1003
1019
|
"AltGraph",
|
|
1004
1020
|
"CapsLock",
|
|
@@ -1024,7 +1040,7 @@ function re(r, t) {
|
|
|
1024
1040
|
}
|
|
1025
1041
|
function R(r) {
|
|
1026
1042
|
var a, l, u;
|
|
1027
|
-
const t =
|
|
1043
|
+
const t = $.get(r);
|
|
1028
1044
|
if (t)
|
|
1029
1045
|
return t;
|
|
1030
1046
|
const e = st((a = r.defaultView) == null ? void 0 : a.navigator), n = {
|
|
@@ -1067,7 +1083,7 @@ function R(r) {
|
|
|
1067
1083
|
n.entries.delete(c.code || `key:${f}`), i(c);
|
|
1068
1084
|
}, !0), r.addEventListener("visibilitychange", () => {
|
|
1069
1085
|
r.visibilityState === "hidden" && s();
|
|
1070
|
-
}), (l = r.defaultView) == null || l.addEventListener("blur", s), (u = r.defaultView) == null || u.addEventListener("pagehide", s),
|
|
1086
|
+
}), (l = r.defaultView) == null || l.addEventListener("blur", s), (u = r.defaultView) == null || u.addEventListener("pagehide", s), $.set(r, n), n;
|
|
1071
1087
|
}
|
|
1072
1088
|
function F(r) {
|
|
1073
1089
|
return {
|
|
@@ -1089,9 +1105,9 @@ function st(r) {
|
|
|
1089
1105
|
return e.includes("mac") || e.includes("darwin") || e.includes("iphone") || e.includes("ipad") ? "macos" : e.includes("win") ? "windows" : e.includes("linux") || e.includes("x11") || e.includes("cros") ? "linux" : "unknown";
|
|
1090
1106
|
}
|
|
1091
1107
|
function ot(r, t) {
|
|
1092
|
-
return r.platform === t.platform && r.modifiers.ctrl === t.modifiers.ctrl && r.modifiers.shift === t.modifiers.shift && r.modifiers.alt === t.modifiers.alt && r.modifiers.meta === t.modifiers.meta && r.modifiers.mod === t.modifiers.mod && r.modifiers.altGraph === t.modifiers.altGraph &&
|
|
1108
|
+
return r.platform === t.platform && r.modifiers.ctrl === t.modifiers.ctrl && r.modifiers.shift === t.modifiers.shift && r.modifiers.alt === t.modifiers.alt && r.modifiers.meta === t.modifiers.meta && r.modifiers.mod === t.modifiers.mod && r.modifiers.altGraph === t.modifiers.altGraph && k(r.held.key, t.held.key) && k(r.held.code, t.held.code);
|
|
1093
1109
|
}
|
|
1094
|
-
function
|
|
1110
|
+
function k(r, t) {
|
|
1095
1111
|
return r.length === t.length && r.every((e, n) => e === t[n]);
|
|
1096
1112
|
}
|
|
1097
1113
|
function C(r) {
|
|
@@ -1305,17 +1321,17 @@ function ae(r) {
|
|
|
1305
1321
|
return String(r).charAt(0).toUpperCase() + String(r).slice(1);
|
|
1306
1322
|
}
|
|
1307
1323
|
function ce(r, t) {
|
|
1308
|
-
return
|
|
1324
|
+
return D(r, t) || Q(r, t);
|
|
1309
1325
|
}
|
|
1310
1326
|
function le(r, t, e, n) {
|
|
1311
1327
|
const i = p(r), s = p(t), a = p(e), l = p(n);
|
|
1312
|
-
return !P(s, a) && !
|
|
1328
|
+
return !P(s, a) && !D(i, l);
|
|
1313
1329
|
}
|
|
1314
1330
|
function ue(r, t, e) {
|
|
1315
|
-
return !P(r, p(t)) && !
|
|
1331
|
+
return !P(r, p(t)) && !D(r, X(e));
|
|
1316
1332
|
}
|
|
1317
1333
|
const fe = (r) => r && new Date(r);
|
|
1318
|
-
function
|
|
1334
|
+
function he(r, t = "HH:mm dd.MM.yyyy", e = {}) {
|
|
1319
1335
|
return r && g(r, t, e);
|
|
1320
1336
|
}
|
|
1321
1337
|
function ut(r, t = "HH:mm dd.MM.yyyy", e = {}, n = !0) {
|
|
@@ -1328,9 +1344,9 @@ function ut(r, t = "HH:mm dd.MM.yyyy", e = {}, n = !0) {
|
|
|
1328
1344
|
return "";
|
|
1329
1345
|
} else
|
|
1330
1346
|
r = new Date(r.toString());
|
|
1331
|
-
return n ? g(r, t, e) : g(
|
|
1347
|
+
return n ? g(r, t, e) : g(I(r, "utc"), t, e);
|
|
1332
1348
|
}
|
|
1333
|
-
function
|
|
1349
|
+
function de(r) {
|
|
1334
1350
|
const t = { weekday: "short" }, e = new Intl.DateTimeFormat("ru-RU", t).format(r);
|
|
1335
1351
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1336
1352
|
}
|
|
@@ -1350,11 +1366,11 @@ function ye(r) {
|
|
|
1350
1366
|
}
|
|
1351
1367
|
function pe(r, t) {
|
|
1352
1368
|
const e = z(r, t), { hours: n, minutes: i } = A(e);
|
|
1353
|
-
return n || i ? `${e > 0 ? "-" : "+"}${
|
|
1369
|
+
return n || i ? `${e > 0 ? "-" : "+"}${d(n)}:${d(i)}` : "";
|
|
1354
1370
|
}
|
|
1355
1371
|
function ge(r, t) {
|
|
1356
1372
|
const e = z(r, t), { hours: n, minutes: i } = A(e);
|
|
1357
|
-
return n || i ? `${e > 0 ? "-" : ""}${
|
|
1373
|
+
return n || i ? `${e > 0 ? "-" : ""}${d(n)}:${d(i)}` : "";
|
|
1358
1374
|
}
|
|
1359
1375
|
function N(r = /* @__PURE__ */ new Date()) {
|
|
1360
1376
|
return new Date(r.getFullYear(), r.getMonth(), r.getDate());
|
|
@@ -1405,20 +1421,20 @@ function xe(r) {
|
|
|
1405
1421
|
const e = new Date(t);
|
|
1406
1422
|
if (Number.isNaN(e.getTime()))
|
|
1407
1423
|
return t.slice(0, 16);
|
|
1408
|
-
const n = e.getFullYear(), i =
|
|
1424
|
+
const n = e.getFullYear(), i = d(e.getMonth() + 1), s = d(e.getDate()), a = d(e.getHours()), l = d(e.getMinutes());
|
|
1409
1425
|
return `${n}-${i}-${s}T${a}:${l}`;
|
|
1410
1426
|
}
|
|
1411
|
-
function
|
|
1427
|
+
function Ee(r, t) {
|
|
1412
1428
|
const e = j(r);
|
|
1413
1429
|
if (e)
|
|
1414
1430
|
return e;
|
|
1415
1431
|
const n = new Date(String(r ?? "").trim());
|
|
1416
1432
|
if (Number.isNaN(n.getTime()))
|
|
1417
1433
|
return "";
|
|
1418
|
-
const i = B(t), s = i ?
|
|
1419
|
-
return `${
|
|
1434
|
+
const i = B(t), s = i ? I(n, i) : n;
|
|
1435
|
+
return `${d(s.getHours())}:${d(s.getMinutes())}`;
|
|
1420
1436
|
}
|
|
1421
|
-
function
|
|
1437
|
+
function De(r, t, e) {
|
|
1422
1438
|
const n = j(t).match(/^(\d{2}):(\d{2})$/);
|
|
1423
1439
|
if (!n)
|
|
1424
1440
|
return null;
|
|
@@ -1431,7 +1447,7 @@ function Ie(r, t, e) {
|
|
|
1431
1447
|
const l = B(e);
|
|
1432
1448
|
if (!l)
|
|
1433
1449
|
return i.setHours(s, a, 0, 0), i.toISOString();
|
|
1434
|
-
const u =
|
|
1450
|
+
const u = I(i, l);
|
|
1435
1451
|
return u.setHours(s, a, 0, 0), v(u, l).toISOString();
|
|
1436
1452
|
}
|
|
1437
1453
|
function j(r) {
|
|
@@ -1456,7 +1472,7 @@ function B(r) {
|
|
|
1456
1472
|
return null;
|
|
1457
1473
|
}
|
|
1458
1474
|
}
|
|
1459
|
-
function
|
|
1475
|
+
function Ie(r) {
|
|
1460
1476
|
if (r == null)
|
|
1461
1477
|
return null;
|
|
1462
1478
|
const t = String(r).trim();
|
|
@@ -1469,8 +1485,8 @@ function Ee(r) {
|
|
|
1469
1485
|
return n ? `${n[1]}:${n[2]}:00` : null;
|
|
1470
1486
|
}
|
|
1471
1487
|
function Ce(r) {
|
|
1472
|
-
const t =
|
|
1473
|
-
return `${e}${
|
|
1488
|
+
const t = ht(r), e = Math.sign(t) >= 0 ? "" : "-", { hours: n, minutes: i } = A(t);
|
|
1489
|
+
return `${e}${d(n)}:${d(i)}`;
|
|
1474
1490
|
}
|
|
1475
1491
|
function Ae(r = null, t = "dd", e = {}) {
|
|
1476
1492
|
const n = ft(r);
|
|
@@ -1492,7 +1508,7 @@ function A(r) {
|
|
|
1492
1508
|
minutes: Math.floor(t / 60) % 60
|
|
1493
1509
|
};
|
|
1494
1510
|
}
|
|
1495
|
-
function
|
|
1511
|
+
function ht(r) {
|
|
1496
1512
|
const t = String(r ?? "").trim();
|
|
1497
1513
|
if (!t)
|
|
1498
1514
|
return 0;
|
|
@@ -1506,7 +1522,7 @@ function dt(r) {
|
|
|
1506
1522
|
}
|
|
1507
1523
|
return 0;
|
|
1508
1524
|
}
|
|
1509
|
-
function
|
|
1525
|
+
function d(r) {
|
|
1510
1526
|
return String(r).padStart(2, "0");
|
|
1511
1527
|
}
|
|
1512
1528
|
function Oe(r) {
|
|
@@ -1524,7 +1540,7 @@ function Oe(r) {
|
|
|
1524
1540
|
function Me(r) {
|
|
1525
1541
|
return w(r, /* @__PURE__ */ new Date());
|
|
1526
1542
|
}
|
|
1527
|
-
class
|
|
1543
|
+
class Le {
|
|
1528
1544
|
constructor(t) {
|
|
1529
1545
|
o(this, "_url");
|
|
1530
1546
|
o(this, "_retryInterval");
|
|
@@ -1587,7 +1603,7 @@ class $e {
|
|
|
1587
1603
|
try {
|
|
1588
1604
|
this._options.onEvent(JSON.parse(s.data));
|
|
1589
1605
|
} catch (a) {
|
|
1590
|
-
console.warn(`[SSEManager] Failed to parse message: ${
|
|
1606
|
+
console.warn(`[SSEManager] Failed to parse message: ${E(a)}`);
|
|
1591
1607
|
}
|
|
1592
1608
|
},
|
|
1593
1609
|
onclose: () => {
|
|
@@ -1605,7 +1621,7 @@ class $e {
|
|
|
1605
1621
|
try {
|
|
1606
1622
|
(n = (e = this._options).onError) == null || n.call(e, i instanceof Error ? i : new Error(String(i)));
|
|
1607
1623
|
} catch (s) {
|
|
1608
|
-
console.warn(`[SSEManager] Error callback failed: ${
|
|
1624
|
+
console.warn(`[SSEManager] Error callback failed: ${E(s)}`);
|
|
1609
1625
|
}
|
|
1610
1626
|
}
|
|
1611
1627
|
} finally {
|
|
@@ -1616,7 +1632,7 @@ class $e {
|
|
|
1616
1632
|
return this._isConnected;
|
|
1617
1633
|
}
|
|
1618
1634
|
}
|
|
1619
|
-
class
|
|
1635
|
+
class $e {
|
|
1620
1636
|
constructor() {
|
|
1621
1637
|
o(this, "_currentCount", 0);
|
|
1622
1638
|
o(this, "_lastResetTime", Date.now());
|
|
@@ -1647,15 +1663,15 @@ export {
|
|
|
1647
1663
|
vt as HotkeyManager,
|
|
1648
1664
|
Yt as IS_DEBUG,
|
|
1649
1665
|
Vt as IgnoreToPlain,
|
|
1650
|
-
|
|
1666
|
+
Et as IndexedCollection,
|
|
1651
1667
|
Ut as IsOptionalTransformed,
|
|
1652
1668
|
Ot as Json,
|
|
1653
1669
|
Mt as JsonString,
|
|
1654
1670
|
At as NamedExecutor,
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1671
|
+
It as PayloadHttpClient,
|
|
1672
|
+
Dt as RingBuffer,
|
|
1673
|
+
Le as SSEManager,
|
|
1674
|
+
$t as Script,
|
|
1659
1675
|
Nt as Serialize,
|
|
1660
1676
|
jt as SerializeId,
|
|
1661
1677
|
Bt as SerializeIds,
|
|
@@ -1663,11 +1679,11 @@ export {
|
|
|
1663
1679
|
U as Subscribable,
|
|
1664
1680
|
lt as SystemClock,
|
|
1665
1681
|
Ft as TypeMap,
|
|
1666
|
-
|
|
1667
|
-
|
|
1682
|
+
kt as TypeRecord,
|
|
1683
|
+
$e as UPSMeter_Service,
|
|
1668
1684
|
ae as capitalize,
|
|
1669
1685
|
Wt as compareNumber,
|
|
1670
|
-
|
|
1686
|
+
E as consoleErrorSummary,
|
|
1671
1687
|
x as consoleValueSummary,
|
|
1672
1688
|
ie as createInstance,
|
|
1673
1689
|
pe as diffDuration,
|
|
@@ -1676,12 +1692,12 @@ export {
|
|
|
1676
1692
|
me as extractTime,
|
|
1677
1693
|
ye as findMinMaxDates,
|
|
1678
1694
|
_e as formatDateToMSK,
|
|
1679
|
-
|
|
1695
|
+
he as formatDatetime,
|
|
1680
1696
|
ut as formatDatetimeTZ,
|
|
1681
1697
|
Ae as formatDatetimeTZSpecial,
|
|
1682
1698
|
Qt as generateUUID,
|
|
1683
1699
|
be as getDateOnlyDiffFactor,
|
|
1684
|
-
|
|
1700
|
+
de as getDayOfWeek,
|
|
1685
1701
|
ee as getKeyboardStateSnapshot,
|
|
1686
1702
|
rt as getOnDeserializedMethod,
|
|
1687
1703
|
Me as getTimezoneOffsetMs,
|
|
@@ -1692,11 +1708,11 @@ export {
|
|
|
1692
1708
|
ue as isDateInRange,
|
|
1693
1709
|
le as isDateRangeOverlap,
|
|
1694
1710
|
Zt as isNullOrUndefined,
|
|
1695
|
-
|
|
1711
|
+
Ee as isoDateTimeToTimeInput,
|
|
1696
1712
|
we as isoToDateInput,
|
|
1697
1713
|
xe as isoToDateTimeLocalInput,
|
|
1698
|
-
|
|
1699
|
-
|
|
1714
|
+
De as mergeTimeIntoDateTime,
|
|
1715
|
+
Lt as onDeserialized,
|
|
1700
1716
|
fe as parseDate,
|
|
1701
1717
|
Ce as parseDuration,
|
|
1702
1718
|
Oe as parseOffsetToTimezone,
|
|
@@ -1709,5 +1725,5 @@ export {
|
|
|
1709
1725
|
Te as toIsoZDate,
|
|
1710
1726
|
Se as toIsoZDateTime,
|
|
1711
1727
|
Jt as toPlain,
|
|
1712
|
-
|
|
1728
|
+
Ie as toTimeHHMMSS
|
|
1713
1729
|
};
|