@everymatrix/casino-tournaments-thumbnail 0.0.187 → 0.0.191

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,4149 +1,2 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.app = factory());
5
- }(this, (function () { 'use strict';
6
-
7
- function noop() { }
8
- function add_location(element, file, line, column, char) {
9
- element.__svelte_meta = {
10
- loc: { file, line, column, char }
11
- };
12
- }
13
- function run(fn) {
14
- return fn();
15
- }
16
- function blank_object() {
17
- return Object.create(null);
18
- }
19
- function run_all(fns) {
20
- fns.forEach(run);
21
- }
22
- function is_function(thing) {
23
- return typeof thing === 'function';
24
- }
25
- function safe_not_equal(a, b) {
26
- return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
27
- }
28
- function is_empty(obj) {
29
- return Object.keys(obj).length === 0;
30
- }
31
- function validate_store(store, name) {
32
- if (store != null && typeof store.subscribe !== 'function') {
33
- throw new Error(`'${name}' is not a store with a 'subscribe' method`);
34
- }
35
- }
36
- function subscribe(store, ...callbacks) {
37
- if (store == null) {
38
- return noop;
39
- }
40
- const unsub = store.subscribe(...callbacks);
41
- return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
42
- }
43
- function component_subscribe(component, store, callback) {
44
- component.$$.on_destroy.push(subscribe(store, callback));
45
- }
46
- function action_destroyer(action_result) {
47
- return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
48
- }
49
-
50
- function append(target, node) {
51
- target.appendChild(node);
52
- }
53
- function insert(target, node, anchor) {
54
- target.insertBefore(node, anchor || null);
55
- }
56
- function detach(node) {
57
- node.parentNode.removeChild(node);
58
- }
59
- function element(name) {
60
- return document.createElement(name);
61
- }
62
- function text(data) {
63
- return document.createTextNode(data);
64
- }
65
- function space() {
66
- return text(' ');
67
- }
68
- function empty() {
69
- return text('');
70
- }
71
- function listen(node, event, handler, options) {
72
- node.addEventListener(event, handler, options);
73
- return () => node.removeEventListener(event, handler, options);
74
- }
75
- function attr(node, attribute, value) {
76
- if (value == null)
77
- node.removeAttribute(attribute);
78
- else if (node.getAttribute(attribute) !== value)
79
- node.setAttribute(attribute, value);
80
- }
81
- function children(element) {
82
- return Array.from(element.childNodes);
83
- }
84
- function set_style(node, key, value, important) {
85
- node.style.setProperty(key, value, important ? 'important' : '');
86
- }
87
- function custom_event(type, detail) {
88
- const e = document.createEvent('CustomEvent');
89
- e.initCustomEvent(type, false, false, detail);
90
- return e;
91
- }
92
- function attribute_to_object(attributes) {
93
- const result = {};
94
- for (const attribute of attributes) {
95
- result[attribute.name] = attribute.value;
96
- }
97
- return result;
98
- }
99
-
100
- let current_component;
101
- function set_current_component(component) {
102
- current_component = component;
103
- }
104
- function get_current_component() {
105
- if (!current_component)
106
- throw new Error('Function called outside component initialization');
107
- return current_component;
108
- }
109
- function onMount(fn) {
110
- get_current_component().$$.on_mount.push(fn);
111
- }
112
-
113
- const dirty_components = [];
114
- const binding_callbacks = [];
115
- const render_callbacks = [];
116
- const flush_callbacks = [];
117
- const resolved_promise = Promise.resolve();
118
- let update_scheduled = false;
119
- function schedule_update() {
120
- if (!update_scheduled) {
121
- update_scheduled = true;
122
- resolved_promise.then(flush);
123
- }
124
- }
125
- function add_render_callback(fn) {
126
- render_callbacks.push(fn);
127
- }
128
- let flushing = false;
129
- const seen_callbacks = new Set();
130
- function flush() {
131
- if (flushing)
132
- return;
133
- flushing = true;
134
- do {
135
- // first, call beforeUpdate functions
136
- // and update components
137
- for (let i = 0; i < dirty_components.length; i += 1) {
138
- const component = dirty_components[i];
139
- set_current_component(component);
140
- update(component.$$);
141
- }
142
- set_current_component(null);
143
- dirty_components.length = 0;
144
- while (binding_callbacks.length)
145
- binding_callbacks.pop()();
146
- // then, once components are updated, call
147
- // afterUpdate functions. This may cause
148
- // subsequent updates...
149
- for (let i = 0; i < render_callbacks.length; i += 1) {
150
- const callback = render_callbacks[i];
151
- if (!seen_callbacks.has(callback)) {
152
- // ...so guard against infinite loops
153
- seen_callbacks.add(callback);
154
- callback();
155
- }
156
- }
157
- render_callbacks.length = 0;
158
- } while (dirty_components.length);
159
- while (flush_callbacks.length) {
160
- flush_callbacks.pop()();
161
- }
162
- update_scheduled = false;
163
- flushing = false;
164
- seen_callbacks.clear();
165
- }
166
- function update($$) {
167
- if ($$.fragment !== null) {
168
- $$.update();
169
- run_all($$.before_update);
170
- const dirty = $$.dirty;
171
- $$.dirty = [-1];
172
- $$.fragment && $$.fragment.p($$.ctx, dirty);
173
- $$.after_update.forEach(add_render_callback);
174
- }
175
- }
176
- const outroing = new Set();
177
- function transition_in(block, local) {
178
- if (block && block.i) {
179
- outroing.delete(block);
180
- block.i(local);
181
- }
182
- }
183
-
184
- const globals = (typeof window !== 'undefined'
185
- ? window
186
- : typeof globalThis !== 'undefined'
187
- ? globalThis
188
- : global);
189
- function mount_component(component, target, anchor, customElement) {
190
- const { fragment, on_mount, on_destroy, after_update } = component.$$;
191
- fragment && fragment.m(target, anchor);
192
- if (!customElement) {
193
- // onMount happens before the initial afterUpdate
194
- add_render_callback(() => {
195
- const new_on_destroy = on_mount.map(run).filter(is_function);
196
- if (on_destroy) {
197
- on_destroy.push(...new_on_destroy);
198
- }
199
- else {
200
- // Edge case - component was destroyed immediately,
201
- // most likely as a result of a binding initialising
202
- run_all(new_on_destroy);
203
- }
204
- component.$$.on_mount = [];
205
- });
206
- }
207
- after_update.forEach(add_render_callback);
208
- }
209
- function destroy_component(component, detaching) {
210
- const $$ = component.$$;
211
- if ($$.fragment !== null) {
212
- run_all($$.on_destroy);
213
- $$.fragment && $$.fragment.d(detaching);
214
- // TODO null out other refs, including component.$$ (but need to
215
- // preserve final state?)
216
- $$.on_destroy = $$.fragment = null;
217
- $$.ctx = [];
218
- }
219
- }
220
- function make_dirty(component, i) {
221
- if (component.$$.dirty[0] === -1) {
222
- dirty_components.push(component);
223
- schedule_update();
224
- component.$$.dirty.fill(0);
225
- }
226
- component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
227
- }
228
- function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {
229
- const parent_component = current_component;
230
- set_current_component(component);
231
- const $$ = component.$$ = {
232
- fragment: null,
233
- ctx: null,
234
- // state
235
- props,
236
- update: noop,
237
- not_equal,
238
- bound: blank_object(),
239
- // lifecycle
240
- on_mount: [],
241
- on_destroy: [],
242
- on_disconnect: [],
243
- before_update: [],
244
- after_update: [],
245
- context: new Map(parent_component ? parent_component.$$.context : options.context || []),
246
- // everything else
247
- callbacks: blank_object(),
248
- dirty,
249
- skip_bound: false
250
- };
251
- let ready = false;
252
- $$.ctx = instance
253
- ? instance(component, options.props || {}, (i, ret, ...rest) => {
254
- const value = rest.length ? rest[0] : ret;
255
- if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
256
- if (!$$.skip_bound && $$.bound[i])
257
- $$.bound[i](value);
258
- if (ready)
259
- make_dirty(component, i);
260
- }
261
- return ret;
262
- })
263
- : [];
264
- $$.update();
265
- ready = true;
266
- run_all($$.before_update);
267
- // `false` as a special case of no DOM component
268
- $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
269
- if (options.target) {
270
- if (options.hydrate) {
271
- const nodes = children(options.target);
272
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
273
- $$.fragment && $$.fragment.l(nodes);
274
- nodes.forEach(detach);
275
- }
276
- else {
277
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
278
- $$.fragment && $$.fragment.c();
279
- }
280
- if (options.intro)
281
- transition_in(component.$$.fragment);
282
- mount_component(component, options.target, options.anchor, options.customElement);
283
- flush();
284
- }
285
- set_current_component(parent_component);
286
- }
287
- let SvelteElement;
288
- if (typeof HTMLElement === 'function') {
289
- SvelteElement = class extends HTMLElement {
290
- constructor() {
291
- super();
292
- this.attachShadow({ mode: 'open' });
293
- }
294
- connectedCallback() {
295
- const { on_mount } = this.$$;
296
- this.$$.on_disconnect = on_mount.map(run).filter(is_function);
297
- // @ts-ignore todo: improve typings
298
- for (const key in this.$$.slotted) {
299
- // @ts-ignore todo: improve typings
300
- this.appendChild(this.$$.slotted[key]);
301
- }
302
- }
303
- attributeChangedCallback(attr, _oldValue, newValue) {
304
- this[attr] = newValue;
305
- }
306
- disconnectedCallback() {
307
- run_all(this.$$.on_disconnect);
308
- }
309
- $destroy() {
310
- destroy_component(this, 1);
311
- this.$destroy = noop;
312
- }
313
- $on(type, callback) {
314
- // TODO should this delegate to addEventListener?
315
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
316
- callbacks.push(callback);
317
- return () => {
318
- const index = callbacks.indexOf(callback);
319
- if (index !== -1)
320
- callbacks.splice(index, 1);
321
- };
322
- }
323
- $set($$props) {
324
- if (this.$$set && !is_empty($$props)) {
325
- this.$$.skip_bound = true;
326
- this.$$set($$props);
327
- this.$$.skip_bound = false;
328
- }
329
- }
330
- };
331
- }
332
-
333
- function dispatch_dev(type, detail) {
334
- document.dispatchEvent(custom_event(type, Object.assign({ version: '3.37.0' }, detail)));
335
- }
336
- function append_dev(target, node) {
337
- dispatch_dev('SvelteDOMInsert', { target, node });
338
- append(target, node);
339
- }
340
- function insert_dev(target, node, anchor) {
341
- dispatch_dev('SvelteDOMInsert', { target, node, anchor });
342
- insert(target, node, anchor);
343
- }
344
- function detach_dev(node) {
345
- dispatch_dev('SvelteDOMRemove', { node });
346
- detach(node);
347
- }
348
- function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {
349
- const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
350
- if (has_prevent_default)
351
- modifiers.push('preventDefault');
352
- if (has_stop_propagation)
353
- modifiers.push('stopPropagation');
354
- dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
355
- const dispose = listen(node, event, handler, options);
356
- return () => {
357
- dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
358
- dispose();
359
- };
360
- }
361
- function attr_dev(node, attribute, value) {
362
- attr(node, attribute, value);
363
- if (value == null)
364
- dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
365
- else
366
- dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
367
- }
368
- function set_data_dev(text, data) {
369
- data = '' + data;
370
- if (text.wholeText === data)
371
- return;
372
- dispatch_dev('SvelteDOMSetData', { node: text, data });
373
- text.data = data;
374
- }
375
- function validate_slots(name, slot, keys) {
376
- for (const slot_key of Object.keys(slot)) {
377
- if (!~keys.indexOf(slot_key)) {
378
- console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
379
- }
380
- }
381
- }
382
-
383
- const subscriber_queue = [];
384
- /**
385
- * Creates a `Readable` store that allows reading by subscription.
386
- * @param value initial value
387
- * @param {StartStopNotifier}start start and stop notifications for subscriptions
388
- */
389
- function readable(value, start) {
390
- return {
391
- subscribe: writable(value, start).subscribe
392
- };
393
- }
394
- /**
395
- * Create a `Writable` store that allows both updating and reading by subscription.
396
- * @param {*=}value initial value
397
- * @param {StartStopNotifier=}start start and stop notifications for subscriptions
398
- */
399
- function writable(value, start = noop) {
400
- let stop;
401
- const subscribers = [];
402
- function set(new_value) {
403
- if (safe_not_equal(value, new_value)) {
404
- value = new_value;
405
- if (stop) { // store is ready
406
- const run_queue = !subscriber_queue.length;
407
- for (let i = 0; i < subscribers.length; i += 1) {
408
- const s = subscribers[i];
409
- s[1]();
410
- subscriber_queue.push(s, value);
411
- }
412
- if (run_queue) {
413
- for (let i = 0; i < subscriber_queue.length; i += 2) {
414
- subscriber_queue[i][0](subscriber_queue[i + 1]);
415
- }
416
- subscriber_queue.length = 0;
417
- }
418
- }
419
- }
420
- }
421
- function update(fn) {
422
- set(fn(value));
423
- }
424
- function subscribe(run, invalidate = noop) {
425
- const subscriber = [run, invalidate];
426
- subscribers.push(subscriber);
427
- if (subscribers.length === 1) {
428
- stop = start(set) || noop;
429
- }
430
- run(value);
431
- return () => {
432
- const index = subscribers.indexOf(subscriber);
433
- if (index !== -1) {
434
- subscribers.splice(index, 1);
435
- }
436
- if (subscribers.length === 0) {
437
- stop();
438
- stop = null;
439
- }
440
- };
441
- }
442
- return { set, update, subscribe };
443
- }
444
- function derived(stores, fn, initial_value) {
445
- const single = !Array.isArray(stores);
446
- const stores_array = single
447
- ? [stores]
448
- : stores;
449
- const auto = fn.length < 2;
450
- return readable(initial_value, (set) => {
451
- let inited = false;
452
- const values = [];
453
- let pending = 0;
454
- let cleanup = noop;
455
- const sync = () => {
456
- if (pending) {
457
- return;
458
- }
459
- cleanup();
460
- const result = fn(single ? values[0] : values, set);
461
- if (auto) {
462
- set(result);
463
- }
464
- else {
465
- cleanup = is_function(result) ? result : noop;
466
- }
467
- };
468
- const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {
469
- values[i] = value;
470
- pending &= ~(1 << i);
471
- if (inited) {
472
- sync();
473
- }
474
- }, () => {
475
- pending |= (1 << i);
476
- }));
477
- inited = true;
478
- sync();
479
- return function stop() {
480
- run_all(unsubscribers);
481
- cleanup();
482
- };
483
- });
484
- }
485
-
486
- var isMergeableObject = function isMergeableObject(value) {
487
- return isNonNullObject(value)
488
- && !isSpecial(value)
489
- };
490
-
491
- function isNonNullObject(value) {
492
- return !!value && typeof value === 'object'
493
- }
494
-
495
- function isSpecial(value) {
496
- var stringValue = Object.prototype.toString.call(value);
497
-
498
- return stringValue === '[object RegExp]'
499
- || stringValue === '[object Date]'
500
- || isReactElement(value)
501
- }
502
-
503
- // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
504
- var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
505
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
506
-
507
- function isReactElement(value) {
508
- return value.$$typeof === REACT_ELEMENT_TYPE
509
- }
510
-
511
- function emptyTarget(val) {
512
- return Array.isArray(val) ? [] : {}
513
- }
514
-
515
- function cloneUnlessOtherwiseSpecified(value, options) {
516
- return (options.clone !== false && options.isMergeableObject(value))
517
- ? deepmerge(emptyTarget(value), value, options)
518
- : value
519
- }
520
-
521
- function defaultArrayMerge(target, source, options) {
522
- return target.concat(source).map(function(element) {
523
- return cloneUnlessOtherwiseSpecified(element, options)
524
- })
525
- }
526
-
527
- function getMergeFunction(key, options) {
528
- if (!options.customMerge) {
529
- return deepmerge
530
- }
531
- var customMerge = options.customMerge(key);
532
- return typeof customMerge === 'function' ? customMerge : deepmerge
533
- }
534
-
535
- function getEnumerableOwnPropertySymbols(target) {
536
- return Object.getOwnPropertySymbols
537
- ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
538
- return target.propertyIsEnumerable(symbol)
539
- })
540
- : []
541
- }
542
-
543
- function getKeys(target) {
544
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
545
- }
546
-
547
- function propertyIsOnObject(object, property) {
548
- try {
549
- return property in object
550
- } catch(_) {
551
- return false
552
- }
553
- }
554
-
555
- // Protects from prototype poisoning and unexpected merging up the prototype chain.
556
- function propertyIsUnsafe(target, key) {
557
- return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
558
- && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
559
- && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
560
- }
561
-
562
- function mergeObject(target, source, options) {
563
- var destination = {};
564
- if (options.isMergeableObject(target)) {
565
- getKeys(target).forEach(function(key) {
566
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
567
- });
568
- }
569
- getKeys(source).forEach(function(key) {
570
- if (propertyIsUnsafe(target, key)) {
571
- return
572
- }
573
-
574
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
575
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
576
- } else {
577
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
578
- }
579
- });
580
- return destination
581
- }
582
-
583
- function deepmerge(target, source, options) {
584
- options = options || {};
585
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
586
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
587
- // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
588
- // implementations can use it. The caller may not replace it.
589
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
590
-
591
- var sourceIsArray = Array.isArray(source);
592
- var targetIsArray = Array.isArray(target);
593
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
594
-
595
- if (!sourceAndTargetTypesMatch) {
596
- return cloneUnlessOtherwiseSpecified(source, options)
597
- } else if (sourceIsArray) {
598
- return options.arrayMerge(target, source, options)
599
- } else {
600
- return mergeObject(target, source, options)
601
- }
602
- }
603
-
604
- deepmerge.all = function deepmergeAll(array, options) {
605
- if (!Array.isArray(array)) {
606
- throw new Error('first argument should be an array')
607
- }
608
-
609
- return array.reduce(function(prev, next) {
610
- return deepmerge(prev, next, options)
611
- }, {})
612
- };
613
-
614
- var deepmerge_1 = deepmerge;
615
-
616
- var cjs = deepmerge_1;
617
-
618
- /*! *****************************************************************************
619
- Copyright (c) Microsoft Corporation.
620
-
621
- Permission to use, copy, modify, and/or distribute this software for any
622
- purpose with or without fee is hereby granted.
623
-
624
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
625
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
626
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
627
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
628
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
629
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
630
- PERFORMANCE OF THIS SOFTWARE.
631
- ***************************************************************************** */
632
- /* global Reflect, Promise */
633
-
634
- var extendStatics = function(d, b) {
635
- extendStatics = Object.setPrototypeOf ||
636
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
637
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
638
- return extendStatics(d, b);
639
- };
640
-
641
- function __extends(d, b) {
642
- if (typeof b !== "function" && b !== null)
643
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
644
- extendStatics(d, b);
645
- function __() { this.constructor = d; }
646
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
647
- }
648
-
649
- var __assign = function() {
650
- __assign = Object.assign || function __assign(t) {
651
- for (var s, i = 1, n = arguments.length; i < n; i++) {
652
- s = arguments[i];
653
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
654
- }
655
- return t;
656
- };
657
- return __assign.apply(this, arguments);
658
- };
659
-
660
- function __spreadArray(to, from) {
661
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
662
- to[j] = from[i];
663
- return to;
664
- }
665
-
666
- var ErrorKind;
667
- (function (ErrorKind) {
668
- /** Argument is unclosed (e.g. `{0`) */
669
- ErrorKind[ErrorKind["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
670
- /** Argument is empty (e.g. `{}`). */
671
- ErrorKind[ErrorKind["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
672
- /** Argument is malformed (e.g. `{foo!}``) */
673
- ErrorKind[ErrorKind["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
674
- /** Expect an argument type (e.g. `{foo,}`) */
675
- ErrorKind[ErrorKind["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
676
- /** Unsupported argument type (e.g. `{foo,foo}`) */
677
- ErrorKind[ErrorKind["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
678
- /** Expect an argument style (e.g. `{foo, number, }`) */
679
- ErrorKind[ErrorKind["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
680
- /** The number skeleton is invalid. */
681
- ErrorKind[ErrorKind["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
682
- /** The date time skeleton is invalid. */
683
- ErrorKind[ErrorKind["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
684
- /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */
685
- ErrorKind[ErrorKind["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
686
- /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */
687
- ErrorKind[ErrorKind["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
688
- /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */
689
- ErrorKind[ErrorKind["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
690
- /** Missing select argument options (e.g. `{foo, select}`) */
691
- ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
692
- /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */
693
- ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
694
- /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */
695
- ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
696
- /** Expecting a selector in `select` argument (e.g `{foo, select}`) */
697
- ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
698
- /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */
699
- ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
700
- /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */
701
- ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
702
- /**
703
- * Expecting a message fragment after the `plural` or `selectordinal` selector
704
- * (e.g. `{foo, plural, one}`)
705
- */
706
- ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
707
- /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */
708
- ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
709
- /**
710
- * Duplicate selectors in `plural` or `selectordinal` argument.
711
- * (e.g. {foo, plural, one {#} one {#}})
712
- */
713
- ErrorKind[ErrorKind["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
714
- /** Duplicate selectors in `select` argument.
715
- * (e.g. {foo, select, apple {apple} apple {apple}})
716
- */
717
- ErrorKind[ErrorKind["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
718
- /** Plural or select argument option must have `other` clause. */
719
- ErrorKind[ErrorKind["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
720
- /** The tag is malformed. (e.g. `<bold!>foo</bold!>) */
721
- ErrorKind[ErrorKind["INVALID_TAG"] = 23] = "INVALID_TAG";
722
- /** The tag name is invalid. (e.g. `<123>foo</123>`) */
723
- ErrorKind[ErrorKind["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
724
- /** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */
725
- ErrorKind[ErrorKind["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
726
- /** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */
727
- ErrorKind[ErrorKind["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
728
- })(ErrorKind || (ErrorKind = {}));
729
-
730
- var TYPE;
731
- (function (TYPE) {
732
- /**
733
- * Raw text
734
- */
735
- TYPE[TYPE["literal"] = 0] = "literal";
736
- /**
737
- * Variable w/o any format, e.g `var` in `this is a {var}`
738
- */
739
- TYPE[TYPE["argument"] = 1] = "argument";
740
- /**
741
- * Variable w/ number format
742
- */
743
- TYPE[TYPE["number"] = 2] = "number";
744
- /**
745
- * Variable w/ date format
746
- */
747
- TYPE[TYPE["date"] = 3] = "date";
748
- /**
749
- * Variable w/ time format
750
- */
751
- TYPE[TYPE["time"] = 4] = "time";
752
- /**
753
- * Variable w/ select format
754
- */
755
- TYPE[TYPE["select"] = 5] = "select";
756
- /**
757
- * Variable w/ plural format
758
- */
759
- TYPE[TYPE["plural"] = 6] = "plural";
760
- /**
761
- * Only possible within plural argument.
762
- * This is the `#` symbol that will be substituted with the count.
763
- */
764
- TYPE[TYPE["pound"] = 7] = "pound";
765
- /**
766
- * XML-like tag
767
- */
768
- TYPE[TYPE["tag"] = 8] = "tag";
769
- })(TYPE || (TYPE = {}));
770
- var SKELETON_TYPE;
771
- (function (SKELETON_TYPE) {
772
- SKELETON_TYPE[SKELETON_TYPE["number"] = 0] = "number";
773
- SKELETON_TYPE[SKELETON_TYPE["dateTime"] = 1] = "dateTime";
774
- })(SKELETON_TYPE || (SKELETON_TYPE = {}));
775
- /**
776
- * Type Guards
777
- */
778
- function isLiteralElement(el) {
779
- return el.type === TYPE.literal;
780
- }
781
- function isArgumentElement(el) {
782
- return el.type === TYPE.argument;
783
- }
784
- function isNumberElement(el) {
785
- return el.type === TYPE.number;
786
- }
787
- function isDateElement(el) {
788
- return el.type === TYPE.date;
789
- }
790
- function isTimeElement(el) {
791
- return el.type === TYPE.time;
792
- }
793
- function isSelectElement(el) {
794
- return el.type === TYPE.select;
795
- }
796
- function isPluralElement(el) {
797
- return el.type === TYPE.plural;
798
- }
799
- function isPoundElement(el) {
800
- return el.type === TYPE.pound;
801
- }
802
- function isTagElement(el) {
803
- return el.type === TYPE.tag;
804
- }
805
- function isNumberSkeleton(el) {
806
- return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);
807
- }
808
- function isDateTimeSkeleton(el) {
809
- return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);
810
- }
811
-
812
- // @generated from regex-gen.ts
813
- var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
814
-
815
- /**
816
- * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
817
- * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
818
- * with some tweaks
819
- */
820
- var DATE_TIME_REGEX = /(?:[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;
821
- /**
822
- * Parse Date time skeleton into Intl.DateTimeFormatOptions
823
- * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
824
- * @public
825
- * @param skeleton skeleton string
826
- */
827
- function parseDateTimeSkeleton(skeleton) {
828
- var result = {};
829
- skeleton.replace(DATE_TIME_REGEX, function (match) {
830
- var len = match.length;
831
- switch (match[0]) {
832
- // Era
833
- case 'G':
834
- result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
835
- break;
836
- // Year
837
- case 'y':
838
- result.year = len === 2 ? '2-digit' : 'numeric';
839
- break;
840
- case 'Y':
841
- case 'u':
842
- case 'U':
843
- case 'r':
844
- throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');
845
- // Quarter
846
- case 'q':
847
- case 'Q':
848
- throw new RangeError('`q/Q` (quarter) patterns are not supported');
849
- // Month
850
- case 'M':
851
- case 'L':
852
- result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];
853
- break;
854
- // Week
855
- case 'w':
856
- case 'W':
857
- throw new RangeError('`w/W` (week) patterns are not supported');
858
- case 'd':
859
- result.day = ['numeric', '2-digit'][len - 1];
860
- break;
861
- case 'D':
862
- case 'F':
863
- case 'g':
864
- throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');
865
- // Weekday
866
- case 'E':
867
- result.weekday = len === 4 ? 'short' : len === 5 ? 'narrow' : 'short';
868
- break;
869
- case 'e':
870
- if (len < 4) {
871
- throw new RangeError('`e..eee` (weekday) patterns are not supported');
872
- }
873
- result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];
874
- break;
875
- case 'c':
876
- if (len < 4) {
877
- throw new RangeError('`c..ccc` (weekday) patterns are not supported');
878
- }
879
- result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];
880
- break;
881
- // Period
882
- case 'a': // AM, PM
883
- result.hour12 = true;
884
- break;
885
- case 'b': // am, pm, noon, midnight
886
- case 'B': // flexible day periods
887
- throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');
888
- // Hour
889
- case 'h':
890
- result.hourCycle = 'h12';
891
- result.hour = ['numeric', '2-digit'][len - 1];
892
- break;
893
- case 'H':
894
- result.hourCycle = 'h23';
895
- result.hour = ['numeric', '2-digit'][len - 1];
896
- break;
897
- case 'K':
898
- result.hourCycle = 'h11';
899
- result.hour = ['numeric', '2-digit'][len - 1];
900
- break;
901
- case 'k':
902
- result.hourCycle = 'h24';
903
- result.hour = ['numeric', '2-digit'][len - 1];
904
- break;
905
- case 'j':
906
- case 'J':
907
- case 'C':
908
- throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');
909
- // Minute
910
- case 'm':
911
- result.minute = ['numeric', '2-digit'][len - 1];
912
- break;
913
- // Second
914
- case 's':
915
- result.second = ['numeric', '2-digit'][len - 1];
916
- break;
917
- case 'S':
918
- case 'A':
919
- throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');
920
- // Zone
921
- case 'z': // 1..3, 4: specific non-location format
922
- result.timeZoneName = len < 4 ? 'short' : 'long';
923
- break;
924
- case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
925
- case 'O': // 1, 4: miliseconds in day short, long
926
- case 'v': // 1, 4: generic non-location format
927
- case 'V': // 1, 2, 3, 4: time zone ID or city
928
- case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
929
- case 'x': // 1, 2, 3, 4: The ISO8601 varios formats
930
- throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');
931
- }
932
- return '';
933
- });
934
- return result;
935
- }
936
-
937
- // @generated from regex-gen.ts
938
- var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
939
-
940
- function parseNumberSkeletonFromString(skeleton) {
941
- if (skeleton.length === 0) {
942
- throw new Error('Number skeleton cannot be empty');
943
- }
944
- // Parse the skeleton
945
- var stringTokens = skeleton
946
- .split(WHITE_SPACE_REGEX)
947
- .filter(function (x) { return x.length > 0; });
948
- var tokens = [];
949
- for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {
950
- var stringToken = stringTokens_1[_i];
951
- var stemAndOptions = stringToken.split('/');
952
- if (stemAndOptions.length === 0) {
953
- throw new Error('Invalid number skeleton');
954
- }
955
- var stem = stemAndOptions[0], options = stemAndOptions.slice(1);
956
- for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {
957
- var option = options_1[_a];
958
- if (option.length === 0) {
959
- throw new Error('Invalid number skeleton');
960
- }
961
- }
962
- tokens.push({ stem: stem, options: options });
963
- }
964
- return tokens;
965
- }
966
- function icuUnitToEcma(unit) {
967
- return unit.replace(/^(.*?)-/, '');
968
- }
969
- var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
970
- var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
971
- var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
972
- var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
973
- function parseSignificantPrecision(str) {
974
- var result = {};
975
- str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {
976
- // @@@ case
977
- if (typeof g2 !== 'string') {
978
- result.minimumSignificantDigits = g1.length;
979
- result.maximumSignificantDigits = g1.length;
980
- }
981
- // @@@+ case
982
- else if (g2 === '+') {
983
- result.minimumSignificantDigits = g1.length;
984
- }
985
- // .### case
986
- else if (g1[0] === '#') {
987
- result.maximumSignificantDigits = g1.length;
988
- }
989
- // .@@## or .@@@ case
990
- else {
991
- result.minimumSignificantDigits = g1.length;
992
- result.maximumSignificantDigits =
993
- g1.length + (typeof g2 === 'string' ? g2.length : 0);
994
- }
995
- return '';
996
- });
997
- return result;
998
- }
999
- function parseSign(str) {
1000
- switch (str) {
1001
- case 'sign-auto':
1002
- return {
1003
- signDisplay: 'auto',
1004
- };
1005
- case 'sign-accounting':
1006
- case '()':
1007
- return {
1008
- currencySign: 'accounting',
1009
- };
1010
- case 'sign-always':
1011
- case '+!':
1012
- return {
1013
- signDisplay: 'always',
1014
- };
1015
- case 'sign-accounting-always':
1016
- case '()!':
1017
- return {
1018
- signDisplay: 'always',
1019
- currencySign: 'accounting',
1020
- };
1021
- case 'sign-except-zero':
1022
- case '+?':
1023
- return {
1024
- signDisplay: 'exceptZero',
1025
- };
1026
- case 'sign-accounting-except-zero':
1027
- case '()?':
1028
- return {
1029
- signDisplay: 'exceptZero',
1030
- currencySign: 'accounting',
1031
- };
1032
- case 'sign-never':
1033
- case '+_':
1034
- return {
1035
- signDisplay: 'never',
1036
- };
1037
- }
1038
- }
1039
- function parseConciseScientificAndEngineeringStem(stem) {
1040
- // Engineering
1041
- var result;
1042
- if (stem[0] === 'E' && stem[1] === 'E') {
1043
- result = {
1044
- notation: 'engineering',
1045
- };
1046
- stem = stem.slice(2);
1047
- }
1048
- else if (stem[0] === 'E') {
1049
- result = {
1050
- notation: 'scientific',
1051
- };
1052
- stem = stem.slice(1);
1053
- }
1054
- if (result) {
1055
- var signDisplay = stem.slice(0, 2);
1056
- if (signDisplay === '+!') {
1057
- result.signDisplay = 'always';
1058
- stem = stem.slice(2);
1059
- }
1060
- else if (signDisplay === '+?') {
1061
- result.signDisplay = 'exceptZero';
1062
- stem = stem.slice(2);
1063
- }
1064
- if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {
1065
- throw new Error('Malformed concise eng/scientific notation');
1066
- }
1067
- result.minimumIntegerDigits = stem.length;
1068
- }
1069
- return result;
1070
- }
1071
- function parseNotationOptions(opt) {
1072
- var result = {};
1073
- var signOpts = parseSign(opt);
1074
- if (signOpts) {
1075
- return signOpts;
1076
- }
1077
- return result;
1078
- }
1079
- /**
1080
- * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
1081
- */
1082
- function parseNumberSkeleton(tokens) {
1083
- var result = {};
1084
- for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
1085
- var token = tokens_1[_i];
1086
- switch (token.stem) {
1087
- case 'percent':
1088
- case '%':
1089
- result.style = 'percent';
1090
- continue;
1091
- case '%x100':
1092
- result.style = 'percent';
1093
- result.scale = 100;
1094
- continue;
1095
- case 'currency':
1096
- result.style = 'currency';
1097
- result.currency = token.options[0];
1098
- continue;
1099
- case 'group-off':
1100
- case ',_':
1101
- result.useGrouping = false;
1102
- continue;
1103
- case 'precision-integer':
1104
- case '.':
1105
- result.maximumFractionDigits = 0;
1106
- continue;
1107
- case 'measure-unit':
1108
- case 'unit':
1109
- result.style = 'unit';
1110
- result.unit = icuUnitToEcma(token.options[0]);
1111
- continue;
1112
- case 'compact-short':
1113
- case 'K':
1114
- result.notation = 'compact';
1115
- result.compactDisplay = 'short';
1116
- continue;
1117
- case 'compact-long':
1118
- case 'KK':
1119
- result.notation = 'compact';
1120
- result.compactDisplay = 'long';
1121
- continue;
1122
- case 'scientific':
1123
- result = __assign(__assign(__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));
1124
- continue;
1125
- case 'engineering':
1126
- result = __assign(__assign(__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));
1127
- continue;
1128
- case 'notation-simple':
1129
- result.notation = 'standard';
1130
- continue;
1131
- // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h
1132
- case 'unit-width-narrow':
1133
- result.currencyDisplay = 'narrowSymbol';
1134
- result.unitDisplay = 'narrow';
1135
- continue;
1136
- case 'unit-width-short':
1137
- result.currencyDisplay = 'code';
1138
- result.unitDisplay = 'short';
1139
- continue;
1140
- case 'unit-width-full-name':
1141
- result.currencyDisplay = 'name';
1142
- result.unitDisplay = 'long';
1143
- continue;
1144
- case 'unit-width-iso-code':
1145
- result.currencyDisplay = 'symbol';
1146
- continue;
1147
- case 'scale':
1148
- result.scale = parseFloat(token.options[0]);
1149
- continue;
1150
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
1151
- case 'integer-width':
1152
- if (token.options.length > 1) {
1153
- throw new RangeError('integer-width stems only accept a single optional option');
1154
- }
1155
- token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) {
1156
- if (g1) {
1157
- result.minimumIntegerDigits = g2.length;
1158
- }
1159
- else if (g3 && g4) {
1160
- throw new Error('We currently do not support maximum integer digits');
1161
- }
1162
- else if (g5) {
1163
- throw new Error('We currently do not support exact integer digits');
1164
- }
1165
- return '';
1166
- });
1167
- continue;
1168
- }
1169
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
1170
- if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {
1171
- result.minimumIntegerDigits = token.stem.length;
1172
- continue;
1173
- }
1174
- if (FRACTION_PRECISION_REGEX.test(token.stem)) {
1175
- // Precision
1176
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision
1177
- // precision-integer case
1178
- if (token.options.length > 1) {
1179
- throw new RangeError('Fraction-precision stems only accept a single optional option');
1180
- }
1181
- token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) {
1182
- // .000* case (before ICU67 it was .000+)
1183
- if (g2 === '*') {
1184
- result.minimumFractionDigits = g1.length;
1185
- }
1186
- // .### case
1187
- else if (g3 && g3[0] === '#') {
1188
- result.maximumFractionDigits = g3.length;
1189
- }
1190
- // .00## case
1191
- else if (g4 && g5) {
1192
- result.minimumFractionDigits = g4.length;
1193
- result.maximumFractionDigits = g4.length + g5.length;
1194
- }
1195
- else {
1196
- result.minimumFractionDigits = g1.length;
1197
- result.maximumFractionDigits = g1.length;
1198
- }
1199
- return '';
1200
- });
1201
- if (token.options.length) {
1202
- result = __assign(__assign({}, result), parseSignificantPrecision(token.options[0]));
1203
- }
1204
- continue;
1205
- }
1206
- // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision
1207
- if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
1208
- result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));
1209
- continue;
1210
- }
1211
- var signOpts = parseSign(token.stem);
1212
- if (signOpts) {
1213
- result = __assign(__assign({}, result), signOpts);
1214
- }
1215
- var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
1216
- if (conciseScientificAndEngineeringOpts) {
1217
- result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts);
1218
- }
1219
- }
1220
- return result;
1221
- }
1222
-
1223
- var _a;
1224
- var SPACE_SEPARATOR_START_REGEX = new RegExp("^" + SPACE_SEPARATOR_REGEX.source + "*");
1225
- var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source + "*$");
1226
- function createLocation(start, end) {
1227
- return { start: start, end: end };
1228
- }
1229
- // #region Ponyfills
1230
- // Consolidate these variables up top for easier toggling during debugging
1231
- var hasNativeStartsWith = !!String.prototype.startsWith;
1232
- var hasNativeFromCodePoint = !!String.fromCodePoint;
1233
- var hasNativeFromEntries = !!Object.fromEntries;
1234
- var hasNativeCodePointAt = !!String.prototype.codePointAt;
1235
- var hasTrimStart = !!String.prototype.trimStart;
1236
- var hasTrimEnd = !!String.prototype.trimEnd;
1237
- var hasNativeIsSafeInteger = !!Number.isSafeInteger;
1238
- var isSafeInteger = hasNativeIsSafeInteger
1239
- ? Number.isSafeInteger
1240
- : function (n) {
1241
- return (typeof n === 'number' &&
1242
- isFinite(n) &&
1243
- Math.floor(n) === n &&
1244
- Math.abs(n) <= 0x1fffffffffffff);
1245
- };
1246
- // IE11 does not support y and u.
1247
- var REGEX_SUPPORTS_U_AND_Y = true;
1248
- try {
1249
- var re = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
1250
- /**
1251
- * legacy Edge or Xbox One browser
1252
- * Unicode flag support: supported
1253
- * Pattern_Syntax support: not supported
1254
- * See https://github.com/formatjs/formatjs/issues/2822
1255
- */
1256
- REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';
1257
- }
1258
- catch (_) {
1259
- REGEX_SUPPORTS_U_AND_Y = false;
1260
- }
1261
- var startsWith = hasNativeStartsWith
1262
- ? // Native
1263
- function startsWith(s, search, position) {
1264
- return s.startsWith(search, position);
1265
- }
1266
- : // For IE11
1267
- function startsWith(s, search, position) {
1268
- return s.slice(position, position + search.length) === search;
1269
- };
1270
- var fromCodePoint = hasNativeFromCodePoint
1271
- ? String.fromCodePoint
1272
- : // IE11
1273
- function fromCodePoint() {
1274
- var codePoints = [];
1275
- for (var _i = 0; _i < arguments.length; _i++) {
1276
- codePoints[_i] = arguments[_i];
1277
- }
1278
- var elements = '';
1279
- var length = codePoints.length;
1280
- var i = 0;
1281
- var code;
1282
- while (length > i) {
1283
- code = codePoints[i++];
1284
- if (code > 0x10ffff)
1285
- throw RangeError(code + ' is not a valid code point');
1286
- elements +=
1287
- code < 0x10000
1288
- ? String.fromCharCode(code)
1289
- : String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00);
1290
- }
1291
- return elements;
1292
- };
1293
- var fromEntries =
1294
- // native
1295
- hasNativeFromEntries
1296
- ? Object.fromEntries
1297
- : // Ponyfill
1298
- function fromEntries(entries) {
1299
- var obj = {};
1300
- for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
1301
- var _a = entries_1[_i], k = _a[0], v = _a[1];
1302
- obj[k] = v;
1303
- }
1304
- return obj;
1305
- };
1306
- var codePointAt = hasNativeCodePointAt
1307
- ? // Native
1308
- function codePointAt(s, index) {
1309
- return s.codePointAt(index);
1310
- }
1311
- : // IE 11
1312
- function codePointAt(s, index) {
1313
- var size = s.length;
1314
- if (index < 0 || index >= size) {
1315
- return undefined;
1316
- }
1317
- var first = s.charCodeAt(index);
1318
- var second;
1319
- return first < 0xd800 ||
1320
- first > 0xdbff ||
1321
- index + 1 === size ||
1322
- (second = s.charCodeAt(index + 1)) < 0xdc00 ||
1323
- second > 0xdfff
1324
- ? first
1325
- : ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;
1326
- };
1327
- var trimStart = hasTrimStart
1328
- ? // Native
1329
- function trimStart(s) {
1330
- return s.trimStart();
1331
- }
1332
- : // Ponyfill
1333
- function trimStart(s) {
1334
- return s.replace(SPACE_SEPARATOR_START_REGEX, '');
1335
- };
1336
- var trimEnd = hasTrimEnd
1337
- ? // Native
1338
- function trimEnd(s) {
1339
- return s.trimEnd();
1340
- }
1341
- : // Ponyfill
1342
- function trimEnd(s) {
1343
- return s.replace(SPACE_SEPARATOR_END_REGEX, '');
1344
- };
1345
- // Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.
1346
- function RE(s, flag) {
1347
- return new RegExp(s, flag);
1348
- }
1349
- // #endregion
1350
- var matchIdentifierAtIndex;
1351
- if (REGEX_SUPPORTS_U_AND_Y) {
1352
- // Native
1353
- var IDENTIFIER_PREFIX_RE_1 = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
1354
- matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {
1355
- var _a;
1356
- IDENTIFIER_PREFIX_RE_1.lastIndex = index;
1357
- var match = IDENTIFIER_PREFIX_RE_1.exec(s);
1358
- return (_a = match[1]) !== null && _a !== void 0 ? _a : '';
1359
- };
1360
- }
1361
- else {
1362
- // IE11
1363
- matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {
1364
- var match = [];
1365
- while (true) {
1366
- var c = codePointAt(s, index);
1367
- if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {
1368
- break;
1369
- }
1370
- match.push(c);
1371
- index += c >= 0x10000 ? 2 : 1;
1372
- }
1373
- return fromCodePoint.apply(void 0, match);
1374
- };
1375
- }
1376
- var Parser = /** @class */ (function () {
1377
- function Parser(message, options) {
1378
- if (options === void 0) { options = {}; }
1379
- this.message = message;
1380
- this.position = { offset: 0, line: 1, column: 1 };
1381
- this.ignoreTag = !!options.ignoreTag;
1382
- this.requiresOtherClause = !!options.requiresOtherClause;
1383
- this.shouldParseSkeletons = !!options.shouldParseSkeletons;
1384
- }
1385
- Parser.prototype.parse = function () {
1386
- if (this.offset() !== 0) {
1387
- throw Error('parser can only be used once');
1388
- }
1389
- return this.parseMessage(0, '', false);
1390
- };
1391
- Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) {
1392
- var elements = [];
1393
- while (!this.isEOF()) {
1394
- var char = this.char();
1395
- if (char === 123 /* `{` */) {
1396
- var result = this.parseArgument(nestingLevel, expectingCloseTag);
1397
- if (result.err) {
1398
- return result;
1399
- }
1400
- elements.push(result.val);
1401
- }
1402
- else if (char === 125 /* `}` */ && nestingLevel > 0) {
1403
- break;
1404
- }
1405
- else if (char === 35 /* `#` */ &&
1406
- (parentArgType === 'plural' || parentArgType === 'selectordinal')) {
1407
- var position = this.clonePosition();
1408
- this.bump();
1409
- elements.push({
1410
- type: TYPE.pound,
1411
- location: createLocation(position, this.clonePosition()),
1412
- });
1413
- }
1414
- else if (char === 60 /* `<` */ &&
1415
- !this.ignoreTag &&
1416
- this.peek() === 47 // char code for '/'
1417
- ) {
1418
- if (expectingCloseTag) {
1419
- break;
1420
- }
1421
- else {
1422
- return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
1423
- }
1424
- }
1425
- else if (char === 60 /* `<` */ &&
1426
- !this.ignoreTag &&
1427
- _isAlpha(this.peek() || 0)) {
1428
- var result = this.parseTag(nestingLevel, parentArgType);
1429
- if (result.err) {
1430
- return result;
1431
- }
1432
- elements.push(result.val);
1433
- }
1434
- else {
1435
- var result = this.parseLiteral(nestingLevel, parentArgType);
1436
- if (result.err) {
1437
- return result;
1438
- }
1439
- elements.push(result.val);
1440
- }
1441
- }
1442
- return { val: elements, err: null };
1443
- };
1444
- /**
1445
- * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
1446
- * [custom element name][] except that a dash is NOT always mandatory and uppercase letters
1447
- * are accepted:
1448
- *
1449
- * ```
1450
- * tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
1451
- * tagName ::= [a-z] (PENChar)*
1452
- * PENChar ::=
1453
- * "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
1454
- * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
1455
- * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
1456
- * ```
1457
- *
1458
- * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
1459
- * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
1460
- * since other tag-based engines like React allow it
1461
- */
1462
- Parser.prototype.parseTag = function (nestingLevel, parentArgType) {
1463
- var startPosition = this.clonePosition();
1464
- this.bump(); // `<`
1465
- var tagName = this.parseTagName();
1466
- this.bumpSpace();
1467
- if (this.bumpIf('/>')) {
1468
- // Self closing tag
1469
- return {
1470
- val: {
1471
- type: TYPE.literal,
1472
- value: "<" + tagName + "/>",
1473
- location: createLocation(startPosition, this.clonePosition()),
1474
- },
1475
- err: null,
1476
- };
1477
- }
1478
- else if (this.bumpIf('>')) {
1479
- var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
1480
- if (childrenResult.err) {
1481
- return childrenResult;
1482
- }
1483
- var children = childrenResult.val;
1484
- // Expecting a close tag
1485
- var endTagStartPosition = this.clonePosition();
1486
- if (this.bumpIf('</')) {
1487
- if (this.isEOF() || !_isAlpha(this.char())) {
1488
- return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
1489
- }
1490
- var closingTagNameStartPosition = this.clonePosition();
1491
- var closingTagName = this.parseTagName();
1492
- if (tagName !== closingTagName) {
1493
- return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
1494
- }
1495
- this.bumpSpace();
1496
- if (!this.bumpIf('>')) {
1497
- return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
1498
- }
1499
- return {
1500
- val: {
1501
- type: TYPE.tag,
1502
- value: tagName,
1503
- children: children,
1504
- location: createLocation(startPosition, this.clonePosition()),
1505
- },
1506
- err: null,
1507
- };
1508
- }
1509
- else {
1510
- return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));
1511
- }
1512
- }
1513
- else {
1514
- return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
1515
- }
1516
- };
1517
- /**
1518
- * This method assumes that the caller has peeked ahead for the first tag character.
1519
- */
1520
- Parser.prototype.parseTagName = function () {
1521
- var startOffset = this.offset();
1522
- this.bump(); // the first tag name character
1523
- while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {
1524
- this.bump();
1525
- }
1526
- return this.message.slice(startOffset, this.offset());
1527
- };
1528
- Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) {
1529
- var start = this.clonePosition();
1530
- var value = '';
1531
- while (true) {
1532
- var parseQuoteResult = this.tryParseQuote(parentArgType);
1533
- if (parseQuoteResult) {
1534
- value += parseQuoteResult;
1535
- continue;
1536
- }
1537
- var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
1538
- if (parseUnquotedResult) {
1539
- value += parseUnquotedResult;
1540
- continue;
1541
- }
1542
- var parseLeftAngleResult = this.tryParseLeftAngleBracket();
1543
- if (parseLeftAngleResult) {
1544
- value += parseLeftAngleResult;
1545
- continue;
1546
- }
1547
- break;
1548
- }
1549
- var location = createLocation(start, this.clonePosition());
1550
- return {
1551
- val: { type: TYPE.literal, value: value, location: location },
1552
- err: null,
1553
- };
1554
- };
1555
- Parser.prototype.tryParseLeftAngleBracket = function () {
1556
- if (!this.isEOF() &&
1557
- this.char() === 60 /* `<` */ &&
1558
- (this.ignoreTag ||
1559
- // If at the opening tag or closing tag position, bail.
1560
- !_isAlphaOrSlash(this.peek() || 0))) {
1561
- this.bump(); // `<`
1562
- return '<';
1563
- }
1564
- return null;
1565
- };
1566
- /**
1567
- * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
1568
- * a character that requires quoting (that is, "only where needed"), and works the same in
1569
- * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
1570
- */
1571
- Parser.prototype.tryParseQuote = function (parentArgType) {
1572
- if (this.isEOF() || this.char() !== 39 /* `'` */) {
1573
- return null;
1574
- }
1575
- // Parse escaped char following the apostrophe, or early return if there is no escaped char.
1576
- // Check if is valid escaped character
1577
- switch (this.peek()) {
1578
- case 39 /* `'` */:
1579
- // double quote, should return as a single quote.
1580
- this.bump();
1581
- this.bump();
1582
- return "'";
1583
- // '{', '<', '>', '}'
1584
- case 123:
1585
- case 60:
1586
- case 62:
1587
- case 125:
1588
- break;
1589
- case 35: // '#'
1590
- if (parentArgType === 'plural' || parentArgType === 'selectordinal') {
1591
- break;
1592
- }
1593
- return null;
1594
- default:
1595
- return null;
1596
- }
1597
- this.bump(); // apostrophe
1598
- var codePoints = [this.char()]; // escaped char
1599
- this.bump();
1600
- // read chars until the optional closing apostrophe is found
1601
- while (!this.isEOF()) {
1602
- var ch = this.char();
1603
- if (ch === 39 /* `'` */) {
1604
- if (this.peek() === 39 /* `'` */) {
1605
- codePoints.push(39);
1606
- // Bump one more time because we need to skip 2 characters.
1607
- this.bump();
1608
- }
1609
- else {
1610
- // Optional closing apostrophe.
1611
- this.bump();
1612
- break;
1613
- }
1614
- }
1615
- else {
1616
- codePoints.push(ch);
1617
- }
1618
- this.bump();
1619
- }
1620
- return fromCodePoint.apply(void 0, codePoints);
1621
- };
1622
- Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) {
1623
- if (this.isEOF()) {
1624
- return null;
1625
- }
1626
- var ch = this.char();
1627
- if (ch === 60 /* `<` */ ||
1628
- ch === 123 /* `{` */ ||
1629
- (ch === 35 /* `#` */ &&
1630
- (parentArgType === 'plural' || parentArgType === 'selectordinal')) ||
1631
- (ch === 125 /* `}` */ && nestingLevel > 0)) {
1632
- return null;
1633
- }
1634
- else {
1635
- this.bump();
1636
- return fromCodePoint(ch);
1637
- }
1638
- };
1639
- Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) {
1640
- var openingBracePosition = this.clonePosition();
1641
- this.bump(); // `{`
1642
- this.bumpSpace();
1643
- if (this.isEOF()) {
1644
- return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
1645
- }
1646
- if (this.char() === 125 /* `}` */) {
1647
- this.bump();
1648
- return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
1649
- }
1650
- // argument name
1651
- var value = this.parseIdentifierIfPossible().value;
1652
- if (!value) {
1653
- return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
1654
- }
1655
- this.bumpSpace();
1656
- if (this.isEOF()) {
1657
- return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
1658
- }
1659
- switch (this.char()) {
1660
- // Simple argument: `{name}`
1661
- case 125 /* `}` */: {
1662
- this.bump(); // `}`
1663
- return {
1664
- val: {
1665
- type: TYPE.argument,
1666
- // value does not include the opening and closing braces.
1667
- value: value,
1668
- location: createLocation(openingBracePosition, this.clonePosition()),
1669
- },
1670
- err: null,
1671
- };
1672
- }
1673
- // Argument with options: `{name, format, ...}`
1674
- case 44 /* `,` */: {
1675
- this.bump(); // `,`
1676
- this.bumpSpace();
1677
- if (this.isEOF()) {
1678
- return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
1679
- }
1680
- return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
1681
- }
1682
- default:
1683
- return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
1684
- }
1685
- };
1686
- /**
1687
- * Advance the parser until the end of the identifier, if it is currently on
1688
- * an identifier character. Return an empty string otherwise.
1689
- */
1690
- Parser.prototype.parseIdentifierIfPossible = function () {
1691
- var startingPosition = this.clonePosition();
1692
- var startOffset = this.offset();
1693
- var value = matchIdentifierAtIndex(this.message, startOffset);
1694
- var endOffset = startOffset + value.length;
1695
- this.bumpTo(endOffset);
1696
- var endPosition = this.clonePosition();
1697
- var location = createLocation(startingPosition, endPosition);
1698
- return { value: value, location: location };
1699
- };
1700
- Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) {
1701
- var _a;
1702
- // Parse this range:
1703
- // {name, type, style}
1704
- // ^---^
1705
- var typeStartPosition = this.clonePosition();
1706
- var argType = this.parseIdentifierIfPossible().value;
1707
- var typeEndPosition = this.clonePosition();
1708
- switch (argType) {
1709
- case '':
1710
- // Expecting a style string number, date, time, plural, selectordinal, or select.
1711
- return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
1712
- case 'number':
1713
- case 'date':
1714
- case 'time': {
1715
- // Parse this range:
1716
- // {name, number, style}
1717
- // ^-------^
1718
- this.bumpSpace();
1719
- var styleAndLocation = null;
1720
- if (this.bumpIf(',')) {
1721
- this.bumpSpace();
1722
- var styleStartPosition = this.clonePosition();
1723
- var result = this.parseSimpleArgStyleIfPossible();
1724
- if (result.err) {
1725
- return result;
1726
- }
1727
- var style = trimEnd(result.val);
1728
- if (style.length === 0) {
1729
- return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
1730
- }
1731
- var styleLocation = createLocation(styleStartPosition, this.clonePosition());
1732
- styleAndLocation = { style: style, styleLocation: styleLocation };
1733
- }
1734
- var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
1735
- if (argCloseResult.err) {
1736
- return argCloseResult;
1737
- }
1738
- var location_1 = createLocation(openingBracePosition, this.clonePosition());
1739
- // Extract style or skeleton
1740
- if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) {
1741
- // Skeleton starts with `::`.
1742
- var skeleton = trimStart(styleAndLocation.style.slice(2));
1743
- if (argType === 'number') {
1744
- var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
1745
- if (result.err) {
1746
- return result;
1747
- }
1748
- return {
1749
- val: { type: TYPE.number, value: value, location: location_1, style: result.val },
1750
- err: null,
1751
- };
1752
- }
1753
- else {
1754
- if (skeleton.length === 0) {
1755
- return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);
1756
- }
1757
- var style = {
1758
- type: SKELETON_TYPE.dateTime,
1759
- pattern: skeleton,
1760
- location: styleAndLocation.styleLocation,
1761
- parsedOptions: this.shouldParseSkeletons
1762
- ? parseDateTimeSkeleton(skeleton)
1763
- : {},
1764
- };
1765
- var type = argType === 'date' ? TYPE.date : TYPE.time;
1766
- return {
1767
- val: { type: type, value: value, location: location_1, style: style },
1768
- err: null,
1769
- };
1770
- }
1771
- }
1772
- // Regular style or no style.
1773
- return {
1774
- val: {
1775
- type: argType === 'number'
1776
- ? TYPE.number
1777
- : argType === 'date'
1778
- ? TYPE.date
1779
- : TYPE.time,
1780
- value: value,
1781
- location: location_1,
1782
- style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null,
1783
- },
1784
- err: null,
1785
- };
1786
- }
1787
- case 'plural':
1788
- case 'selectordinal':
1789
- case 'select': {
1790
- // Parse this range:
1791
- // {name, plural, options}
1792
- // ^---------^
1793
- var typeEndPosition_1 = this.clonePosition();
1794
- this.bumpSpace();
1795
- if (!this.bumpIf(',')) {
1796
- return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));
1797
- }
1798
- this.bumpSpace();
1799
- // Parse offset:
1800
- // {name, plural, offset:1, options}
1801
- // ^-----^
1802
- //
1803
- // or the first option:
1804
- //
1805
- // {name, plural, one {...} other {...}}
1806
- // ^--^
1807
- var identifierAndLocation = this.parseIdentifierIfPossible();
1808
- var pluralOffset = 0;
1809
- if (argType !== 'select' && identifierAndLocation.value === 'offset') {
1810
- if (!this.bumpIf(':')) {
1811
- return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
1812
- }
1813
- this.bumpSpace();
1814
- var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
1815
- if (result.err) {
1816
- return result;
1817
- }
1818
- // Parse another identifier for option parsing
1819
- this.bumpSpace();
1820
- identifierAndLocation = this.parseIdentifierIfPossible();
1821
- pluralOffset = result.val;
1822
- }
1823
- var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
1824
- if (optionsResult.err) {
1825
- return optionsResult;
1826
- }
1827
- var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
1828
- if (argCloseResult.err) {
1829
- return argCloseResult;
1830
- }
1831
- var location_2 = createLocation(openingBracePosition, this.clonePosition());
1832
- if (argType === 'select') {
1833
- return {
1834
- val: {
1835
- type: TYPE.select,
1836
- value: value,
1837
- options: fromEntries(optionsResult.val),
1838
- location: location_2,
1839
- },
1840
- err: null,
1841
- };
1842
- }
1843
- else {
1844
- return {
1845
- val: {
1846
- type: TYPE.plural,
1847
- value: value,
1848
- options: fromEntries(optionsResult.val),
1849
- offset: pluralOffset,
1850
- pluralType: argType === 'plural' ? 'cardinal' : 'ordinal',
1851
- location: location_2,
1852
- },
1853
- err: null,
1854
- };
1855
- }
1856
- }
1857
- default:
1858
- return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
1859
- }
1860
- };
1861
- Parser.prototype.tryParseArgumentClose = function (openingBracePosition) {
1862
- // Parse: {value, number, ::currency/GBP }
1863
- //
1864
- if (this.isEOF() || this.char() !== 125 /* `}` */) {
1865
- return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
1866
- }
1867
- this.bump(); // `}`
1868
- return { val: true, err: null };
1869
- };
1870
- /**
1871
- * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
1872
- */
1873
- Parser.prototype.parseSimpleArgStyleIfPossible = function () {
1874
- var nestedBraces = 0;
1875
- var startPosition = this.clonePosition();
1876
- while (!this.isEOF()) {
1877
- var ch = this.char();
1878
- switch (ch) {
1879
- case 39 /* `'` */: {
1880
- // Treat apostrophe as quoting but include it in the style part.
1881
- // Find the end of the quoted literal text.
1882
- this.bump();
1883
- var apostrophePosition = this.clonePosition();
1884
- if (!this.bumpUntil("'")) {
1885
- return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
1886
- }
1887
- this.bump();
1888
- break;
1889
- }
1890
- case 123 /* `{` */: {
1891
- nestedBraces += 1;
1892
- this.bump();
1893
- break;
1894
- }
1895
- case 125 /* `}` */: {
1896
- if (nestedBraces > 0) {
1897
- nestedBraces -= 1;
1898
- }
1899
- else {
1900
- return {
1901
- val: this.message.slice(startPosition.offset, this.offset()),
1902
- err: null,
1903
- };
1904
- }
1905
- break;
1906
- }
1907
- default:
1908
- this.bump();
1909
- break;
1910
- }
1911
- }
1912
- return {
1913
- val: this.message.slice(startPosition.offset, this.offset()),
1914
- err: null,
1915
- };
1916
- };
1917
- Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) {
1918
- var tokens = [];
1919
- try {
1920
- tokens = parseNumberSkeletonFromString(skeleton);
1921
- }
1922
- catch (e) {
1923
- return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
1924
- }
1925
- return {
1926
- val: {
1927
- type: SKELETON_TYPE.number,
1928
- tokens: tokens,
1929
- location: location,
1930
- parsedOptions: this.shouldParseSkeletons
1931
- ? parseNumberSkeleton(tokens)
1932
- : {},
1933
- },
1934
- err: null,
1935
- };
1936
- };
1937
- /**
1938
- * @param nesting_level The current nesting level of messages.
1939
- * This can be positive when parsing message fragment in select or plural argument options.
1940
- * @param parent_arg_type The parent argument's type.
1941
- * @param parsed_first_identifier If provided, this is the first identifier-like selector of
1942
- * the argument. It is a by-product of a previous parsing attempt.
1943
- * @param expecting_close_tag If true, this message is directly or indirectly nested inside
1944
- * between a pair of opening and closing tags. The nested message will not parse beyond
1945
- * the closing tag boundary.
1946
- */
1947
- Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
1948
- var _a;
1949
- var hasOtherClause = false;
1950
- var options = [];
1951
- var parsedSelectors = new Set();
1952
- var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
1953
- // Parse:
1954
- // one {one apple}
1955
- // ^--^
1956
- while (true) {
1957
- if (selector.length === 0) {
1958
- var startPosition = this.clonePosition();
1959
- if (parentArgType !== 'select' && this.bumpIf('=')) {
1960
- // Try parse `={number}` selector
1961
- var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
1962
- if (result.err) {
1963
- return result;
1964
- }
1965
- selectorLocation = createLocation(startPosition, this.clonePosition());
1966
- selector = this.message.slice(startPosition.offset, this.offset());
1967
- }
1968
- else {
1969
- break;
1970
- }
1971
- }
1972
- // Duplicate selector clauses
1973
- if (parsedSelectors.has(selector)) {
1974
- return this.error(parentArgType === 'select'
1975
- ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR
1976
- : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);
1977
- }
1978
- if (selector === 'other') {
1979
- hasOtherClause = true;
1980
- }
1981
- // Parse:
1982
- // one {one apple}
1983
- // ^----------^
1984
- this.bumpSpace();
1985
- var openingBracePosition = this.clonePosition();
1986
- if (!this.bumpIf('{')) {
1987
- return this.error(parentArgType === 'select'
1988
- ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT
1989
- : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
1990
- }
1991
- var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
1992
- if (fragmentResult.err) {
1993
- return fragmentResult;
1994
- }
1995
- var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
1996
- if (argCloseResult.err) {
1997
- return argCloseResult;
1998
- }
1999
- options.push([
2000
- selector,
2001
- {
2002
- value: fragmentResult.val,
2003
- location: createLocation(openingBracePosition, this.clonePosition()),
2004
- },
2005
- ]);
2006
- // Keep track of the existing selectors
2007
- parsedSelectors.add(selector);
2008
- // Prep next selector clause.
2009
- this.bumpSpace();
2010
- (_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location);
2011
- }
2012
- if (options.length === 0) {
2013
- return this.error(parentArgType === 'select'
2014
- ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR
2015
- : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
2016
- }
2017
- if (this.requiresOtherClause && !hasOtherClause) {
2018
- return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
2019
- }
2020
- return { val: options, err: null };
2021
- };
2022
- Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) {
2023
- var sign = 1;
2024
- var startingPosition = this.clonePosition();
2025
- if (this.bumpIf('+')) ;
2026
- else if (this.bumpIf('-')) {
2027
- sign = -1;
2028
- }
2029
- var hasDigits = false;
2030
- var decimal = 0;
2031
- while (!this.isEOF()) {
2032
- var ch = this.char();
2033
- if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) {
2034
- hasDigits = true;
2035
- decimal = decimal * 10 + (ch - 48);
2036
- this.bump();
2037
- }
2038
- else {
2039
- break;
2040
- }
2041
- }
2042
- var location = createLocation(startingPosition, this.clonePosition());
2043
- if (!hasDigits) {
2044
- return this.error(expectNumberError, location);
2045
- }
2046
- decimal *= sign;
2047
- if (!isSafeInteger(decimal)) {
2048
- return this.error(invalidNumberError, location);
2049
- }
2050
- return { val: decimal, err: null };
2051
- };
2052
- Parser.prototype.offset = function () {
2053
- return this.position.offset;
2054
- };
2055
- Parser.prototype.isEOF = function () {
2056
- return this.offset() === this.message.length;
2057
- };
2058
- Parser.prototype.clonePosition = function () {
2059
- // This is much faster than `Object.assign` or spread.
2060
- return {
2061
- offset: this.position.offset,
2062
- line: this.position.line,
2063
- column: this.position.column,
2064
- };
2065
- };
2066
- /**
2067
- * Return the code point at the current position of the parser.
2068
- * Throws if the index is out of bound.
2069
- */
2070
- Parser.prototype.char = function () {
2071
- var offset = this.position.offset;
2072
- if (offset >= this.message.length) {
2073
- throw Error('out of bound');
2074
- }
2075
- var code = codePointAt(this.message, offset);
2076
- if (code === undefined) {
2077
- throw Error("Offset " + offset + " is at invalid UTF-16 code unit boundary");
2078
- }
2079
- return code;
2080
- };
2081
- Parser.prototype.error = function (kind, location) {
2082
- return {
2083
- val: null,
2084
- err: {
2085
- kind: kind,
2086
- message: this.message,
2087
- location: location,
2088
- },
2089
- };
2090
- };
2091
- /** Bump the parser to the next UTF-16 code unit. */
2092
- Parser.prototype.bump = function () {
2093
- if (this.isEOF()) {
2094
- return;
2095
- }
2096
- var code = this.char();
2097
- if (code === 10 /* '\n' */) {
2098
- this.position.line += 1;
2099
- this.position.column = 1;
2100
- this.position.offset += 1;
2101
- }
2102
- else {
2103
- this.position.column += 1;
2104
- // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.
2105
- this.position.offset += code < 0x10000 ? 1 : 2;
2106
- }
2107
- };
2108
- /**
2109
- * If the substring starting at the current position of the parser has
2110
- * the given prefix, then bump the parser to the character immediately
2111
- * following the prefix and return true. Otherwise, don't bump the parser
2112
- * and return false.
2113
- */
2114
- Parser.prototype.bumpIf = function (prefix) {
2115
- if (startsWith(this.message, prefix, this.offset())) {
2116
- for (var i = 0; i < prefix.length; i++) {
2117
- this.bump();
2118
- }
2119
- return true;
2120
- }
2121
- return false;
2122
- };
2123
- /**
2124
- * Bump the parser until the pattern character is found and return `true`.
2125
- * Otherwise bump to the end of the file and return `false`.
2126
- */
2127
- Parser.prototype.bumpUntil = function (pattern) {
2128
- var currentOffset = this.offset();
2129
- var index = this.message.indexOf(pattern, currentOffset);
2130
- if (index >= 0) {
2131
- this.bumpTo(index);
2132
- return true;
2133
- }
2134
- else {
2135
- this.bumpTo(this.message.length);
2136
- return false;
2137
- }
2138
- };
2139
- /**
2140
- * Bump the parser to the target offset.
2141
- * If target offset is beyond the end of the input, bump the parser to the end of the input.
2142
- */
2143
- Parser.prototype.bumpTo = function (targetOffset) {
2144
- if (this.offset() > targetOffset) {
2145
- throw Error("targetOffset " + targetOffset + " must be greater than or equal to the current offset " + this.offset());
2146
- }
2147
- targetOffset = Math.min(targetOffset, this.message.length);
2148
- while (true) {
2149
- var offset = this.offset();
2150
- if (offset === targetOffset) {
2151
- break;
2152
- }
2153
- if (offset > targetOffset) {
2154
- throw Error("targetOffset " + targetOffset + " is at invalid UTF-16 code unit boundary");
2155
- }
2156
- this.bump();
2157
- if (this.isEOF()) {
2158
- break;
2159
- }
2160
- }
2161
- };
2162
- /** advance the parser through all whitespace to the next non-whitespace code unit. */
2163
- Parser.prototype.bumpSpace = function () {
2164
- while (!this.isEOF() && _isWhiteSpace(this.char())) {
2165
- this.bump();
2166
- }
2167
- };
2168
- /**
2169
- * Peek at the *next* Unicode codepoint in the input without advancing the parser.
2170
- * If the input has been exhausted, then this returns null.
2171
- */
2172
- Parser.prototype.peek = function () {
2173
- if (this.isEOF()) {
2174
- return null;
2175
- }
2176
- var code = this.char();
2177
- var offset = this.offset();
2178
- var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1));
2179
- return nextCode !== null && nextCode !== void 0 ? nextCode : null;
2180
- };
2181
- return Parser;
2182
- }());
2183
- /**
2184
- * This check if codepoint is alphabet (lower & uppercase)
2185
- * @param codepoint
2186
- * @returns
2187
- */
2188
- function _isAlpha(codepoint) {
2189
- return ((codepoint >= 97 && codepoint <= 122) ||
2190
- (codepoint >= 65 && codepoint <= 90));
2191
- }
2192
- function _isAlphaOrSlash(codepoint) {
2193
- return _isAlpha(codepoint) || codepoint === 47; /* '/' */
2194
- }
2195
- /** See `parseTag` function docs. */
2196
- function _isPotentialElementNameChar(c) {
2197
- return (c === 45 /* '-' */ ||
2198
- c === 46 /* '.' */ ||
2199
- (c >= 48 && c <= 57) /* 0..9 */ ||
2200
- c === 95 /* '_' */ ||
2201
- (c >= 97 && c <= 122) /** a..z */ ||
2202
- (c >= 65 && c <= 90) /* A..Z */ ||
2203
- c == 0xb7 ||
2204
- (c >= 0xc0 && c <= 0xd6) ||
2205
- (c >= 0xd8 && c <= 0xf6) ||
2206
- (c >= 0xf8 && c <= 0x37d) ||
2207
- (c >= 0x37f && c <= 0x1fff) ||
2208
- (c >= 0x200c && c <= 0x200d) ||
2209
- (c >= 0x203f && c <= 0x2040) ||
2210
- (c >= 0x2070 && c <= 0x218f) ||
2211
- (c >= 0x2c00 && c <= 0x2fef) ||
2212
- (c >= 0x3001 && c <= 0xd7ff) ||
2213
- (c >= 0xf900 && c <= 0xfdcf) ||
2214
- (c >= 0xfdf0 && c <= 0xfffd) ||
2215
- (c >= 0x10000 && c <= 0xeffff));
2216
- }
2217
- /**
2218
- * Code point equivalent of regex `\p{White_Space}`.
2219
- * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
2220
- */
2221
- function _isWhiteSpace(c) {
2222
- return ((c >= 0x0009 && c <= 0x000d) ||
2223
- c === 0x0020 ||
2224
- c === 0x0085 ||
2225
- (c >= 0x200e && c <= 0x200f) ||
2226
- c === 0x2028 ||
2227
- c === 0x2029);
2228
- }
2229
- /**
2230
- * Code point equivalent of regex `\p{Pattern_Syntax}`.
2231
- * See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
2232
- */
2233
- function _isPatternSyntax(c) {
2234
- return ((c >= 0x0021 && c <= 0x0023) ||
2235
- c === 0x0024 ||
2236
- (c >= 0x0025 && c <= 0x0027) ||
2237
- c === 0x0028 ||
2238
- c === 0x0029 ||
2239
- c === 0x002a ||
2240
- c === 0x002b ||
2241
- c === 0x002c ||
2242
- c === 0x002d ||
2243
- (c >= 0x002e && c <= 0x002f) ||
2244
- (c >= 0x003a && c <= 0x003b) ||
2245
- (c >= 0x003c && c <= 0x003e) ||
2246
- (c >= 0x003f && c <= 0x0040) ||
2247
- c === 0x005b ||
2248
- c === 0x005c ||
2249
- c === 0x005d ||
2250
- c === 0x005e ||
2251
- c === 0x0060 ||
2252
- c === 0x007b ||
2253
- c === 0x007c ||
2254
- c === 0x007d ||
2255
- c === 0x007e ||
2256
- c === 0x00a1 ||
2257
- (c >= 0x00a2 && c <= 0x00a5) ||
2258
- c === 0x00a6 ||
2259
- c === 0x00a7 ||
2260
- c === 0x00a9 ||
2261
- c === 0x00ab ||
2262
- c === 0x00ac ||
2263
- c === 0x00ae ||
2264
- c === 0x00b0 ||
2265
- c === 0x00b1 ||
2266
- c === 0x00b6 ||
2267
- c === 0x00bb ||
2268
- c === 0x00bf ||
2269
- c === 0x00d7 ||
2270
- c === 0x00f7 ||
2271
- (c >= 0x2010 && c <= 0x2015) ||
2272
- (c >= 0x2016 && c <= 0x2017) ||
2273
- c === 0x2018 ||
2274
- c === 0x2019 ||
2275
- c === 0x201a ||
2276
- (c >= 0x201b && c <= 0x201c) ||
2277
- c === 0x201d ||
2278
- c === 0x201e ||
2279
- c === 0x201f ||
2280
- (c >= 0x2020 && c <= 0x2027) ||
2281
- (c >= 0x2030 && c <= 0x2038) ||
2282
- c === 0x2039 ||
2283
- c === 0x203a ||
2284
- (c >= 0x203b && c <= 0x203e) ||
2285
- (c >= 0x2041 && c <= 0x2043) ||
2286
- c === 0x2044 ||
2287
- c === 0x2045 ||
2288
- c === 0x2046 ||
2289
- (c >= 0x2047 && c <= 0x2051) ||
2290
- c === 0x2052 ||
2291
- c === 0x2053 ||
2292
- (c >= 0x2055 && c <= 0x205e) ||
2293
- (c >= 0x2190 && c <= 0x2194) ||
2294
- (c >= 0x2195 && c <= 0x2199) ||
2295
- (c >= 0x219a && c <= 0x219b) ||
2296
- (c >= 0x219c && c <= 0x219f) ||
2297
- c === 0x21a0 ||
2298
- (c >= 0x21a1 && c <= 0x21a2) ||
2299
- c === 0x21a3 ||
2300
- (c >= 0x21a4 && c <= 0x21a5) ||
2301
- c === 0x21a6 ||
2302
- (c >= 0x21a7 && c <= 0x21ad) ||
2303
- c === 0x21ae ||
2304
- (c >= 0x21af && c <= 0x21cd) ||
2305
- (c >= 0x21ce && c <= 0x21cf) ||
2306
- (c >= 0x21d0 && c <= 0x21d1) ||
2307
- c === 0x21d2 ||
2308
- c === 0x21d3 ||
2309
- c === 0x21d4 ||
2310
- (c >= 0x21d5 && c <= 0x21f3) ||
2311
- (c >= 0x21f4 && c <= 0x22ff) ||
2312
- (c >= 0x2300 && c <= 0x2307) ||
2313
- c === 0x2308 ||
2314
- c === 0x2309 ||
2315
- c === 0x230a ||
2316
- c === 0x230b ||
2317
- (c >= 0x230c && c <= 0x231f) ||
2318
- (c >= 0x2320 && c <= 0x2321) ||
2319
- (c >= 0x2322 && c <= 0x2328) ||
2320
- c === 0x2329 ||
2321
- c === 0x232a ||
2322
- (c >= 0x232b && c <= 0x237b) ||
2323
- c === 0x237c ||
2324
- (c >= 0x237d && c <= 0x239a) ||
2325
- (c >= 0x239b && c <= 0x23b3) ||
2326
- (c >= 0x23b4 && c <= 0x23db) ||
2327
- (c >= 0x23dc && c <= 0x23e1) ||
2328
- (c >= 0x23e2 && c <= 0x2426) ||
2329
- (c >= 0x2427 && c <= 0x243f) ||
2330
- (c >= 0x2440 && c <= 0x244a) ||
2331
- (c >= 0x244b && c <= 0x245f) ||
2332
- (c >= 0x2500 && c <= 0x25b6) ||
2333
- c === 0x25b7 ||
2334
- (c >= 0x25b8 && c <= 0x25c0) ||
2335
- c === 0x25c1 ||
2336
- (c >= 0x25c2 && c <= 0x25f7) ||
2337
- (c >= 0x25f8 && c <= 0x25ff) ||
2338
- (c >= 0x2600 && c <= 0x266e) ||
2339
- c === 0x266f ||
2340
- (c >= 0x2670 && c <= 0x2767) ||
2341
- c === 0x2768 ||
2342
- c === 0x2769 ||
2343
- c === 0x276a ||
2344
- c === 0x276b ||
2345
- c === 0x276c ||
2346
- c === 0x276d ||
2347
- c === 0x276e ||
2348
- c === 0x276f ||
2349
- c === 0x2770 ||
2350
- c === 0x2771 ||
2351
- c === 0x2772 ||
2352
- c === 0x2773 ||
2353
- c === 0x2774 ||
2354
- c === 0x2775 ||
2355
- (c >= 0x2794 && c <= 0x27bf) ||
2356
- (c >= 0x27c0 && c <= 0x27c4) ||
2357
- c === 0x27c5 ||
2358
- c === 0x27c6 ||
2359
- (c >= 0x27c7 && c <= 0x27e5) ||
2360
- c === 0x27e6 ||
2361
- c === 0x27e7 ||
2362
- c === 0x27e8 ||
2363
- c === 0x27e9 ||
2364
- c === 0x27ea ||
2365
- c === 0x27eb ||
2366
- c === 0x27ec ||
2367
- c === 0x27ed ||
2368
- c === 0x27ee ||
2369
- c === 0x27ef ||
2370
- (c >= 0x27f0 && c <= 0x27ff) ||
2371
- (c >= 0x2800 && c <= 0x28ff) ||
2372
- (c >= 0x2900 && c <= 0x2982) ||
2373
- c === 0x2983 ||
2374
- c === 0x2984 ||
2375
- c === 0x2985 ||
2376
- c === 0x2986 ||
2377
- c === 0x2987 ||
2378
- c === 0x2988 ||
2379
- c === 0x2989 ||
2380
- c === 0x298a ||
2381
- c === 0x298b ||
2382
- c === 0x298c ||
2383
- c === 0x298d ||
2384
- c === 0x298e ||
2385
- c === 0x298f ||
2386
- c === 0x2990 ||
2387
- c === 0x2991 ||
2388
- c === 0x2992 ||
2389
- c === 0x2993 ||
2390
- c === 0x2994 ||
2391
- c === 0x2995 ||
2392
- c === 0x2996 ||
2393
- c === 0x2997 ||
2394
- c === 0x2998 ||
2395
- (c >= 0x2999 && c <= 0x29d7) ||
2396
- c === 0x29d8 ||
2397
- c === 0x29d9 ||
2398
- c === 0x29da ||
2399
- c === 0x29db ||
2400
- (c >= 0x29dc && c <= 0x29fb) ||
2401
- c === 0x29fc ||
2402
- c === 0x29fd ||
2403
- (c >= 0x29fe && c <= 0x2aff) ||
2404
- (c >= 0x2b00 && c <= 0x2b2f) ||
2405
- (c >= 0x2b30 && c <= 0x2b44) ||
2406
- (c >= 0x2b45 && c <= 0x2b46) ||
2407
- (c >= 0x2b47 && c <= 0x2b4c) ||
2408
- (c >= 0x2b4d && c <= 0x2b73) ||
2409
- (c >= 0x2b74 && c <= 0x2b75) ||
2410
- (c >= 0x2b76 && c <= 0x2b95) ||
2411
- c === 0x2b96 ||
2412
- (c >= 0x2b97 && c <= 0x2bff) ||
2413
- (c >= 0x2e00 && c <= 0x2e01) ||
2414
- c === 0x2e02 ||
2415
- c === 0x2e03 ||
2416
- c === 0x2e04 ||
2417
- c === 0x2e05 ||
2418
- (c >= 0x2e06 && c <= 0x2e08) ||
2419
- c === 0x2e09 ||
2420
- c === 0x2e0a ||
2421
- c === 0x2e0b ||
2422
- c === 0x2e0c ||
2423
- c === 0x2e0d ||
2424
- (c >= 0x2e0e && c <= 0x2e16) ||
2425
- c === 0x2e17 ||
2426
- (c >= 0x2e18 && c <= 0x2e19) ||
2427
- c === 0x2e1a ||
2428
- c === 0x2e1b ||
2429
- c === 0x2e1c ||
2430
- c === 0x2e1d ||
2431
- (c >= 0x2e1e && c <= 0x2e1f) ||
2432
- c === 0x2e20 ||
2433
- c === 0x2e21 ||
2434
- c === 0x2e22 ||
2435
- c === 0x2e23 ||
2436
- c === 0x2e24 ||
2437
- c === 0x2e25 ||
2438
- c === 0x2e26 ||
2439
- c === 0x2e27 ||
2440
- c === 0x2e28 ||
2441
- c === 0x2e29 ||
2442
- (c >= 0x2e2a && c <= 0x2e2e) ||
2443
- c === 0x2e2f ||
2444
- (c >= 0x2e30 && c <= 0x2e39) ||
2445
- (c >= 0x2e3a && c <= 0x2e3b) ||
2446
- (c >= 0x2e3c && c <= 0x2e3f) ||
2447
- c === 0x2e40 ||
2448
- c === 0x2e41 ||
2449
- c === 0x2e42 ||
2450
- (c >= 0x2e43 && c <= 0x2e4f) ||
2451
- (c >= 0x2e50 && c <= 0x2e51) ||
2452
- c === 0x2e52 ||
2453
- (c >= 0x2e53 && c <= 0x2e7f) ||
2454
- (c >= 0x3001 && c <= 0x3003) ||
2455
- c === 0x3008 ||
2456
- c === 0x3009 ||
2457
- c === 0x300a ||
2458
- c === 0x300b ||
2459
- c === 0x300c ||
2460
- c === 0x300d ||
2461
- c === 0x300e ||
2462
- c === 0x300f ||
2463
- c === 0x3010 ||
2464
- c === 0x3011 ||
2465
- (c >= 0x3012 && c <= 0x3013) ||
2466
- c === 0x3014 ||
2467
- c === 0x3015 ||
2468
- c === 0x3016 ||
2469
- c === 0x3017 ||
2470
- c === 0x3018 ||
2471
- c === 0x3019 ||
2472
- c === 0x301a ||
2473
- c === 0x301b ||
2474
- c === 0x301c ||
2475
- c === 0x301d ||
2476
- (c >= 0x301e && c <= 0x301f) ||
2477
- c === 0x3020 ||
2478
- c === 0x3030 ||
2479
- c === 0xfd3e ||
2480
- c === 0xfd3f ||
2481
- (c >= 0xfe45 && c <= 0xfe46));
2482
- }
2483
-
2484
- function pruneLocation(els) {
2485
- els.forEach(function (el) {
2486
- delete el.location;
2487
- if (isSelectElement(el) || isPluralElement(el)) {
2488
- for (var k in el.options) {
2489
- delete el.options[k].location;
2490
- pruneLocation(el.options[k].value);
2491
- }
2492
- }
2493
- else if (isNumberElement(el) && isNumberSkeleton(el.style)) {
2494
- delete el.style.location;
2495
- }
2496
- else if ((isDateElement(el) || isTimeElement(el)) &&
2497
- isDateTimeSkeleton(el.style)) {
2498
- delete el.style.location;
2499
- }
2500
- else if (isTagElement(el)) {
2501
- pruneLocation(el.children);
2502
- }
2503
- });
2504
- }
2505
- function parse(message, opts) {
2506
- if (opts === void 0) { opts = {}; }
2507
- opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
2508
- var result = new Parser(message, opts).parse();
2509
- if (result.err) {
2510
- var error = SyntaxError(ErrorKind[result.err.kind]);
2511
- // @ts-expect-error Assign to error object
2512
- error.location = result.err.location;
2513
- // @ts-expect-error Assign to error object
2514
- error.originalMessage = result.err.message;
2515
- throw error;
2516
- }
2517
- if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
2518
- pruneLocation(result.val);
2519
- }
2520
- return result.val;
2521
- }
2522
-
2523
- //
2524
- // Main
2525
- //
2526
- function memoize(fn, options) {
2527
- var cache = options && options.cache ? options.cache : cacheDefault;
2528
- var serializer = options && options.serializer ? options.serializer : serializerDefault;
2529
- var strategy = options && options.strategy ? options.strategy : strategyDefault;
2530
- return strategy(fn, {
2531
- cache: cache,
2532
- serializer: serializer,
2533
- });
2534
- }
2535
- //
2536
- // Strategy
2537
- //
2538
- function isPrimitive(value) {
2539
- return (value == null || typeof value === 'number' || typeof value === 'boolean'); // || typeof value === "string" 'unsafe' primitive for our needs
2540
- }
2541
- function monadic(fn, cache, serializer, arg) {
2542
- var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
2543
- var computedValue = cache.get(cacheKey);
2544
- if (typeof computedValue === 'undefined') {
2545
- computedValue = fn.call(this, arg);
2546
- cache.set(cacheKey, computedValue);
2547
- }
2548
- return computedValue;
2549
- }
2550
- function variadic(fn, cache, serializer) {
2551
- var args = Array.prototype.slice.call(arguments, 3);
2552
- var cacheKey = serializer(args);
2553
- var computedValue = cache.get(cacheKey);
2554
- if (typeof computedValue === 'undefined') {
2555
- computedValue = fn.apply(this, args);
2556
- cache.set(cacheKey, computedValue);
2557
- }
2558
- return computedValue;
2559
- }
2560
- function assemble(fn, context, strategy, cache, serialize) {
2561
- return strategy.bind(context, fn, cache, serialize);
2562
- }
2563
- function strategyDefault(fn, options) {
2564
- var strategy = fn.length === 1 ? monadic : variadic;
2565
- return assemble(fn, this, strategy, options.cache.create(), options.serializer);
2566
- }
2567
- function strategyVariadic(fn, options) {
2568
- return assemble(fn, this, variadic, options.cache.create(), options.serializer);
2569
- }
2570
- function strategyMonadic(fn, options) {
2571
- return assemble(fn, this, monadic, options.cache.create(), options.serializer);
2572
- }
2573
- //
2574
- // Serializer
2575
- //
2576
- var serializerDefault = function () {
2577
- return JSON.stringify(arguments);
2578
- };
2579
- //
2580
- // Cache
2581
- //
2582
- function ObjectWithoutPrototypeCache() {
2583
- this.cache = Object.create(null);
2584
- }
2585
- ObjectWithoutPrototypeCache.prototype.has = function (key) {
2586
- return key in this.cache;
2587
- };
2588
- ObjectWithoutPrototypeCache.prototype.get = function (key) {
2589
- return this.cache[key];
2590
- };
2591
- ObjectWithoutPrototypeCache.prototype.set = function (key, value) {
2592
- this.cache[key] = value;
2593
- };
2594
- var cacheDefault = {
2595
- create: function create() {
2596
- // @ts-ignore
2597
- return new ObjectWithoutPrototypeCache();
2598
- },
2599
- };
2600
- var strategies = {
2601
- variadic: strategyVariadic,
2602
- monadic: strategyMonadic,
2603
- };
2604
-
2605
- var ErrorCode;
2606
- (function (ErrorCode) {
2607
- // When we have a placeholder but no value to format
2608
- ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
2609
- // When value supplied is invalid
2610
- ErrorCode["INVALID_VALUE"] = "INVALID_VALUE";
2611
- // When we need specific Intl API but it's not available
2612
- ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API";
2613
- })(ErrorCode || (ErrorCode = {}));
2614
- var FormatError = /** @class */ (function (_super) {
2615
- __extends(FormatError, _super);
2616
- function FormatError(msg, code, originalMessage) {
2617
- var _this = _super.call(this, msg) || this;
2618
- _this.code = code;
2619
- _this.originalMessage = originalMessage;
2620
- return _this;
2621
- }
2622
- FormatError.prototype.toString = function () {
2623
- return "[formatjs Error: " + this.code + "] " + this.message;
2624
- };
2625
- return FormatError;
2626
- }(Error));
2627
- var InvalidValueError = /** @class */ (function (_super) {
2628
- __extends(InvalidValueError, _super);
2629
- function InvalidValueError(variableId, value, options, originalMessage) {
2630
- return _super.call(this, "Invalid values for \"" + variableId + "\": \"" + value + "\". Options are \"" + Object.keys(options).join('", "') + "\"", ErrorCode.INVALID_VALUE, originalMessage) || this;
2631
- }
2632
- return InvalidValueError;
2633
- }(FormatError));
2634
- var InvalidValueTypeError = /** @class */ (function (_super) {
2635
- __extends(InvalidValueTypeError, _super);
2636
- function InvalidValueTypeError(value, type, originalMessage) {
2637
- return _super.call(this, "Value for \"" + value + "\" must be of type " + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
2638
- }
2639
- return InvalidValueTypeError;
2640
- }(FormatError));
2641
- var MissingValueError = /** @class */ (function (_super) {
2642
- __extends(MissingValueError, _super);
2643
- function MissingValueError(variableId, originalMessage) {
2644
- return _super.call(this, "The intl string context variable \"" + variableId + "\" was not provided to the string \"" + originalMessage + "\"", ErrorCode.MISSING_VALUE, originalMessage) || this;
2645
- }
2646
- return MissingValueError;
2647
- }(FormatError));
2648
-
2649
- var PART_TYPE;
2650
- (function (PART_TYPE) {
2651
- PART_TYPE[PART_TYPE["literal"] = 0] = "literal";
2652
- PART_TYPE[PART_TYPE["object"] = 1] = "object";
2653
- })(PART_TYPE || (PART_TYPE = {}));
2654
- function mergeLiteral(parts) {
2655
- if (parts.length < 2) {
2656
- return parts;
2657
- }
2658
- return parts.reduce(function (all, part) {
2659
- var lastPart = all[all.length - 1];
2660
- if (!lastPart ||
2661
- lastPart.type !== PART_TYPE.literal ||
2662
- part.type !== PART_TYPE.literal) {
2663
- all.push(part);
2664
- }
2665
- else {
2666
- lastPart.value += part.value;
2667
- }
2668
- return all;
2669
- }, []);
2670
- }
2671
- function isFormatXMLElementFn(el) {
2672
- return typeof el === 'function';
2673
- }
2674
- // TODO(skeleton): add skeleton support
2675
- function formatToParts(els, locales, formatters, formats, values, currentPluralValue,
2676
- // For debugging
2677
- originalMessage) {
2678
- // Hot path for straight simple msg translations
2679
- if (els.length === 1 && isLiteralElement(els[0])) {
2680
- return [
2681
- {
2682
- type: PART_TYPE.literal,
2683
- value: els[0].value,
2684
- },
2685
- ];
2686
- }
2687
- var result = [];
2688
- for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {
2689
- var el = els_1[_i];
2690
- // Exit early for string parts.
2691
- if (isLiteralElement(el)) {
2692
- result.push({
2693
- type: PART_TYPE.literal,
2694
- value: el.value,
2695
- });
2696
- continue;
2697
- }
2698
- // TODO: should this part be literal type?
2699
- // Replace `#` in plural rules with the actual numeric value.
2700
- if (isPoundElement(el)) {
2701
- if (typeof currentPluralValue === 'number') {
2702
- result.push({
2703
- type: PART_TYPE.literal,
2704
- value: formatters.getNumberFormat(locales).format(currentPluralValue),
2705
- });
2706
- }
2707
- continue;
2708
- }
2709
- var varName = el.value;
2710
- // Enforce that all required values are provided by the caller.
2711
- if (!(values && varName in values)) {
2712
- throw new MissingValueError(varName, originalMessage);
2713
- }
2714
- var value = values[varName];
2715
- if (isArgumentElement(el)) {
2716
- if (!value || typeof value === 'string' || typeof value === 'number') {
2717
- value =
2718
- typeof value === 'string' || typeof value === 'number'
2719
- ? String(value)
2720
- : '';
2721
- }
2722
- result.push({
2723
- type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object,
2724
- value: value,
2725
- });
2726
- continue;
2727
- }
2728
- // Recursively format plural and select parts' option — which can be a
2729
- // nested pattern structure. The choosing of the option to use is
2730
- // abstracted-by and delegated-to the part helper object.
2731
- if (isDateElement(el)) {
2732
- var style = typeof el.style === 'string'
2733
- ? formats.date[el.style]
2734
- : isDateTimeSkeleton(el.style)
2735
- ? el.style.parsedOptions
2736
- : undefined;
2737
- result.push({
2738
- type: PART_TYPE.literal,
2739
- value: formatters
2740
- .getDateTimeFormat(locales, style)
2741
- .format(value),
2742
- });
2743
- continue;
2744
- }
2745
- if (isTimeElement(el)) {
2746
- var style = typeof el.style === 'string'
2747
- ? formats.time[el.style]
2748
- : isDateTimeSkeleton(el.style)
2749
- ? el.style.parsedOptions
2750
- : undefined;
2751
- result.push({
2752
- type: PART_TYPE.literal,
2753
- value: formatters
2754
- .getDateTimeFormat(locales, style)
2755
- .format(value),
2756
- });
2757
- continue;
2758
- }
2759
- if (isNumberElement(el)) {
2760
- var style = typeof el.style === 'string'
2761
- ? formats.number[el.style]
2762
- : isNumberSkeleton(el.style)
2763
- ? el.style.parsedOptions
2764
- : undefined;
2765
- if (style && style.scale) {
2766
- value =
2767
- value *
2768
- (style.scale || 1);
2769
- }
2770
- result.push({
2771
- type: PART_TYPE.literal,
2772
- value: formatters
2773
- .getNumberFormat(locales, style)
2774
- .format(value),
2775
- });
2776
- continue;
2777
- }
2778
- if (isTagElement(el)) {
2779
- var children = el.children, value_1 = el.value;
2780
- var formatFn = values[value_1];
2781
- if (!isFormatXMLElementFn(formatFn)) {
2782
- throw new InvalidValueTypeError(value_1, 'function', originalMessage);
2783
- }
2784
- var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);
2785
- var chunks = formatFn(parts.map(function (p) { return p.value; }));
2786
- if (!Array.isArray(chunks)) {
2787
- chunks = [chunks];
2788
- }
2789
- result.push.apply(result, chunks.map(function (c) {
2790
- return {
2791
- type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object,
2792
- value: c,
2793
- };
2794
- }));
2795
- }
2796
- if (isSelectElement(el)) {
2797
- var opt = el.options[value] || el.options.other;
2798
- if (!opt) {
2799
- throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
2800
- }
2801
- result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));
2802
- continue;
2803
- }
2804
- if (isPluralElement(el)) {
2805
- var opt = el.options["=" + value];
2806
- if (!opt) {
2807
- if (!Intl.PluralRules) {
2808
- throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
2809
- }
2810
- var rule = formatters
2811
- .getPluralRules(locales, { type: el.pluralType })
2812
- .select(value - (el.offset || 0));
2813
- opt = el.options[rule] || el.options.other;
2814
- }
2815
- if (!opt) {
2816
- throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
2817
- }
2818
- result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));
2819
- continue;
2820
- }
2821
- }
2822
- return mergeLiteral(result);
2823
- }
2824
-
2825
- /*
2826
- Copyright (c) 2014, Yahoo! Inc. All rights reserved.
2827
- Copyrights licensed under the New BSD License.
2828
- See the accompanying LICENSE file for terms.
2829
- */
2830
- // -- MessageFormat --------------------------------------------------------
2831
- function mergeConfig(c1, c2) {
2832
- if (!c2) {
2833
- return c1;
2834
- }
2835
- return __assign(__assign(__assign({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) {
2836
- all[k] = __assign(__assign({}, c1[k]), (c2[k] || {}));
2837
- return all;
2838
- }, {}));
2839
- }
2840
- function mergeConfigs(defaultConfig, configs) {
2841
- if (!configs) {
2842
- return defaultConfig;
2843
- }
2844
- return Object.keys(defaultConfig).reduce(function (all, k) {
2845
- all[k] = mergeConfig(defaultConfig[k], configs[k]);
2846
- return all;
2847
- }, __assign({}, defaultConfig));
2848
- }
2849
- function createFastMemoizeCache(store) {
2850
- return {
2851
- create: function () {
2852
- return {
2853
- has: function (key) {
2854
- return key in store;
2855
- },
2856
- get: function (key) {
2857
- return store[key];
2858
- },
2859
- set: function (key, value) {
2860
- store[key] = value;
2861
- },
2862
- };
2863
- },
2864
- };
2865
- }
2866
- function createDefaultFormatters(cache) {
2867
- if (cache === void 0) { cache = {
2868
- number: {},
2869
- dateTime: {},
2870
- pluralRules: {},
2871
- }; }
2872
- return {
2873
- getNumberFormat: memoize(function () {
2874
- var _a;
2875
- var args = [];
2876
- for (var _i = 0; _i < arguments.length; _i++) {
2877
- args[_i] = arguments[_i];
2878
- }
2879
- return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
2880
- }, {
2881
- cache: createFastMemoizeCache(cache.number),
2882
- strategy: strategies.variadic,
2883
- }),
2884
- getDateTimeFormat: memoize(function () {
2885
- var _a;
2886
- var args = [];
2887
- for (var _i = 0; _i < arguments.length; _i++) {
2888
- args[_i] = arguments[_i];
2889
- }
2890
- return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
2891
- }, {
2892
- cache: createFastMemoizeCache(cache.dateTime),
2893
- strategy: strategies.variadic,
2894
- }),
2895
- getPluralRules: memoize(function () {
2896
- var _a;
2897
- var args = [];
2898
- for (var _i = 0; _i < arguments.length; _i++) {
2899
- args[_i] = arguments[_i];
2900
- }
2901
- return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
2902
- }, {
2903
- cache: createFastMemoizeCache(cache.pluralRules),
2904
- strategy: strategies.variadic,
2905
- }),
2906
- };
2907
- }
2908
- var IntlMessageFormat = /** @class */ (function () {
2909
- function IntlMessageFormat(message, locales, overrideFormats, opts) {
2910
- var _this = this;
2911
- if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
2912
- this.formatterCache = {
2913
- number: {},
2914
- dateTime: {},
2915
- pluralRules: {},
2916
- };
2917
- this.format = function (values) {
2918
- var parts = _this.formatToParts(values);
2919
- // Hot path for straight simple msg translations
2920
- if (parts.length === 1) {
2921
- return parts[0].value;
2922
- }
2923
- var result = parts.reduce(function (all, part) {
2924
- if (!all.length ||
2925
- part.type !== PART_TYPE.literal ||
2926
- typeof all[all.length - 1] !== 'string') {
2927
- all.push(part.value);
2928
- }
2929
- else {
2930
- all[all.length - 1] += part.value;
2931
- }
2932
- return all;
2933
- }, []);
2934
- if (result.length <= 1) {
2935
- return result[0] || '';
2936
- }
2937
- return result;
2938
- };
2939
- this.formatToParts = function (values) {
2940
- return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);
2941
- };
2942
- this.resolvedOptions = function () { return ({
2943
- locale: Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],
2944
- }); };
2945
- this.getAst = function () { return _this.ast; };
2946
- if (typeof message === 'string') {
2947
- this.message = message;
2948
- if (!IntlMessageFormat.__parse) {
2949
- throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');
2950
- }
2951
- // Parse string messages into an AST.
2952
- this.ast = IntlMessageFormat.__parse(message, {
2953
- ignoreTag: opts === null || opts === void 0 ? void 0 : opts.ignoreTag,
2954
- });
2955
- }
2956
- else {
2957
- this.ast = message;
2958
- }
2959
- if (!Array.isArray(this.ast)) {
2960
- throw new TypeError('A message must be provided as a String or AST.');
2961
- }
2962
- // Creates a new object with the specified `formats` merged with the default
2963
- // formats.
2964
- this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
2965
- // Defined first because it's used to build the format pattern.
2966
- this.locales = locales;
2967
- this.formatters =
2968
- (opts && opts.formatters) || createDefaultFormatters(this.formatterCache);
2969
- }
2970
- Object.defineProperty(IntlMessageFormat, "defaultLocale", {
2971
- get: function () {
2972
- if (!IntlMessageFormat.memoizedDefaultLocale) {
2973
- IntlMessageFormat.memoizedDefaultLocale =
2974
- new Intl.NumberFormat().resolvedOptions().locale;
2975
- }
2976
- return IntlMessageFormat.memoizedDefaultLocale;
2977
- },
2978
- enumerable: false,
2979
- configurable: true
2980
- });
2981
- IntlMessageFormat.memoizedDefaultLocale = null;
2982
- IntlMessageFormat.__parse = parse;
2983
- // Default format options used as the prototype of the `formats` provided to the
2984
- // constructor. These are used when constructing the internal Intl.NumberFormat
2985
- // and Intl.DateTimeFormat instances.
2986
- IntlMessageFormat.formats = {
2987
- number: {
2988
- integer: {
2989
- maximumFractionDigits: 0,
2990
- },
2991
- currency: {
2992
- style: 'currency',
2993
- },
2994
- percent: {
2995
- style: 'percent',
2996
- },
2997
- },
2998
- date: {
2999
- short: {
3000
- month: 'numeric',
3001
- day: 'numeric',
3002
- year: '2-digit',
3003
- },
3004
- medium: {
3005
- month: 'short',
3006
- day: 'numeric',
3007
- year: 'numeric',
3008
- },
3009
- long: {
3010
- month: 'long',
3011
- day: 'numeric',
3012
- year: 'numeric',
3013
- },
3014
- full: {
3015
- weekday: 'long',
3016
- month: 'long',
3017
- day: 'numeric',
3018
- year: 'numeric',
3019
- },
3020
- },
3021
- time: {
3022
- short: {
3023
- hour: 'numeric',
3024
- minute: 'numeric',
3025
- },
3026
- medium: {
3027
- hour: 'numeric',
3028
- minute: 'numeric',
3029
- second: 'numeric',
3030
- },
3031
- long: {
3032
- hour: 'numeric',
3033
- minute: 'numeric',
3034
- second: 'numeric',
3035
- timeZoneName: 'short',
3036
- },
3037
- full: {
3038
- hour: 'numeric',
3039
- minute: 'numeric',
3040
- second: 'numeric',
3041
- timeZoneName: 'short',
3042
- },
3043
- },
3044
- };
3045
- return IntlMessageFormat;
3046
- }());
3047
-
3048
- const r={},i=(e,n,t)=>t?(n in r||(r[n]={}),e in r[n]||(r[n][e]=t),t):t,a=(e,n)=>{if(null==n)return;if(n in r&&e in r[n])return r[n][e];const t=E(n);for(let o=0;o<t.length;o++){const r=c(t[o],e);if(r)return i(e,n,r)}};let l;const s=writable({});function u(e){return e in l}function c(e,n){if(!u(e))return null;return function(e,n){if(n in e)return e[n];const t=n.split(".");let o=e;for(let e=0;e<t.length;e++)if("object"==typeof o){if(e>0){const n=t.slice(e,t.length).join(".");if(n in o){o=o[n];break}}o=o[t[e]];}else o=void 0;return o}(function(e){return l[e]||null}(e),n)}function m(e,...n){delete r[e],s.update((o=>(o[e]=cjs.all([o[e]||{},...n]),o)));}derived([s],(([e])=>Object.keys(e)));s.subscribe((e=>l=e));const d={};function g(e){return d[e]}function w(e){return E(e).some((e=>{var n;return null===(n=g(e))||void 0===n?void 0:n.size}))}function h(e,n){return Promise.all(n.map((n=>(function(e,n){d[e].delete(n),0===d[e].size&&delete d[e];}(e,n),n().then((e=>e.default||e)))))).then((n=>m(e,...n)))}const p={};function b(e){if(!w(e))return e in p?p[e]:void 0;const n=function(e){return E(e).map((e=>{const n=g(e);return [e,n?[...n]:[]]})).filter((([,e])=>e.length>0))}(e);return p[e]=Promise.all(n.map((([e,n])=>h(e,n)))).then((()=>{if(w(e))return b(e);delete p[e];})),p[e]}/*! *****************************************************************************
3049
- Copyright (c) Microsoft Corporation.
3050
-
3051
- Permission to use, copy, modify, and/or distribute this software for any
3052
- purpose with or without fee is hereby granted.
3053
-
3054
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3055
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3056
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3057
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3058
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3059
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3060
- PERFORMANCE OF THIS SOFTWARE.
3061
- ***************************************************************************** */function v(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]]);}return t}const O={fallbackLocale:null,initialLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,ignoreTag:!0};function j(){return O}const k=writable(!1);let L;const T=writable(null);function x(e){return e.split("-").map(((e,n,t)=>t.slice(0,n+1).join("-"))).reverse()}function E(e,n=j().fallbackLocale){const t=x(e);return n?[...new Set([...t,...x(n)])]:t}function D(){return L}T.subscribe((e=>{L=e,"undefined"!=typeof window&&null!==e&&document.documentElement.setAttribute("lang",e);}));const M=T.set;T.set=e=>{if(function(e){if(null==e)return;const n=E(e);for(let e=0;e<n.length;e++){const t=n[e];if(u(t))return t}}(e)&&w(e)){const{loadingDelay:n}=j();let t;return "undefined"!=typeof window&&null!=D()&&n?t=window.setTimeout((()=>k.set(!0)),n):k.set(!0),b(e).then((()=>{M(e);})).finally((()=>{clearTimeout(t),k.set(!1);}))}return M(e)},T.update=e=>M(e(L));const Z=e=>{const n=Object.create(null);return t=>{const o=JSON.stringify(t);return o in n?n[o]:n[o]=e(t)}},C=(e,n)=>{const{formats:t}=j();if(e in t&&n in t[e])return t[e][n];throw new Error(`[svelte-i18n] Unknown "${n}" ${e} format.`)},G=Z((e=>{var{locale:n,format:t}=e,o=v(e,["locale","format"]);if(null==n)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return t&&(o=C("number",t)),new Intl.NumberFormat(n,o)})),J=Z((e=>{var{locale:n,format:t}=e,o=v(e,["locale","format"]);if(null==n)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return t?o=C("date",t):0===Object.keys(o).length&&(o=C("date","short")),new Intl.DateTimeFormat(n,o)})),U=Z((e=>{var{locale:n,format:t}=e,o=v(e,["locale","format"]);if(null==n)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return t?o=C("time",t):0===Object.keys(o).length&&(o=C("time","short")),new Intl.DateTimeFormat(n,o)})),_=(e={})=>{var{locale:n=D()}=e,t=v(e,["locale"]);return G(Object.assign({locale:n},t))},q=(e={})=>{var{locale:n=D()}=e,t=v(e,["locale"]);return J(Object.assign({locale:n},t))},B=(e={})=>{var{locale:n=D()}=e,t=v(e,["locale"]);return U(Object.assign({locale:n},t))},H=Z(((e,n=D())=>new IntlMessageFormat(e,n,j().formats,{ignoreTag:j().ignoreTag}))),K=(e,n={})=>{"object"==typeof e&&(e=(n=e).id);const{values:t,locale:o=D(),default:r}=n;if(null==o)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let i=a(e,o);if(i){if("string"!=typeof i)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof i}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),i}else j().warnOnMissingMessages&&console.warn(`[svelte-i18n] The message "${e}" was not found in "${E(o).join('", "')}".${w(D())?"\n\nNote: there are at least one loader still registered to this locale that wasn't executed.":""}`),i=r||e;if(!t)return i;let l=i;try{l=H(i,o).format(t);}catch(n){console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,n.message);}return l},Q=(e,n)=>B(n).format(e),R=(e,n)=>q(n).format(e),V=(e,n)=>_(n).format(e),W=(e,n=D())=>a(e,n),X=derived([T,s],(()=>K));derived([T],(()=>Q));derived([T],(()=>R));derived([T],(()=>V));derived([T,s],(()=>W));
3062
-
3063
- function addNewMessages(lang, dict) {
3064
- m(lang, dict);
3065
- }
3066
-
3067
- const TournamentsThumbnailTranslations = {
3068
- en: {
3069
- tournamentsThumbnail: {
3070
- enrolled: 'Enrolled',
3071
- scoreCriteria: 'Score Criteria',
3072
- minbet: 'min bet counts: ',
3073
- seegames: 'You can see the games',
3074
- here: 'here',
3075
- scheduled: 'Scheduled',
3076
- ongoing: 'OnGoing',
3077
- finished: 'Finished',
3078
- startingAt: 'Starting at',
3079
- mostRounds: 'MostRounds',
3080
- }
3081
- },
3082
- tr: {
3083
- tournamentsThumbnail: {
3084
- enrolled: 'Katıldın',
3085
- scoreCriteria: 'Skor kriteri',
3086
- minbet: 'en düşük bahis sayısı',
3087
- seegames: 'Turnuvadaki oyunları görmek için',
3088
- here: 'tıklayın',
3089
- scheduled: 'Planlanmış',
3090
- ongoing: 'Devam Eden',
3091
- finished: 'Sona Ermiş',
3092
- startingAt: 'BAŞLAMA SAATİ:',
3093
- mostRounds: 'MostRounds',
3094
- }
3095
- },
3096
- el: {
3097
- tournamentsThumbnail: {
3098
- enrolled: 'Εγγεγραμμένος',
3099
- scoreCriteria: 'Κριτήρια Σκορ',
3100
- minbet: 'Ελάχιστος αριθμός πονταρισμάτων: ',
3101
- seegames: 'Μπορείε να δεις τα παιχνίδια',
3102
- here: 'εδώ',
3103
- all: 'OΛΑ',
3104
- scheduled: 'ΠΡΟΓΡΑΜΜΑΤΙΣΜΕΝΑ',
3105
- ongoing: 'ΤΡΕΧΟΝΤΑ',
3106
- finished: 'ΟΛΟΚΛΗΡΩΜΕΝΑ',
3107
- startingAt: 'ΑΡΧΙΖΕΙ',
3108
- mostRounds: 'MostRounds',
3109
- }
3110
- },
3111
- };
3112
-
3113
- /* src/CasinoTournamentsThumbnail.svelte generated by Svelte v3.37.0 */
3114
-
3115
- const { Object: Object_1 } = globals;
3116
- const file = "src/CasinoTournamentsThumbnail.svelte";
3117
-
3118
- // (75:2) {#if status}
3119
- function create_if_block_6(ctx) {
3120
- let div;
3121
- let t;
3122
- let mounted;
3123
- let dispose;
3124
-
3125
- const block = {
3126
- c: function create() {
3127
- div = element("div");
3128
- t = text(/*shownStatus*/ ctx[12]);
3129
- attr_dev(div, "class", "Status");
3130
- add_location(div, file, 75, 4, 2365);
3131
- },
3132
- m: function mount(target, anchor) {
3133
- insert_dev(target, div, anchor);
3134
- append_dev(div, t);
3135
-
3136
- if (!mounted) {
3137
- dispose = action_destroyer(/*matchStatus*/ ctx[15].call(null, div));
3138
- mounted = true;
3139
- }
3140
- },
3141
- p: function update(ctx, dirty) {
3142
- if (dirty & /*shownStatus*/ 4096) set_data_dev(t, /*shownStatus*/ ctx[12]);
3143
- },
3144
- d: function destroy(detaching) {
3145
- if (detaching) detach_dev(div);
3146
- mounted = false;
3147
- dispose();
3148
- }
3149
- };
3150
-
3151
- dispatch_dev("SvelteRegisterBlock", {
3152
- block,
3153
- id: create_if_block_6.name,
3154
- type: "if",
3155
- source: "(75:2) {#if status}",
3156
- ctx
3157
- });
3158
-
3159
- return block;
3160
- }
3161
-
3162
- // (79:2) {#if showenrolled == 'true'}
3163
- function create_if_block_4(ctx) {
3164
- let if_block_anchor;
3165
- let if_block = /*userenrolled*/ ctx[5] && create_if_block_5(ctx);
3166
-
3167
- const block = {
3168
- c: function create() {
3169
- if (if_block) if_block.c();
3170
- if_block_anchor = empty();
3171
- },
3172
- m: function mount(target, anchor) {
3173
- if (if_block) if_block.m(target, anchor);
3174
- insert_dev(target, if_block_anchor, anchor);
3175
- },
3176
- p: function update(ctx, dirty) {
3177
- if (/*userenrolled*/ ctx[5]) {
3178
- if (if_block) {
3179
- if_block.p(ctx, dirty);
3180
- } else {
3181
- if_block = create_if_block_5(ctx);
3182
- if_block.c();
3183
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
3184
- }
3185
- } else if (if_block) {
3186
- if_block.d(1);
3187
- if_block = null;
3188
- }
3189
- },
3190
- d: function destroy(detaching) {
3191
- if (if_block) if_block.d(detaching);
3192
- if (detaching) detach_dev(if_block_anchor);
3193
- }
3194
- };
3195
-
3196
- dispatch_dev("SvelteRegisterBlock", {
3197
- block,
3198
- id: create_if_block_4.name,
3199
- type: "if",
3200
- source: "(79:2) {#if showenrolled == 'true'}",
3201
- ctx
3202
- });
3203
-
3204
- return block;
3205
- }
3206
-
3207
- // (80:4) {#if userenrolled}
3208
- function create_if_block_5(ctx) {
3209
- let div;
3210
- let t_value = /*$_*/ ctx[13]("tournamentsThumbnail.enrolled") + "";
3211
- let t;
3212
-
3213
- const block = {
3214
- c: function create() {
3215
- div = element("div");
3216
- t = text(t_value);
3217
- attr_dev(div, "class", "Enrolled");
3218
- add_location(div, file, 80, 6, 2490);
3219
- },
3220
- m: function mount(target, anchor) {
3221
- insert_dev(target, div, anchor);
3222
- append_dev(div, t);
3223
- },
3224
- p: function update(ctx, dirty) {
3225
- if (dirty & /*$_*/ 8192 && t_value !== (t_value = /*$_*/ ctx[13]("tournamentsThumbnail.enrolled") + "")) set_data_dev(t, t_value);
3226
- },
3227
- d: function destroy(detaching) {
3228
- if (detaching) detach_dev(div);
3229
- }
3230
- };
3231
-
3232
- dispatch_dev("SvelteRegisterBlock", {
3233
- block,
3234
- id: create_if_block_5.name,
3235
- type: "if",
3236
- source: "(80:4) {#if userenrolled}",
3237
- ctx
3238
- });
3239
-
3240
- return block;
3241
- }
3242
-
3243
- // (86:2) {:else}
3244
- function create_else_block_1(ctx) {
3245
- let div;
3246
- let div_class_value;
3247
- let mounted;
3248
- let dispose;
3249
-
3250
- const block = {
3251
- c: function create() {
3252
- div = element("div");
3253
-
3254
- attr_dev(div, "class", div_class_value = "CardImg " + (/*status*/ ctx[2] == "Closing" || /*status*/ ctx[2] == "Closed"
3255
- ? "CardImgFinished"
3256
- : ""));
3257
-
3258
- set_style(div, "background", "url('https://i.stack.imgur.com/y9DpT.jpg') center no-repeat");
3259
- add_location(div, file, 86, 4, 2764);
3260
- },
3261
- m: function mount(target, anchor) {
3262
- insert_dev(target, div, anchor);
3263
-
3264
- if (!mounted) {
3265
- dispose = action_destroyer(/*matchStatus*/ ctx[15].call(null, div));
3266
- mounted = true;
3267
- }
3268
- },
3269
- p: function update(ctx, dirty) {
3270
- if (dirty & /*status*/ 4 && div_class_value !== (div_class_value = "CardImg " + (/*status*/ ctx[2] == "Closing" || /*status*/ ctx[2] == "Closed"
3271
- ? "CardImgFinished"
3272
- : ""))) {
3273
- attr_dev(div, "class", div_class_value);
3274
- }
3275
- },
3276
- d: function destroy(detaching) {
3277
- if (detaching) detach_dev(div);
3278
- mounted = false;
3279
- dispose();
3280
- }
3281
- };
3282
-
3283
- dispatch_dev("SvelteRegisterBlock", {
3284
- block,
3285
- id: create_else_block_1.name,
3286
- type: "else",
3287
- source: "(86:2) {:else}",
3288
- ctx
3289
- });
3290
-
3291
- return block;
3292
- }
3293
-
3294
- // (84:2) {#if thumbnail}
3295
- function create_if_block_3(ctx) {
3296
- let div;
3297
- let div_class_value;
3298
- let mounted;
3299
- let dispose;
3300
-
3301
- const block = {
3302
- c: function create() {
3303
- div = element("div");
3304
-
3305
- attr_dev(div, "class", div_class_value = "CardImg " + (/*status*/ ctx[2] == "Closing" || /*status*/ ctx[2] == "Closed"
3306
- ? "CardImgFinished"
3307
- : ""));
3308
-
3309
- set_style(div, "background", "url('" + /*thumbnail*/ ctx[4] + "')");
3310
- add_location(div, file, 84, 4, 2596);
3311
- },
3312
- m: function mount(target, anchor) {
3313
- insert_dev(target, div, anchor);
3314
-
3315
- if (!mounted) {
3316
- dispose = action_destroyer(/*matchStatus*/ ctx[15].call(null, div));
3317
- mounted = true;
3318
- }
3319
- },
3320
- p: function update(ctx, dirty) {
3321
- if (dirty & /*status*/ 4 && div_class_value !== (div_class_value = "CardImg " + (/*status*/ ctx[2] == "Closing" || /*status*/ ctx[2] == "Closed"
3322
- ? "CardImgFinished"
3323
- : ""))) {
3324
- attr_dev(div, "class", div_class_value);
3325
- }
3326
-
3327
- if (dirty & /*thumbnail*/ 16) {
3328
- set_style(div, "background", "url('" + /*thumbnail*/ ctx[4] + "')");
3329
- }
3330
- },
3331
- d: function destroy(detaching) {
3332
- if (detaching) detach_dev(div);
3333
- mounted = false;
3334
- dispose();
3335
- }
3336
- };
3337
-
3338
- dispatch_dev("SvelteRegisterBlock", {
3339
- block,
3340
- id: create_if_block_3.name,
3341
- type: "if",
3342
- source: "(84:2) {#if thumbnail}",
3343
- ctx
3344
- });
3345
-
3346
- return block;
3347
- }
3348
-
3349
- // (92:4) {#if startdate}
3350
- function create_if_block_2(ctx) {
3351
- let div;
3352
- let t;
3353
- let formatDate_action;
3354
- let mounted;
3355
- let dispose;
3356
-
3357
- const block = {
3358
- c: function create() {
3359
- div = element("div");
3360
- t = text(/*shownDate*/ ctx[10]);
3361
- attr_dev(div, "class", "Date");
3362
- add_location(div, file, 92, 6, 3055);
3363
- },
3364
- m: function mount(target, anchor) {
3365
- insert_dev(target, div, anchor);
3366
- append_dev(div, t);
3367
-
3368
- if (!mounted) {
3369
- dispose = action_destroyer(formatDate_action = /*formatDate*/ ctx[14].call(null, div, /*startdate*/ ctx[1]));
3370
- mounted = true;
3371
- }
3372
- },
3373
- p: function update(ctx, dirty) {
3374
- if (dirty & /*shownDate*/ 1024) set_data_dev(t, /*shownDate*/ ctx[10]);
3375
- if (formatDate_action && is_function(formatDate_action.update) && dirty & /*startdate*/ 2) formatDate_action.update.call(null, /*startdate*/ ctx[1]);
3376
- },
3377
- d: function destroy(detaching) {
3378
- if (detaching) detach_dev(div);
3379
- mounted = false;
3380
- dispose();
3381
- }
3382
- };
3383
-
3384
- dispatch_dev("SvelteRegisterBlock", {
3385
- block,
3386
- id: create_if_block_2.name,
3387
- type: "if",
3388
- source: "(92:4) {#if startdate}",
3389
- ctx
3390
- });
3391
-
3392
- return block;
3393
- }
3394
-
3395
- // (96:4) {#if isLoggedIn}
3396
- function create_if_block(ctx) {
3397
- let div0;
3398
- let p0;
3399
- let t0_value = /*$_*/ ctx[13]("tournamentsThumbnail.scoreCriteria") + "";
3400
- let t0;
3401
- let t1;
3402
- let t2;
3403
- let div1;
3404
- let p1;
3405
- let t3_value = /*$_*/ ctx[13]("tournamentsThumbnail.seegames") + "";
3406
- let t3;
3407
- let t4;
3408
- let a;
3409
- let t5_value = /*$_*/ ctx[13]("tournamentsThumbnail.here") + "";
3410
- let t5;
3411
- let mounted;
3412
- let dispose;
3413
-
3414
- function select_block_type_1(ctx, dirty) {
3415
- if (/*scorecriteria*/ ctx[6] == "BetCount") return create_if_block_1;
3416
- return create_else_block;
3417
- }
3418
-
3419
- let current_block_type = select_block_type_1(ctx);
3420
- let if_block = current_block_type(ctx);
3421
-
3422
- const block = {
3423
- c: function create() {
3424
- div0 = element("div");
3425
- p0 = element("p");
3426
- t0 = text(t0_value);
3427
- t1 = text(":\n ");
3428
- if_block.c();
3429
- t2 = space();
3430
- div1 = element("div");
3431
- p1 = element("p");
3432
- t3 = text(t3_value);
3433
- t4 = space();
3434
- a = element("a");
3435
- t5 = text(t5_value);
3436
- add_location(p0, file, 97, 8, 3192);
3437
- attr_dev(div0, "class", "ScoreCriteria");
3438
- add_location(div0, file, 96, 6, 3156);
3439
- attr_dev(a, "href", /*gameurl*/ ctx[9]);
3440
- attr_dev(a, "target", "_blank");
3441
- add_location(a, file, 109, 49, 3575);
3442
- add_location(p1, file, 109, 8, 3534);
3443
- attr_dev(div1, "class", "Games");
3444
- add_location(div1, file, 108, 6, 3506);
3445
- },
3446
- m: function mount(target, anchor) {
3447
- insert_dev(target, div0, anchor);
3448
- append_dev(div0, p0);
3449
- append_dev(p0, t0);
3450
- append_dev(p0, t1);
3451
- if_block.m(p0, null);
3452
- insert_dev(target, t2, anchor);
3453
- insert_dev(target, div1, anchor);
3454
- append_dev(div1, p1);
3455
- append_dev(p1, t3);
3456
- append_dev(p1, t4);
3457
- append_dev(p1, a);
3458
- append_dev(a, t5);
3459
-
3460
- if (!mounted) {
3461
- dispose = listen_dev(a, "click", /*click_handler*/ ctx[20], false, false, false);
3462
- mounted = true;
3463
- }
3464
- },
3465
- p: function update(ctx, dirty) {
3466
- if (dirty & /*$_*/ 8192 && t0_value !== (t0_value = /*$_*/ ctx[13]("tournamentsThumbnail.scoreCriteria") + "")) set_data_dev(t0, t0_value);
3467
-
3468
- if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block) {
3469
- if_block.p(ctx, dirty);
3470
- } else {
3471
- if_block.d(1);
3472
- if_block = current_block_type(ctx);
3473
-
3474
- if (if_block) {
3475
- if_block.c();
3476
- if_block.m(p0, null);
3477
- }
3478
- }
3479
-
3480
- if (dirty & /*$_*/ 8192 && t3_value !== (t3_value = /*$_*/ ctx[13]("tournamentsThumbnail.seegames") + "")) set_data_dev(t3, t3_value);
3481
- if (dirty & /*$_*/ 8192 && t5_value !== (t5_value = /*$_*/ ctx[13]("tournamentsThumbnail.here") + "")) set_data_dev(t5, t5_value);
3482
-
3483
- if (dirty & /*gameurl*/ 512) {
3484
- attr_dev(a, "href", /*gameurl*/ ctx[9]);
3485
- }
3486
- },
3487
- d: function destroy(detaching) {
3488
- if (detaching) detach_dev(div0);
3489
- if_block.d();
3490
- if (detaching) detach_dev(t2);
3491
- if (detaching) detach_dev(div1);
3492
- mounted = false;
3493
- dispose();
3494
- }
3495
- };
3496
-
3497
- dispatch_dev("SvelteRegisterBlock", {
3498
- block,
3499
- id: create_if_block.name,
3500
- type: "if",
3501
- source: "(96:4) {#if isLoggedIn}",
3502
- ctx
3503
- });
3504
-
3505
- return block;
3506
- }
3507
-
3508
- // (103:10) {:else}
3509
- function create_else_block(ctx) {
3510
- let t;
3511
-
3512
- const block = {
3513
- c: function create() {
3514
- t = text(/*scorecriteria*/ ctx[6]);
3515
- },
3516
- m: function mount(target, anchor) {
3517
- insert_dev(target, t, anchor);
3518
- },
3519
- p: function update(ctx, dirty) {
3520
- if (dirty & /*scorecriteria*/ 64) set_data_dev(t, /*scorecriteria*/ ctx[6]);
3521
- },
3522
- d: function destroy(detaching) {
3523
- if (detaching) detach_dev(t);
3524
- }
3525
- };
3526
-
3527
- dispatch_dev("SvelteRegisterBlock", {
3528
- block,
3529
- id: create_else_block.name,
3530
- type: "else",
3531
- source: "(103:10) {:else}",
3532
- ctx
3533
- });
3534
-
3535
- return block;
3536
- }
3537
-
3538
- // (100:10) {#if scorecriteria == 'BetCount'}
3539
- function create_if_block_1(ctx) {
3540
- let t0_value = /*$_*/ ctx[13]("tournamentsThumbnail.mostRounds") + "";
3541
- let t0;
3542
- let t1;
3543
- let t2_value = /*$_*/ ctx[13]("tournamentsThumbnail.minbet") + "";
3544
- let t2;
3545
- let t3;
3546
- let t4;
3547
- let t5;
3548
-
3549
- const block = {
3550
- c: function create() {
3551
- t0 = text(t0_value);
3552
- t1 = text("\n (");
3553
- t2 = text(t2_value);
3554
- t3 = text(": ");
3555
- t4 = text(/*minbetcount*/ ctx[7]);
3556
- t5 = text(")");
3557
- },
3558
- m: function mount(target, anchor) {
3559
- insert_dev(target, t0, anchor);
3560
- insert_dev(target, t1, anchor);
3561
- insert_dev(target, t2, anchor);
3562
- insert_dev(target, t3, anchor);
3563
- insert_dev(target, t4, anchor);
3564
- insert_dev(target, t5, anchor);
3565
- },
3566
- p: function update(ctx, dirty) {
3567
- if (dirty & /*$_*/ 8192 && t0_value !== (t0_value = /*$_*/ ctx[13]("tournamentsThumbnail.mostRounds") + "")) set_data_dev(t0, t0_value);
3568
- if (dirty & /*$_*/ 8192 && t2_value !== (t2_value = /*$_*/ ctx[13]("tournamentsThumbnail.minbet") + "")) set_data_dev(t2, t2_value);
3569
- if (dirty & /*minbetcount*/ 128) set_data_dev(t4, /*minbetcount*/ ctx[7]);
3570
- },
3571
- d: function destroy(detaching) {
3572
- if (detaching) detach_dev(t0);
3573
- if (detaching) detach_dev(t1);
3574
- if (detaching) detach_dev(t2);
3575
- if (detaching) detach_dev(t3);
3576
- if (detaching) detach_dev(t4);
3577
- if (detaching) detach_dev(t5);
3578
- }
3579
- };
3580
-
3581
- dispatch_dev("SvelteRegisterBlock", {
3582
- block,
3583
- id: create_if_block_1.name,
3584
- type: "if",
3585
- source: "(100:10) {#if scorecriteria == 'BetCount'}",
3586
- ctx
3587
- });
3588
-
3589
- return block;
3590
- }
3591
-
3592
- function create_fragment(ctx) {
3593
- let div2;
3594
- let t0;
3595
- let t1;
3596
- let t2;
3597
- let div1;
3598
- let div0;
3599
- let t3;
3600
- let t4;
3601
- let t5;
3602
- let if_block0 = /*status*/ ctx[2] && create_if_block_6(ctx);
3603
- let if_block1 = /*showenrolled*/ ctx[8] == "true" && create_if_block_4(ctx);
3604
-
3605
- function select_block_type(ctx, dirty) {
3606
- if (/*thumbnail*/ ctx[4]) return create_if_block_3;
3607
- return create_else_block_1;
3608
- }
3609
-
3610
- let current_block_type = select_block_type(ctx);
3611
- let if_block2 = current_block_type(ctx);
3612
- let if_block3 = /*startdate*/ ctx[1] && create_if_block_2(ctx);
3613
- let if_block4 = /*isLoggedIn*/ ctx[11] && create_if_block(ctx);
3614
-
3615
- const block = {
3616
- c: function create() {
3617
- div2 = element("div");
3618
- if (if_block0) if_block0.c();
3619
- t0 = space();
3620
- if (if_block1) if_block1.c();
3621
- t1 = space();
3622
- if_block2.c();
3623
- t2 = space();
3624
- div1 = element("div");
3625
- div0 = element("div");
3626
- t3 = text(/*title*/ ctx[0]);
3627
- t4 = space();
3628
- if (if_block3) if_block3.c();
3629
- t5 = space();
3630
- if (if_block4) if_block4.c();
3631
- this.c = noop;
3632
- attr_dev(div0, "class", "Title");
3633
- add_location(div0, file, 90, 4, 2996);
3634
- attr_dev(div1, "class", "Details");
3635
- add_location(div1, file, 89, 2, 2970);
3636
- attr_dev(div2, "class", "Thumbnail");
3637
- add_location(div2, file, 73, 0, 2322);
3638
- },
3639
- l: function claim(nodes) {
3640
- throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
3641
- },
3642
- m: function mount(target, anchor) {
3643
- insert_dev(target, div2, anchor);
3644
- if (if_block0) if_block0.m(div2, null);
3645
- append_dev(div2, t0);
3646
- if (if_block1) if_block1.m(div2, null);
3647
- append_dev(div2, t1);
3648
- if_block2.m(div2, null);
3649
- append_dev(div2, t2);
3650
- append_dev(div2, div1);
3651
- append_dev(div1, div0);
3652
- append_dev(div0, t3);
3653
- append_dev(div1, t4);
3654
- if (if_block3) if_block3.m(div1, null);
3655
- append_dev(div1, t5);
3656
- if (if_block4) if_block4.m(div1, null);
3657
- },
3658
- p: function update(ctx, [dirty]) {
3659
- if (/*status*/ ctx[2]) {
3660
- if (if_block0) {
3661
- if_block0.p(ctx, dirty);
3662
- } else {
3663
- if_block0 = create_if_block_6(ctx);
3664
- if_block0.c();
3665
- if_block0.m(div2, t0);
3666
- }
3667
- } else if (if_block0) {
3668
- if_block0.d(1);
3669
- if_block0 = null;
3670
- }
3671
-
3672
- if (/*showenrolled*/ ctx[8] == "true") {
3673
- if (if_block1) {
3674
- if_block1.p(ctx, dirty);
3675
- } else {
3676
- if_block1 = create_if_block_4(ctx);
3677
- if_block1.c();
3678
- if_block1.m(div2, t1);
3679
- }
3680
- } else if (if_block1) {
3681
- if_block1.d(1);
3682
- if_block1 = null;
3683
- }
3684
-
3685
- if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block2) {
3686
- if_block2.p(ctx, dirty);
3687
- } else {
3688
- if_block2.d(1);
3689
- if_block2 = current_block_type(ctx);
3690
-
3691
- if (if_block2) {
3692
- if_block2.c();
3693
- if_block2.m(div2, t2);
3694
- }
3695
- }
3696
-
3697
- if (dirty & /*title*/ 1) set_data_dev(t3, /*title*/ ctx[0]);
3698
-
3699
- if (/*startdate*/ ctx[1]) {
3700
- if (if_block3) {
3701
- if_block3.p(ctx, dirty);
3702
- } else {
3703
- if_block3 = create_if_block_2(ctx);
3704
- if_block3.c();
3705
- if_block3.m(div1, t5);
3706
- }
3707
- } else if (if_block3) {
3708
- if_block3.d(1);
3709
- if_block3 = null;
3710
- }
3711
-
3712
- if (/*isLoggedIn*/ ctx[11]) {
3713
- if (if_block4) {
3714
- if_block4.p(ctx, dirty);
3715
- } else {
3716
- if_block4 = create_if_block(ctx);
3717
- if_block4.c();
3718
- if_block4.m(div1, null);
3719
- }
3720
- } else if (if_block4) {
3721
- if_block4.d(1);
3722
- if_block4 = null;
3723
- }
3724
- },
3725
- i: noop,
3726
- o: noop,
3727
- d: function destroy(detaching) {
3728
- if (detaching) detach_dev(div2);
3729
- if (if_block0) if_block0.d();
3730
- if (if_block1) if_block1.d();
3731
- if_block2.d();
3732
- if (if_block3) if_block3.d();
3733
- if (if_block4) if_block4.d();
3734
- }
3735
- };
3736
-
3737
- dispatch_dev("SvelteRegisterBlock", {
3738
- block,
3739
- id: create_fragment.name,
3740
- type: "component",
3741
- source: "",
3742
- ctx
3743
- });
3744
-
3745
- return block;
3746
- }
3747
-
3748
- function instance($$self, $$props, $$invalidate) {
3749
- let $_;
3750
- validate_store(X, "_");
3751
- component_subscribe($$self, X, $$value => $$invalidate(13, $_ = $$value));
3752
- let { $$slots: slots = {}, $$scope } = $$props;
3753
- validate_slots("undefined", slots, []);
3754
- let { session = "" } = $$props;
3755
- let { userid = "" } = $$props;
3756
- let { title = "" } = $$props;
3757
- let { startdate = "" } = $$props;
3758
- let { status = "" } = $$props;
3759
- let { tourid = "" } = $$props;
3760
- let { thumbnail = "" } = $$props;
3761
- let { userenrolled = "" } = $$props;
3762
- let { scorecriteria = "" } = $$props;
3763
- let { minbetcount = "" } = $$props;
3764
- let { showenrolled = "false" } = $$props;
3765
- let { gameurl = "" } = $$props;
3766
- let { lang = "en" } = $$props;
3767
-
3768
- // Variables of topics for communication
3769
- let sessionTopic;
3770
-
3771
- let shownDate = "";
3772
- let isLoggedIn = false;
3773
- let sessionID = "";
3774
- let playerID = "";
3775
- let shownStatus = "";
3776
-
3777
- Object.keys(TournamentsThumbnailTranslations).forEach(item => {
3778
- addNewMessages(item, TournamentsThumbnailTranslations[item]);
3779
- });
3780
-
3781
- const messageHandler = e => {
3782
- if (e.data && e.data.type == "SessionID") {
3783
- $$invalidate(11, isLoggedIn = true);
3784
- }
3785
- };
3786
-
3787
- const formatDate = () => {
3788
- const dateOptions = { month: "long" };
3789
- let currentDate = new Date(startdate);
3790
- let currentMonth = new Intl.DateTimeFormat(lang, dateOptions).format(currentDate);
3791
- let currentDay = currentDate.getDate();
3792
-
3793
- let currentHour = currentDate.toLocaleString(lang, {
3794
- hour: "numeric",
3795
- minute: "numeric",
3796
- hour12: false
3797
- });
3798
-
3799
- $$invalidate(10, shownDate = `${currentDay} ${currentMonth}, ` + $_("tournamentsThumbnail.startingAt") + ` ${currentHour}`);
3800
- };
3801
-
3802
- const matchStatus = () => {
3803
- if (status == "Unstarted") {
3804
- $$invalidate(12, shownStatus = $_("tournamentsThumbnail.scheduled"));
3805
- }
3806
-
3807
- if (status == "Running") {
3808
- $$invalidate(12, shownStatus = $_("tournamentsThumbnail.ongoing"));
3809
- }
3810
-
3811
- if (status == "Closed" || status == "Closing") {
3812
- $$invalidate(12, shownStatus = $_("tournamentsThumbnail.finished"));
3813
- }
3814
- };
3815
-
3816
- const tournamentGamesClicked = (node, tourId) => {
3817
- window.postMessage({ type: "tournamentGamesClicked", tourId }, window.location.href);
3818
- };
3819
-
3820
- const setSession = () => {
3821
- if (session.length > 0 && session != "false") {
3822
- sessionID = session;
3823
- $$invalidate(11, isLoggedIn = true);
3824
- } else {
3825
- $$invalidate(11, isLoggedIn = false);
3826
- }
3827
- };
3828
-
3829
- onMount(() => {
3830
- window.addEventListener("message", messageHandler, false);
3831
-
3832
- return () => {
3833
- window.removeEventListener("message", messageHandler);
3834
- };
3835
- });
3836
-
3837
- const writable_props = [
3838
- "session",
3839
- "userid",
3840
- "title",
3841
- "startdate",
3842
- "status",
3843
- "tourid",
3844
- "thumbnail",
3845
- "userenrolled",
3846
- "scorecriteria",
3847
- "minbetcount",
3848
- "showenrolled",
3849
- "gameurl",
3850
- "lang"
3851
- ];
3852
-
3853
- Object_1.keys($$props).forEach(key => {
3854
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<undefined> was created with unknown prop '${key}'`);
3855
- });
3856
-
3857
- const click_handler = () => tournamentGamesClicked();
3858
-
3859
- $$self.$$set = $$props => {
3860
- if ("session" in $$props) $$invalidate(17, session = $$props.session);
3861
- if ("userid" in $$props) $$invalidate(18, userid = $$props.userid);
3862
- if ("title" in $$props) $$invalidate(0, title = $$props.title);
3863
- if ("startdate" in $$props) $$invalidate(1, startdate = $$props.startdate);
3864
- if ("status" in $$props) $$invalidate(2, status = $$props.status);
3865
- if ("tourid" in $$props) $$invalidate(3, tourid = $$props.tourid);
3866
- if ("thumbnail" in $$props) $$invalidate(4, thumbnail = $$props.thumbnail);
3867
- if ("userenrolled" in $$props) $$invalidate(5, userenrolled = $$props.userenrolled);
3868
- if ("scorecriteria" in $$props) $$invalidate(6, scorecriteria = $$props.scorecriteria);
3869
- if ("minbetcount" in $$props) $$invalidate(7, minbetcount = $$props.minbetcount);
3870
- if ("showenrolled" in $$props) $$invalidate(8, showenrolled = $$props.showenrolled);
3871
- if ("gameurl" in $$props) $$invalidate(9, gameurl = $$props.gameurl);
3872
- if ("lang" in $$props) $$invalidate(19, lang = $$props.lang);
3873
- };
3874
-
3875
- $$self.$capture_state = () => ({
3876
- onMount,
3877
- _: X,
3878
- addNewMessages,
3879
- TournamentsThumbnailTranslations,
3880
- session,
3881
- userid,
3882
- title,
3883
- startdate,
3884
- status,
3885
- tourid,
3886
- thumbnail,
3887
- userenrolled,
3888
- scorecriteria,
3889
- minbetcount,
3890
- showenrolled,
3891
- gameurl,
3892
- lang,
3893
- sessionTopic,
3894
- shownDate,
3895
- isLoggedIn,
3896
- sessionID,
3897
- playerID,
3898
- shownStatus,
3899
- messageHandler,
3900
- formatDate,
3901
- matchStatus,
3902
- tournamentGamesClicked,
3903
- setSession,
3904
- $_
3905
- });
3906
-
3907
- $$self.$inject_state = $$props => {
3908
- if ("session" in $$props) $$invalidate(17, session = $$props.session);
3909
- if ("userid" in $$props) $$invalidate(18, userid = $$props.userid);
3910
- if ("title" in $$props) $$invalidate(0, title = $$props.title);
3911
- if ("startdate" in $$props) $$invalidate(1, startdate = $$props.startdate);
3912
- if ("status" in $$props) $$invalidate(2, status = $$props.status);
3913
- if ("tourid" in $$props) $$invalidate(3, tourid = $$props.tourid);
3914
- if ("thumbnail" in $$props) $$invalidate(4, thumbnail = $$props.thumbnail);
3915
- if ("userenrolled" in $$props) $$invalidate(5, userenrolled = $$props.userenrolled);
3916
- if ("scorecriteria" in $$props) $$invalidate(6, scorecriteria = $$props.scorecriteria);
3917
- if ("minbetcount" in $$props) $$invalidate(7, minbetcount = $$props.minbetcount);
3918
- if ("showenrolled" in $$props) $$invalidate(8, showenrolled = $$props.showenrolled);
3919
- if ("gameurl" in $$props) $$invalidate(9, gameurl = $$props.gameurl);
3920
- if ("lang" in $$props) $$invalidate(19, lang = $$props.lang);
3921
- if ("sessionTopic" in $$props) sessionTopic = $$props.sessionTopic;
3922
- if ("shownDate" in $$props) $$invalidate(10, shownDate = $$props.shownDate);
3923
- if ("isLoggedIn" in $$props) $$invalidate(11, isLoggedIn = $$props.isLoggedIn);
3924
- if ("sessionID" in $$props) sessionID = $$props.sessionID;
3925
- if ("playerID" in $$props) playerID = $$props.playerID;
3926
- if ("shownStatus" in $$props) $$invalidate(12, shownStatus = $$props.shownStatus);
3927
- };
3928
-
3929
- if ($$props && "$$inject" in $$props) {
3930
- $$self.$inject_state($$props.$$inject);
3931
- }
3932
-
3933
- $$self.$$.update = () => {
3934
- if ($$self.$$.dirty & /*session*/ 131072) {
3935
- session && setSession();
3936
- }
3937
- };
3938
-
3939
- return [
3940
- title,
3941
- startdate,
3942
- status,
3943
- tourid,
3944
- thumbnail,
3945
- userenrolled,
3946
- scorecriteria,
3947
- minbetcount,
3948
- showenrolled,
3949
- gameurl,
3950
- shownDate,
3951
- isLoggedIn,
3952
- shownStatus,
3953
- $_,
3954
- formatDate,
3955
- matchStatus,
3956
- tournamentGamesClicked,
3957
- session,
3958
- userid,
3959
- lang,
3960
- click_handler
3961
- ];
3962
- }
3963
-
3964
- class CasinoTournamentsThumbnail extends SvelteElement {
3965
- constructor(options) {
3966
- super();
3967
- this.shadowRoot.innerHTML = `<style>*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:"Helvetica Neue", "Helvetica", sans-serif}a{color:#48952a;text-decoration:underline;cursor:pointer}.Thumbnail{position:relative}.Thumbnail .CardImg{height:300px;width:100%;background:url("https://breakthrough.org/wp-content/uploads/2018/10/default-placeholder-image.png");background-repeat:no-repeat;background-position:center;background-size:auto}.Thumbnail .CardImg.CardImgFinished{filter:grayscale(1)}.Thumbnail .Status{background:#000000;display:flex;justify-content:center;align-items:center;position:absolute;top:20px;right:20px;min-height:30px;padding:0 10px;font-size:12px;text-transform:uppercase;z-index:1}.Thumbnail .Enrolled{background:#2B2B5D;color:#aaaabe;display:flex;justify-content:center;align-items:center;position:absolute;top:20px;left:20px;min-height:30px;padding:0 10px;font-size:12px;text-transform:uppercase;z-index:1}.Thumbnail .Details{padding:10px 20px 0}.Thumbnail .Details .Title{font-size:18px;padding-bottom:10px}.Thumbnail .Details .Date{text-transform:uppercase;font-size:12px;padding-bottom:4px}.Thumbnail .Details .ScoreCriteria{font-size:12px;padding-bottom:4px}.Thumbnail .Details .Games{font-size:12px}</style>`;
3968
-
3969
- init(
3970
- this,
3971
- {
3972
- target: this.shadowRoot,
3973
- props: attribute_to_object(this.attributes),
3974
- customElement: true
3975
- },
3976
- instance,
3977
- create_fragment,
3978
- safe_not_equal,
3979
- {
3980
- session: 17,
3981
- userid: 18,
3982
- title: 0,
3983
- startdate: 1,
3984
- status: 2,
3985
- tourid: 3,
3986
- thumbnail: 4,
3987
- userenrolled: 5,
3988
- scorecriteria: 6,
3989
- minbetcount: 7,
3990
- showenrolled: 8,
3991
- gameurl: 9,
3992
- lang: 19
3993
- }
3994
- );
3995
-
3996
- if (options) {
3997
- if (options.target) {
3998
- insert_dev(options.target, this, options.anchor);
3999
- }
4000
-
4001
- if (options.props) {
4002
- this.$set(options.props);
4003
- flush();
4004
- }
4005
- }
4006
- }
4007
-
4008
- static get observedAttributes() {
4009
- return [
4010
- "session",
4011
- "userid",
4012
- "title",
4013
- "startdate",
4014
- "status",
4015
- "tourid",
4016
- "thumbnail",
4017
- "userenrolled",
4018
- "scorecriteria",
4019
- "minbetcount",
4020
- "showenrolled",
4021
- "gameurl",
4022
- "lang"
4023
- ];
4024
- }
4025
-
4026
- get session() {
4027
- return this.$$.ctx[17];
4028
- }
4029
-
4030
- set session(session) {
4031
- this.$set({ session });
4032
- flush();
4033
- }
4034
-
4035
- get userid() {
4036
- return this.$$.ctx[18];
4037
- }
4038
-
4039
- set userid(userid) {
4040
- this.$set({ userid });
4041
- flush();
4042
- }
4043
-
4044
- get title() {
4045
- return this.$$.ctx[0];
4046
- }
4047
-
4048
- set title(title) {
4049
- this.$set({ title });
4050
- flush();
4051
- }
4052
-
4053
- get startdate() {
4054
- return this.$$.ctx[1];
4055
- }
4056
-
4057
- set startdate(startdate) {
4058
- this.$set({ startdate });
4059
- flush();
4060
- }
4061
-
4062
- get status() {
4063
- return this.$$.ctx[2];
4064
- }
4065
-
4066
- set status(status) {
4067
- this.$set({ status });
4068
- flush();
4069
- }
4070
-
4071
- get tourid() {
4072
- return this.$$.ctx[3];
4073
- }
4074
-
4075
- set tourid(tourid) {
4076
- this.$set({ tourid });
4077
- flush();
4078
- }
4079
-
4080
- get thumbnail() {
4081
- return this.$$.ctx[4];
4082
- }
4083
-
4084
- set thumbnail(thumbnail) {
4085
- this.$set({ thumbnail });
4086
- flush();
4087
- }
4088
-
4089
- get userenrolled() {
4090
- return this.$$.ctx[5];
4091
- }
4092
-
4093
- set userenrolled(userenrolled) {
4094
- this.$set({ userenrolled });
4095
- flush();
4096
- }
4097
-
4098
- get scorecriteria() {
4099
- return this.$$.ctx[6];
4100
- }
4101
-
4102
- set scorecriteria(scorecriteria) {
4103
- this.$set({ scorecriteria });
4104
- flush();
4105
- }
4106
-
4107
- get minbetcount() {
4108
- return this.$$.ctx[7];
4109
- }
4110
-
4111
- set minbetcount(minbetcount) {
4112
- this.$set({ minbetcount });
4113
- flush();
4114
- }
4115
-
4116
- get showenrolled() {
4117
- return this.$$.ctx[8];
4118
- }
4119
-
4120
- set showenrolled(showenrolled) {
4121
- this.$set({ showenrolled });
4122
- flush();
4123
- }
4124
-
4125
- get gameurl() {
4126
- return this.$$.ctx[9];
4127
- }
4128
-
4129
- set gameurl(gameurl) {
4130
- this.$set({ gameurl });
4131
- flush();
4132
- }
4133
-
4134
- get lang() {
4135
- return this.$$.ctx[19];
4136
- }
4137
-
4138
- set lang(lang) {
4139
- this.$set({ lang });
4140
- flush();
4141
- }
4142
- }
4143
-
4144
- !customElements.get('casino-tournaments-thumbnail') && customElements.define('casino-tournaments-thumbnail', CasinoTournamentsThumbnail);
4145
-
4146
- return CasinoTournamentsThumbnail;
4147
-
4148
- })));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).app=t()}(this,function(){"use strict";function y(){}function h(e){return e()}function f(){return Object.create(null)}function p(e){e.forEach(h)}function m(e){return"function"==typeof e}function n(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function A(e,...t){if(null==e)return y;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function u(e){return e&&m(e.destroy)?e.destroy:y}function _(e,t){e.appendChild(t)}function L(e,t,n){e.insertBefore(t,n||null)}function P(e){e.parentNode.removeChild(e)}function t(e){return document.createElement(e)}function S(e){return document.createTextNode(e)}function w(){return S(" ")}function O(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function C(e,t){e.wholeText!==(t=""+t)&&(e.data=t)}function a(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}let N;function d(e){N=e}const g=[],e=[],r=[],i=[],E=Promise.resolve();let b=!1;function T(e){r.push(e)}let o=!1;const s=new Set;function v(){if(!o){o=!0;do{for(let e=0;e<g.length;e+=1){var t=g[e];d(t),function(e){{var t;null!==e.fragment&&(e.update(),p(e.before_update),t=e.dirty,e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(T))}}(t.$$)}for(d(null),g.length=0;e.length;)e.pop()();for(let e=0;e<r.length;e+=1){const n=r[e];s.has(n)||(s.add(n),n())}}while(r.length=0,g.length);for(;i.length;)i.pop()();b=!1,o=!1,s.clear()}}const I=new Set;function l(r,e,t,n,i,o,s=[-1]){var a,u=N;d(r);const l=r.$$={fragment:null,ctx:null,props:o,update:y,not_equal:i,bound:f(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(u?u.$$.context:e.context||[]),callbacks:f(),dirty:s,skip_bound:!1};let c=!1;if(l.ctx=t?t(r,e.props||{},(e,t,...n)=>{n=n.length?n[0]:t;return l.ctx&&i(l.ctx[e],l.ctx[e]=n)&&(!l.skip_bound&&l.bound[e]&&l.bound[e](n),c&&(n=e,-1===(e=r).$$.dirty[0]&&(g.push(e),b||(b=!0,E.then(v)),e.$$.dirty.fill(0)),e.$$.dirty[n/31|0]|=1<<n%31)),t}):[],l.update(),c=!0,p(l.before_update),l.fragment=!!n&&n(l.ctx),e.target){if(e.hydrate){const y=(n=e.target,Array.from(n.childNodes));l.fragment&&l.fragment.l(y),y.forEach(P)}else l.fragment&&l.fragment.c();e.intro&&(a=r.$$.fragment)&&a.i&&(I.delete(a),a.i(void 0)),function(t,e,n,r){const{fragment:i,on_mount:o,on_destroy:s,after_update:a}=t.$$;i&&i.m(e,n),r||T(()=>{var e=o.map(h).filter(m);s?s.push(...e):p(e),t.$$.on_mount=[]}),a.forEach(T)}(r,e.target,e.anchor,e.customElement),v()}d(u)}let c;"function"==typeof HTMLElement&&(c=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(h).filter(m);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){p(this.$$.on_disconnect)}$destroy(){!function(e){const t=e.$$;null!==t.fragment&&(p(t.on_destroy),t.fragment&&t.fragment.d(1),t.on_destroy=t.fragment=null,t.ctx=[])}(this),this.$destroy=y}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{var e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){this.$$set&&0!==Object.keys(e).length&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});const R=[];function M(r,i=y){let o;const s=[];function a(e){if(n(r,e)&&(r=e,o)){const e=!R.length;for(let e=0;e<s.length;e+=1){const t=s[e];t[1](),R.push(t,r)}if(e){for(let e=0;e<R.length;e+=2)R[e][0](R[e+1]);R.length=0}}}return{set:a,update:function(e){a(e(r))},subscribe:function(e,t=y){const n=[e,t];return s.push(n),1===s.length&&(o=i(a)||y),e(r),()=>{var e=s.indexOf(n);-1!==e&&s.splice(e,1),0===s.length&&(o(),o=null)}}}}function U(e,a,t){const u=!Array.isArray(e),l=u?[e]:e,c=a.length<2;return{subscribe:M(t,t=>{let n=!1;const r=[];let i=0,o=y;const s=()=>{var e;i||(o(),e=a(u?r[0]:r,t),c?t(e):o=m(e)?e:y)},e=l.map((e,t)=>A(e,e=>{r[t]=e,i&=~(1<<t),n&&s()},()=>{i|=1<<t}));return n=!0,s(),function(){p(e),o()}}).subscribe}}var D=function(e){return!(!e||"object"!=typeof e||(t=e,"[object RegExp]"===(e=Object.prototype.toString.call(t))||"[object Date]"===e||t.$$typeof===$));var t},$="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function k(e,t){return!1!==t.clone&&t.isMergeableObject(e)?V(Array.isArray(e)?[]:{},e,t):e}function G(e,t,n){return e.concat(t).map(function(e){return k(e,n)})}function x(e){return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return t.propertyIsEnumerable(e)}):[]));var t}function F(e,t){try{return t in e}catch(e){return!1}}function j(r,i,o){var s={};return o.isMergeableObject(r)&&x(r).forEach(function(e){s[e]=k(r[e],o)}),x(i).forEach(function(t){var e,n;(!F(e=r,n=t)||Object.hasOwnProperty.call(e,n)&&Object.propertyIsEnumerable.call(e,n))&&(F(r,t)&&o.isMergeableObject(i[t])?s[t]=function(){if(!o.customMerge)return V;var e=o.customMerge(t);return"function"==typeof e?e:V}()(r[t],i[t],o):s[t]=k(i[t],o))}),s}function V(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||G,n.isMergeableObject=n.isMergeableObject||D,n.cloneUnlessOtherwiseSpecified=k;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):j(e,t,n):k(t,n)}V.all=function(e,n){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,t){return V(e,t,n)},{})};var X=V,z=function(e,t){return(z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function B(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Y,K,H,q=function(){return(q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Z(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}function W(e){return e.type===K.literal}function Q(e){return e.type===K.number}function J(e){return e.type===K.date}function ee(e){return e.type===K.time}function te(e){return e.type===K.select}function ne(e){return e.type===K.plural}function re(e){return e.type===K.tag}function ie(e){return e&&"object"==typeof e&&e.type===H.number}function oe(e){return e&&"object"==typeof e&&e.type===H.dateTime}(Le=Y=Y||{})[Le.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",Le[Le.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",Le[Le.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",Le[Le.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",Le[Le.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",Le[Le.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",Le[Le.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",Le[Le.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",Le[Le.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",Le[Le.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",Le[Le.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",Le[Le.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",Le[Le.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",Le[Le.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",Le[Le.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",Le[Le.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",Le[Le.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",Le[Le.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",Le[Le.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",Le[Le.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",Le[Le.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",Le[Le.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",Le[Le.INVALID_TAG=23]="INVALID_TAG",Le[Le.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",Le[Le.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",Le[Le.UNCLOSED_TAG=27]="UNCLOSED_TAG",(Pe=K=K||{})[Pe.literal=0]="literal",Pe[Pe.argument=1]="argument",Pe[Pe.number=2]="number",Pe[Pe.date=3]="date",Pe[Pe.time=4]="time",Pe[Pe.select=5]="select",Pe[Pe.plural=6]="plural",Pe[Pe.pound=7]="pound",Pe[Pe.tag=8]="tag",(Se=H=H||{})[Se.number=0]="number",Se[Se.dateTime=1]="dateTime";var se=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,ae=/(?:[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;var ue,le=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i,ce=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,he=/^(@+)?(\+|#+)?$/g,fe=/(\*)(0+)|(#+)(0+)|(0+)/g,pe=/^(0+)$/;function me(e){var r={};return e.replace(he,function(e,t,n){return"string"!=typeof n?(r.minimumSignificantDigits=t.length,r.maximumSignificantDigits=t.length):"+"===n?r.minimumSignificantDigits=t.length:"#"===t[0]?r.maximumSignificantDigits=t.length:(r.minimumSignificantDigits=t.length,r.maximumSignificantDigits=t.length+("string"==typeof n?n.length:0)),""}),r}function de(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function ge(e){return de(e)||{}}function Ee(e){for(var s={},t=0,n=e;t<n.length;t++){var r,i=n[t];switch(i.stem){case"percent":case"%":s.style="percent";continue;case"%x100":s.style="percent",s.scale=100;continue;case"currency":s.style="currency",s.currency=i.options[0];continue;case"group-off":case",_":s.useGrouping=!1;continue;case"precision-integer":case".":s.maximumFractionDigits=0;continue;case"measure-unit":case"unit":s.style="unit",s.unit=i.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":s.notation="compact",s.compactDisplay="short";continue;case"compact-long":case"KK":s.notation="compact",s.compactDisplay="long";continue;case"scientific":s=q(q(q({},s),{notation:"scientific"}),i.options.reduce(function(e,t){return q(q({},e),ge(t))},{}));continue;case"engineering":s=q(q(q({},s),{notation:"engineering"}),i.options.reduce(function(e,t){return q(q({},e),ge(t))},{}));continue;case"notation-simple":s.notation="standard";continue;case"unit-width-narrow":s.currencyDisplay="narrowSymbol",s.unitDisplay="narrow";continue;case"unit-width-short":s.currencyDisplay="code",s.unitDisplay="short";continue;case"unit-width-full-name":s.currencyDisplay="name",s.unitDisplay="long";continue;case"unit-width-iso-code":s.currencyDisplay="symbol";continue;case"scale":s.scale=parseFloat(i.options[0]);continue;case"integer-width":if(1<i.options.length)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(fe,function(e,t,n,r,i,o){if(t)s.minimumIntegerDigits=n.length;else{if(r&&i)throw new Error("We currently do not support maximum integer digits");if(o)throw new Error("We currently do not support exact integer digits")}return""});continue}if(pe.test(i.stem))s.minimumIntegerDigits=i.stem.length;else if(ce.test(i.stem)){if(1<i.options.length)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(ce,function(e,t,n,r,i,o){return"*"===n?s.minimumFractionDigits=t.length:r&&"#"===r[0]?s.maximumFractionDigits=r.length:i&&o?(s.minimumFractionDigits=i.length,s.maximumFractionDigits=i.length+o.length):(s.minimumFractionDigits=t.length,s.maximumFractionDigits=t.length),""}),i.options.length&&(s=q(q({},s),me(i.options[0])))}else he.test(i.stem)?s=q(q({},s),me(i.stem)):((r=de(i.stem))&&(s=q(q({},s),r)),(r=function(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var n=e.slice(0,2);if("+!"===n?(t.signDisplay="always",e=e.slice(2)):"+?"===n&&(t.signDisplay="exceptZero",e=e.slice(2)),!pe.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}(i.stem))&&(s=q(q({},s),r)))}return s}var ye=new RegExp("^"+se.source+"*"),be=new RegExp(se.source+"*$");function Te(e,t){return{start:e,end:t}}var ve=!!String.prototype.startsWith,_e=!!String.fromCodePoint,Ae=!!Object.fromEntries,Le=!!String.prototype.codePointAt,Pe=!!String.prototype.trimStart,Se=!!String.prototype.trimEnd,we=Number.isSafeInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},se=!0;try{se="a"===(null===(ue=$e("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===ue?void 0:ue[0])}catch(y){se=!1}var Oe,Ce,Ne=ve?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},Ie=_e?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n,r="",i=e.length,o=0;o<i;){if(1114111<(n=e[o++]))throw RangeError(n+" is not a valid code point");r+=n<65536?String.fromCharCode(n):String.fromCharCode(55296+((n-=65536)>>10),n%1024+56320)}return r},Re=Ae?Object.fromEntries:function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];t[o]=i}return t},Me=Le?function(e,t){return e.codePointAt(t)}:function(e,t){var n=e.length;if(!(t<0||n<=t)){var r,i=e.charCodeAt(t);return i<55296||56319<i||t+1===n||(r=e.charCodeAt(t+1))<56320||57343<r?i:r-56320+(i-55296<<10)+65536}},Ue=Pe?function(e){return e.trimStart()}:function(e){return e.replace(ye,"")},De=Se?function(e){return e.trimEnd()}:function(e){return e.replace(be,"")};function $e(e,t){return new RegExp(e,t)}Ce=se?(Oe=$e("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),function(e,t){return Oe.lastIndex=t,null!==(e=Oe.exec(e)[1])&&void 0!==e?e:""}):function(e,t){for(var n,r=[];;){var i=Me(e,t);if(void 0===i||Fe(i)||(33<=(n=i)&&n<=35||36===n||37<=n&&n<=39||40===n||41===n||42===n||43===n||44===n||45===n||46<=n&&n<=47||58<=n&&n<=59||60<=n&&n<=62||63<=n&&n<=64||91===n||92===n||93===n||94===n||96===n||123===n||124===n||125===n||126===n||161===n||162<=n&&n<=165||166===n||167===n||169===n||171===n||172===n||174===n||176===n||177===n||182===n||187===n||191===n||215===n||247===n||8208<=n&&n<=8213||8214<=n&&n<=8215||8216===n||8217===n||8218===n||8219<=n&&n<=8220||8221===n||8222===n||8223===n||8224<=n&&n<=8231||8240<=n&&n<=8248||8249===n||8250===n||8251<=n&&n<=8254||8257<=n&&n<=8259||8260===n||8261===n||8262===n||8263<=n&&n<=8273||8274===n||8275===n||8277<=n&&n<=8286||8592<=n&&n<=8596||8597<=n&&n<=8601||8602<=n&&n<=8603||8604<=n&&n<=8607||8608===n||8609<=n&&n<=8610||8611===n||8612<=n&&n<=8613||8614===n||8615<=n&&n<=8621||8622===n||8623<=n&&n<=8653||8654<=n&&n<=8655||8656<=n&&n<=8657||8658===n||8659===n||8660===n||8661<=n&&n<=8691||8692<=n&&n<=8959||8960<=n&&n<=8967||8968===n||8969===n||8970===n||8971===n||8972<=n&&n<=8991||8992<=n&&n<=8993||8994<=n&&n<=9e3||9001===n||9002===n||9003<=n&&n<=9083||9084===n||9085<=n&&n<=9114||9115<=n&&n<=9139||9140<=n&&n<=9179||9180<=n&&n<=9185||9186<=n&&n<=9254||9255<=n&&n<=9279||9280<=n&&n<=9290||9291<=n&&n<=9311||9472<=n&&n<=9654||9655===n||9656<=n&&n<=9664||9665===n||9666<=n&&n<=9719||9720<=n&&n<=9727||9728<=n&&n<=9838||9839===n||9840<=n&&n<=10087||10088===n||10089===n||10090===n||10091===n||10092===n||10093===n||10094===n||10095===n||10096===n||10097===n||10098===n||10099===n||10100===n||10101===n||10132<=n&&n<=10175||10176<=n&&n<=10180||10181===n||10182===n||10183<=n&&n<=10213||10214===n||10215===n||10216===n||10217===n||10218===n||10219===n||10220===n||10221===n||10222===n||10223===n||10224<=n&&n<=10239||10240<=n&&n<=10495||10496<=n&&n<=10626||10627===n||10628===n||10629===n||10630===n||10631===n||10632===n||10633===n||10634===n||10635===n||10636===n||10637===n||10638===n||10639===n||10640===n||10641===n||10642===n||10643===n||10644===n||10645===n||10646===n||10647===n||10648===n||10649<=n&&n<=10711||10712===n||10713===n||10714===n||10715===n||10716<=n&&n<=10747||10748===n||10749===n||10750<=n&&n<=11007||11008<=n&&n<=11055||11056<=n&&n<=11076||11077<=n&&n<=11078||11079<=n&&n<=11084||11085<=n&&n<=11123||11124<=n&&n<=11125||11126<=n&&n<=11157||11158===n||11159<=n&&n<=11263||11776<=n&&n<=11777||11778===n||11779===n||11780===n||11781===n||11782<=n&&n<=11784||11785===n||11786===n||11787===n||11788===n||11789===n||11790<=n&&n<=11798||11799===n||11800<=n&&n<=11801||11802===n||11803===n||11804===n||11805===n||11806<=n&&n<=11807||11808===n||11809===n||11810===n||11811===n||11812===n||11813===n||11814===n||11815===n||11816===n||11817===n||11818<=n&&n<=11822||11823===n||11824<=n&&n<=11833||11834<=n&&n<=11835||11836<=n&&n<=11839||11840===n||11841===n||11842===n||11843<=n&&n<=11855||11856<=n&&n<=11857||11858===n||11859<=n&&n<=11903||12289<=n&&n<=12291||12296===n||12297===n||12298===n||12299===n||12300===n||12301===n||12302===n||12303===n||12304===n||12305===n||12306<=n&&n<=12307||12308===n||12309===n||12310===n||12311===n||12312===n||12313===n||12314===n||12315===n||12316===n||12317===n||12318<=n&&n<=12319||12320===n||12336===n||64830===n||64831===n||65093<=n&&n<=65094))break;r.push(i),t+=65536<=i?2:1}return Ie.apply(void 0,r)};var ke=(Ge.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},Ge.prototype.parseMessage=function(e,t,n){for(var r=[];!this.isEOF();){var i,o=this.char();if(123===o){if((i=this.parseArgument(e,n)).err)return i;r.push(i.val)}else{if(125===o&&0<e)break;if(35!==o||"plural"!==t&&"selectordinal"!==t){if(60===o&&!this.ignoreTag&&47===this.peek()){if(n)break;return this.error(Y.UNMATCHED_CLOSING_TAG,Te(this.clonePosition(),this.clonePosition()))}if(60===o&&!this.ignoreTag&&xe(this.peek()||0)){if((i=this.parseTag(e,t)).err)return i;r.push(i.val)}else{if((i=this.parseLiteral(e,t)).err)return i;r.push(i.val)}}else{o=this.clonePosition();this.bump(),r.push({type:K.pound,location:Te(o,this.clonePosition())})}}}return{val:r,err:null}},Ge.prototype.parseTag=function(e,t){var n=this.clonePosition();this.bump();var r=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:K.literal,value:"<"+r+"/>",location:Te(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(e+1,t,!0);if(i.err)return i;e=i.val,t=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!xe(this.char()))return this.error(Y.INVALID_TAG,Te(t,this.clonePosition()));i=this.clonePosition();return r!==this.parseTagName()?this.error(Y.UNMATCHED_CLOSING_TAG,Te(i,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:K.tag,value:r,children:e,location:Te(n,this.clonePosition())},err:null}:this.error(Y.INVALID_TAG,Te(t,this.clonePosition())))}return this.error(Y.UNCLOSED_TAG,Te(n,this.clonePosition()))}return this.error(Y.INVALID_TAG,Te(n,this.clonePosition()))},Ge.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||48<=e&&e<=57||95===e||97<=e&&e<=122||65<=e&&e<=90||183==e||192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8204<=e&&e<=8205||8255<=e&&e<=8256||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||65536<=e&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},Ge.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),r="";;){var i=this.tryParseQuote(t);if(i)r+=i;else{i=this.tryParseUnquoted(e,t);if(i)r+=i;else{i=this.tryParseLeftAngleBracket();if(!i)break;r+=i}}}n=Te(n,this.clonePosition());return{val:{type:K.literal,value:r,location:n},err:null}},Ge.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(xe(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},Ge.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(39===n){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(n);this.bump()}return Ie.apply(void 0,t)},Ge.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return 60===n||123===n||35===n&&("plural"===t||"selectordinal"===t)||125===n&&0<e?null:(this.bump(),Ie(n))},Ge.prototype.parseArgument=function(e,t){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(Y.EXPECT_ARGUMENT_CLOSING_BRACE,Te(n,this.clonePosition()));if(125===this.char())return this.bump(),this.error(Y.EMPTY_ARGUMENT,Te(n,this.clonePosition()));var r=this.parseIdentifierIfPossible().value;if(!r)return this.error(Y.MALFORMED_ARGUMENT,Te(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(Y.EXPECT_ARGUMENT_CLOSING_BRACE,Te(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:K.argument,value:r,location:Te(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(Y.EXPECT_ARGUMENT_CLOSING_BRACE,Te(n,this.clonePosition())):this.parseArgumentOptions(e,t,r,n);default:return this.error(Y.MALFORMED_ARGUMENT,Te(n,this.clonePosition()))}},Ge.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=Ce(this.message,t),t=t+n.length;return this.bumpTo(t),{value:n,location:Te(e,this.clonePosition())}},Ge.prototype.parseArgumentOptions=function(e,t,n,r){var i,o=this.clonePosition(),s=this.parseIdentifierIfPossible().value,a=this.clonePosition();switch(s){case"":return this.error(Y.EXPECT_ARGUMENT_TYPE,Te(o,a));case"number":case"date":case"time":this.bumpSpace();var u=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((f=this.parseSimpleArgStyleIfPossible()).err)return f;if(0===(h=De(f.val)).length)return this.error(Y.EXPECT_ARGUMENT_STYLE,Te(this.clonePosition(),this.clonePosition()));u={style:h,styleLocation:Te(l,this.clonePosition())}}if((p=this.tryParseArgumentClose(r)).err)return p;var c=Te(r,this.clonePosition());if(u&&Ne(null==u?void 0:u.style,"::",0)){l=Ue(u.style.slice(2));if("number"===s)return(f=this.parseNumberSkeletonFromString(l,u.styleLocation)).err?f:{val:{type:K.number,value:n,location:c,style:f.val},err:null};if(0===l.length)return this.error(Y.EXPECT_DATE_TIME_SKELETON,c);var h={type:H.dateTime,pattern:l,location:u.styleLocation,parsedOptions:this.shouldParseSkeletons?(i={},l.replace(ae,function(e){var t=e.length;switch(e[0]){case"G":i.era=4===t?"long":5===t?"narrow":"short";break;case"y":i.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":i.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":i.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":i.weekday=4!==t&&5===t?"narrow":"short";break;case"e":if(t<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");i.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");i.weekday=["short","long","narrow","short"][t-4];break;case"a":i.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":i.hourCycle="h12",i.hour=["numeric","2-digit"][t-1];break;case"H":i.hourCycle="h23",i.hour=["numeric","2-digit"][t-1];break;case"K":i.hourCycle="h11",i.hour=["numeric","2-digit"][t-1];break;case"k":i.hourCycle="h24",i.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":i.minute=["numeric","2-digit"][t-1];break;case"s":i.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":i.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),i):{}};return{val:{type:"date"===s?K.date:K.time,value:n,location:c,style:h},err:null}}return{val:{type:"number"===s?K.number:"date"===s?K.date:K.time,value:n,location:c,style:null!==(c=null==u?void 0:u.style)&&void 0!==c?c:null},err:null};case"plural":case"selectordinal":case"select":u=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(Y.EXPECT_SELECT_ARGUMENT_OPTIONS,Te(u,q({},u)));this.bumpSpace();var f,c=this.parseIdentifierIfPossible(),u=0;if("select"!==s&&"offset"===c.value){if(!this.bumpIf(":"))return this.error(Y.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Te(this.clonePosition(),this.clonePosition()));if(this.bumpSpace(),(f=this.tryParseDecimalInteger(Y.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Y.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return f;this.bumpSpace(),c=this.parseIdentifierIfPossible(),u=f.val}c=this.tryParsePluralOrSelectOptions(e,s,t,c);if(c.err)return c;if((p=this.tryParseArgumentClose(r)).err)return p;var p=Te(r,this.clonePosition());return"select"===s?{val:{type:K.select,value:n,options:Re(c.val),location:p},err:null}:{val:{type:K.plural,value:n,options:Re(c.val),offset:u,pluralType:"plural"===s?"cardinal":"ordinal",location:p},err:null};default:return this.error(Y.INVALID_ARGUMENT_TYPE,Te(o,a))}},Ge.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(Y.EXPECT_ARGUMENT_CLOSING_BRACE,Te(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},Ge.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(Y.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Te(n,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(0<e))return{val:this.message.slice(t.offset,this.offset()),err:null};--e;break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}},Ge.prototype.parseNumberSkeletonFromString=function(e,t){var n=[];try{n=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],n=0,r=e.split(le).filter(function(e){return 0<e.length});n<r.length;n++){var i=r[n].split("/");if(0===i.length)throw new Error("Invalid number skeleton");for(var o=i[0],i=i.slice(1),s=0,a=i;s<a.length;s++)if(0===a[s].length)throw new Error("Invalid number skeleton");t.push({stem:o,options:i})}return t}(e)}catch(e){return this.error(Y.INVALID_NUMBER_SKELETON,t)}return{val:{type:H.number,tokens:n,location:t,parsedOptions:this.shouldParseSkeletons?Ee(n):{}},err:null}},Ge.prototype.tryParsePluralOrSelectOptions=function(e,t,n,r){for(var i=!1,o=[],s=new Set,a=r.value,u=r.location;;){if(0===a.length){var l=this.clonePosition();if("select"===t||!this.bumpIf("="))break;var c=this.tryParseDecimalInteger(Y.EXPECT_PLURAL_ARGUMENT_SELECTOR,Y.INVALID_PLURAL_ARGUMENT_SELECTOR);if(c.err)return c;u=Te(l,this.clonePosition()),a=this.message.slice(l.offset,this.offset())}if(s.has(a))return this.error("select"===t?Y.DUPLICATE_SELECT_ARGUMENT_SELECTOR:Y.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,u);"other"===a&&(i=!0),this.bumpSpace();var h=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?Y.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:Y.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Te(this.clonePosition(),this.clonePosition()));c=this.parseMessage(e+1,t,n);if(c.err)return c;l=this.tryParseArgumentClose(h);if(l.err)return l;o.push([a,{value:c.val,location:Te(h,this.clonePosition())}]),s.add(a),this.bumpSpace(),a=(h=this.parseIdentifierIfPossible()).value,u=h.location}return 0===o.length?this.error("select"===t?Y.EXPECT_SELECT_ARGUMENT_SELECTOR:Y.EXPECT_PLURAL_ARGUMENT_SELECTOR,Te(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(Y.MISSING_OTHER_CLAUSE,Te(this.clonePosition(),this.clonePosition())):{val:o,err:null}},Ge.prototype.tryParseDecimalInteger=function(e,t){var n=1,r=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var i=!1,o=0;!this.isEOF();){var s=this.char();if(!(48<=s&&s<=57))break;i=!0,o=10*o+(s-48),this.bump()}r=Te(r,this.clonePosition());return i?we(o*=n)?{val:o,err:null}:this.error(t,r):this.error(e,r)},Ge.prototype.offset=function(){return this.position.offset},Ge.prototype.isEOF=function(){return this.offset()===this.message.length},Ge.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},Ge.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=Me(this.message,e);if(void 0===t)throw Error("Offset "+e+" is at invalid UTF-16 code unit boundary");return t},Ge.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},Ge.prototype.bump=function(){var e;this.isEOF()||(10===(e=this.char())?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2))},Ge.prototype.bumpIf=function(e){if(Ne(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},Ge.prototype.bumpUntil=function(e){var t=this.offset(),t=this.message.indexOf(e,t);return 0<=t?(this.bumpTo(t),!0):(this.bumpTo(this.message.length),!1)},Ge.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset "+e+" must be greater than or equal to the current offset "+this.offset());for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(e<t)throw Error("targetOffset "+e+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},Ge.prototype.bumpSpace=function(){for(;!this.isEOF()&&Fe(this.char());)this.bump()},Ge.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),e=this.message.charCodeAt(t+(65536<=e?2:1));return null!=e?e:null},Ge);function Ge(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}function xe(e){return 97<=e&&e<=122||65<=e&&e<=90}function Fe(e){return 9<=e&&e<=13||32===e||133===e||8206<=e&&e<=8207||8232===e||8233===e}function je(e,t){t=q({shouldParseSkeletons:!0,requiresOtherClause:!0},t=void 0===t?{}:t);var n=new ke(e,t).parse();if(n.err){e=SyntaxError(Y[n.err.kind]);throw e.location=n.err.location,e.originalMessage=n.err.message,e}return null!=t&&t.captureLocation||function n(e){e.forEach(function(e){if(delete e.location,te(e)||ne(e))for(var t in e.options)delete e.options[t].location,n(e.options[t].value);else Q(e)&&ie(e.style)||(J(e)||ee(e))&&oe(e.style)?delete e.style.location:re(e)&&n(e.children)})}(n.val),n.val}function Ve(e,t){var n=t&&t.cache?t.cache:qe,r=t&&t.serializer?t.serializer:Ye;return(t&&t.strategy?t.strategy:function(e,t){return Be(e,this,1===e.length?Xe:ze,t.cache.create(),t.serializer)})(e,{cache:n,serializer:r})}function Xe(e,t,n,r){var i=null==r||"number"==typeof r||"boolean"==typeof r?r:n(r),n=t.get(i);return void 0===n&&(n=e.call(this,r),t.set(i,n)),n}function ze(e,t,n){var r=Array.prototype.slice.call(arguments,3),i=n(r),n=t.get(i);return void 0===n&&(n=e.apply(this,r),t.set(i,n)),n}function Be(e,t,n,r,i){return n.bind(t,e,r,i)}var Ye=function(){return JSON.stringify(arguments)};function Ke(){this.cache=Object.create(null)}Ke.prototype.has=function(e){return e in this.cache},Ke.prototype.get=function(e){return this.cache[e]},Ke.prototype.set=function(e,t){this.cache[e]=t};var He,qe={create:function(){return new Ke}},Ze={variadic:function(e,t){return Be(e,this,ze,t.cache.create(),t.serializer)},monadic:function(e,t){return Be(e,this,Xe,t.cache.create(),t.serializer)}};(se=He=He||{}).MISSING_VALUE="MISSING_VALUE",se.INVALID_VALUE="INVALID_VALUE",se.MISSING_INTL_API="MISSING_INTL_API";var We,Qe,Je,et,tt,nt=(B(lt,tt=Error),lt.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},lt),rt=(B(ut,et=nt),ut),it=(B(at,Je=nt),at),ot=(B(st,Qe=nt),st);function st(e,t){return Qe.call(this,'The intl string context variable "'+e+'" was not provided to the string "'+t+'"',He.MISSING_VALUE,t)||this}function at(e,t,n){return Je.call(this,'Value for "'+e+'" must be of type '+t,He.INVALID_VALUE,n)||this}function ut(e,t,n,r){return et.call(this,'Invalid values for "'+e+'": "'+t+'". Options are "'+Object.keys(n).join('", "')+'"',He.INVALID_VALUE,r)||this}function lt(e,t,n){e=tt.call(this,e)||this;return e.code=t,e.originalMessage=n,e}function ct(e,t,n,r,i,o,s){if(1===e.length&&W(e[0]))return[{type:We.literal,value:e[0].value}];for(var a=[],u=0,l=e;u<l.length;u++){var c=l[u];if(W(c))a.push({type:We.literal,value:c.value});else if(c.type===K.pound)"number"==typeof o&&a.push({type:We.literal,value:n.getNumberFormat(t).format(o)});else{var h=c.value;if(!(i&&h in i))throw new ot(h,s);var f=i[h];if(c.type===K.argument)f&&"string"!=typeof f&&"number"!=typeof f||(f="string"==typeof f||"number"==typeof f?String(f):""),a.push({type:"string"==typeof f?We.literal:We.object,value:f});else if(J(c)){var p="string"==typeof c.style?r.date[c.style]:oe(c.style)?c.style.parsedOptions:void 0;a.push({type:We.literal,value:n.getDateTimeFormat(t,p).format(f)})}else if(ee(c))p="string"==typeof c.style?r.time[c.style]:oe(c.style)?c.style.parsedOptions:void 0,a.push({type:We.literal,value:n.getDateTimeFormat(t,p).format(f)});else if(Q(c))(p="string"==typeof c.style?r.number[c.style]:ie(c.style)?c.style.parsedOptions:void 0)&&p.scale&&(f*=p.scale||1),a.push({type:We.literal,value:n.getNumberFormat(t,p).format(f)});else{if(re(c)){var m=c.children,d=c.value,h=i[d];if("function"!=typeof h)throw new it(d,"function",s);m=h(ct(m,t,n,r,i,o).map(function(e){return e.value}));Array.isArray(m)||(m=[m]),a.push.apply(a,m.map(function(e){return{type:"string"==typeof e?We.literal:We.object,value:e}}))}if(te(c)){if(!(g=c.options[f]||c.options.other))throw new rt(c.value,f,Object.keys(c.options),s);a.push.apply(a,ct(g.value,t,n,r,i))}else if(ne(c)){if(!(g=c.options["="+f])){if(!Intl.PluralRules)throw new nt('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',He.MISSING_INTL_API,s);var m=n.getPluralRules(t,{type:c.pluralType}).select(f-(c.offset||0)),g=c.options[m]||c.options.other}if(!g)throw new rt(c.value,f,Object.keys(c.options),s);a.push.apply(a,ct(g.value,t,n,r,i,f-(c.offset||0)))}}}}return a.length<2?a:a.reduce(function(e,t){var n=e[e.length-1];return n&&n.type===We.literal&&t.type===We.literal?n.value+=t.value:e.push(t),e},[])}function ht(n){return{create:function(){return{has:function(e){return e in n},get:function(e){return n[e]},set:function(e,t){n[e]=t}}}}}(se=We=We||{})[se.literal=0]="literal",se[se.object=1]="object";var ft=(Object.defineProperty(pt,"defaultLocale",{get:function(){return pt.memoizedDefaultLocale||(pt.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),pt.memoizedDefaultLocale},enumerable:!1,configurable:!0}),pt.memoizedDefaultLocale=null,pt.__parse=je,pt.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},pt);function pt(e,t,n,r){var i,o,s=this;if(void 0===t&&(t=pt.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){e=s.formatToParts(e);if(1===e.length)return e[0].value;e=e.reduce(function(e,t){return e.length&&t.type===We.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e},[]);return e.length<=1?e[0]||"":e},this.formatToParts=function(e){return ct(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},"string"==typeof e){if(this.message=e,!pt.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=pt.__parse(e,{ignoreTag:null==r?void 0:r.ignoreTag})}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=(i=pt.formats,(o=n)?Object.keys(i).reduce(function(e,t){var n,r;return e[t]=(n=i[t],(r=o[t])?q(q(q({},n||{}),r||{}),Object.keys(n).reduce(function(e,t){return e[t]=q(q({},n[t]),r[t]||{}),e},{})):n),e},q({},i)):i),this.locales=t,this.formatters=r&&r.formatters||{getNumberFormat:Ve(function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,Z([void 0],t)))},{cache:ht((r=void 0===(r=this.formatterCache)?{number:{},dateTime:{},pluralRules:{}}:r).number),strategy:Ze.variadic}),getDateTimeFormat:Ve(function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,Z([void 0],t)))},{cache:ht(r.dateTime),strategy:Ze.variadic}),getPluralRules:Ve(function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,Z([void 0],t)))},{cache:ht(r.pluralRules),strategy:Ze.variadic})}}const mt={},dt=(t,n)=>{if(null!=n){if(n in mt&&t in mt[n])return mt[n][t];var r,i,o=It(n);for(let e=0;e<o.length;e++){var s=(r=o[e],i=t,yt(r)?function(e,t){if(t in e)return e[t];const n=t.split(".");let r=e;for(let e=0;e<n.length;e++)if("object"==typeof r){if(0<e){const t=n.slice(e,n.length).join(".");if(t in r){r=r[t];break}}r=r[n[e]]}else r=void 0;return r}(function(e){return gt[e]||null}(r),i):null);if(s)return r=t,i=n,(s=s)&&(i in mt||(mt[i]={}),r in mt[i]||(mt[i][r]=s),s)}}};let gt;const Et=M({});function yt(e){return e in gt}function bt(t,...n){delete mt[t],Et.update(e=>(e[t]=X.all([e[t]||{},...n]),e))}U([Et],([e])=>Object.keys(e)),Et.subscribe(e=>gt=e);const Tt={};function vt(e){return Tt[e]}function _t(e){return It(e).some(e=>{return null===(e=vt(e))||void 0===e?void 0:e.size})}const At={};function Lt(e){if(!_t(e))return e in At?At[e]:void 0;const t=It(e).map(e=>{var t=vt(e);return[e,t?[...t]:[]]}).filter(([,e])=>0<e.length);return At[e]=Promise.all(t.map(([e,n])=>function(t){return Promise.all(n.map(e=>(function(e,t){Tt[e].delete(t),0===Tt[e].size&&delete Tt[e]}(t,e),e().then(e=>e.default||e)))).then(e=>bt(t,...e))}(e))).then(()=>_t(e)?Lt(e):void delete At[e]),At[e]}function Pt(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}const St={fallbackLocale:null,initialLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,ignoreTag:!0};const wt=M(!1);let Ot;const Ct=M(null);function Nt(e){return e.split("-").map((e,t,n)=>n.slice(0,t+1).join("-")).reverse()}function It(e,t=St.fallbackLocale){e=Nt(e);return t?[...new Set([...e,...Nt(t)])]:e}Ct.subscribe(e=>{Ot=e,"undefined"!=typeof window&&null!==e&&document.documentElement.setAttribute("lang",e)});const Rt=Ct.set;Ct.set=t=>{if(function(e){if(null!=e){var t=It(e);for(let e=0;e<t.length;e++){var n=t[e];if(yt(n))return n}}}(t)&&_t(t)){var{loadingDelay:n}=St;let e;return"undefined"!=typeof window&&null!=Ot&&n?e=window.setTimeout(()=>wt.set(!0),n):wt.set(!0),Lt(t).then(()=>{Rt(t)}).finally(()=>{clearTimeout(e),wt.set(!1)})}return Rt(t)},Ct.update=e=>Rt(e(Ot));const Mt=n=>{const r=Object.create(null);return e=>{var t=JSON.stringify(e);return t in r?r[t]:r[t]=n(e)}},Ut=(e,t)=>{var{formats:n}=St;if(e in n&&t in n[e])return n[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},Dt=Mt(e=>{var{locale:t,format:n}=e,e=Pt(e,["locale","format"]);if(null==t)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return n&&(e=Ut("number",n)),new Intl.NumberFormat(t,e)}),$t=Mt(e=>{var{locale:t,format:n}=e,e=Pt(e,["locale","format"]);if(null==t)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return n?e=Ut("date",n):0===Object.keys(e).length&&(e=Ut("date","short")),new Intl.DateTimeFormat(t,e)}),kt=Mt(e=>{var{locale:t,format:n}=e,e=Pt(e,["locale","format"]);if(null==t)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return n?e=Ut("time",n):0===Object.keys(e).length&&(e=Ut("time","short")),new Intl.DateTimeFormat(t,e)}),Gt=Mt((e,t=Ot)=>new ft(e,t,St.formats,{ignoreTag:St.ignoreTag})),xt=U([Ct,Et],()=>(e,t={})=>{"object"==typeof e&&(e=(t=e).id);var{values:n,locale:r=Ot,default:i}=t;if(null==r)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let o=dt(e,r);if(o){if("string"!=typeof o)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof o}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),o}else St.warnOnMissingMessages&&console.warn(`[svelte-i18n] The message "${e}" was not found in "${It(r).join('", "')}".${_t(Ot)?"\n\nNote: there are at least one loader still registered to this locale that wasn't executed.":""}`),o=i||e;if(!n)return o;let s=o;try{s=Gt(o,r).format(n)}catch(t){console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,t.message)}return s});U([Ct],()=>(e,t)=>((e={})=>{var{locale:t=Ot}=e,e=Pt(e,["locale"]);return kt(Object.assign({locale:t},e))})(t).format(e)),U([Ct],()=>(e,t)=>((e={})=>{var{locale:t=Ot}=e,e=Pt(e,["locale"]);return $t(Object.assign({locale:t},e))})(t).format(e)),U([Ct],()=>(e,t)=>((e={})=>{var{locale:t=Ot}=e,e=Pt(e,["locale"]);return Dt(Object.assign({locale:t},e))})(t).format(e)),U([Ct,Et],()=>(e,t=Ot)=>dt(e,t));const Ft={en:{tournamentsThumbnail:{enrolled:"Enrolled",scoreCriteria:"Score Criteria",minbet:"min bet counts: ",seegames:"You can see the games",here:"here",scheduled:"Scheduled",ongoing:"OnGoing",finished:"Finished",startingAt:"Starting at",mostRounds:"MostRounds"}},tr:{tournamentsThumbnail:{enrolled:"Katıldın",scoreCriteria:"Skor kriteri",minbet:"en düşük bahis sayısı",seegames:"Turnuvadaki oyunları görmek için",here:"tıklayın",scheduled:"Planlanmış",ongoing:"Devam Eden",finished:"Sona Ermiş",startingAt:"BAŞLAMA SAATİ:",mostRounds:"MostRounds"}},el:{tournamentsThumbnail:{enrolled:"Εγγεγραμμένος",scoreCriteria:"Κριτήρια Σκορ",minbet:"Ελάχιστος αριθμός πονταρισμάτων: ",seegames:"Μπορείε να δεις τα παιχνίδια",here:"εδώ",all:"OΛΑ",scheduled:"ΠΡΟΓΡΑΜΜΑΤΙΣΜΕΝΑ",ongoing:"ΤΡΕΧΟΝΤΑ",finished:"ΟΛΟΚΛΗΡΩΜΕΝΑ",startingAt:"ΑΡΧΙΖΕΙ",mostRounds:"MostRounds"}}};function jt(n){let r,i,o,s;return{c(){r=t("div"),i=S(n[12]),O(r,"class","Status")},m(e,t){L(e,r,t),_(r,i),o||(s=u(n[15].call(null,r)),o=!0)},p(e,t){4096&t&&C(i,e[12])},d(e){e&&P(r),o=!1,s()}}}function Vt(e){let n,r=e[5]&&Xt(e);return{c(){r&&r.c(),n=S("")},m(e,t){r&&r.m(e,t),L(e,n,t)},p(e,t){e[5]?r?r.p(e,t):(r=Xt(e),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&P(n)}}}function Xt(e){let n,r,i=e[13]("tournamentsThumbnail.enrolled")+"";return{c(){n=t("div"),r=S(i),O(n,"class","Enrolled")},m(e,t){L(e,n,t),_(n,r)},p(e,t){8192&t&&i!==(i=e[13]("tournamentsThumbnail.enrolled")+"")&&C(r,i)},d(e){e&&P(n)}}}function zt(n){let r,i,o,s;return{c(){r=t("div"),O(r,"class",i="CardImg "+("Closing"==n[2]||"Closed"==n[2]?"CardImgFinished":"")),a(r,"background","url('https://i.stack.imgur.com/y9DpT.jpg') center no-repeat")},m(e,t){L(e,r,t),o||(s=u(n[15].call(null,r)),o=!0)},p(e,t){4&t&&i!==(i="CardImg "+("Closing"==e[2]||"Closed"==e[2]?"CardImgFinished":""))&&O(r,"class",i)},d(e){e&&P(r),o=!1,s()}}}function Bt(n){let r,i,o,s;return{c(){r=t("div"),O(r,"class",i="CardImg "+("Closing"==n[2]||"Closed"==n[2]?"CardImgFinished":"")),a(r,"background","url('"+n[4]+"')")},m(e,t){L(e,r,t),o||(s=u(n[15].call(null,r)),o=!0)},p(e,t){4&t&&i!==(i="CardImg "+("Closing"==e[2]||"Closed"==e[2]?"CardImgFinished":""))&&O(r,"class",i),16&t&&a(r,"background","url('"+e[4]+"')")},d(e){e&&P(r),o=!1,s()}}}function Yt(n){let r,i,o,s,a;return{c(){r=t("div"),i=S(n[10]),O(r,"class","Date")},m(e,t){L(e,r,t),_(r,i),s||(a=u(o=n[14].call(null,r,n[1])),s=!0)},p(e,t){1024&t&&C(i,e[10]),o&&m(o.update)&&2&t&&o.update.call(null,e[1])},d(e){e&&P(r),s=!1,a()}}}function Kt(i){let o,s,a,u,l,c,h,f,p,m,d,g,E,n=i[13]("tournamentsThumbnail.scoreCriteria")+"",r=i[13]("tournamentsThumbnail.seegames")+"",y=i[13]("tournamentsThumbnail.here")+"";function b(e){return"BetCount"==e[6]?qt:Ht}let T=b(i),v=T(i);return{c(){o=t("div"),s=t("p"),a=S(n),u=S(":\n "),v.c(),l=w(),c=t("div"),h=t("p"),f=S(r),p=w(),m=t("a"),d=S(y),O(o,"class","ScoreCriteria"),O(m,"href",i[9]),O(m,"target","_blank"),O(c,"class","Games")},m(e,t){var n,r;L(e,o,t),_(o,s),_(s,a),_(s,u),v.m(s,null),L(e,l,t),L(e,c,t),_(c,h),_(h,f),_(h,p),_(h,m),_(m,d),g||(n=m,r=i[20],n.addEventListener("click",r,void 0),E=()=>n.removeEventListener("click",r,void 0),g=!0)},p(e,t){8192&t&&n!==(n=e[13]("tournamentsThumbnail.scoreCriteria")+"")&&C(a,n),T===(T=b(e))&&v?v.p(e,t):(v.d(1),v=T(e),v&&(v.c(),v.m(s,null))),8192&t&&r!==(r=e[13]("tournamentsThumbnail.seegames")+"")&&C(f,r),8192&t&&y!==(y=e[13]("tournamentsThumbnail.here")+"")&&C(d,y),512&t&&O(m,"href",e[9])},d(e){e&&P(o),v.d(),e&&P(l),e&&P(c),g=!1,E()}}}function Ht(e){let n;return{c(){n=S(e[6])},m(e,t){L(e,n,t)},p(e,t){64&t&&C(n,e[6])},d(e){e&&P(n)}}}function qt(e){let n,r,i,o,s,a,u=e[13]("tournamentsThumbnail.mostRounds")+"",l=e[13]("tournamentsThumbnail.minbet")+"";return{c(){n=S(u),r=S("\n ("),i=S(l),o=S(": "),s=S(e[7]),a=S(")")},m(e,t){L(e,n,t),L(e,r,t),L(e,i,t),L(e,o,t),L(e,s,t),L(e,a,t)},p(e,t){8192&t&&u!==(u=e[13]("tournamentsThumbnail.mostRounds")+"")&&C(n,u),8192&t&&l!==(l=e[13]("tournamentsThumbnail.minbet")+"")&&C(i,l),128&t&&C(s,e[7])},d(e){e&&P(n),e&&P(r),e&&P(i),e&&P(o),e&&P(s),e&&P(a)}}}function Zt(e){let n,r,i,o,s,a,u,l,c,h=e[2]&&jt(e),f="true"==e[8]&&Vt(e);function p(e){return e[4]?Bt:zt}let m=p(e),d=m(e),g=e[1]&&Yt(e),E=e[11]&&Kt(e);return{c(){n=t("div"),h&&h.c(),r=w(),f&&f.c(),i=w(),d.c(),o=w(),s=t("div"),a=t("div"),u=S(e[0]),l=w(),g&&g.c(),c=w(),E&&E.c(),this.c=y,O(a,"class","Title"),O(s,"class","Details"),O(n,"class","Thumbnail")},m(e,t){L(e,n,t),h&&h.m(n,null),_(n,r),f&&f.m(n,null),_(n,i),d.m(n,null),_(n,o),_(n,s),_(s,a),_(a,u),_(s,l),g&&g.m(s,null),_(s,c),E&&E.m(s,null)},p(e,[t]){e[2]?h?h.p(e,t):(h=jt(e),h.c(),h.m(n,r)):h&&(h.d(1),h=null),"true"==e[8]?f?f.p(e,t):(f=Vt(e),f.c(),f.m(n,i)):f&&(f.d(1),f=null),m===(m=p(e))&&d?d.p(e,t):(d.d(1),d=m(e),d&&(d.c(),d.m(n,o))),1&t&&C(u,e[0]),e[1]?g?g.p(e,t):(g=Yt(e),g.c(),g.m(s,c)):g&&(g.d(1),g=null),e[11]?E?E.p(e,t):(E=Kt(e),E.c(),E.m(s,null)):E&&(E.d(1),E=null)},i:y,o:y,d(e){e&&P(n),h&&h.d(),f&&f.d(),d.d(),g&&g.d(),E&&E.d()}}}function Wt(e,t,i){let o;var n=xt;e.$$.on_destroy.push(A(n,e=>i(13,o=e)));let{session:r=""}=t,{userid:s=""}=t,{title:a=""}=t,{startdate:u=""}=t,{status:l=""}=t,{tourid:c=""}=t,{thumbnail:h=""}=t,{userenrolled:f=""}=t,{scorecriteria:p=""}=t,{minbetcount:m=""}=t,{showenrolled:d="false"}=t,{gameurl:g=""}=t,{lang:E="en"}=t,y,b=!1,T="";Object.keys(Ft).forEach(e=>{bt(e,Ft[e])});const v=e=>{e.data&&"SessionID"==e.data.type&&i(11,b=!0)},_=(e,t)=>{window.postMessage({type:"tournamentGamesClicked",tourId:t},window.location.href)};return t=()=>(window.addEventListener("message",v,!1),()=>{window.removeEventListener("message",v)}),function(){if(!N)throw new Error("Function called outside component initialization");return N}().$$.on_mount.push(t),e.$$set=e=>{"session"in e&&i(17,r=e.session),"userid"in e&&i(18,s=e.userid),"title"in e&&i(0,a=e.title),"startdate"in e&&i(1,u=e.startdate),"status"in e&&i(2,l=e.status),"tourid"in e&&i(3,c=e.tourid),"thumbnail"in e&&i(4,h=e.thumbnail),"userenrolled"in e&&i(5,f=e.userenrolled),"scorecriteria"in e&&i(6,p=e.scorecriteria),"minbetcount"in e&&i(7,m=e.minbetcount),"showenrolled"in e&&i(8,d=e.showenrolled),"gameurl"in e&&i(9,g=e.gameurl),"lang"in e&&i(19,E=e.lang)},e.$$.update=()=>{131072&e.$$.dirty&&r&&(0<r.length&&"false"!=r?i(11,b=!0):i(11,b=!1))},[a,u,l,c,h,f,p,m,d,g,"",b,T,o,()=>{let e=new Date(u),t=new Intl.DateTimeFormat(E,{month:"long"}).format(e),n=e.getDate(),r=e.toLocaleString(E,{hour:"numeric",minute:"numeric",hour12:!1});i(10,y=`${n} ${t}, `+o("tournamentsThumbnail.startingAt")+` ${r}`)},()=>{"Unstarted"==l&&i(12,T=o("tournamentsThumbnail.scheduled")),"Running"==l&&i(12,T=o("tournamentsThumbnail.ongoing")),"Closed"!=l&&"Closing"!=l||i(12,T=o("tournamentsThumbnail.finished"))},_,r,s,E,()=>_()]}class Qt extends c{constructor(e){super(),this.shadowRoot.innerHTML='<style>*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:"Helvetica Neue", "Helvetica", sans-serif}a{color:#48952a;text-decoration:underline;cursor:pointer}.Thumbnail{position:relative}.Thumbnail .CardImg{height:300px;width:100%;background:url("https://breakthrough.org/wp-content/uploads/2018/10/default-placeholder-image.png");background-repeat:no-repeat;background-position:center;background-size:auto}.Thumbnail .CardImg.CardImgFinished{filter:grayscale(1)}.Thumbnail .Status{background:#000000;display:flex;justify-content:center;align-items:center;position:absolute;top:20px;right:20px;min-height:30px;padding:0 10px;font-size:12px;text-transform:uppercase;z-index:1}.Thumbnail .Enrolled{background:#2B2B5D;color:#aaaabe;display:flex;justify-content:center;align-items:center;position:absolute;top:20px;left:20px;min-height:30px;padding:0 10px;font-size:12px;text-transform:uppercase;z-index:1}.Thumbnail .Details{padding:10px 20px 0}.Thumbnail .Details .Title{font-size:18px;padding-bottom:10px}.Thumbnail .Details .Date{text-transform:uppercase;font-size:12px;padding-bottom:4px}.Thumbnail .Details .ScoreCriteria{font-size:12px;padding-bottom:4px}.Thumbnail .Details .Games{font-size:12px}</style>',l(this,{target:this.shadowRoot,props:function(e){const t={};for(const n of e)t[n.name]=n.value;return t}(this.attributes),customElement:!0},Wt,Zt,n,{session:17,userid:18,title:0,startdate:1,status:2,tourid:3,thumbnail:4,userenrolled:5,scorecriteria:6,minbetcount:7,showenrolled:8,gameurl:9,lang:19}),e&&(e.target&&L(e.target,this,e.anchor),e.props&&(this.$set(e.props),v()))}static get observedAttributes(){return["session","userid","title","startdate","status","tourid","thumbnail","userenrolled","scorecriteria","minbetcount","showenrolled","gameurl","lang"]}get session(){return this.$$.ctx[17]}set session(e){this.$set({session:e}),v()}get userid(){return this.$$.ctx[18]}set userid(e){this.$set({userid:e}),v()}get title(){return this.$$.ctx[0]}set title(e){this.$set({title:e}),v()}get startdate(){return this.$$.ctx[1]}set startdate(e){this.$set({startdate:e}),v()}get status(){return this.$$.ctx[2]}set status(e){this.$set({status:e}),v()}get tourid(){return this.$$.ctx[3]}set tourid(e){this.$set({tourid:e}),v()}get thumbnail(){return this.$$.ctx[4]}set thumbnail(e){this.$set({thumbnail:e}),v()}get userenrolled(){return this.$$.ctx[5]}set userenrolled(e){this.$set({userenrolled:e}),v()}get scorecriteria(){return this.$$.ctx[6]}set scorecriteria(e){this.$set({scorecriteria:e}),v()}get minbetcount(){return this.$$.ctx[7]}set minbetcount(e){this.$set({minbetcount:e}),v()}get showenrolled(){return this.$$.ctx[8]}set showenrolled(e){this.$set({showenrolled:e}),v()}get gameurl(){return this.$$.ctx[9]}set gameurl(e){this.$set({gameurl:e}),v()}get lang(){return this.$$.ctx[19]}set lang(e){this.$set({lang:e}),v()}}return customElements.get("casino-tournaments-thumbnail")||customElements.define("casino-tournaments-thumbnail",Qt),Qt});
4149
2
  //# sourceMappingURL=casino-tournaments-thumbnail.js.map