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