@mjsz-vbr-elements/core 2.9.1 → 2.11.0

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