@everymatrix/player-consents 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/player-consents.js +642 -0
- package/dist/player-consents.js.map +1 -0
- package/index.html +42 -0
- package/index.js +1 -0
- package/package.json +39 -0
- package/public/favicon.png +0 -0
- package/public/reset.css +48 -0
- package/rollup.config.js +59 -0
- package/src/PlayerConsents.svelte +617 -0
- package/src/i18n.js +28 -0
- package/src/images/fa-circle-exclamation.svg.svelte +2 -0
- package/src/index.ts +4 -0
- package/src/translations.js +200 -0
- package/stories/PlayerConsents.stories.js +13 -0
- package/tsconfig.json +6 -0
- package/types/types.ts +41 -0
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).app=t()}(this,(function(){"use strict";function e(){}function t(e){return e()}function r(){return Object.create(null)}function n(e){e.forEach(t)}function o(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function s(t,...r){if(null==t)return e;const n=t.subscribe(...r);return n.unsubscribe?()=>n.unsubscribe():n}function a(e,t){e.appendChild(t)}function l(e,t,r){e.insertBefore(t,r||null)}function c(e){e.parentNode&&e.parentNode.removeChild(e)}function u(e,t){for(let r=0;r<e.length;r+=1)e[r]&&e[r].d(t)}function h(e){return document.createElement(e)}function p(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function f(e){return document.createTextNode(e)}function d(){return f(" ")}function m(e,t,r,n){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}function g(e,t,r){null==r?e.removeAttribute(t):e.getAttribute(t)!==r&&e.setAttribute(t,r)}function E(e,t,r){t in e?e[t]="boolean"==typeof e[t]&&""===r||r:g(e,t,r)}function y(e,t){t=""+t,e.data!==t&&(e.data=t)}function b(e){const t={};for(const r of e)t[r.name]=r.value;return t}let v;function C(e){v=e}
|
|
2
|
+
/**
|
|
3
|
+
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
|
|
4
|
+
* It must be called during the component's initialisation (but doesn't need to live *inside* the component;
|
|
5
|
+
* it can be called from an external module).
|
|
6
|
+
*
|
|
7
|
+
* `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
|
|
8
|
+
*
|
|
9
|
+
* https://svelte.dev/docs#run-time-svelte-onmount
|
|
10
|
+
*/
|
|
11
|
+
function T(e){(function(){if(!v)throw new Error("Function called outside component initialization");return v})().$$.on_mount.push(e)}const H=[],A=[];let w=[];const B=[],N=Promise.resolve();let _=!1;function S(e){w.push(e)}
|
|
12
|
+
// flush() calls callbacks in this order:
|
|
13
|
+
// 1. All beforeUpdate callbacks, in order: parents before children
|
|
14
|
+
// 2. All bind:this callbacks, in reverse order: children before parents.
|
|
15
|
+
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
|
|
16
|
+
// for afterUpdates called during the initial onMount, which are called in
|
|
17
|
+
// reverse order: children before parents.
|
|
18
|
+
// Since callbacks might update component values, which could trigger another
|
|
19
|
+
// call to flush(), the following steps guard against this:
|
|
20
|
+
// 1. During beforeUpdate, any updated components will be added to the
|
|
21
|
+
// dirty_components array and will cause a reentrant call to flush(). Because
|
|
22
|
+
// the flush index is kept outside the function, the reentrant call will pick
|
|
23
|
+
// up where the earlier call left off and go through all dirty components. The
|
|
24
|
+
// current_component value is saved and restored so that the reentrant call will
|
|
25
|
+
// not interfere with the "parent" flush() call.
|
|
26
|
+
// 2. bind:this callbacks cannot trigger new flush() calls.
|
|
27
|
+
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
|
|
28
|
+
// callback called a second time; the seen_callbacks set, outside the flush()
|
|
29
|
+
// function, guarantees this behavior.
|
|
30
|
+
const L=new Set;let P=0;// Do *not* move this inside the flush() function
|
|
31
|
+
function I(){
|
|
32
|
+
// Do not reenter flush while dirty components are updated, as this can
|
|
33
|
+
// result in an infinite loop. Instead, let the inner flush handle it.
|
|
34
|
+
// Reentrancy is ok afterwards for bindings etc.
|
|
35
|
+
if(0!==P)return;const e=v;do{
|
|
36
|
+
// first, call beforeUpdate functions
|
|
37
|
+
// and update components
|
|
38
|
+
try{for(;P<H.length;){const e=H[P];P++,C(e),R(e.$$)}}catch(e){
|
|
39
|
+
// reset dirty state to not end up in a deadlocked state and then rethrow
|
|
40
|
+
throw H.length=0,P=0,e}for(C(null),H.length=0,P=0;A.length;)A.pop()();
|
|
41
|
+
// then, once components are updated, call
|
|
42
|
+
// afterUpdate functions. This may cause
|
|
43
|
+
// subsequent updates...
|
|
44
|
+
for(let e=0;e<w.length;e+=1){const t=w[e];L.has(t)||(
|
|
45
|
+
// ...so guard against infinite loops
|
|
46
|
+
L.add(t),t())}w.length=0}while(H.length);for(;B.length;)B.pop()();_=!1,L.clear(),C(e)}function R(e){if(null!==e.fragment){e.update(),n(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(S)}}
|
|
47
|
+
/**
|
|
48
|
+
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
|
|
49
|
+
*/const O=new Set;function U(e,t){const r=e.$$;null!==r.fragment&&(!function(e){const t=[],r=[];w.forEach((n=>-1===e.indexOf(n)?t.push(n):r.push(n))),r.forEach((e=>e())),w=t}(r.after_update),n(r.on_destroy),r.fragment&&r.fragment.d(t),
|
|
50
|
+
// TODO null out other refs, including component.$$ (but need to
|
|
51
|
+
// preserve final state?)
|
|
52
|
+
r.on_destroy=r.fragment=null,r.ctx=[])}function k(e,t){-1===e.$$.dirty[0]&&(H.push(e),_||(_=!0,N.then(I)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function M(i,s,a,l,u,h,p,f=[-1]){const d=v;C(i);const m=i.$$={fragment:null,ctx:[],
|
|
53
|
+
// state
|
|
54
|
+
props:h,update:e,not_equal:u,bound:r(),
|
|
55
|
+
// lifecycle
|
|
56
|
+
on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(d?d.$$.context:[])),
|
|
57
|
+
// everything else
|
|
58
|
+
callbacks:r(),dirty:f,skip_bound:!1,root:s.target||d.$$.root};p&&p(m.root);let g=!1;if(m.ctx=a?a(i,s.props||{},((e,t,...r)=>{const n=r.length?r[0]:t;return m.ctx&&u(m.ctx[e],m.ctx[e]=n)&&(!m.skip_bound&&m.bound[e]&&m.bound[e](n),g&&k(i,e)),t})):[],m.update(),g=!0,n(m.before_update),
|
|
59
|
+
// `false` as a special case of no DOM component
|
|
60
|
+
m.fragment=!!l&&l(m.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
62
|
+
m.fragment&&m.fragment.l(e),e.forEach(c)}else
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
64
|
+
m.fragment&&m.fragment.c();s.intro&&((E=i.$$.fragment)&&E.i&&(O.delete(E),E.i(y))),function(e,r,i,s){const{fragment:a,after_update:l}=e.$$;a&&a.m(r,i),s||
|
|
65
|
+
// onMount happens before the initial afterUpdate
|
|
66
|
+
S((()=>{const r=e.$$.on_mount.map(t).filter(o);
|
|
67
|
+
// if the component was destroyed immediately
|
|
68
|
+
// it will update the `$$.on_destroy` reference to `null`.
|
|
69
|
+
// the destructured on_destroy may still reference to the old array
|
|
70
|
+
e.$$.on_destroy?e.$$.on_destroy.push(...r):
|
|
71
|
+
// Edge case - component was destroyed immediately,
|
|
72
|
+
// most likely as a result of a binding initialising
|
|
73
|
+
n(r),e.$$.on_mount=[]})),l.forEach(S)}(i,s.target,s.anchor,s.customElement),I()}var E,y;C(d)}let j;"function"==typeof HTMLElement&&(j=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(o);
|
|
74
|
+
// @ts-ignore todo: improve typings
|
|
75
|
+
for(const e in this.$$.slotted)
|
|
76
|
+
// @ts-ignore todo: improve typings
|
|
77
|
+
this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,r){this[e]=r}disconnectedCallback(){n(this.$$.on_disconnect)}$destroy(){U(this,1),this.$destroy=e}$on(t,r){
|
|
78
|
+
// TODO should this delegate to addEventListener?
|
|
79
|
+
if(!o(r))return e;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(r),()=>{const e=n.indexOf(r);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});const x=[];
|
|
80
|
+
/**
|
|
81
|
+
* Creates a `Readable` store that allows reading by subscription.
|
|
82
|
+
* @param value initial value
|
|
83
|
+
* @param {StartStopNotifier} [start]
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Create a `Writable` store that allows both updating and reading by subscription.
|
|
87
|
+
* @param {*=}value initial value
|
|
88
|
+
* @param {StartStopNotifier=} start
|
|
89
|
+
*/
|
|
90
|
+
function G(t,r=e){let n;const o=new Set;function s(e){if(i(t,e)&&(t=e,n)){// store is ready
|
|
91
|
+
const e=!x.length;for(const e of o)e[1](),x.push(e,t);if(e){for(let e=0;e<x.length;e+=2)x[e][0](x[e+1]);x.length=0}}}return{set:s,update:function(e){s(e(t))},subscribe:function(i,a=e){const l=[i,a];return o.add(l),1===o.size&&(n=r(s)||e),i(t),()=>{o.delete(l),0===o.size&&n&&(n(),n=null)}}}}function $(t,r,i){const a=!Array.isArray(t),l=a?[t]:t,c=r.length<2;return u=t=>{let i=!1;const u=[];let h=0,p=e;const f=()=>{if(h)return;p();const n=r(a?u[0]:u,t);c?t(n):p=o(n)?n:e},d=l.map(((e,t)=>s(e,(e=>{u[t]=e,h&=~(1<<t),i&&f()}),(()=>{h|=1<<t}))));return i=!0,f(),function(){n(d),p(),
|
|
92
|
+
// We need to set this to false because callbacks can still happen despite having unsubscribed:
|
|
93
|
+
// Callbacks might already be placed in the queue which doesn't know it should no longer
|
|
94
|
+
// invoke this derived store.
|
|
95
|
+
i=!1}},{subscribe:G(i,u).subscribe};var u}var D=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===z}(e)}
|
|
96
|
+
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
97
|
+
(e)};var z="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function F(e,t){return!1!==t.clone&&t.isMergeableObject(e)?Y((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function V(e,t,r){return e.concat(t).map((function(e){return F(e,r)}))}function X(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function K(e,t){try{return t in e}catch(e){return!1}}
|
|
98
|
+
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
99
|
+
function Z(e,t,r){var n={};return r.isMergeableObject(e)&&X(e).forEach((function(t){n[t]=F(e[t],r)})),X(t).forEach((function(o){(function(e,t){return K(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t));// and also unsafe if they're nonenumerable.
|
|
100
|
+
})(e,o)||(K(e,o)&&r.isMergeableObject(t[o])?n[o]=function(e,t){if(!t.customMerge)return Y;var r=t.customMerge(e);return"function"==typeof r?r:Y}(o,r)(e[o],t[o],r):n[o]=F(t[o],r))})),n}function Y(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||V,r.isMergeableObject=r.isMergeableObject||D,
|
|
101
|
+
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
102
|
+
// implementations can use it. The caller may not replace it.
|
|
103
|
+
r.cloneUnlessOtherwiseSpecified=F;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):Z(e,t,r):F(t,r)}Y.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return Y(e,r,t)}),{})};var q=Y,J=function(e,t){return J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},J(e,t)};function W(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Q,ee,te,re=function(){return re=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},re.apply(this,arguments)};function ne(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}
|
|
104
|
+
/**
|
|
105
|
+
* Type Guards
|
|
106
|
+
*/
|
|
107
|
+
function oe(e){return e.type===ee.literal}function ie(e){return e.type===ee.argument}function se(e){return e.type===ee.number}function ae(e){return e.type===ee.date}function le(e){return e.type===ee.time}function ce(e){return e.type===ee.select}function ue(e){return e.type===ee.plural}function he(e){return e.type===ee.pound}function pe(e){return e.type===ee.tag}function fe(e){return!(!e||"object"!=typeof e||e.type!==te.number)}function de(e){return!(!e||"object"!=typeof e||e.type!==te.dateTime)}
|
|
108
|
+
// @generated from regex-gen.ts
|
|
109
|
+
"function"==typeof SuppressedError&&SuppressedError,function(e){
|
|
110
|
+
/** Argument is unclosed (e.g. `{0`) */
|
|
111
|
+
e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",
|
|
112
|
+
/** Argument is empty (e.g. `{}`). */
|
|
113
|
+
e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",
|
|
114
|
+
/** Argument is malformed (e.g. `{foo!}``) */
|
|
115
|
+
e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",
|
|
116
|
+
/** Expect an argument type (e.g. `{foo,}`) */
|
|
117
|
+
e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",
|
|
118
|
+
/** Unsupported argument type (e.g. `{foo,foo}`) */
|
|
119
|
+
e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",
|
|
120
|
+
/** Expect an argument style (e.g. `{foo, number, }`) */
|
|
121
|
+
e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",
|
|
122
|
+
/** The number skeleton is invalid. */
|
|
123
|
+
e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",
|
|
124
|
+
/** The date time skeleton is invalid. */
|
|
125
|
+
e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",
|
|
126
|
+
/** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */
|
|
127
|
+
e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",
|
|
128
|
+
/** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */
|
|
129
|
+
e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",
|
|
130
|
+
/** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */
|
|
131
|
+
e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",
|
|
132
|
+
/** Missing select argument options (e.g. `{foo, select}`) */
|
|
133
|
+
e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",
|
|
134
|
+
/** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */
|
|
135
|
+
e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",
|
|
136
|
+
/** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */
|
|
137
|
+
e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",
|
|
138
|
+
/** Expecting a selector in `select` argument (e.g `{foo, select}`) */
|
|
139
|
+
e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",
|
|
140
|
+
/** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */
|
|
141
|
+
e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",
|
|
142
|
+
/** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */
|
|
143
|
+
e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",
|
|
144
|
+
/**
|
|
145
|
+
* Expecting a message fragment after the `plural` or `selectordinal` selector
|
|
146
|
+
* (e.g. `{foo, plural, one}`)
|
|
147
|
+
*/
|
|
148
|
+
e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",
|
|
149
|
+
/** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */
|
|
150
|
+
e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",
|
|
151
|
+
/**
|
|
152
|
+
* Duplicate selectors in `plural` or `selectordinal` argument.
|
|
153
|
+
* (e.g. {foo, plural, one {#} one {#}})
|
|
154
|
+
*/
|
|
155
|
+
e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",
|
|
156
|
+
/** Duplicate selectors in `select` argument.
|
|
157
|
+
* (e.g. {foo, select, apple {apple} apple {apple}})
|
|
158
|
+
*/
|
|
159
|
+
e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",
|
|
160
|
+
/** Plural or select argument option must have `other` clause. */
|
|
161
|
+
e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",
|
|
162
|
+
/** The tag is malformed. (e.g. `<bold!>foo</bold!>) */
|
|
163
|
+
e[e.INVALID_TAG=23]="INVALID_TAG",
|
|
164
|
+
/** The tag name is invalid. (e.g. `<123>foo</123>`) */
|
|
165
|
+
e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",
|
|
166
|
+
/** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */
|
|
167
|
+
e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",
|
|
168
|
+
/** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */
|
|
169
|
+
e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"}(Q||(Q={})),function(e){
|
|
170
|
+
/**
|
|
171
|
+
* Raw text
|
|
172
|
+
*/
|
|
173
|
+
e[e.literal=0]="literal",
|
|
174
|
+
/**
|
|
175
|
+
* Variable w/o any format, e.g `var` in `this is a {var}`
|
|
176
|
+
*/
|
|
177
|
+
e[e.argument=1]="argument",
|
|
178
|
+
/**
|
|
179
|
+
* Variable w/ number format
|
|
180
|
+
*/
|
|
181
|
+
e[e.number=2]="number",
|
|
182
|
+
/**
|
|
183
|
+
* Variable w/ date format
|
|
184
|
+
*/
|
|
185
|
+
e[e.date=3]="date",
|
|
186
|
+
/**
|
|
187
|
+
* Variable w/ time format
|
|
188
|
+
*/
|
|
189
|
+
e[e.time=4]="time",
|
|
190
|
+
/**
|
|
191
|
+
* Variable w/ select format
|
|
192
|
+
*/
|
|
193
|
+
e[e.select=5]="select",
|
|
194
|
+
/**
|
|
195
|
+
* Variable w/ plural format
|
|
196
|
+
*/
|
|
197
|
+
e[e.plural=6]="plural",
|
|
198
|
+
/**
|
|
199
|
+
* Only possible within plural argument.
|
|
200
|
+
* This is the `#` symbol that will be substituted with the count.
|
|
201
|
+
*/
|
|
202
|
+
e[e.pound=7]="pound",
|
|
203
|
+
/**
|
|
204
|
+
* XML-like tag
|
|
205
|
+
*/
|
|
206
|
+
e[e.tag=8]="tag"}(ee||(ee={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(te||(te={}));var me=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,ge=/(?:[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;
|
|
207
|
+
/**
|
|
208
|
+
* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
209
|
+
* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
|
|
210
|
+
* with some tweaks
|
|
211
|
+
*/
|
|
212
|
+
/**
|
|
213
|
+
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
|
214
|
+
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
215
|
+
* @public
|
|
216
|
+
* @param skeleton skeleton string
|
|
217
|
+
*/
|
|
218
|
+
function Ee(e){var t={};return e.replace(ge,(function(e){var r=e.length;switch(e[0]){
|
|
219
|
+
// Era
|
|
220
|
+
case"G":t.era=4===r?"long":5===r?"narrow":"short";break;
|
|
221
|
+
// Year
|
|
222
|
+
case"y":t.year=2===r?"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");
|
|
223
|
+
// Quarter
|
|
224
|
+
case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");
|
|
225
|
+
// Month
|
|
226
|
+
case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][r-1];break;
|
|
227
|
+
// Week
|
|
228
|
+
case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
|
|
229
|
+
// Weekday
|
|
230
|
+
case"E":t.weekday=4===r?"short":5===r?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;
|
|
231
|
+
// Period
|
|
232
|
+
case"a":// AM, PM
|
|
233
|
+
t.hour12=!0;break;case"b":// am, pm, noon, midnight
|
|
234
|
+
case"B":// flexible day periods
|
|
235
|
+
throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
|
|
236
|
+
// Hour
|
|
237
|
+
case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][r-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][r-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][r-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][r-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");
|
|
238
|
+
// Minute
|
|
239
|
+
case"m":t.minute=["numeric","2-digit"][r-1];break;
|
|
240
|
+
// Second
|
|
241
|
+
case"s":t.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
|
|
242
|
+
// Zone
|
|
243
|
+
case"z":// 1..3, 4: specific non-location format
|
|
244
|
+
t.timeZoneName=r<4?"short":"long";break;case"Z":// 1..3, 4, 5: The ISO8601 varios formats
|
|
245
|
+
case"O":// 1, 4: miliseconds in day short, long
|
|
246
|
+
case"v":// 1, 4: generic non-location format
|
|
247
|
+
case"V":// 1, 2, 3, 4: time zone ID or city
|
|
248
|
+
case"X":// 1, 2, 3, 4: The ISO8601 varios formats
|
|
249
|
+
case"x":// 1, 2, 3, 4: The ISO8601 varios formats
|
|
250
|
+
throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}
|
|
251
|
+
// @generated from regex-gen.ts
|
|
252
|
+
var ye=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var be=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,ve=/^(@+)?(\+|#+)?[rs]?$/g,Ce=/(\*)(0+)|(#+)(0+)|(0+)/g,Te=/^(0+)$/;function He(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(ve,(function(e,r,n){
|
|
253
|
+
// @@@ case
|
|
254
|
+
return"string"!=typeof n?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):"+"===n?t.minimumSignificantDigits=r.length:"#"===r[0]?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+("string"==typeof n?n.length:0)),""})),t}function Ae(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function we(e){
|
|
255
|
+
// Engineering
|
|
256
|
+
var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var r=e.slice(0,2);if("+!"===r?(t.signDisplay="always",e=e.slice(2)):"+?"===r&&(t.signDisplay="exceptZero",e=e.slice(2)),!Te.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function Be(e){var t=Ae(e);return t||{}}
|
|
257
|
+
/**
|
|
258
|
+
* https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
|
|
259
|
+
*/function Ne(e){for(var t={},r=0,n=e;r<n.length;r++){var o=n[r];switch(o.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=o.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=o.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=re(re(re({},t),{notation:"scientific"}),o.options.reduce((function(e,t){return re(re({},e),Be(t))}),{}));continue;case"engineering":t=re(re(re({},t),{notation:"engineering"}),o.options.reduce((function(e,t){return re(re({},e),Be(t))}),{}));continue;case"notation-simple":t.notation="standard";continue;
|
|
260
|
+
// https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h
|
|
261
|
+
case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(o.options[0]);continue;
|
|
262
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
|
|
263
|
+
case"integer-width":if(o.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");o.options[0].replace(Ce,(function(e,r,n,o,i,s){if(r)t.minimumIntegerDigits=n.length;else{if(o&&i)throw new Error("We currently do not support maximum integer digits");if(s)throw new Error("We currently do not support exact integer digits")}return""}));continue}
|
|
264
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
|
|
265
|
+
if(Te.test(o.stem))t.minimumIntegerDigits=o.stem.length;else if(be.test(o.stem)){
|
|
266
|
+
// Precision
|
|
267
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision
|
|
268
|
+
// precision-integer case
|
|
269
|
+
if(o.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");o.stem.replace(be,(function(e,r,n,o,i,s){
|
|
270
|
+
// .000* case (before ICU67 it was .000+)
|
|
271
|
+
return"*"===n?t.minimumFractionDigits=r.length:o&&"#"===o[0]?t.maximumFractionDigits=o.length:i&&s?(t.minimumFractionDigits=i.length,t.maximumFractionDigits=i.length+s.length):(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length),""}));var i=o.options[0];
|
|
272
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
|
|
273
|
+
"w"===i?t=re(re({},t),{trailingZeroDisplay:"stripIfInteger"}):i&&(t=re(re({},t),He(i)))}
|
|
274
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision
|
|
275
|
+
else if(ve.test(o.stem))t=re(re({},t),He(o.stem));else{var s=Ae(o.stem);s&&(t=re(re({},t),s));var a=we(o.stem);a&&(t=re(re({},t),a))}}return t}
|
|
276
|
+
// @generated from time-data-gen.ts
|
|
277
|
+
// prettier-ignore
|
|
278
|
+
var _e,Se={AX:["H"],BQ:["H"],CP:["H"],CZ:["H"],DK:["H"],FI:["H"],ID:["H"],IS:["H"],ML:["H"],NE:["H"],RU:["H"],SE:["H"],SJ:["H"],SK:["H"],AS:["h","H"],BT:["h","H"],DJ:["h","H"],ER:["h","H"],GH:["h","H"],IN:["h","H"],LS:["h","H"],PG:["h","H"],PW:["h","H"],SO:["h","H"],TO:["h","H"],VU:["h","H"],WS:["h","H"],"001":["H","h"],AL:["h","H","hB"],TD:["h","H","hB"],"ca-ES":["H","h","hB"],CF:["H","h","hB"],CM:["H","h","hB"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],LU:["H","h","hB"],NP:["H","h","hB"],PF:["H","h","hB"],SC:["H","h","hB"],SM:["H","h","hB"],SN:["H","h","hB"],TF:["H","h","hB"],VA:["H","h","hB"],CY:["h","H","hb","hB"],GR:["h","H","hb","hB"],CO:["h","H","hB","hb"],DO:["h","H","hB","hb"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],NA:["h","H","hB","hb"],PA:["h","H","hB","hb"],PR:["h","H","hB","hb"],VE:["h","H","hB","hb"],AC:["H","h","hb","hB"],AI:["H","h","hb","hB"],BW:["H","h","hb","hB"],BZ:["H","h","hb","hB"],CC:["H","h","hb","hB"],CK:["H","h","hb","hB"],CX:["H","h","hb","hB"],DG:["H","h","hb","hB"],FK:["H","h","hb","hB"],GB:["H","h","hb","hB"],GG:["H","h","hb","hB"],GI:["H","h","hb","hB"],IE:["H","h","hb","hB"],IM:["H","h","hb","hB"],IO:["H","h","hb","hB"],JE:["H","h","hb","hB"],LT:["H","h","hb","hB"],MK:["H","h","hb","hB"],MN:["H","h","hb","hB"],MS:["H","h","hb","hB"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],PN:["H","h","hb","hB"],SH:["H","h","hb","hB"],SX:["H","h","hb","hB"],TA:["H","h","hb","hB"],ZA:["H","h","hb","hB"],"af-ZA":["H","h","hB","hb"],AR:["H","h","hB","hb"],CL:["H","h","hB","hb"],CR:["H","h","hB","hb"],CU:["H","h","hB","hb"],EA:["H","h","hB","hb"],"es-BO":["H","h","hB","hb"],"es-BR":["H","h","hB","hb"],"es-EC":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"es-PE":["H","h","hB","hb"],GT:["H","h","hB","hb"],HN:["H","h","hB","hb"],IC:["H","h","hB","hb"],KG:["H","h","hB","hb"],KM:["H","h","hB","hb"],LK:["H","h","hB","hb"],MA:["H","h","hB","hb"],MX:["H","h","hB","hb"],NI:["H","h","hB","hb"],PY:["H","h","hB","hb"],SV:["H","h","hB","hb"],UY:["H","h","hB","hb"],JP:["H","h","K"],AD:["H","hB"],AM:["H","hB"],AO:["H","hB"],AT:["H","hB"],AW:["H","hB"],BE:["H","hB"],BF:["H","hB"],BJ:["H","hB"],BL:["H","hB"],BR:["H","hB"],CG:["H","hB"],CI:["H","hB"],CV:["H","hB"],DE:["H","hB"],EE:["H","hB"],FR:["H","hB"],GA:["H","hB"],GF:["H","hB"],GN:["H","hB"],GP:["H","hB"],GW:["H","hB"],HR:["H","hB"],IL:["H","hB"],IT:["H","hB"],KZ:["H","hB"],MC:["H","hB"],MD:["H","hB"],MF:["H","hB"],MQ:["H","hB"],MZ:["H","hB"],NC:["H","hB"],NL:["H","hB"],PM:["H","hB"],PT:["H","hB"],RE:["H","hB"],RO:["H","hB"],SI:["H","hB"],SR:["H","hB"],ST:["H","hB"],TG:["H","hB"],TR:["H","hB"],WF:["H","hB"],YT:["H","hB"],BD:["h","hB","H"],PK:["h","hB","H"],AZ:["H","hB","h"],BA:["H","hB","h"],BG:["H","hB","h"],CH:["H","hB","h"],GE:["H","hB","h"],LI:["H","hB","h"],ME:["H","hB","h"],RS:["H","hB","h"],UA:["H","hB","h"],UZ:["H","hB","h"],XK:["H","hB","h"],AG:["h","hb","H","hB"],AU:["h","hb","H","hB"],BB:["h","hb","H","hB"],BM:["h","hb","H","hB"],BS:["h","hb","H","hB"],CA:["h","hb","H","hB"],DM:["h","hb","H","hB"],"en-001":["h","hb","H","hB"],FJ:["h","hb","H","hB"],FM:["h","hb","H","hB"],GD:["h","hb","H","hB"],GM:["h","hb","H","hB"],GU:["h","hb","H","hB"],GY:["h","hb","H","hB"],JM:["h","hb","H","hB"],KI:["h","hb","H","hB"],KN:["h","hb","H","hB"],KY:["h","hb","H","hB"],LC:["h","hb","H","hB"],LR:["h","hb","H","hB"],MH:["h","hb","H","hB"],MP:["h","hb","H","hB"],MW:["h","hb","H","hB"],NZ:["h","hb","H","hB"],SB:["h","hb","H","hB"],SG:["h","hb","H","hB"],SL:["h","hb","H","hB"],SS:["h","hb","H","hB"],SZ:["h","hb","H","hB"],TC:["h","hb","H","hB"],TT:["h","hb","H","hB"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],VC:["h","hb","H","hB"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],ZM:["h","hb","H","hB"],BO:["H","hB","h","hb"],EC:["H","hB","h","hb"],ES:["H","hB","h","hb"],GQ:["H","hB","h","hb"],PE:["H","hB","h","hb"],AE:["h","hB","hb","H"],"ar-001":["h","hB","hb","H"],BH:["h","hB","hb","H"],DZ:["h","hB","hb","H"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],HK:["h","hB","hb","H"],IQ:["h","hB","hb","H"],JO:["h","hB","hb","H"],KW:["h","hB","hb","H"],LB:["h","hB","hb","H"],LY:["h","hB","hb","H"],MO:["h","hB","hb","H"],MR:["h","hB","hb","H"],OM:["h","hB","hb","H"],PH:["h","hB","hb","H"],PS:["h","hB","hb","H"],QA:["h","hB","hb","H"],SA:["h","hB","hb","H"],SD:["h","hB","hb","H"],SY:["h","hB","hb","H"],TN:["h","hB","hb","H"],YE:["h","hB","hb","H"],AF:["H","hb","hB","h"],LA:["H","hb","hB","h"],CN:["H","hB","hb","h"],LV:["H","hB","hb","h"],TL:["H","hB","hb","h"],"zu-ZA":["H","hB","hb","h"],CD:["hB","H"],IR:["hB","H"],"hi-IN":["hB","h","H"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"te-IN":["hB","h","H"],KH:["hB","h","H","hb"],"ta-IN":["hB","h","hb","H"],BN:["hb","hB","h","H"],MY:["hb","hB","h","H"],ET:["hB","hb","h","H"],"gu-IN":["hB","hb","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],TW:["hB","hb","h","H"],KE:["hB","hb","H","h"],MM:["hB","hb","H","h"],TZ:["hB","hb","H","h"],UG:["hB","hb","H","h"]};
|
|
279
|
+
/**
|
|
280
|
+
* Returns the best matching date time pattern if a date time skeleton
|
|
281
|
+
* pattern is provided with a locale. Follows the Unicode specification:
|
|
282
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns
|
|
283
|
+
* @param skeleton date time skeleton pattern that possibly includes j, J or C
|
|
284
|
+
* @param locale
|
|
285
|
+
*/
|
|
286
|
+
/**
|
|
287
|
+
* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)
|
|
288
|
+
* of the given `locale` to the corresponding time pattern.
|
|
289
|
+
* @param locale
|
|
290
|
+
*/
|
|
291
|
+
function Le(e){var t=e.hourCycle;if(void 0===t&&
|
|
292
|
+
// @ts-ignore hourCycle(s) is not identified yet
|
|
293
|
+
e.hourCycles&&
|
|
294
|
+
// @ts-ignore
|
|
295
|
+
e.hourCycles.length&&(
|
|
296
|
+
// @ts-ignore
|
|
297
|
+
t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}
|
|
298
|
+
// TODO: Once hourCycle is fully supported remove the following with data generation
|
|
299
|
+
var r,n=e.language;return"root"!==n&&(r=e.maximize().region),(Se[r||""]||Se[n||""]||Se["".concat(n,"-001")]||Se["001"])[0]}var Pe=new RegExp("^".concat(me.source,"*")),Ie=new RegExp("".concat(me.source,"*$"));function Re(e,t){return{start:e,end:t}}
|
|
300
|
+
// #region Ponyfills
|
|
301
|
+
// Consolidate these variables up top for easier toggling during debugging
|
|
302
|
+
var Oe=!!String.prototype.startsWith,Ue=!!String.fromCodePoint,ke=!!Object.fromEntries,Me=!!String.prototype.codePointAt,je=!!String.prototype.trimStart,xe=!!String.prototype.trimEnd,Ge=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},$e=!0;try{
|
|
303
|
+
/**
|
|
304
|
+
* legacy Edge or Xbox One browser
|
|
305
|
+
* Unicode flag support: supported
|
|
306
|
+
* Pattern_Syntax support: not supported
|
|
307
|
+
* See https://github.com/formatjs/formatjs/issues/2822
|
|
308
|
+
*/
|
|
309
|
+
$e="a"===(null===(_e=Ye("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===_e?void 0:_e[0])}catch(e){$e=!1}var De,ze=Oe?// Native
|
|
310
|
+
function(e,t,r){return e.startsWith(t,r)}:// For IE11
|
|
311
|
+
function(e,t,r){return e.slice(r,r+t.length)===t},Fe=Ue?String.fromCodePoint:// IE11
|
|
312
|
+
function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r,n="",o=e.length,i=0;o>i;){if((r=e[i++])>1114111)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=
|
|
313
|
+
// native
|
|
314
|
+
ke?Object.fromEntries:// Ponyfill
|
|
315
|
+
function(e){for(var t={},r=0,n=e;r<n.length;r++){var o=n[r],i=o[0],s=o[1];t[i]=s}return t},Xe=Me?// Native
|
|
316
|
+
function(e,t){return e.codePointAt(t)}:// IE 11
|
|
317
|
+
function(e,t){var r=e.length;if(!(t<0||t>=r)){var n,o=e.charCodeAt(t);return o<55296||o>56319||t+1===r||(n=e.charCodeAt(t+1))<56320||n>57343?o:n-56320+(o-55296<<10)+65536}},Ke=je?// Native
|
|
318
|
+
function(e){return e.trimStart()}:// Ponyfill
|
|
319
|
+
function(e){return e.replace(Pe,"")},Ze=xe?// Native
|
|
320
|
+
function(e){return e.trimEnd()}:// Ponyfill
|
|
321
|
+
function(e){return e.replace(Ie,"")};
|
|
322
|
+
// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.
|
|
323
|
+
function Ye(e,t){return new RegExp(e,t)}
|
|
324
|
+
// #endregion
|
|
325
|
+
if($e){
|
|
326
|
+
// Native
|
|
327
|
+
var qe=Ye("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");De=function(e,t){var r;return qe.lastIndex=t,null!==(r=qe.exec(e)[1])&&void 0!==r?r:""}}else
|
|
328
|
+
// IE11
|
|
329
|
+
De=function(e,t){for(var r=[];;){var n=Xe(e,t);if(void 0===n||Qe(n)||et(n))break;r.push(n),t+=n>=65536?2:1}return Fe.apply(void 0,r)};var Je=/** @class */function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,r){for(var n=[];!this.isEOF();){var o=this.char();if(123/* `{` */===o){if((i=this.parseArgument(e,r)).err)return i;n.push(i.val)}else{if(125/* `}` */===o&&e>0)break;if(35/* `#` */!==o||"plural"!==t&&"selectordinal"!==t){if(60/* `<` */===o&&!this.ignoreTag&&47===this.peek()){if(r)break;return this.error(Q.UNMATCHED_CLOSING_TAG,Re(this.clonePosition(),this.clonePosition()))}if(60/* `<` */===o&&!this.ignoreTag&&We(this.peek()||0)){if((i=this.parseTag(e,t)).err)return i;n.push(i.val)}else{var i;if((i=this.parseLiteral(e,t)).err)return i;n.push(i.val)}}else{var s=this.clonePosition();this.bump(),n.push({type:ee.pound,location:Re(s,this.clonePosition())})}}}return{val:n,err:null}},
|
|
330
|
+
/**
|
|
331
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
332
|
+
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
333
|
+
* are accepted:
|
|
334
|
+
*
|
|
335
|
+
* ```
|
|
336
|
+
* tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
|
|
337
|
+
* tagName ::= [a-z] (PENChar)*
|
|
338
|
+
* PENChar ::=
|
|
339
|
+
* "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
|
|
340
|
+
* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
|
|
341
|
+
* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
345
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
346
|
+
* since other tag-based engines like React allow it
|
|
347
|
+
*/
|
|
348
|
+
e.prototype.parseTag=function(e,t){var r=this.clonePosition();this.bump();// `<`
|
|
349
|
+
var n=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))
|
|
350
|
+
// Self closing tag
|
|
351
|
+
return{val:{type:ee.literal,value:"<".concat(n,"/>"),location:Re(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(e+1,t,!0);if(o.err)return o;var i=o.val,s=this.clonePosition();
|
|
352
|
+
// Expecting a close tag
|
|
353
|
+
if(this.bumpIf("</")){if(this.isEOF()||!We(this.char()))return this.error(Q.INVALID_TAG,Re(s,this.clonePosition()));var a=this.clonePosition();return n!==this.parseTagName()?this.error(Q.UNMATCHED_CLOSING_TAG,Re(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:ee.tag,value:n,children:i,location:Re(r,this.clonePosition())},err:null}:this.error(Q.INVALID_TAG,Re(s,this.clonePosition())))}return this.error(Q.UNCLOSED_TAG,Re(r,this.clonePosition()))}return this.error(Q.INVALID_TAG,Re(r,this.clonePosition()))},
|
|
354
|
+
/**
|
|
355
|
+
* This method assumes that the caller has peeked ahead for the first tag character.
|
|
356
|
+
*/
|
|
357
|
+
e.prototype.parseTagName=function(){var e,t=this.offset();// the first tag name character
|
|
358
|
+
for(this.bump();!this.isEOF()&&(45/* '-' */===(e=this.char())||46/* '.' */===e||e>=48&&e<=57/* 0..9 */||95/* '_' */===e||e>=97&&e<=122/** a..z */||e>=65&&e<=90/* A..Z */||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var r=this.clonePosition(),n="";;){var o=this.tryParseQuote(t);if(o)n+=o;else{var i=this.tryParseUnquoted(e,t);if(i)n+=i;else{var s=this.tryParseLeftAngleBracket();if(!s)break;n+=s}}}var a=Re(r,this.clonePosition());return{val:{type:ee.literal,value:n,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60/* `<` */!==this.char()||!this.ignoreTag&&(We(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e;
|
|
359
|
+
/** See `parseTag` function docs. */},
|
|
360
|
+
/**
|
|
361
|
+
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
|
|
362
|
+
* a character that requires quoting (that is, "only where needed"), and works the same in
|
|
363
|
+
* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
|
|
364
|
+
*/
|
|
365
|
+
e.prototype.tryParseQuote=function(e){if(this.isEOF()||39/* `'` */!==this.char())return null;
|
|
366
|
+
// Parse escaped char following the apostrophe, or early return if there is no escaped char.
|
|
367
|
+
// Check if is valid escaped character
|
|
368
|
+
switch(this.peek()){case 39/* `'` */:
|
|
369
|
+
// double quote, should return as a single quote.
|
|
370
|
+
return this.bump(),this.bump(),"'";
|
|
371
|
+
// '{', '<', '>', '}'
|
|
372
|
+
case 123:case 60:case 62:case 125:break;case 35:// '#'
|
|
373
|
+
if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();// apostrophe
|
|
374
|
+
var t=[this.char()];// escaped char
|
|
375
|
+
// read chars until the optional closing apostrophe is found
|
|
376
|
+
for(this.bump();!this.isEOF();){var r=this.char();if(39/* `'` */===r){if(39/* `'` */!==this.peek()){
|
|
377
|
+
// Optional closing apostrophe.
|
|
378
|
+
this.bump();break}t.push(39),
|
|
379
|
+
// Bump one more time because we need to skip 2 characters.
|
|
380
|
+
this.bump()}else t.push(r);this.bump()}return Fe.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var r=this.char();return 60/* `<` */===r||123/* `{` */===r||35/* `#` */===r&&("plural"===t||"selectordinal"===t)||125/* `}` */===r&&e>0?null:(this.bump(),Fe(r))},e.prototype.parseArgument=function(e,t){var r=this.clonePosition();if(this.bump(),// `{`
|
|
381
|
+
this.bumpSpace(),this.isEOF())return this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Re(r,this.clonePosition()));if(125/* `}` */===this.char())return this.bump(),this.error(Q.EMPTY_ARGUMENT,Re(r,this.clonePosition()));
|
|
382
|
+
// argument name
|
|
383
|
+
var n=this.parseIdentifierIfPossible().value;if(!n)return this.error(Q.MALFORMED_ARGUMENT,Re(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Re(r,this.clonePosition()));switch(this.char()){
|
|
384
|
+
// Simple argument: `{name}`
|
|
385
|
+
case 125/* `}` */:// `}`
|
|
386
|
+
return this.bump(),{val:{type:ee.argument,
|
|
387
|
+
// value does not include the opening and closing braces.
|
|
388
|
+
value:n,location:Re(r,this.clonePosition())},err:null};
|
|
389
|
+
// Argument with options: `{name, format, ...}`
|
|
390
|
+
case 44/* `,` */:return this.bump(),// `,`
|
|
391
|
+
this.bumpSpace(),this.isEOF()?this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Re(r,this.clonePosition())):this.parseArgumentOptions(e,t,n,r);default:return this.error(Q.MALFORMED_ARGUMENT,Re(r,this.clonePosition()))}},
|
|
392
|
+
/**
|
|
393
|
+
* Advance the parser until the end of the identifier, if it is currently on
|
|
394
|
+
* an identifier character. Return an empty string otherwise.
|
|
395
|
+
*/
|
|
396
|
+
e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=De(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:Re(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,r,n){var o,i=this.clonePosition(),s=this.parseIdentifierIfPossible().value,a=this.clonePosition();
|
|
397
|
+
// Parse this range:
|
|
398
|
+
// {name, type, style}
|
|
399
|
+
// ^---^
|
|
400
|
+
switch(s){case"":
|
|
401
|
+
// Expecting a style string number, date, time, plural, selectordinal, or select.
|
|
402
|
+
return this.error(Q.EXPECT_ARGUMENT_TYPE,Re(i,a));case"number":case"date":case"time":
|
|
403
|
+
// Parse this range:
|
|
404
|
+
// {name, number, style}
|
|
405
|
+
// ^-------^
|
|
406
|
+
this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var c=this.clonePosition();if((E=this.parseSimpleArgStyleIfPossible()).err)return E;if(0===(f=Ze(E.val)).length)return this.error(Q.EXPECT_ARGUMENT_STYLE,Re(this.clonePosition(),this.clonePosition()));l={style:f,styleLocation:Re(c,this.clonePosition())}}if((y=this.tryParseArgumentClose(n)).err)return y;var u=Re(n,this.clonePosition());
|
|
407
|
+
// Extract style or skeleton
|
|
408
|
+
if(l&&ze(null==l?void 0:l.style,"::",0)){
|
|
409
|
+
// Skeleton starts with `::`.
|
|
410
|
+
var h=Ke(l.style.slice(2));if("number"===s)return(E=this.parseNumberSkeletonFromString(h,l.styleLocation)).err?E:{val:{type:ee.number,value:r,location:u,style:E.val},err:null};if(0===h.length)return this.error(Q.EXPECT_DATE_TIME_SKELETON,u);var p=h;
|
|
411
|
+
// Get "best match" pattern only if locale is passed, if not, let it
|
|
412
|
+
// pass as-is where `parseDateTimeSkeleton()` will throw an error
|
|
413
|
+
// for unsupported patterns.
|
|
414
|
+
this.locale&&(p=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e.charAt(n);if("j"===o){for(var i=0;n+1<e.length&&e.charAt(n+1)===o;)i++,n++;var s=1+(1&i),a=i<2?1:3+(i>>1),l=Le(t);for("H"!=l&&"k"!=l||(a=0);a-- >0;)r+="a";for(;s-- >0;)r=l+r}else r+="J"===o?"H":o}return r}(h,this.locale));var f={type:te.dateTime,pattern:p,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?Ee(p):{}};return{val:{type:"date"===s?ee.date:ee.time,value:r,location:u,style:f},err:null}}
|
|
415
|
+
// Regular style or no style.
|
|
416
|
+
return{val:{type:"number"===s?ee.number:"date"===s?ee.date:ee.time,value:r,location:u,style:null!==(o=null==l?void 0:l.style)&&void 0!==o?o:null},err:null};case"plural":case"selectordinal":case"select":
|
|
417
|
+
// Parse this range:
|
|
418
|
+
// {name, plural, options}
|
|
419
|
+
// ^---------^
|
|
420
|
+
var d=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(Q.EXPECT_SELECT_ARGUMENT_OPTIONS,Re(d,re({},d)));this.bumpSpace();
|
|
421
|
+
// Parse offset:
|
|
422
|
+
// {name, plural, offset:1, options}
|
|
423
|
+
// ^-----^
|
|
424
|
+
// or the first option:
|
|
425
|
+
// {name, plural, one {...} other {...}}
|
|
426
|
+
// ^--^
|
|
427
|
+
var m=this.parseIdentifierIfPossible(),g=0;if("select"!==s&&"offset"===m.value){if(!this.bumpIf(":"))return this.error(Q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Re(this.clonePosition(),this.clonePosition()));var E;if(this.bumpSpace(),(E=this.tryParseDecimalInteger(Q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Q.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return E;
|
|
428
|
+
// Parse another identifier for option parsing
|
|
429
|
+
this.bumpSpace(),m=this.parseIdentifierIfPossible(),g=E.val}var y,b=this.tryParsePluralOrSelectOptions(e,s,t,m);if(b.err)return b;if((y=this.tryParseArgumentClose(n)).err)return y;var v=Re(n,this.clonePosition());return"select"===s?{val:{type:ee.select,value:r,options:Ve(b.val),location:v},err:null}:{val:{type:ee.plural,value:r,options:Ve(b.val),offset:g,pluralType:"plural"===s?"cardinal":"ordinal",location:v},err:null};default:return this.error(Q.INVALID_ARGUMENT_TYPE,Re(i,a))}},e.prototype.tryParseArgumentClose=function(e){
|
|
430
|
+
// Parse: {value, number, ::currency/GBP }
|
|
431
|
+
return this.isEOF()||125/* `}` */!==this.char()?this.error(Q.EXPECT_ARGUMENT_CLOSING_BRACE,Re(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},
|
|
432
|
+
/**
|
|
433
|
+
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
|
|
434
|
+
*/
|
|
435
|
+
e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39/* `'` */:
|
|
436
|
+
// Treat apostrophe as quoting but include it in the style part.
|
|
437
|
+
// Find the end of the quoted literal text.
|
|
438
|
+
this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(Q.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Re(r,this.clonePosition()));this.bump();break;case 123/* `{` */:e+=1,this.bump();break;case 125/* `}` */:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var r=[];try{r=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");
|
|
439
|
+
// Parse the skeleton
|
|
440
|
+
for(var t=[],r=0,n=e.split(ye).filter((function(e){return e.length>0}));r<n.length;r++){var o=n[r].split("/");if(0===o.length)throw new Error("Invalid number skeleton");for(var i=o[0],s=o.slice(1),a=0,l=s;a<l.length;a++)if(0===l[a].length)throw new Error("Invalid number skeleton");t.push({stem:i,options:s})}return t}(e)}catch(e){return this.error(Q.INVALID_NUMBER_SKELETON,t)}return{val:{type:te.number,tokens:r,location:t,parsedOptions:this.shouldParseSkeletons?Ne(r):{}},err:null}},
|
|
441
|
+
/**
|
|
442
|
+
* @param nesting_level The current nesting level of messages.
|
|
443
|
+
* This can be positive when parsing message fragment in select or plural argument options.
|
|
444
|
+
* @param parent_arg_type The parent argument's type.
|
|
445
|
+
* @param parsed_first_identifier If provided, this is the first identifier-like selector of
|
|
446
|
+
* the argument. It is a by-product of a previous parsing attempt.
|
|
447
|
+
* @param expecting_close_tag If true, this message is directly or indirectly nested inside
|
|
448
|
+
* between a pair of opening and closing tags. The nested message will not parse beyond
|
|
449
|
+
* the closing tag boundary.
|
|
450
|
+
*/
|
|
451
|
+
e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,n){
|
|
452
|
+
// Parse:
|
|
453
|
+
// one {one apple}
|
|
454
|
+
// ^--^
|
|
455
|
+
for(var o,i=!1,s=[],a=new Set,l=n.value,c=n.location;;){if(0===l.length){var u=this.clonePosition();if("select"===t||!this.bumpIf("="))break;
|
|
456
|
+
// Try parse `={number}` selector
|
|
457
|
+
var h=this.tryParseDecimalInteger(Q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Q.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;c=Re(u,this.clonePosition()),l=this.message.slice(u.offset,this.offset())}
|
|
458
|
+
// Duplicate selector clauses
|
|
459
|
+
if(a.has(l))return this.error("select"===t?Q.DUPLICATE_SELECT_ARGUMENT_SELECTOR:Q.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,c);"other"===l&&(i=!0),
|
|
460
|
+
// Parse:
|
|
461
|
+
// one {one apple}
|
|
462
|
+
// ^----------^
|
|
463
|
+
this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?Q.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:Q.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Re(this.clonePosition(),this.clonePosition()));var f=this.parseMessage(e+1,t,r);if(f.err)return f;var d=this.tryParseArgumentClose(p);if(d.err)return d;s.push([l,{value:f.val,location:Re(p,this.clonePosition())}]),
|
|
464
|
+
// Keep track of the existing selectors
|
|
465
|
+
a.add(l),
|
|
466
|
+
// Prep next selector clause.
|
|
467
|
+
this.bumpSpace(),l=(o=this.parseIdentifierIfPossible()).value,c=o.location}return 0===s.length?this.error("select"===t?Q.EXPECT_SELECT_ARGUMENT_SELECTOR:Q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Re(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(Q.MISSING_OTHER_CLAUSE,Re(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){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(!(s>=48/* `0` */&&s<=57/* `9` */))break;o=!0,i=10*i+(s-48),this.bump()}var a=Re(n,this.clonePosition());return o?Ge(i*=r)?{val:i,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){
|
|
468
|
+
// This is much faster than `Object.assign` or spread.
|
|
469
|
+
return{offset:this.position.offset,line:this.position.line,column:this.position.column}},
|
|
470
|
+
/**
|
|
471
|
+
* Return the code point at the current position of the parser.
|
|
472
|
+
* Throws if the index is out of bound.
|
|
473
|
+
*/
|
|
474
|
+
e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=Xe(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},
|
|
475
|
+
/** Bump the parser to the next UTF-16 code unit. */
|
|
476
|
+
e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10/* '\n' */===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,
|
|
477
|
+
// 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.
|
|
478
|
+
this.position.offset+=e<65536?1:2)}},
|
|
479
|
+
/**
|
|
480
|
+
* If the substring starting at the current position of the parser has
|
|
481
|
+
* the given prefix, then bump the parser to the character immediately
|
|
482
|
+
* following the prefix and return true. Otherwise, don't bump the parser
|
|
483
|
+
* and return false.
|
|
484
|
+
*/
|
|
485
|
+
e.prototype.bumpIf=function(e){if(ze(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},
|
|
486
|
+
/**
|
|
487
|
+
* Bump the parser until the pattern character is found and return `true`.
|
|
488
|
+
* Otherwise bump to the end of the file and return `false`.
|
|
489
|
+
*/
|
|
490
|
+
e.prototype.bumpUntil=function(e){var t=this.offset(),r=this.message.indexOf(e,t);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},
|
|
491
|
+
/**
|
|
492
|
+
* Bump the parser to the target offset.
|
|
493
|
+
* If target offset is beyond the end of the input, bump the parser to the end of the input.
|
|
494
|
+
*/
|
|
495
|
+
e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},
|
|
496
|
+
/** advance the parser through all whitespace to the next non-whitespace code unit. */
|
|
497
|
+
e.prototype.bumpSpace=function(){for(;!this.isEOF()&&Qe(this.char());)this.bump()},
|
|
498
|
+
/**
|
|
499
|
+
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
|
|
500
|
+
* If the input has been exhausted, then this returns null.
|
|
501
|
+
*/
|
|
502
|
+
e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),r=this.message.charCodeAt(t+(e>=65536?2:1));return null!=r?r:null},e}();
|
|
503
|
+
/**
|
|
504
|
+
* This check if codepoint is alphabet (lower & uppercase)
|
|
505
|
+
* @param codepoint
|
|
506
|
+
* @returns
|
|
507
|
+
*/function We(e){return e>=97&&e<=122||e>=65&&e<=90}
|
|
508
|
+
/**
|
|
509
|
+
* Code point equivalent of regex `\p{White_Space}`.
|
|
510
|
+
* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
511
|
+
*/
|
|
512
|
+
function Qe(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}
|
|
513
|
+
/**
|
|
514
|
+
* Code point equivalent of regex `\p{Pattern_Syntax}`.
|
|
515
|
+
* See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
516
|
+
*/function et(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function tt(e){e.forEach((function(e){if(delete e.location,ce(e)||ue(e))for(var t in e.options)delete e.options[t].location,tt(e.options[t].value);else se(e)&&fe(e.style)||(ae(e)||le(e))&&de(e.style)?delete e.style.location:pe(e)&&tt(e.children)}))}function rt(e,t){void 0===t&&(t={}),t=re({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new Je(e,t).parse();if(r.err){var n=SyntaxError(Q[r.err.kind]);
|
|
517
|
+
// @ts-expect-error Assign to error object
|
|
518
|
+
throw n.location=r.err.location,
|
|
519
|
+
// @ts-expect-error Assign to error object
|
|
520
|
+
n.originalMessage=r.err.message,n}return(null==t?void 0:t.captureLocation)||tt(r.val),r.val}
|
|
521
|
+
|
|
522
|
+
// Main
|
|
523
|
+
|
|
524
|
+
function nt(e,t){var r=t&&t.cache?t.cache:ht,n=t&&t.serializer?t.serializer:lt;return(t&&t.strategy?t.strategy:at)(e,{cache:r,serializer:n})}
|
|
525
|
+
|
|
526
|
+
// Strategy
|
|
527
|
+
|
|
528
|
+
function ot(e,t,r,n){var o,i=null==(o=n)||"number"==typeof o||"boolean"==typeof o?n:r(n),s=t.get(i);return void 0===s&&(s=e.call(this,n),t.set(i,s)),s}function it(e,t,r){var n=Array.prototype.slice.call(arguments,3),o=r(n),i=t.get(o);return void 0===i&&(i=e.apply(this,n),t.set(o,i)),i}function st(e,t,r,n,o){return r.bind(t,e,n,o)}function at(e,t){return st(e,this,1===e.length?ot:it,t.cache.create(),t.serializer)}
|
|
529
|
+
// Serializer
|
|
530
|
+
var lt=function(){return JSON.stringify(arguments)};
|
|
531
|
+
|
|
532
|
+
// Cache
|
|
533
|
+
|
|
534
|
+
function ct(){this.cache=Object.create(null)}ct.prototype.get=function(e){return this.cache[e]},ct.prototype.set=function(e,t){this.cache[e]=t};var ut,ht={create:function(){
|
|
535
|
+
// @ts-ignore
|
|
536
|
+
return new ct}},pt={variadic:function(e,t){return st(e,this,it,t.cache.create(),t.serializer)},monadic:function(e,t){return st(e,this,ot,t.cache.create(),t.serializer)}};!function(e){
|
|
537
|
+
// When we have a placeholder but no value to format
|
|
538
|
+
e.MISSING_VALUE="MISSING_VALUE",
|
|
539
|
+
// When value supplied is invalid
|
|
540
|
+
e.INVALID_VALUE="INVALID_VALUE",
|
|
541
|
+
// When we need specific Intl API but it's not available
|
|
542
|
+
e.MISSING_INTL_API="MISSING_INTL_API"}(ut||(ut={}));var ft,dt=/** @class */function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.code=r,o.originalMessage=n,o}return W(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),mt=/** @class */function(e){function t(t,r,n,o){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(r,'". Options are "').concat(Object.keys(n).join('", "'),'"'),ut.INVALID_VALUE,o)||this}return W(t,e),t}(dt),gt=/** @class */function(e){function t(t,r,n){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(r),ut.INVALID_VALUE,n)||this}return W(t,e),t}(dt),Et=/** @class */function(e){function t(t,r){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(r,'"'),ut.MISSING_VALUE,r)||this}return W(t,e),t}(dt);function yt(e){return"function"==typeof e}
|
|
543
|
+
// TODO(skeleton): add skeleton support
|
|
544
|
+
function bt(e,t,r,n,o,i,
|
|
545
|
+
// For debugging
|
|
546
|
+
s){
|
|
547
|
+
// Hot path for straight simple msg translations
|
|
548
|
+
if(1===e.length&&oe(e[0]))return[{type:ft.literal,value:e[0].value}];for(var a=[],l=0,c=e;l<c.length;l++){var u=c[l];
|
|
549
|
+
// Exit early for string parts.
|
|
550
|
+
if(oe(u))a.push({type:ft.literal,value:u.value});else
|
|
551
|
+
// TODO: should this part be literal type?
|
|
552
|
+
// Replace `#` in plural rules with the actual numeric value.
|
|
553
|
+
if(he(u))"number"==typeof i&&a.push({type:ft.literal,value:r.getNumberFormat(t).format(i)});else{var h=u.value;
|
|
554
|
+
// Enforce that all required values are provided by the caller.
|
|
555
|
+
if(!o||!(h in o))throw new Et(h,s);var p=o[h];if(ie(u))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?ft.literal:ft.object,value:p});else
|
|
556
|
+
// Recursively format plural and select parts' option — which can be a
|
|
557
|
+
// nested pattern structure. The choosing of the option to use is
|
|
558
|
+
// abstracted-by and delegated-to the part helper object.
|
|
559
|
+
if(ae(u)){var f="string"==typeof u.style?n.date[u.style]:de(u.style)?u.style.parsedOptions:void 0;a.push({type:ft.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(le(u)){f="string"==typeof u.style?n.time[u.style]:de(u.style)?u.style.parsedOptions:n.time.medium;a.push({type:ft.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(se(u)){(f="string"==typeof u.style?n.number[u.style]:fe(u.style)?u.style.parsedOptions:void 0)&&f.scale&&(p*=f.scale||1),a.push({type:ft.literal,value:r.getNumberFormat(t,f).format(p)})}else{if(pe(u)){var d=u.children,m=u.value,g=o[m];if(!yt(g))throw new gt(m,"function",s);var E=g(bt(d,t,r,n,o,i).map((function(e){return e.value})));Array.isArray(E)||(E=[E]),a.push.apply(a,E.map((function(e){return{type:"string"==typeof e?ft.literal:ft.object,value:e}})))}if(ce(u)){if(!(y=u.options[p]||u.options.other))throw new mt(u.value,p,Object.keys(u.options),s);a.push.apply(a,bt(y.value,t,r,n,o))}else if(ue(u)){var y;if(!(y=u.options["=".concat(p)])){if(!Intl.PluralRules)throw new dt('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',ut.MISSING_INTL_API,s);var b=r.getPluralRules(t,{type:u.pluralType}).select(p-(u.offset||0));y=u.options[b]||u.options.other}if(!y)throw new mt(u.value,p,Object.keys(u.options),s);a.push.apply(a,bt(y.value,t,r,n,o,p-(u.offset||0)))}else;}}}return function(e){return e.length<2?e:e.reduce((function(e,t){var r=e[e.length-1];return r&&r.type===ft.literal&&t.type===ft.literal?r.value+=t.value:e.push(t),e}),[])}(a)}
|
|
560
|
+
/*
|
|
561
|
+
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
562
|
+
Copyrights licensed under the New BSD License.
|
|
563
|
+
See the accompanying LICENSE file for terms.
|
|
564
|
+
*/
|
|
565
|
+
// -- MessageFormat --------------------------------------------------------
|
|
566
|
+
function vt(e,t){return t?Object.keys(e).reduce((function(r,n){var o,i;return r[n]=(o=e[n],(i=t[n])?re(re(re({},o||{}),i||{}),Object.keys(o).reduce((function(e,t){return e[t]=re(re({},o[t]),i[t]||{}),e}),{})):o),r}),re({},e)):e}function Ct(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(ft||(ft={}));var Tt=/** @class */function(){function e(t,r,n,o){var i,s=this;if(void 0===r&&(r=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);
|
|
567
|
+
// Hot path for straight simple msg translations
|
|
568
|
+
if(1===t.length)return t[0].value;var r=t.reduce((function(e,t){return e.length&&t.type===ft.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return bt(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:s.resolvedLocale.toString()}},this.getAst=function(){return s.ast},
|
|
569
|
+
// Defined first because it's used to build the format pattern.
|
|
570
|
+
this.locales=r,this.resolvedLocale=e.resolveLocale(r),"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
571
|
+
// Parse string messages into an AST.
|
|
572
|
+
this.ast=e.__parse(t,{ignoreTag:null==o?void 0:o.ignoreTag,locale:this.resolvedLocale})}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");
|
|
573
|
+
// Creates a new object with the specified `formats` merged with the default
|
|
574
|
+
// formats.
|
|
575
|
+
this.formats=vt(e.formats,n),this.formatters=o&&o.formatters||(void 0===(i=this.formatterCache)&&(i={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:nt((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.NumberFormat).bind.apply(e,ne([void 0],t,!1)))}),{cache:Ct(i.number),strategy:pt.variadic}),getDateTimeFormat:nt((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.DateTimeFormat).bind.apply(e,ne([void 0],t,!1)))}),{cache:Ct(i.dateTime),strategy:pt.variadic}),getPluralRules:nt((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.PluralRules).bind.apply(e,ne([void 0],t,!1)))}),{cache:Ct(i.pluralRules),strategy:pt.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(e){var t=Intl.NumberFormat.supportedLocalesOf(e);return t.length>0?new Intl.Locale(t[0]):new Intl.Locale("string"==typeof e?e:e[0])},e.__parse=rt,
|
|
576
|
+
// Default format options used as the prototype of the `formats` provided to the
|
|
577
|
+
// constructor. These are used when constructing the internal Intl.NumberFormat
|
|
578
|
+
// and Intl.DateTimeFormat instances.
|
|
579
|
+
e.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"}}},e}();const Ht={},At=(e,t,r)=>r?(t in Ht||(Ht[t]={}),e in Ht[t]||(Ht[t][e]=r),r):r,wt=(e,t)=>{if(null==t)return;if(t in Ht&&e in Ht[t])return Ht[t][e];const r=qt(t);for(let n=0;n<r.length;n++){const o=St(r[n],e);if(o)return At(e,t,o)}};let Bt;const Nt=G({});function _t(e){return e in Bt}function St(e,t){if(!_t(e))return null;const r=function(e){return Bt[e]||null}(e);return function(e,t){if(null==t)return;if(t in e)return e[t];const r=t.split(".");let n=e;for(let e=0;e<r.length;e++)if("object"==typeof n){if(e>0){const t=r.slice(e,r.length).join(".");if(t in n){n=n[t];break}}n=n[r[e]]}else n=void 0;return n}(r,t)}function Lt(e,...t){delete Ht[e],Nt.update((r=>(r[e]=q.all([r[e]||{},...t]),r)))}$([Nt],(([e])=>Object.keys(e))),Nt.subscribe((e=>Bt=e));const Pt={};function It(e){return Pt[e]}function Rt(e){return null!=e&&qt(e).some((e=>{var t;return null==(t=It(e))?void 0:t.size}))}function Ot(e,t){const r=Promise.all(t.map((t=>(function(e,t){Pt[e].delete(t),0===Pt[e].size&&delete Pt[e]}(e,t),t().then((e=>e.default||e))))));return r.then((t=>Lt(e,...t)))}const Ut={};function kt(e){if(!Rt(e))return e in Ut?Ut[e]:Promise.resolve();const t=function(e){return qt(e).map((e=>{const t=It(e);return[e,t?[...t]:[]]})).filter((([,e])=>e.length>0))}(e);return Ut[e]=Promise.all(t.map((([e,t])=>Ot(e,t)))).then((()=>{if(Rt(e))return kt(e);delete Ut[e]})),Ut[e]}const Mt={fallbackLocale: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,handleMissingMessage:void 0,ignoreTag:!0};function jt(){return Mt}const xt=G(!1);var Gt=Object.defineProperty,$t=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,zt=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable,Xt=(e,t,r)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;let Kt;const Zt=G(null);function Yt(e){return e.split("-").map(((e,t,r)=>r.slice(0,t+1).join("-"))).reverse()}function qt(e,t=jt().fallbackLocale){const r=Yt(e);return t?[...new Set([...r,...Yt(t)])]:r}function Jt(){return null!=Kt?Kt:void 0}Zt.subscribe((e=>{Kt=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const Wt=(Qt=((e,t)=>{for(var r in t||(t={}))Ft.call(t,r)&&Xt(e,r,t[r]);if(zt)for(var r of zt(t))Vt.call(t,r)&&Xt(e,r,t[r]);return e})({},Zt),$t(Qt,Dt({set:e=>{if(e&&function(e){if(null==e)return;const t=qt(e);for(let e=0;e<t.length;e++){const r=t[e];if(_t(r))return r}}(e)&&Rt(e)){const{loadingDelay:t}=jt();let r;return"undefined"!=typeof window&&null!=Jt()&&t?r=window.setTimeout((()=>xt.set(!0)),t):xt.set(!0),kt(e).then((()=>{Zt.set(e)})).finally((()=>{clearTimeout(r),xt.set(!1)}))}return Zt.set(e)}})));var Qt;const er=e=>{const t=Object.create(null);return r=>{const n=JSON.stringify(r);return n in t?t[n]:t[n]=e(r)}};var tr=Object.defineProperty,rr=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,or=Object.prototype.propertyIsEnumerable,ir=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sr=(e,t)=>{for(var r in t||(t={}))nr.call(t,r)&&ir(e,r,t[r]);if(rr)for(var r of rr(t))or.call(t,r)&&ir(e,r,t[r]);return e},ar=(e,t)=>{var r={};for(var n in e)nr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&rr)for(var n of rr(e))t.indexOf(n)<0&&or.call(e,n)&&(r[n]=e[n]);return r};const lr=(e,t)=>{const{formats:r}=jt();if(e in r&&t in r[e])return r[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},cr=er((e=>{var t=e,{locale:r,format:n}=t,o=ar(t,["locale","format"]);if(null==r)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return n&&(o=lr("number",n)),new Intl.NumberFormat(r,o)})),ur=er((e=>{var t=e,{locale:r,format:n}=t,o=ar(t,["locale","format"]);if(null==r)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return n?o=lr("date",n):0===Object.keys(o).length&&(o=lr("date","short")),new Intl.DateTimeFormat(r,o)})),hr=er((e=>{var t=e,{locale:r,format:n}=t,o=ar(t,["locale","format"]);if(null==r)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return n?o=lr("time",n):0===Object.keys(o).length&&(o=lr("time","short")),new Intl.DateTimeFormat(r,o)})),pr=er((
|
|
580
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
581
|
+
(e,t=Jt())=>new Tt(e,t,jt().formats,{ignoreTag:jt().ignoreTag}))),fr=(e,t={})=>{var r,n,o,i;let s=t;"object"==typeof e&&(s=e,e=s.id);const{values:a,locale:l=Jt(),default:c}=s;if(null==l)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let u=wt(e,l);if(u){if("string"!=typeof u)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof u}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),u}else u=null!=(i=null!=(o=null==(n=(r=jt()).handleMissingMessage)?void 0:n.call(r,{locale:l,id:e,defaultValue:c}))?o:c)?i:e;if(!a)return u;let h=u;try{h=pr(u,l).format(a)}catch(t){t instanceof Error&&console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,t.message)}return h},dr=(e,t)=>((e={})=>{var t=e,{locale:r=Jt()}=t,n=ar(t,["locale"]);return hr(sr({locale:r},n))})(t).format(e),mr=(e,t)=>((e={})=>{var t=e,{locale:r=Jt()}=t,n=ar(t,["locale"]);return ur(sr({locale:r},n))})(t).format(e),gr=(e,t)=>((e={})=>{var t=e,{locale:r=Jt()}=t,n=ar(t,["locale"]);return cr(sr({locale:r},n))})(t).format(e),Er=(e,t=Jt())=>wt(e,t),yr=$([Wt,Nt],(()=>fr));function br(e,t){Lt(e,t)}$([Wt],(()=>dr)),$([Wt],(()=>mr)),$([Wt],(()=>gr)),$([Wt,Nt],(()=>Er));const vr={en:{invalidUrl:"Failed to construct 'URL': Invalid URL",fetchConsentsError:"Error: Could not fetch consents.",fetchPlayerConsentsError:"Error: Could not fetch player consents.",fetchConsentsCategoriesError:"Error: Could not fetch consents categories",updateConsentsError:"Error: Could not update consents.",saveChangesError:"Error: Could not save changes.",mustAcceptError:"Mandatory consents must be accepted.",title:"Consents",description:"Here, you can explore and manage your preferences regarding how we collect and utilize your data. Your privacy matters to us, and this tool empowers you to make informed choices about your online experience."},"zh-hk":{invalidUrl:"構建URL失敗:無效的URL",fetchConsentsError:"錯誤:無法獲取同意。",fetchPlayerConsentsError:"錯誤:無法獲取玩家同意。",fetchConsentsCategoriesError:"錯誤:無法獲取同意類別",updateConsentsError:"錯誤:無法更新同意。",saveChangesError:"錯誤:無法保存更改。",mustAcceptError:"必須接受強制同意。",title:"同意",description:"在這裡,您可以探索和管理有關我們如何收集和利用您的數據的偏好。您的隱私對我們很重要,這個工具使您能夠就您的在線體驗做出知情選擇。"},de:{invalidUrl:"Fehler beim Erstellen der URL: Ungültige URL",fetchConsentsError:"Fehler: Konnte Zustimmungen nicht abrufen.",fetchPlayerConsentsError:"Fehler: Spielerzustimmungen konnten nicht abgerufen werden.",fetchConsentsCategoriesError:"Fehler: Zustimmungskategorien konnten nicht abgerufen werden",updateConsentsError:"Fehler: Zustimmungen konnten nicht aktualisiert werden.",saveChangesError:"Fehler: Änderungen konnten nicht gespeichert werden.",mustAcceptError:"Obligatorische Zustimmungen müssen akzeptiert werden.",title:"Zustimmungen",description:"Hier können Sie Ihre Präferenzen erkunden und verwalten, wie wir Ihre Daten sammeln und nutzen. Ihre Privatsphäre ist uns wichtig, und dieses Tool ermöglicht es Ihnen, informierte Entscheidungen über Ihr Online-Erlebnis zu treffen."},it:{invalidUrl:"Impossibile costruire l'URL: URL non valido",fetchConsentsError:"Errore: Impossibile recuperare i consensi.",fetchPlayerConsentsError:"Errore: Impossibile recuperare i consensi del giocatore.",fetchConsentsCategoriesError:"Errore: Impossibile recuperare le categorie di consenso",updateConsentsError:"Errore: Impossibile aggiornare i consensi.",saveChangesError:"Errore: Impossibile salvare le modifiche.",mustAcceptError:"I consensi obbligatori devono essere accettati.",title:"Consenso",description:"Qui puoi esplorare e gestire le tue preferenze su come raccogliamo e utilizziamo i tuoi dati. La tua privacy è importante per noi e questo strumento ti permette di fare scelte informate sul tuo esperienza online."},fr:{invalidUrl:"Impossible de construire l'URL : URL non valide",fetchConsentsError:"Erreur : Impossible de récupérer les consentements.",fetchPlayerConsentsError:"Erreur : Impossible de récupérer les consentements du joueur.",fetchConsentsCategoriesError:"Erreur : Impossible de récupérer les catégories de consentement",updateConsentsError:"Erreur : Impossible de mettre à jour les consentements.",saveChangesError:"Erreur : Impossible d'enregistrer les modifications.",mustAcceptError:"Les consentements obligatoires doivent être acceptés.",title:"Consentements",description:"Ici, vous pouvez explorer et gérer vos préférences concernant la manière dont nous collectons et utilisons vos données. Votre vie privée nous tient à cœur, et cet outil vous permet de prendre des décisions éclairées sur votre expérience en ligne."},es:{invalidUrl:"Error al construir la URL: URL no válida",fetchConsentsError:"Error: No se pudieron obtener los consentimientos.",fetchPlayerConsentsError:"Error: No se pudieron obtener los consentimientos del jugador.",fetchConsentsCategoriesError:"Error: No se pudieron obtener las categorías de consentimiento",updateConsentsError:"Error: No se pudieron actualizar los consentimientos.",saveChangesError:"Error: No se pudieron guardar los cambios.",mustAcceptError:"Se deben aceptar los consentimientos obligatorios.",title:"Consentimientos",description:"Aquí puedes explorar y gestionar tus preferencias sobre cómo recopilamos y utilizamos tus datos. Tu privacidad es importante para nosotros, y esta herramienta te permite tomar decisiones informadas sobre tu experiencia en línea."},el:{invalidUrl:"Αποτυχία κατασκευής URL: Μη έγκυρο URL",fetchConsentsError:"Σφάλμα: Αδυναμία ανάκτησης συναινέσεων.",fetchPlayerConsentsError:"Σφάλμα: Αδυναμία ανάκτησης συναινέσεων παίκτη.",fetchConsentsCategoriesError:"Σφάλμα: Αδυναμία ανάκτησης κατηγοριών συναίνεσης",updateConsentsError:"Σφάλμα: Αδυναμία ενημέρωσης συναινέσεων.",saveChangesError:"Σφάλμα: Αδυναμία αποθήκευσης αλλαγών.",mustAcceptError:"Οι υποχρεωτικές συναινέσεις πρέπει να γίνουν αποδεκτές.",title:"Συναινέσεις",description:"Εδώ μπορείτε να εξερευνήσετε και να διαχειριστείτε τις προτιμήσεις σας σχετικά με τον τρόπο με τον οποίο συλλέγουμε και χρησιμοποιούμε τα δεδομένα σας. Η ιδιωτικότητά σας είναι σημαντική για εμάς, και αυτό το εργαλείο σας επιτρέπει να λαμβάνετε ενημερωμένες αποφάσεις σχετικά με την online εμπειρία σας."},tr:{invalidUrl:"URL oluşturulamadı: Geçersiz URL",fetchConsentsError:"Hata: Onaylar alınamadı.",fetchPlayerConsentsError:"Hata: Oyuncu onayları alınamadı.",fetchConsentsCategoriesError:"Hata: Onay kategorileri alınamadı",updateConsentsError:"Hata: Onaylar güncellenemedi.",saveChangesError:"Hata: Değişiklikler kaydedilemedi.",mustAcceptError:"Zorunlu onaylar kabul edilmelidir.",title:"Onaylar",description:"Burada, verilerinizi nasıl topladığımız ve kullandığımız konusundaki tercihlerinizi keşfedebilir ve yönetebilirsiniz. Gizliliğiniz bizim için önemli ve bu araç, çevrimiçi deneyiminiz hakkında bilinçli kararlar almanıza olanak tanır."},ru:{invalidUrl:"Не удалось построить URL: Неверный URL",fetchConsentsError:"Ошибка: Не удалось получить согласия.",fetchPlayerConsentsError:"Ошибка: Не удалось получить согласия игрока.",fetchConsentsCategoriesError:"Ошибка: Не удалось получить категории согласий",updateConsentsError:"Ошибка: Не удалось обновить согласия.",saveChangesError:"Ошибка: Не удалось сохранить изменения.",mustAcceptError:"Необходимо принять обязательные согласия.",title:"Согласия",description:"Здесь вы можете исследовать и управлять своими предпочтениями относительно того, как мы собираем и используем ваши данные. Ваша конфиденциальность имеет для нас значение, и этот инструмент позволяет вам принимать обоснованные решения о вашем онлайн-опыте."},ro:{invalidUrl:"Nu s-a putut construi URL-ul: URL invalid",fetchConsentsError:"Eroare: Nu s-au putut obține consimțăminte.",fetchPlayerConsentsError:"Eroare: Nu s-au putut obține consimțăminte ale jucătorului.",fetchConsentsCategoriesError:"Eroare: Nu s-au putut obține categoriile de consimțământ",updateConsentsError:"Eroare: Nu s-au putut actualiza consimțăminte.",saveChangesError:"Eroare: Nu s-au putut salva modificările.",mustAcceptError:"Consimțământele obligatorii trebuie acceptate.",title:"Consimțăminte",description:"Aici puteți explora și gestiona preferințele dvs. referitoare la modul în care colectăm și utilizăm datele dvs. Confidențialitatea dvs. este importantă pentru noi, iar acest instrument vă permite să luați decizii informate despre experiența dvs. online."},hr:{invalidUrl:"Neuspjelo sastavljanje URL-a: Nevaljani URL",fetchConsentsError:"Greška: Nije moguće dohvatiti suglasnosti.",fetchPlayerConsentsError:"Greška: Nije moguće dohvatiti suglasnosti igrača.",fetchConsentsCategoriesError:"Greška: Nije moguće dohvatiti kategorije suglasnosti",updateConsentsError:"Greška: Nije moguće ažurirati suglasnosti.",saveChangesError:"Greška: Nije moguće spremiti promjene.",mustAcceptError:"Obavezna suglasnost mora biti prihvaćena.",title:"Suglasnosti",description:"Ovdje možete istražiti i upravljati svojim preferencijama u vezi s načinom na koji prikupljamo i koristimo vaše podatke. Vaša privatnost nam je važna, a ovaj alat omogućuje vam donošenje informiranih odluka o vašem online iskustvu."},hu:{invalidUrl:"Nem sikerült URL-t létrehozni: Érvénytelen URL",fetchConsentsError:"Hiba: Nem sikerült lekérni a hozzájárulásokat.",fetchPlayerConsentsError:"Hiba: Nem sikerült lekérni a játékos hozzájárulásait.",fetchConsentsCategoriesError:"Hiba: Nem sikerült lekérni a hozzájárulás kategóriákat",updateConsentsError:"Hiba: Nem sikerült frissíteni a hozzájárulásokat.",saveChangesError:"Hiba: Nem sikerült menteni a változásokat.",mustAcceptError:"Kötelező hozzájárulásokat el kell fogadni.",title:"Hozzájárulások",description:"Itt felfedezheti és kezelheti az adatainak gyűjtésére és felhasználására vonatkozó preferenciáit. Fontos számunkra a magánélete, és ez az eszköz lehetővé teszi, hogy tájékozott döntéseket hozzon az online élménye kapcsán."},pl:{invalidUrl:"Nie udało się skonstruować URL: Nieprawidłowy URL",fetchConsentsError:"Błąd: Nie można pobrać zgód.",fetchPlayerConsentsError:"Błąd: Nie można pobrać zgód gracza.",fetchConsentsCategoriesError:"Błąd: Nie można pobrać kategorii zgód",updateConsentsError:"Błąd: Nie można zaktualizować zgód.",saveChangesError:"Błąd: Nie można zapisać zmian.",mustAcceptError:"Wymagane zgody muszą zostać zaakceptowane.",title:"Zgody",description:"Tutaj możesz eksplorować i zarządzać swoimi preferencjami dotyczącymi sposobu, w jaki zbieramy i wykorzystujemy Twoje dane. Twoja prywatność jest dla nas ważna, a ten narzędzie pozwala podejmować świadome decyzje dotyczące Twojego doświadczenia online."},pt:{invalidUrl:"Falha ao construir URL: URL inválido",fetchConsentsError:"Erro: Não foi possível obter consentimentos.",fetchPlayerConsentsError:"Erro: Não foi possível obter consentimentos do jogador.",fetchConsentsCategoriesError:"Erro: Não foi possível obter categorias de consentimento",updateConsentsError:"Erro: Não foi possível atualizar consentimentos.",saveChangesError:"Erro: Não foi possível salvar alterações.",mustAcceptError:"Os consentimentos obrigatórios devem ser aceitos.",title:"Consentimentos",description:"Aqui, você pode explorar e gerenciar suas preferências sobre como coletamos e utilizamos seus dados. Sua privacidade é importante para nós, e esta ferramenta permite que você faça escolhas informadas sobre sua experiência online."},sl:{invalidUrl:"Napaka pri gradnji URL: Neveljaven URL",fetchConsentsError:"Napaka: Ne morem pridobiti soglasij.",fetchPlayerConsentsError:"Napaka: Ne morem pridobiti soglasij igralca.",fetchConsentsCategoriesError:"Napaka: Ne morem pridobiti kategorij soglasja",updateConsentsError:"Napaka: Ne morem posodobiti soglasij.",saveChangesError:"Napaka: Spremembe ni mogoče shraniti.",mustAcceptError:"Obvezna soglasja je treba sprejeti.",title:"Soglasja",description:"Tu lahko raziščete in upravljate svoje preference glede načina, kako zbiramo in uporabljamo vaše podatke. Vaša zasebnost nam je pomembna, ta orodje pa vam omogoča, da sprejemate informirane odločitve o svoji spletni izkušnji."},sr:{invalidUrl:"Неуспело конструисање URL-а: Неважећи URL",fetchConsentsError:"Грешка: Није могуће добити сагласности.",fetchPlayerConsentsError:"Грешка: Није могуће добити сагласности играча.",fetchConsentsCategoriesError:"Грешка: Није могуће добити категорије сагласности",updateConsentsError:"Грешка: Није могуће ажурирати сагласности.",saveChangesError:"Грешка: Промене није могуће сачувати.",mustAcceptError:"Обавезне сагласности морају бити прихваћене.",title:"Сагласности",description:"Овде можете истражити и управљати вашим преференцијама у вези са тим како сакупљамо и користимо ваше податке. Ваша приватност је важна за нас, а ова алатка вам омогућава да донесете информисане одлуке о свом онлајн искуству."},"es-mx":{invalidUrl:"Error al construir URL: URL no válida",fetchConsentsError:"Error: No se pudieron obtener los consentimientos.",fetchPlayerConsentsError:"Error: No se pudieron obtener los consentimientos del jugador.",fetchConsentsCategoriesError:"Error: No se pudieron obtener las categorías de consentimiento",updateConsentsError:"Error: No se pudieron actualizar los consentimientos.",saveChangesError:"Error: No se pudieron guardar los cambios.",mustAcceptError:"Se deben aceptar los consentimientos obligatorios.",title:"Consentimientos",description:"Aquí puedes explorar y gestionar tus preferencias sobre cómo recopilamos y utilizamos tus datos. Tu privacidad es importante para nosotros, y esta herramienta te permite tomar decisiones informadas sobre tu experiencia en línea."},"pt-br":{invalidUrl:"Falha ao construir URL: URL inválido",fetchConsentsError:"Erro: Não foi possível obter consentimentos.",fetchPlayerConsentsError:"Erro: Não foi possível obter consentimentos do jogador.",fetchConsentsCategoriesError:"Erro: Não foi possível obter categorias de consentimento",updateConsentsError:"Erro: Não foi possível atualizar consentimentos.",saveChangesError:"Erro: Não foi possível salvar alterações.",mustAcceptError:"Os consentimentos obrigatórios devem ser aceitos.",title:"Consentimentos",description:"Aqui, você pode explorar e gerenciar suas preferências sobre como coletamos e utilizamos seus dados. Sua privacidade é importante para nós, e esta ferramenta permite que você faça escolhas informadas sobre sua experiência online."}};
|
|
582
|
+
/* ../general-animation-loading/src/GeneralAnimationLoading.svelte generated by Svelte v3.59.2 */function Cr(t){let r;return{c(){r=h("div"),r.innerHTML='<section class="LoaderContainer" part="LoaderContainer"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></section>',this.c=e},m(e,n){l(e,r,n),
|
|
583
|
+
/*div5_binding*/t[3](r)},p:e,i:e,o:e,d(e){e&&c(r)
|
|
584
|
+
/*div5_binding*/,t[3](null)}}}function Tr(e,t,r){let n,{clientstyling:o=""}=t,{clientstylingurl:i=""}=t;return e.$$set=e=>{"clientstyling"in e&&r(1,o=e.clientstyling),"clientstylingurl"in e&&r(2,i=e.clientstylingurl)},e.$$.update=()=>{/*clientstyling, customStylingContainer*/3&e.$$.dirty&&o&&n&&(()=>{let e=document.createElement("style");e.innerHTML=o,n.appendChild(e)})(),/*clientstylingurl, customStylingContainer*/5&e.$$.dirty&&i&&n&&(()=>{let e=new URL(i),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{n.appendChild(t)}),1),setTimeout((()=>{}),500)}))})()},[n,o,i,function(e){A[e?"unshift":"push"]((()=>{n=e,r(0,n)}))}]}
|
|
585
|
+
/* src/images/fa-circle-exclamation.svg.svelte generated by Svelte v3.59.2 */
|
|
586
|
+
function Hr(t){let r,n;return{c(){r=p("svg"),n=p("path"),this.c=e,g(n,"d","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"),g(r,"xmlns","http://www.w3.org/2000/svg"),g(r,"viewBox","0 0 512 512")},m(e,t){l(e,r,t),a(r,n)},p:e,i:e,o:e,d(e){e&&c(r)}}}!customElements.get("general-animation-loading")&&customElements.define("general-animation-loading",class extends j{constructor(e){super();const t=document.createElement("style");t.textContent=".LoaderContainer{display:flex;justify-content:center}.lds-ellipsis{display:inline-block;position:relative;width:80px;height:80px}.lds-ellipsis div{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:#d1d1d1;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}",this.shadowRoot.appendChild(t),M(this,{target:this.shadowRoot,props:b(this.attributes),customElement:!0},Tr,Cr,i,{clientstyling:1,clientstylingurl:2},null),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),I()))}static get observedAttributes(){return["clientstyling","clientstylingurl"]}get clientstyling(){return this.$$.ctx[1]}set clientstyling(e){this.$$set({clientstyling:e}),I()}get clientstylingurl(){return this.$$.ctx[2]}set clientstylingurl(e){this.$$set({clientstylingurl:e}),I()}});
|
|
587
|
+
/* src/PlayerConsents.svelte generated by Svelte v3.59.2 */
|
|
588
|
+
function Ar(e,t,r){const n=e.slice();return n[48]=t[r],n[49]=t,n[50]=r,n}function wr(e,t,r){const n=e.slice();return n[51]=t[r],n[52]=t,n[53]=r,n}
|
|
589
|
+
// (375:4) {:else}
|
|
590
|
+
function Br(e){let t,r,n,o=(vr[/*lang*/e[2]].title||vr[/*lang*/e[2]].description)&&Sr(e),i=/*consentsCategories*/e[8],s=[];for(let t=0;t<i.length;t+=1)s[t]=Ur(Ar(e,i,t));let a=/*errorMessage*/e[6]&&kr(e);return{c(){o&&o.c(),t=d();for(let e=0;e<s.length;e+=1)s[e].c();r=d(),a&&a.c(),n=f("")},m(e,i){o&&o.m(e,i),l(e,t,i);for(let t=0;t<s.length;t+=1)s[t]&&s[t].m(e,i);l(e,r,i),a&&a.m(e,i),l(e,n,i)},p(e,l){if(vr[/*lang*/e[2]].title||vr[/*lang*/e[2]].description?o?o.p(e,l):(o=Sr(e),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null),/*consentsList, consentsCategories, initialConsentsState, consentsState, toggleConsent, displayconsentdescription, categoryToggle, toggleCategoryConsents*/64264&l[0]){let t;for(i=/*consentsCategories*/e[8],t=0;t<i.length;t+=1){const n=Ar(e,i,t);s[t]?s[t].p(n,l):(s[t]=Ur(n),s[t].c(),s[t].m(r.parentNode,r))}for(;t<s.length;t+=1)s[t].d(1);s.length=i.length}/*errorMessage*/e[6]?a?a.p(e,l):(a=kr(e),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null)},d(e){o&&o.d(e),e&&c(t),u(s,e),e&&c(r),a&&a.d(e),e&&c(n)}}}
|
|
591
|
+
// (371:25)
|
|
592
|
+
function Nr(e){let t,r,n;return{c(){t=h("div"),r=h("strong"),n=f(/*fatalError*/e[7]),g(r,"class","ErrorMessage"),g(t,"class","ContainerCenter")},m(e,o){l(e,t,o),a(t,r),a(r,n)},p(e,t){/*fatalError*/128&t[0]&&y(n,/*fatalError*/e[7])},d(e){e&&c(t)}}}
|
|
593
|
+
// (369:4) {#if isLoading}
|
|
594
|
+
function _r(e){let t;return{c(){t=h("general-animation-loading"),E(t,"clientstyling",/*clientstyling*/e[0]),E(t,"clientstylingurl",/*clientstylingurl*/e[1])},m(e,r){l(e,t,r)},p(e,r){/*clientstyling*/1&r[0]&&E(t,"clientstyling",/*clientstyling*/e[0]),/*clientstylingurl*/2&r[0]&&E(t,"clientstylingurl",/*clientstylingurl*/e[1])},d(e){e&&c(t)}}}
|
|
595
|
+
// (376:6) {#if TRANSLATIONS[lang]['title'] || TRANSLATIONS[lang]['description']}
|
|
596
|
+
function Sr(e){let t,r,n=vr[/*lang*/e[2]].title&&Lr(e),o=vr[/*lang*/e[2]].description&&Pr(e);return{c(){t=h("div"),n&&n.c(),r=d(),o&&o.c(),g(t,"class","PlayerConsentsHeader")},m(e,i){l(e,t,i),n&&n.m(t,null),a(t,r),o&&o.m(t,null)},p(e,i){vr[/*lang*/e[2]].title?n?n.p(e,i):(n=Lr(e),n.c(),n.m(t,r)):n&&(n.d(1),n=null),vr[/*lang*/e[2]].description?o?o.p(e,i):(o=Pr(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(e){e&&c(t),n&&n.d(),o&&o.d()}}}
|
|
597
|
+
// (378:10) {#if TRANSLATIONS[lang]['title']}
|
|
598
|
+
function Lr(e){let t,r,n=vr[/*lang*/e[2]].title+"";return{c(){t=h("h2"),r=f(n),g(t,"class","PlayerConsentsTitle")},m(e,n){l(e,t,n),a(t,r)},p(e,t){/*lang*/4&t[0]&&n!==(n=vr[/*lang*/e[2]].title+"")&&y(r,n)},d(e){e&&c(t)}}}
|
|
599
|
+
// (381:10) {#if TRANSLATIONS[lang]['description']}
|
|
600
|
+
function Pr(e){let t,r,n=vr[/*lang*/e[2]].description+"";return{c(){t=h("p"),r=f(n),g(t,"class","PlayerConsentsDescription")},m(e,n){l(e,t,n),a(t,r)},p(e,t){/*lang*/4&t[0]&&n!==(n=vr[/*lang*/e[2]].description+"")&&y(r,n)},d(e){e&&c(t)}}}
|
|
601
|
+
// (401:18) {#if consent.mustAccept === true}
|
|
602
|
+
function Ir(e){let t;return{c(){t=h("sup"),t.textContent="*",g(t,"class","ConsentRequired")},m(e,r){l(e,t,r)},d(e){e&&c(t)}}}
|
|
603
|
+
// (405:16) {#if displayconsentdescription === 'true'}
|
|
604
|
+
function Rr(e){let t,r,n=/*consent*/e[51].description+"";return{c(){t=h("p"),r=f(n),g(t,"class","ConsentDescription")},m(e,n){l(e,t,n),a(t,r)},p(e,t){/*consentsList, consentsCategories*/768&t[0]&&n!==(n=/*consent*/e[51].description+"")&&y(r,n)},d(e){e&&c(t)}}}
|
|
605
|
+
// (396:10) {#each consentsList.filter(consent => consent.category.categoryTagCode === category.categoryTagCode) as consent}
|
|
606
|
+
function Or(e){let t,r,o,i,s,u,p,E,b,v,C,T,H,A,w=/*consent*/e[51].friendlyName+"",B=/*consent*/!0===e[51].mustAccept&&Ir(),N=/*displayconsentdescription*/"true"===e[3]&&Rr(e);function _(){
|
|
607
|
+
/*input_change_handler_1*/e[24].call(b,/*consent*/e[51])}function S(){/*change_handler_1*/
|
|
608
|
+
return e[25](/*consent*/e[51])}return{c(){t=h("div"),r=h("div"),o=h("h4"),i=f(w),s=d(),B&&B.c(),u=d(),N&&N.c(),p=d(),E=h("label"),b=h("input"),C=d(),T=h("span"),g(o,"class","ConsentName"),g(r,"class","ConsentContent"),g(b,"type","checkbox"),b.disabled=v=/*consent*/!0===e[51].mustAccept&&/*initialConsentsState*/!0===e[12][/*consent*/e[51].tagCode],g(T,"class","Slider Round"),g(E,"class","ToggleSwitch"),g(t,"class","ConsentItem")},m(n,c){l(n,t,c),a(t,r),a(r,o),a(o,i),a(o,s),B&&B.m(o,null),a(r,u),N&&N.m(r,null),a(t,p),a(t,E),a(E,b),b.checked=/*consentsState*/e[13][/*consent*/e[51].tagCode],a(E,C),a(E,T),H||(A=[m(b,"change",_),m(b,"change",S)],H=!0)},p(t,n){e=t,/*consentsList, consentsCategories*/768&n[0]&&w!==(w=/*consent*/e[51].friendlyName+"")&&y(i,w),/*consent*/!0===e[51].mustAccept?B||(B=Ir(),B.c(),B.m(o,null)):B&&(B.d(1),B=null),/*displayconsentdescription*/"true"===e[3]?N?N.p(e,n):(N=Rr(e),N.c(),N.m(r,null)):N&&(N.d(1),N=null),/*consentsList, consentsCategories, initialConsentsState*/4864&n[0]&&v!==(v=/*consent*/!0===e[51].mustAccept&&/*initialConsentsState*/!0===e[12][/*consent*/e[51].tagCode])&&(b.disabled=v),/*consentsState, consentsList, consentsCategories*/8960&n[0]&&(b.checked=/*consentsState*/e[13][/*consent*/e[51].tagCode])},d(e){e&&c(t),B&&B.d(),N&&N.d(),H=!1,n(A)}}}
|
|
609
|
+
// (386:6) {#each consentsCategories as category}
|
|
610
|
+
function Ur(e){let t,r,o,i,s,p,E,b,v,C,T,H,A,w=/*category*/e[48].friendlyName+"";function B(){
|
|
611
|
+
/*input_change_handler*/e[21].call(E,/*category*/e[48])}function N(){/*change_handler*/
|
|
612
|
+
return e[22](/*category*/e[48])}function _(...t){/*func*/
|
|
613
|
+
return e[23](/*category*/e[48],...t)}let S=/*consentsList*/e[9].filter(_),L=[];for(let t=0;t<S.length;t+=1)L[t]=Or(wr(e,S,t));return{c(){t=h("div"),r=h("div"),o=h("h3"),i=f(w),s=d(),p=h("label"),E=h("input"),b=d(),v=h("span"),C=d(),T=h("div");for(let e=0;e<L.length;e+=1)L[e].c();g(E,"type","checkbox"),g(v,"class","Slider Round"),g(p,"class","ToggleSwitch Big"),g(r,"class","AccordionHeader"),g(T,"class","AccordionContent"),g(t,"class","AccordionItem")},m(n,c){l(n,t,c),a(t,r),a(r,o),a(o,i),a(r,s),a(r,p),a(p,E),E.checked=/*categoryToggle*/e[11][/*category*/e[48].categoryTagCode],a(p,b),a(p,v),a(t,C),a(t,T);for(let e=0;e<L.length;e+=1)L[e]&&L[e].m(T,null);H||(A=[m(E,"change",B),m(E,"change",N)],H=!0)},p(t,r){if(e=t,/*consentsCategories*/256&r[0]&&w!==(w=/*category*/e[48].friendlyName+"")&&y(i,w),/*categoryToggle, consentsCategories*/2304&r[0]&&(E.checked=/*categoryToggle*/e[11][/*category*/e[48].categoryTagCode]),/*consentsList, consentsCategories, initialConsentsState, consentsState, toggleConsent, displayconsentdescription*/45832&r[0]){let t;for(S=/*consentsList*/e[9].filter(_),t=0;t<S.length;t+=1){const n=wr(e,S,t);L[t]?L[t].p(n,r):(L[t]=Or(n),L[t].c(),L[t].m(T,null))}for(;t<L.length;t+=1)L[t].d(1);L.length=S.length}},d(e){e&&c(t),u(L,e),H=!1,n(A)}}}
|
|
614
|
+
// (418:6) { #if errorMessage }
|
|
615
|
+
function kr(e){let t,r,n,o,i;return{c(){t=h("div"),r=h("circle-exclamation-icon"),n=d(),o=h("strong"),i=f(/*errorMessage*/e[6]),g(o,"class","ErrorMessage"),g(t,"class","ConsentErrorContainer")},m(e,s){l(e,t,s),a(t,r),a(t,n),a(t,o),a(o,i)},p(e,t){/*errorMessage*/64&t[0]&&y(i,/*errorMessage*/e[6])},d(e){e&&c(t)}}}function Mr(t){let r,n,o;function i(e,t){/*isLoading*/
|
|
616
|
+
return e[10]?_r:/*fatalError*/e[7]?Nr:Br}let s=i(t),u=s(t);return{c(){r=h("div"),n=h("div"),u.c(),this.c=e,g(n,"class","ConsentsContainer"),g(r,"class",o=/*displayNone*/t[5]?"DisplayNone":"")},m(e,o){l(e,r,o),a(r,n),u.m(n,null),
|
|
617
|
+
/*div0_binding*/t[26](n)},p(e,t){s===(s=i(e))&&u?u.p(e,t):(u.d(1),u=s(e),u&&(u.c(),u.m(n,null))),/*displayNone*/32&t[0]&&o!==(o=/*displayNone*/e[5]?"DisplayNone":"")&&g(r,"class",o)},i:e,o:e,d(e){e&&c(r),u.d(),
|
|
618
|
+
/*div0_binding*/t[26](null)}}}function jr(e,t,r){let n;var o,i;o=yr,i=e=>r(33,n=e),e.$$.on_destroy.push(s(o,i));let a,{session:l=""}=t,{userid:c=""}=t,{endpoint:u=""}=t,{clientstyling:h=""}=t,{clientstylingurl:p=""}=t,{lang:f="en"}=t,{displayconsentdescription:d=""}=t,{translationurl:m=""}=t,g=!1,E=!1,y=!1,b="",v="",C="",H="",w=[],B=[],N=[],_=!0,S=!0,L={},P={},I={},R={};Object.keys(vr).forEach((e=>{br(e,vr[e])}));
|
|
619
|
+
/**
|
|
620
|
+
* Sets the active language by updating the locale.
|
|
621
|
+
*/
|
|
622
|
+
const O=()=>{var e;e=f,Wt.set(e)},U=(e,t=!1)=>{t?r(7,H=e):($(),r(6,C=e))},k=async(e,t,r,o=!1)=>{try{const o=await fetch(e,r);if(!o.ok)throw new Error(n(t));
|
|
623
|
+
// return await response.json();
|
|
624
|
+
const i=await o.json();return y?i:i.filter((e=>!0===e.showOnRegister));
|
|
625
|
+
// If user is not logged in, filter the consents by ShowOnRegister flag
|
|
626
|
+
}catch(e){throw U(e instanceof TypeError?n(t):e.message,o),e}},M=async()=>{const e=new URL(`${u}/api/v1/gm/consents`);
|
|
627
|
+
// The widget can be used at register where the session id does not exists. If session is not set, fetch only the active consents
|
|
628
|
+
if(e.searchParams.append("Status","Active"),!y)return await k(e.href,"fetchConsentsError",{method:"GET"},!0);
|
|
629
|
+
// Get all data if the session id exists
|
|
630
|
+
const t=new URL(`${u}/api/v1/gm/user-consents/${v}`);return await Promise.all([k(e.href,"fetchConsentsError",{method:"GET"},!0),k(t.href,"fetchPlayerConsentsError",{method:"GET",headers:{"X-SessionId":b,"Content-Type":"application/json"}})])},j=e=>{const t=new Map;return e.forEach((e=>{t.has(e.category.categoryTagCode)||t.set(e.category.categoryTagCode,e.category)})),Array.from(t.values())},x=e=>{const t=localStorage.getItem("categoryToggle"+v);if(null===t){const t=e.reduce(((e,t)=>(e[t.categoryTagCode]=!1,e)),{});return localStorage.setItem("categoryToggle"+v,JSON.stringify(t)),t}return JSON.parse(t)},G=()=>{B.forEach((e=>{const t=N.find((t=>t.tagCode===e.tagCode));r(12,I[e.tagCode]=t&&"Accepted"===t.status,I)})),r(13,R=Object.assign({},I))},$=()=>{r(13,R=Object.assign({},I)),r(11,L=Object.assign({},P))},D=async()=>{if(!S)return;S=!1;const e=[],t=[],o=B.filter((e=>!0===e.mustAccept&&(!R[e.tagCode]||!1===R[e.tagCode])));
|
|
631
|
+
// If the user is not logged in, just emit an event with the new consents and return
|
|
632
|
+
if(window.postMessage({type:"HasMandatoryConsents",data:o.length>0}),Object.keys(R).forEach((r=>{const n=N.find((e=>e.tagCode===r));R[r]!==I[r]&&(n?e.push({tagCode:r,status:R[r]?"Accepted":"Denied"}):t.push({tagCode:r,status:R[r]?"Accepted":"Denied"}))})),!y)return localStorage.setItem("categoryToggle"+v,JSON.stringify(L)),P=Object.assign({},L),window.postMessage({type:"NewPlayerConsentData",data:JSON.stringify(t)},window.location.href),void(S=!0);const i=new URL(`${u}/api/v1/gm/user-consents/${v}`);try{const n=await Promise.allSettled([t.length>0&&k(i.href,"updateConsentsError",{method:"POST",headers:{"X-SessionId":b,"Content-Type":"application/json"},body:JSON.stringify({userConsents:t})}),e.length>0&&k(i.href,"updateConsentsError",{method:"PATCH",headers:{"X-SessionId":b,"Content-Type":"application/json"},body:JSON.stringify({userConsents:e})})]);n.forEach(((n,o)=>{if("rejected"===n.status||!1===n.value.ok){const n=o<t.length?t[o]:e[o-t.length];r(13,R[n.tagCode]=I[n.tagCode],R)}})),n.every((e=>"fulfilled"===e.status))&&(localStorage.setItem("categoryToggle"+v,JSON.stringify(L)),P=Object.assign({},L),window.postMessage({type:"PlayerConsentUpdated",success:!0},window.location.href),r(12,I=Object.assign({},R)))}catch(e){U(e instanceof TypeError?n("saveChangesError"):e.message),window.postMessage({type:"PlayerConsentUpdated",success:!1},window.location.href)}finally{S=!0}},z=e=>{B.filter((t=>t.category.categoryTagCode===e)).forEach((t=>{t.mustAccept&&!0===I[t.tagCode]||r(13,R[t.tagCode]=L[e]||!1,R)})),D()},F=e=>{r(11,L[e.categoryTagCode]=!1,L),D()};
|
|
633
|
+
/**
|
|
634
|
+
* Sets translation URL by fetching translation data and updating messages.
|
|
635
|
+
*/
|
|
636
|
+
/**
|
|
637
|
+
* Sets the isMounted flag after a short delay when the component is first rendered.
|
|
638
|
+
*/
|
|
639
|
+
T((()=>{setTimeout((()=>{r(20,E=!0)}),50)}));return e.$$set=e=>{"session"in e&&r(16,l=e.session),"userid"in e&&r(17,c=e.userid),"endpoint"in e&&r(18,u=e.endpoint),"clientstyling"in e&&r(0,h=e.clientstyling),"clientstylingurl"in e&&r(1,p=e.clientstylingurl),"lang"in e&&r(2,f=e.lang),"displayconsentdescription"in e&&r(3,d=e.displayconsentdescription),"translationurl"in e&&r(19,m=e.translationurl)},e.$$.update=()=>{/*isMounted*/1048576&e.$$.dirty[0]&&E&&(l&&(b=l,y=!0),c&&(v=c),(async()=>{try{let e=[],t=[];
|
|
640
|
+
// Consider the case where the widget is used in a non-logged in state
|
|
641
|
+
y?[e,t]=await M():e=await M(),r(10,_=!1),r(9,B=[...e]),r(8,w=j(B).sort(((e,t)=>e.categoryTagCode.localeCompare(t.categoryTagCode)))),r(11,L=x(w)),P=Object.assign({},L),N=[...t],G()}catch(e){throw r(10,_=!1),U(e instanceof TypeError?n("invalidUrl"):e.message,!0),e}})()),/*customStylingContainer, clientstyling, clientstylingurl*/19&e.$$.dirty[0]&&a&&(h&&(()=>{let e=document.createElement("style");e.innerHTML=h,a.appendChild(e)})(),p&&(()=>{try{r(5,g=!0);let e=new URL(p),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{a.appendChild(t)}),1),setTimeout((()=>{r(5,g=!1)}),500)}))}catch(e){const t=e instanceof TypeError?n("invalidUrl"):e.message;U(t)}})()),/*lang*/4&e.$$.dirty[0]&&f&&O(),/*translationurl*/524288&e.$$.dirty[0]&&m&&(()=>{let e=new URL(m);fetch(e.href).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{br(t,e[t])}))})).catch((e=>{console.log(e)}))})()},[h,p,f,d,a,g,C,H,w,B,_,L,I,R,z,F,l,c,u,m,E,function(e){L[e.categoryTagCode]=this.checked,r(11,L)},e=>z(e.categoryTagCode),(e,t)=>t.category.categoryTagCode===e.categoryTagCode,function(e){R[e.tagCode]=this.checked,r(13,R)},e=>F(e.category),function(e){A[e?"unshift":"push"]((()=>{a=e,r(4,a)}))}]}customElements.define("circle-exclamation-icon",class extends j{constructor(e){super(),M(this,{target:this.shadowRoot,props:b(this.attributes),customElement:!0},null,Hr,i,{},null),e&&e.target&&l(e.target,this,e.anchor)}});class xr extends j{constructor(e){super();const t=document.createElement("style");t.textContent='.DisplayNone{display:none}.ContainerCenter{width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:219px}.ErrorMessage{font-size:12px;color:var(--emw--color-error, #ed0909)}.PlayerConsentsHeader{margin-bottom:30px}.AccordionHeader{font-weight:bold;cursor:pointer;border-bottom:1px solid var(--emw--color-gray-50, #cccccc);display:flex;align-items:center;justify-content:space-between}.AccordionItem{margin-bottom:10px}.AccordionContent{display:block;padding:10px 0}.AccordionContent:last-of-type{padding-bottom:0}.ConsentItem{display:flex;width:100%;justify-content:space-between;align-items:center;margin-bottom:20px}.ConsentItem:last-of-type{margin-bottom:0}.ConsentItem .ConsentName{margin:0}.ConsentItem .ConsentDescription{font-size:0.8rem}.ToggleSwitch{position:relative;display:inline-block;width:40px;height:24px}.ToggleSwitch.Big{width:53px;height:30px}.ToggleSwitch.Big .Slider:before{width:22px;height:22px}.ToggleSwitch.Big input:checked+.Slider:before{-webkit-transform:translateX(22px);-ms-transform:translateX(22px);transform:translateX(22px)}.ToggleSwitch input{opacity:0;width:0;height:0}.ToggleSwitch input:checked+.Slider{background-color:var(--emw--color-primary, #307fe2)}.ToggleSwitch input:disabled+.Slider{opacity:0.1}.ToggleSwitch input:checked+.Slider:before{-webkit-transform:translateX(16px);-ms-transform:translateX(16px);transform:translateX(16px)}.ToggleSwitch input:focus+.Slider{box-shadow:0 0 1px var(--emw--color-primary, #307fe2)}.ToggleSwitch .Slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:var(--emw--color-gray-150, #a1a1a1);-webkit-transition:0.4s;transition:0.4s}.ToggleSwitch .Slider:before{position:absolute;content:"";height:16px;width:16px;left:4px;bottom:4px;background-color:var(--emw--color-white, #fff);-webkit-transition:0.4s;transition:0.4s}.ToggleSwitch .Slider.Round{border-radius:34px}.ToggleSwitch .Slider.Round:before{border-radius:50%}.ConsentErrorContainer{display:flex;gap:10px;align-items:center;border:1px dashed var(--emw--color-error, #ed0909);padding:10px;margin-bottom:10px}.ConsentErrorContainer circle-exclamation-icon{width:15px;fill:var(--emw--color-error, #ed0909)}.ConsentRequired{color:var(--emw--color-error, #ed0909)}',this.shadowRoot.appendChild(t),M(this,{target:this.shadowRoot,props:b(this.attributes),customElement:!0},jr,Mr,i,{session:16,userid:17,endpoint:18,clientstyling:0,clientstylingurl:1,lang:2,displayconsentdescription:3,translationurl:19},null,[-1,-1]),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),I()))}static get observedAttributes(){return["session","userid","endpoint","clientstyling","clientstylingurl","lang","displayconsentdescription","translationurl"]}get session(){return this.$$.ctx[16]}set session(e){this.$$set({session:e}),I()}get userid(){return this.$$.ctx[17]}set userid(e){this.$$set({userid:e}),I()}get endpoint(){return this.$$.ctx[18]}set endpoint(e){this.$$set({endpoint:e}),I()}get clientstyling(){return this.$$.ctx[0]}set clientstyling(e){this.$$set({clientstyling:e}),I()}get clientstylingurl(){return this.$$.ctx[1]}set clientstylingurl(e){this.$$set({clientstylingurl:e}),I()}get lang(){return this.$$.ctx[2]}set lang(e){this.$$set({lang:e}),I()}get displayconsentdescription(){return this.$$.ctx[3]}set displayconsentdescription(e){this.$$set({displayconsentdescription:e}),I()}get translationurl(){return this.$$.ctx[19]}set translationurl(e){this.$$set({translationurl:e}),I()}}return!customElements.get("player-consents")&&customElements.define("player-consents",xr),xr}));
|
|
642
|
+
//# sourceMappingURL=player-consents.js.map
|