@everymatrix/loyalty-points-card 0.1.6 → 0.1.8

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,4753 +0,0 @@
1
- var Bn = Object.defineProperty;
2
- var tr = (e) => {
3
- throw TypeError(e);
4
- };
5
- var Pn = (e, t, r) => t in e ? Bn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
6
- var J = (e, t, r) => Pn(e, typeof t != "symbol" ? t + "" : t, r), vt = (e, t, r) => t.has(e) || tr("Cannot " + r);
7
- var x = (e, t, r) => (vt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Y = (e, t, r) => t.has(e) ? tr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), be = (e, t, r, n) => (vt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r), oe = (e, t, r) => (vt(e, t, "access private method"), r);
8
- import { tick as Nn } from "svelte";
9
- const On = "5";
10
- var xr;
11
- typeof window < "u" && ((xr = window.__svelte ?? (window.__svelte = {})).v ?? (xr.v = /* @__PURE__ */ new Set())).add(On);
12
- const In = 2, A = Symbol(), Ht = !1;
13
- var Ln = Array.isArray, Rn = Array.prototype.indexOf, Cn = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, Mn = Object.prototype, Dn = Array.prototype, Un = Object.getPrototypeOf;
14
- const ee = () => {
15
- };
16
- function Tr(e) {
17
- for (var t = 0; t < e.length; t++)
18
- e[t]();
19
- }
20
- function wr() {
21
- var e, t, r = new Promise((n, i) => {
22
- e = n, t = i;
23
- });
24
- return { promise: r, resolve: e, reject: t };
25
- }
26
- const P = 2, St = 4, Vt = 8, Hr = 1 << 24, me = 16, Le = 32, Re = 64, Sr = 128, X = 512, C = 1024, k = 2048, se = 4096, xe = 8192, te = 16384, Xt = 32768, rr = 65536, nr = 1 << 17, Ar = 1 << 18, Wt = 1 << 19, Gn = 1 << 20, pe = 32768, At = 1 << 21, zt = 1 << 22, re = 1 << 23, mt = Symbol("$state"), Ee = new class extends Error {
27
- constructor() {
28
- super(...arguments);
29
- J(this, "name", "StaleReactionError");
30
- J(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
31
- }
32
- }();
33
- function Fn() {
34
- throw new Error("https://svelte.dev/e/async_derived_orphan");
35
- }
36
- function jn(e) {
37
- throw new Error("https://svelte.dev/e/effect_in_teardown");
38
- }
39
- function kn() {
40
- throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
41
- }
42
- function Vn(e) {
43
- throw new Error("https://svelte.dev/e/effect_orphan");
44
- }
45
- function Xn() {
46
- throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
47
- }
48
- function Wn() {
49
- throw new Error("https://svelte.dev/e/state_descriptors_fixed");
50
- }
51
- function zn() {
52
- throw new Error("https://svelte.dev/e/state_prototype_fixed");
53
- }
54
- function $n() {
55
- throw new Error("https://svelte.dev/e/state_unsafe_mutation");
56
- }
57
- function Br(e) {
58
- return e === this.v;
59
- }
60
- function Pr(e, t) {
61
- return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
62
- }
63
- function qn(e) {
64
- return !Pr(e, this.v);
65
- }
66
- let Zn = !1, Q = null;
67
- function Ye(e) {
68
- Q = e;
69
- }
70
- function Qn(e, t = !1, r) {
71
- Q = {
72
- p: Q,
73
- i: !1,
74
- c: null,
75
- e: null,
76
- s: e,
77
- x: null,
78
- l: null
79
- };
80
- }
81
- function Yn(e) {
82
- var t = (
83
- /** @type {ComponentContext} */
84
- Q
85
- ), r = t.e;
86
- if (r !== null) {
87
- t.e = null;
88
- for (var n of r)
89
- zr(n);
90
- }
91
- return t.i = !0, Q = t.p, /** @type {T} */
92
- {};
93
- }
94
- function Nr() {
95
- return !0;
96
- }
97
- let ye = [];
98
- function Jn() {
99
- var e = ye;
100
- ye = [], Tr(e);
101
- }
102
- function Kn(e) {
103
- if (ye.length === 0) {
104
- var t = ye;
105
- queueMicrotask(() => {
106
- t === ye && Jn();
107
- });
108
- }
109
- ye.push(e);
110
- }
111
- function ei(e) {
112
- var t = E;
113
- if (t === null)
114
- return b.f |= re, e;
115
- if (t.f & Xt)
116
- Je(e, t);
117
- else {
118
- if (!(t.f & Sr))
119
- throw e;
120
- t.b.error(e);
121
- }
122
- }
123
- function Je(e, t) {
124
- for (; t !== null; ) {
125
- if (t.f & Sr)
126
- try {
127
- t.b.error(e);
128
- return;
129
- } catch (r) {
130
- e = r;
131
- }
132
- t = t.parent;
133
- }
134
- throw e;
135
- }
136
- const ti = -7169;
137
- function D(e, t) {
138
- e.f = e.f & ti | t;
139
- }
140
- function $t(e) {
141
- e.f & X || e.deps === null ? D(e, C) : D(e, se);
142
- }
143
- function Or(e) {
144
- if (e !== null)
145
- for (const t of e)
146
- !(t.f & P) || !(t.f & pe) || (t.f ^= pe, Or(
147
- /** @type {Derived} */
148
- t.deps
149
- ));
150
- }
151
- function ri(e, t, r) {
152
- e.f & k ? t.add(e) : e.f & se && r.add(e), Or(e.deps), D(e, C);
153
- }
154
- const ze = /* @__PURE__ */ new Set();
155
- let T = null, B = null, q = [], qt = null, Bt = !1;
156
- var Te, we, le, fe, Xe, He, Se, W, Pt, Nt, Ir, Lr;
157
- const at = class at {
158
- constructor() {
159
- Y(this, W);
160
- J(this, "committed", !1);
161
- /**
162
- * The current values of any sources that are updated in this batch
163
- * They keys of this map are identical to `this.#previous`
164
- * @type {Map<Source, any>}
165
- */
166
- J(this, "current", /* @__PURE__ */ new Map());
167
- /**
168
- * The values of any sources that are updated in this batch _before_ those updates took place.
169
- * They keys of this map are identical to `this.#current`
170
- * @type {Map<Source, any>}
171
- */
172
- J(this, "previous", /* @__PURE__ */ new Map());
173
- /**
174
- * When the batch is committed (and the DOM is updated), we need to remove old branches
175
- * and append new ones by calling the functions added inside (if/each/key/etc) blocks
176
- * @type {Set<() => void>}
177
- */
178
- Y(this, Te, /* @__PURE__ */ new Set());
179
- /**
180
- * If a fork is discarded, we need to destroy any effects that are no longer needed
181
- * @type {Set<(batch: Batch) => void>}
182
- */
183
- Y(this, we, /* @__PURE__ */ new Set());
184
- /**
185
- * The number of async effects that are currently in flight
186
- */
187
- Y(this, le, 0);
188
- /**
189
- * The number of async effects that are currently in flight, _not_ inside a pending boundary
190
- */
191
- Y(this, fe, 0);
192
- /**
193
- * A deferred that resolves when the batch is committed, used with `settled()`
194
- * TODO replace with Promise.withResolvers once supported widely enough
195
- * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
196
- */
197
- Y(this, Xe, null);
198
- /**
199
- * Deferred effects (which run after async work has completed) that are DIRTY
200
- * @type {Set<Effect>}
201
- */
202
- Y(this, He, /* @__PURE__ */ new Set());
203
- /**
204
- * Deferred effects that are MAYBE_DIRTY
205
- * @type {Set<Effect>}
206
- */
207
- Y(this, Se, /* @__PURE__ */ new Set());
208
- /**
209
- * A set of branches that still exist, but will be destroyed when this batch
210
- * is committed — we skip over these during `process`
211
- * @type {Set<Effect>}
212
- */
213
- J(this, "skipped_effects", /* @__PURE__ */ new Set());
214
- J(this, "is_fork", !1);
215
- }
216
- is_deferred() {
217
- return this.is_fork || x(this, fe) > 0;
218
- }
219
- /**
220
- *
221
- * @param {Effect[]} root_effects
222
- */
223
- process(t) {
224
- var i;
225
- q = [], this.apply();
226
- var r = [], n = [];
227
- for (const s of t)
228
- oe(this, W, Pt).call(this, s, r, n);
229
- this.is_fork || oe(this, W, Ir).call(this), this.is_deferred() ? (oe(this, W, Nt).call(this, n), oe(this, W, Nt).call(this, r)) : (T = null, ir(n), ir(r), (i = x(this, Xe)) == null || i.resolve()), B = null;
230
- }
231
- /**
232
- * Associate a change to a given source with the current
233
- * batch, noting its previous and current values
234
- * @param {Source} source
235
- * @param {any} value
236
- */
237
- capture(t, r) {
238
- r !== A && !this.previous.has(t) && this.previous.set(t, r), t.f & re || (this.current.set(t, t.v), B == null || B.set(t, t.v));
239
- }
240
- activate() {
241
- T = this, this.apply();
242
- }
243
- deactivate() {
244
- T === this && (T = null, B = null);
245
- }
246
- flush() {
247
- if (this.activate(), q.length > 0) {
248
- if (ni(), T !== null && T !== this)
249
- return;
250
- } else x(this, le) === 0 && this.process([]);
251
- this.deactivate();
252
- }
253
- discard() {
254
- for (const t of x(this, we)) t(this);
255
- x(this, we).clear();
256
- }
257
- /**
258
- *
259
- * @param {boolean} blocking
260
- */
261
- increment(t) {
262
- be(this, le, x(this, le) + 1), t && be(this, fe, x(this, fe) + 1);
263
- }
264
- /**
265
- *
266
- * @param {boolean} blocking
267
- */
268
- decrement(t) {
269
- be(this, le, x(this, le) - 1), t && be(this, fe, x(this, fe) - 1), this.revive();
270
- }
271
- revive() {
272
- for (const t of x(this, He))
273
- x(this, Se).delete(t), D(t, k), Ae(t);
274
- for (const t of x(this, Se))
275
- D(t, se), Ae(t);
276
- this.flush();
277
- }
278
- /** @param {() => void} fn */
279
- oncommit(t) {
280
- x(this, Te).add(t);
281
- }
282
- /** @param {(batch: Batch) => void} fn */
283
- ondiscard(t) {
284
- x(this, we).add(t);
285
- }
286
- settled() {
287
- return (x(this, Xe) ?? be(this, Xe, wr())).promise;
288
- }
289
- static ensure() {
290
- if (T === null) {
291
- const t = T = new at();
292
- ze.add(T), at.enqueue(() => {
293
- T === t && t.flush();
294
- });
295
- }
296
- return T;
297
- }
298
- /** @param {() => void} task */
299
- static enqueue(t) {
300
- Kn(t);
301
- }
302
- apply() {
303
- }
304
- };
305
- Te = new WeakMap(), we = new WeakMap(), le = new WeakMap(), fe = new WeakMap(), Xe = new WeakMap(), He = new WeakMap(), Se = new WeakMap(), W = new WeakSet(), /**
306
- * Traverse the effect tree, executing effects or stashing
307
- * them for later execution as appropriate
308
- * @param {Effect} root
309
- * @param {Effect[]} effects
310
- * @param {Effect[]} render_effects
311
- */
312
- Pt = function(t, r, n) {
313
- t.f ^= C;
314
- for (var i = t.first, s = null; i !== null; ) {
315
- var a = i.f, l = (a & (Le | Re)) !== 0, u = l && (a & C) !== 0, o = u || (a & xe) !== 0 || this.skipped_effects.has(i);
316
- if (!o && i.fn !== null) {
317
- l ? i.f ^= C : s !== null && a & (St | Vt | Hr) ? s.b.defer_effect(i) : a & St ? r.push(i) : We(i) && (a & me && x(this, He).add(i), je(i));
318
- var f = i.first;
319
- if (f !== null) {
320
- i = f;
321
- continue;
322
- }
323
- }
324
- var c = i.parent;
325
- for (i = i.next; i === null && c !== null; )
326
- c === s && (s = null), i = c.next, c = c.parent;
327
- }
328
- }, /**
329
- * @param {Effect[]} effects
330
- */
331
- Nt = function(t) {
332
- for (var r = 0; r < t.length; r += 1)
333
- ri(t[r], x(this, He), x(this, Se));
334
- }, Ir = function() {
335
- if (x(this, fe) === 0) {
336
- for (const t of x(this, Te)) t();
337
- x(this, Te).clear();
338
- }
339
- x(this, le) === 0 && oe(this, W, Lr).call(this);
340
- }, Lr = function() {
341
- var i;
342
- if (ze.size > 1) {
343
- this.previous.clear();
344
- var t = B, r = !0;
345
- for (const s of ze) {
346
- if (s === this) {
347
- r = !1;
348
- continue;
349
- }
350
- const a = [];
351
- for (const [u, o] of this.current) {
352
- if (s.current.has(u))
353
- if (r && o !== s.current.get(u))
354
- s.current.set(u, o);
355
- else
356
- continue;
357
- a.push(u);
358
- }
359
- if (a.length === 0)
360
- continue;
361
- const l = [...s.current.keys()].filter((u) => !this.current.has(u));
362
- if (l.length > 0) {
363
- var n = q;
364
- q = [];
365
- const u = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
366
- for (const f of a)
367
- Rr(f, l, u, o);
368
- if (q.length > 0) {
369
- T = s, s.apply();
370
- for (const f of q)
371
- oe(i = s, W, Pt).call(i, f, [], []);
372
- s.deactivate();
373
- }
374
- q = n;
375
- }
376
- }
377
- T = null, B = t;
378
- }
379
- this.committed = !0, ze.delete(this);
380
- };
381
- let Ke = at;
382
- function ni() {
383
- var e = he;
384
- Bt = !0;
385
- var t = null;
386
- try {
387
- var r = 0;
388
- for (tt(!0); q.length > 0; ) {
389
- var n = Ke.ensure();
390
- if (r++ > 1e3) {
391
- var i, s;
392
- ii();
393
- }
394
- n.process(q), ne.clear();
395
- }
396
- } finally {
397
- Bt = !1, tt(e), qt = null;
398
- }
399
- }
400
- function ii() {
401
- try {
402
- Xn();
403
- } catch (e) {
404
- Je(e, qt);
405
- }
406
- }
407
- let z = null;
408
- function ir(e) {
409
- var t = e.length;
410
- if (t !== 0) {
411
- for (var r = 0; r < t; ) {
412
- var n = e[r++];
413
- if (!(n.f & (te | xe)) && We(n) && (z = /* @__PURE__ */ new Set(), je(n), n.deps === null && n.first === null && n.nodes === null && (n.teardown === null && n.ac === null ? Zr(n) : n.fn = null), (z == null ? void 0 : z.size) > 0)) {
414
- ne.clear();
415
- for (const i of z) {
416
- if (i.f & (te | xe)) continue;
417
- const s = [i];
418
- let a = i.parent;
419
- for (; a !== null; )
420
- z.has(a) && (z.delete(a), s.push(a)), a = a.parent;
421
- for (let l = s.length - 1; l >= 0; l--) {
422
- const u = s[l];
423
- u.f & (te | xe) || je(u);
424
- }
425
- }
426
- z.clear();
427
- }
428
- }
429
- z = null;
430
- }
431
- }
432
- function Rr(e, t, r, n) {
433
- if (!r.has(e) && (r.add(e), e.reactions !== null))
434
- for (const i of e.reactions) {
435
- const s = i.f;
436
- s & P ? Rr(
437
- /** @type {Derived} */
438
- i,
439
- t,
440
- r,
441
- n
442
- ) : s & (zt | me) && !(s & k) && Cr(i, t, n) && (D(i, k), Ae(
443
- /** @type {Effect} */
444
- i
445
- ));
446
- }
447
- }
448
- function Cr(e, t, r) {
449
- const n = r.get(e);
450
- if (n !== void 0) return n;
451
- if (e.deps !== null)
452
- for (const i of e.deps) {
453
- if (t.includes(i))
454
- return !0;
455
- if (i.f & P && Cr(
456
- /** @type {Derived} */
457
- i,
458
- t,
459
- r
460
- ))
461
- return r.set(
462
- /** @type {Derived} */
463
- i,
464
- !0
465
- ), !0;
466
- }
467
- return r.set(e, !1), !1;
468
- }
469
- function Ae(e) {
470
- for (var t = qt = e; t.parent !== null; ) {
471
- t = t.parent;
472
- var r = t.f;
473
- if (Bt && t === E && r & me && !(r & Ar))
474
- return;
475
- if (r & (Re | Le)) {
476
- if (!(r & C)) return;
477
- t.f ^= C;
478
- }
479
- }
480
- q.push(t);
481
- }
482
- function si(e, t, r, n) {
483
- const i = Mr;
484
- if (r.length === 0 && e.length === 0) {
485
- n(t.map(i));
486
- return;
487
- }
488
- var s = T, a = (
489
- /** @type {Effect} */
490
- E
491
- ), l = ai();
492
- function u() {
493
- Promise.all(r.map((o) => /* @__PURE__ */ oi(o))).then((o) => {
494
- l();
495
- try {
496
- n([...t.map(i), ...o]);
497
- } catch (f) {
498
- a.f & te || Je(f, a);
499
- }
500
- s == null || s.deactivate(), et();
501
- }).catch((o) => {
502
- Je(o, a);
503
- });
504
- }
505
- e.length > 0 ? Promise.all(e).then(() => {
506
- l();
507
- try {
508
- return u();
509
- } finally {
510
- s == null || s.deactivate(), et();
511
- }
512
- }) : u();
513
- }
514
- function ai() {
515
- var e = E, t = b, r = Q, n = T;
516
- return function(s = !0) {
517
- Be(e), ie(t), Ye(r), s && (n == null || n.activate());
518
- };
519
- }
520
- function et() {
521
- Be(null), ie(null), Ye(null);
522
- }
523
- // @__NO_SIDE_EFFECTS__
524
- function Mr(e) {
525
- var t = P | k, r = b !== null && b.f & P ? (
526
- /** @type {Derived} */
527
- b
528
- ) : null;
529
- return E !== null && (E.f |= Wt), {
530
- ctx: Q,
531
- deps: null,
532
- effects: null,
533
- equals: Br,
534
- f: t,
535
- fn: e,
536
- reactions: null,
537
- rv: 0,
538
- v: (
539
- /** @type {V} */
540
- A
541
- ),
542
- wv: 0,
543
- parent: r ?? E,
544
- ac: null
545
- };
546
- }
547
- // @__NO_SIDE_EFFECTS__
548
- function oi(e, t, r) {
549
- let n = (
550
- /** @type {Effect | null} */
551
- E
552
- );
553
- n === null && Fn();
554
- var i = (
555
- /** @type {Boundary} */
556
- n.b
557
- ), s = (
558
- /** @type {Promise<V>} */
559
- /** @type {unknown} */
560
- void 0
561
- ), a = Qt(
562
- /** @type {V} */
563
- A
564
- ), l = !b, u = /* @__PURE__ */ new Map();
565
- return _i(() => {
566
- var p;
567
- var o = wr();
568
- s = o.promise;
569
- try {
570
- Promise.resolve(e()).then(o.resolve, o.reject).then(() => {
571
- f === T && f.committed && f.deactivate(), et();
572
- });
573
- } catch (v) {
574
- o.reject(v), et();
575
- }
576
- var f = (
577
- /** @type {Batch} */
578
- T
579
- );
580
- if (l) {
581
- var c = i.is_rendered();
582
- i.update_pending_count(1), f.increment(c), (p = u.get(f)) == null || p.reject(Ee), u.delete(f), u.set(f, o);
583
- }
584
- const h = (v, d = void 0) => {
585
- if (f.activate(), d)
586
- d !== Ee && (a.f |= re, It(a, d));
587
- else {
588
- a.f & re && (a.f ^= re), It(a, v);
589
- for (const [y, I] of u) {
590
- if (u.delete(y), y === f) break;
591
- I.reject(Ee);
592
- }
593
- }
594
- l && (i.update_pending_count(-1), f.decrement(c));
595
- };
596
- o.promise.then(h, (v) => h(null, v || "unknown"));
597
- }), Wr(() => {
598
- for (const o of u.values())
599
- o.reject(Ee);
600
- }), new Promise((o) => {
601
- function f(c) {
602
- function h() {
603
- c === s ? o(a) : f(s);
604
- }
605
- c.then(h, h);
606
- }
607
- f(s);
608
- });
609
- }
610
- // @__NO_SIDE_EFFECTS__
611
- function _t(e) {
612
- const t = /* @__PURE__ */ Mr(e);
613
- return Qr(t), t;
614
- }
615
- function Dr(e) {
616
- var t = e.effects;
617
- if (t !== null) {
618
- e.effects = null;
619
- for (var r = 0; r < t.length; r += 1)
620
- ut(
621
- /** @type {Effect} */
622
- t[r]
623
- );
624
- }
625
- }
626
- function ui(e) {
627
- for (var t = e.parent; t !== null; ) {
628
- if (!(t.f & P))
629
- return t.f & te ? null : (
630
- /** @type {Effect} */
631
- t
632
- );
633
- t = t.parent;
634
- }
635
- return null;
636
- }
637
- function Zt(e) {
638
- var t, r = E;
639
- Be(ui(e));
640
- try {
641
- e.f &= ~pe, Dr(e), t = en(e);
642
- } finally {
643
- Be(r);
644
- }
645
- return t;
646
- }
647
- function Ur(e) {
648
- var t = Zt(e);
649
- if (!e.equals(t) && (e.wv = Jr(), (!(T != null && T.is_fork) || e.deps === null) && (e.v = t, e.deps === null))) {
650
- D(e, C);
651
- return;
652
- }
653
- ve || (B !== null ? (Xr() || T != null && T.is_fork) && B.set(e, t) : $t(e));
654
- }
655
- let Ot = /* @__PURE__ */ new Set();
656
- const ne = /* @__PURE__ */ new Map();
657
- let Gr = !1;
658
- function Qt(e, t) {
659
- var r = {
660
- f: 0,
661
- // TODO ideally we could skip this altogether, but it causes type errors
662
- v: e,
663
- reactions: null,
664
- equals: Br,
665
- rv: 0,
666
- wv: 0
667
- };
668
- return r;
669
- }
670
- // @__NO_SIDE_EFFECTS__
671
- function G(e, t) {
672
- const r = Qt(e);
673
- return Qr(r), r;
674
- }
675
- // @__NO_SIDE_EFFECTS__
676
- function li(e, t = !1, r = !0) {
677
- const n = Qt(e);
678
- return t || (n.equals = qn), n;
679
- }
680
- function O(e, t, r = !1) {
681
- b !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
682
- // to ensure we error if state is set inside an inspect effect
683
- (!$ || b.f & nr) && Nr() && b.f & (P | me | zt | nr) && !(M != null && M.includes(e)) && $n();
684
- let n = r ? Fe(t) : t;
685
- return It(e, n);
686
- }
687
- function It(e, t) {
688
- if (!e.equals(t)) {
689
- var r = e.v;
690
- ve ? ne.set(e, t) : ne.set(e, r), e.v = t;
691
- var n = Ke.ensure();
692
- if (n.capture(e, r), e.f & P) {
693
- const i = (
694
- /** @type {Derived} */
695
- e
696
- );
697
- e.f & k && Zt(i), $t(i);
698
- }
699
- e.wv = Jr(), Fr(e, k), E !== null && E.f & C && !(E.f & (Le | Re)) && (V === null ? yi([e]) : V.push(e)), !n.is_fork && Ot.size > 0 && !Gr && fi();
700
- }
701
- return t;
702
- }
703
- function fi() {
704
- Gr = !1;
705
- var e = he;
706
- tt(!0);
707
- const t = Array.from(Ot);
708
- try {
709
- for (const r of t)
710
- r.f & C && D(r, se), We(r) && je(r);
711
- } finally {
712
- tt(e);
713
- }
714
- Ot.clear();
715
- }
716
- function bt(e) {
717
- O(e, e.v + 1);
718
- }
719
- function Fr(e, t) {
720
- var r = e.reactions;
721
- if (r !== null)
722
- for (var n = r.length, i = 0; i < n; i++) {
723
- var s = r[i], a = s.f, l = (a & k) === 0;
724
- if (l && D(s, t), a & P) {
725
- var u = (
726
- /** @type {Derived} */
727
- s
728
- );
729
- B == null || B.delete(u), a & pe || (a & X && (s.f |= pe), Fr(u, se));
730
- } else l && (a & me && z !== null && z.add(
731
- /** @type {Effect} */
732
- s
733
- ), Ae(
734
- /** @type {Effect} */
735
- s
736
- ));
737
- }
738
- }
739
- function Fe(e) {
740
- if (typeof e != "object" || e === null || mt in e)
741
- return e;
742
- const t = Un(e);
743
- if (t !== Mn && t !== Dn)
744
- return e;
745
- var r = /* @__PURE__ */ new Map(), n = Ln(e), i = /* @__PURE__ */ G(0), s = ce, a = (l) => {
746
- if (ce === s)
747
- return l();
748
- var u = b, o = ce;
749
- ie(null), or(s);
750
- var f = l();
751
- return ie(u), or(o), f;
752
- };
753
- return n && r.set("length", /* @__PURE__ */ G(
754
- /** @type {any[]} */
755
- e.length
756
- )), new Proxy(
757
- /** @type {any} */
758
- e,
759
- {
760
- defineProperty(l, u, o) {
761
- (!("value" in o) || o.configurable === !1 || o.enumerable === !1 || o.writable === !1) && Wn();
762
- var f = r.get(u);
763
- return f === void 0 ? f = a(() => {
764
- var c = /* @__PURE__ */ G(o.value);
765
- return r.set(u, c), c;
766
- }) : O(f, o.value, !0), !0;
767
- },
768
- deleteProperty(l, u) {
769
- var o = r.get(u);
770
- if (o === void 0) {
771
- if (u in l) {
772
- const f = a(() => /* @__PURE__ */ G(A));
773
- r.set(u, f), bt(i);
774
- }
775
- } else
776
- O(o, A), bt(i);
777
- return !0;
778
- },
779
- get(l, u, o) {
780
- var p;
781
- if (u === mt)
782
- return e;
783
- var f = r.get(u), c = u in l;
784
- if (f === void 0 && (!c || (p = dt(l, u)) != null && p.writable) && (f = a(() => {
785
- var v = Fe(c ? l[u] : A), d = /* @__PURE__ */ G(v);
786
- return d;
787
- }), r.set(u, f)), f !== void 0) {
788
- var h = H(f);
789
- return h === A ? void 0 : h;
790
- }
791
- return Reflect.get(l, u, o);
792
- },
793
- getOwnPropertyDescriptor(l, u) {
794
- var o = Reflect.getOwnPropertyDescriptor(l, u);
795
- if (o && "value" in o) {
796
- var f = r.get(u);
797
- f && (o.value = H(f));
798
- } else if (o === void 0) {
799
- var c = r.get(u), h = c == null ? void 0 : c.v;
800
- if (c !== void 0 && h !== A)
801
- return {
802
- enumerable: !0,
803
- configurable: !0,
804
- value: h,
805
- writable: !0
806
- };
807
- }
808
- return o;
809
- },
810
- has(l, u) {
811
- var h;
812
- if (u === mt)
813
- return !0;
814
- var o = r.get(u), f = o !== void 0 && o.v !== A || Reflect.has(l, u);
815
- if (o !== void 0 || E !== null && (!f || (h = dt(l, u)) != null && h.writable)) {
816
- o === void 0 && (o = a(() => {
817
- var p = f ? Fe(l[u]) : A, v = /* @__PURE__ */ G(p);
818
- return v;
819
- }), r.set(u, o));
820
- var c = H(o);
821
- if (c === A)
822
- return !1;
823
- }
824
- return f;
825
- },
826
- set(l, u, o, f) {
827
- var S;
828
- var c = r.get(u), h = u in l;
829
- if (n && u === "length")
830
- for (var p = o; p < /** @type {Source<number>} */
831
- c.v; p += 1) {
832
- var v = r.get(p + "");
833
- v !== void 0 ? O(v, A) : p in l && (v = a(() => /* @__PURE__ */ G(A)), r.set(p + "", v));
834
- }
835
- if (c === void 0)
836
- (!h || (S = dt(l, u)) != null && S.writable) && (c = a(() => /* @__PURE__ */ G(void 0)), O(c, Fe(o)), r.set(u, c));
837
- else {
838
- h = c.v !== A;
839
- var d = a(() => Fe(o));
840
- O(c, d);
841
- }
842
- var y = Reflect.getOwnPropertyDescriptor(l, u);
843
- if (y != null && y.set && y.set.call(f, o), !h) {
844
- if (n && typeof u == "string") {
845
- var I = (
846
- /** @type {Source<number>} */
847
- r.get("length")
848
- ), L = Number(u);
849
- Number.isInteger(L) && L >= I.v && O(I, L + 1);
850
- }
851
- bt(i);
852
- }
853
- return !0;
854
- },
855
- ownKeys(l) {
856
- H(i);
857
- var u = Reflect.ownKeys(l).filter((c) => {
858
- var h = r.get(c);
859
- return h === void 0 || h.v !== A;
860
- });
861
- for (var [o, f] of r)
862
- f.v !== A && !(o in l) && u.push(o);
863
- return u;
864
- },
865
- setPrototypeOf() {
866
- zn();
867
- }
868
- }
869
- );
870
- }
871
- var hi, ci, pi;
872
- // @__NO_SIDE_EFFECTS__
873
- function jr(e) {
874
- return (
875
- /** @type {TemplateNode | null} */
876
- ci.call(e)
877
- );
878
- }
879
- // @__NO_SIDE_EFFECTS__
880
- function kr(e) {
881
- return (
882
- /** @type {TemplateNode | null} */
883
- pi.call(e)
884
- );
885
- }
886
- function Ue(e, t) {
887
- return /* @__PURE__ */ jr(e);
888
- }
889
- function vi(e, t = 1, r = !1) {
890
- let n = e;
891
- for (; t--; )
892
- n = /** @type {TemplateNode} */
893
- /* @__PURE__ */ kr(n);
894
- return n;
895
- }
896
- function Vr(e) {
897
- var t = b, r = E;
898
- ie(null), Be(null);
899
- try {
900
- return e();
901
- } finally {
902
- ie(t), Be(r);
903
- }
904
- }
905
- function di(e) {
906
- E === null && (b === null && Vn(), kn()), ve && jn();
907
- }
908
- function mi(e, t) {
909
- var r = t.last;
910
- r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e);
911
- }
912
- function ot(e, t, r) {
913
- var n = E;
914
- n !== null && n.f & xe && (e |= xe);
915
- var i = {
916
- ctx: Q,
917
- deps: null,
918
- nodes: null,
919
- f: e | k | X,
920
- first: null,
921
- fn: t,
922
- last: null,
923
- next: null,
924
- parent: n,
925
- b: n && n.b,
926
- prev: null,
927
- teardown: null,
928
- wv: 0,
929
- ac: null
930
- };
931
- if (r)
932
- try {
933
- je(i), i.f |= Xt;
934
- } catch (l) {
935
- throw ut(i), l;
936
- }
937
- else t !== null && Ae(i);
938
- var s = i;
939
- if (r && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
940
- !(s.f & Wt) && (s = s.first, e & me && e & rr && s !== null && (s.f |= rr)), s !== null && (s.parent = n, n !== null && mi(s, n), b !== null && b.f & P && !(e & Re))) {
941
- var a = (
942
- /** @type {Derived} */
943
- b
944
- );
945
- (a.effects ?? (a.effects = [])).push(s);
946
- }
947
- return i;
948
- }
949
- function Xr() {
950
- return b !== null && !$;
951
- }
952
- function Wr(e) {
953
- const t = ot(Vt, null, !1);
954
- return D(t, C), t.teardown = e, t;
955
- }
956
- function sr(e) {
957
- di();
958
- var t = (
959
- /** @type {Effect} */
960
- E.f
961
- ), r = !b && (t & Le) !== 0 && (t & Xt) === 0;
962
- if (r) {
963
- var n = (
964
- /** @type {ComponentContext} */
965
- Q
966
- );
967
- (n.e ?? (n.e = [])).push(e);
968
- } else
969
- return zr(e);
970
- }
971
- function zr(e) {
972
- return ot(St | Gn, e, !1);
973
- }
974
- function _i(e) {
975
- return ot(zt | Wt, e, !0);
976
- }
977
- function bi(e, t = [], r = [], n = []) {
978
- si(n, t, r, (i) => {
979
- ot(Vt, () => e(...i.map(H)), !0);
980
- });
981
- }
982
- function $r(e) {
983
- var t = e.teardown;
984
- if (t !== null) {
985
- const r = ve, n = b;
986
- ar(!0), ie(null);
987
- try {
988
- t.call(null);
989
- } finally {
990
- ar(r), ie(n);
991
- }
992
- }
993
- }
994
- function qr(e, t = !1) {
995
- var r = e.first;
996
- for (e.first = e.last = null; r !== null; ) {
997
- const i = r.ac;
998
- i !== null && Vr(() => {
999
- i.abort(Ee);
1000
- });
1001
- var n = r.next;
1002
- r.f & Re ? r.parent = null : ut(r, t), r = n;
1003
- }
1004
- }
1005
- function gi(e) {
1006
- for (var t = e.first; t !== null; ) {
1007
- var r = t.next;
1008
- t.f & Le || ut(t), t = r;
1009
- }
1010
- }
1011
- function ut(e, t = !0) {
1012
- var r = !1;
1013
- (t || e.f & Ar) && e.nodes !== null && e.nodes.end !== null && (Ei(
1014
- e.nodes.start,
1015
- /** @type {TemplateNode} */
1016
- e.nodes.end
1017
- ), r = !0), qr(e, t && !r), rt(e, 0), D(e, te);
1018
- var n = e.nodes && e.nodes.t;
1019
- if (n !== null)
1020
- for (const s of n)
1021
- s.stop();
1022
- $r(e);
1023
- var i = e.parent;
1024
- i !== null && i.first !== null && Zr(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1025
- }
1026
- function Ei(e, t) {
1027
- for (; e !== null; ) {
1028
- var r = e === t ? null : /* @__PURE__ */ kr(e);
1029
- e.remove(), e = r;
1030
- }
1031
- }
1032
- function Zr(e) {
1033
- var t = e.parent, r = e.prev, n = e.next;
1034
- r !== null && (r.next = n), n !== null && (n.prev = r), t !== null && (t.first === e && (t.first = n), t.last === e && (t.last = r));
1035
- }
1036
- let he = !1;
1037
- function tt(e) {
1038
- he = e;
1039
- }
1040
- let ve = !1;
1041
- function ar(e) {
1042
- ve = e;
1043
- }
1044
- let b = null, $ = !1;
1045
- function ie(e) {
1046
- b = e;
1047
- }
1048
- let E = null;
1049
- function Be(e) {
1050
- E = e;
1051
- }
1052
- let M = null;
1053
- function Qr(e) {
1054
- b !== null && (M === null ? M = [e] : M.push(e));
1055
- }
1056
- let F = null, j = 0, V = null;
1057
- function yi(e) {
1058
- V = e;
1059
- }
1060
- let Yr = 1, ue = 0, ce = ue;
1061
- function or(e) {
1062
- ce = e;
1063
- }
1064
- function Jr() {
1065
- return ++Yr;
1066
- }
1067
- function We(e) {
1068
- var t = e.f;
1069
- if (t & k)
1070
- return !0;
1071
- if (t & P && (e.f &= ~pe), t & se) {
1072
- for (var r = (
1073
- /** @type {Value[]} */
1074
- e.deps
1075
- ), n = r.length, i = 0; i < n; i++) {
1076
- var s = r[i];
1077
- if (We(
1078
- /** @type {Derived} */
1079
- s
1080
- ) && Ur(
1081
- /** @type {Derived} */
1082
- s
1083
- ), s.wv > e.wv)
1084
- return !0;
1085
- }
1086
- t & X && // During time traveling we don't want to reset the status so that
1087
- // traversal of the graph in the other batches still happens
1088
- B === null && D(e, C);
1089
- }
1090
- return !1;
1091
- }
1092
- function Kr(e, t, r = !0) {
1093
- var n = e.reactions;
1094
- if (n !== null && !(M != null && M.includes(e)))
1095
- for (var i = 0; i < n.length; i++) {
1096
- var s = n[i];
1097
- s.f & P ? Kr(
1098
- /** @type {Derived} */
1099
- s,
1100
- t,
1101
- !1
1102
- ) : t === s && (r ? D(s, k) : s.f & C && D(s, se), Ae(
1103
- /** @type {Effect} */
1104
- s
1105
- ));
1106
- }
1107
- }
1108
- function en(e) {
1109
- var v;
1110
- var t = F, r = j, n = V, i = b, s = M, a = Q, l = $, u = ce, o = e.f;
1111
- F = /** @type {null | Value[]} */
1112
- null, j = 0, V = null, b = o & (Le | Re) ? null : e, M = null, Ye(e.ctx), $ = !1, ce = ++ue, e.ac !== null && (Vr(() => {
1113
- e.ac.abort(Ee);
1114
- }), e.ac = null);
1115
- try {
1116
- e.f |= At;
1117
- var f = (
1118
- /** @type {Function} */
1119
- e.fn
1120
- ), c = f(), h = e.deps;
1121
- if (F !== null) {
1122
- var p;
1123
- if (rt(e, j), h !== null && j > 0)
1124
- for (h.length = j + F.length, p = 0; p < F.length; p++)
1125
- h[j + p] = F[p];
1126
- else
1127
- e.deps = h = F;
1128
- if (Xr() && e.f & X)
1129
- for (p = j; p < h.length; p++)
1130
- ((v = h[p]).reactions ?? (v.reactions = [])).push(e);
1131
- } else h !== null && j < h.length && (rt(e, j), h.length = j);
1132
- if (Nr() && V !== null && !$ && h !== null && !(e.f & (P | se | k)))
1133
- for (p = 0; p < /** @type {Source[]} */
1134
- V.length; p++)
1135
- Kr(
1136
- V[p],
1137
- /** @type {Effect} */
1138
- e
1139
- );
1140
- if (i !== null && i !== e) {
1141
- if (ue++, i.deps !== null)
1142
- for (let d = 0; d < r; d += 1)
1143
- i.deps[d].rv = ue;
1144
- if (t !== null)
1145
- for (const d of t)
1146
- d.rv = ue;
1147
- V !== null && (n === null ? n = V : n.push(.../** @type {Source[]} */
1148
- V));
1149
- }
1150
- return e.f & re && (e.f ^= re), c;
1151
- } catch (d) {
1152
- return ei(d);
1153
- } finally {
1154
- e.f ^= At, F = t, j = r, V = n, b = i, M = s, Ye(a), $ = l, ce = u;
1155
- }
1156
- }
1157
- function xi(e, t) {
1158
- let r = t.reactions;
1159
- if (r !== null) {
1160
- var n = Rn.call(r, e);
1161
- if (n !== -1) {
1162
- var i = r.length - 1;
1163
- i === 0 ? r = t.reactions = null : (r[n] = r[i], r.pop());
1164
- }
1165
- }
1166
- if (r === null && t.f & P && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1167
- // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1168
- // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1169
- (F === null || !F.includes(t))) {
1170
- var s = (
1171
- /** @type {Derived} */
1172
- t
1173
- );
1174
- s.f & X && (s.f ^= X, s.f &= ~pe), $t(s), Dr(s), rt(s, 0);
1175
- }
1176
- }
1177
- function rt(e, t) {
1178
- var r = e.deps;
1179
- if (r !== null)
1180
- for (var n = t; n < r.length; n++)
1181
- xi(e, r[n]);
1182
- }
1183
- function je(e) {
1184
- var t = e.f;
1185
- if (!(t & te)) {
1186
- D(e, C);
1187
- var r = E, n = he;
1188
- E = e, he = !0;
1189
- try {
1190
- t & (me | Hr) ? gi(e) : qr(e), $r(e);
1191
- var i = en(e);
1192
- e.teardown = typeof i == "function" ? i : null, e.wv = Yr;
1193
- var s;
1194
- Ht && Zn && e.f & k && e.deps;
1195
- } finally {
1196
- he = n, E = r;
1197
- }
1198
- }
1199
- }
1200
- function H(e) {
1201
- var t = e.f, r = (t & P) !== 0;
1202
- if (b !== null && !$) {
1203
- var n = E !== null && (E.f & te) !== 0;
1204
- if (!n && !(M != null && M.includes(e))) {
1205
- var i = b.deps;
1206
- if (b.f & At)
1207
- e.rv < ue && (e.rv = ue, F === null && i !== null && i[j] === e ? j++ : F === null ? F = [e] : F.push(e));
1208
- else {
1209
- (b.deps ?? (b.deps = [])).push(e);
1210
- var s = e.reactions;
1211
- s === null ? e.reactions = [b] : s.includes(b) || s.push(b);
1212
- }
1213
- }
1214
- }
1215
- if (ve && ne.has(e))
1216
- return ne.get(e);
1217
- if (r) {
1218
- var a = (
1219
- /** @type {Derived} */
1220
- e
1221
- );
1222
- if (ve) {
1223
- var l = a.v;
1224
- return (!(a.f & C) && a.reactions !== null || rn(a)) && (l = Zt(a)), ne.set(a, l), l;
1225
- }
1226
- var u = (a.f & X) === 0 && !$ && b !== null && (he || (b.f & X) !== 0), o = a.deps === null;
1227
- We(a) && (u && (a.f |= X), Ur(a)), u && !o && tn(a);
1228
- }
1229
- if (B != null && B.has(e))
1230
- return B.get(e);
1231
- if (e.f & re)
1232
- throw e.v;
1233
- return e.v;
1234
- }
1235
- function tn(e) {
1236
- if (e.deps !== null) {
1237
- e.f |= X;
1238
- for (const t of e.deps)
1239
- (t.reactions ?? (t.reactions = [])).push(e), t.f & P && !(t.f & X) && tn(
1240
- /** @type {Derived} */
1241
- t
1242
- );
1243
- }
1244
- }
1245
- function rn(e) {
1246
- if (e.v === A) return !0;
1247
- if (e.deps === null) return !1;
1248
- for (const t of e.deps)
1249
- if (ne.has(t) || t.f & P && rn(
1250
- /** @type {Derived} */
1251
- t
1252
- ))
1253
- return !0;
1254
- return !1;
1255
- }
1256
- function Ti(e) {
1257
- var t = $;
1258
- try {
1259
- return $ = !0, e();
1260
- } finally {
1261
- $ = t;
1262
- }
1263
- }
1264
- function wi(e) {
1265
- var t = document.createElement("template");
1266
- return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
1267
- }
1268
- function Hi(e, t) {
1269
- var r = (
1270
- /** @type {Effect} */
1271
- E
1272
- );
1273
- r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
1274
- }
1275
- // @__NO_SIDE_EFFECTS__
1276
- function Si(e, t) {
1277
- var r = (t & In) !== 0, n, i = !e.startsWith("<!>");
1278
- return () => {
1279
- n === void 0 && (n = wi(i ? e : "<!>" + e), n = /** @type {TemplateNode} */
1280
- /* @__PURE__ */ jr(n));
1281
- var s = (
1282
- /** @type {TemplateNode} */
1283
- r || hi ? document.importNode(n, !0) : n.cloneNode(!0)
1284
- );
1285
- return Hi(s, s), s;
1286
- };
1287
- }
1288
- function Ai(e, t) {
1289
- e !== null && e.before(
1290
- /** @type {Node} */
1291
- t
1292
- );
1293
- }
1294
- function ur(e, t) {
1295
- var r = t == null ? "" : typeof t == "object" ? t + "" : t;
1296
- r !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = r, e.nodeValue = r + "");
1297
- }
1298
- function Yt(e, t, r) {
1299
- if (e == null)
1300
- return t(void 0), r && r(void 0), ee;
1301
- const n = Ti(
1302
- () => e.subscribe(
1303
- t,
1304
- // @ts-expect-error
1305
- r
1306
- )
1307
- );
1308
- return n.unsubscribe ? () => n.unsubscribe() : n;
1309
- }
1310
- const ge = [];
1311
- function Bi(e, t) {
1312
- return {
1313
- subscribe: lt(e, t).subscribe
1314
- };
1315
- }
1316
- function lt(e, t = ee) {
1317
- let r = null;
1318
- const n = /* @__PURE__ */ new Set();
1319
- function i(l) {
1320
- if (Pr(e, l) && (e = l, r)) {
1321
- const u = !ge.length;
1322
- for (const o of n)
1323
- o[1](), ge.push(o, e);
1324
- if (u) {
1325
- for (let o = 0; o < ge.length; o += 2)
1326
- ge[o][0](ge[o + 1]);
1327
- ge.length = 0;
1328
- }
1329
- }
1330
- }
1331
- function s(l) {
1332
- i(l(
1333
- /** @type {T} */
1334
- e
1335
- ));
1336
- }
1337
- function a(l, u = ee) {
1338
- const o = [l, u];
1339
- return n.add(o), n.size === 1 && (r = t(i, s) || ee), l(
1340
- /** @type {T} */
1341
- e
1342
- ), () => {
1343
- n.delete(o), n.size === 0 && r && (r(), r = null);
1344
- };
1345
- }
1346
- return { set: i, update: s, subscribe: a };
1347
- }
1348
- function Ce(e, t, r) {
1349
- const n = !Array.isArray(e), i = n ? [e] : e;
1350
- if (!i.every(Boolean))
1351
- throw new Error("derived() expects stores as input, got a falsy value");
1352
- const s = t.length < 2;
1353
- return Bi(r, (a, l) => {
1354
- let u = !1;
1355
- const o = [];
1356
- let f = 0, c = ee;
1357
- const h = () => {
1358
- if (f)
1359
- return;
1360
- c();
1361
- const v = t(n ? o[0] : o, a, l);
1362
- s ? a(v) : c = typeof v == "function" ? v : ee;
1363
- }, p = i.map(
1364
- (v, d) => Yt(
1365
- v,
1366
- (y) => {
1367
- o[d] = y, f &= ~(1 << d), u && h();
1368
- },
1369
- () => {
1370
- f |= 1 << d;
1371
- }
1372
- )
1373
- );
1374
- return u = !0, h(), function() {
1375
- Tr(p), c(), u = !1;
1376
- };
1377
- });
1378
- }
1379
- function Pi(e) {
1380
- let t;
1381
- return Yt(e, (r) => t = r)(), t;
1382
- }
1383
- let Lt = Symbol();
1384
- function Ni(e, t, r) {
1385
- const n = r[t] ?? (r[t] = {
1386
- store: null,
1387
- source: /* @__PURE__ */ li(void 0),
1388
- unsubscribe: ee
1389
- });
1390
- if (n.store !== e && !(Lt in r))
1391
- if (n.unsubscribe(), n.store = e ?? null, e == null)
1392
- n.source.v = void 0, n.unsubscribe = ee;
1393
- else {
1394
- var i = !0;
1395
- n.unsubscribe = Yt(e, (s) => {
1396
- i ? n.source.v = s : O(n.source, s);
1397
- }), i = !1;
1398
- }
1399
- return e && Lt in r ? Pi(e) : H(n.source);
1400
- }
1401
- function Oi() {
1402
- const e = {};
1403
- function t() {
1404
- Wr(() => {
1405
- for (var r in e)
1406
- e[r].unsubscribe();
1407
- Cn(e, Lt, {
1408
- enumerable: !1,
1409
- value: !0
1410
- });
1411
- });
1412
- }
1413
- return [e, t];
1414
- }
1415
- function $e(e, t, r, n) {
1416
- var i = (
1417
- /** @type {V} */
1418
- n
1419
- ), s = !0, a = () => (s && (s = !1, i = /** @type {V} */
1420
- n), i), l;
1421
- l = /** @type {V} */
1422
- e[t], l === void 0 && n !== void 0 && (l = a());
1423
- var u;
1424
- return u = () => {
1425
- var o = (
1426
- /** @type {V} */
1427
- e[t]
1428
- );
1429
- return o === void 0 ? a() : (s = !0, o);
1430
- }, u;
1431
- }
1432
- class Ii extends Error {
1433
- constructor(t, r) {
1434
- super(r), this.code = t, this.name = "ElevateApiError";
1435
- }
1436
- }
1437
- const Li = async (e) => {
1438
- const t = new URL(`${e.apiEndpoint}/elevate/playerInfo?language=${e.locale ?? ""}`), r = new Headers({ "Content-Type": "application/json" });
1439
- e.userSession && r.append("X-SessionId", e.userSession);
1440
- const i = await (await fetch(t.href, { method: "GET", headers: r })).json();
1441
- if (!i.success)
1442
- throw new Ii(i.errorCode, i.errorMessage);
1443
- return i.data;
1444
- }, Ri = async (e) => {
1445
- const t = new URL(`${e.apiEndpoint}/elevate/levels?language=${e.locale ?? ""}`);
1446
- return (await (await fetch(t.href, { method: "GET" })).json()).data;
1447
- }, Ci = (e, t) => {
1448
- const r = [...e].sort((i, s) => i.firstEntryPoints > s.firstEntryPoints ? 1 : -1);
1449
- let n = 0;
1450
- return r.forEach((i, s) => {
1451
- t > i.firstEntryPoints && (n = s);
1452
- }), n;
1453
- }, Mi = (e) => {
1454
- window.postMessage({ type: "GamificationXpUpdated", points: e }, window.location.href);
1455
- }, Di = (e) => {
1456
- let t = /* @__PURE__ */ G(void 0), r = /* @__PURE__ */ G(void 0), n = /* @__PURE__ */ G(void 0), i = /* @__PURE__ */ G(void 0), s = /* @__PURE__ */ G(!1), a = /* @__PURE__ */ G(void 0);
1457
- const l = async () => {
1458
- const { apiEndpoint: u, userSession: o, locale: f, loadLevels: c, onLevelLoaded: h } = e();
1459
- if (!(!u || !o)) {
1460
- O(s, !0), O(a, void 0);
1461
- try {
1462
- const p = [
1463
- Li({ apiEndpoint: u, userSession: o, locale: f }).then((v) => {
1464
- var y, I, L, S, N, U, ae;
1465
- Mi((y = v.level) == null ? void 0 : y.loyaltyPoints);
1466
- const d = v.level;
1467
- d.name = ((I = d.presentation) == null ? void 0 : I.displayName) || d.name, d.spendablePoints = ((L = v.spendableWallet) == null ? void 0 : L.total.points) || 0, O(t, d, !0), O(n, (S = v.loyaltyWallet) == null ? void 0 : S.total, !0), O(i, (N = v.spendableWallet) == null ? void 0 : N.total, !0), h == null || h({ elevateLevel: d }), h == null || h({
1468
- elevateLevelWalletTotal: (U = v.spendableWallet) == null ? void 0 : U.total,
1469
- loyaltyWalletTotal: (ae = v.loyaltyWallet) == null ? void 0 : ae.total
1470
- });
1471
- })
1472
- ];
1473
- c && p.push(Ri({ apiEndpoint: u, userSession: o, locale: f }).then((v) => {
1474
- O(r, v, !0);
1475
- })), await Promise.all(p), await Nn(), H(r) && H(t) && (h == null || h({
1476
- calculatedLevelFlag: Ci(H(r), H(t).loyaltyPoints ?? 0)
1477
- }));
1478
- } catch (p) {
1479
- O(a, p, !0), console.error("Failed to load elevate info:", p);
1480
- } finally {
1481
- O(s, !1);
1482
- }
1483
- }
1484
- };
1485
- return sr(() => {
1486
- const { apiEndpoint: u, userSession: o, locale: f, loadLevels: c } = e();
1487
- l();
1488
- }), sr(() => {
1489
- const u = () => {
1490
- l();
1491
- };
1492
- return window.addEventListener("redeemRewardButton", u), () => window.removeEventListener("redeemRewardButton", u);
1493
- }), {
1494
- get playerElevateLevel() {
1495
- return H(t);
1496
- },
1497
- get levels() {
1498
- return H(r);
1499
- },
1500
- get loyaltyWalletTotal() {
1501
- return H(n);
1502
- },
1503
- get spendableWalletTotal() {
1504
- return H(i);
1505
- },
1506
- get loading() {
1507
- return H(s);
1508
- },
1509
- get error() {
1510
- return H(a);
1511
- },
1512
- reload: l
1513
- };
1514
- };
1515
- function Ui(e) {
1516
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1517
- }
1518
- var Gi = function(t) {
1519
- return Fi(t) && !ji(t);
1520
- };
1521
- function Fi(e) {
1522
- return !!e && typeof e == "object";
1523
- }
1524
- function ji(e) {
1525
- var t = Object.prototype.toString.call(e);
1526
- return t === "[object RegExp]" || t === "[object Date]" || Xi(e);
1527
- }
1528
- var ki = typeof Symbol == "function" && Symbol.for, Vi = ki ? Symbol.for("react.element") : 60103;
1529
- function Xi(e) {
1530
- return e.$$typeof === Vi;
1531
- }
1532
- function Wi(e) {
1533
- return Array.isArray(e) ? [] : {};
1534
- }
1535
- function ke(e, t) {
1536
- return t.clone !== !1 && t.isMergeableObject(e) ? Pe(Wi(e), e, t) : e;
1537
- }
1538
- function zi(e, t, r) {
1539
- return e.concat(t).map(function(n) {
1540
- return ke(n, r);
1541
- });
1542
- }
1543
- function $i(e, t) {
1544
- if (!t.customMerge)
1545
- return Pe;
1546
- var r = t.customMerge(e);
1547
- return typeof r == "function" ? r : Pe;
1548
- }
1549
- function qi(e) {
1550
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
1551
- return Object.propertyIsEnumerable.call(e, t);
1552
- }) : [];
1553
- }
1554
- function lr(e) {
1555
- return Object.keys(e).concat(qi(e));
1556
- }
1557
- function nn(e, t) {
1558
- try {
1559
- return t in e;
1560
- } catch {
1561
- return !1;
1562
- }
1563
- }
1564
- function Zi(e, t) {
1565
- return nn(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
1566
- }
1567
- function Qi(e, t, r) {
1568
- var n = {};
1569
- return r.isMergeableObject(e) && lr(e).forEach(function(i) {
1570
- n[i] = ke(e[i], r);
1571
- }), lr(t).forEach(function(i) {
1572
- Zi(e, i) || (nn(e, i) && r.isMergeableObject(t[i]) ? n[i] = $i(i, r)(e[i], t[i], r) : n[i] = ke(t[i], r));
1573
- }), n;
1574
- }
1575
- function Pe(e, t, r) {
1576
- r = r || {}, r.arrayMerge = r.arrayMerge || zi, r.isMergeableObject = r.isMergeableObject || Gi, r.cloneUnlessOtherwiseSpecified = ke;
1577
- var n = Array.isArray(t), i = Array.isArray(e), s = n === i;
1578
- return s ? n ? r.arrayMerge(e, t, r) : Qi(e, t, r) : ke(t, r);
1579
- }
1580
- Pe.all = function(t, r) {
1581
- if (!Array.isArray(t))
1582
- throw new Error("first argument should be an array");
1583
- return t.reduce(function(n, i) {
1584
- return Pe(n, i, r);
1585
- }, {});
1586
- };
1587
- var Yi = Pe, Ji = Yi;
1588
- const Ki = /* @__PURE__ */ Ui(Ji);
1589
- var Rt = function(e, t) {
1590
- return Rt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
1591
- r.__proto__ = n;
1592
- } || function(r, n) {
1593
- for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (r[i] = n[i]);
1594
- }, Rt(e, t);
1595
- };
1596
- function ft(e, t) {
1597
- if (typeof t != "function" && t !== null)
1598
- throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
1599
- Rt(e, t);
1600
- function r() {
1601
- this.constructor = e;
1602
- }
1603
- e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
1604
- }
1605
- var Z = function() {
1606
- return Z = Object.assign || function(t) {
1607
- for (var r, n = 1, i = arguments.length; n < i; n++) {
1608
- r = arguments[n];
1609
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
1610
- }
1611
- return t;
1612
- }, Z.apply(this, arguments);
1613
- };
1614
- function es(e, t) {
1615
- var r = {};
1616
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
1617
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
1618
- for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
1619
- t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (r[n[i]] = e[n[i]]);
1620
- return r;
1621
- }
1622
- function gt(e, t, r) {
1623
- if (r || arguments.length === 2) for (var n = 0, i = t.length, s; n < i; n++)
1624
- (s || !(n in t)) && (s || (s = Array.prototype.slice.call(t, 0, n)), s[n] = t[n]);
1625
- return e.concat(s || Array.prototype.slice.call(t));
1626
- }
1627
- function Et(e, t) {
1628
- var r = t && t.cache ? t.cache : os, n = t && t.serializer ? t.serializer : ss, i = t && t.strategy ? t.strategy : ns;
1629
- return i(e, {
1630
- cache: r,
1631
- serializer: n
1632
- });
1633
- }
1634
- function ts(e) {
1635
- return e == null || typeof e == "number" || typeof e == "boolean";
1636
- }
1637
- function rs(e, t, r, n) {
1638
- var i = ts(n) ? n : r(n), s = t.get(i);
1639
- return typeof s > "u" && (s = e.call(this, n), t.set(i, s)), s;
1640
- }
1641
- function sn(e, t, r) {
1642
- var n = Array.prototype.slice.call(arguments, 3), i = r(n), s = t.get(i);
1643
- return typeof s > "u" && (s = e.apply(this, n), t.set(i, s)), s;
1644
- }
1645
- function an(e, t, r, n, i) {
1646
- return r.bind(t, e, n, i);
1647
- }
1648
- function ns(e, t) {
1649
- var r = e.length === 1 ? rs : sn;
1650
- return an(e, this, r, t.cache.create(), t.serializer);
1651
- }
1652
- function is(e, t) {
1653
- return an(e, this, sn, t.cache.create(), t.serializer);
1654
- }
1655
- var ss = function() {
1656
- return JSON.stringify(arguments);
1657
- }, as = (
1658
- /** @class */
1659
- function() {
1660
- function e() {
1661
- this.cache = /* @__PURE__ */ Object.create(null);
1662
- }
1663
- return e.prototype.get = function(t) {
1664
- return this.cache[t];
1665
- }, e.prototype.set = function(t, r) {
1666
- this.cache[t] = r;
1667
- }, e;
1668
- }()
1669
- ), os = {
1670
- create: function() {
1671
- return new as();
1672
- }
1673
- }, yt = {
1674
- variadic: is
1675
- }, nt = function() {
1676
- return nt = Object.assign || function(t) {
1677
- for (var r, n = 1, i = arguments.length; n < i; n++) {
1678
- r = arguments[n];
1679
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
1680
- }
1681
- return t;
1682
- }, nt.apply(this, arguments);
1683
- };
1684
- var m;
1685
- (function(e) {
1686
- e[e.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", e[e.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", e[e.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", e[e.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", e[e.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", e[e.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", e[e.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", e[e.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", e[e.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", e[e.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", e[e.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", e[e.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", e[e.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", e[e.INVALID_TAG = 23] = "INVALID_TAG", e[e.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", e[e.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", e[e.UNCLOSED_TAG = 27] = "UNCLOSED_TAG";
1687
- })(m || (m = {}));
1688
- var g;
1689
- (function(e) {
1690
- e[e.literal = 0] = "literal", e[e.argument = 1] = "argument", e[e.number = 2] = "number", e[e.date = 3] = "date", e[e.time = 4] = "time", e[e.select = 5] = "select", e[e.plural = 6] = "plural", e[e.pound = 7] = "pound", e[e.tag = 8] = "tag";
1691
- })(g || (g = {}));
1692
- var Ne;
1693
- (function(e) {
1694
- e[e.number = 0] = "number", e[e.dateTime = 1] = "dateTime";
1695
- })(Ne || (Ne = {}));
1696
- function fr(e) {
1697
- return e.type === g.literal;
1698
- }
1699
- function us(e) {
1700
- return e.type === g.argument;
1701
- }
1702
- function on(e) {
1703
- return e.type === g.number;
1704
- }
1705
- function un(e) {
1706
- return e.type === g.date;
1707
- }
1708
- function ln(e) {
1709
- return e.type === g.time;
1710
- }
1711
- function fn(e) {
1712
- return e.type === g.select;
1713
- }
1714
- function hn(e) {
1715
- return e.type === g.plural;
1716
- }
1717
- function ls(e) {
1718
- return e.type === g.pound;
1719
- }
1720
- function cn(e) {
1721
- return e.type === g.tag;
1722
- }
1723
- function pn(e) {
1724
- return !!(e && typeof e == "object" && e.type === Ne.number);
1725
- }
1726
- function Ct(e) {
1727
- return !!(e && typeof e == "object" && e.type === Ne.dateTime);
1728
- }
1729
- var vn = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, fs = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
1730
- function hs(e) {
1731
- var t = {};
1732
- return e.replace(fs, function(r) {
1733
- var n = r.length;
1734
- switch (r[0]) {
1735
- case "G":
1736
- t.era = n === 4 ? "long" : n === 5 ? "narrow" : "short";
1737
- break;
1738
- case "y":
1739
- t.year = n === 2 ? "2-digit" : "numeric";
1740
- break;
1741
- case "Y":
1742
- case "u":
1743
- case "U":
1744
- case "r":
1745
- throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
1746
- case "q":
1747
- case "Q":
1748
- throw new RangeError("`q/Q` (quarter) patterns are not supported");
1749
- case "M":
1750
- case "L":
1751
- t.month = ["numeric", "2-digit", "short", "long", "narrow"][n - 1];
1752
- break;
1753
- case "w":
1754
- case "W":
1755
- throw new RangeError("`w/W` (week) patterns are not supported");
1756
- case "d":
1757
- t.day = ["numeric", "2-digit"][n - 1];
1758
- break;
1759
- case "D":
1760
- case "F":
1761
- case "g":
1762
- throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
1763
- case "E":
1764
- t.weekday = n === 4 ? "long" : n === 5 ? "narrow" : "short";
1765
- break;
1766
- case "e":
1767
- if (n < 4)
1768
- throw new RangeError("`e..eee` (weekday) patterns are not supported");
1769
- t.weekday = ["short", "long", "narrow", "short"][n - 4];
1770
- break;
1771
- case "c":
1772
- if (n < 4)
1773
- throw new RangeError("`c..ccc` (weekday) patterns are not supported");
1774
- t.weekday = ["short", "long", "narrow", "short"][n - 4];
1775
- break;
1776
- case "a":
1777
- t.hour12 = !0;
1778
- break;
1779
- case "b":
1780
- case "B":
1781
- throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
1782
- case "h":
1783
- t.hourCycle = "h12", t.hour = ["numeric", "2-digit"][n - 1];
1784
- break;
1785
- case "H":
1786
- t.hourCycle = "h23", t.hour = ["numeric", "2-digit"][n - 1];
1787
- break;
1788
- case "K":
1789
- t.hourCycle = "h11", t.hour = ["numeric", "2-digit"][n - 1];
1790
- break;
1791
- case "k":
1792
- t.hourCycle = "h24", t.hour = ["numeric", "2-digit"][n - 1];
1793
- break;
1794
- case "j":
1795
- case "J":
1796
- case "C":
1797
- throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
1798
- case "m":
1799
- t.minute = ["numeric", "2-digit"][n - 1];
1800
- break;
1801
- case "s":
1802
- t.second = ["numeric", "2-digit"][n - 1];
1803
- break;
1804
- case "S":
1805
- case "A":
1806
- throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
1807
- case "z":
1808
- t.timeZoneName = n < 4 ? "short" : "long";
1809
- break;
1810
- case "Z":
1811
- case "O":
1812
- case "v":
1813
- case "V":
1814
- case "X":
1815
- case "x":
1816
- throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
1817
- }
1818
- return "";
1819
- }), t;
1820
- }
1821
- var w = function() {
1822
- return w = Object.assign || function(t) {
1823
- for (var r, n = 1, i = arguments.length; n < i; n++) {
1824
- r = arguments[n];
1825
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
1826
- }
1827
- return t;
1828
- }, w.apply(this, arguments);
1829
- };
1830
- var cs = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
1831
- function ps(e) {
1832
- if (e.length === 0)
1833
- throw new Error("Number skeleton cannot be empty");
1834
- for (var t = e.split(cs).filter(function(h) {
1835
- return h.length > 0;
1836
- }), r = [], n = 0, i = t; n < i.length; n++) {
1837
- var s = i[n], a = s.split("/");
1838
- if (a.length === 0)
1839
- throw new Error("Invalid number skeleton");
1840
- for (var l = a[0], u = a.slice(1), o = 0, f = u; o < f.length; o++) {
1841
- var c = f[o];
1842
- if (c.length === 0)
1843
- throw new Error("Invalid number skeleton");
1844
- }
1845
- r.push({ stem: l, options: u });
1846
- }
1847
- return r;
1848
- }
1849
- function vs(e) {
1850
- return e.replace(/^(.*?)-/, "");
1851
- }
1852
- var hr = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, dn = /^(@+)?(\+|#+)?[rs]?$/g, ds = /(\*)(0+)|(#+)(0+)|(0+)/g, mn = /^(0+)$/;
1853
- function cr(e) {
1854
- var t = {};
1855
- return e[e.length - 1] === "r" ? t.roundingPriority = "morePrecision" : e[e.length - 1] === "s" && (t.roundingPriority = "lessPrecision"), e.replace(dn, function(r, n, i) {
1856
- return typeof i != "string" ? (t.minimumSignificantDigits = n.length, t.maximumSignificantDigits = n.length) : i === "+" ? t.minimumSignificantDigits = n.length : n[0] === "#" ? t.maximumSignificantDigits = n.length : (t.minimumSignificantDigits = n.length, t.maximumSignificantDigits = n.length + (typeof i == "string" ? i.length : 0)), "";
1857
- }), t;
1858
- }
1859
- function _n(e) {
1860
- switch (e) {
1861
- case "sign-auto":
1862
- return {
1863
- signDisplay: "auto"
1864
- };
1865
- case "sign-accounting":
1866
- case "()":
1867
- return {
1868
- currencySign: "accounting"
1869
- };
1870
- case "sign-always":
1871
- case "+!":
1872
- return {
1873
- signDisplay: "always"
1874
- };
1875
- case "sign-accounting-always":
1876
- case "()!":
1877
- return {
1878
- signDisplay: "always",
1879
- currencySign: "accounting"
1880
- };
1881
- case "sign-except-zero":
1882
- case "+?":
1883
- return {
1884
- signDisplay: "exceptZero"
1885
- };
1886
- case "sign-accounting-except-zero":
1887
- case "()?":
1888
- return {
1889
- signDisplay: "exceptZero",
1890
- currencySign: "accounting"
1891
- };
1892
- case "sign-never":
1893
- case "+_":
1894
- return {
1895
- signDisplay: "never"
1896
- };
1897
- }
1898
- }
1899
- function ms(e) {
1900
- var t;
1901
- if (e[0] === "E" && e[1] === "E" ? (t = {
1902
- notation: "engineering"
1903
- }, e = e.slice(2)) : e[0] === "E" && (t = {
1904
- notation: "scientific"
1905
- }, e = e.slice(1)), t) {
1906
- var r = e.slice(0, 2);
1907
- if (r === "+!" ? (t.signDisplay = "always", e = e.slice(2)) : r === "+?" && (t.signDisplay = "exceptZero", e = e.slice(2)), !mn.test(e))
1908
- throw new Error("Malformed concise eng/scientific notation");
1909
- t.minimumIntegerDigits = e.length;
1910
- }
1911
- return t;
1912
- }
1913
- function pr(e) {
1914
- var t = {}, r = _n(e);
1915
- return r || t;
1916
- }
1917
- function _s(e) {
1918
- for (var t = {}, r = 0, n = e; r < n.length; r++) {
1919
- var i = n[r];
1920
- switch (i.stem) {
1921
- case "percent":
1922
- case "%":
1923
- t.style = "percent";
1924
- continue;
1925
- case "%x100":
1926
- t.style = "percent", t.scale = 100;
1927
- continue;
1928
- case "currency":
1929
- t.style = "currency", t.currency = i.options[0];
1930
- continue;
1931
- case "group-off":
1932
- case ",_":
1933
- t.useGrouping = !1;
1934
- continue;
1935
- case "precision-integer":
1936
- case ".":
1937
- t.maximumFractionDigits = 0;
1938
- continue;
1939
- case "measure-unit":
1940
- case "unit":
1941
- t.style = "unit", t.unit = vs(i.options[0]);
1942
- continue;
1943
- case "compact-short":
1944
- case "K":
1945
- t.notation = "compact", t.compactDisplay = "short";
1946
- continue;
1947
- case "compact-long":
1948
- case "KK":
1949
- t.notation = "compact", t.compactDisplay = "long";
1950
- continue;
1951
- case "scientific":
1952
- t = w(w(w({}, t), { notation: "scientific" }), i.options.reduce(function(u, o) {
1953
- return w(w({}, u), pr(o));
1954
- }, {}));
1955
- continue;
1956
- case "engineering":
1957
- t = w(w(w({}, t), { notation: "engineering" }), i.options.reduce(function(u, o) {
1958
- return w(w({}, u), pr(o));
1959
- }, {}));
1960
- continue;
1961
- case "notation-simple":
1962
- t.notation = "standard";
1963
- continue;
1964
- case "unit-width-narrow":
1965
- t.currencyDisplay = "narrowSymbol", t.unitDisplay = "narrow";
1966
- continue;
1967
- case "unit-width-short":
1968
- t.currencyDisplay = "code", t.unitDisplay = "short";
1969
- continue;
1970
- case "unit-width-full-name":
1971
- t.currencyDisplay = "name", t.unitDisplay = "long";
1972
- continue;
1973
- case "unit-width-iso-code":
1974
- t.currencyDisplay = "symbol";
1975
- continue;
1976
- case "scale":
1977
- t.scale = parseFloat(i.options[0]);
1978
- continue;
1979
- case "rounding-mode-floor":
1980
- t.roundingMode = "floor";
1981
- continue;
1982
- case "rounding-mode-ceiling":
1983
- t.roundingMode = "ceil";
1984
- continue;
1985
- case "rounding-mode-down":
1986
- t.roundingMode = "trunc";
1987
- continue;
1988
- case "rounding-mode-up":
1989
- t.roundingMode = "expand";
1990
- continue;
1991
- case "rounding-mode-half-even":
1992
- t.roundingMode = "halfEven";
1993
- continue;
1994
- case "rounding-mode-half-down":
1995
- t.roundingMode = "halfTrunc";
1996
- continue;
1997
- case "rounding-mode-half-up":
1998
- t.roundingMode = "halfExpand";
1999
- continue;
2000
- case "integer-width":
2001
- if (i.options.length > 1)
2002
- throw new RangeError("integer-width stems only accept a single optional option");
2003
- i.options[0].replace(ds, function(u, o, f, c, h, p) {
2004
- if (o)
2005
- t.minimumIntegerDigits = f.length;
2006
- else {
2007
- if (c && h)
2008
- throw new Error("We currently do not support maximum integer digits");
2009
- if (p)
2010
- throw new Error("We currently do not support exact integer digits");
2011
- }
2012
- return "";
2013
- });
2014
- continue;
2015
- }
2016
- if (mn.test(i.stem)) {
2017
- t.minimumIntegerDigits = i.stem.length;
2018
- continue;
2019
- }
2020
- if (hr.test(i.stem)) {
2021
- if (i.options.length > 1)
2022
- throw new RangeError("Fraction-precision stems only accept a single optional option");
2023
- i.stem.replace(hr, function(u, o, f, c, h, p) {
2024
- return f === "*" ? t.minimumFractionDigits = o.length : c && c[0] === "#" ? t.maximumFractionDigits = c.length : h && p ? (t.minimumFractionDigits = h.length, t.maximumFractionDigits = h.length + p.length) : (t.minimumFractionDigits = o.length, t.maximumFractionDigits = o.length), "";
2025
- });
2026
- var s = i.options[0];
2027
- s === "w" ? t = w(w({}, t), { trailingZeroDisplay: "stripIfInteger" }) : s && (t = w(w({}, t), cr(s)));
2028
- continue;
2029
- }
2030
- if (dn.test(i.stem)) {
2031
- t = w(w({}, t), cr(i.stem));
2032
- continue;
2033
- }
2034
- var a = _n(i.stem);
2035
- a && (t = w(w({}, t), a));
2036
- var l = ms(i.stem);
2037
- l && (t = w(w({}, t), l));
2038
- }
2039
- return t;
2040
- }
2041
- var qe = {
2042
- "001": [
2043
- "H",
2044
- "h"
2045
- ],
2046
- 419: [
2047
- "h",
2048
- "H",
2049
- "hB",
2050
- "hb"
2051
- ],
2052
- AC: [
2053
- "H",
2054
- "h",
2055
- "hb",
2056
- "hB"
2057
- ],
2058
- AD: [
2059
- "H",
2060
- "hB"
2061
- ],
2062
- AE: [
2063
- "h",
2064
- "hB",
2065
- "hb",
2066
- "H"
2067
- ],
2068
- AF: [
2069
- "H",
2070
- "hb",
2071
- "hB",
2072
- "h"
2073
- ],
2074
- AG: [
2075
- "h",
2076
- "hb",
2077
- "H",
2078
- "hB"
2079
- ],
2080
- AI: [
2081
- "H",
2082
- "h",
2083
- "hb",
2084
- "hB"
2085
- ],
2086
- AL: [
2087
- "h",
2088
- "H",
2089
- "hB"
2090
- ],
2091
- AM: [
2092
- "H",
2093
- "hB"
2094
- ],
2095
- AO: [
2096
- "H",
2097
- "hB"
2098
- ],
2099
- AR: [
2100
- "h",
2101
- "H",
2102
- "hB",
2103
- "hb"
2104
- ],
2105
- AS: [
2106
- "h",
2107
- "H"
2108
- ],
2109
- AT: [
2110
- "H",
2111
- "hB"
2112
- ],
2113
- AU: [
2114
- "h",
2115
- "hb",
2116
- "H",
2117
- "hB"
2118
- ],
2119
- AW: [
2120
- "H",
2121
- "hB"
2122
- ],
2123
- AX: [
2124
- "H"
2125
- ],
2126
- AZ: [
2127
- "H",
2128
- "hB",
2129
- "h"
2130
- ],
2131
- BA: [
2132
- "H",
2133
- "hB",
2134
- "h"
2135
- ],
2136
- BB: [
2137
- "h",
2138
- "hb",
2139
- "H",
2140
- "hB"
2141
- ],
2142
- BD: [
2143
- "h",
2144
- "hB",
2145
- "H"
2146
- ],
2147
- BE: [
2148
- "H",
2149
- "hB"
2150
- ],
2151
- BF: [
2152
- "H",
2153
- "hB"
2154
- ],
2155
- BG: [
2156
- "H",
2157
- "hB",
2158
- "h"
2159
- ],
2160
- BH: [
2161
- "h",
2162
- "hB",
2163
- "hb",
2164
- "H"
2165
- ],
2166
- BI: [
2167
- "H",
2168
- "h"
2169
- ],
2170
- BJ: [
2171
- "H",
2172
- "hB"
2173
- ],
2174
- BL: [
2175
- "H",
2176
- "hB"
2177
- ],
2178
- BM: [
2179
- "h",
2180
- "hb",
2181
- "H",
2182
- "hB"
2183
- ],
2184
- BN: [
2185
- "hb",
2186
- "hB",
2187
- "h",
2188
- "H"
2189
- ],
2190
- BO: [
2191
- "h",
2192
- "H",
2193
- "hB",
2194
- "hb"
2195
- ],
2196
- BQ: [
2197
- "H"
2198
- ],
2199
- BR: [
2200
- "H",
2201
- "hB"
2202
- ],
2203
- BS: [
2204
- "h",
2205
- "hb",
2206
- "H",
2207
- "hB"
2208
- ],
2209
- BT: [
2210
- "h",
2211
- "H"
2212
- ],
2213
- BW: [
2214
- "H",
2215
- "h",
2216
- "hb",
2217
- "hB"
2218
- ],
2219
- BY: [
2220
- "H",
2221
- "h"
2222
- ],
2223
- BZ: [
2224
- "H",
2225
- "h",
2226
- "hb",
2227
- "hB"
2228
- ],
2229
- CA: [
2230
- "h",
2231
- "hb",
2232
- "H",
2233
- "hB"
2234
- ],
2235
- CC: [
2236
- "H",
2237
- "h",
2238
- "hb",
2239
- "hB"
2240
- ],
2241
- CD: [
2242
- "hB",
2243
- "H"
2244
- ],
2245
- CF: [
2246
- "H",
2247
- "h",
2248
- "hB"
2249
- ],
2250
- CG: [
2251
- "H",
2252
- "hB"
2253
- ],
2254
- CH: [
2255
- "H",
2256
- "hB",
2257
- "h"
2258
- ],
2259
- CI: [
2260
- "H",
2261
- "hB"
2262
- ],
2263
- CK: [
2264
- "H",
2265
- "h",
2266
- "hb",
2267
- "hB"
2268
- ],
2269
- CL: [
2270
- "h",
2271
- "H",
2272
- "hB",
2273
- "hb"
2274
- ],
2275
- CM: [
2276
- "H",
2277
- "h",
2278
- "hB"
2279
- ],
2280
- CN: [
2281
- "H",
2282
- "hB",
2283
- "hb",
2284
- "h"
2285
- ],
2286
- CO: [
2287
- "h",
2288
- "H",
2289
- "hB",
2290
- "hb"
2291
- ],
2292
- CP: [
2293
- "H"
2294
- ],
2295
- CR: [
2296
- "h",
2297
- "H",
2298
- "hB",
2299
- "hb"
2300
- ],
2301
- CU: [
2302
- "h",
2303
- "H",
2304
- "hB",
2305
- "hb"
2306
- ],
2307
- CV: [
2308
- "H",
2309
- "hB"
2310
- ],
2311
- CW: [
2312
- "H",
2313
- "hB"
2314
- ],
2315
- CX: [
2316
- "H",
2317
- "h",
2318
- "hb",
2319
- "hB"
2320
- ],
2321
- CY: [
2322
- "h",
2323
- "H",
2324
- "hb",
2325
- "hB"
2326
- ],
2327
- CZ: [
2328
- "H"
2329
- ],
2330
- DE: [
2331
- "H",
2332
- "hB"
2333
- ],
2334
- DG: [
2335
- "H",
2336
- "h",
2337
- "hb",
2338
- "hB"
2339
- ],
2340
- DJ: [
2341
- "h",
2342
- "H"
2343
- ],
2344
- DK: [
2345
- "H"
2346
- ],
2347
- DM: [
2348
- "h",
2349
- "hb",
2350
- "H",
2351
- "hB"
2352
- ],
2353
- DO: [
2354
- "h",
2355
- "H",
2356
- "hB",
2357
- "hb"
2358
- ],
2359
- DZ: [
2360
- "h",
2361
- "hB",
2362
- "hb",
2363
- "H"
2364
- ],
2365
- EA: [
2366
- "H",
2367
- "h",
2368
- "hB",
2369
- "hb"
2370
- ],
2371
- EC: [
2372
- "h",
2373
- "H",
2374
- "hB",
2375
- "hb"
2376
- ],
2377
- EE: [
2378
- "H",
2379
- "hB"
2380
- ],
2381
- EG: [
2382
- "h",
2383
- "hB",
2384
- "hb",
2385
- "H"
2386
- ],
2387
- EH: [
2388
- "h",
2389
- "hB",
2390
- "hb",
2391
- "H"
2392
- ],
2393
- ER: [
2394
- "h",
2395
- "H"
2396
- ],
2397
- ES: [
2398
- "H",
2399
- "hB",
2400
- "h",
2401
- "hb"
2402
- ],
2403
- ET: [
2404
- "hB",
2405
- "hb",
2406
- "h",
2407
- "H"
2408
- ],
2409
- FI: [
2410
- "H"
2411
- ],
2412
- FJ: [
2413
- "h",
2414
- "hb",
2415
- "H",
2416
- "hB"
2417
- ],
2418
- FK: [
2419
- "H",
2420
- "h",
2421
- "hb",
2422
- "hB"
2423
- ],
2424
- FM: [
2425
- "h",
2426
- "hb",
2427
- "H",
2428
- "hB"
2429
- ],
2430
- FO: [
2431
- "H",
2432
- "h"
2433
- ],
2434
- FR: [
2435
- "H",
2436
- "hB"
2437
- ],
2438
- GA: [
2439
- "H",
2440
- "hB"
2441
- ],
2442
- GB: [
2443
- "H",
2444
- "h",
2445
- "hb",
2446
- "hB"
2447
- ],
2448
- GD: [
2449
- "h",
2450
- "hb",
2451
- "H",
2452
- "hB"
2453
- ],
2454
- GE: [
2455
- "H",
2456
- "hB",
2457
- "h"
2458
- ],
2459
- GF: [
2460
- "H",
2461
- "hB"
2462
- ],
2463
- GG: [
2464
- "H",
2465
- "h",
2466
- "hb",
2467
- "hB"
2468
- ],
2469
- GH: [
2470
- "h",
2471
- "H"
2472
- ],
2473
- GI: [
2474
- "H",
2475
- "h",
2476
- "hb",
2477
- "hB"
2478
- ],
2479
- GL: [
2480
- "H",
2481
- "h"
2482
- ],
2483
- GM: [
2484
- "h",
2485
- "hb",
2486
- "H",
2487
- "hB"
2488
- ],
2489
- GN: [
2490
- "H",
2491
- "hB"
2492
- ],
2493
- GP: [
2494
- "H",
2495
- "hB"
2496
- ],
2497
- GQ: [
2498
- "H",
2499
- "hB",
2500
- "h",
2501
- "hb"
2502
- ],
2503
- GR: [
2504
- "h",
2505
- "H",
2506
- "hb",
2507
- "hB"
2508
- ],
2509
- GT: [
2510
- "h",
2511
- "H",
2512
- "hB",
2513
- "hb"
2514
- ],
2515
- GU: [
2516
- "h",
2517
- "hb",
2518
- "H",
2519
- "hB"
2520
- ],
2521
- GW: [
2522
- "H",
2523
- "hB"
2524
- ],
2525
- GY: [
2526
- "h",
2527
- "hb",
2528
- "H",
2529
- "hB"
2530
- ],
2531
- HK: [
2532
- "h",
2533
- "hB",
2534
- "hb",
2535
- "H"
2536
- ],
2537
- HN: [
2538
- "h",
2539
- "H",
2540
- "hB",
2541
- "hb"
2542
- ],
2543
- HR: [
2544
- "H",
2545
- "hB"
2546
- ],
2547
- HU: [
2548
- "H",
2549
- "h"
2550
- ],
2551
- IC: [
2552
- "H",
2553
- "h",
2554
- "hB",
2555
- "hb"
2556
- ],
2557
- ID: [
2558
- "H"
2559
- ],
2560
- IE: [
2561
- "H",
2562
- "h",
2563
- "hb",
2564
- "hB"
2565
- ],
2566
- IL: [
2567
- "H",
2568
- "hB"
2569
- ],
2570
- IM: [
2571
- "H",
2572
- "h",
2573
- "hb",
2574
- "hB"
2575
- ],
2576
- IN: [
2577
- "h",
2578
- "H"
2579
- ],
2580
- IO: [
2581
- "H",
2582
- "h",
2583
- "hb",
2584
- "hB"
2585
- ],
2586
- IQ: [
2587
- "h",
2588
- "hB",
2589
- "hb",
2590
- "H"
2591
- ],
2592
- IR: [
2593
- "hB",
2594
- "H"
2595
- ],
2596
- IS: [
2597
- "H"
2598
- ],
2599
- IT: [
2600
- "H",
2601
- "hB"
2602
- ],
2603
- JE: [
2604
- "H",
2605
- "h",
2606
- "hb",
2607
- "hB"
2608
- ],
2609
- JM: [
2610
- "h",
2611
- "hb",
2612
- "H",
2613
- "hB"
2614
- ],
2615
- JO: [
2616
- "h",
2617
- "hB",
2618
- "hb",
2619
- "H"
2620
- ],
2621
- JP: [
2622
- "H",
2623
- "K",
2624
- "h"
2625
- ],
2626
- KE: [
2627
- "hB",
2628
- "hb",
2629
- "H",
2630
- "h"
2631
- ],
2632
- KG: [
2633
- "H",
2634
- "h",
2635
- "hB",
2636
- "hb"
2637
- ],
2638
- KH: [
2639
- "hB",
2640
- "h",
2641
- "H",
2642
- "hb"
2643
- ],
2644
- KI: [
2645
- "h",
2646
- "hb",
2647
- "H",
2648
- "hB"
2649
- ],
2650
- KM: [
2651
- "H",
2652
- "h",
2653
- "hB",
2654
- "hb"
2655
- ],
2656
- KN: [
2657
- "h",
2658
- "hb",
2659
- "H",
2660
- "hB"
2661
- ],
2662
- KP: [
2663
- "h",
2664
- "H",
2665
- "hB",
2666
- "hb"
2667
- ],
2668
- KR: [
2669
- "h",
2670
- "H",
2671
- "hB",
2672
- "hb"
2673
- ],
2674
- KW: [
2675
- "h",
2676
- "hB",
2677
- "hb",
2678
- "H"
2679
- ],
2680
- KY: [
2681
- "h",
2682
- "hb",
2683
- "H",
2684
- "hB"
2685
- ],
2686
- KZ: [
2687
- "H",
2688
- "hB"
2689
- ],
2690
- LA: [
2691
- "H",
2692
- "hb",
2693
- "hB",
2694
- "h"
2695
- ],
2696
- LB: [
2697
- "h",
2698
- "hB",
2699
- "hb",
2700
- "H"
2701
- ],
2702
- LC: [
2703
- "h",
2704
- "hb",
2705
- "H",
2706
- "hB"
2707
- ],
2708
- LI: [
2709
- "H",
2710
- "hB",
2711
- "h"
2712
- ],
2713
- LK: [
2714
- "H",
2715
- "h",
2716
- "hB",
2717
- "hb"
2718
- ],
2719
- LR: [
2720
- "h",
2721
- "hb",
2722
- "H",
2723
- "hB"
2724
- ],
2725
- LS: [
2726
- "h",
2727
- "H"
2728
- ],
2729
- LT: [
2730
- "H",
2731
- "h",
2732
- "hb",
2733
- "hB"
2734
- ],
2735
- LU: [
2736
- "H",
2737
- "h",
2738
- "hB"
2739
- ],
2740
- LV: [
2741
- "H",
2742
- "hB",
2743
- "hb",
2744
- "h"
2745
- ],
2746
- LY: [
2747
- "h",
2748
- "hB",
2749
- "hb",
2750
- "H"
2751
- ],
2752
- MA: [
2753
- "H",
2754
- "h",
2755
- "hB",
2756
- "hb"
2757
- ],
2758
- MC: [
2759
- "H",
2760
- "hB"
2761
- ],
2762
- MD: [
2763
- "H",
2764
- "hB"
2765
- ],
2766
- ME: [
2767
- "H",
2768
- "hB",
2769
- "h"
2770
- ],
2771
- MF: [
2772
- "H",
2773
- "hB"
2774
- ],
2775
- MG: [
2776
- "H",
2777
- "h"
2778
- ],
2779
- MH: [
2780
- "h",
2781
- "hb",
2782
- "H",
2783
- "hB"
2784
- ],
2785
- MK: [
2786
- "H",
2787
- "h",
2788
- "hb",
2789
- "hB"
2790
- ],
2791
- ML: [
2792
- "H"
2793
- ],
2794
- MM: [
2795
- "hB",
2796
- "hb",
2797
- "H",
2798
- "h"
2799
- ],
2800
- MN: [
2801
- "H",
2802
- "h",
2803
- "hb",
2804
- "hB"
2805
- ],
2806
- MO: [
2807
- "h",
2808
- "hB",
2809
- "hb",
2810
- "H"
2811
- ],
2812
- MP: [
2813
- "h",
2814
- "hb",
2815
- "H",
2816
- "hB"
2817
- ],
2818
- MQ: [
2819
- "H",
2820
- "hB"
2821
- ],
2822
- MR: [
2823
- "h",
2824
- "hB",
2825
- "hb",
2826
- "H"
2827
- ],
2828
- MS: [
2829
- "H",
2830
- "h",
2831
- "hb",
2832
- "hB"
2833
- ],
2834
- MT: [
2835
- "H",
2836
- "h"
2837
- ],
2838
- MU: [
2839
- "H",
2840
- "h"
2841
- ],
2842
- MV: [
2843
- "H",
2844
- "h"
2845
- ],
2846
- MW: [
2847
- "h",
2848
- "hb",
2849
- "H",
2850
- "hB"
2851
- ],
2852
- MX: [
2853
- "h",
2854
- "H",
2855
- "hB",
2856
- "hb"
2857
- ],
2858
- MY: [
2859
- "hb",
2860
- "hB",
2861
- "h",
2862
- "H"
2863
- ],
2864
- MZ: [
2865
- "H",
2866
- "hB"
2867
- ],
2868
- NA: [
2869
- "h",
2870
- "H",
2871
- "hB",
2872
- "hb"
2873
- ],
2874
- NC: [
2875
- "H",
2876
- "hB"
2877
- ],
2878
- NE: [
2879
- "H"
2880
- ],
2881
- NF: [
2882
- "H",
2883
- "h",
2884
- "hb",
2885
- "hB"
2886
- ],
2887
- NG: [
2888
- "H",
2889
- "h",
2890
- "hb",
2891
- "hB"
2892
- ],
2893
- NI: [
2894
- "h",
2895
- "H",
2896
- "hB",
2897
- "hb"
2898
- ],
2899
- NL: [
2900
- "H",
2901
- "hB"
2902
- ],
2903
- NO: [
2904
- "H",
2905
- "h"
2906
- ],
2907
- NP: [
2908
- "H",
2909
- "h",
2910
- "hB"
2911
- ],
2912
- NR: [
2913
- "H",
2914
- "h",
2915
- "hb",
2916
- "hB"
2917
- ],
2918
- NU: [
2919
- "H",
2920
- "h",
2921
- "hb",
2922
- "hB"
2923
- ],
2924
- NZ: [
2925
- "h",
2926
- "hb",
2927
- "H",
2928
- "hB"
2929
- ],
2930
- OM: [
2931
- "h",
2932
- "hB",
2933
- "hb",
2934
- "H"
2935
- ],
2936
- PA: [
2937
- "h",
2938
- "H",
2939
- "hB",
2940
- "hb"
2941
- ],
2942
- PE: [
2943
- "h",
2944
- "H",
2945
- "hB",
2946
- "hb"
2947
- ],
2948
- PF: [
2949
- "H",
2950
- "h",
2951
- "hB"
2952
- ],
2953
- PG: [
2954
- "h",
2955
- "H"
2956
- ],
2957
- PH: [
2958
- "h",
2959
- "hB",
2960
- "hb",
2961
- "H"
2962
- ],
2963
- PK: [
2964
- "h",
2965
- "hB",
2966
- "H"
2967
- ],
2968
- PL: [
2969
- "H",
2970
- "h"
2971
- ],
2972
- PM: [
2973
- "H",
2974
- "hB"
2975
- ],
2976
- PN: [
2977
- "H",
2978
- "h",
2979
- "hb",
2980
- "hB"
2981
- ],
2982
- PR: [
2983
- "h",
2984
- "H",
2985
- "hB",
2986
- "hb"
2987
- ],
2988
- PS: [
2989
- "h",
2990
- "hB",
2991
- "hb",
2992
- "H"
2993
- ],
2994
- PT: [
2995
- "H",
2996
- "hB"
2997
- ],
2998
- PW: [
2999
- "h",
3000
- "H"
3001
- ],
3002
- PY: [
3003
- "h",
3004
- "H",
3005
- "hB",
3006
- "hb"
3007
- ],
3008
- QA: [
3009
- "h",
3010
- "hB",
3011
- "hb",
3012
- "H"
3013
- ],
3014
- RE: [
3015
- "H",
3016
- "hB"
3017
- ],
3018
- RO: [
3019
- "H",
3020
- "hB"
3021
- ],
3022
- RS: [
3023
- "H",
3024
- "hB",
3025
- "h"
3026
- ],
3027
- RU: [
3028
- "H"
3029
- ],
3030
- RW: [
3031
- "H",
3032
- "h"
3033
- ],
3034
- SA: [
3035
- "h",
3036
- "hB",
3037
- "hb",
3038
- "H"
3039
- ],
3040
- SB: [
3041
- "h",
3042
- "hb",
3043
- "H",
3044
- "hB"
3045
- ],
3046
- SC: [
3047
- "H",
3048
- "h",
3049
- "hB"
3050
- ],
3051
- SD: [
3052
- "h",
3053
- "hB",
3054
- "hb",
3055
- "H"
3056
- ],
3057
- SE: [
3058
- "H"
3059
- ],
3060
- SG: [
3061
- "h",
3062
- "hb",
3063
- "H",
3064
- "hB"
3065
- ],
3066
- SH: [
3067
- "H",
3068
- "h",
3069
- "hb",
3070
- "hB"
3071
- ],
3072
- SI: [
3073
- "H",
3074
- "hB"
3075
- ],
3076
- SJ: [
3077
- "H"
3078
- ],
3079
- SK: [
3080
- "H"
3081
- ],
3082
- SL: [
3083
- "h",
3084
- "hb",
3085
- "H",
3086
- "hB"
3087
- ],
3088
- SM: [
3089
- "H",
3090
- "h",
3091
- "hB"
3092
- ],
3093
- SN: [
3094
- "H",
3095
- "h",
3096
- "hB"
3097
- ],
3098
- SO: [
3099
- "h",
3100
- "H"
3101
- ],
3102
- SR: [
3103
- "H",
3104
- "hB"
3105
- ],
3106
- SS: [
3107
- "h",
3108
- "hb",
3109
- "H",
3110
- "hB"
3111
- ],
3112
- ST: [
3113
- "H",
3114
- "hB"
3115
- ],
3116
- SV: [
3117
- "h",
3118
- "H",
3119
- "hB",
3120
- "hb"
3121
- ],
3122
- SX: [
3123
- "H",
3124
- "h",
3125
- "hb",
3126
- "hB"
3127
- ],
3128
- SY: [
3129
- "h",
3130
- "hB",
3131
- "hb",
3132
- "H"
3133
- ],
3134
- SZ: [
3135
- "h",
3136
- "hb",
3137
- "H",
3138
- "hB"
3139
- ],
3140
- TA: [
3141
- "H",
3142
- "h",
3143
- "hb",
3144
- "hB"
3145
- ],
3146
- TC: [
3147
- "h",
3148
- "hb",
3149
- "H",
3150
- "hB"
3151
- ],
3152
- TD: [
3153
- "h",
3154
- "H",
3155
- "hB"
3156
- ],
3157
- TF: [
3158
- "H",
3159
- "h",
3160
- "hB"
3161
- ],
3162
- TG: [
3163
- "H",
3164
- "hB"
3165
- ],
3166
- TH: [
3167
- "H",
3168
- "h"
3169
- ],
3170
- TJ: [
3171
- "H",
3172
- "h"
3173
- ],
3174
- TL: [
3175
- "H",
3176
- "hB",
3177
- "hb",
3178
- "h"
3179
- ],
3180
- TM: [
3181
- "H",
3182
- "h"
3183
- ],
3184
- TN: [
3185
- "h",
3186
- "hB",
3187
- "hb",
3188
- "H"
3189
- ],
3190
- TO: [
3191
- "h",
3192
- "H"
3193
- ],
3194
- TR: [
3195
- "H",
3196
- "hB"
3197
- ],
3198
- TT: [
3199
- "h",
3200
- "hb",
3201
- "H",
3202
- "hB"
3203
- ],
3204
- TW: [
3205
- "hB",
3206
- "hb",
3207
- "h",
3208
- "H"
3209
- ],
3210
- TZ: [
3211
- "hB",
3212
- "hb",
3213
- "H",
3214
- "h"
3215
- ],
3216
- UA: [
3217
- "H",
3218
- "hB",
3219
- "h"
3220
- ],
3221
- UG: [
3222
- "hB",
3223
- "hb",
3224
- "H",
3225
- "h"
3226
- ],
3227
- UM: [
3228
- "h",
3229
- "hb",
3230
- "H",
3231
- "hB"
3232
- ],
3233
- US: [
3234
- "h",
3235
- "hb",
3236
- "H",
3237
- "hB"
3238
- ],
3239
- UY: [
3240
- "h",
3241
- "H",
3242
- "hB",
3243
- "hb"
3244
- ],
3245
- UZ: [
3246
- "H",
3247
- "hB",
3248
- "h"
3249
- ],
3250
- VA: [
3251
- "H",
3252
- "h",
3253
- "hB"
3254
- ],
3255
- VC: [
3256
- "h",
3257
- "hb",
3258
- "H",
3259
- "hB"
3260
- ],
3261
- VE: [
3262
- "h",
3263
- "H",
3264
- "hB",
3265
- "hb"
3266
- ],
3267
- VG: [
3268
- "h",
3269
- "hb",
3270
- "H",
3271
- "hB"
3272
- ],
3273
- VI: [
3274
- "h",
3275
- "hb",
3276
- "H",
3277
- "hB"
3278
- ],
3279
- VN: [
3280
- "H",
3281
- "h"
3282
- ],
3283
- VU: [
3284
- "h",
3285
- "H"
3286
- ],
3287
- WF: [
3288
- "H",
3289
- "hB"
3290
- ],
3291
- WS: [
3292
- "h",
3293
- "H"
3294
- ],
3295
- XK: [
3296
- "H",
3297
- "hB",
3298
- "h"
3299
- ],
3300
- YE: [
3301
- "h",
3302
- "hB",
3303
- "hb",
3304
- "H"
3305
- ],
3306
- YT: [
3307
- "H",
3308
- "hB"
3309
- ],
3310
- ZA: [
3311
- "H",
3312
- "h",
3313
- "hb",
3314
- "hB"
3315
- ],
3316
- ZM: [
3317
- "h",
3318
- "hb",
3319
- "H",
3320
- "hB"
3321
- ],
3322
- ZW: [
3323
- "H",
3324
- "h"
3325
- ],
3326
- "af-ZA": [
3327
- "H",
3328
- "h",
3329
- "hB",
3330
- "hb"
3331
- ],
3332
- "ar-001": [
3333
- "h",
3334
- "hB",
3335
- "hb",
3336
- "H"
3337
- ],
3338
- "ca-ES": [
3339
- "H",
3340
- "h",
3341
- "hB"
3342
- ],
3343
- "en-001": [
3344
- "h",
3345
- "hb",
3346
- "H",
3347
- "hB"
3348
- ],
3349
- "en-HK": [
3350
- "h",
3351
- "hb",
3352
- "H",
3353
- "hB"
3354
- ],
3355
- "en-IL": [
3356
- "H",
3357
- "h",
3358
- "hb",
3359
- "hB"
3360
- ],
3361
- "en-MY": [
3362
- "h",
3363
- "hb",
3364
- "H",
3365
- "hB"
3366
- ],
3367
- "es-BR": [
3368
- "H",
3369
- "h",
3370
- "hB",
3371
- "hb"
3372
- ],
3373
- "es-ES": [
3374
- "H",
3375
- "h",
3376
- "hB",
3377
- "hb"
3378
- ],
3379
- "es-GQ": [
3380
- "H",
3381
- "h",
3382
- "hB",
3383
- "hb"
3384
- ],
3385
- "fr-CA": [
3386
- "H",
3387
- "h",
3388
- "hB"
3389
- ],
3390
- "gl-ES": [
3391
- "H",
3392
- "h",
3393
- "hB"
3394
- ],
3395
- "gu-IN": [
3396
- "hB",
3397
- "hb",
3398
- "h",
3399
- "H"
3400
- ],
3401
- "hi-IN": [
3402
- "hB",
3403
- "h",
3404
- "H"
3405
- ],
3406
- "it-CH": [
3407
- "H",
3408
- "h",
3409
- "hB"
3410
- ],
3411
- "it-IT": [
3412
- "H",
3413
- "h",
3414
- "hB"
3415
- ],
3416
- "kn-IN": [
3417
- "hB",
3418
- "h",
3419
- "H"
3420
- ],
3421
- "ml-IN": [
3422
- "hB",
3423
- "h",
3424
- "H"
3425
- ],
3426
- "mr-IN": [
3427
- "hB",
3428
- "hb",
3429
- "h",
3430
- "H"
3431
- ],
3432
- "pa-IN": [
3433
- "hB",
3434
- "hb",
3435
- "h",
3436
- "H"
3437
- ],
3438
- "ta-IN": [
3439
- "hB",
3440
- "h",
3441
- "hb",
3442
- "H"
3443
- ],
3444
- "te-IN": [
3445
- "hB",
3446
- "h",
3447
- "H"
3448
- ],
3449
- "zu-ZA": [
3450
- "H",
3451
- "hB",
3452
- "hb",
3453
- "h"
3454
- ]
3455
- };
3456
- function bs(e, t) {
3457
- for (var r = "", n = 0; n < e.length; n++) {
3458
- var i = e.charAt(n);
3459
- if (i === "j") {
3460
- for (var s = 0; n + 1 < e.length && e.charAt(n + 1) === i; )
3461
- s++, n++;
3462
- var a = 1 + (s & 1), l = s < 2 ? 1 : 3 + (s >> 1), u = "a", o = gs(t);
3463
- for ((o == "H" || o == "k") && (l = 0); l-- > 0; )
3464
- r += u;
3465
- for (; a-- > 0; )
3466
- r = o + r;
3467
- } else i === "J" ? r += "H" : r += i;
3468
- }
3469
- return r;
3470
- }
3471
- function gs(e) {
3472
- var t = e.hourCycle;
3473
- if (t === void 0 && // @ts-ignore hourCycle(s) is not identified yet
3474
- e.hourCycles && // @ts-ignore
3475
- e.hourCycles.length && (t = e.hourCycles[0]), t)
3476
- switch (t) {
3477
- case "h24":
3478
- return "k";
3479
- case "h23":
3480
- return "H";
3481
- case "h12":
3482
- return "h";
3483
- case "h11":
3484
- return "K";
3485
- default:
3486
- throw new Error("Invalid hourCycle");
3487
- }
3488
- var r = e.language, n;
3489
- r !== "root" && (n = e.maximize().region);
3490
- var i = qe[n || ""] || qe[r || ""] || qe["".concat(r, "-001")] || qe["001"];
3491
- return i[0];
3492
- }
3493
- var xt, Es = new RegExp("^".concat(vn.source, "*")), ys = new RegExp("".concat(vn.source, "*$"));
3494
- function _(e, t) {
3495
- return { start: e, end: t };
3496
- }
3497
- var xs = !!String.prototype.startsWith && "_a".startsWith("a", 1), Ts = !!String.fromCodePoint, ws = !!Object.fromEntries, Hs = !!String.prototype.codePointAt, Ss = !!String.prototype.trimStart, As = !!String.prototype.trimEnd, Bs = !!Number.isSafeInteger, Ps = Bs ? Number.isSafeInteger : function(e) {
3498
- return typeof e == "number" && isFinite(e) && Math.floor(e) === e && Math.abs(e) <= 9007199254740991;
3499
- }, Mt = !0;
3500
- try {
3501
- var Ns = gn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
3502
- Mt = ((xt = Ns.exec("a")) === null || xt === void 0 ? void 0 : xt[0]) === "a";
3503
- } catch {
3504
- Mt = !1;
3505
- }
3506
- var vr = xs ? (
3507
- // Native
3508
- function(t, r, n) {
3509
- return t.startsWith(r, n);
3510
- }
3511
- ) : (
3512
- // For IE11
3513
- function(t, r, n) {
3514
- return t.slice(n, n + r.length) === r;
3515
- }
3516
- ), Dt = Ts ? String.fromCodePoint : (
3517
- // IE11
3518
- function() {
3519
- for (var t = [], r = 0; r < arguments.length; r++)
3520
- t[r] = arguments[r];
3521
- for (var n = "", i = t.length, s = 0, a; i > s; ) {
3522
- if (a = t[s++], a > 1114111)
3523
- throw RangeError(a + " is not a valid code point");
3524
- n += a < 65536 ? String.fromCharCode(a) : String.fromCharCode(((a -= 65536) >> 10) + 55296, a % 1024 + 56320);
3525
- }
3526
- return n;
3527
- }
3528
- ), dr = (
3529
- // native
3530
- ws ? Object.fromEntries : (
3531
- // Ponyfill
3532
- function(t) {
3533
- for (var r = {}, n = 0, i = t; n < i.length; n++) {
3534
- var s = i[n], a = s[0], l = s[1];
3535
- r[a] = l;
3536
- }
3537
- return r;
3538
- }
3539
- )
3540
- ), bn = Hs ? (
3541
- // Native
3542
- function(t, r) {
3543
- return t.codePointAt(r);
3544
- }
3545
- ) : (
3546
- // IE 11
3547
- function(t, r) {
3548
- var n = t.length;
3549
- if (!(r < 0 || r >= n)) {
3550
- var i = t.charCodeAt(r), s;
3551
- return i < 55296 || i > 56319 || r + 1 === n || (s = t.charCodeAt(r + 1)) < 56320 || s > 57343 ? i : (i - 55296 << 10) + (s - 56320) + 65536;
3552
- }
3553
- }
3554
- ), Os = Ss ? (
3555
- // Native
3556
- function(t) {
3557
- return t.trimStart();
3558
- }
3559
- ) : (
3560
- // Ponyfill
3561
- function(t) {
3562
- return t.replace(Es, "");
3563
- }
3564
- ), Is = As ? (
3565
- // Native
3566
- function(t) {
3567
- return t.trimEnd();
3568
- }
3569
- ) : (
3570
- // Ponyfill
3571
- function(t) {
3572
- return t.replace(ys, "");
3573
- }
3574
- );
3575
- function gn(e, t) {
3576
- return new RegExp(e, t);
3577
- }
3578
- var Ut;
3579
- if (Mt) {
3580
- var mr = gn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
3581
- Ut = function(t, r) {
3582
- var n;
3583
- mr.lastIndex = r;
3584
- var i = mr.exec(t);
3585
- return (n = i[1]) !== null && n !== void 0 ? n : "";
3586
- };
3587
- } else
3588
- Ut = function(t, r) {
3589
- for (var n = []; ; ) {
3590
- var i = bn(t, r);
3591
- if (i === void 0 || En(i) || Ms(i))
3592
- break;
3593
- n.push(i), r += i >= 65536 ? 2 : 1;
3594
- }
3595
- return Dt.apply(void 0, n);
3596
- };
3597
- var Ls = (
3598
- /** @class */
3599
- function() {
3600
- function e(t, r) {
3601
- r === void 0 && (r = {}), this.message = t, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!r.ignoreTag, this.locale = r.locale, this.requiresOtherClause = !!r.requiresOtherClause, this.shouldParseSkeletons = !!r.shouldParseSkeletons;
3602
- }
3603
- return e.prototype.parse = function() {
3604
- if (this.offset() !== 0)
3605
- throw Error("parser can only be used once");
3606
- return this.parseMessage(0, "", !1);
3607
- }, e.prototype.parseMessage = function(t, r, n) {
3608
- for (var i = []; !this.isEOF(); ) {
3609
- var s = this.char();
3610
- if (s === 123) {
3611
- var a = this.parseArgument(t, n);
3612
- if (a.err)
3613
- return a;
3614
- i.push(a.val);
3615
- } else {
3616
- if (s === 125 && t > 0)
3617
- break;
3618
- if (s === 35 && (r === "plural" || r === "selectordinal")) {
3619
- var l = this.clonePosition();
3620
- this.bump(), i.push({
3621
- type: g.pound,
3622
- location: _(l, this.clonePosition())
3623
- });
3624
- } else if (s === 60 && !this.ignoreTag && this.peek() === 47) {
3625
- if (n)
3626
- break;
3627
- return this.error(m.UNMATCHED_CLOSING_TAG, _(this.clonePosition(), this.clonePosition()));
3628
- } else if (s === 60 && !this.ignoreTag && Gt(this.peek() || 0)) {
3629
- var a = this.parseTag(t, r);
3630
- if (a.err)
3631
- return a;
3632
- i.push(a.val);
3633
- } else {
3634
- var a = this.parseLiteral(t, r);
3635
- if (a.err)
3636
- return a;
3637
- i.push(a.val);
3638
- }
3639
- }
3640
- }
3641
- return { val: i, err: null };
3642
- }, e.prototype.parseTag = function(t, r) {
3643
- var n = this.clonePosition();
3644
- this.bump();
3645
- var i = this.parseTagName();
3646
- if (this.bumpSpace(), this.bumpIf("/>"))
3647
- return {
3648
- val: {
3649
- type: g.literal,
3650
- value: "<".concat(i, "/>"),
3651
- location: _(n, this.clonePosition())
3652
- },
3653
- err: null
3654
- };
3655
- if (this.bumpIf(">")) {
3656
- var s = this.parseMessage(t + 1, r, !0);
3657
- if (s.err)
3658
- return s;
3659
- var a = s.val, l = this.clonePosition();
3660
- if (this.bumpIf("</")) {
3661
- if (this.isEOF() || !Gt(this.char()))
3662
- return this.error(m.INVALID_TAG, _(l, this.clonePosition()));
3663
- var u = this.clonePosition(), o = this.parseTagName();
3664
- return i !== o ? this.error(m.UNMATCHED_CLOSING_TAG, _(u, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
3665
- val: {
3666
- type: g.tag,
3667
- value: i,
3668
- children: a,
3669
- location: _(n, this.clonePosition())
3670
- },
3671
- err: null
3672
- } : this.error(m.INVALID_TAG, _(l, this.clonePosition())));
3673
- } else
3674
- return this.error(m.UNCLOSED_TAG, _(n, this.clonePosition()));
3675
- } else
3676
- return this.error(m.INVALID_TAG, _(n, this.clonePosition()));
3677
- }, e.prototype.parseTagName = function() {
3678
- var t = this.offset();
3679
- for (this.bump(); !this.isEOF() && Cs(this.char()); )
3680
- this.bump();
3681
- return this.message.slice(t, this.offset());
3682
- }, e.prototype.parseLiteral = function(t, r) {
3683
- for (var n = this.clonePosition(), i = ""; ; ) {
3684
- var s = this.tryParseQuote(r);
3685
- if (s) {
3686
- i += s;
3687
- continue;
3688
- }
3689
- var a = this.tryParseUnquoted(t, r);
3690
- if (a) {
3691
- i += a;
3692
- continue;
3693
- }
3694
- var l = this.tryParseLeftAngleBracket();
3695
- if (l) {
3696
- i += l;
3697
- continue;
3698
- }
3699
- break;
3700
- }
3701
- var u = _(n, this.clonePosition());
3702
- return {
3703
- val: { type: g.literal, value: i, location: u },
3704
- err: null
3705
- };
3706
- }, e.prototype.tryParseLeftAngleBracket = function() {
3707
- return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
3708
- !Rs(this.peek() || 0)) ? (this.bump(), "<") : null;
3709
- }, e.prototype.tryParseQuote = function(t) {
3710
- if (this.isEOF() || this.char() !== 39)
3711
- return null;
3712
- switch (this.peek()) {
3713
- case 39:
3714
- return this.bump(), this.bump(), "'";
3715
- case 123:
3716
- case 60:
3717
- case 62:
3718
- case 125:
3719
- break;
3720
- case 35:
3721
- if (t === "plural" || t === "selectordinal")
3722
- break;
3723
- return null;
3724
- default:
3725
- return null;
3726
- }
3727
- this.bump();
3728
- var r = [this.char()];
3729
- for (this.bump(); !this.isEOF(); ) {
3730
- var n = this.char();
3731
- if (n === 39)
3732
- if (this.peek() === 39)
3733
- r.push(39), this.bump();
3734
- else {
3735
- this.bump();
3736
- break;
3737
- }
3738
- else
3739
- r.push(n);
3740
- this.bump();
3741
- }
3742
- return Dt.apply(void 0, r);
3743
- }, e.prototype.tryParseUnquoted = function(t, r) {
3744
- if (this.isEOF())
3745
- return null;
3746
- var n = this.char();
3747
- return n === 60 || n === 123 || n === 35 && (r === "plural" || r === "selectordinal") || n === 125 && t > 0 ? null : (this.bump(), Dt(n));
3748
- }, e.prototype.parseArgument = function(t, r) {
3749
- var n = this.clonePosition();
3750
- if (this.bump(), this.bumpSpace(), this.isEOF())
3751
- return this.error(m.EXPECT_ARGUMENT_CLOSING_BRACE, _(n, this.clonePosition()));
3752
- if (this.char() === 125)
3753
- return this.bump(), this.error(m.EMPTY_ARGUMENT, _(n, this.clonePosition()));
3754
- var i = this.parseIdentifierIfPossible().value;
3755
- if (!i)
3756
- return this.error(m.MALFORMED_ARGUMENT, _(n, this.clonePosition()));
3757
- if (this.bumpSpace(), this.isEOF())
3758
- return this.error(m.EXPECT_ARGUMENT_CLOSING_BRACE, _(n, this.clonePosition()));
3759
- switch (this.char()) {
3760
- case 125:
3761
- return this.bump(), {
3762
- val: {
3763
- type: g.argument,
3764
- // value does not include the opening and closing braces.
3765
- value: i,
3766
- location: _(n, this.clonePosition())
3767
- },
3768
- err: null
3769
- };
3770
- case 44:
3771
- return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(m.EXPECT_ARGUMENT_CLOSING_BRACE, _(n, this.clonePosition())) : this.parseArgumentOptions(t, r, i, n);
3772
- default:
3773
- return this.error(m.MALFORMED_ARGUMENT, _(n, this.clonePosition()));
3774
- }
3775
- }, e.prototype.parseIdentifierIfPossible = function() {
3776
- var t = this.clonePosition(), r = this.offset(), n = Ut(this.message, r), i = r + n.length;
3777
- this.bumpTo(i);
3778
- var s = this.clonePosition(), a = _(t, s);
3779
- return { value: n, location: a };
3780
- }, e.prototype.parseArgumentOptions = function(t, r, n, i) {
3781
- var s, a = this.clonePosition(), l = this.parseIdentifierIfPossible().value, u = this.clonePosition();
3782
- switch (l) {
3783
- case "":
3784
- return this.error(m.EXPECT_ARGUMENT_TYPE, _(a, u));
3785
- case "number":
3786
- case "date":
3787
- case "time": {
3788
- this.bumpSpace();
3789
- var o = null;
3790
- if (this.bumpIf(",")) {
3791
- this.bumpSpace();
3792
- var f = this.clonePosition(), c = this.parseSimpleArgStyleIfPossible();
3793
- if (c.err)
3794
- return c;
3795
- var h = Is(c.val);
3796
- if (h.length === 0)
3797
- return this.error(m.EXPECT_ARGUMENT_STYLE, _(this.clonePosition(), this.clonePosition()));
3798
- var p = _(f, this.clonePosition());
3799
- o = { style: h, styleLocation: p };
3800
- }
3801
- var v = this.tryParseArgumentClose(i);
3802
- if (v.err)
3803
- return v;
3804
- var d = _(i, this.clonePosition());
3805
- if (o && vr(o == null ? void 0 : o.style, "::", 0)) {
3806
- var y = Os(o.style.slice(2));
3807
- if (l === "number") {
3808
- var c = this.parseNumberSkeletonFromString(y, o.styleLocation);
3809
- return c.err ? c : {
3810
- val: { type: g.number, value: n, location: d, style: c.val },
3811
- err: null
3812
- };
3813
- } else {
3814
- if (y.length === 0)
3815
- return this.error(m.EXPECT_DATE_TIME_SKELETON, d);
3816
- var I = y;
3817
- this.locale && (I = bs(y, this.locale));
3818
- var h = {
3819
- type: Ne.dateTime,
3820
- pattern: I,
3821
- location: o.styleLocation,
3822
- parsedOptions: this.shouldParseSkeletons ? hs(I) : {}
3823
- }, L = l === "date" ? g.date : g.time;
3824
- return {
3825
- val: { type: L, value: n, location: d, style: h },
3826
- err: null
3827
- };
3828
- }
3829
- }
3830
- return {
3831
- val: {
3832
- type: l === "number" ? g.number : l === "date" ? g.date : g.time,
3833
- value: n,
3834
- location: d,
3835
- style: (s = o == null ? void 0 : o.style) !== null && s !== void 0 ? s : null
3836
- },
3837
- err: null
3838
- };
3839
- }
3840
- case "plural":
3841
- case "selectordinal":
3842
- case "select": {
3843
- var S = this.clonePosition();
3844
- if (this.bumpSpace(), !this.bumpIf(","))
3845
- return this.error(m.EXPECT_SELECT_ARGUMENT_OPTIONS, _(S, nt({}, S)));
3846
- this.bumpSpace();
3847
- var N = this.parseIdentifierIfPossible(), U = 0;
3848
- if (l !== "select" && N.value === "offset") {
3849
- if (!this.bumpIf(":"))
3850
- return this.error(m.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, _(this.clonePosition(), this.clonePosition()));
3851
- this.bumpSpace();
3852
- var c = this.tryParseDecimalInteger(m.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, m.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
3853
- if (c.err)
3854
- return c;
3855
- this.bumpSpace(), N = this.parseIdentifierIfPossible(), U = c.val;
3856
- }
3857
- var ae = this.tryParsePluralOrSelectOptions(t, l, r, N);
3858
- if (ae.err)
3859
- return ae;
3860
- var v = this.tryParseArgumentClose(i);
3861
- if (v.err)
3862
- return v;
3863
- var er = _(i, this.clonePosition());
3864
- return l === "select" ? {
3865
- val: {
3866
- type: g.select,
3867
- value: n,
3868
- options: dr(ae.val),
3869
- location: er
3870
- },
3871
- err: null
3872
- } : {
3873
- val: {
3874
- type: g.plural,
3875
- value: n,
3876
- options: dr(ae.val),
3877
- offset: U,
3878
- pluralType: l === "plural" ? "cardinal" : "ordinal",
3879
- location: er
3880
- },
3881
- err: null
3882
- };
3883
- }
3884
- default:
3885
- return this.error(m.INVALID_ARGUMENT_TYPE, _(a, u));
3886
- }
3887
- }, e.prototype.tryParseArgumentClose = function(t) {
3888
- return this.isEOF() || this.char() !== 125 ? this.error(m.EXPECT_ARGUMENT_CLOSING_BRACE, _(t, this.clonePosition())) : (this.bump(), { val: !0, err: null });
3889
- }, e.prototype.parseSimpleArgStyleIfPossible = function() {
3890
- for (var t = 0, r = this.clonePosition(); !this.isEOF(); ) {
3891
- var n = this.char();
3892
- switch (n) {
3893
- case 39: {
3894
- this.bump();
3895
- var i = this.clonePosition();
3896
- if (!this.bumpUntil("'"))
3897
- return this.error(m.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, _(i, this.clonePosition()));
3898
- this.bump();
3899
- break;
3900
- }
3901
- case 123: {
3902
- t += 1, this.bump();
3903
- break;
3904
- }
3905
- case 125: {
3906
- if (t > 0)
3907
- t -= 1;
3908
- else
3909
- return {
3910
- val: this.message.slice(r.offset, this.offset()),
3911
- err: null
3912
- };
3913
- break;
3914
- }
3915
- default:
3916
- this.bump();
3917
- break;
3918
- }
3919
- }
3920
- return {
3921
- val: this.message.slice(r.offset, this.offset()),
3922
- err: null
3923
- };
3924
- }, e.prototype.parseNumberSkeletonFromString = function(t, r) {
3925
- var n = [];
3926
- try {
3927
- n = ps(t);
3928
- } catch {
3929
- return this.error(m.INVALID_NUMBER_SKELETON, r);
3930
- }
3931
- return {
3932
- val: {
3933
- type: Ne.number,
3934
- tokens: n,
3935
- location: r,
3936
- parsedOptions: this.shouldParseSkeletons ? _s(n) : {}
3937
- },
3938
- err: null
3939
- };
3940
- }, e.prototype.tryParsePluralOrSelectOptions = function(t, r, n, i) {
3941
- for (var s, a = !1, l = [], u = /* @__PURE__ */ new Set(), o = i.value, f = i.location; ; ) {
3942
- if (o.length === 0) {
3943
- var c = this.clonePosition();
3944
- if (r !== "select" && this.bumpIf("=")) {
3945
- var h = this.tryParseDecimalInteger(m.EXPECT_PLURAL_ARGUMENT_SELECTOR, m.INVALID_PLURAL_ARGUMENT_SELECTOR);
3946
- if (h.err)
3947
- return h;
3948
- f = _(c, this.clonePosition()), o = this.message.slice(c.offset, this.offset());
3949
- } else
3950
- break;
3951
- }
3952
- if (u.has(o))
3953
- return this.error(r === "select" ? m.DUPLICATE_SELECT_ARGUMENT_SELECTOR : m.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, f);
3954
- o === "other" && (a = !0), this.bumpSpace();
3955
- var p = this.clonePosition();
3956
- if (!this.bumpIf("{"))
3957
- return this.error(r === "select" ? m.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : m.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, _(this.clonePosition(), this.clonePosition()));
3958
- var v = this.parseMessage(t + 1, r, n);
3959
- if (v.err)
3960
- return v;
3961
- var d = this.tryParseArgumentClose(p);
3962
- if (d.err)
3963
- return d;
3964
- l.push([
3965
- o,
3966
- {
3967
- value: v.val,
3968
- location: _(p, this.clonePosition())
3969
- }
3970
- ]), u.add(o), this.bumpSpace(), s = this.parseIdentifierIfPossible(), o = s.value, f = s.location;
3971
- }
3972
- return l.length === 0 ? this.error(r === "select" ? m.EXPECT_SELECT_ARGUMENT_SELECTOR : m.EXPECT_PLURAL_ARGUMENT_SELECTOR, _(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !a ? this.error(m.MISSING_OTHER_CLAUSE, _(this.clonePosition(), this.clonePosition())) : { val: l, err: null };
3973
- }, e.prototype.tryParseDecimalInteger = function(t, r) {
3974
- var n = 1, i = this.clonePosition();
3975
- this.bumpIf("+") || this.bumpIf("-") && (n = -1);
3976
- for (var s = !1, a = 0; !this.isEOF(); ) {
3977
- var l = this.char();
3978
- if (l >= 48 && l <= 57)
3979
- s = !0, a = a * 10 + (l - 48), this.bump();
3980
- else
3981
- break;
3982
- }
3983
- var u = _(i, this.clonePosition());
3984
- return s ? (a *= n, Ps(a) ? { val: a, err: null } : this.error(r, u)) : this.error(t, u);
3985
- }, e.prototype.offset = function() {
3986
- return this.position.offset;
3987
- }, e.prototype.isEOF = function() {
3988
- return this.offset() === this.message.length;
3989
- }, e.prototype.clonePosition = function() {
3990
- return {
3991
- offset: this.position.offset,
3992
- line: this.position.line,
3993
- column: this.position.column
3994
- };
3995
- }, e.prototype.char = function() {
3996
- var t = this.position.offset;
3997
- if (t >= this.message.length)
3998
- throw Error("out of bound");
3999
- var r = bn(this.message, t);
4000
- if (r === void 0)
4001
- throw Error("Offset ".concat(t, " is at invalid UTF-16 code unit boundary"));
4002
- return r;
4003
- }, e.prototype.error = function(t, r) {
4004
- return {
4005
- val: null,
4006
- err: {
4007
- kind: t,
4008
- message: this.message,
4009
- location: r
4010
- }
4011
- };
4012
- }, e.prototype.bump = function() {
4013
- if (!this.isEOF()) {
4014
- var t = this.char();
4015
- t === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += t < 65536 ? 1 : 2);
4016
- }
4017
- }, e.prototype.bumpIf = function(t) {
4018
- if (vr(this.message, t, this.offset())) {
4019
- for (var r = 0; r < t.length; r++)
4020
- this.bump();
4021
- return !0;
4022
- }
4023
- return !1;
4024
- }, e.prototype.bumpUntil = function(t) {
4025
- var r = this.offset(), n = this.message.indexOf(t, r);
4026
- return n >= 0 ? (this.bumpTo(n), !0) : (this.bumpTo(this.message.length), !1);
4027
- }, e.prototype.bumpTo = function(t) {
4028
- if (this.offset() > t)
4029
- throw Error("targetOffset ".concat(t, " must be greater than or equal to the current offset ").concat(this.offset()));
4030
- for (t = Math.min(t, this.message.length); ; ) {
4031
- var r = this.offset();
4032
- if (r === t)
4033
- break;
4034
- if (r > t)
4035
- throw Error("targetOffset ".concat(t, " is at invalid UTF-16 code unit boundary"));
4036
- if (this.bump(), this.isEOF())
4037
- break;
4038
- }
4039
- }, e.prototype.bumpSpace = function() {
4040
- for (; !this.isEOF() && En(this.char()); )
4041
- this.bump();
4042
- }, e.prototype.peek = function() {
4043
- if (this.isEOF())
4044
- return null;
4045
- var t = this.char(), r = this.offset(), n = this.message.charCodeAt(r + (t >= 65536 ? 2 : 1));
4046
- return n ?? null;
4047
- }, e;
4048
- }()
4049
- );
4050
- function Gt(e) {
4051
- return e >= 97 && e <= 122 || e >= 65 && e <= 90;
4052
- }
4053
- function Rs(e) {
4054
- return Gt(e) || e === 47;
4055
- }
4056
- function Cs(e) {
4057
- return e === 45 || e === 46 || e >= 48 && e <= 57 || e === 95 || e >= 97 && e <= 122 || e >= 65 && e <= 90 || e == 183 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 893 || e >= 895 && e <= 8191 || e >= 8204 && e <= 8205 || e >= 8255 && e <= 8256 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039;
4058
- }
4059
- function En(e) {
4060
- return e >= 9 && e <= 13 || e === 32 || e === 133 || e >= 8206 && e <= 8207 || e === 8232 || e === 8233;
4061
- }
4062
- function Ms(e) {
4063
- return e >= 33 && e <= 35 || e === 36 || e >= 37 && e <= 39 || e === 40 || e === 41 || e === 42 || e === 43 || e === 44 || e === 45 || e >= 46 && e <= 47 || e >= 58 && e <= 59 || e >= 60 && e <= 62 || e >= 63 && e <= 64 || e === 91 || e === 92 || e === 93 || e === 94 || e === 96 || e === 123 || e === 124 || e === 125 || e === 126 || e === 161 || e >= 162 && e <= 165 || e === 166 || e === 167 || e === 169 || e === 171 || e === 172 || e === 174 || e === 176 || e === 177 || e === 182 || e === 187 || e === 191 || e === 215 || e === 247 || e >= 8208 && e <= 8213 || e >= 8214 && e <= 8215 || e === 8216 || e === 8217 || e === 8218 || e >= 8219 && e <= 8220 || e === 8221 || e === 8222 || e === 8223 || e >= 8224 && e <= 8231 || e >= 8240 && e <= 8248 || e === 8249 || e === 8250 || e >= 8251 && e <= 8254 || e >= 8257 && e <= 8259 || e === 8260 || e === 8261 || e === 8262 || e >= 8263 && e <= 8273 || e === 8274 || e === 8275 || e >= 8277 && e <= 8286 || e >= 8592 && e <= 8596 || e >= 8597 && e <= 8601 || e >= 8602 && e <= 8603 || e >= 8604 && e <= 8607 || e === 8608 || e >= 8609 && e <= 8610 || e === 8611 || e >= 8612 && e <= 8613 || e === 8614 || e >= 8615 && e <= 8621 || e === 8622 || e >= 8623 && e <= 8653 || e >= 8654 && e <= 8655 || e >= 8656 && e <= 8657 || e === 8658 || e === 8659 || e === 8660 || e >= 8661 && e <= 8691 || e >= 8692 && e <= 8959 || e >= 8960 && e <= 8967 || e === 8968 || e === 8969 || e === 8970 || e === 8971 || e >= 8972 && e <= 8991 || e >= 8992 && e <= 8993 || e >= 8994 && e <= 9e3 || e === 9001 || e === 9002 || e >= 9003 && e <= 9083 || e === 9084 || e >= 9085 && e <= 9114 || e >= 9115 && e <= 9139 || e >= 9140 && e <= 9179 || e >= 9180 && e <= 9185 || e >= 9186 && e <= 9254 || e >= 9255 && e <= 9279 || e >= 9280 && e <= 9290 || e >= 9291 && e <= 9311 || e >= 9472 && e <= 9654 || e === 9655 || e >= 9656 && e <= 9664 || e === 9665 || e >= 9666 && e <= 9719 || e >= 9720 && e <= 9727 || e >= 9728 && e <= 9838 || e === 9839 || e >= 9840 && e <= 10087 || e === 10088 || e === 10089 || e === 10090 || e === 10091 || e === 10092 || e === 10093 || e === 10094 || e === 10095 || e === 10096 || e === 10097 || e === 10098 || e === 10099 || e === 10100 || e === 10101 || e >= 10132 && e <= 10175 || e >= 10176 && e <= 10180 || e === 10181 || e === 10182 || e >= 10183 && e <= 10213 || e === 10214 || e === 10215 || e === 10216 || e === 10217 || e === 10218 || e === 10219 || e === 10220 || e === 10221 || e === 10222 || e === 10223 || e >= 10224 && e <= 10239 || e >= 10240 && e <= 10495 || e >= 10496 && e <= 10626 || e === 10627 || e === 10628 || e === 10629 || e === 10630 || e === 10631 || e === 10632 || e === 10633 || e === 10634 || e === 10635 || e === 10636 || e === 10637 || e === 10638 || e === 10639 || e === 10640 || e === 10641 || e === 10642 || e === 10643 || e === 10644 || e === 10645 || e === 10646 || e === 10647 || e === 10648 || e >= 10649 && e <= 10711 || e === 10712 || e === 10713 || e === 10714 || e === 10715 || e >= 10716 && e <= 10747 || e === 10748 || e === 10749 || e >= 10750 && e <= 11007 || e >= 11008 && e <= 11055 || e >= 11056 && e <= 11076 || e >= 11077 && e <= 11078 || e >= 11079 && e <= 11084 || e >= 11085 && e <= 11123 || e >= 11124 && e <= 11125 || e >= 11126 && e <= 11157 || e === 11158 || e >= 11159 && e <= 11263 || e >= 11776 && e <= 11777 || e === 11778 || e === 11779 || e === 11780 || e === 11781 || e >= 11782 && e <= 11784 || e === 11785 || e === 11786 || e === 11787 || e === 11788 || e === 11789 || e >= 11790 && e <= 11798 || e === 11799 || e >= 11800 && e <= 11801 || e === 11802 || e === 11803 || e === 11804 || e === 11805 || e >= 11806 && e <= 11807 || e === 11808 || e === 11809 || e === 11810 || e === 11811 || e === 11812 || e === 11813 || e === 11814 || e === 11815 || e === 11816 || e === 11817 || e >= 11818 && e <= 11822 || e === 11823 || e >= 11824 && e <= 11833 || e >= 11834 && e <= 11835 || e >= 11836 && e <= 11839 || e === 11840 || e === 11841 || e === 11842 || e >= 11843 && e <= 11855 || e >= 11856 && e <= 11857 || e === 11858 || e >= 11859 && e <= 11903 || e >= 12289 && e <= 12291 || e === 12296 || e === 12297 || e === 12298 || e === 12299 || e === 12300 || e === 12301 || e === 12302 || e === 12303 || e === 12304 || e === 12305 || e >= 12306 && e <= 12307 || e === 12308 || e === 12309 || e === 12310 || e === 12311 || e === 12312 || e === 12313 || e === 12314 || e === 12315 || e === 12316 || e === 12317 || e >= 12318 && e <= 12319 || e === 12320 || e === 12336 || e === 64830 || e === 64831 || e >= 65093 && e <= 65094;
4064
- }
4065
- function Ft(e) {
4066
- e.forEach(function(t) {
4067
- if (delete t.location, fn(t) || hn(t))
4068
- for (var r in t.options)
4069
- delete t.options[r].location, Ft(t.options[r].value);
4070
- else on(t) && pn(t.style) || (un(t) || ln(t)) && Ct(t.style) ? delete t.style.location : cn(t) && Ft(t.children);
4071
- });
4072
- }
4073
- function Ds(e, t) {
4074
- t === void 0 && (t = {}), t = nt({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, t);
4075
- var r = new Ls(e, t).parse();
4076
- if (r.err) {
4077
- var n = SyntaxError(m[r.err.kind]);
4078
- throw n.location = r.err.location, n.originalMessage = r.err.message, n;
4079
- }
4080
- return t != null && t.captureLocation || Ft(r.val), r.val;
4081
- }
4082
- var Oe;
4083
- (function(e) {
4084
- e.MISSING_VALUE = "MISSING_VALUE", e.INVALID_VALUE = "INVALID_VALUE", e.MISSING_INTL_API = "MISSING_INTL_API";
4085
- })(Oe || (Oe = {}));
4086
- var ht = (
4087
- /** @class */
4088
- function(e) {
4089
- ft(t, e);
4090
- function t(r, n, i) {
4091
- var s = e.call(this, r) || this;
4092
- return s.code = n, s.originalMessage = i, s;
4093
- }
4094
- return t.prototype.toString = function() {
4095
- return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
4096
- }, t;
4097
- }(Error)
4098
- ), _r = (
4099
- /** @class */
4100
- function(e) {
4101
- ft(t, e);
4102
- function t(r, n, i, s) {
4103
- return e.call(this, 'Invalid values for "'.concat(r, '": "').concat(n, '". Options are "').concat(Object.keys(i).join('", "'), '"'), Oe.INVALID_VALUE, s) || this;
4104
- }
4105
- return t;
4106
- }(ht)
4107
- ), Us = (
4108
- /** @class */
4109
- function(e) {
4110
- ft(t, e);
4111
- function t(r, n, i) {
4112
- return e.call(this, 'Value for "'.concat(r, '" must be of type ').concat(n), Oe.INVALID_VALUE, i) || this;
4113
- }
4114
- return t;
4115
- }(ht)
4116
- ), Gs = (
4117
- /** @class */
4118
- function(e) {
4119
- ft(t, e);
4120
- function t(r, n) {
4121
- return e.call(this, 'The intl string context variable "'.concat(r, '" was not provided to the string "').concat(n, '"'), Oe.MISSING_VALUE, n) || this;
4122
- }
4123
- return t;
4124
- }(ht)
4125
- ), R;
4126
- (function(e) {
4127
- e[e.literal = 0] = "literal", e[e.object = 1] = "object";
4128
- })(R || (R = {}));
4129
- function Fs(e) {
4130
- return e.length < 2 ? e : e.reduce(function(t, r) {
4131
- var n = t[t.length - 1];
4132
- return !n || n.type !== R.literal || r.type !== R.literal ? t.push(r) : n.value += r.value, t;
4133
- }, []);
4134
- }
4135
- function js(e) {
4136
- return typeof e == "function";
4137
- }
4138
- function Ze(e, t, r, n, i, s, a) {
4139
- if (e.length === 1 && fr(e[0]))
4140
- return [
4141
- {
4142
- type: R.literal,
4143
- value: e[0].value
4144
- }
4145
- ];
4146
- for (var l = [], u = 0, o = e; u < o.length; u++) {
4147
- var f = o[u];
4148
- if (fr(f)) {
4149
- l.push({
4150
- type: R.literal,
4151
- value: f.value
4152
- });
4153
- continue;
4154
- }
4155
- if (ls(f)) {
4156
- typeof s == "number" && l.push({
4157
- type: R.literal,
4158
- value: r.getNumberFormat(t).format(s)
4159
- });
4160
- continue;
4161
- }
4162
- var c = f.value;
4163
- if (!(i && c in i))
4164
- throw new Gs(c, a);
4165
- var h = i[c];
4166
- if (us(f)) {
4167
- (!h || typeof h == "string" || typeof h == "number") && (h = typeof h == "string" || typeof h == "number" ? String(h) : ""), l.push({
4168
- type: typeof h == "string" ? R.literal : R.object,
4169
- value: h
4170
- });
4171
- continue;
4172
- }
4173
- if (un(f)) {
4174
- var p = typeof f.style == "string" ? n.date[f.style] : Ct(f.style) ? f.style.parsedOptions : void 0;
4175
- l.push({
4176
- type: R.literal,
4177
- value: r.getDateTimeFormat(t, p).format(h)
4178
- });
4179
- continue;
4180
- }
4181
- if (ln(f)) {
4182
- var p = typeof f.style == "string" ? n.time[f.style] : Ct(f.style) ? f.style.parsedOptions : n.time.medium;
4183
- l.push({
4184
- type: R.literal,
4185
- value: r.getDateTimeFormat(t, p).format(h)
4186
- });
4187
- continue;
4188
- }
4189
- if (on(f)) {
4190
- var p = typeof f.style == "string" ? n.number[f.style] : pn(f.style) ? f.style.parsedOptions : void 0;
4191
- p && p.scale && (h = h * (p.scale || 1)), l.push({
4192
- type: R.literal,
4193
- value: r.getNumberFormat(t, p).format(h)
4194
- });
4195
- continue;
4196
- }
4197
- if (cn(f)) {
4198
- var v = f.children, d = f.value, y = i[d];
4199
- if (!js(y))
4200
- throw new Us(d, "function", a);
4201
- var I = Ze(v, t, r, n, i, s), L = y(I.map(function(U) {
4202
- return U.value;
4203
- }));
4204
- Array.isArray(L) || (L = [L]), l.push.apply(l, L.map(function(U) {
4205
- return {
4206
- type: typeof U == "string" ? R.literal : R.object,
4207
- value: U
4208
- };
4209
- }));
4210
- }
4211
- if (fn(f)) {
4212
- var S = f.options[h] || f.options.other;
4213
- if (!S)
4214
- throw new _r(f.value, h, Object.keys(f.options), a);
4215
- l.push.apply(l, Ze(S.value, t, r, n, i));
4216
- continue;
4217
- }
4218
- if (hn(f)) {
4219
- var S = f.options["=".concat(h)];
4220
- if (!S) {
4221
- if (!Intl.PluralRules)
4222
- throw new ht(`Intl.PluralRules is not available in this environment.
4223
- Try polyfilling it using "@formatjs/intl-pluralrules"
4224
- `, Oe.MISSING_INTL_API, a);
4225
- var N = r.getPluralRules(t, { type: f.pluralType }).select(h - (f.offset || 0));
4226
- S = f.options[N] || f.options.other;
4227
- }
4228
- if (!S)
4229
- throw new _r(f.value, h, Object.keys(f.options), a);
4230
- l.push.apply(l, Ze(S.value, t, r, n, i, h - (f.offset || 0)));
4231
- continue;
4232
- }
4233
- }
4234
- return Fs(l);
4235
- }
4236
- function ks(e, t) {
4237
- return t ? Z(Z(Z({}, e || {}), t || {}), Object.keys(e).reduce(function(r, n) {
4238
- return r[n] = Z(Z({}, e[n]), t[n] || {}), r;
4239
- }, {})) : e;
4240
- }
4241
- function Vs(e, t) {
4242
- return t ? Object.keys(e).reduce(function(r, n) {
4243
- return r[n] = ks(e[n], t[n]), r;
4244
- }, Z({}, e)) : e;
4245
- }
4246
- function Tt(e) {
4247
- return {
4248
- create: function() {
4249
- return {
4250
- get: function(t) {
4251
- return e[t];
4252
- },
4253
- set: function(t, r) {
4254
- e[t] = r;
4255
- }
4256
- };
4257
- }
4258
- };
4259
- }
4260
- function Xs(e) {
4261
- return e === void 0 && (e = {
4262
- number: {},
4263
- dateTime: {},
4264
- pluralRules: {}
4265
- }), {
4266
- getNumberFormat: Et(function() {
4267
- for (var t, r = [], n = 0; n < arguments.length; n++)
4268
- r[n] = arguments[n];
4269
- return new ((t = Intl.NumberFormat).bind.apply(t, gt([void 0], r, !1)))();
4270
- }, {
4271
- cache: Tt(e.number),
4272
- strategy: yt.variadic
4273
- }),
4274
- getDateTimeFormat: Et(function() {
4275
- for (var t, r = [], n = 0; n < arguments.length; n++)
4276
- r[n] = arguments[n];
4277
- return new ((t = Intl.DateTimeFormat).bind.apply(t, gt([void 0], r, !1)))();
4278
- }, {
4279
- cache: Tt(e.dateTime),
4280
- strategy: yt.variadic
4281
- }),
4282
- getPluralRules: Et(function() {
4283
- for (var t, r = [], n = 0; n < arguments.length; n++)
4284
- r[n] = arguments[n];
4285
- return new ((t = Intl.PluralRules).bind.apply(t, gt([void 0], r, !1)))();
4286
- }, {
4287
- cache: Tt(e.pluralRules),
4288
- strategy: yt.variadic
4289
- })
4290
- };
4291
- }
4292
- var Ws = (
4293
- /** @class */
4294
- function() {
4295
- function e(t, r, n, i) {
4296
- r === void 0 && (r = e.defaultLocale);
4297
- var s = this;
4298
- if (this.formatterCache = {
4299
- number: {},
4300
- dateTime: {},
4301
- pluralRules: {}
4302
- }, this.format = function(u) {
4303
- var o = s.formatToParts(u);
4304
- if (o.length === 1)
4305
- return o[0].value;
4306
- var f = o.reduce(function(c, h) {
4307
- return !c.length || h.type !== R.literal || typeof c[c.length - 1] != "string" ? c.push(h.value) : c[c.length - 1] += h.value, c;
4308
- }, []);
4309
- return f.length <= 1 ? f[0] || "" : f;
4310
- }, this.formatToParts = function(u) {
4311
- return Ze(s.ast, s.locales, s.formatters, s.formats, u, void 0, s.message);
4312
- }, this.resolvedOptions = function() {
4313
- var u;
4314
- return {
4315
- locale: ((u = s.resolvedLocale) === null || u === void 0 ? void 0 : u.toString()) || Intl.NumberFormat.supportedLocalesOf(s.locales)[0]
4316
- };
4317
- }, this.getAst = function() {
4318
- return s.ast;
4319
- }, this.locales = r, this.resolvedLocale = e.resolveLocale(r), typeof t == "string") {
4320
- if (this.message = t, !e.__parse)
4321
- throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
4322
- var a = i || {};
4323
- a.formatters;
4324
- var l = es(a, ["formatters"]);
4325
- this.ast = e.__parse(t, Z(Z({}, l), { locale: this.resolvedLocale }));
4326
- } else
4327
- this.ast = t;
4328
- if (!Array.isArray(this.ast))
4329
- throw new TypeError("A message must be provided as a String or AST.");
4330
- this.formats = Vs(e.formats, n), this.formatters = i && i.formatters || Xs(this.formatterCache);
4331
- }
4332
- return Object.defineProperty(e, "defaultLocale", {
4333
- get: function() {
4334
- return e.memoizedDefaultLocale || (e.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), e.memoizedDefaultLocale;
4335
- },
4336
- enumerable: !1,
4337
- configurable: !0
4338
- }), e.memoizedDefaultLocale = null, e.resolveLocale = function(t) {
4339
- if (!(typeof Intl.Locale > "u")) {
4340
- var r = Intl.NumberFormat.supportedLocalesOf(t);
4341
- return r.length > 0 ? new Intl.Locale(r[0]) : new Intl.Locale(typeof t == "string" ? t : t[0]);
4342
- }
4343
- }, e.__parse = Ds, e.formats = {
4344
- number: {
4345
- integer: {
4346
- maximumFractionDigits: 0
4347
- },
4348
- currency: {
4349
- style: "currency"
4350
- },
4351
- percent: {
4352
- style: "percent"
4353
- }
4354
- },
4355
- date: {
4356
- short: {
4357
- month: "numeric",
4358
- day: "numeric",
4359
- year: "2-digit"
4360
- },
4361
- medium: {
4362
- month: "short",
4363
- day: "numeric",
4364
- year: "numeric"
4365
- },
4366
- long: {
4367
- month: "long",
4368
- day: "numeric",
4369
- year: "numeric"
4370
- },
4371
- full: {
4372
- weekday: "long",
4373
- month: "long",
4374
- day: "numeric",
4375
- year: "numeric"
4376
- }
4377
- },
4378
- time: {
4379
- short: {
4380
- hour: "numeric",
4381
- minute: "numeric"
4382
- },
4383
- medium: {
4384
- hour: "numeric",
4385
- minute: "numeric",
4386
- second: "numeric"
4387
- },
4388
- long: {
4389
- hour: "numeric",
4390
- minute: "numeric",
4391
- second: "numeric",
4392
- timeZoneName: "short"
4393
- },
4394
- full: {
4395
- hour: "numeric",
4396
- minute: "numeric",
4397
- second: "numeric",
4398
- timeZoneName: "short"
4399
- }
4400
- }
4401
- }, e;
4402
- }()
4403
- );
4404
- function zs(e, t) {
4405
- if (t == null)
4406
- return;
4407
- if (t in e)
4408
- return e[t];
4409
- const r = t.split(".");
4410
- let n = e;
4411
- for (let i = 0; i < r.length; i++)
4412
- if (typeof n == "object") {
4413
- if (i > 0) {
4414
- const s = r.slice(i, r.length).join(".");
4415
- if (s in n) {
4416
- n = n[s];
4417
- break;
4418
- }
4419
- }
4420
- n = n[r[i]];
4421
- } else
4422
- n = void 0;
4423
- return n;
4424
- }
4425
- const K = {}, $s = (e, t, r) => r && (t in K || (K[t] = {}), e in K[t] || (K[t][e] = r), r), yn = (e, t) => {
4426
- if (t == null)
4427
- return;
4428
- if (t in K && e in K[t])
4429
- return K[t][e];
4430
- const r = ct(t);
4431
- for (let n = 0; n < r.length; n++) {
4432
- const i = r[n], s = Zs(i, e);
4433
- if (s)
4434
- return $s(e, t, s);
4435
- }
4436
- };
4437
- let Jt;
4438
- const Me = lt({});
4439
- function qs(e) {
4440
- return Jt[e] || null;
4441
- }
4442
- function xn(e) {
4443
- return e in Jt;
4444
- }
4445
- function Zs(e, t) {
4446
- if (!xn(e))
4447
- return null;
4448
- const r = qs(e);
4449
- return zs(r, t);
4450
- }
4451
- function Qs(e) {
4452
- if (e == null)
4453
- return;
4454
- const t = ct(e);
4455
- for (let r = 0; r < t.length; r++) {
4456
- const n = t[r];
4457
- if (xn(n))
4458
- return n;
4459
- }
4460
- }
4461
- function Tn(e, ...t) {
4462
- delete K[e], Me.update((r) => (r[e] = Ki.all([r[e] || {}, ...t]), r));
4463
- }
4464
- Ce(
4465
- [Me],
4466
- ([e]) => Object.keys(e)
4467
- );
4468
- Me.subscribe((e) => Jt = e);
4469
- const Qe = {};
4470
- function Ys(e, t) {
4471
- Qe[e].delete(t), Qe[e].size === 0 && delete Qe[e];
4472
- }
4473
- function wn(e) {
4474
- return Qe[e];
4475
- }
4476
- function Js(e) {
4477
- return ct(e).map((t) => {
4478
- const r = wn(t);
4479
- return [t, r ? [...r] : []];
4480
- }).filter(([, t]) => t.length > 0);
4481
- }
4482
- function jt(e) {
4483
- return e == null ? !1 : ct(e).some(
4484
- (t) => {
4485
- var r;
4486
- return (r = wn(t)) == null ? void 0 : r.size;
4487
- }
4488
- );
4489
- }
4490
- function Ks(e, t) {
4491
- return Promise.all(
4492
- t.map((n) => (Ys(e, n), n().then((i) => i.default || i)))
4493
- ).then((n) => Tn(e, ...n));
4494
- }
4495
- const Ge = {};
4496
- function Hn(e) {
4497
- if (!jt(e))
4498
- return e in Ge ? Ge[e] : Promise.resolve();
4499
- const t = Js(e);
4500
- return Ge[e] = Promise.all(
4501
- t.map(
4502
- ([r, n]) => Ks(r, n)
4503
- )
4504
- ).then(() => {
4505
- if (jt(e))
4506
- return Hn(e);
4507
- delete Ge[e];
4508
- }), Ge[e];
4509
- }
4510
- const ea = {
4511
- number: {
4512
- scientific: { notation: "scientific" },
4513
- engineering: { notation: "engineering" },
4514
- compactLong: { notation: "compact", compactDisplay: "long" },
4515
- compactShort: { notation: "compact", compactDisplay: "short" }
4516
- },
4517
- date: {
4518
- short: { month: "numeric", day: "numeric", year: "2-digit" },
4519
- medium: { month: "short", day: "numeric", year: "numeric" },
4520
- long: { month: "long", day: "numeric", year: "numeric" },
4521
- full: { weekday: "long", month: "long", day: "numeric", year: "numeric" }
4522
- },
4523
- time: {
4524
- short: { hour: "numeric", minute: "numeric" },
4525
- medium: { hour: "numeric", minute: "numeric", second: "numeric" },
4526
- long: {
4527
- hour: "numeric",
4528
- minute: "numeric",
4529
- second: "numeric",
4530
- timeZoneName: "short"
4531
- },
4532
- full: {
4533
- hour: "numeric",
4534
- minute: "numeric",
4535
- second: "numeric",
4536
- timeZoneName: "short"
4537
- }
4538
- }
4539
- }, ta = {
4540
- fallbackLocale: null,
4541
- loadingDelay: 200,
4542
- formats: ea,
4543
- warnOnMissingMessages: !0,
4544
- handleMissingMessage: void 0,
4545
- ignoreTag: !0
4546
- }, ra = ta;
4547
- function Ie() {
4548
- return ra;
4549
- }
4550
- const wt = lt(!1);
4551
- var na = Object.defineProperty, ia = Object.defineProperties, sa = Object.getOwnPropertyDescriptors, br = Object.getOwnPropertySymbols, aa = Object.prototype.hasOwnProperty, oa = Object.prototype.propertyIsEnumerable, gr = (e, t, r) => t in e ? na(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ua = (e, t) => {
4552
- for (var r in t || (t = {}))
4553
- aa.call(t, r) && gr(e, r, t[r]);
4554
- if (br)
4555
- for (var r of br(t))
4556
- oa.call(t, r) && gr(e, r, t[r]);
4557
- return e;
4558
- }, la = (e, t) => ia(e, sa(t));
4559
- let kt;
4560
- const it = lt(null);
4561
- function Er(e) {
4562
- return e.split("-").map((t, r, n) => n.slice(0, r + 1).join("-")).reverse();
4563
- }
4564
- function ct(e, t = Ie().fallbackLocale) {
4565
- const r = Er(e);
4566
- return t ? [.../* @__PURE__ */ new Set([...r, ...Er(t)])] : r;
4567
- }
4568
- function _e() {
4569
- return kt ?? void 0;
4570
- }
4571
- it.subscribe((e) => {
4572
- kt = e ?? void 0, typeof window < "u" && e != null && document.documentElement.setAttribute("lang", e);
4573
- });
4574
- const fa = (e) => {
4575
- if (e && Qs(e) && jt(e)) {
4576
- const { loadingDelay: t } = Ie();
4577
- let r;
4578
- return typeof window < "u" && _e() != null && t ? r = window.setTimeout(
4579
- () => wt.set(!0),
4580
- t
4581
- ) : wt.set(!0), Hn(e).then(() => {
4582
- it.set(e);
4583
- }).finally(() => {
4584
- clearTimeout(r), wt.set(!1);
4585
- });
4586
- }
4587
- return it.set(e);
4588
- }, de = la(ua({}, it), {
4589
- set: fa
4590
- }), pt = (e) => {
4591
- const t = /* @__PURE__ */ Object.create(null);
4592
- return (n) => {
4593
- const i = JSON.stringify(n);
4594
- return i in t ? t[i] : t[i] = e(n);
4595
- };
4596
- };
4597
- var ha = Object.defineProperty, st = Object.getOwnPropertySymbols, Sn = Object.prototype.hasOwnProperty, An = Object.prototype.propertyIsEnumerable, yr = (e, t, r) => t in e ? ha(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Kt = (e, t) => {
4598
- for (var r in t || (t = {}))
4599
- Sn.call(t, r) && yr(e, r, t[r]);
4600
- if (st)
4601
- for (var r of st(t))
4602
- An.call(t, r) && yr(e, r, t[r]);
4603
- return e;
4604
- }, De = (e, t) => {
4605
- var r = {};
4606
- for (var n in e)
4607
- Sn.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
4608
- if (e != null && st)
4609
- for (var n of st(e))
4610
- t.indexOf(n) < 0 && An.call(e, n) && (r[n] = e[n]);
4611
- return r;
4612
- };
4613
- const Ve = (e, t) => {
4614
- const { formats: r } = Ie();
4615
- if (e in r && t in r[e])
4616
- return r[e][t];
4617
- throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`);
4618
- }, ca = pt(
4619
- (e) => {
4620
- var t = e, { locale: r, format: n } = t, i = De(t, ["locale", "format"]);
4621
- if (r == null)
4622
- throw new Error('[svelte-i18n] A "locale" must be set to format numbers');
4623
- return n && (i = Ve("number", n)), new Intl.NumberFormat(r, i);
4624
- }
4625
- ), pa = pt(
4626
- (e) => {
4627
- var t = e, { locale: r, format: n } = t, i = De(t, ["locale", "format"]);
4628
- if (r == null)
4629
- throw new Error('[svelte-i18n] A "locale" must be set to format dates');
4630
- return n ? i = Ve("date", n) : Object.keys(i).length === 0 && (i = Ve("date", "short")), new Intl.DateTimeFormat(r, i);
4631
- }
4632
- ), va = pt(
4633
- (e) => {
4634
- var t = e, { locale: r, format: n } = t, i = De(t, ["locale", "format"]);
4635
- if (r == null)
4636
- throw new Error(
4637
- '[svelte-i18n] A "locale" must be set to format time values'
4638
- );
4639
- return n ? i = Ve("time", n) : Object.keys(i).length === 0 && (i = Ve("time", "short")), new Intl.DateTimeFormat(r, i);
4640
- }
4641
- ), da = (e = {}) => {
4642
- var t = e, {
4643
- locale: r = _e()
4644
- } = t, n = De(t, [
4645
- "locale"
4646
- ]);
4647
- return ca(Kt({ locale: r }, n));
4648
- }, ma = (e = {}) => {
4649
- var t = e, {
4650
- locale: r = _e()
4651
- } = t, n = De(t, [
4652
- "locale"
4653
- ]);
4654
- return pa(Kt({ locale: r }, n));
4655
- }, _a = (e = {}) => {
4656
- var t = e, {
4657
- locale: r = _e()
4658
- } = t, n = De(t, [
4659
- "locale"
4660
- ]);
4661
- return va(Kt({ locale: r }, n));
4662
- }, ba = pt(
4663
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
4664
- (e, t = _e()) => new Ws(e, t, Ie().formats, {
4665
- ignoreTag: Ie().ignoreTag
4666
- })
4667
- ), ga = (e, t = {}) => {
4668
- var r, n, i, s;
4669
- let a = t;
4670
- typeof e == "object" && (a = e, e = a.id);
4671
- const {
4672
- values: l,
4673
- locale: u = _e(),
4674
- default: o
4675
- } = a;
4676
- if (u == null)
4677
- throw new Error(
4678
- "[svelte-i18n] Cannot format a message without first setting the initial locale."
4679
- );
4680
- let f = yn(e, u);
4681
- if (!f)
4682
- f = (s = (i = (n = (r = Ie()).handleMissingMessage) == null ? void 0 : n.call(r, { locale: u, id: e, defaultValue: o })) != null ? i : o) != null ? s : e;
4683
- else if (typeof f != "string")
4684
- return console.warn(
4685
- `[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof f}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`
4686
- ), f;
4687
- if (!l)
4688
- return f;
4689
- let c = f;
4690
- try {
4691
- c = ba(f, u).format(l);
4692
- } catch (h) {
4693
- h instanceof Error && console.warn(
4694
- `[svelte-i18n] Message "${e}" has syntax error:`,
4695
- h.message
4696
- );
4697
- }
4698
- return c;
4699
- }, Ea = (e, t) => _a(t).format(e), ya = (e, t) => ma(t).format(e), xa = (e, t) => da(t).format(e), Ta = (e, t = _e()) => yn(e, t), wa = Ce([de, Me], () => ga);
4700
- Ce([de], () => Ea);
4701
- Ce([de], () => ya);
4702
- Ce([de], () => xa);
4703
- Ce([de, Me], () => Ta);
4704
- function Ha({ withLocale: e, translations: t }) {
4705
- de.subscribe((r) => {
4706
- r == null && (Me.set(t), de.set(e));
4707
- });
4708
- }
4709
- function Sa(e, t) {
4710
- Tn(e, t);
4711
- }
4712
- const Aa = {
4713
- en: {
4714
- tokens: "Tokens",
4715
- tokenBalance: "Token Balance",
4716
- requestRakeback: "Request Rakeback"
4717
- },
4718
- tr: {
4719
- tokens: "Tokens",
4720
- tokenBalance: "Token Bakiyesi",
4721
- requestRakeback: "Rakeback Talebi"
4722
- }
4723
- };
4724
- var Ba = /* @__PURE__ */ Si('<div class="loyalty-points svelte-stu6z8"><div class="loyalty-points__content svelte-stu6z8"><div class="loyalty-points__value svelte-stu6z8"><span class="loyalty-points__amount svelte-stu6z8"> </span> <span class="loyalty-points__description svelte-stu6z8"> </span></div></div></div>');
4725
- function Ia(e, t) {
4726
- Qn(t, !0);
4727
- const r = () => Ni(wa, "$_", n), [n, i] = Oi(), s = $e(t, "apiEndpoint", 3, ""), a = $e(t, "userSession", 3, ""), l = $e(t, "locale", 3, ""), u = $e(t, "onLevelLoaded", 3, (N) => {
4728
- });
4729
- Ha({ withLocale: l(), translations: {} }), Object.entries(Aa).forEach(([N, U]) => {
4730
- Sa(N, U);
4731
- });
4732
- const o = Di(() => ({
4733
- apiEndpoint: s(),
4734
- userSession: a(),
4735
- locale: l(),
4736
- loadLevels: !1,
4737
- onLevelLoaded: u()
4738
- })), f = /* @__PURE__ */ _t(() => o.spendableWalletTotal), c = /* @__PURE__ */ _t(() => {
4739
- var N;
4740
- return ((N = H(f)) == null ? void 0 : N.points) ?? 0;
4741
- }), h = /* @__PURE__ */ _t(() => H(c).toLocaleString());
4742
- var p = Ba(), v = Ue(p), d = Ue(v), y = Ue(d), I = Ue(y), L = vi(y, 2), S = Ue(L);
4743
- bi(
4744
- (N, U) => {
4745
- ur(I, `${H(h) ?? ""}
4746
- ${N ?? ""}`), ur(S, U);
4747
- },
4748
- [() => r()("tokens"), () => r()("tokenBalance")]
4749
- ), Ai(e, p), Yn(), i();
4750
- }
4751
- export {
4752
- Ia as default
4753
- };