@mjsz-vbr-elements/core 2.21.1 → 2.22.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.
@@ -1,803 +0,0 @@
1
- /**
2
- * name: @mjsz-vbr-elements/core
3
- * version: v2.21.1 - 12/03/2025, 07:49:08
4
- * (c) 2025
5
- * description: Data visualization for MJSZ VBR
6
- * author: Ákos Stegner <akos.stegner@gmail.com>
7
- */
8
- import { ref as I, watch as x, unref as O, reactive as pe, defineComponent as De, h as ke, computed as C, provide as me, inject as ye, onErrorCaptured as Le, readonly as he, nextTick as z, getCurrentScope as Ne, onScopeDispose as _e, toValue as A, isRef as Fe, shallowRef as ae } from "vue";
9
- import { _ as K, w as Be, x as We, z as Y, A as Me, B as $e, C as ve, D as W, E as ge, F as Ue, G as se, H as _, I as F, J as ze, K as Ke, u as Ge } from "./datetime-K_d-hEsO.js";
10
- import { SORT_STATE_ORIGINAL as M, SORT_STATE_DESCEND as Q, SORT_STATE_ASCEND as U } from "./constants.js";
11
- function qe(e) {
12
- var t = Object.prototype.toString.call(e);
13
- return t === "[object Uint8ClampedArray]" || t === "[object Int8Array]" || t === "[object Uint8Array]" || t === "[object Int16Array]" || t === "[object Uint16Array]" || t === "[object Int32Array]" || t === "[object Uint32Array]" || t === "[object Float32Array]" || t === "[object Float64Array]" || t === "[object BigInt64Array]" || t === "[object BigUint64Array]";
14
- }
15
- var He = /* @__PURE__ */ K(function(t) {
16
- return t != null && typeof t["fantasy-land/empty"] == "function" ? t["fantasy-land/empty"]() : t != null && t.constructor != null && typeof t.constructor["fantasy-land/empty"] == "function" ? t.constructor["fantasy-land/empty"]() : t != null && typeof t.empty == "function" ? t.empty() : t != null && t.constructor != null && typeof t.constructor.empty == "function" ? t.constructor.empty() : Be(t) ? [] : We(t) ? "" : Y(t) ? {} : Me(t) ? /* @__PURE__ */ function() {
17
- return arguments;
18
- }() : qe(t) ? t.constructor.from("") : void 0;
19
- }), Je = /* @__PURE__ */ K(function(t) {
20
- return t != null && $e(t, He(t));
21
- }), Qe = /* @__PURE__ */ ve(function(t, r, n) {
22
- var i = {}, o;
23
- r = r || {}, n = n || {};
24
- for (o in r)
25
- W(o, r) && (i[o] = W(o, n) ? t(o, r[o], n[o]) : r[o]);
26
- for (o in n)
27
- W(o, n) && !W(o, i) && (i[o] = n[o]);
28
- return i;
29
- }), Ve = /* @__PURE__ */ ve(function e(t, r, n) {
30
- return Qe(function(i, o, u) {
31
- return Y(o) && Y(u) ? e(t, o, u) : t(i, o, u);
32
- }, r, n);
33
- }), Xe = /* @__PURE__ */ ge(function(t, r) {
34
- return Ve(function(n, i, o) {
35
- return o;
36
- }, t, r);
37
- }), Ye = /* @__PURE__ */ ge(function(t, r) {
38
- for (var n = {}, i = {}, o = 0, u = t.length; o < u; )
39
- i[t[o]] = 1, o += 1;
40
- for (var a in r)
41
- i.hasOwnProperty(a) || (n[a] = r[a]);
42
- return n;
43
- }), k = `
44
- \v\f\r                 \u2028\u2029\uFEFF`, Ze = "​", et = typeof String.prototype.trim == "function", G = !et || /* @__PURE__ */ k.trim() || !/* @__PURE__ */ Ze.trim() ? /* @__PURE__ */ K(function(t) {
45
- var r = new RegExp("^[" + k + "][" + k + "]*"), n = new RegExp("[" + k + "][" + k + "]*$");
46
- return t.replace(r, "").replace(n, "");
47
- }) : /* @__PURE__ */ K(function(t) {
48
- return t.trim();
49
- });
50
- function St(e, t, r, n) {
51
- const i = I(""), o = I(!1), u = (a) => {
52
- const s = Ue(se(t), a), d = s.length > 0;
53
- if (o.value = d, !d)
54
- return i.value = "";
55
- const c = s.map((p) => ({
56
- team: p.team.longName,
57
- points: Math.abs(se(t, p))
58
- })).map((p) => r(`additionalText.${t}.content`, p)).join(", ");
59
- i.value = [
60
- r(`additionalText.${t}.prependix`),
61
- c,
62
- ...r(`additionalText.${t}.appendix`) && [r(`additionalText.${t}.appendix`)]
63
- ].join(" ");
64
- };
65
- return x(e, u, { immediate: !0 }), x(
66
- () => O(n),
67
- () => u(O(e))
68
- ), {
69
- text: i,
70
- isVisible: o
71
- };
72
- }
73
- const be = Symbol("I18nContext"), T = pe({
74
- messages: {},
75
- locale: "",
76
- fallbackLocale: ""
77
- });
78
- function Pt({ messages: e = {}, locale: t = "", fallbackLocale: r = "" }) {
79
- T.messages = Xe(T.messages, e), T.locale = t, T.fallbackLocale = r;
80
- const n = (s, d = {}) => {
81
- const y = !Je(d), c = _(G, F(".", s));
82
- return C(() => {
83
- const h = we(c);
84
- return y ? rt(h, d) : h;
85
- }).value;
86
- }, i = (s) => {
87
- const d = _(G, F(".", s));
88
- return !!Z(T.locale, d, T.messages);
89
- }, o = (s) => {
90
- T.locale = s;
91
- }, a = {
92
- locale: C({
93
- get() {
94
- return T.locale;
95
- },
96
- set(s) {
97
- T.locale = s;
98
- }
99
- }),
100
- setLocale: o,
101
- translate: n,
102
- hasTranslation: i
103
- };
104
- return me(be, a), {
105
- translate: n
106
- };
107
- }
108
- function tt(e) {
109
- e && (T.messages = e.messages, T.locale = e.locale, T.fallbackLocale = e.fallbackLocale);
110
- const t = nt();
111
- return {
112
- locale: t.locale,
113
- t: t.translate,
114
- setLocale: t.setLocale,
115
- hasTranslation: t.hasTranslation
116
- };
117
- }
118
- function nt() {
119
- const e = ye(be, null);
120
- if (e === null)
121
- throw new Error("Provider is missing a parent component.");
122
- return e;
123
- }
124
- function we(e = []) {
125
- let t = Z(T.locale, e, T.messages);
126
- return !t && T.fallbackLocale && (t = Z(T.fallbackLocale, e, T.messages)), t || e.join(".");
127
- }
128
- function Z(e, t, r) {
129
- return ze([e, ...t], r);
130
- }
131
- function rt(e, t) {
132
- return e.replace(/\{(\w+)\}/g, (r, n) => t[n]);
133
- }
134
- const Ct = De({
135
- props: {
136
- tag: {
137
- type: String,
138
- default: "div"
139
- },
140
- path: {
141
- type: String,
142
- defult: ""
143
- }
144
- },
145
- setup(e, { slots: t }) {
146
- const r = _(G, F(".", e.path)), n = we(r), i = F(/\{|\}/, n), o = Object.keys(t).map((u) => {
147
- const a = i.indexOf(u);
148
- return a > -1 && (i[a] = t[u]()[0]), i;
149
- });
150
- return () => ke(e.tag, o);
151
- }
152
- });
153
- function Rt(e, t = "", r = {}) {
154
- const n = I(""), { t: i } = tt(), o = C(() => {
155
- if (O(t))
156
- try {
157
- const s = ot(O(e), O(t));
158
- return Ye(s, O(e));
159
- } catch (s) {
160
- n.value = s;
161
- }
162
- return O(e);
163
- }), u = (s) => ({
164
- ...s,
165
- ...s.label && { label: i(s.label ?? "", O(r)) },
166
- ...s.tooltip && { tooltip: i(s.tooltip ?? "") }
167
- });
168
- return {
169
- columns: C(() => _(u, o.value)),
170
- error: n
171
- };
172
- }
173
- function ot(e, t = "") {
174
- const r = _(G, F(",", t)), n = Ke(e);
175
- if (r[0] === "")
176
- return [];
177
- const i = r.findIndex((o) => !n.includes(o));
178
- if (i > -1)
179
- throw r[i];
180
- return r;
181
- }
182
- const Te = Symbol("ErrorProviderContext");
183
- function jt() {
184
- const e = I(""), t = I({}), r = (o) => {
185
- console.error({ error: o }), e.value = o.message || o.error.message, t.value = {
186
- message: o.message,
187
- key: o.key || Ge(o.message),
188
- cause: o.cause
189
- };
190
- }, n = () => {
191
- e.value = "", t.value = {};
192
- };
193
- return me(Te, {
194
- onError: r,
195
- reset: n
196
- }), window.onerror = (o) => {
197
- console.error("WINDOW_ONERROR:", o);
198
- }, Le((o, u, a) => {
199
- console.error("onErrorCaptured:", o, u, a);
200
- }), {
201
- hasError: C(() => e.value.length > 0),
202
- message: e,
203
- error: t,
204
- reset: n,
205
- onError: r
206
- };
207
- }
208
- function Dt() {
209
- const e = it();
210
- return {
211
- onError: e.onError,
212
- reset: e.reset
213
- };
214
- }
215
- function it() {
216
- const e = ye(Te, null);
217
- if (e === null)
218
- throw new Error("Provider is missing a parent component.");
219
- return e;
220
- }
221
- function Ae(e) {
222
- return Ne() ? (_e(e), !0) : !1;
223
- }
224
- const q = typeof window < "u" && typeof document < "u";
225
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
226
- const at = Object.prototype.toString, st = (e) => at.call(e) === "[object Object]", N = () => {
227
- }, ut = /* @__PURE__ */ ct();
228
- function ct() {
229
- var e, t;
230
- return q && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
231
- }
232
- function lt(e, t) {
233
- function r(...n) {
234
- return new Promise((i, o) => {
235
- Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(i).catch(o);
236
- });
237
- }
238
- return r;
239
- }
240
- const Ee = (e) => e();
241
- function ft(e = Ee) {
242
- const t = I(!0);
243
- function r() {
244
- t.value = !1;
245
- }
246
- function n() {
247
- t.value = !0;
248
- }
249
- const i = (...o) => {
250
- t.value && e(...o);
251
- };
252
- return { isActive: he(t), pause: r, resume: n, eventFilter: i };
253
- }
254
- function ee(e, t = !1, r = "Timeout") {
255
- return new Promise((n, i) => {
256
- setTimeout(t ? () => i(r) : n, e);
257
- });
258
- }
259
- function V(e) {
260
- return Array.isArray(e) ? e : [e];
261
- }
262
- function dt(e, t, r = {}) {
263
- const {
264
- eventFilter: n = Ee,
265
- ...i
266
- } = r;
267
- return x(
268
- e,
269
- lt(
270
- n,
271
- t
272
- ),
273
- i
274
- );
275
- }
276
- function kt(e, t, r = {}) {
277
- const {
278
- eventFilter: n,
279
- ...i
280
- } = r, { eventFilter: o, pause: u, resume: a, isActive: s } = ft(n);
281
- return { stop: dt(
282
- e,
283
- t,
284
- {
285
- ...i,
286
- eventFilter: o
287
- }
288
- ), pause: u, resume: a, isActive: s };
289
- }
290
- function te(e, t = !1) {
291
- function r(c, { flush: p = "sync", deep: h = !1, timeout: v, throwOnTimeout: l } = {}) {
292
- let f = null;
293
- const b = [new Promise((E) => {
294
- f = x(
295
- e,
296
- (g) => {
297
- c(g) !== t && (f ? f() : z(() => f == null ? void 0 : f()), E(g));
298
- },
299
- {
300
- flush: p,
301
- deep: h,
302
- immediate: !0
303
- }
304
- );
305
- })];
306
- return v != null && b.push(
307
- ee(v, l).then(() => A(e)).finally(() => f == null ? void 0 : f())
308
- ), Promise.race(b);
309
- }
310
- function n(c, p) {
311
- if (!Fe(c))
312
- return r((g) => g === c, p);
313
- const { flush: h = "sync", deep: v = !1, timeout: l, throwOnTimeout: f } = p ?? {};
314
- let m = null;
315
- const E = [new Promise((g) => {
316
- m = x(
317
- [e, c],
318
- ([D, B]) => {
319
- t !== (D === B) && (m ? m() : z(() => m == null ? void 0 : m()), g(D));
320
- },
321
- {
322
- flush: h,
323
- deep: v,
324
- immediate: !0
325
- }
326
- );
327
- })];
328
- return l != null && E.push(
329
- ee(l, f).then(() => A(e)).finally(() => (m == null || m(), A(e)))
330
- ), Promise.race(E);
331
- }
332
- function i(c) {
333
- return r((p) => !!p, c);
334
- }
335
- function o(c) {
336
- return n(null, c);
337
- }
338
- function u(c) {
339
- return n(void 0, c);
340
- }
341
- function a(c) {
342
- return r(Number.isNaN, c);
343
- }
344
- function s(c, p) {
345
- return r((h) => {
346
- const v = Array.from(h);
347
- return v.includes(c) || v.includes(A(c));
348
- }, p);
349
- }
350
- function d(c) {
351
- return y(1, c);
352
- }
353
- function y(c = 1, p) {
354
- let h = -1;
355
- return r(() => (h += 1, h >= c), p);
356
- }
357
- return Array.isArray(A(e)) ? {
358
- toMatch: r,
359
- toContains: s,
360
- changed: d,
361
- changedTimes: y,
362
- get not() {
363
- return te(e, !t);
364
- }
365
- } : {
366
- toMatch: r,
367
- toBe: n,
368
- toBeTruthy: i,
369
- toBeNull: o,
370
- toBeNaN: a,
371
- toBeUndefined: u,
372
- changed: d,
373
- changedTimes: y,
374
- get not() {
375
- return te(e, !t);
376
- }
377
- };
378
- }
379
- function pt(e) {
380
- return te(e);
381
- }
382
- function mt(e, t, r = {}) {
383
- const {
384
- immediate: n = !0
385
- } = r, i = I(!1);
386
- let o = null;
387
- function u() {
388
- o && (clearTimeout(o), o = null);
389
- }
390
- function a() {
391
- i.value = !1, u();
392
- }
393
- function s(...d) {
394
- u(), i.value = !0, o = setTimeout(() => {
395
- i.value = !1, o = null, e(...d);
396
- }, A(t));
397
- }
398
- return n && (i.value = !0, q && s()), Ae(a), {
399
- isPending: he(i),
400
- start: s,
401
- stop: a
402
- };
403
- }
404
- function yt(e, t, r) {
405
- return x(
406
- e,
407
- t,
408
- {
409
- ...r,
410
- immediate: !0
411
- }
412
- );
413
- }
414
- function Lt(e, t, r) {
415
- const n = x(e, (...i) => (z(() => n()), t(...i)), r);
416
- return n;
417
- }
418
- function Nt(e, t, r) {
419
- const n = x(
420
- e,
421
- (i, o, u) => {
422
- i && (r != null && r.once && z(() => n()), t(i, o, u));
423
- },
424
- {
425
- ...r,
426
- once: !1
427
- }
428
- );
429
- return n;
430
- }
431
- const Ie = q ? window : void 0, ht = q ? window.document : void 0;
432
- function L(e) {
433
- var t;
434
- const r = A(e);
435
- return (t = r == null ? void 0 : r.$el) != null ? t : r;
436
- }
437
- function j(...e) {
438
- const t = [], r = () => {
439
- t.forEach((a) => a()), t.length = 0;
440
- }, n = (a, s, d, y) => (a.addEventListener(s, d, y), () => a.removeEventListener(s, d, y)), i = C(() => {
441
- const a = V(A(e[0])).filter((s) => s != null);
442
- return a.every((s) => typeof s != "string") ? a : void 0;
443
- }), o = yt(
444
- () => {
445
- var a, s;
446
- return [
447
- (s = (a = i.value) == null ? void 0 : a.map((d) => L(d))) != null ? s : [Ie].filter((d) => d != null),
448
- V(A(i.value ? e[1] : e[0])),
449
- V(O(i.value ? e[2] : e[1])),
450
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
451
- A(i.value ? e[3] : e[2])
452
- ];
453
- },
454
- ([a, s, d, y]) => {
455
- if (r(), !(a != null && a.length) || !(s != null && s.length) || !(d != null && d.length))
456
- return;
457
- const c = st(y) ? { ...y } : y;
458
- t.push(
459
- ...a.flatMap(
460
- (p) => s.flatMap(
461
- (h) => d.map((v) => n(p, h, v, c))
462
- )
463
- )
464
- );
465
- },
466
- { flush: "post" }
467
- ), u = () => {
468
- o(), r();
469
- };
470
- return Ae(r), u;
471
- }
472
- let ue = !1;
473
- function _t(e, t, r = {}) {
474
- const { window: n = Ie, ignore: i = [], capture: o = !0, detectIframe: u = !1 } = r;
475
- if (!n)
476
- return N;
477
- if (ut && !ue) {
478
- ue = !0;
479
- const l = { passive: !0 };
480
- Array.from(n.document.body.children).forEach((f) => j(f, "click", N, l)), j(n.document.documentElement, "click", N, l);
481
- }
482
- let a = !0;
483
- const s = (l) => A(i).some((f) => {
484
- if (typeof f == "string")
485
- return Array.from(n.document.querySelectorAll(f)).some((m) => m === l.target || l.composedPath().includes(m));
486
- {
487
- const m = L(f);
488
- return m && (l.target === m || l.composedPath().includes(m));
489
- }
490
- });
491
- function d(l) {
492
- const f = A(l);
493
- return f && f.$.subTree.shapeFlag === 16;
494
- }
495
- function y(l, f) {
496
- const m = A(l), b = m.$.subTree && m.$.subTree.children;
497
- return b == null || !Array.isArray(b) ? !1 : b.some((E) => E.el === f.target || f.composedPath().includes(E.el));
498
- }
499
- const c = (l) => {
500
- const f = L(e);
501
- if (l.target != null && !(!(f instanceof Element) && d(e) && y(e, l)) && !(!f || f === l.target || l.composedPath().includes(f))) {
502
- if (l.detail === 0 && (a = !s(l)), !a) {
503
- a = !0;
504
- return;
505
- }
506
- t(l);
507
- }
508
- };
509
- let p = !1;
510
- const h = [
511
- j(n, "click", (l) => {
512
- p || (p = !0, setTimeout(() => {
513
- p = !1;
514
- }, 0), c(l));
515
- }, { passive: !0, capture: o }),
516
- j(n, "pointerdown", (l) => {
517
- const f = L(e);
518
- a = !s(l) && !!(f && !l.composedPath().includes(f));
519
- }, { passive: !0 }),
520
- u && j(n, "blur", (l) => {
521
- setTimeout(() => {
522
- var f;
523
- const m = L(e);
524
- ((f = n.document.activeElement) == null ? void 0 : f.tagName) === "IFRAME" && !(m != null && m.contains(n.document.activeElement)) && t(l);
525
- }, 0);
526
- }, { passive: !0 })
527
- ].filter(Boolean);
528
- return () => h.forEach((l) => l());
529
- }
530
- function vt(e, t, r) {
531
- const {
532
- immediate: n = !0,
533
- delay: i = 0,
534
- onError: o = N,
535
- onSuccess: u = N,
536
- resetOnExecute: a = !0,
537
- shallow: s = !0,
538
- throwError: d
539
- } = r ?? {}, y = s ? ae(t) : I(t), c = I(!1), p = I(!1), h = ae(void 0);
540
- async function v(m = 0, ...b) {
541
- a && (y.value = t), h.value = void 0, c.value = !1, p.value = !0, m > 0 && await ee(m);
542
- const E = typeof e == "function" ? e(...b) : e;
543
- try {
544
- const g = await E;
545
- y.value = g, c.value = !0, u(g);
546
- } catch (g) {
547
- if (h.value = g, o(g), d)
548
- throw g;
549
- } finally {
550
- p.value = !1;
551
- }
552
- return y.value;
553
- }
554
- n && v(i);
555
- const l = {
556
- state: y,
557
- isReady: c,
558
- isLoading: p,
559
- error: h,
560
- execute: v
561
- };
562
- function f() {
563
- return new Promise((m, b) => {
564
- pt(p).toBe(!1).then(() => m(l)).catch(b);
565
- });
566
- }
567
- return {
568
- ...l,
569
- then(m, b) {
570
- return f().then(m, b);
571
- }
572
- };
573
- }
574
- function Ft(e = {}) {
575
- const { document: t = ht } = e;
576
- if (!t)
577
- return I("visible");
578
- const r = I(t.visibilityState);
579
- return j(t, "visibilitychange", () => {
580
- r.value = t.visibilityState;
581
- }, { passive: !0 }), r;
582
- }
583
- async function gt(e) {
584
- return new Promise((t, r) => {
585
- const n = new Image(), { src: i, srcset: o, sizes: u, class: a, loading: s, crossorigin: d, referrerPolicy: y, width: c, height: p, decoding: h, fetchPriority: v, ismap: l, usemap: f } = e;
586
- n.src = i, o != null && (n.srcset = o), u != null && (n.sizes = u), a != null && (n.className = a), s != null && (n.loading = s), d != null && (n.crossOrigin = d), y != null && (n.referrerPolicy = y), c != null && (n.width = c), p != null && (n.height = p), h != null && (n.decoding = h), v != null && (n.fetchPriority = v), l != null && (n.isMap = l), f != null && (n.useMap = f), n.onload = () => t(n), n.onerror = r;
587
- });
588
- }
589
- function Bt(e, t = {}) {
590
- const r = vt(
591
- () => gt(A(e)),
592
- void 0,
593
- {
594
- resetOnExecute: !0,
595
- ...t
596
- }
597
- );
598
- return x(
599
- () => A(e),
600
- () => r.execute(t.delay),
601
- { deep: !0 }
602
- ), r;
603
- }
604
- function Wt(e = [], t = {}) {
605
- const { delay: r = 0 } = t, n = I(!1), i = C(() => {
606
- const a = O(e);
607
- return Array.isArray(a) ? a.map((s) => O(s)).some(Boolean) : a;
608
- }), { start: o, stop: u } = mt(() => {
609
- n.value = !0;
610
- }, r);
611
- return x(
612
- i,
613
- (a) => {
614
- if (a)
615
- return o();
616
- u(), n.value = !1;
617
- },
618
- { immediate: !0, deep: !0 }
619
- ), n;
620
- }
621
- /*! *****************************************************************************
622
- Copyright (c) Microsoft Corporation.
623
-
624
- Permission to use, copy, modify, and/or distribute this software for any
625
- purpose with or without fee is hereby granted.
626
-
627
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
628
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
629
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
630
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
631
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
632
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
633
- PERFORMANCE OF THIS SOFTWARE.
634
- ***************************************************************************** */
635
- function X(e, t) {
636
- var r = typeof Symbol == "function" && e[Symbol.iterator];
637
- if (!r) return e;
638
- var n, i, o = r.call(e), u = [];
639
- try {
640
- for (; (t === void 0 || t-- > 0) && !(n = o.next()).done; ) u.push(n.value);
641
- } catch (a) {
642
- i = { error: a };
643
- } finally {
644
- try {
645
- n && !n.done && (r = o.return) && r.call(o);
646
- } finally {
647
- if (i) throw i.error;
648
- }
649
- }
650
- return u;
651
- }
652
- var ce;
653
- (function(e) {
654
- e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped";
655
- })(ce || (ce = {}));
656
- var bt = { type: "xstate.init" };
657
- function $(e) {
658
- return e === void 0 ? [] : [].concat(e);
659
- }
660
- function le(e, t) {
661
- return typeof (e = typeof e == "string" && t && t[e] ? t[e] : e) == "string" ? { type: e } : typeof e == "function" ? { type: e.name, exec: e } : e;
662
- }
663
- function ne(e) {
664
- return function(t) {
665
- return e === t;
666
- };
667
- }
668
- function wt(e) {
669
- return typeof e == "string" ? { type: e } : e;
670
- }
671
- function fe(e, t) {
672
- return { value: e, context: t, actions: [], changed: !1, matches: ne(e) };
673
- }
674
- function de(e, t, r) {
675
- var n = t, i = !1;
676
- return [e.filter(function(o) {
677
- if (o.type === "xstate.assign") {
678
- i = !0;
679
- var u = Object.assign({}, n);
680
- return typeof o.assignment == "function" ? u = o.assignment(n, r) : Object.keys(o.assignment).forEach(function(a) {
681
- u[a] = typeof o.assignment[a] == "function" ? o.assignment[a](n, r) : o.assignment[a];
682
- }), n = u, !1;
683
- }
684
- return !0;
685
- }), n, i];
686
- }
687
- function Tt(e, t) {
688
- t === void 0 && (t = {});
689
- var r = X(de($(e.states[e.initial].entry).map(function(u) {
690
- return le(u, t.actions);
691
- }), e.context, bt), 2), n = r[0], i = r[1], o = { config: e, _options: t, initialState: { value: e.initial, actions: n, context: i, matches: ne(e.initial) }, transition: function(u, a) {
692
- var s, d, y = typeof u == "string" ? { value: u, context: e.context } : u, c = y.value, p = y.context, h = wt(a), v = e.states[c];
693
- if (v.on) {
694
- var l = $(v.on[h.type]);
695
- "*" in v.on && l.push.apply(l, function(w, S, J) {
696
- if (arguments.length === 2) for (var P, R = 0, je = S.length; R < je; R++) !P && R in S || (P || (P = Array.prototype.slice.call(S, 0, R)), P[R] = S[R]);
697
- return w.concat(P || Array.prototype.slice.call(S));
698
- }([], X($(v.on["*"])), !1));
699
- try {
700
- for (var f = function(w) {
701
- var S = typeof Symbol == "function" && Symbol.iterator, J = S && w[S], P = 0;
702
- if (J) return J.call(w);
703
- if (w && typeof w.length == "number") return { next: function() {
704
- return w && P >= w.length && (w = void 0), { value: w && w[P++], done: !w };
705
- } };
706
- throw new TypeError(S ? "Object is not iterable." : "Symbol.iterator is not defined.");
707
- }(l), m = f.next(); !m.done; m = f.next()) {
708
- var b = m.value;
709
- if (b === void 0) return fe(c, p);
710
- var E = typeof b == "string" ? { target: b } : b, g = E.target, D = E.actions, B = D === void 0 ? [] : D, re = E.cond, Oe = re === void 0 ? function() {
711
- return !0;
712
- } : re, xe = g === void 0, Se = g ?? c, Pe = e.states[Se];
713
- if (Oe(p, h)) {
714
- var H = X(de((xe ? $(B) : [].concat(v.exit, B, Pe.entry).filter(function(w) {
715
- return w;
716
- })).map(function(w) {
717
- return le(w, o._options.actions);
718
- }), p, h), 3), oe = H[0], Ce = H[1], Re = H[2], ie = g ?? c;
719
- return { value: ie, context: Ce, actions: oe, changed: g !== c || oe.length > 0 || Re, matches: ne(ie) };
720
- }
721
- }
722
- } catch (w) {
723
- s = { error: w };
724
- } finally {
725
- try {
726
- m && !m.done && (d = f.return) && d.call(f);
727
- } finally {
728
- if (s) throw s.error;
729
- }
730
- }
731
- }
732
- return fe(c, p);
733
- } };
734
- return o;
735
- }
736
- const At = Tt({
737
- id: "sort",
738
- initial: M,
739
- states: {
740
- [M]: {
741
- on: {
742
- DIRECTION1: Q,
743
- DIRECTION2: U
744
- }
745
- },
746
- [Q]: {
747
- on: {
748
- DIRECTION1: U,
749
- DIRECTION2: M
750
- }
751
- },
752
- [U]: {
753
- on: {
754
- DIRECTION1: M,
755
- DIRECTION2: Q
756
- }
757
- }
758
- }
759
- });
760
- function Et(e, t) {
761
- const r = t === U ? "DIRECTION2" : "DIRECTION1";
762
- return At.transition(e, r).value;
763
- }
764
- function Mt(e = {}) {
765
- const { sortTarget: t = null, orders: r = [] } = e, n = pe({ sortTarget: t, orders: r });
766
- return {
767
- sort: n,
768
- change: ({ target: o, orders: u }) => {
769
- if (n.sortTarget !== o) {
770
- n.sortTarget = o, n.orders = u;
771
- return;
772
- }
773
- const a = u.map((s, d) => ({
774
- ...s,
775
- direction: Et(n.orders[d].direction, s.direction)
776
- }));
777
- n.sortTarget = o, n.orders = a;
778
- }
779
- };
780
- }
781
- export {
782
- Rt as a,
783
- jt as b,
784
- Dt as c,
785
- Pt as d,
786
- tt as e,
787
- Wt as f,
788
- Mt as g,
789
- Bt as h,
790
- Ct as i,
791
- Je as j,
792
- Lt as k,
793
- kt as l,
794
- Xe as m,
795
- N as n,
796
- _t as o,
797
- L as p,
798
- vt as q,
799
- Ft as r,
800
- St as u,
801
- ot as v,
802
- Nt as w
803
- };