@everymatrix/player-account-closure 0.0.188 → 0.0.192

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