@endge/utils 0.25.3 → 0.25.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/collection/collection.d.ts +5 -5
- package/dist/collection/indexed-collection.d.ts +16 -16
- package/dist/database/PayloadHttpClient.d.ts +3 -3
- package/dist/events/EventBus.d.ts +1 -1
- package/dist/execute/NamedExecutor.d.ts +7 -7
- package/dist/execute/delay-executor.d.ts +8 -8
- package/dist/tools/hotkeys.d.ts +8 -8
- package/dist/tools/logs.d.ts +4 -4
- package/dist/utils.js +343 -334
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 f, TransformationType as
|
|
4
|
+
import { Transform as f, TransformationType as _, plainToInstance as T, instanceToPlain as S, 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 N, format as
|
|
10
|
-
import { utcToZonedTime as
|
|
9
|
+
import { differenceInSeconds as N, format as g, differenceInCalendarDays as q, isAfter as D, isEqual as Q, isBefore as z, 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
|
-
var
|
|
12
|
+
var m = /* @__PURE__ */ ((r) => (r.Add = "add", r.Remove = "remove", r.Update = "update", r.IndexCreate = "indexCreate", r))(m || {});
|
|
13
13
|
class P {
|
|
14
14
|
constructor() {
|
|
15
15
|
o(this, "_listeners", /* @__PURE__ */ new Set());
|
|
@@ -31,9 +31,9 @@ class H {
|
|
|
31
31
|
* Создает экземпляр EventBus и подготавливает базовое состояние.
|
|
32
32
|
*/
|
|
33
33
|
constructor(t = []) {
|
|
34
|
-
o(this, "
|
|
34
|
+
o(this, "_listeners", /* @__PURE__ */ new Map());
|
|
35
35
|
t.forEach((e) => {
|
|
36
|
-
this.
|
|
36
|
+
this._listeners.set(e, /* @__PURE__ */ new Set());
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
// ---- Типизированные события ----
|
|
@@ -59,7 +59,7 @@ class H {
|
|
|
59
59
|
* Выполняет действие offAll в рамках ответственности EventBus.
|
|
60
60
|
*/
|
|
61
61
|
offAll() {
|
|
62
|
-
for (const t of this.
|
|
62
|
+
for (const t of this._listeners.values())
|
|
63
63
|
t.clear();
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -100,7 +100,7 @@ class H {
|
|
|
100
100
|
_on(t, e) {
|
|
101
101
|
const n = Array.isArray(t) ? t : [t];
|
|
102
102
|
for (const i of n)
|
|
103
|
-
this.
|
|
103
|
+
this._listeners.has(i) || this._listeners.set(i, /* @__PURE__ */ new Set()), this._listeners.get(i).add(e);
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Обрабатывает входящее событие EventBus.
|
|
@@ -120,13 +120,13 @@ class H {
|
|
|
120
120
|
var i;
|
|
121
121
|
const n = Array.isArray(t) ? t : [t];
|
|
122
122
|
for (const s of n)
|
|
123
|
-
(i = this.
|
|
123
|
+
(i = this._listeners.get(s)) == null || i.delete(e);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
* Публикует событие во внутренний event bus EventBus.
|
|
127
127
|
*/
|
|
128
128
|
_emit(t, e) {
|
|
129
|
-
const n = this.
|
|
129
|
+
const n = this._listeners.get(t);
|
|
130
130
|
if (n)
|
|
131
131
|
for (const i of n)
|
|
132
132
|
i(e);
|
|
@@ -136,34 +136,34 @@ class H {
|
|
|
136
136
|
*/
|
|
137
137
|
hasListeners(t) {
|
|
138
138
|
var e;
|
|
139
|
-
return (((e = this.
|
|
139
|
+
return (((e = this._listeners.get(t)) == null ? void 0 : e.size) ?? 0) > 0;
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* Выполняет действие eventNames в рамках ответственности EventBus.
|
|
143
143
|
*/
|
|
144
144
|
eventNames() {
|
|
145
|
-
return [...this.
|
|
145
|
+
return [...this._listeners.entries()].filter(([, t]) => t.size > 0).map(([t]) => t);
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Очищает накопленное состояние EventBus.
|
|
149
149
|
*/
|
|
150
150
|
clear(t) {
|
|
151
151
|
var e;
|
|
152
|
-
t ? (e = this.
|
|
152
|
+
t ? (e = this._listeners.get(t)) == null || e.clear() : this._listeners.clear();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
class
|
|
155
|
+
const wt = new H(Object.keys({}));
|
|
156
|
+
class xt extends P {
|
|
157
157
|
/**
|
|
158
158
|
* Создает экземпляр Collection и подготавливает базовое состояние.
|
|
159
159
|
*/
|
|
160
160
|
constructor(e = []) {
|
|
161
161
|
super();
|
|
162
|
-
o(this, "
|
|
163
|
-
o(this, "
|
|
164
|
-
o(this, "
|
|
165
|
-
o(this, "
|
|
166
|
-
this.
|
|
162
|
+
o(this, "_items", []);
|
|
163
|
+
o(this, "_indices", /* @__PURE__ */ new Map());
|
|
164
|
+
o(this, "_rootIds", /* @__PURE__ */ new Set());
|
|
165
|
+
o(this, "_bus");
|
|
166
|
+
this._bus = new H(Object.values(m)), e.length && this.add(e), this._createIndex("id");
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* Выполняет действие add в рамках ответственности Collection.
|
|
@@ -171,10 +171,10 @@ class Dt extends P {
|
|
|
171
171
|
add(e) {
|
|
172
172
|
const n = Array.isArray(e) ? e : [e];
|
|
173
173
|
n.forEach((i) => {
|
|
174
|
-
this.
|
|
174
|
+
this._items.push(i), this._indices.forEach((s, a) => {
|
|
175
175
|
s.set(i[a], i);
|
|
176
|
-
}), i.parentId || this.
|
|
177
|
-
}), n != null && n.length && (this.
|
|
176
|
+
}), i.parentId || this._rootIds.add(i.id);
|
|
177
|
+
}), n != null && n.length && (this._bus.emit(m.Add, n), this.notify());
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
180
|
* Удаляет сущность из runtime-коллекции Collection.
|
|
@@ -182,14 +182,14 @@ class Dt extends P {
|
|
|
182
182
|
remove(e) {
|
|
183
183
|
const n = Array.isArray(e) ? e : [e], i = [];
|
|
184
184
|
n.forEach((s) => {
|
|
185
|
-
const a = typeof s == "string" ? s : s.id, l = this.
|
|
185
|
+
const a = typeof s == "string" ? s : s.id, l = this._items.findIndex((u) => u.id === a);
|
|
186
186
|
if (l !== -1) {
|
|
187
|
-
const [u] = this.
|
|
188
|
-
this.
|
|
187
|
+
const [u] = this._items.splice(l, 1);
|
|
188
|
+
this._indices.forEach((c, h) => {
|
|
189
189
|
c.delete(u[h]);
|
|
190
|
-
}), u.parentId || this.
|
|
190
|
+
}), u.parentId || this._rootIds.delete(u.id), i.push(u);
|
|
191
191
|
}
|
|
192
|
-
}), i.length && (this.
|
|
192
|
+
}), i.length && (this._bus.emit(m.Remove, i), this.notify());
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Обновляет runtime-состояние Collection.
|
|
@@ -198,87 +198,87 @@ class Dt extends P {
|
|
|
198
198
|
const n = Array.isArray(e) ? e : [e];
|
|
199
199
|
n.forEach((i) => {
|
|
200
200
|
const s = this.get(i.id);
|
|
201
|
-
s && (Object.assign(s, i), this.
|
|
201
|
+
s && (Object.assign(s, i), this._indices.forEach((a, l) => {
|
|
202
202
|
a.set(i[l], s);
|
|
203
203
|
}));
|
|
204
|
-
}), n != null && n.length && (this.
|
|
204
|
+
}), n != null && n.length && (this._bus.emit(m.Update, n), this.notify());
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* Возвращает значение состояния Collection.
|
|
208
208
|
*/
|
|
209
209
|
get(e) {
|
|
210
210
|
if (typeof e == "string")
|
|
211
|
-
return this.
|
|
211
|
+
return this._indices.get("id").get(e);
|
|
212
212
|
{
|
|
213
213
|
const [n, i] = Object.entries(e)[0];
|
|
214
|
-
return this.
|
|
214
|
+
return this._indices.has(n) || this._createIndex(n), this._indices.get(n).get(i);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* Создает runtime-сущность Collection.
|
|
219
219
|
*/
|
|
220
|
-
|
|
221
|
-
if (this.
|
|
220
|
+
_createIndex(e) {
|
|
221
|
+
if (this._indices.has(e))
|
|
222
222
|
return;
|
|
223
223
|
const n = /* @__PURE__ */ new Map();
|
|
224
|
-
this.
|
|
224
|
+
this._items.forEach((i) => {
|
|
225
225
|
n.set(i[e], i);
|
|
226
|
-
}), this.
|
|
226
|
+
}), this._indices.set(e, n), this._bus.emit(m.IndexCreate, e);
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Возвращает реактивный массив всех элементов.
|
|
230
230
|
*/
|
|
231
231
|
get all() {
|
|
232
|
-
return this.
|
|
232
|
+
return this._items;
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* Возвращает массив корневых элементов (без parentId).
|
|
236
236
|
*/
|
|
237
237
|
get allRoot() {
|
|
238
|
-
return Array.from(this.
|
|
238
|
+
return Array.from(this._rootIds).map((e) => this.get(e));
|
|
239
239
|
}
|
|
240
240
|
// Доступ к подпискам
|
|
241
241
|
/**
|
|
242
242
|
* Обрабатывает входящее событие Collection.
|
|
243
243
|
*/
|
|
244
244
|
on(e, n) {
|
|
245
|
-
this.
|
|
245
|
+
this._bus.on(e, n);
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* Выполняет действие off в рамках ответственности Collection.
|
|
249
249
|
*/
|
|
250
250
|
off(e, n) {
|
|
251
|
-
this.
|
|
251
|
+
this._bus.off(e, n);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
class
|
|
254
|
+
class Dt {
|
|
255
255
|
/**
|
|
256
256
|
* Создает экземпляр IndexedCollection и подготавливает базовое состояние.
|
|
257
257
|
*/
|
|
258
258
|
constructor(t = null) {
|
|
259
|
-
o(this, "
|
|
260
|
-
o(this, "
|
|
261
|
-
o(this, "
|
|
262
|
-
o(this, "
|
|
263
|
-
o(this, "
|
|
264
|
-
o(this, "
|
|
265
|
-
o(this, "
|
|
266
|
-
o(this, "
|
|
267
|
-
o(this, "
|
|
268
|
-
o(this, "
|
|
259
|
+
o(this, "_list", []);
|
|
260
|
+
o(this, "_filteredList", []);
|
|
261
|
+
o(this, "_map", /* @__PURE__ */ new Map());
|
|
262
|
+
o(this, "_indexById", /* @__PURE__ */ new Map());
|
|
263
|
+
o(this, "_dirtySort", !1);
|
|
264
|
+
o(this, "_dirtyFilter", !1);
|
|
265
|
+
o(this, "_sortFn");
|
|
266
|
+
o(this, "_filterFn");
|
|
267
|
+
o(this, "_indexEnabled", !1);
|
|
268
|
+
o(this, "_filterIndexEnabled", !1);
|
|
269
269
|
t && this.options(t);
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
272
272
|
* Выполняет действие options в рамках ответственности IndexedCollection.
|
|
273
273
|
*/
|
|
274
274
|
options(t) {
|
|
275
|
-
return Object.hasOwn(t, "sortFn") && (this.
|
|
275
|
+
return Object.hasOwn(t, "sortFn") && (this._sortFn = t.sortFn, this._dirtySort = !0), Object.hasOwn(t, "filterFn") && (this._filterFn = t.filterFn, this._dirtyFilter = !0), t.indexEnabled !== void 0 && (this._indexEnabled = t.indexEnabled, this._dirtySort = !0), t.filterIndexEnabled !== void 0 && (this._filterIndexEnabled = t.filterIndexEnabled, this._dirtyFilter = !0), this;
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Выполняет действие markDirty в рамках ответственности IndexedCollection.
|
|
279
279
|
*/
|
|
280
280
|
markDirty(t) {
|
|
281
|
-
t.sort && (this.
|
|
281
|
+
t.sort && (this._dirtySort = !0), t.filter && (this._dirtyFilter = !0);
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* Выполняет действие ensure в рамках ответственности IndexedCollection.
|
|
@@ -291,13 +291,13 @@ class Et {
|
|
|
291
291
|
* Выполняет действие ensureSorted в рамках ответственности IndexedCollection.
|
|
292
292
|
*/
|
|
293
293
|
ensureSorted() {
|
|
294
|
-
if (this.
|
|
295
|
-
this.
|
|
296
|
-
for (let t = 0; t < this.
|
|
297
|
-
const e = this.
|
|
298
|
-
this.
|
|
294
|
+
if (this._dirtySort) {
|
|
295
|
+
this._sortFn && this._list.sort(this._sortFn), this._indexById.clear();
|
|
296
|
+
for (let t = 0; t < this._list.length; t++) {
|
|
297
|
+
const e = this._list[t];
|
|
298
|
+
this._indexById.set(e.id, t), this._indexEnabled && (e.index = t);
|
|
299
299
|
}
|
|
300
|
-
this.
|
|
300
|
+
this._filterFn && (this._dirtyFilter = !0), this._dirtySort = !1;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
// Фильтр, если нужно
|
|
@@ -305,7 +305,7 @@ class Et {
|
|
|
305
305
|
* Выполняет действие ensureFiltered в рамках ответственности IndexedCollection.
|
|
306
306
|
*/
|
|
307
307
|
ensureFiltered() {
|
|
308
|
-
this.
|
|
308
|
+
this._dirtyFilter && (this._rebuildFilteredFromScratch(), this._dirtyFilter = !1);
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
311
311
|
* Выполняет действие add в рамках ответственности IndexedCollection.
|
|
@@ -313,12 +313,12 @@ class Et {
|
|
|
313
313
|
add(t) {
|
|
314
314
|
const e = Array.isArray(t) ? t : [t];
|
|
315
315
|
for (const n of e) {
|
|
316
|
-
if (this.
|
|
316
|
+
if (this._map.has(n.id))
|
|
317
317
|
continue;
|
|
318
|
-
const i = this.
|
|
319
|
-
this.
|
|
318
|
+
const i = this._list.length;
|
|
319
|
+
this._list.push(n), this._map.set(n.id, n), this._indexById.set(n.id, i), this._indexEnabled && (n.index = i), this._filterIndexEnabled && (n.filteredIndex = -1), this._addToFilteredIfPasses(n);
|
|
320
320
|
}
|
|
321
|
-
this.
|
|
321
|
+
this._sortFn && (this._dirtySort = !0);
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
324
|
* Удаляет сущность из runtime-коллекции IndexedCollection.
|
|
@@ -326,10 +326,10 @@ class Et {
|
|
|
326
326
|
remove(t) {
|
|
327
327
|
const e = Array.isArray(t) ? t : [t];
|
|
328
328
|
for (const n of e) {
|
|
329
|
-
const i = this.
|
|
330
|
-
i && (this.
|
|
329
|
+
const i = this._map.get(n);
|
|
330
|
+
i && (this._removeFromFilteredO1(i), this._removeFromListO1(n), this._map.delete(n), this._indexEnabled && (i.index = -1), this._filterIndexEnabled && (i.filteredIndex = -1));
|
|
331
331
|
}
|
|
332
|
-
this.
|
|
332
|
+
this._sortFn && (this._dirtySort = !0);
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
335
|
* Вызывать после изменения полей элемента
|
|
@@ -337,15 +337,15 @@ class Et {
|
|
|
337
337
|
* mayAffectSort если изменились поля сортировки
|
|
338
338
|
*/
|
|
339
339
|
touch(t, e = {}) {
|
|
340
|
-
const n = this.
|
|
341
|
-
n && (e.mayAffectFilter !== !1 && (this.
|
|
340
|
+
const n = this._map.get(t);
|
|
341
|
+
n && (e.mayAffectFilter !== !1 && (this._refilterOneO1(n), !this._filterIndexEnabled && this._filterFn && (this._dirtyFilter = !0)), e.mayAffectSort !== !1 && this._sortFn && (this._dirtySort = !0));
|
|
342
342
|
}
|
|
343
343
|
/**
|
|
344
344
|
* Выполняет действие forEach в рамках ответственности IndexedCollection.
|
|
345
345
|
*/
|
|
346
346
|
forEach(t) {
|
|
347
347
|
this.ensure();
|
|
348
|
-
const e = this.
|
|
348
|
+
const e = this._filterFn ? this._filteredList : this._list;
|
|
349
349
|
for (let n = 0; n < e.length; n++)
|
|
350
350
|
t(e[n], n);
|
|
351
351
|
}
|
|
@@ -359,14 +359,14 @@ class Et {
|
|
|
359
359
|
* Отсортированный полный список (без фильтра), если есть sortFn.
|
|
360
360
|
*/
|
|
361
361
|
unfiltered() {
|
|
362
|
-
return this.ensureSorted(), this.
|
|
362
|
+
return this.ensureSorted(), this._list;
|
|
363
363
|
}
|
|
364
364
|
/**
|
|
365
365
|
* Отсортированный и отфильтрованный список (если есть filterFn).
|
|
366
366
|
* Если filterFn нет — возвращается list.
|
|
367
367
|
*/
|
|
368
368
|
filtered() {
|
|
369
|
-
return this.ensure(), this.
|
|
369
|
+
return this.ensure(), this._filterFn ? this._filteredList : this._list;
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
372
372
|
* Выполняет действие pos в рамках ответственности IndexedCollection.
|
|
@@ -393,13 +393,13 @@ class Et {
|
|
|
393
393
|
* Выполняет действие has в рамках ответственности IndexedCollection.
|
|
394
394
|
*/
|
|
395
395
|
has(t) {
|
|
396
|
-
return this.
|
|
396
|
+
return this._map.has(t);
|
|
397
397
|
}
|
|
398
398
|
/**
|
|
399
399
|
* Возвращает значение состояния IndexedCollection.
|
|
400
400
|
*/
|
|
401
401
|
get(t) {
|
|
402
|
-
return this.
|
|
402
|
+
return this._map.get(t);
|
|
403
403
|
}
|
|
404
404
|
/**
|
|
405
405
|
* Выполняет действие size в рамках ответственности IndexedCollection.
|
|
@@ -411,81 +411,81 @@ class Et {
|
|
|
411
411
|
* Очищает накопленное состояние IndexedCollection.
|
|
412
412
|
*/
|
|
413
413
|
clear() {
|
|
414
|
-
this.
|
|
414
|
+
this._list = [], this._filteredList = [], this._map.clear(), this._indexById.clear(), this._dirtySort = !1, this._dirtyFilter = !1;
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* Выполняет внутренний шаг rebuildFilteredFromScratch для IndexedCollection.
|
|
418
418
|
*/
|
|
419
|
-
|
|
420
|
-
if (!this.
|
|
421
|
-
if (this.
|
|
422
|
-
for (const t of this.
|
|
419
|
+
_rebuildFilteredFromScratch() {
|
|
420
|
+
if (!this._filterFn) {
|
|
421
|
+
if (this._filteredList = [], this._filterIndexEnabled)
|
|
422
|
+
for (const t of this._list)
|
|
423
423
|
t.filteredIndex = -1;
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
|
-
if (this.
|
|
427
|
-
for (const t of this.
|
|
426
|
+
if (this._filteredList = [], this._filterIndexEnabled)
|
|
427
|
+
for (const t of this._list)
|
|
428
428
|
t.filteredIndex = -1;
|
|
429
|
-
for (const t of this.
|
|
430
|
-
this.
|
|
429
|
+
for (const t of this._list)
|
|
430
|
+
this._filterFn(t) && this._appendToFiltered(t);
|
|
431
431
|
}
|
|
432
432
|
/**
|
|
433
433
|
* Выполняет внутренний шаг addToFilteredIfPasses для IndexedCollection.
|
|
434
434
|
*/
|
|
435
|
-
|
|
436
|
-
if (this.
|
|
437
|
-
if (!this.
|
|
438
|
-
this.
|
|
435
|
+
_addToFilteredIfPasses(t) {
|
|
436
|
+
if (this._filterFn) {
|
|
437
|
+
if (!this._filterIndexEnabled) {
|
|
438
|
+
this._dirtyFilter = !0;
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
(t.filteredIndex ?? -1) >= 0 || this.
|
|
441
|
+
(t.filteredIndex ?? -1) >= 0 || this._filterFn(t) && this._appendToFiltered(t);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
/**
|
|
445
445
|
* Добавляет сущность в runtime-коллекцию IndexedCollection.
|
|
446
446
|
*/
|
|
447
|
-
|
|
448
|
-
const e = this.
|
|
449
|
-
this.
|
|
447
|
+
_appendToFiltered(t) {
|
|
448
|
+
const e = this._filteredList.length;
|
|
449
|
+
this._filteredList.push(t), this._filterIndexEnabled && (t.filteredIndex = e);
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
452
|
* Выполняет внутренний шаг refilterOneO1 для IndexedCollection.
|
|
453
453
|
*/
|
|
454
|
-
|
|
455
|
-
if (!this.
|
|
454
|
+
_refilterOneO1(t) {
|
|
455
|
+
if (!this._filterFn || !this._filterIndexEnabled)
|
|
456
456
|
return !1;
|
|
457
|
-
const e = this.
|
|
458
|
-
return e ? i ? !1 : (this.
|
|
457
|
+
const e = this._filterFn(t), i = (t.filteredIndex ?? -1) >= 0;
|
|
458
|
+
return e ? i ? !1 : (this._appendToFiltered(t), !0) : i ? (this._removeFromFilteredO1(t), !0) : !1;
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
461
|
* Удаляет сущность из runtime-коллекции IndexedCollection.
|
|
462
462
|
*/
|
|
463
|
-
|
|
464
|
-
if (!this.
|
|
463
|
+
_removeFromFilteredO1(t) {
|
|
464
|
+
if (!this._filterIndexEnabled)
|
|
465
465
|
return;
|
|
466
466
|
const e = t.filteredIndex ?? -1;
|
|
467
467
|
if (e < 0)
|
|
468
468
|
return;
|
|
469
|
-
const n = this.
|
|
469
|
+
const n = this._filteredList.length - 1;
|
|
470
470
|
if (e !== n) {
|
|
471
|
-
const i = this.
|
|
472
|
-
this.
|
|
471
|
+
const i = this._filteredList[n];
|
|
472
|
+
this._filteredList[e] = i, i.filteredIndex = e;
|
|
473
473
|
}
|
|
474
|
-
this.
|
|
474
|
+
this._filteredList.pop(), t.filteredIndex = -1;
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
477
|
* Удаляет сущность из runtime-коллекции IndexedCollection.
|
|
478
478
|
*/
|
|
479
|
-
|
|
480
|
-
const e = this.
|
|
479
|
+
_removeFromListO1(t) {
|
|
480
|
+
const e = this._indexById.get(t);
|
|
481
481
|
if (e === void 0)
|
|
482
482
|
return;
|
|
483
|
-
const n = this.
|
|
483
|
+
const n = this._list.length - 1;
|
|
484
484
|
if (e !== n) {
|
|
485
|
-
const i = this.
|
|
486
|
-
this.
|
|
485
|
+
const i = this._list[n];
|
|
486
|
+
this._list[e] = i, this._indexById.set(i.id, e), this._indexEnabled && (i.index = e);
|
|
487
487
|
}
|
|
488
|
-
this.
|
|
488
|
+
this._list.pop(), this._indexById.delete(t);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
class It {
|
|
@@ -494,7 +494,7 @@ class It {
|
|
|
494
494
|
o(this, "_buf");
|
|
495
495
|
o(this, "_head", 0);
|
|
496
496
|
o(this, "_len", 0);
|
|
497
|
-
this._cap = Math.max(0, t | 0), this._buf =
|
|
497
|
+
this._cap = Math.max(0, t | 0), this._buf = Array.from({ length: this._cap });
|
|
498
498
|
}
|
|
499
499
|
get capacity() {
|
|
500
500
|
return this._cap;
|
|
@@ -511,7 +511,7 @@ class It {
|
|
|
511
511
|
toArray() {
|
|
512
512
|
if (this._len === 0 || this._cap <= 0)
|
|
513
513
|
return [];
|
|
514
|
-
const t =
|
|
514
|
+
const t = Array.from({ length: this._len }), e = (this._head - this._len + this._cap) % this._cap;
|
|
515
515
|
for (let n = 0; n < this._len; n += 1) {
|
|
516
516
|
const i = (e + n) % this._cap;
|
|
517
517
|
t[n] = this._buf[i];
|
|
@@ -519,31 +519,31 @@ class It {
|
|
|
519
519
|
return t;
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
class
|
|
522
|
+
class Et {
|
|
523
523
|
constructor(t) {
|
|
524
|
-
o(this, "
|
|
525
|
-
this.
|
|
524
|
+
o(this, "_baseUrl");
|
|
525
|
+
this._baseUrl = t.baseUrl.replace(/\/+$/, "");
|
|
526
526
|
}
|
|
527
|
-
|
|
527
|
+
_buildUrl(t, e) {
|
|
528
528
|
const n = new URL(
|
|
529
529
|
t.replace(/^\//, ""),
|
|
530
|
-
this.
|
|
530
|
+
this._baseUrl.endsWith("/") ? this._baseUrl : `${this._baseUrl}/`
|
|
531
531
|
);
|
|
532
532
|
if (e)
|
|
533
533
|
for (const [i, s] of Object.entries(e))
|
|
534
534
|
s != null && n.searchParams.set(i, String(s));
|
|
535
535
|
return n.toString();
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
_buildHeaders(t) {
|
|
538
538
|
return {
|
|
539
539
|
"Content-Type": "application/json",
|
|
540
540
|
...t || {}
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
543
|
async get(t, e, n) {
|
|
544
|
-
const i = await fetch(this.
|
|
544
|
+
const i = await fetch(this._buildUrl(t, e), {
|
|
545
545
|
method: "GET",
|
|
546
|
-
headers: this.
|
|
546
|
+
headers: this._buildHeaders(n),
|
|
547
547
|
credentials: "include"
|
|
548
548
|
});
|
|
549
549
|
if (!i.ok) {
|
|
@@ -553,9 +553,9 @@ class At {
|
|
|
553
553
|
return await i.json();
|
|
554
554
|
}
|
|
555
555
|
async post(t, e, n) {
|
|
556
|
-
const i = await fetch(this.
|
|
556
|
+
const i = await fetch(this._buildUrl(t), {
|
|
557
557
|
method: "POST",
|
|
558
|
-
headers: this.
|
|
558
|
+
headers: this._buildHeaders(n),
|
|
559
559
|
credentials: "include",
|
|
560
560
|
body: e !== void 0 ? JSON.stringify(e) : void 0
|
|
561
561
|
});
|
|
@@ -566,9 +566,9 @@ class At {
|
|
|
566
566
|
return await i.json();
|
|
567
567
|
}
|
|
568
568
|
async patch(t, e, n) {
|
|
569
|
-
const i = await fetch(this.
|
|
569
|
+
const i = await fetch(this._buildUrl(t), {
|
|
570
570
|
method: "PATCH",
|
|
571
|
-
headers: this.
|
|
571
|
+
headers: this._buildHeaders(n),
|
|
572
572
|
credentials: "include",
|
|
573
573
|
body: e !== void 0 ? JSON.stringify(e) : void 0
|
|
574
574
|
});
|
|
@@ -579,9 +579,9 @@ class At {
|
|
|
579
579
|
return await i.json();
|
|
580
580
|
}
|
|
581
581
|
async delete(t, e) {
|
|
582
|
-
const n = await fetch(this.
|
|
582
|
+
const n = await fetch(this._buildUrl(t), {
|
|
583
583
|
method: "DELETE",
|
|
584
|
-
headers: this.
|
|
584
|
+
headers: this._buildHeaders(e),
|
|
585
585
|
credentials: "include"
|
|
586
586
|
});
|
|
587
587
|
if (!n.ok) {
|
|
@@ -591,44 +591,44 @@ class At {
|
|
|
591
591
|
return await n.json().catch(() => ({}));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
class
|
|
594
|
+
class At {
|
|
595
595
|
/**
|
|
596
596
|
* Создает экземпляр DelayedExecutor и подготавливает базовое состояние.
|
|
597
597
|
*/
|
|
598
598
|
constructor(t, e = !1) {
|
|
599
|
-
o(this, "
|
|
600
|
-
o(this, "
|
|
601
|
-
o(this, "
|
|
602
|
-
o(this, "
|
|
603
|
-
this.
|
|
599
|
+
o(this, "_delayTimer", null);
|
|
600
|
+
o(this, "_maxTimer", null);
|
|
601
|
+
o(this, "_hasExecutedOnce", !1);
|
|
602
|
+
o(this, "_lastArgs", null);
|
|
603
|
+
this._fn = t, this._firstExecuteImmediately = e;
|
|
604
604
|
}
|
|
605
605
|
/**
|
|
606
606
|
* Выполняет действие run в рамках ответственности DelayedExecutor.
|
|
607
607
|
*/
|
|
608
608
|
run(t, e = 500, n = 2e3) {
|
|
609
|
-
if (this.
|
|
610
|
-
this.
|
|
609
|
+
if (this._lastArgs = t, this._firstExecuteImmediately && !this._hasExecutedOnce) {
|
|
610
|
+
this._hasExecutedOnce = !0, this.flush();
|
|
611
611
|
return;
|
|
612
612
|
}
|
|
613
|
-
this.
|
|
613
|
+
this._delayTimer && clearTimeout(this._delayTimer), this._delayTimer = setTimeout(() => this.flush(), e), this._maxTimer || (this._maxTimer = setTimeout(() => this.flush(), n));
|
|
614
614
|
}
|
|
615
615
|
/**
|
|
616
616
|
* Принудительно завершает накопленные изменения DelayedExecutor.
|
|
617
617
|
*/
|
|
618
618
|
flush() {
|
|
619
|
-
this.
|
|
619
|
+
this._clear(), this._lastArgs && this._fn(...this._lastArgs);
|
|
620
620
|
}
|
|
621
621
|
/**
|
|
622
622
|
* Выполняет действие cancel в рамках ответственности DelayedExecutor.
|
|
623
623
|
*/
|
|
624
624
|
cancel() {
|
|
625
|
-
this.
|
|
625
|
+
this._clear();
|
|
626
626
|
}
|
|
627
627
|
/**
|
|
628
628
|
* Очищает накопленное состояние DelayedExecutor.
|
|
629
629
|
*/
|
|
630
|
-
|
|
631
|
-
this.
|
|
630
|
+
_clear() {
|
|
631
|
+
this._delayTimer && clearTimeout(this._delayTimer), this._maxTimer && clearTimeout(this._maxTimer), this._delayTimer = null, this._maxTimer = null;
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
634
|
function x(r) {
|
|
@@ -638,68 +638,68 @@ function x(r) {
|
|
|
638
638
|
function U(r) {
|
|
639
639
|
return r instanceof Error ? `${r.name}: ${r.message}` : x(r);
|
|
640
640
|
}
|
|
641
|
-
class
|
|
641
|
+
class Ot {
|
|
642
642
|
/**
|
|
643
643
|
* Создает экземпляр NamedExecutor и подготавливает базовое состояние.
|
|
644
644
|
*/
|
|
645
645
|
constructor(t) {
|
|
646
|
-
o(this, "
|
|
647
|
-
o(this, "
|
|
648
|
-
o(this, "
|
|
649
|
-
o(this, "
|
|
650
|
-
this.
|
|
646
|
+
o(this, "_delayTimers", /* @__PURE__ */ new Map());
|
|
647
|
+
o(this, "_maxTimers", /* @__PURE__ */ new Map());
|
|
648
|
+
o(this, "_callbacks", /* @__PURE__ */ new Map());
|
|
649
|
+
o(this, "_firstCallTime", /* @__PURE__ */ new Map());
|
|
650
|
+
this._config = t;
|
|
651
651
|
}
|
|
652
652
|
/**
|
|
653
653
|
* Выполняет действие run в рамках ответственности NamedExecutor.
|
|
654
654
|
*/
|
|
655
655
|
run(t, e) {
|
|
656
656
|
const n = Date.now();
|
|
657
|
-
if (!this.
|
|
658
|
-
this.
|
|
657
|
+
if (!this._firstCallTime.has(t)) {
|
|
658
|
+
this._firstCallTime.set(t, n);
|
|
659
659
|
const s = setTimeout(() => {
|
|
660
660
|
this.flush(t);
|
|
661
|
-
}, this.
|
|
662
|
-
this.
|
|
661
|
+
}, this._config.maxMs);
|
|
662
|
+
this._maxTimers.set(t, s);
|
|
663
663
|
}
|
|
664
|
-
this.
|
|
664
|
+
this._callbacks.set(t, e), clearTimeout(this._delayTimers.get(t));
|
|
665
665
|
const i = setTimeout(() => {
|
|
666
666
|
this.flush(t);
|
|
667
|
-
}, this.
|
|
668
|
-
this.
|
|
667
|
+
}, this._config.delayMs);
|
|
668
|
+
this._delayTimers.set(t, i);
|
|
669
669
|
}
|
|
670
670
|
/**
|
|
671
671
|
* Принудительно завершает накопленные изменения NamedExecutor.
|
|
672
672
|
*/
|
|
673
673
|
flush(t) {
|
|
674
674
|
try {
|
|
675
|
-
const e = this.
|
|
675
|
+
const e = this._callbacks.get(t);
|
|
676
676
|
e && e();
|
|
677
677
|
} catch (e) {
|
|
678
678
|
console.error(`[NamedExecutor] flush error: ${U(e)}`);
|
|
679
679
|
}
|
|
680
|
-
this.
|
|
680
|
+
this._clear(t);
|
|
681
681
|
}
|
|
682
682
|
/**
|
|
683
683
|
* Выполняет действие cancel в рамках ответственности NamedExecutor.
|
|
684
684
|
*/
|
|
685
685
|
cancel(t) {
|
|
686
|
-
this.
|
|
686
|
+
this._clear(t);
|
|
687
687
|
}
|
|
688
688
|
/**
|
|
689
689
|
* Принудительно завершает накопленные изменения NamedExecutor.
|
|
690
690
|
*/
|
|
691
691
|
flushAll() {
|
|
692
|
-
for (const t of this.
|
|
692
|
+
for (const t of this._callbacks.keys())
|
|
693
693
|
this.flush(t);
|
|
694
694
|
}
|
|
695
695
|
/**
|
|
696
696
|
* Очищает накопленное состояние NamedExecutor.
|
|
697
697
|
*/
|
|
698
|
-
|
|
699
|
-
clearTimeout(this.
|
|
698
|
+
_clear(t) {
|
|
699
|
+
clearTimeout(this._delayTimers.get(t)), clearTimeout(this._maxTimers.get(t)), this._delayTimers.delete(t), this._maxTimers.delete(t), this._callbacks.delete(t), this._firstCallTime.delete(t);
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function Ct() {
|
|
703
703
|
return function(r, t) {
|
|
704
704
|
f(
|
|
705
705
|
({ value: e }) => {
|
|
@@ -724,7 +724,7 @@ function Mt() {
|
|
|
724
724
|
)(r, t);
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function Mt() {
|
|
728
728
|
return function(r, t) {
|
|
729
729
|
f(
|
|
730
730
|
({ value: e }) => {
|
|
@@ -756,7 +756,7 @@ function $t() {
|
|
|
756
756
|
};
|
|
757
757
|
}
|
|
758
758
|
const R = Symbol("onDeserialized");
|
|
759
|
-
function
|
|
759
|
+
function $t() {
|
|
760
760
|
return function(r, t) {
|
|
761
761
|
Reflect.defineMetadata(R, t, r);
|
|
762
762
|
};
|
|
@@ -768,7 +768,7 @@ function rt(r) {
|
|
|
768
768
|
);
|
|
769
769
|
return t ? r[t].bind(r) : null;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Ft() {
|
|
772
772
|
return function(r, t) {
|
|
773
773
|
f(
|
|
774
774
|
({ value: e }) => typeof e == "string" ? e.trim() : String(e ?? ""),
|
|
@@ -779,46 +779,59 @@ function kt() {
|
|
|
779
779
|
)(r, t);
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
|
-
function
|
|
783
|
-
return f(({ value: e, type: n }) =>
|
|
784
|
-
e
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
782
|
+
function kt(r, t) {
|
|
783
|
+
return f(({ value: e, type: n }) => {
|
|
784
|
+
if (!e)
|
|
785
|
+
return /* @__PURE__ */ new Map();
|
|
786
|
+
if (n === _.PLAIN_TO_CLASS) {
|
|
787
|
+
if (Array.isArray(e))
|
|
788
|
+
return t ? new Map(
|
|
789
|
+
e.map((i) => {
|
|
790
|
+
const s = T(r, i);
|
|
791
|
+
return [s[t], s];
|
|
792
|
+
})
|
|
793
|
+
) : (console.warn(
|
|
794
|
+
"[TypeMap] Key field is required for array transformation!"
|
|
795
|
+
), /* @__PURE__ */ new Map());
|
|
796
|
+
if (typeof e == "object") {
|
|
797
|
+
const i = r;
|
|
798
|
+
return new Map(
|
|
799
|
+
Object.entries(e).map(([s, a]) => {
|
|
800
|
+
const l = new i();
|
|
801
|
+
return Object.assign(l, a), [s, l];
|
|
802
|
+
})
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
return console.warn(`[TypeMap] Expected object or array, got ${x(e)}`), /* @__PURE__ */ new Map();
|
|
806
|
+
}
|
|
807
|
+
return n === _.CLASS_TO_PLAIN ? e instanceof Map ? Array.from(e.values()).map((i) => S(i)) : (console.warn(`[TypeMap] Expected Map, got ${x(e)}`), t ? [] : {}) : (console.warn(`[TypeMap] Unexpected transformation type: ${String(n)}`), e);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
function Lt(r) {
|
|
798
811
|
return f(({ value: t, type: e }) => {
|
|
799
812
|
if (!t || typeof t != "object")
|
|
800
813
|
return {};
|
|
801
|
-
if (e ===
|
|
814
|
+
if (e === _.PLAIN_TO_CLASS) {
|
|
802
815
|
const n = {};
|
|
803
816
|
for (const i of Object.keys(t))
|
|
804
|
-
n[i] =
|
|
817
|
+
n[i] = T(r, t[i]);
|
|
805
818
|
return n;
|
|
806
819
|
}
|
|
807
|
-
if (e ===
|
|
820
|
+
if (e === _.CLASS_TO_PLAIN) {
|
|
808
821
|
const n = {};
|
|
809
822
|
for (const i of Object.keys(t))
|
|
810
|
-
n[i] =
|
|
823
|
+
n[i] = S(t[i]);
|
|
811
824
|
return n;
|
|
812
825
|
}
|
|
813
826
|
return t;
|
|
814
827
|
});
|
|
815
828
|
}
|
|
816
|
-
class
|
|
829
|
+
class Nt {
|
|
817
830
|
/**
|
|
818
831
|
* Выполняет действие toPlain в рамках ответственности Serialize.
|
|
819
832
|
*/
|
|
820
833
|
static toPlain(t) {
|
|
821
|
-
return
|
|
834
|
+
return S(t, {
|
|
822
835
|
exposeDefaultValues: !0,
|
|
823
836
|
excludeExtraneousValues: !0
|
|
824
837
|
});
|
|
@@ -827,71 +840,67 @@ class zt {
|
|
|
827
840
|
* Выполняет действие fromJSON в рамках ответственности Serialize.
|
|
828
841
|
*/
|
|
829
842
|
static fromJSON(t, e) {
|
|
830
|
-
const n =
|
|
843
|
+
const n = T(t, e, {
|
|
831
844
|
exposeDefaultValues: !0,
|
|
832
845
|
excludeExtraneousValues: !0
|
|
833
846
|
}), i = rt(n);
|
|
834
847
|
return i && i(), n;
|
|
835
848
|
}
|
|
836
849
|
}
|
|
837
|
-
function
|
|
850
|
+
function zt(r) {
|
|
838
851
|
return function(t, e) {
|
|
839
852
|
J(r)(t, e), Reflect.defineMetadata("genericExpose", r.name, t, e);
|
|
840
853
|
};
|
|
841
854
|
}
|
|
842
855
|
const nt = Symbol("beforeSerialize");
|
|
843
|
-
function
|
|
856
|
+
function Pt() {
|
|
844
857
|
return function(r, t, e) {
|
|
845
858
|
Reflect.defineMetadata(nt, t, r);
|
|
846
859
|
};
|
|
847
860
|
}
|
|
848
|
-
function
|
|
861
|
+
function Ht(r, t, e) {
|
|
849
862
|
r.__afterDeserializeMethods__ || (r.__afterDeserializeMethods__ = []), r.__afterDeserializeMethods__.push(t);
|
|
850
863
|
}
|
|
851
|
-
function
|
|
864
|
+
function Ut(r) {
|
|
852
865
|
return function(t, e) {
|
|
853
866
|
f(({ value: n }) => n === null ? void 0 : n, { toPlainOnly: !0 })(t, e), Z(r)(t, e);
|
|
854
867
|
};
|
|
855
868
|
}
|
|
856
|
-
function
|
|
857
|
-
return f(({ value: r, type: t }) => t ===
|
|
869
|
+
function Rt() {
|
|
870
|
+
return f(({ value: r, type: t }) => t === _.PLAIN_TO_CLASS ? r == null ? void 0 : r.id : r);
|
|
871
|
+
}
|
|
872
|
+
function Kt(r) {
|
|
873
|
+
return f(({ value: t, type: e }) => e === _.PLAIN_TO_CLASS ? t == null ? void 0 : t.map((n) => n == null ? void 0 : n[r]) : t);
|
|
858
874
|
}
|
|
859
|
-
function jt(
|
|
860
|
-
return f(({ value:
|
|
875
|
+
function jt() {
|
|
876
|
+
return f(({ value: r, type: t }) => t === _.CLASS_TO_PLAIN && (r == null ? void 0 : r.id) || r);
|
|
861
877
|
}
|
|
862
878
|
function Bt() {
|
|
863
|
-
return f(({ value: r, type: t }) => t ===
|
|
879
|
+
return f(({ value: r, type: t }) => t === _.CLASS_TO_PLAIN ? r.map((e) => e.id) : r);
|
|
864
880
|
}
|
|
865
881
|
function Vt() {
|
|
866
|
-
return f(({ value: r, type: t }) => t === m.CLASS_TO_PLAIN ? r.map((e) => e.id) : r);
|
|
867
|
-
}
|
|
868
|
-
function Gt() {
|
|
869
882
|
return f(({ value: r, type: t }) => t === "classToPlain" ? void 0 : r, { toPlainOnly: !0 });
|
|
870
883
|
}
|
|
871
|
-
function
|
|
872
|
-
return
|
|
884
|
+
function Gt(r, t) {
|
|
885
|
+
return T(r, t, {
|
|
873
886
|
exposeDefaultValues: !0,
|
|
874
887
|
excludeExtraneousValues: !0
|
|
875
888
|
});
|
|
876
889
|
}
|
|
877
|
-
function
|
|
878
|
-
return
|
|
890
|
+
function Jt(r) {
|
|
891
|
+
return S(r, {
|
|
879
892
|
exposeUnsetFields: !1
|
|
880
893
|
});
|
|
881
894
|
}
|
|
882
|
-
function
|
|
895
|
+
function Zt(r) {
|
|
883
896
|
return r == null;
|
|
884
897
|
}
|
|
885
|
-
function
|
|
898
|
+
function Wt(r, t) {
|
|
886
899
|
return r < t ? -1 : r > t ? 1 : 0;
|
|
887
900
|
}
|
|
888
|
-
const
|
|
901
|
+
const Yt = !1;
|
|
889
902
|
function qt(r, t) {
|
|
890
|
-
|
|
891
|
-
return t();
|
|
892
|
-
console.groupCollapsed(`⏳ ${r}`);
|
|
893
|
-
const e = performance.now(), n = t(), i = performance.now();
|
|
894
|
-
return console.log(`${r}: ${Math.round(i - e)} ms`), console.groupEnd(), n;
|
|
903
|
+
return t();
|
|
895
904
|
}
|
|
896
905
|
const Qt = () => W(), M = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
897
906
|
function Xt(r) {
|
|
@@ -905,33 +914,33 @@ class vt {
|
|
|
905
914
|
* Создает экземпляр HotkeyManager и подготавливает базовое состояние.
|
|
906
915
|
*/
|
|
907
916
|
constructor(t = {}) {
|
|
908
|
-
o(this, "
|
|
909
|
-
o(this, "
|
|
910
|
-
o(this, "
|
|
911
|
-
o(this, "
|
|
912
|
-
o(this, "
|
|
913
|
-
this.
|
|
917
|
+
o(this, "_bindings", /* @__PURE__ */ new Map());
|
|
918
|
+
o(this, "_enabled", !0);
|
|
919
|
+
o(this, "_target");
|
|
920
|
+
o(this, "_ignoreInput");
|
|
921
|
+
o(this, "_handleBound");
|
|
922
|
+
this._target = t.target || window, this._ignoreInput = t.ignoreInput ?? !1, this._handleBound = this._handle.bind(this), this._target.addEventListener("keydown", this._handleBound);
|
|
914
923
|
}
|
|
915
924
|
/**
|
|
916
925
|
* Выполняет внутренний шаг isIgnoredTarget для HotkeyManager.
|
|
917
926
|
*/
|
|
918
|
-
|
|
919
|
-
return this.
|
|
927
|
+
_isIgnoredTarget(t) {
|
|
928
|
+
return this._ignoreInput ? t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable : !1;
|
|
920
929
|
}
|
|
921
930
|
/**
|
|
922
931
|
* Нормализует входные данные HotkeyManager.
|
|
923
932
|
*/
|
|
924
|
-
|
|
933
|
+
_normalizeKey(t) {
|
|
925
934
|
const e = [];
|
|
926
935
|
return t.ctrlKey && e.push("ctrl"), t.metaKey && e.push("meta"), t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), e.push(t.key.toLowerCase()), e.join("+");
|
|
927
936
|
}
|
|
928
937
|
/**
|
|
929
938
|
* Обрабатывает runtime-событие HotkeyManager.
|
|
930
939
|
*/
|
|
931
|
-
|
|
932
|
-
if (!this.
|
|
940
|
+
_handle(t) {
|
|
941
|
+
if (!this._enabled || this._isIgnoredTarget(t.target))
|
|
933
942
|
return;
|
|
934
|
-
const e = this.
|
|
943
|
+
const e = this._normalizeKey(t), n = this._bindings.get(e);
|
|
935
944
|
if (n)
|
|
936
945
|
for (const i of n)
|
|
937
946
|
i(t);
|
|
@@ -943,7 +952,7 @@ class vt {
|
|
|
943
952
|
const n = Array.isArray(t) ? t : [t];
|
|
944
953
|
for (const i of n) {
|
|
945
954
|
const s = i.toLowerCase();
|
|
946
|
-
this.
|
|
955
|
+
this._bindings.has(s) || this._bindings.set(s, /* @__PURE__ */ new Set()), this._bindings.get(s).add(e);
|
|
947
956
|
}
|
|
948
957
|
}
|
|
949
958
|
/**
|
|
@@ -954,32 +963,32 @@ class vt {
|
|
|
954
963
|
const n = Array.isArray(t) ? t : [t];
|
|
955
964
|
for (const s of n) {
|
|
956
965
|
const a = s.toLowerCase();
|
|
957
|
-
(i = this.
|
|
966
|
+
(i = this._bindings.get(a)) == null || i.delete(e);
|
|
958
967
|
}
|
|
959
968
|
}
|
|
960
969
|
/**
|
|
961
970
|
* Очищает накопленное состояние HotkeyManager.
|
|
962
971
|
*/
|
|
963
972
|
clear(t) {
|
|
964
|
-
t ? this.
|
|
973
|
+
t ? this._bindings.delete(t.toLowerCase()) : this._bindings.clear();
|
|
965
974
|
}
|
|
966
975
|
/**
|
|
967
976
|
* Выполняет действие enable в рамках ответственности HotkeyManager.
|
|
968
977
|
*/
|
|
969
978
|
enable() {
|
|
970
|
-
this.
|
|
979
|
+
this._enabled = !0;
|
|
971
980
|
}
|
|
972
981
|
/**
|
|
973
982
|
* Выполняет действие disable в рамках ответственности HotkeyManager.
|
|
974
983
|
*/
|
|
975
984
|
disable() {
|
|
976
|
-
this.
|
|
985
|
+
this._enabled = !1;
|
|
977
986
|
}
|
|
978
987
|
/**
|
|
979
988
|
* Освобождает runtime-ресурсы и подписки HotkeyManager.
|
|
980
989
|
*/
|
|
981
990
|
destroy() {
|
|
982
|
-
this.clear(), this.
|
|
991
|
+
this.clear(), this._target.removeEventListener("keydown", this._handleBound);
|
|
983
992
|
}
|
|
984
993
|
}
|
|
985
994
|
function te(r, t) {
|
|
@@ -989,7 +998,7 @@ function te(r, t) {
|
|
|
989
998
|
return n && i && s && a && l;
|
|
990
999
|
}) : !1;
|
|
991
1000
|
}
|
|
992
|
-
const $ = /* @__PURE__ */ new WeakMap(),
|
|
1001
|
+
const $ = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new Set([
|
|
993
1002
|
"Alt",
|
|
994
1003
|
"AltGraph",
|
|
995
1004
|
"CapsLock",
|
|
@@ -1007,18 +1016,18 @@ const $ = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new Set([
|
|
|
1007
1016
|
"SymbolLock"
|
|
1008
1017
|
]);
|
|
1009
1018
|
function ee(r) {
|
|
1010
|
-
return
|
|
1019
|
+
return E(K(r).snapshot);
|
|
1011
1020
|
}
|
|
1012
1021
|
function re(r, t) {
|
|
1013
1022
|
const e = K(r);
|
|
1014
|
-
return e.subscribers.add(t), t(
|
|
1023
|
+
return e.subscribers.add(t), t(E(e.snapshot)), () => e.subscribers.delete(t);
|
|
1015
1024
|
}
|
|
1016
1025
|
function K(r) {
|
|
1017
1026
|
var a, l, u;
|
|
1018
1027
|
const t = $.get(r);
|
|
1019
1028
|
if (t)
|
|
1020
1029
|
return t;
|
|
1021
|
-
const e =
|
|
1030
|
+
const e = st((a = r.defaultView) == null ? void 0 : a.navigator), n = {
|
|
1022
1031
|
snapshot: F(e),
|
|
1023
1032
|
entries: /* @__PURE__ */ new Map(),
|
|
1024
1033
|
subscribers: /* @__PURE__ */ new Set()
|
|
@@ -1031,24 +1040,24 @@ function K(r) {
|
|
|
1031
1040
|
meta: c.metaKey,
|
|
1032
1041
|
mod: e === "macos" ? c.metaKey : e === "windows" || e === "linux" ? c.ctrlKey : c.ctrlKey || c.metaKey,
|
|
1033
1042
|
altGraph: ((C = c.getModifierState) == null ? void 0 : C.call(c, "AltGraph")) === !0
|
|
1034
|
-
} : F(e).modifiers, O = [...n.entries.values()],
|
|
1043
|
+
} : F(e).modifiers, O = [...n.entries.values()], b = {
|
|
1035
1044
|
platform: e,
|
|
1036
1045
|
modifiers: h,
|
|
1037
1046
|
held: {
|
|
1038
|
-
key: [...new Set(O.map((
|
|
1039
|
-
code: [...new Set(O.map((
|
|
1047
|
+
key: [...new Set(O.map((y) => y.key))].sort(),
|
|
1048
|
+
code: [...new Set(O.map((y) => y.code).filter(Boolean))].sort()
|
|
1040
1049
|
}
|
|
1041
1050
|
};
|
|
1042
|
-
if (!
|
|
1043
|
-
n.snapshot =
|
|
1044
|
-
for (const
|
|
1045
|
-
|
|
1051
|
+
if (!ot(n.snapshot, b)) {
|
|
1052
|
+
n.snapshot = b;
|
|
1053
|
+
for (const y of n.subscribers)
|
|
1054
|
+
y(E(b));
|
|
1046
1055
|
}
|
|
1047
1056
|
}, s = () => {
|
|
1048
1057
|
n.entries.clear(), i();
|
|
1049
1058
|
};
|
|
1050
1059
|
return r.addEventListener("keydown", (c) => {
|
|
1051
|
-
if (!
|
|
1060
|
+
if (!it.has(c.key)) {
|
|
1052
1061
|
const h = c.key.toLowerCase();
|
|
1053
1062
|
n.entries.set(c.code || `key:${h}`, { key: h, code: c.code });
|
|
1054
1063
|
}
|
|
@@ -1074,18 +1083,18 @@ function F(r) {
|
|
|
1074
1083
|
held: { key: [], code: [] }
|
|
1075
1084
|
};
|
|
1076
1085
|
}
|
|
1077
|
-
function
|
|
1086
|
+
function st(r) {
|
|
1078
1087
|
var n;
|
|
1079
1088
|
const t = r, e = String(((n = t == null ? void 0 : t.userAgentData) == null ? void 0 : n.platform) ?? (t == null ? void 0 : t.platform) ?? (t == null ? void 0 : t.userAgent) ?? "").toLowerCase();
|
|
1080
1089
|
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";
|
|
1081
1090
|
}
|
|
1082
|
-
function
|
|
1091
|
+
function ot(r, t) {
|
|
1083
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 && k(r.held.key, t.held.key) && k(r.held.code, t.held.code);
|
|
1084
1093
|
}
|
|
1085
1094
|
function k(r, t) {
|
|
1086
1095
|
return r.length === t.length && r.every((e, n) => e === t[n]);
|
|
1087
1096
|
}
|
|
1088
|
-
function
|
|
1097
|
+
function E(r) {
|
|
1089
1098
|
return {
|
|
1090
1099
|
platform: r.platform,
|
|
1091
1100
|
modifiers: { ...r.modifiers },
|
|
@@ -1096,10 +1105,10 @@ class ne extends P {
|
|
|
1096
1105
|
constructor() {
|
|
1097
1106
|
super(...arguments);
|
|
1098
1107
|
/** Массив всех логов */
|
|
1099
|
-
o(this, "
|
|
1108
|
+
o(this, "_logs", []);
|
|
1100
1109
|
/** Текущий контекст (иерархия) */
|
|
1101
|
-
o(this, "
|
|
1102
|
-
o(this, "
|
|
1110
|
+
o(this, "_currentContext", []);
|
|
1111
|
+
o(this, "_currentActions", []);
|
|
1103
1112
|
}
|
|
1104
1113
|
/**
|
|
1105
1114
|
* Устанавливает текущий контекст.
|
|
@@ -1111,7 +1120,7 @@ class ne extends P {
|
|
|
1111
1120
|
* logger.context('components', 'DriverCard')
|
|
1112
1121
|
*/
|
|
1113
1122
|
context(...e) {
|
|
1114
|
-
return this.
|
|
1123
|
+
return this._currentContext = e, this;
|
|
1115
1124
|
}
|
|
1116
1125
|
/**
|
|
1117
1126
|
* Добавляет дополнительный уровень контекста.
|
|
@@ -1122,7 +1131,7 @@ class ne extends P {
|
|
|
1122
1131
|
* logger.start('attributes')
|
|
1123
1132
|
*/
|
|
1124
1133
|
start(e) {
|
|
1125
|
-
return this.
|
|
1134
|
+
return this._currentContext.push(e), this;
|
|
1126
1135
|
}
|
|
1127
1136
|
/**
|
|
1128
1137
|
* Убирает последний уровень контекста.
|
|
@@ -1136,10 +1145,10 @@ class ne extends P {
|
|
|
1136
1145
|
*/
|
|
1137
1146
|
end(e, n, i) {
|
|
1138
1147
|
if (n) {
|
|
1139
|
-
const s = i ?? this.
|
|
1140
|
-
this.
|
|
1148
|
+
const s = i ?? this._currentActions.length ? this._currentActions : void 0;
|
|
1149
|
+
this._log(e ?? "info", n, s);
|
|
1141
1150
|
}
|
|
1142
|
-
return this.
|
|
1151
|
+
return this._currentContext.pop(), this._currentActions = [], this;
|
|
1143
1152
|
}
|
|
1144
1153
|
/**
|
|
1145
1154
|
* Добавляет экшены в текущий контекст (для следующего `end`)
|
|
@@ -1150,7 +1159,7 @@ class ne extends P {
|
|
|
1150
1159
|
* logger.action('ti ti-check', 'Все успешно', () => console.logFrame('Успешно!'))
|
|
1151
1160
|
*/
|
|
1152
1161
|
action(e, n, i) {
|
|
1153
|
-
return this.
|
|
1162
|
+
return this._currentActions.push({ icon: e, tooltip: n, handler: i }), this;
|
|
1154
1163
|
}
|
|
1155
1164
|
/**
|
|
1156
1165
|
* Внутренний метод для создания лога.
|
|
@@ -1159,15 +1168,15 @@ class ne extends P {
|
|
|
1159
1168
|
* @param message Сообщение
|
|
1160
1169
|
* @param actions Дополнительные действия (иконки с обработчиками)
|
|
1161
1170
|
*/
|
|
1162
|
-
|
|
1171
|
+
_log(e, n, i) {
|
|
1163
1172
|
const s = {
|
|
1164
1173
|
timestamp: Date.now(),
|
|
1165
1174
|
level: e,
|
|
1166
1175
|
message: n,
|
|
1167
|
-
context: [...this.
|
|
1176
|
+
context: [...this._currentContext],
|
|
1168
1177
|
actions: i
|
|
1169
1178
|
};
|
|
1170
|
-
this.
|
|
1179
|
+
this._logs.push(s), this.notify();
|
|
1171
1180
|
}
|
|
1172
1181
|
/**
|
|
1173
1182
|
* Лог уровня _debug.
|
|
@@ -1178,7 +1187,7 @@ class ne extends P {
|
|
|
1178
1187
|
* logger._debug('Загрузка данных')
|
|
1179
1188
|
*/
|
|
1180
1189
|
debug(e, n) {
|
|
1181
|
-
this.
|
|
1190
|
+
this._log("debug", e, n);
|
|
1182
1191
|
}
|
|
1183
1192
|
/**
|
|
1184
1193
|
* Лог уровня info.
|
|
@@ -1189,7 +1198,7 @@ class ne extends P {
|
|
|
1189
1198
|
* logger.info('Загрузка завершена')
|
|
1190
1199
|
*/
|
|
1191
1200
|
info(e, n) {
|
|
1192
|
-
this.
|
|
1201
|
+
this._log("info", e, n);
|
|
1193
1202
|
}
|
|
1194
1203
|
/**
|
|
1195
1204
|
* Лог уровня warn.
|
|
@@ -1200,7 +1209,7 @@ class ne extends P {
|
|
|
1200
1209
|
* logger.warn('Низкий заряд батареи')
|
|
1201
1210
|
*/
|
|
1202
1211
|
warn(e, n) {
|
|
1203
|
-
this.
|
|
1212
|
+
this._log("warn", e, n);
|
|
1204
1213
|
}
|
|
1205
1214
|
/**
|
|
1206
1215
|
* Лог уровня error.
|
|
@@ -1213,7 +1222,7 @@ class ne extends P {
|
|
|
1213
1222
|
* ])
|
|
1214
1223
|
*/
|
|
1215
1224
|
error(e, n) {
|
|
1216
|
-
this.
|
|
1225
|
+
this._log("error", e, n);
|
|
1217
1226
|
}
|
|
1218
1227
|
/**
|
|
1219
1228
|
* Лог уровня success.
|
|
@@ -1226,7 +1235,7 @@ class ne extends P {
|
|
|
1226
1235
|
* ])
|
|
1227
1236
|
*/
|
|
1228
1237
|
success(e, n) {
|
|
1229
|
-
this.
|
|
1238
|
+
this._log("success", e, n);
|
|
1230
1239
|
}
|
|
1231
1240
|
/**
|
|
1232
1241
|
* Получить все логи.
|
|
@@ -1234,16 +1243,16 @@ class ne extends P {
|
|
|
1234
1243
|
* @returns Массив логов
|
|
1235
1244
|
*/
|
|
1236
1245
|
getLogs() {
|
|
1237
|
-
return this.
|
|
1246
|
+
return this._logs;
|
|
1238
1247
|
}
|
|
1239
1248
|
/**
|
|
1240
1249
|
* Очистить все логи (полностью).
|
|
1241
1250
|
*/
|
|
1242
1251
|
clear() {
|
|
1243
|
-
this.
|
|
1252
|
+
this._logs = [], this.notify();
|
|
1244
1253
|
}
|
|
1245
1254
|
}
|
|
1246
|
-
function
|
|
1255
|
+
function at(r) {
|
|
1247
1256
|
try {
|
|
1248
1257
|
return new new Proxy(r, { construct: () => ({}) })(), !0;
|
|
1249
1258
|
} catch {
|
|
@@ -1251,18 +1260,18 @@ function ct(r) {
|
|
|
1251
1260
|
}
|
|
1252
1261
|
}
|
|
1253
1262
|
function ie(r, ...t) {
|
|
1254
|
-
if (
|
|
1263
|
+
if (at(r)) {
|
|
1255
1264
|
const e = r;
|
|
1256
1265
|
return new e(...t);
|
|
1257
1266
|
} else
|
|
1258
1267
|
return r(...t);
|
|
1259
1268
|
}
|
|
1260
|
-
const
|
|
1269
|
+
const ct = /* @__PURE__ */ new WeakMap();
|
|
1261
1270
|
function se(r) {
|
|
1262
1271
|
let t;
|
|
1263
|
-
return () => (t || (t = r(),
|
|
1272
|
+
return () => (t || (t = r(), ct.set(r, t)), t);
|
|
1264
1273
|
}
|
|
1265
|
-
const
|
|
1274
|
+
const lt = {
|
|
1266
1275
|
DateTime: Y,
|
|
1267
1276
|
toDateTime(r) {
|
|
1268
1277
|
return this.DateTime.fromJSDate(r);
|
|
@@ -1291,7 +1300,7 @@ const ut = {
|
|
|
1291
1300
|
getZone() {
|
|
1292
1301
|
return this.DateTime.now().zone;
|
|
1293
1302
|
}
|
|
1294
|
-
}, oe = (r) =>
|
|
1303
|
+
}, oe = (r) => lt.toDateTime(r);
|
|
1295
1304
|
function ae(r) {
|
|
1296
1305
|
return String(r).charAt(0).toUpperCase() + String(r).slice(1);
|
|
1297
1306
|
}
|
|
@@ -1299,58 +1308,58 @@ function ce(r, t) {
|
|
|
1299
1308
|
return D(r, t) || Q(r, t);
|
|
1300
1309
|
}
|
|
1301
1310
|
function le(r, t, e, n) {
|
|
1302
|
-
const i =
|
|
1311
|
+
const i = p(r), s = p(t), a = p(e), l = p(n);
|
|
1303
1312
|
return !z(s, a) && !D(i, l);
|
|
1304
1313
|
}
|
|
1305
1314
|
function ue(r, t, e) {
|
|
1306
|
-
return !z(r,
|
|
1315
|
+
return !z(r, p(t)) && !D(r, X(e));
|
|
1307
1316
|
}
|
|
1308
1317
|
const fe = (r) => r && new Date(r);
|
|
1309
1318
|
function de(r, t = "HH:mm dd.MM.yyyy", e = {}) {
|
|
1310
|
-
return r &&
|
|
1319
|
+
return r && g(r, t, e);
|
|
1311
1320
|
}
|
|
1312
|
-
function
|
|
1321
|
+
function ut(r, t = "HH:mm dd.MM.yyyy", e = {}, n = !0) {
|
|
1313
1322
|
if (!r || !r || r === "")
|
|
1314
1323
|
return "";
|
|
1315
1324
|
if (typeof r == "string")
|
|
1316
1325
|
r = new Date(r);
|
|
1317
1326
|
else if (r instanceof Date) {
|
|
1318
|
-
if (isNaN(r))
|
|
1327
|
+
if (Number.isNaN(r.getTime()))
|
|
1319
1328
|
return "";
|
|
1320
1329
|
} else
|
|
1321
1330
|
r = new Date(r.toString());
|
|
1322
|
-
return n ?
|
|
1331
|
+
return n ? g(r, t, e) : g(I(r, "utc"), t, e);
|
|
1323
1332
|
}
|
|
1324
1333
|
function he(r) {
|
|
1325
1334
|
const t = { weekday: "short" }, e = new Intl.DateTimeFormat("ru-RU", t).format(r);
|
|
1326
1335
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1327
1336
|
}
|
|
1328
|
-
function
|
|
1337
|
+
function _e(r) {
|
|
1329
1338
|
const t = new Date(r), e = t.getTime() + t.getTimezoneOffset() * 6e3, n = new Date(e + 180 * 6e3), i = String(n.getDate()).padStart(2, "0"), s = String(n.getMonth() + 1).padStart(2, "0"), a = n.getFullYear();
|
|
1330
1339
|
return `${i}.${s}.${a}`;
|
|
1331
1340
|
}
|
|
1332
|
-
function
|
|
1333
|
-
return
|
|
1341
|
+
function me(r, t = !0) {
|
|
1342
|
+
return ut(r, "HH:mm", {}, t);
|
|
1334
1343
|
}
|
|
1335
|
-
function
|
|
1344
|
+
function ye(r) {
|
|
1336
1345
|
const t = Array.from(r), e = Math.min(...t.map((i) => i.getTime())), n = Math.max(...t.map((i) => i.getTime()));
|
|
1337
1346
|
return {
|
|
1338
1347
|
minDate: new Date(e),
|
|
1339
1348
|
maxDate: new Date(n)
|
|
1340
1349
|
};
|
|
1341
1350
|
}
|
|
1342
|
-
function
|
|
1351
|
+
function pe(r, t) {
|
|
1343
1352
|
const e = N(r, t), { hours: n, minutes: i } = A(e);
|
|
1344
1353
|
return n || i ? `${e > 0 ? "-" : "+"}${d(n)}:${d(i)}` : "";
|
|
1345
1354
|
}
|
|
1346
|
-
function
|
|
1355
|
+
function ge(r, t) {
|
|
1347
1356
|
const e = N(r, t), { hours: n, minutes: i } = A(e);
|
|
1348
1357
|
return n || i ? `${e > 0 ? "-" : ""}${d(n)}:${d(i)}` : "";
|
|
1349
1358
|
}
|
|
1350
1359
|
function L(r = /* @__PURE__ */ new Date()) {
|
|
1351
1360
|
return new Date(r.getFullYear(), r.getMonth(), r.getDate());
|
|
1352
1361
|
}
|
|
1353
|
-
function
|
|
1362
|
+
function Te(r, t) {
|
|
1354
1363
|
const e = q(L(r), L(t));
|
|
1355
1364
|
return e ? e > 7 ? {
|
|
1356
1365
|
variant: "red",
|
|
@@ -1366,14 +1375,14 @@ function Se(r, t) {
|
|
|
1366
1375
|
value: `${e}`
|
|
1367
1376
|
} : null;
|
|
1368
1377
|
}
|
|
1369
|
-
function
|
|
1378
|
+
function Se(r) {
|
|
1370
1379
|
const e = String(r ?? "").trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
1371
1380
|
if (!e)
|
|
1372
1381
|
return null;
|
|
1373
1382
|
const n = Number(e[1]), i = Number(e[2]) - 1, s = Number(e[3]), a = new Date(Date.UTC(n, i, s, 0, 0, 0, 0));
|
|
1374
1383
|
return Number.isNaN(a.getTime()) ? null : a.toISOString();
|
|
1375
1384
|
}
|
|
1376
|
-
function
|
|
1385
|
+
function be(r) {
|
|
1377
1386
|
const t = String(r ?? "").trim();
|
|
1378
1387
|
if (!t)
|
|
1379
1388
|
return null;
|
|
@@ -1385,7 +1394,7 @@ function we(r) {
|
|
|
1385
1394
|
const n = new Date(t);
|
|
1386
1395
|
return Number.isNaN(n.getTime()) ? null : n.toISOString();
|
|
1387
1396
|
}
|
|
1388
|
-
function
|
|
1397
|
+
function we(r) {
|
|
1389
1398
|
const t = String(r ?? "").trim();
|
|
1390
1399
|
return t ? t.slice(0, 10) : "";
|
|
1391
1400
|
}
|
|
@@ -1406,10 +1415,10 @@ function De(r, t) {
|
|
|
1406
1415
|
const n = new Date(String(r ?? "").trim());
|
|
1407
1416
|
if (Number.isNaN(n.getTime()))
|
|
1408
1417
|
return "";
|
|
1409
|
-
const i = B(t), s = i ?
|
|
1418
|
+
const i = B(t), s = i ? I(n, i) : n;
|
|
1410
1419
|
return `${d(s.getHours())}:${d(s.getMinutes())}`;
|
|
1411
1420
|
}
|
|
1412
|
-
function
|
|
1421
|
+
function Ie(r, t, e) {
|
|
1413
1422
|
const n = j(t).match(/^(\d{2}):(\d{2})$/);
|
|
1414
1423
|
if (!n)
|
|
1415
1424
|
return null;
|
|
@@ -1422,7 +1431,7 @@ function Ee(r, t, e) {
|
|
|
1422
1431
|
const l = B(e);
|
|
1423
1432
|
if (!l)
|
|
1424
1433
|
return i.setHours(s, a, 0, 0), i.toISOString();
|
|
1425
|
-
const u =
|
|
1434
|
+
const u = I(i, l);
|
|
1426
1435
|
return u.setHours(s, a, 0, 0), v(u, l).toISOString();
|
|
1427
1436
|
}
|
|
1428
1437
|
function j(r) {
|
|
@@ -1447,7 +1456,7 @@ function B(r) {
|
|
|
1447
1456
|
return null;
|
|
1448
1457
|
}
|
|
1449
1458
|
}
|
|
1450
|
-
function
|
|
1459
|
+
function Ee(r) {
|
|
1451
1460
|
if (r == null)
|
|
1452
1461
|
return null;
|
|
1453
1462
|
const t = String(r).trim();
|
|
@@ -1460,17 +1469,17 @@ function Ie(r) {
|
|
|
1460
1469
|
return n ? `${n[1]}:${n[2]}:00` : null;
|
|
1461
1470
|
}
|
|
1462
1471
|
function Ae(r) {
|
|
1463
|
-
const t =
|
|
1472
|
+
const t = dt(r), e = Math.sign(t) >= 0 ? "" : "-", { hours: n, minutes: i } = A(t);
|
|
1464
1473
|
return `${e}${d(n)}:${d(i)}`;
|
|
1465
1474
|
}
|
|
1466
1475
|
function Oe(r = null, t = "dd", e = {}) {
|
|
1467
|
-
const n =
|
|
1476
|
+
const n = ft(r);
|
|
1468
1477
|
if (!n)
|
|
1469
1478
|
return "";
|
|
1470
1479
|
const i = /* @__PURE__ */ new Date(), s = new Date(n);
|
|
1471
|
-
return i.setHours(0, 0, 0, 0), s.setHours(0, 0, 0, 0), s.toDateString() === i.toDateString() ? "" : `/${
|
|
1480
|
+
return i.setHours(0, 0, 0, 0), s.setHours(0, 0, 0, 0), s.toDateString() === i.toDateString() ? "" : `/${g(n, t, e)}`;
|
|
1472
1481
|
}
|
|
1473
|
-
function
|
|
1482
|
+
function ft(r) {
|
|
1474
1483
|
if (!r || r === "")
|
|
1475
1484
|
return null;
|
|
1476
1485
|
const t = typeof r == "string" ? new Date(r) : r instanceof Date ? r : new Date(r.toString());
|
|
@@ -1483,7 +1492,7 @@ function A(r) {
|
|
|
1483
1492
|
minutes: Math.floor(t / 60) % 60
|
|
1484
1493
|
};
|
|
1485
1494
|
}
|
|
1486
|
-
function
|
|
1495
|
+
function dt(r) {
|
|
1487
1496
|
const t = String(r ?? "").trim();
|
|
1488
1497
|
if (!t)
|
|
1489
1498
|
return 0;
|
|
@@ -1503,9 +1512,9 @@ function d(r) {
|
|
|
1503
1512
|
function Ce(r) {
|
|
1504
1513
|
const t = /* @__PURE__ */ new Date();
|
|
1505
1514
|
try {
|
|
1506
|
-
const e =
|
|
1515
|
+
const e = w(r, t), n = Intl.supportedValuesOf("timeZone");
|
|
1507
1516
|
for (const i of n)
|
|
1508
|
-
if (
|
|
1517
|
+
if (w(i, t) === e)
|
|
1509
1518
|
return i;
|
|
1510
1519
|
} catch {
|
|
1511
1520
|
return null;
|
|
@@ -1513,7 +1522,7 @@ function Ce(r) {
|
|
|
1513
1522
|
return null;
|
|
1514
1523
|
}
|
|
1515
1524
|
function Me(r) {
|
|
1516
|
-
return
|
|
1525
|
+
return w(r, /* @__PURE__ */ new Date());
|
|
1517
1526
|
}
|
|
1518
1527
|
class $e {
|
|
1519
1528
|
constructor(t) {
|
|
@@ -1602,52 +1611,52 @@ class Fe {
|
|
|
1602
1611
|
}
|
|
1603
1612
|
}
|
|
1604
1613
|
export {
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1614
|
+
Ht as AfterDeserialize,
|
|
1615
|
+
wt as AppBus,
|
|
1616
|
+
Pt as BeforeSerialize,
|
|
1617
|
+
xt as Collection,
|
|
1618
|
+
At as DelayedExecutor,
|
|
1619
|
+
Kt as DeserializeArrayField,
|
|
1620
|
+
Rt as DeserializeId,
|
|
1612
1621
|
H as EventBus,
|
|
1613
|
-
|
|
1614
|
-
|
|
1622
|
+
m as Events,
|
|
1623
|
+
zt as GenericExpose,
|
|
1615
1624
|
vt as HotkeyManager,
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1625
|
+
Yt as IS_DEBUG,
|
|
1626
|
+
Vt as IgnoreToPlain,
|
|
1627
|
+
Dt as IndexedCollection,
|
|
1628
|
+
Ut as IsOptionalTransformed,
|
|
1629
|
+
Ct as Json,
|
|
1630
|
+
Mt as JsonString,
|
|
1631
|
+
Ot as NamedExecutor,
|
|
1632
|
+
Et as PayloadHttpClient,
|
|
1624
1633
|
It as RingBuffer,
|
|
1625
1634
|
$e as SSEManager,
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1635
|
+
Ft as Script,
|
|
1636
|
+
Nt as Serialize,
|
|
1637
|
+
jt as SerializeId,
|
|
1638
|
+
Bt as SerializeIds,
|
|
1630
1639
|
ne as StructuredLogger,
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1640
|
+
lt as SystemClock,
|
|
1641
|
+
kt as TypeMap,
|
|
1642
|
+
Lt as TypeRecord,
|
|
1634
1643
|
Fe as UPSMeter_Service,
|
|
1635
1644
|
ae as capitalize,
|
|
1636
|
-
|
|
1645
|
+
Wt as compareNumber,
|
|
1637
1646
|
U as consoleErrorSummary,
|
|
1638
1647
|
x as consoleValueSummary,
|
|
1639
1648
|
ie as createInstance,
|
|
1640
|
-
|
|
1641
|
-
|
|
1649
|
+
pe as diffDuration,
|
|
1650
|
+
ge as diffDurationTable,
|
|
1642
1651
|
oe as dt,
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1652
|
+
me as extractTime,
|
|
1653
|
+
ye as findMinMaxDates,
|
|
1654
|
+
_e as formatDateToMSK,
|
|
1646
1655
|
de as formatDatetime,
|
|
1647
|
-
|
|
1656
|
+
ut as formatDatetimeTZ,
|
|
1648
1657
|
Oe as formatDatetimeTZSpecial,
|
|
1649
1658
|
Qt as generateUUID,
|
|
1650
|
-
|
|
1659
|
+
Te as getDateOnlyDiffFactor,
|
|
1651
1660
|
he as getDayOfWeek,
|
|
1652
1661
|
ee as getKeyboardStateSnapshot,
|
|
1653
1662
|
rt as getOnDeserializedMethod,
|
|
@@ -1655,15 +1664,15 @@ export {
|
|
|
1655
1664
|
se as globalState,
|
|
1656
1665
|
ce as isAfterOrEqual,
|
|
1657
1666
|
te as isAnyKeyComboActive,
|
|
1658
|
-
|
|
1667
|
+
at as isConstructor,
|
|
1659
1668
|
ue as isDateInRange,
|
|
1660
1669
|
le as isDateRangeOverlap,
|
|
1661
|
-
|
|
1670
|
+
Zt as isNullOrUndefined,
|
|
1662
1671
|
De as isoDateTimeToTimeInput,
|
|
1663
|
-
|
|
1672
|
+
we as isoToDateInput,
|
|
1664
1673
|
xe as isoToDateTimeLocalInput,
|
|
1665
|
-
|
|
1666
|
-
|
|
1674
|
+
Ie as mergeTimeIntoDateTime,
|
|
1675
|
+
$t as onDeserialized,
|
|
1667
1676
|
fe as parseDate,
|
|
1668
1677
|
Ae as parseDuration,
|
|
1669
1678
|
Ce as parseOffsetToTimezone,
|
|
@@ -1672,9 +1681,9 @@ export {
|
|
|
1672
1681
|
L as removeTime,
|
|
1673
1682
|
re as subscribeKeyboardState,
|
|
1674
1683
|
j as timeToTimeInput,
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1684
|
+
Gt as toInstance,
|
|
1685
|
+
Se as toIsoZDate,
|
|
1686
|
+
be as toIsoZDateTime,
|
|
1687
|
+
Jt as toPlain,
|
|
1688
|
+
Ee as toTimeHHMMSS
|
|
1680
1689
|
};
|