@fest-lib/core 0.1.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/core.js +1011 -0
  4. package/package.json +64 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ⚙️ FE-ST ⚙️
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Core.TS
2
+
3
+ TypeScript core library (such as 'getValue', type checking, and any other utils)
package/dist/core.js ADDED
@@ -0,0 +1,1011 @@
1
+ function K() {
2
+ const e = globalThis;
3
+ if (typeof e.HTMLElement == "function") return;
4
+ const t = class {
5
+ }, r = (n) => {
6
+ typeof e[n] != "function" && (e[n] = t);
7
+ };
8
+ r("EventTarget"), r("Node"), r("Element"), r("HTMLElement"), r("SVGElement"), r("Text"), r("Comment"), r("DocumentFragment"), r("ShadowRoot"), r("HTMLDocument"), r("Document"), r("HTMLBodyElement"), r("HTMLHeadElement"), r("HTMLCanvasElement"), r("HTMLInputElement"), r("HTMLLinkElement"), r("HTMLStyleElement"), r("HTMLPreElement"), r("HTMLDivElement"), r("CSSStyleRule"), r("CSSLayerBlockRule");
9
+ }
10
+ function be() {
11
+ let e, t, r = !1, n = !1;
12
+ return {
13
+ promise: new Promise((i, s) => {
14
+ e = (f) => {
15
+ !r && !n && (r = !0, i(f));
16
+ }, t = (f) => {
17
+ !r && !n && (n = !0, s(f));
18
+ };
19
+ }),
20
+ resolve: e,
21
+ reject: t,
22
+ get isResolved() {
23
+ return r;
24
+ },
25
+ get isRejected() {
26
+ return n;
27
+ }
28
+ };
29
+ }
30
+ var Te = class {
31
+ queue = [];
32
+ processing = !1;
33
+ async add(e) {
34
+ return new Promise((t, r) => {
35
+ this.queue.push(async () => {
36
+ try {
37
+ t(await e());
38
+ } catch (n) {
39
+ r(n);
40
+ }
41
+ }), this.process();
42
+ });
43
+ }
44
+ async process() {
45
+ if (!(this.processing || this.queue.length === 0)) {
46
+ for (this.processing = !0; this.queue.length > 0; ) await this.queue.shift()();
47
+ this.processing = !1;
48
+ }
49
+ }
50
+ get length() {
51
+ return this.queue.length;
52
+ }
53
+ get isProcessing() {
54
+ return this.processing;
55
+ }
56
+ };
57
+ function Re(e, t, r = "Operation timed out") {
58
+ const n = new Promise((i, s) => {
59
+ setTimeout(() => s(new Error(r)), t);
60
+ });
61
+ return Promise.race([e, n]);
62
+ }
63
+ async function Ee(e, t = 3, r = 1e3, n = 2) {
64
+ let i;
65
+ for (let s = 0; s <= t; s++) try {
66
+ return await e();
67
+ } catch (f) {
68
+ if (i = f, s < t) {
69
+ const o = r * Math.pow(n, s);
70
+ await new Promise((a) => setTimeout(a, o));
71
+ }
72
+ }
73
+ throw i;
74
+ }
75
+ async function Ie(e, t) {
76
+ const r = [], n = [];
77
+ for (let i = 0; i < e.length; i++) {
78
+ const s = e[i], f = Promise.resolve().then(async () => {
79
+ try {
80
+ const o = await s();
81
+ r[i] = o;
82
+ } catch (o) {
83
+ throw o;
84
+ }
85
+ });
86
+ r[i] = void 0, n.push(f), n.length >= t && (await Promise.race(n), n.splice(n.findIndex((o) => o === f), 1));
87
+ }
88
+ return await Promise.all(n), r;
89
+ }
90
+ var X = class {
91
+ channels = /* @__PURE__ */ new Map();
92
+ listeners = /* @__PURE__ */ new Map();
93
+ register(e, t) {
94
+ this.channels.set(e, t);
95
+ const r = this.listeners.get(e);
96
+ if (r) for (const n of r) try {
97
+ n(t);
98
+ } catch (i) {
99
+ console.error(`[ChannelRegistry] Listener error for ${e}:`, i);
100
+ }
101
+ return t;
102
+ }
103
+ get(e) {
104
+ return this.channels.get(e);
105
+ }
106
+ has(e) {
107
+ return this.channels.has(e);
108
+ }
109
+ unregister(e) {
110
+ const t = this.channels.delete(e);
111
+ if (t) {
112
+ const r = this.listeners.get(e);
113
+ if (r) for (const n of r) try {
114
+ n(null);
115
+ } catch (i) {
116
+ console.error(`[ChannelRegistry] Unregister listener error for ${e}:`, i);
117
+ }
118
+ }
119
+ return t;
120
+ }
121
+ onChannelChange(e, t) {
122
+ this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set());
123
+ const r = this.listeners.get(e);
124
+ if (r.add(t), this.channels.has(e)) try {
125
+ t(this.channels.get(e));
126
+ } catch (n) {
127
+ console.error(`[ChannelRegistry] Initial listener error for ${e}:`, n);
128
+ }
129
+ return () => {
130
+ r.delete(t), r.size === 0 && this.listeners.delete(e);
131
+ };
132
+ }
133
+ getChannelNames() {
134
+ return Array.from(this.channels.keys());
135
+ }
136
+ clear() {
137
+ this.channels.clear(), this.listeners.clear();
138
+ }
139
+ }, _e = new X();
140
+ function De(e, t) {
141
+ const r = {};
142
+ for (const n of t) r[n] = (...i) => e.request(n, i);
143
+ return r;
144
+ }
145
+ var Z = class {
146
+ healthChecks = /* @__PURE__ */ new Map();
147
+ intervals = /* @__PURE__ */ new Map();
148
+ healthStatus = /* @__PURE__ */ new Map();
149
+ registerHealthCheck(e, t, r = 3e4) {
150
+ this.healthChecks.set(e, t);
151
+ const n = this.intervals.get(e);
152
+ n && clearInterval(n);
153
+ const i = setInterval(async () => {
154
+ try {
155
+ const s = await t();
156
+ this.healthStatus.set(e, s), s || console.warn(`[ChannelHealth] Channel '${e}' is unhealthy`);
157
+ } catch (s) {
158
+ console.error(`[ChannelHealth] Health check failed for '${e}':`, s), this.healthStatus.set(e, !1);
159
+ }
160
+ }, r);
161
+ this.intervals.set(e, i), t().then((s) => {
162
+ this.healthStatus.set(e, s);
163
+ }).catch(() => {
164
+ this.healthStatus.set(e, !1);
165
+ });
166
+ }
167
+ isHealthy(e) {
168
+ return this.healthStatus.get(e) ?? !1;
169
+ }
170
+ getAllHealthStatuses() {
171
+ const e = {};
172
+ for (const [t, r] of this.healthStatus) e[t] = r;
173
+ return e;
174
+ }
175
+ stopMonitoring(e) {
176
+ const t = this.intervals.get(e);
177
+ t && (clearInterval(t), this.intervals.delete(e)), this.healthChecks.delete(e), this.healthStatus.delete(e);
178
+ }
179
+ stopAllMonitoring() {
180
+ for (const e of this.intervals.values()) clearInterval(e);
181
+ this.intervals.clear(), this.healthChecks.clear(), this.healthStatus.clear();
182
+ }
183
+ }, We = new Z();
184
+ WeakMap.prototype.getOrInsert ??= function(e, t) {
185
+ return this.has(e) || this.set(e, t), this.get(e);
186
+ };
187
+ WeakMap.prototype.getOrInsertComputed ??= function(e, t) {
188
+ return this.has(e) || this.set(e, t(e)), this.get(e);
189
+ };
190
+ Map.prototype.getOrInsert ??= function(e, t) {
191
+ return this.has(e) || this.set(e, t), this.get(e);
192
+ };
193
+ Map.prototype.getOrInsertComputed ??= function(e, t) {
194
+ return this.has(e) || this.set(e, t(e)), this.get(e);
195
+ };
196
+ var Ne = (e, t, r = () => null) => (e?.has?.(t) || e?.set?.(t, r?.()), e?.get?.(t)), ke = (e, t, r = () => null) => (e?.has?.(t) || e?.set?.(t, r?.(t)), e?.get?.(t)), F = /* @__PURE__ */ Symbol.for("@fix"), He = (e) => e?.some?.(g), Le = (e) => Array.isArray(e) || e instanceof Set || e instanceof Map, g = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, Y = (e, t) => g(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, k = (e, t = "value") => (typeof e == "object" || typeof e == "function") && e != null && (t in e || e?.[t] != null), B = (e) => k(e, "value"), Q = (e) => g(e) ? e : B(e) ? e?.value : e, c = (e, t) => e?.[F] ?? e ?? t ?? t, E = (e) => e != null && (typeof e == "object" || typeof e == "function") && (e instanceof WeakRef || typeof e?.deref == "function") ? E(e?.deref?.()) : e, ee = (e) => {
197
+ if (typeof e == "function" || e == null) return e;
198
+ const t = function() {
199
+ };
200
+ return t[F] = e, t;
201
+ }, ze = (e, t, r) => (e = E(e), e != null && (typeof e == "object" || typeof e == "function") ? e[t] = Q(r = E(r)) : e), te = (e) => crypto?.getRandomValues ? crypto?.getRandomValues?.(e) : (() => {
202
+ const t = new Uint8Array(e.length);
203
+ for (let r = 0; r < e.length; r++) t[r] = Math.floor(Math.random() * 256);
204
+ return t;
205
+ })();
206
+ function Fe(e, t, r) {
207
+ return Math.min(Math.max(e, t), r);
208
+ }
209
+ var Be = (e, t, r) => Math.max(e, Math.min(t, r)), Ue = (e, t) => typeof t == "function" ? t?.bind?.(e) ?? t : t, Ve = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^ te?.(/* @__PURE__ */ new Uint8Array(1))?.[0] & 15 >> +e / 4).toString(16)), $e = (e) => e && e?.replace?.(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), Ge = (e) => e && e?.replace?.(/-([a-z])/g, (t, r) => r.toUpperCase()), qe = (e, t = 0) => {
210
+ const r = Number(e);
211
+ return Number.isFinite(r) ? r : t;
212
+ }, je = (e, t) => !Number.isFinite(t) || t <= 0 || !Number.isFinite(e) ? 0 : Math.min(Math.max(e, 0), t), S = (e, t = 1) => Math.round(e * t) / t, Je = (e, t = 1) => Math.floor(e * t) / t, Ke = (e, t = 1) => Math.ceil(e * t) / t, Xe = (e) => typeof CSSStyleValue < "u" && e instanceof CSSStyleValue, Ze = (e) => e != null && (typeof e == "boolean" ? e !== !1 : !0) && typeof e != "object" && typeof e != "function", Ye = (e) => typeof e == "boolean" ? e ? "" : null : typeof e == "number" ? String(e) : e, I = /* @__PURE__ */ Symbol.for("@trigger-lock"), Qe = (e, t, r = "value") => {
213
+ k(e, r) && (e[I] = !0);
214
+ let n;
215
+ try {
216
+ n = t?.();
217
+ } finally {
218
+ k(e, r) && delete e[I];
219
+ }
220
+ return n;
221
+ }, et = (e) => {
222
+ if (typeof e != "string") return null;
223
+ const t = [...e?.matchAll?.(/^\d+(\.\d+)?$/g)];
224
+ if (t?.length != 1) return null;
225
+ const r = parseFloat(t[0][0]);
226
+ return !Number.isNaN(r) && Number.isFinite(r) ? r : null;
227
+ }, re = /^\d+$/g, ne = (e) => {
228
+ if (typeof e != "string" || (e = e?.trim?.(), e == "" || e == null)) return null;
229
+ const t = [...e?.matchAll?.(re)];
230
+ if (t?.length != 1) return null;
231
+ const r = parseInt(t[0][0]);
232
+ return !Number.isNaN(r) && Number.isInteger(r) ? r : null;
233
+ }, tt = (e) => typeof e == "number" && !Number.isNaN(e), rt = (e) => typeof e == "string" ? ne(e) != null : typeof e == "number" && Number.isInteger(e) && e >= 0, nt = (e) => Array.isArray(e) || e != null && typeof e == "object" && typeof e[Symbol.iterator] == "function", it = (e, t, r) => {
234
+ e = e instanceof WeakRef ? e.deref() : e;
235
+ const n = [...Object.entries(r)].map?.(([i, s]) => e?.[t]?.call?.(e, i, s));
236
+ return () => {
237
+ n?.forEach?.((i) => i?.());
238
+ };
239
+ }, U = (e) => e instanceof WeakRef || typeof e?.deref == "function", st = (e) => U(e) ? E(e) : e, ot = (e) => e != null ? U(e) ? e : typeof e == "function" || typeof e == "object" ? new WeakRef(e) : e : e, ft = (e) => (typeof e == "object" || typeof e == "function") && (e?.value != null || e != null && "value" in e), at = (e) => e != null && (typeof e == "object" || typeof e == "function"), ut = (e) => B(e) ? e?.value : e, ct = (e, t) => e instanceof Promise || typeof e?.then == "function" ? e?.then?.(t) : t?.(e), lt = (e, t) => e instanceof Promise || typeof e?.then == "function" ? e?.then?.(t) : t?.(e), yt = function(e) {
240
+ return (t) => {
241
+ e[I] = !0;
242
+ let r;
243
+ try {
244
+ r = t?.();
245
+ } finally {
246
+ e[I] = !1;
247
+ }
248
+ return r;
249
+ };
250
+ }, V = (e) => Array.isArray(e) ? e?.flatMap?.((t) => Array.isArray(t) ? V(t) : t) : e, ie = (e) => V(e)?.every?.(x), x = (e) => g(e) || typeof SharedArrayBuffer == "function" && e instanceof SharedArrayBuffer || se(e) || Array.isArray(e) && ie(e), se = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), ht = (e) => typeof e == "symbol" || typeof e == "object" && Object.prototype.toString.call(e) == "[object Symbol]", mt = (e) => e instanceof Promise || typeof e?.then == "function", dt = (e) => g(e) || typeof ArrayBuffer == "function" && e instanceof ArrayBuffer || typeof MessagePort == "function" && e instanceof MessagePort || typeof ReadableStream == "function" && e instanceof ReadableStream || typeof WritableStream == "function" && e instanceof WritableStream || typeof TransformStream == "function" && e instanceof TransformStream || typeof ImageBitmap == "function" && e instanceof ImageBitmap || typeof VideoFrame == "function" && e instanceof VideoFrame || typeof OffscreenCanvas == "function" && e instanceof OffscreenCanvas || typeof RTCDataChannel == "function" && e instanceof RTCDataChannel || typeof AudioData == "function" && e instanceof AudioData || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream || typeof WebTransportSendStream == "function" && e instanceof WebTransportSendStream || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream, pt = (e) => {
251
+ switch (typeof e) {
252
+ case "number":
253
+ return 0;
254
+ case "string":
255
+ return "";
256
+ case "boolean":
257
+ return !1;
258
+ case "object":
259
+ return null;
260
+ case "function":
261
+ return null;
262
+ case "symbol":
263
+ return null;
264
+ case "bigint":
265
+ return 0n;
266
+ }
267
+ }, w = (e) => typeof e?.[Symbol.iterator] == "function", gt = (e) => [
268
+ "symbol",
269
+ "string",
270
+ "number"
271
+ ].indexOf(typeof e) >= 0, St = (e) => e != null && (typeof e == "function" || typeof e == "object") && !(e instanceof WeakRef), vt = (e, t = "id") => {
272
+ const r = Array.from(e?.values?.()).map((i) => [i?.[t], i]), n = new Map(r);
273
+ return Array.from(n?.values?.() || []);
274
+ }, oe = (e, t, r = null) => {
275
+ const n = r != null && (typeof e == "object" || typeof e == "function") ? e?.[r] ?? e : e;
276
+ let i = [];
277
+ t instanceof Set || t instanceof Map || Array.isArray(t) || w(t) ? i = (n instanceof Set || n instanceof WeakSet ? t?.values?.() : t?.entries?.()) || (Array.isArray(t) || w(t) ? t : []) : (typeof t == "object" || typeof t == "function") && (i = n instanceof Set || n instanceof WeakSet ? Object.values(t) : Object.entries(t));
278
+ let s = [];
279
+ Array.isArray(n) ? s = n.entries() : n instanceof Map || n instanceof WeakMap ? s = n?.entries?.() : n instanceof Set || n instanceof WeakSet ? s = n?.values?.() : (typeof n == "object" || typeof n == "function") && (s = Object.entries(n));
280
+ const f = new Set(Array.from(i).map((u) => u?.[0])), o = new Set(Array.from(s).map((u) => u?.[0])), a = f?.difference?.(o);
281
+ if (Array.isArray(n)) {
282
+ const u = n.filter((y, M) => !a.has(M));
283
+ n.splice(0, n.length), n.push(...u);
284
+ } else if (n instanceof Map || n instanceof Set || n instanceof WeakMap || n instanceof WeakSet) for (const u of a) n.delete(u);
285
+ else if (typeof n == "function" || typeof n == "object") for (const u of a) delete n[u];
286
+ return n;
287
+ }, fe = (e, t, r = null, n = !0, i = "id") => {
288
+ const s = r != null && (typeof e == "object" || typeof e == "function") ? e?.[r] ?? e : e;
289
+ let f = null;
290
+ if (n && oe(s, t), t instanceof Set || t instanceof Map || Array.isArray(t) || w(t) ? f = (s instanceof Set || s instanceof WeakSet ? t?.values?.() : t?.entries?.()) || (Array.isArray(t) || w(t) ? t : []) : (typeof t == "object" || typeof t == "function") && (f = s instanceof Set || s instanceof WeakSet ? Object.values(t) : Object.entries(t)), s && f && (typeof f == "object" || typeof f == "function")) {
291
+ if (s instanceof Map || s instanceof WeakMap) {
292
+ for (const o of f) s.set(...o);
293
+ return s;
294
+ }
295
+ if (s instanceof Set || s instanceof WeakSet) {
296
+ for (const o of f) {
297
+ const a = o?.[i] ? Array.from(s?.values?.() || []).find((u) => !_?.(u?.[i], o?.[i])) : null;
298
+ a != null ? fe(a, o, null, n, i) : s.add(o);
299
+ }
300
+ return s;
301
+ }
302
+ if (typeof s == "object" || typeof s == "function") {
303
+ if (Array.isArray(s) || w(s)) {
304
+ let o = 0;
305
+ for (const a of f) o < s.length ? s[o++] = a?.[1] : s?.push?.(a?.[1]);
306
+ return s;
307
+ }
308
+ return Object.assign(s, Object.fromEntries([...f || []].filter((o) => typeof o != "symbol")));
309
+ }
310
+ }
311
+ return r != null ? (Reflect.set(e, r, t), e) : typeof t == "object" || typeof t == "function" ? Object.assign(e, t) : t;
312
+ }, ae = (e, t) => ce.getOrInsert(e, /* @__PURE__ */ new WeakMap()).getOrInsert(t, t?.bind?.(e)), Mt = (e, t) => (typeof t == "function" ? ae(e, t) : t) ?? t, W = (e, t, r, n) => {
313
+ if (t == Symbol.iterator) return ue(e, r, n);
314
+ if (t == null || typeof t == "symbol" || typeof t == "object" || typeof t == "function") return;
315
+ const i = (s, ...f) => {
316
+ if (s != null) return r?.(s, ...f);
317
+ };
318
+ if (e instanceof Map || e instanceof WeakMap) {
319
+ if (e.has(t)) return i?.(e.get(t), t, null, "@set");
320
+ } else if (e instanceof Set || e instanceof WeakSet) {
321
+ if (e.has(t)) return i?.(t, t, null, "@add");
322
+ } else if (Array.isArray(e) && typeof t == "string" && [...t?.matchAll?.(/^\d+$/g)].length == 1 && Number.isInteger(typeof t == "string" ? parseInt(t) : t)) {
323
+ const s = typeof t == "string" ? parseInt(t) : t;
324
+ return i?.(e?.[s], s, null, "@add");
325
+ } else if (typeof e == "function" || typeof e == "object") return i?.(e?.[t], t, null, "@set");
326
+ }, At = (e, t = {}) => (Object.entries(t)?.forEach?.(([r, n]) => {
327
+ _(n, e[r]) && (e[r] = n);
328
+ }), e), ue = (e, t, r) => {
329
+ if (e == null) return;
330
+ let n = [];
331
+ if (e instanceof Set || e instanceof Map || typeof e?.keys == "function") return [...e?.keys?.() || n].forEach?.((i) => W(e, i, t, r));
332
+ if (Array.isArray(e) || w(e)) return [...e].forEach?.((i, s) => W(e, s, t, r));
333
+ if (typeof e == "object" || typeof e == "function") return [...Object.keys(e) || n].forEach?.((i) => W(e, i, t, r));
334
+ }, Pt = (e, t) => e == null && t == null ? !1 : e == null || t == null ? !0 : e instanceof Map || e instanceof WeakMap ? e.size != t.size || Array.from(e.entries()).some(([r, n]) => !t.has(r) || !_(n, t.get(r))) : e instanceof Set || e instanceof WeakSet ? e.size != t.size || Array.from(e.values()).some((r) => !t.has(r)) : Array.isArray(e) || Array.isArray(t) ? e.length != t.length || e.some((r, n) => !_(r, t[n])) : typeof e == "object" || typeof t == "object" ? JSON.stringify(e) != JSON.stringify(t) : e != t, _ = (e, t) => e == null && t == null ? !1 : e == null || t == null ? !0 : typeof e == "boolean" && typeof t == "boolean" ? e != t : typeof e == "number" && typeof t == "number" ? !(e == t || Math.abs(e - t) < 1e-9) : typeof e == "string" && typeof t == "string" ? e != "" && t != "" && e != t || e !== t : typeof e != typeof t ? e !== t : e && t && e != t || e !== t, ce = /* @__PURE__ */ new WeakMap(), wt = (e, t) => {
335
+ const r = e == null || e < 0 || typeof e != "number" || e == Symbol.iterator || (t != null ? e >= (t?.length || 0) : !1);
336
+ return t != null ? Array.isArray(t) && r : !1;
337
+ }, Ct = /* @__PURE__ */ new WeakMap(), xt = (e, t) => typeof e?.[t] == "function" ? e?.[t]?.bind?.(e) : e?.[t], b = (e, t, r) => {
338
+ if (Array.isArray(e))
339
+ return e.every(x) ? e.map(t) : e.map((n, i) => b(n, t, [e, i]));
340
+ if (e instanceof Map) {
341
+ const n = Array.from(e.entries());
342
+ return n.map(([i, s]) => s).every(x) ? new Map(n.map(([i, s]) => [i, t(s, i, e)])) : new Map(n.map(([i, s]) => [i, b(s, t, [e, i])]));
343
+ }
344
+ if (e instanceof Set) {
345
+ const n = Array.from(e.entries()), i = n.map(([s, f]) => f);
346
+ return n.every(x) ? new Set(i.map(t)) : new Set(i.map((s) => b(s, t, [e, s])));
347
+ }
348
+ if (typeof e == "object" && e?.constructor == Object && Object.prototype.toString.call(e) == "[object Object]") {
349
+ const n = Array.from(Object.entries(e));
350
+ return n.map(([i, s]) => s).every(x) ? Object.fromEntries(n.map(([i, s]) => [i, t(s, i, e)])) : Object.fromEntries(n.map(([i, s]) => [i, b(s, t, [e, i])]));
351
+ }
352
+ return t(e, r?.[1] ?? "", r?.[0] ?? null);
353
+ }, Ot = (e, t, r) => {
354
+ if (e?.[t] != null) {
355
+ const n = e[t];
356
+ return Array.isArray(r) ? n.add(...r) : typeof r == "function" && n.add(r), e;
357
+ }
358
+ return e[t] ??= Array.isArray(r) ? new Set(r) : typeof r == "function" ? /* @__PURE__ */ new Set([r]) : r, e;
359
+ }, p = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), m = (e, t) => e instanceof Promise || typeof e?.then == "function" ? p?.has?.(e) ? t(p?.get?.(e)) : Promise.try?.(async () => {
360
+ const r = await e;
361
+ return p?.set?.(e, r), r;
362
+ })?.then?.(t) : t(e), le = class {
363
+ #e;
364
+ #t;
365
+ constructor(e, t) {
366
+ this.#e = e, this.#t = t;
367
+ }
368
+ defineProperty(e, t, r) {
369
+ return c(e) instanceof Promise ? Reflect.defineProperty(e, t, r) : m(c(e), (n) => Reflect.defineProperty(n, t, r));
370
+ }
371
+ deleteProperty(e, t) {
372
+ return c(e) instanceof Promise ? Reflect.deleteProperty(e, t) : m(c(e), (r) => Reflect.deleteProperty(r, t));
373
+ }
374
+ getPrototypeOf(e) {
375
+ return c(e) instanceof Promise ? Reflect.getPrototypeOf(e) : m(c(e), (t) => Reflect.getPrototypeOf(t));
376
+ }
377
+ setPrototypeOf(e, t) {
378
+ return c(e) instanceof Promise ? Reflect.setPrototypeOf(e, t) : m(c(e), (r) => Reflect.setPrototypeOf(r, t));
379
+ }
380
+ isExtensible(e) {
381
+ return c(e) instanceof Promise ? Reflect.isExtensible(e) : m(c(e), (t) => Reflect.isExtensible(t));
382
+ }
383
+ preventExtensions(e) {
384
+ return c(e) instanceof Promise ? Reflect.ownKeys(e) : m(c(e), (t) => Reflect.preventExtensions(t));
385
+ }
386
+ ownKeys(e) {
387
+ const t = c(e);
388
+ return t instanceof Promise ? Object.keys(t) : m(t, (r) => (typeof r == "object" || typeof r == "function") && r != null ? Object.keys(r) : []) ?? [];
389
+ }
390
+ getOwnPropertyDescriptor(e, t) {
391
+ return c(e) instanceof Promise ? Reflect.getOwnPropertyDescriptor(e, t) : m(c(e), (r) => Reflect.getOwnPropertyDescriptor(r, t));
392
+ }
393
+ construct(e, t, r) {
394
+ return m(c(e), (n) => Reflect.construct(n, t, r));
395
+ }
396
+ has(e, t) {
397
+ return c(e) instanceof Promise ? Reflect.has(e, t) : m(c(e), (r) => Reflect.has(r, t));
398
+ }
399
+ get(e, t, r) {
400
+ if (e = c(e), t == "promise") return e;
401
+ if (t == "resolve" && this.#e) return (...i) => {
402
+ const s = this.#e?.(...i);
403
+ return this.#e = null, s;
404
+ };
405
+ if (t == "reject" && this.#t) return (...i) => {
406
+ const s = this.#t?.(...i);
407
+ return this.#t = null, s;
408
+ };
409
+ if (t == "then" || t == "catch" || t == "finally") {
410
+ if (e instanceof Promise) return e?.[t]?.bind?.(e);
411
+ {
412
+ const i = Promise.try(() => e);
413
+ return i?.[t]?.bind?.(i);
414
+ }
415
+ }
416
+ let n;
417
+ return p?.has?.(e) && (n = p?.get?.(e))?.[t] != null ? n = p?.get?.(e)?.[t] : n = ye(m(e, async (i) => {
418
+ if (c(i) instanceof Promise) return Reflect.get(i, t, r);
419
+ if (g(i)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? i : void 0;
420
+ let s;
421
+ try {
422
+ s = Reflect.get(i, t, r);
423
+ } catch {
424
+ s = e?.[t];
425
+ }
426
+ return typeof s == "function" ? s?.bind?.(i) : s;
427
+ })), t == Symbol.toStringTag ? g(n) ? String(n ?? "") || "" : n?.[Symbol.toStringTag]?.() || String(n ?? "") || "" : t == Symbol.toPrimitive ? (i) => {
428
+ if (g(n)) return Y(n, i);
429
+ } : n;
430
+ }
431
+ set(e, t, r) {
432
+ return m(c(e), (n) => Reflect.set(n, t, r));
433
+ }
434
+ apply(e, t, r) {
435
+ if (this.#e) {
436
+ const n = this.#e?.(...r);
437
+ return this.#e = null, n;
438
+ }
439
+ return m(c(e, this.#e), (n) => {
440
+ if (typeof n == "function")
441
+ return c(n) instanceof Promise, Reflect.apply(n, t, r);
442
+ });
443
+ }
444
+ };
445
+ function ye(e, t, r) {
446
+ return e instanceof Promise || typeof e?.then == "function" ? p?.has?.(e) ? p?.get?.(e) : (H?.has?.(e) || e?.then?.((n) => p?.set?.(e, n)), H?.getOrInsertComputed?.(e, () => new Proxy(ee(e), new le(t, r)))) : e;
447
+ }
448
+ var N = /* @__PURE__ */ new WeakMap(), he = class {
449
+ _deref(e) {
450
+ return e instanceof WeakRef || typeof e?.deref == "function" ? e?.deref?.() : e;
451
+ }
452
+ get(e, t, r) {
453
+ const n = this._deref(e), i = n?.[t];
454
+ return (t == "element" || t == "value") && n && (i == null || !(t in n)) ? n : t == "deref" ? () => this._deref(e) : typeof i == "function" ? (...s) => this._deref(e)?.[t]?.(...s) : i;
455
+ }
456
+ set(e, t, r, n) {
457
+ const i = this._deref(e);
458
+ return i ? Reflect.set(i, t, r) : !0;
459
+ }
460
+ has(e, t) {
461
+ const r = this._deref(e);
462
+ return r ? t in r : !1;
463
+ }
464
+ ownKeys(e) {
465
+ const t = this._deref(e);
466
+ return t ? Reflect.ownKeys(t) : [];
467
+ }
468
+ getOwnPropertyDescriptor(e, t) {
469
+ const r = this._deref(e);
470
+ if (r)
471
+ return Object.getOwnPropertyDescriptor(r, t);
472
+ }
473
+ deleteProperty(e, t) {
474
+ const r = this._deref(e);
475
+ return r ? Reflect.deleteProperty(r, t) : !0;
476
+ }
477
+ defineProperty(e, t, r) {
478
+ const n = this._deref(e);
479
+ return n ? Reflect.defineProperty(n, t, r) : !0;
480
+ }
481
+ getPrototypeOf(e) {
482
+ const t = this._deref(e);
483
+ return t ? Object.getPrototypeOf(t) : null;
484
+ }
485
+ setPrototypeOf(e, t) {
486
+ const r = this._deref(e);
487
+ return r ? Reflect.setPrototypeOf(r, t) : !0;
488
+ }
489
+ isExtensible(e) {
490
+ const t = this._deref(e);
491
+ return t ? Reflect.isExtensible(t) : !1;
492
+ }
493
+ preventExtensions(e) {
494
+ const t = this._deref(e);
495
+ return t ? Reflect.preventExtensions(t) : !0;
496
+ }
497
+ };
498
+ function bt(e) {
499
+ if (!(typeof e == "object" || typeof e == "function") || typeof e == "symbol") return e;
500
+ const t = e instanceof WeakRef || typeof e?.deref == "function";
501
+ if (e = t ? e?.deref?.() : e, e != null && N.has(e)) return N.get(e);
502
+ const r = new he(), n = new Proxy(t ? e : new WeakRef(e), r);
503
+ return N.set(e, n), n;
504
+ }
505
+ var $ = (e, t, r = 0) => {
506
+ const n = [...t], i = [...e];
507
+ return r % 2 && (i.reverse(), n.reverse()), [(r == 0 || r == 3 ? i[0] : n[0] - i[0]) || 0, (r == 0 || r == 1 ? i[1] : n[1] - i[1]) || 0];
508
+ }, Tt = (e, t, r = 0) => {
509
+ const n = [...t], i = [...e];
510
+ r % 2 && n.reverse();
511
+ const s = [(r == 0 || r == 3 ? i[0] : n[0] - i[0]) || 0, (r == 0 || r == 1 ? i[1] : n[1] - i[1]) || 0];
512
+ return r % 2 && s.reverse(), s;
513
+ }, Rt = (e, t = 0) => {
514
+ const r = [...e];
515
+ return t % 2 && r.reverse(), [(t == 0 || t == 3 ? r[0] : -r[0]) || 0, (t == 0 || t == 1 ? r[1] : -r[1]) || 0];
516
+ }, Et = (e, t = 0) => {
517
+ const r = [...e], n = [(t == 0 || t == 3 ? r[0] : -r[0]) || 0, (t == 0 || t == 1 ? r[1] : -r[1]) || 0];
518
+ return t % 2 && n.reverse(), n;
519
+ }, v = (e, t = [4, 8]) => {
520
+ if (Array.isArray(e) && e.length >= 2) return [Math.max(1, Math.floor(Number(e[0]) || t[0])), Math.max(1, Math.floor(Number(e[1]) || t[1]))];
521
+ if (e && typeof e == "object") {
522
+ const r = e;
523
+ return [Math.max(1, Math.floor(Number(r.columns) || t[0])), Math.max(1, Math.floor(Number(r.rows) || t[1]))];
524
+ }
525
+ return [t[0], t[1]];
526
+ }, me = (e, t) => {
527
+ const [r, n] = v(t);
528
+ return [Math.max(0, Math.min(r - 1, Math.floor(Number(e[0]) || 0))), Math.max(0, Math.min(n - 1, Math.floor(Number(e[1]) || 0)))];
529
+ }, It = (e, t, r, n, i) => {
530
+ const s = v(r), f = Math.max(1, t[0] || 1), o = Math.max(1, t[1] || 1), a = $(e, [f, o], n), u = {
531
+ item: i?.redirect?.item ?? { id: "" },
532
+ list: i?.redirect?.list ?? [],
533
+ items: i?.redirect?.items ?? /* @__PURE__ */ new Map(),
534
+ layout: s,
535
+ size: [f, o]
536
+ }, y = ge(a, u, n), M = (i?.mode ?? "floor") === "round" ? [Math.round(y[0]), Math.round(y[1])] : [Math.floor(y[0]), Math.floor(y[1])], P = pe(M, u);
537
+ return me(P, s);
538
+ }, de = (e) => e == null ? [] : Array.isArray(e) ? e : e instanceof Map ? Array.from(e.values()) : e instanceof Set || typeof e[Symbol.iterator] == "function" ? Array.from(e) : [], _t = (e, t) => {
539
+ const r = e.style.getPropertyValue(["--ox-c-span", "--ox-r-span"][t]), n = (parseFloat(r || "1") || 1) - 1;
540
+ return Math.min(Math.max(n - 1, 0), 1);
541
+ }, pe = (e, t) => {
542
+ const r = v(t?.layout ?? [4, 8]), n = {
543
+ ...t,
544
+ layout: r
545
+ }, i = de(n?.items), s = n?.item || {}, f = (d) => i.filter((C) => !(C == s || C?.id == s?.id)).some((C) => (C?.cell?.[0] || 0) == (d[0] || 0) && (C?.cell?.[1] || 0) == (d[1] || 0)), o = [...e];
546
+ if (!f(o)) return [...o];
547
+ const a = r[0] || 4, u = r[1] || 8, y = ([
548
+ [o[0] + 1, o[1]],
549
+ [o[0] - 1, o[1]],
550
+ [o[0], o[1] + 1],
551
+ [o[0], o[1] - 1]
552
+ ].filter((d) => d[0] >= 0 && d[0] < a && d[1] >= 0 && d[1] < u) || []).find((d) => !f(d));
553
+ if (y) return [...y];
554
+ let M = 0, P = !0, h = [...o];
555
+ for (; P && M++ < a * u; ) {
556
+ if (!(P = f(h))) return [...h];
557
+ h[0]++, h[0] >= a && (h[0] = 0, h[1]++, h[1] >= u && (h[1] = 0));
558
+ }
559
+ return [...o];
560
+ }, Dt = (e, t, r = 0) => {
561
+ const n = [...t.size], i = [...e], s = v(t.layout ?? [4, 8]);
562
+ return r % 2 && n.reverse(), [S(i[0], n[0] / s[0]), S(i[1], n[1] / s[1])];
563
+ }, ge = (e, t, r = 0) => {
564
+ const n = [...t.size], i = [...e], s = v(t.layout ?? [4, 8]);
565
+ r % 2 && n.reverse();
566
+ const f = [s[0] / n[0], s[1] / n[1]];
567
+ return [i[0] * f[0], i[1] * f[1]];
568
+ }, Wt = (e, t, r = 0) => {
569
+ const n = [...e], i = [...t.size], s = v(t.layout ?? [4, 8]);
570
+ r % 2 && i.reverse();
571
+ const f = [i[0] / s[0], i[1] / s[1]];
572
+ return [S(n[0], f[0]), S(n[1], f[1])];
573
+ }, Nt = (e, t) => {
574
+ const r = v(t.layout ?? [4, 8]);
575
+ return [Math.min(Math.max(S(e[0]), 0), r[0] - 1), Math.min(Math.max(S(e[1]), 0), r[1] - 1)];
576
+ }, kt = (e, t, r = 0) => {
577
+ const n = [...e], i = [...t.size], s = v(t.layout ?? [4, 8]), f = $(n, i, r), o = r % 2 ? [i[1], i[0]] : [i[0], i[1]];
578
+ return [Math.min(Math.max(S(f[0] / o[0] * s[0], 1), 0), s[0] - 1), Math.min(Math.max(S(f[1] / o[1] * s[1], 1), 0), s[1] - 1)];
579
+ }, D = (e) => {
580
+ const t = String(e ?? "").trim();
581
+ return t ? (t.startsWith("/") ? t : `/${t}`).replace(/\/+/g, "/") : "/";
582
+ }, G = (e) => {
583
+ const t = D(e);
584
+ return t === "/user" || t.startsWith("/user/");
585
+ }, q = (e) => {
586
+ const t = D(e);
587
+ return t === "/user" ? "/" : t.startsWith("/user/") ? t.slice(5) || "/" : t;
588
+ }, Ht = (e) => q(e).replace(/^\/+/, ""), Lt = (e) => {
589
+ const t = D(e);
590
+ return G(t) ? t : t === "/" ? "/user/" : `/user${t}`;
591
+ }, zt = (e) => {
592
+ const t = D(e), r = q(t);
593
+ return G(t) ? Array.from(/* @__PURE__ */ new Set([r, t])) : [r];
594
+ }, Ft = (e) => e ? (e = e?.replace?.(/_/g, " ") || e, e = e?.charAt?.(0)?.toUpperCase?.() + e?.slice?.(1) || e, e) : "", Bt = (e, t, r = -1, n = null) => {
595
+ e?.indexOf?.(t) >= 0 ? e.splice(e.indexOf(t), 1) : r >= 0 && r < e?.length && e.splice(r, 1);
596
+ }, Ut = (e, t) => {
597
+ e?.indexOf?.(t) >= 0 && e.splice(e.indexOf(t), 1);
598
+ }, Se = (e, t) => {
599
+ e?.indexOf?.(t) < 0 && e.push(t);
600
+ }, Vt = (e, t, r = -1) => {
601
+ typeof r != "number" || r < 0 || r >= e?.length ? Se(e, t) : typeof r == "number" && e?.indexOf?.(t) < 0 && e.splice(r, 0, t);
602
+ }, T = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new Map(), ve = async (e) => {
603
+ try {
604
+ e = await e;
605
+ } catch (n) {
606
+ e = null, console.warn(n);
607
+ }
608
+ if (e == null) return null;
609
+ if (T.has(e) || e?.type != "application/json") return T.get(e);
610
+ const t = await e?.text?.()?.catch?.(console.warn.bind(console)) || "{}";
611
+ let r = {};
612
+ try {
613
+ r = JSON.parse(t);
614
+ } catch {
615
+ try {
616
+ r = JSON.parse(t);
617
+ } catch (i) {
618
+ console.warn(i);
619
+ }
620
+ }
621
+ return e && T.set(e, r), r;
622
+ }, $t = async (e, t) => {
623
+ try {
624
+ t = await t;
625
+ } catch (n) {
626
+ t = null, console.warn(n);
627
+ }
628
+ if (e == null) return null;
629
+ if (R.has(e)) return R.get(e);
630
+ const r = t != null ? await ve(t) : R?.get(e);
631
+ return e && R.set(e, r), r;
632
+ }, Gt = (e, t) => {
633
+ const r = /* @__PURE__ */ new Map();
634
+ e.forEach((i, s) => {
635
+ i?.name && r.set(i.name, {
636
+ item: i,
637
+ index: s
638
+ });
639
+ });
640
+ const n = /* @__PURE__ */ new Map();
641
+ t.forEach((i) => {
642
+ i?.name && n.set(i.name, i);
643
+ });
644
+ for (const [i, { index: s }] of r) {
645
+ const f = n.get(i);
646
+ f && (e[s] = f);
647
+ }
648
+ for (const [i, s] of n) r.has(i) || e.push(s);
649
+ for (let i = e.length - 1; i >= 0; i--) {
650
+ const s = e[i];
651
+ s?.name && !n.has(s.name) && e.splice(i, 1);
652
+ }
653
+ return e.sort((i, s) => i?.name?.localeCompare?.(s?.name ?? "")), e;
654
+ }, Me = /\+?\d[\d\s().\-]{4,}\d/g, Ae = /(доб\.?|доп\.?|ext\.?|extension)\s*[:#\-x]*\s*\d+.*/i, j = {
655
+ defaultTrunk: "8",
656
+ countryCode: "7",
657
+ cityCode: null,
658
+ stripExtensions: !0,
659
+ minLocal: 5,
660
+ maxLocal: 7
661
+ }, O = (e, t = {}) => {
662
+ if (e == null) return null;
663
+ const r = {
664
+ ...j,
665
+ ...t
666
+ };
667
+ let n = String(e).trim();
668
+ if (!n) return null;
669
+ r.stripExtensions && (n = n.replace(Ae, ""));
670
+ const i = /^\+/.test(n);
671
+ let s = n.replace(/\D/g, "");
672
+ if (!s) return null;
673
+ if (i && s.startsWith(r.countryCode)) s = r.defaultTrunk + s.slice(r.countryCode.length);
674
+ else if (s.length === 11 && s.startsWith(r.countryCode)) s = r.defaultTrunk + s.slice(1);
675
+ else if (s.length === 10) s = r.defaultTrunk + s;
676
+ else if (r.cityCode && s.length >= r.minLocal && s.length <= r.maxLocal) s = r.defaultTrunk + r.cityCode + s;
677
+ else if (!(s.length === 11 && s.startsWith(r.defaultTrunk)))
678
+ if (r.cityCode && s.length === r.cityCode.length + 7) s = r.defaultTrunk + s;
679
+ else return null;
680
+ return /^\d{11}$/.test(s) ? s : null;
681
+ }, L = (e) => {
682
+ if (e == null) return [];
683
+ const t = String(e), r = t.match(Me);
684
+ return r?.length ? r : t.split(/[;,/|]+/).map((n) => n.trim()).filter(Boolean);
685
+ }, Pe = (e, t = {}) => {
686
+ const r = /* @__PURE__ */ new Set();
687
+ if (Array.isArray(e)) for (const n of e) if (typeof n == "string") for (const i of L(n)) {
688
+ const s = O(i, t);
689
+ s && r.add(s);
690
+ }
691
+ else {
692
+ const i = O(n, t);
693
+ i && r.add(i);
694
+ }
695
+ else if (typeof e == "string") for (const n of L(e)) {
696
+ const i = O(n, t);
697
+ i && r.add(i);
698
+ }
699
+ else {
700
+ const n = O(e, t);
701
+ n && r.add(n);
702
+ }
703
+ return [...r];
704
+ }, we = (e, t) => Array.isArray(e) && typeof e[1] == "number" ? e[1] : e && typeof e == "object" && typeof e.index == "number" ? e.index : t, Ce = (e) => {
705
+ if (Array.isArray(e)) return e[0];
706
+ if (e && typeof e == "object") {
707
+ if ("phones" in e) return e.phones;
708
+ if ("phone" in e) return e.phone;
709
+ }
710
+ return e;
711
+ };
712
+ function qt(e, t = {}) {
713
+ const r = {
714
+ ...j,
715
+ ...t
716
+ }, n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
717
+ e.forEach((o, a) => {
718
+ const u = we(o, a), y = Ce(o), M = Pe(y, r);
719
+ i.has(u) || i.set(u, /* @__PURE__ */ new Set());
720
+ const P = i.get(u);
721
+ for (const h of M)
722
+ P.add(h), n.has(h) || n.set(h, /* @__PURE__ */ new Set()), n.get(h).add(u);
723
+ });
724
+ const s = {};
725
+ for (const [o, a] of n.entries()) a.size > 1 && (s[o] = [...a].sort((u, y) => u - y));
726
+ const f = {};
727
+ for (const [o, a] of i.entries()) {
728
+ const u = [...a].filter((y) => s[y]);
729
+ u.length && (f[o] = u.sort());
730
+ }
731
+ return {
732
+ duplicatesByNumber: s,
733
+ pairs: Object.entries(f).map(([o, a]) => [Number(o), a]).sort((o, a) => o[0] - a[0]),
734
+ duplicatesByIndex: f,
735
+ normalize: (o) => O(o, r)
736
+ };
737
+ }
738
+ var J = () => Intl.DateTimeFormat().resolvedOptions().timeZone;
739
+ function xe(e) {
740
+ return e ? /^([01]\d|2[0-3]):([0-5]\d)$/.test(String(e).trim()) : !1;
741
+ }
742
+ function A(e) {
743
+ if (!e) return /* @__PURE__ */ new Date();
744
+ if (e instanceof Date) return new Date(e);
745
+ if (typeof e == "object" && e?.timestamp) return A(e.timestamp);
746
+ if (typeof e == "object" && e?.iso_date) return A(e.iso_date);
747
+ if (typeof e == "object" && e?.date) return A(e.date);
748
+ if (typeof e == "number") {
749
+ if (e >= 1e12) return new Date(e);
750
+ const t = Math.pow(10, 11 - (String(e | 0)?.length || 11)) | 0;
751
+ return new Date(e * t);
752
+ }
753
+ if (typeof e == "string" && xe(e)) {
754
+ const t = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(e.trim());
755
+ if (!t) return /* @__PURE__ */ new Date();
756
+ const [, r, n] = t, i = /* @__PURE__ */ new Date();
757
+ return new Date(i.getFullYear(), i.getMonth(), i.getDate(), Number(r), Number(n), 0, 0);
758
+ }
759
+ return new Date(String(e));
760
+ }
761
+ function jt(e) {
762
+ return e ? typeof e == "number" ? e >= 1e12 ? e : e * (Math.pow(10, 11 - (String(e | 0)?.length || 11)) | 0) : e instanceof Date ? e.getTime() : A(e)?.getTime?.() ?? Date.now() : Date.now();
763
+ }
764
+ var Jt = (e) => {
765
+ if (!e) return null;
766
+ const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), r = t.getUTCDay() || 7;
767
+ t.setUTCDate(t.getUTCDate() + 4 - r);
768
+ const n = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
769
+ return Math.ceil(((t.getTime() - n.getTime()) / 864e5 + 1) / 7);
770
+ }, Oe = (e) => e ? typeof e == "object" && (e.date || e.iso_date || e.timestamp) ? e : { iso_date: String(e) } : null, Kt = (e) => {
771
+ const t = Oe(e);
772
+ return t && A(t)?.toLocaleTimeString?.("en-GB", {
773
+ hour: "2-digit",
774
+ minute: "2-digit",
775
+ hour12: !1,
776
+ timeZone: J()
777
+ }) || "";
778
+ }, Xt = (e) => A(e)?.toLocaleDateString?.("en-GB", {
779
+ day: "numeric",
780
+ month: "long",
781
+ weekday: "long",
782
+ year: "numeric",
783
+ timeZone: J()
784
+ }) || "", Zt = (e) => {
785
+ const t = new Date(e);
786
+ return Number.isNaN(t.getTime()) ? "" : t.toLocaleString(void 0, {
787
+ year: "numeric",
788
+ month: "short",
789
+ day: "2-digit",
790
+ hour: "2-digit",
791
+ minute: "2-digit"
792
+ });
793
+ }, l = (e) => {
794
+ if (e == null) return NaN;
795
+ if (typeof e == "number" && Number.isFinite(e)) return e;
796
+ const t = A(e);
797
+ if (t && !Number.isNaN(t?.getTime())) return t?.getTime() ?? 0;
798
+ const r = String(e).match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?/);
799
+ if (r) {
800
+ const i = Number(r[1]) || 0, s = Number(r[2]) || 0, f = Number(r[3]) || 0;
801
+ return ((i * 60 + s) * 60 + f) * 1e3;
802
+ }
803
+ const n = Number(e);
804
+ return Number.isFinite(n) ? n : NaN;
805
+ }, Yt = (e) => {
806
+ const t = e instanceof Date || typeof e == "string" && e.match(/^\d{4}-\d{2}-\d{2}$/);
807
+ let r = !1;
808
+ try {
809
+ r = l(e) > 0;
810
+ } catch {
811
+ r = !1;
812
+ }
813
+ return !!((t && r) ?? !1);
814
+ }, Qt = (e, t, r) => e && t ? l(e) < l(r) && l(r) < l(t) : e ? l(e) < l(r) : t ? l(r) < l(t) : !1, er = (e, t, r, n = 7) => {
815
+ let i = !0;
816
+ if (e && (i &&= l(r) <= l(e)), t && (i &&= l(r) < l(t)), n) {
817
+ const s = l(r) + n * 24 * 60 * 60 * 1e3;
818
+ i &&= l(e) < l(s);
819
+ }
820
+ return i;
821
+ }, tr = (e, t) => {
822
+ const r = l(e) || 0, n = (Number.isFinite(r) ? r : 0) - (t || 0);
823
+ return Math.round(n / (1440 * 60 * 1e3));
824
+ };
825
+ function rr(e, t) {
826
+ let r;
827
+ return (...n) => {
828
+ clearTimeout(r), r = setTimeout(() => e(...n), t);
829
+ };
830
+ }
831
+ function nr(e, t) {
832
+ let r = !1;
833
+ return (...n) => {
834
+ r || (e(...n), r = !0, setTimeout(() => r = !1, t));
835
+ };
836
+ }
837
+ function ir(e) {
838
+ return new Promise((t) => setTimeout(t, e));
839
+ }
840
+ function sr(e = "") {
841
+ return `${e}${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
842
+ }
843
+ function z(e) {
844
+ if (e === null || typeof e != "object") return e;
845
+ if (e instanceof Date) return new Date(e.getTime());
846
+ if (e instanceof Array) return e.map((t) => z(t));
847
+ if (e instanceof Object) {
848
+ const t = {};
849
+ for (const r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = z(e[r]));
850
+ return t;
851
+ }
852
+ return e;
853
+ }
854
+ function or(e) {
855
+ return e == null ? !0 : typeof e == "string" ? e.trim().length === 0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
856
+ }
857
+ function fr() {
858
+ return typeof window < "u" && typeof document < "u";
859
+ }
860
+ function ar() {
861
+ return typeof self < "u" && typeof window > "u";
862
+ }
863
+ K();
864
+ export {
865
+ Qe as $avoidTrigger,
866
+ F as $fxy,
867
+ Q as $getValue,
868
+ ze as $set,
869
+ I as $triggerLock,
870
+ Te as AsyncQueue,
871
+ Z as ChannelHealthMonitor,
872
+ X as ChannelRegistry,
873
+ Ae as EXT_CUT_RE,
874
+ ve as GET_OR_CACHE,
875
+ $t as GET_OR_CACHE_BY_NAME,
876
+ re as INTEGER_REGEXP,
877
+ Me as PHONE_CANDIDATE_RE,
878
+ Se as PUSH_ONCE,
879
+ ye as Promised,
880
+ Ut as REMOVE_IF_HAS,
881
+ Bt as REMOVE_IF_HAS_SIMILAR,
882
+ Vt as SPLICE_INTO_ONCE,
883
+ Ve as UUIDv4,
884
+ bt as WRef,
885
+ Mt as bindCtx,
886
+ Ot as bindEvent,
887
+ ae as bindFx,
888
+ ce as boundCtx,
889
+ T as cachedPerFile,
890
+ R as cachedPerFileName,
891
+ ue as callByAllProp,
892
+ W as callByProp,
893
+ $e as camelToKebab,
894
+ rt as canBeInteger,
895
+ Ke as ceilNearest,
896
+ Qt as checkInTimeRange,
897
+ er as checkRemainsTime,
898
+ Be as clamp,
899
+ je as clampDimension,
900
+ me as clampGridCellTuple,
901
+ kt as clientSpaceInOrientCX,
902
+ tr as computeTimelineOrderInGeneral,
903
+ Ie as concurrentLimit,
904
+ xt as contextify,
905
+ ge as convertOrientPxToCX,
906
+ De as createChannelProxy,
907
+ be as createDeferred,
908
+ $ as cvt_cs_to_os,
909
+ Tt as cvt_os_to_cs,
910
+ Rt as cvt_rel_cs_to_os,
911
+ Et as cvt_rel_os_to_cs,
912
+ rr as debounce,
913
+ z as deepClone,
914
+ b as deepOperateAndClone,
915
+ pt as defaultByType,
916
+ E as deref,
917
+ qt as findDuplicatePhones,
918
+ ee as fixFx,
919
+ Nt as floorInCX,
920
+ Wt as floorInOrientPx,
921
+ Je as floorNearest,
922
+ Xt as formatAsDate,
923
+ Kt as formatAsTime,
924
+ Zt as formatDateTime,
925
+ l as getComparableTimeValue,
926
+ Jt as getISOWeekNumber,
927
+ we as getIndexForRow,
928
+ Ne as getOrInsert,
929
+ ke as getOrInsertComputed,
930
+ Ce as getPhonesFromRow,
931
+ te as getRandomValues,
932
+ _t as getSpan,
933
+ J as getTimeZone,
934
+ ut as getValue,
935
+ We as globalChannelHealthMonitor,
936
+ _e as globalChannelRegistry,
937
+ de as gridItemsAsArray,
938
+ it as handleListeners,
939
+ k as hasProperty,
940
+ B as hasValue,
941
+ Ct as inProxy,
942
+ wt as isArrayInvalidKey,
943
+ nt as isArrayOrIterable,
944
+ fr as isBrowser,
945
+ x as isCanJustReturn,
946
+ dt as isCanTransfer,
947
+ Yt as isDate,
948
+ or as isEmpty,
949
+ He as isHasPrimitives,
950
+ w as isIterable,
951
+ gt as isKeyType,
952
+ ie as isNotComplexArray,
953
+ _ as isNotEqual,
954
+ at as isObject,
955
+ Pt as isObjectNotEqual,
956
+ Le as isObservable,
957
+ g as isPrimitive,
958
+ mt as isPromise,
959
+ xe as isPureHHMM,
960
+ U as isRef,
961
+ ht as isSymbol,
962
+ se as isTypedArray,
963
+ G as isUserScopePath,
964
+ Ze as isVal,
965
+ tt as isValidNumber,
966
+ St as isValidObj,
967
+ ft as isValueRef,
968
+ Xe as isValueUnit,
969
+ ar as isWorker,
970
+ Ge as kebabToCamel,
971
+ Dt as makeOrientInset,
972
+ yt as makeTriggerLess,
973
+ Gt as mergeByExists,
974
+ vt as mergeByKey,
975
+ v as normalizeGridLayout,
976
+ O as normalizeOne,
977
+ Pe as normalizePhones,
978
+ Ye as normalizePrimitive,
979
+ Oe as normalizeSchedule,
980
+ fe as objectAssign,
981
+ At as objectAssignNotEqual,
982
+ jt as parseAndGetCorrectTime,
983
+ A as parseDateCorrectly,
984
+ ct as potentiallyAsync,
985
+ lt as potentiallyAsyncMap,
986
+ pe as redirectCell,
987
+ oe as removeExtra,
988
+ Ft as renderTabName,
989
+ It as resolveLocalPointToGridCell,
990
+ Ee as retry,
991
+ S as roundNearest,
992
+ ir as sleep,
993
+ L as splitCandidates,
994
+ q as stripUserScopePrefix,
995
+ nr as throttle,
996
+ qe as toFiniteNumber,
997
+ ot as toRef,
998
+ Ht as toUserRelativePath,
999
+ Lt as toUserScopePath,
1000
+ Y as tryParseByHint,
1001
+ ne as tryStringAsInteger,
1002
+ et as tryStringAsNumber,
1003
+ sr as uniqueId,
1004
+ st as unref,
1005
+ c as unwrap,
1006
+ V as unwrapArray,
1007
+ zt as userPathCandidates,
1008
+ Fe as valueClamp,
1009
+ Ue as withCtx,
1010
+ Re as withTimeout
1011
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@fest-lib/core",
3
+ "description": "Core JavaScript/TypeScript utilities (fest-lib)",
4
+ "version": "0.1.1",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "node": ">=20"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/fest-live/core.ts.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/fest-live/core.ts/issues"
20
+ },
21
+ "homepage": "https://github.com/fest-live/core.ts#readme",
22
+ "keywords": [
23
+ "fest",
24
+ "fest-lib",
25
+ "utilities",
26
+ "typescript"
27
+ ],
28
+ "files": [
29
+ "dist",
30
+ "LICENSE"
31
+ ],
32
+ "main": "./dist/core.js",
33
+ "module": "./dist/core.js",
34
+ "exports": {
35
+ ".": {
36
+ "import": "./dist/core.js",
37
+ "default": "./dist/core.js"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "scripts": {
42
+ "test": "vite --host 0.0.0.0",
43
+ "dev": "vite --host 0.0.0.0",
44
+ "watch": "vite build --watch",
45
+ "build": "vite build --config vite.config.js && npm run docs && npm run docs:md",
46
+ "build:publish": "FEST_NPM_IMPORTS=1 vite build --config vite.config.js",
47
+ "publish": "npm publish --tag beta --access public",
48
+ "prepack": "npm run build:publish",
49
+ "preview": "vite preview",
50
+ "docs": "typedoc ./src/index.ts --options ./typedoc.json --out ./docs --tsconfig ./tsconfig.json --excludeExternals --excludePrivate --excludeProtected --skipErrorChecking",
51
+ "docs:clean": "rm -rf ./docs && typedoc --options ./typedoc.json",
52
+ "docs:md": "typedoc --options ./typedoc.md.json",
53
+ "docs:md:clean": "rm -rf ./docs-md && typedoc --options ./typedoc.md.json"
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": ">=24.7.2",
57
+ "typedoc": "^0.28.20",
58
+ "typedoc-plugin-markdown": "^4.12.0",
59
+ "typescript": ">=6.0.0-beta",
60
+ "vite": "^8.0.7",
61
+ "vite-plugin-dynamic-import": ">=1.6.0",
62
+ "vite-plugin-external": ">=6.2.2"
63
+ }
64
+ }