@mjsz-vbr-elements/core 2.14.0 → 2.14.3

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