@everymatrix/casino-challenges-container 0.0.14 → 0.0.16

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.
Files changed (29) hide show
  1. package/dist/casino-challenges-container/casino-challenge-card_5.entry.js +1 -0
  2. package/dist/casino-challenges-container/casino-challenges-container-677ffb33.js +1 -0
  3. package/dist/casino-challenges-container/casino-challenges-container.esm.js +1 -1
  4. package/dist/casino-challenges-container/index-7720ad93.js +2 -0
  5. package/dist/casino-challenges-container/index.esm.js +1 -1
  6. package/dist/cjs/casino-challenge-card_5.cjs.entry.js +3108 -0
  7. package/dist/cjs/{casino-challenges-container-13757ed0.js → casino-challenges-container-50aca824.js} +32 -8
  8. package/dist/cjs/casino-challenges-container.cjs.js +2 -2
  9. package/dist/cjs/{index-2d1d2666.js → index-d5f8d1ee.js} +32 -5
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/collection-manifest.json +12 -0
  13. package/dist/collection/components/casino-challenges-container/casino-challenges-container.js +17 -3
  14. package/dist/collection/utils/locale.utils.js +16 -4
  15. package/dist/collection/utils/types.js +7 -0
  16. package/dist/esm/casino-challenge-card_5.entry.js +3101 -0
  17. package/dist/esm/{casino-challenges-container-e2d42fb0.js → casino-challenges-container-677ffb33.js} +32 -8
  18. package/dist/esm/casino-challenges-container.js +3 -3
  19. package/dist/esm/{index-7cb21c9d.js → index-7720ad93.js} +32 -5
  20. package/dist/esm/index.js +2 -2
  21. package/dist/esm/loader.js +3 -3
  22. package/dist/types/components/casino-challenges-container/casino-challenges-container.d.ts +3 -1
  23. package/dist/types/utils/types.d.ts +28 -1
  24. package/package.json +1 -1
  25. package/dist/casino-challenges-container/casino-challenges-container-e2d42fb0.js +0 -1
  26. package/dist/casino-challenges-container/casino-challenges-container_3.entry.js +0 -1
  27. package/dist/casino-challenges-container/index-7cb21c9d.js +0 -2
  28. package/dist/cjs/casino-challenges-container_3.cjs.entry.js +0 -283
  29. package/dist/esm/casino-challenges-container_3.entry.js +0 -278
@@ -0,0 +1,3108 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d5f8d1ee.js');
6
+ const casinoChallengesContainer = require('./casino-challenges-container-50aca824.js');
7
+
8
+ const DEFAULT_LANGUAGE$1 = 'en';
9
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
10
+ const TRANSLATIONS$1 = {
11
+ en: {
12
+ totalLevels: 'Total levels:',
13
+ level1: 'Level 1:',
14
+ get: 'Get:',
15
+ endsIn: 'Ends In',
16
+ expired: 'Expired',
17
+ viewDetails: 'View details',
18
+ placeBetsOf: 'Place bets of',
19
+ place: 'Place',
20
+ bet: 'bet',
21
+ bets: 'bets',
22
+ minBet: 'min bet',
23
+ forfeited: 'Forfeited',
24
+ finished: 'Finished',
25
+ suspended: 'Suspended',
26
+ start: 'Start',
27
+ resume: 'Resume',
28
+ pause: 'Pause'
29
+ },
30
+ ro: {
31
+ totalLevels: 'Niveluri totale:',
32
+ level1: 'Nivel 1:',
33
+ get: 'Obține:',
34
+ endsIn: 'Se termină în',
35
+ expired: 'Expirat',
36
+ viewDetails: 'Vezi detalii',
37
+ placeBetsOf: 'Plasează pariuri de',
38
+ place: 'Plasare',
39
+ bet: 'pariu',
40
+ bets: 'pariuri',
41
+ minBet: 'pariu minim',
42
+ forfeited: 'Pierdut',
43
+ finished: 'Terminat',
44
+ suspended: 'Suspendat',
45
+ start: 'Start',
46
+ resume: 'Reia',
47
+ pause: 'Pauză'
48
+ },
49
+ fr: {
50
+ totalLevels: 'Niveaux totaux :',
51
+ level1: 'Niveau 1 :',
52
+ get: 'Obtenir :',
53
+ endsIn: 'Se termine dans',
54
+ expired: 'Expiré',
55
+ viewDetails: 'Voir les détails',
56
+ placeBetsOf: 'Placez des paris de',
57
+ place: 'Placer',
58
+ bet: 'pari',
59
+ bets: 'paris',
60
+ minBet: 'mise minimale',
61
+ forfeited: 'Forfait',
62
+ finished: 'Terminé',
63
+ suspended: 'Suspendu',
64
+ start: 'Démarrer',
65
+ resume: 'Reprendre',
66
+ pause: 'Pause'
67
+ },
68
+ ar: {
69
+ totalLevels: 'إجمالي المستويات:',
70
+ level1: 'المستوى 1:',
71
+ get: 'احصل على:',
72
+ endsIn: 'ينتهي في',
73
+ expired: 'منتهي الصلاحية',
74
+ viewDetails: 'عرض التفاصيل',
75
+ placeBetsOf: 'قم بوضع رهانات بقيمة',
76
+ place: 'ضع',
77
+ bet: 'رهان',
78
+ bets: 'رهانات',
79
+ minBet: 'الحد الأدنى للرهان',
80
+ forfeited: 'خاسر',
81
+ finished: 'منتهي',
82
+ suspended: 'معلق',
83
+ start: 'ابدأ',
84
+ resume: 'استئناف',
85
+ pause: 'إيقاف مؤقت'
86
+ },
87
+ hr: {
88
+ totalLevels: 'Ukupno razina:',
89
+ level1: 'Razina 1:',
90
+ get: 'Dobiti:',
91
+ endsIn: 'Završava za',
92
+ expired: 'Isteklo',
93
+ viewDetails: 'Pogledaj detalje',
94
+ placeBetsOf: 'Postavite oklade od',
95
+ place: 'Postavi',
96
+ bet: 'kladnja',
97
+ bets: 'kladnje',
98
+ minBet: 'minimalna oklada',
99
+ forfeited: 'Oduzeto',
100
+ finished: 'Završeno',
101
+ suspended: 'Suspendirano',
102
+ start: 'Počni',
103
+ resume: 'Nastavi',
104
+ pause: 'Pauza'
105
+ }
106
+ };
107
+ const translate$1 = (key, customLang) => {
108
+ const lang = customLang;
109
+ return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
110
+ };
111
+ const getTranslations$1 = (data) => {
112
+ Object.keys(data).forEach((item) => {
113
+ for (let key in data[item]) {
114
+ TRANSLATIONS$1[item][key] = data[item][key];
115
+ }
116
+ });
117
+ };
118
+ const resolveTranslationUrl$1 = async (translationUrl) => {
119
+ if (translationUrl) {
120
+ try {
121
+ const response = await fetch(translationUrl);
122
+ if (!response.ok) {
123
+ throw new Error(`HTTP error! status: ${response.status}`);
124
+ }
125
+ const translations = await response.json();
126
+ getTranslations$1(translations);
127
+ }
128
+ catch (error) {
129
+ console.error('Failed to fetch or parse translations from URL:', error);
130
+ }
131
+ }
132
+ };
133
+
134
+ var EChallengeLevelTargetType;
135
+ (function (EChallengeLevelTargetType) {
136
+ EChallengeLevelTargetType[EChallengeLevelTargetType["Accumulative"] = 0] = "Accumulative";
137
+ EChallengeLevelTargetType[EChallengeLevelTargetType["SingleBet"] = 1] = "SingleBet";
138
+ EChallengeLevelTargetType[EChallengeLevelTargetType["MultipleOneBetSize"] = 2] = "MultipleOneBetSize";
139
+ })(EChallengeLevelTargetType || (EChallengeLevelTargetType = {}));
140
+ var EChallengeRecurrenceType;
141
+ (function (EChallengeRecurrenceType) {
142
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Single"] = 0] = "Single";
143
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Daily"] = 1] = "Daily";
144
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Weekly"] = 2] = "Weekly";
145
+ EChallengeRecurrenceType[EChallengeRecurrenceType["Monthly"] = 3] = "Monthly";
146
+ })(EChallengeRecurrenceType || (EChallengeRecurrenceType = {}));
147
+ var EChallengeRewardType;
148
+ (function (EChallengeRewardType) {
149
+ EChallengeRewardType[EChallengeRewardType["FreeSpins"] = 0] = "FreeSpins";
150
+ EChallengeRewardType[EChallengeRewardType["LuckyWheel"] = 1] = "LuckyWheel";
151
+ EChallengeRewardType[EChallengeRewardType["Leaderboard"] = 2] = "Leaderboard";
152
+ EChallengeRewardType[EChallengeRewardType["Challenge"] = 3] = "Challenge";
153
+ EChallengeRewardType[EChallengeRewardType["Custom"] = 4] = "Custom";
154
+ })(EChallengeRewardType || (EChallengeRewardType = {}));
155
+ var EChallengeProgressStatus;
156
+ (function (EChallengeProgressStatus) {
157
+ EChallengeProgressStatus[EChallengeProgressStatus["Closed"] = 0] = "Closed";
158
+ EChallengeProgressStatus[EChallengeProgressStatus["InProgress"] = 1] = "InProgress";
159
+ EChallengeProgressStatus[EChallengeProgressStatus["Fillup"] = 2] = "Fillup";
160
+ EChallengeProgressStatus[EChallengeProgressStatus["Completed"] = 3] = "Completed";
161
+ })(EChallengeProgressStatus || (EChallengeProgressStatus = {}));
162
+ var EChallengeStatus;
163
+ (function (EChallengeStatus) {
164
+ EChallengeStatus[EChallengeStatus["Started"] = 0] = "Started";
165
+ EChallengeStatus[EChallengeStatus["InProgress"] = 1] = "InProgress";
166
+ EChallengeStatus[EChallengeStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
167
+ EChallengeStatus[EChallengeStatus["Completed"] = 3] = "Completed";
168
+ EChallengeStatus[EChallengeStatus["Expired"] = 4] = "Expired";
169
+ EChallengeStatus[EChallengeStatus["Forfeited"] = 5] = "Forfeited";
170
+ EChallengeStatus[EChallengeStatus["Awaiting"] = 6] = "Awaiting";
171
+ EChallengeStatus[EChallengeStatus["Paused"] = 7] = "Paused";
172
+ })(EChallengeStatus || (EChallengeStatus = {}));
173
+ const ChallengeStatusDictionary = [
174
+ 'started',
175
+ 'inProgress',
176
+ 'pendingLevelReward',
177
+ 'completed',
178
+ 'expired',
179
+ 'forfeited',
180
+ 'awaiting',
181
+ 'paused'
182
+ ];
183
+ var EChallengeTriggerType;
184
+ (function (EChallengeTriggerType) {
185
+ EChallengeTriggerType[EChallengeTriggerType["GameLaunch"] = 0] = "GameLaunch";
186
+ EChallengeTriggerType[EChallengeTriggerType["Reward"] = 1] = "Reward";
187
+ EChallengeTriggerType[EChallengeTriggerType["Manual"] = 2] = "Manual";
188
+ })(EChallengeTriggerType || (EChallengeTriggerType = {}));
189
+ var EChallengeValidityType;
190
+ (function (EChallengeValidityType) {
191
+ EChallengeValidityType[EChallengeValidityType["Period"] = 0] = "Period";
192
+ EChallengeValidityType[EChallengeValidityType["Date"] = 1] = "Date";
193
+ })(EChallengeValidityType || (EChallengeValidityType = {}));
194
+
195
+ function getTimeLeft(endTime) {
196
+ const now = new Date();
197
+ const end = new Date(endTime);
198
+ let diff = end.getTime() - now.getTime();
199
+ if (diff <= 0) {
200
+ return;
201
+ }
202
+ const days = Math.floor(diff / (1000 * 60 * 60 * 24));
203
+ diff -= days * (1000 * 60 * 60 * 24);
204
+ const hours = Math.floor(diff / (1000 * 60 * 60));
205
+ diff -= hours * (1000 * 60 * 60);
206
+ const minutes = Math.floor(diff / (1000 * 60));
207
+ diff -= minutes * (1000 * 60);
208
+ const seconds = Math.floor(diff / 1000);
209
+ const pad = (n) => n.toString().padStart(2, '0');
210
+ return `${pad(days)} : ${pad(hours)} : ${pad(minutes)} : ${pad(seconds)}`;
211
+ }
212
+
213
+ const finishSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEuNjQ0NTQgMTIuMTI2MkMxLjU5ODQyIDEyLjEyNzkgMS41NTEyOSAxMi4xMjI3IDEuNTA0MzIgMTIuMTA5OUMxLjI1NzU3IDEyLjA0MjEgMS4xMTI0OSAxMS43ODcyIDEuMTgwMjIgMTEuNTQwM0wzLjUzMDE2IDIuOTU4N0MzLjU5NzkxIDIuNzEyMSAzLjg1MjIyIDIuNTY2NzQgNC4wOTk3MyAyLjYzNDZDNC4zNDY0NyAyLjcwMjM0IDQuNDkxNTUgMi45NTcyNyA0LjQyMzgyIDMuMjA0MTZMMi4wNzM4OCAxMS43ODU4QzIuMDE5MDIgMTEuOTg1NSAxLjg0MTIzIDEyLjExODggMS42NDQ1NCAxMi4xMjYyWiIgZmlsbD0iIzM2QkEzQiIvPgo8cGF0aCBkPSJNMS41NjMwNCAxMS4yNjM0QzEuNTQ3NjggMTEuMjYzOSAxLjUzMTk4IDExLjI2MjIgMS41MTY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gZmlsbD0iI0Q4OTI0RSIvPgo8cGF0aCBkPSJNNi4yMjU0OCAyLjUwOTk0TDYuMzk0OSAzLjAzMTM2QzYuNDI2NjIgMy4xMjkgNi41MTc2MSAzLjE5NTExIDYuNjIwMjcgMy4xOTUxMUg3LjE2ODUzQzcuMzk4MDkgMy4xOTUxMSA3LjQ5MzU0IDMuNDg4ODYgNy4zMDc4MiAzLjYyMzhMNi44NjQyNyAzLjk0NjA2QzYuNzgxMjEgNC4wMDY0IDYuNzQ2NDYgNC4xMTMzNiA2Ljc3ODE4IDQuMjExTDYuOTQ3NjEgNC43MzI0M0M3LjAxODU0IDQuOTUwNzUgNi43Njg2NiA1LjEzMjMxIDYuNTgyOTQgNC45OTczN0w2LjEzOTM5IDQuNjc1MTFDNi4wNTYzMyA0LjYxNDc3IDUuOTQzODcgNC42MTQ3NyA1Ljg2MDgxIDQuNjc1MTFMNS40MTcyNiA0Ljk5NzM3QzUuMjMxNTQgNS4xMzIzMSA0Ljk4MTY1IDQuOTUwNzUgNS4wNTI1OSA0LjczMjQzTDUuMjIyMDEgNC4yMTFDNS4yNTM3NCA0LjExMzM2IDUuMjE4OTggNC4wMDY0IDUuMTM1OTMgMy45NDYwNkw0LjY5MjM4IDMuNjIzOEM0LjUwNjY2IDMuNDg4ODYgNC42MDIxIDMuMTk1MTEgNC44MzE2NyAzLjE5NTExSDUuMzc5OTNDNS40ODI1OSAzLjE5NTExIDUuNTczNTggMy4xMjkgNS42MDUzIDMuMDMxMzZMNS43NzQ3MiAyLjUwOTk0QzUuODQ1NjYgMi4yOTE2MSA2LjE1NDU0IDIuMjkxNjEgNi4yMjU0OCAyLjUwOTk0WiIgZmlsbD0iI0ZGRURDQyIvPgo8L3N2Zz4K';
216
+
217
+ const casinoChallengeCardCss = ".card {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenges-container (max-width: 576px) {\n .card {\n width: 100%;\n }\n}\n.card:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.card__image {\n width: 100%;\n height: 200px;\n border-radius: 16px 16px 0 0;\n}\n@container challenges-container (max-width: 576px) {\n .card__image {\n height: 224px;\n }\n}\n.card__image.grayed {\n opacity: 0.6;\n}\n.card__title {\n color: var(--emw--color-white, #FFFFFF);\n font-size: var(--emw--font-size-medium, 16px);\n margin: 0 0 10px;\n}\n.card__content {\n padding: 20px;\n}\n.card__button {\n margin-top: 20px;\n width: 100%;\n height: 34px;\n background: transparent;\n text-transform: uppercase;\n border-radius: var(--emw--button-border-radius, 99px);\n border: 2px solid var(--emw--button-border-color, #727672);\n font-size: var(--emw--font-size-x-small, 12px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-secondary, #e9931e);\n}\n.card__button:hover {\n border-color: var(--emw--color-secondary, #e9931e);\n cursor: pointer;\n}\n.card__button.filled {\n background-color: var(--emw--button-background-primary-color, #18CE51);\n color: var(--emw--color-white, #FFFFFF);\n border-color: var(--emw--color-gray-300, #083B17);\n}\n.card__button.filled:hover {\n color: var(--emw--color-gray-300, #083B17);\n border-color: transparent;\n box-shadow: 0 0 4px 0 rgba(188, 252, 177, 0.2), 0 0 20px 0 rgba(0, 183, 79, 0.5);\n}\n.card__button.grayed {\n color: var(--emw--color-gray-50, #E2E2E2);\n}\n.card__button.grayed:hover {\n color: var(--emw--color-white, #FFFFFF);\n border-color: var(--emw--button-primary-border, #24B24E);\n}\n.card__button:hover {\n border-color: var(--emw--color-secondary, #e9931e);\n cursor: pointer;\n}\n.card__button:disabled, .card__button:disabled:hover {\n color: var(--emw--color-gray-50, #E2E2E2);\n cursor: not-allowed;\n border: 2px solid var(--emw--button-border-color, #727672);\n opacity: 0.7;\n}\n.card__badge {\n position: absolute;\n background: var(--emw--color-white, #FFFFFF);\n top: 6px;\n right: 6px;\n border-radius: 30px;\n padding: 2px 12px;\n line-height: 22px;\n font-weight: var(--emw--font-weight-medium, 500);\n font-size: var(--emw--font-size-x-small, 12px);\n box-shadow: 0 4px 4px 0 var(--emw--button-box-shadow-color, rgba(0, 0, 0, 0.25));\n backdrop-filter: blur(20px);\n box-sizing: border-box;\n}\n.card__badge span {\n font-weight: var(--emw--font-weight-bold, 700);\n}\n.card__badge.expired {\n background: var(--emw--background-gray-color, rgba(250, 250, 250, 0.5019607843));\n border: 1px solid var(--emw--border-gray-color, #292C29);\n font-weight: 700;\n}\n.card__badge.completed {\n background: var(--emw--background-success-color, #C9F0D7);\n border: 1px solid var(--emw--border-success-color, #00B74F);\n color: var(--emw--color-gray-300, #083B17);\n font-weight: 700;\n}\n.card__badge.forfeited {\n background: var(--emw--background-errored-color, #FFE1DF);\n border: 1px solid var(--emw--border-errored-color, #D6421E);\n color: var(--emw--errored-color, #850606);\n font-weight: 700;\n}\n.card__badge.paused {\n background: var(--emw--background-warning-color, #F8E4AD);\n border: 1px solid var(--emw--border-warning-color, #EA9018);\n color: var(--emw--warning-color, #6D460A);\n font-weight: 700;\n}\n\n.info-item {\n line-height: 24px;\n font-size: var(--emw--font-size-small, 14px);\n font-weight: var(--emw--font-weight-bold, 700);\n color: var(--emw--color-primary, #1dbf51);\n}\n@container challenges-container (min-width: 576px) {\n .info-item {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: bottom;\n }\n}\n.info-item.grayed {\n color: var(--emw--disabled-color, #727672);\n}\n.info-item__label {\n font-weight: var(--emw--font-weight-medium, 500);\n margin-right: 3px;\n color: var(--emw--color-gray-150, #C8D6CE);\n}\n.info-item__tooltip {\n position: absolute;\n line-height: 22px;\n padding: 8px 12px;\n border-radius: 8px;\n opacity: 1;\n z-index: 200;\n white-space: nowrap;\n font-size: var(--emw--font-size-x-small, 12px);\n font-weight: var(--emw--font-weight-medium, 500);\n color: var(--emw--color-white, #FFFFFF);\n background-color: var(--emw--color-background-secondary, #1B1C2B);\n}\n.info-item__tooltip::before {\n content: \"\";\n position: absolute;\n top: -5px;\n left: 50%;\n transform: translateX(-50%);\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid var(--emw--color-background-secondary, #1B1C2B);\n width: 0;\n height: 0;\n z-index: 201;\n}\n\n.progress {\n background-color: var(--emw--progress-background, rgba(188, 252, 177, 0.1019607843));\n border-radius: 100px;\n height: 20px;\n margin-bottom: 10px;\n position: relative;\n align-content: center;\n padding: 0 2px;\n box-sizing: border-box;\n}\n.progress.paused {\n opacity: 0.5;\n}\n.progress.grayed {\n mix-blend-mode: luminosity;\n}\n.progress__placeholder {\n height: 20px;\n}\n.progress__icon {\n padding-top: 4px;\n}\n.progress__point {\n position: absolute;\n text-align: center;\n font-size: 12px;\n color: var(--emw--color-gray-150, #C8D6CE);\n font-weight: 700;\n line-height: 19px;\n top: 0;\n height: 19px;\n width: 19px;\n border-radius: 50%;\n}\n.progress__point.start {\n left: 0;\n border: 2px solid var(--emw--button-background-primary-color, #18CE51);\n background: linear-gradient(90deg, var(--emw--progress-active-level, #24AA4D) 0%, var(--emw--progress-active-level-secondary, #113F21) 100%);\n}\n.progress__point.end {\n right: 0;\n border: 2px solid var(--emw--dark-green, #1C8D56);\n background: var(--emw--color-gray-300, #083B17);\n opacity: 0.7;\n}\n.progress__point.finished {\n opacity: 1;\n}\n.progress__point.hidden {\n opacity: 0;\n}\n.progress__bar {\n border-radius: 73px;\n height: 16px;\n background: linear-gradient(90deg, var(--emw--secondary-green, #1E654F) 0%, var(--emw--dark-green, #1C8D56) 100%);\n text-align: end;\n color: var(--emw--color-gray-50, #E2E2E2);\n font-size: 11px;\n font-weight: 700;\n line-height: 16px;\n padding-right: 6px;\n box-sizing: border-box;\n}\n.progress__bar.finished {\n text-align: center;\n}";
218
+ const CasinoChallengeCardStyle0 = casinoChallengeCardCss;
219
+
220
+ const CasinoChallengeCard = class {
221
+ constructor(hostRef) {
222
+ index.registerInstance(this, hostRef);
223
+ this.timerExpired = index.createEvent(this, "timerExpired", 7);
224
+ this.calculateTargetValue = (level, currencySymbol) => {
225
+ var _a;
226
+ if (!level)
227
+ return '';
228
+ const minbet = ((_a = level.BetRange) === null || _a === void 0 ? void 0 : _a.MinBet)
229
+ ? `, ${translate$1('minBet', this.language)} ${currencySymbol + level.BetRange.MinBet}`
230
+ : '';
231
+ switch (level.LevelTargetType) {
232
+ case EChallengeLevelTargetType.Accumulative:
233
+ return `${translate$1('placeBetsOf', this.language)} ${currencySymbol + level.DisplayCurrencyTargetTurnover + minbet}`;
234
+ case EChallengeLevelTargetType.SingleBet:
235
+ return `${translate$1('place', this.language)} ${currencySymbol + level.TargetTurnover} ${translate$1('bet', this.language)}`;
236
+ case EChallengeLevelTargetType.MultipleOneBetSize:
237
+ return `${translate$1('place', this.language)} ${level.TargetBetCount} ${translate$1('bets', this.language) + minbet}`;
238
+ }
239
+ };
240
+ this.onMouseEnterHandler = (index, el) => {
241
+ if (el.scrollWidth > el.clientWidth) {
242
+ this.tooltipIndex = index;
243
+ }
244
+ };
245
+ this.onMouseLeaveHandler = () => {
246
+ this.tooltipIndex = null;
247
+ };
248
+ this.getBadgeContent = () => {
249
+ switch (this.challenge.Status) {
250
+ case EChallengeStatus.Expired:
251
+ return translate$1('expired', this.language);
252
+ case EChallengeStatus.Forfeited:
253
+ return translate$1('forfeited', this.language);
254
+ case EChallengeStatus.Completed:
255
+ return translate$1('finished', this.language);
256
+ case EChallengeStatus.Paused:
257
+ return translate$1('suspended', this.language);
258
+ default:
259
+ return this.timeLeft
260
+ ? [translate$1('endsIn', this.language), ' - ', index.h("span", null, this.timeLeft)]
261
+ : translate$1('expired', this.language);
262
+ }
263
+ };
264
+ this.goToDetailsPage = (challengeId) => () => {
265
+ window.postMessage({ type: 'GoToDetailsPage', info: { challengeId, activeTabIndex: this.activeTabIndex } }, window.location.href);
266
+ };
267
+ this.checkAttrs = () => {
268
+ if (!this.endpoint) {
269
+ this.error = 'Endpoint is missing! Please provide a valid endpointURL.';
270
+ this.hasError = true;
271
+ console.error(this.error);
272
+ }
273
+ return this.hasError;
274
+ };
275
+ this.mbSource = undefined;
276
+ this.clientStyling = undefined;
277
+ this.clientStylingUrl = undefined;
278
+ this.translationUrl = '';
279
+ this.language = 'en';
280
+ this.endpoint = '';
281
+ this.domain = '';
282
+ this.session = '';
283
+ this.challenge = undefined;
284
+ this.isUserAuthorized = true;
285
+ this.activeTabIndex = 0;
286
+ this.tooltipIndex = null;
287
+ this.timeLeft = undefined;
288
+ this.error = '';
289
+ this.hasError = false;
290
+ this.actionLoading = false;
291
+ }
292
+ get infoItems() {
293
+ var _a, _b, _c, _d, _e;
294
+ const level = this.isUserAuthorized
295
+ ? (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressStatus.InProgress)
296
+ : (_b = this.challenge) === null || _b === void 0 ? void 0 : _b.LevelProgresses.find((x) => x.OrderNumber === 0);
297
+ if (level) {
298
+ const rewardValue = (_c = level.Rewards) === null || _c === void 0 ? void 0 : _c.slice(0, 2).map((r) => r.RewardDescription).join(' + ');
299
+ return [
300
+ {
301
+ lable: translate$1('totalLevels', this.language),
302
+ value: (_d = this.challenge.LevelProgresses) === null || _d === void 0 ? void 0 : _d.length
303
+ },
304
+ {
305
+ lable: translate$1('level1', this.language),
306
+ value: this.calculateTargetValue(level, (_e = this.challenge) === null || _e === void 0 ? void 0 : _e.CurrencySymbol)
307
+ },
308
+ {
309
+ lable: translate$1('get', this.language),
310
+ value: rewardValue
311
+ }
312
+ ];
313
+ }
314
+ return [];
315
+ }
316
+ handleClientStylingChange(newValue, oldValue) {
317
+ if (newValue != oldValue) {
318
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
319
+ }
320
+ }
321
+ handleClientStylingUrlChange(newValue, oldValue) {
322
+ if (newValue != oldValue) {
323
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
324
+ }
325
+ }
326
+ handleMbSourceChange(newValue, oldValue) {
327
+ if (newValue != oldValue) {
328
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
329
+ }
330
+ }
331
+ connectedCallback() {
332
+ this.timerId = setInterval(() => {
333
+ this.updateTime();
334
+ }, 1000);
335
+ }
336
+ componentWillLoad() {
337
+ if (this.translationUrl) {
338
+ resolveTranslationUrl$1(this.translationUrl);
339
+ }
340
+ this.updateTime();
341
+ }
342
+ componentDidLoad() {
343
+ if (this.stylingContainer) {
344
+ if (this.mbSource)
345
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
346
+ if (this.clientStyling)
347
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
348
+ if (this.clientStylingUrl)
349
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
350
+ }
351
+ }
352
+ disconnectedCallback() {
353
+ if (this.stylingSubscription) {
354
+ this.stylingSubscription.unsubscribe();
355
+ }
356
+ clearInterval(this.timerId);
357
+ }
358
+ updateTime() {
359
+ var _a;
360
+ this.timeLeft = getTimeLeft((_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ExpirationTime);
361
+ if (!this.timeLeft && this.timerExpired) {
362
+ clearInterval(this.timerId);
363
+ this.timerExpired.emit(this.challenge.Id);
364
+ }
365
+ }
366
+ renderInfoItem(item, index$1) {
367
+ return (index.h("div", { class: `info-item ${this.isChallengeGrayed}`, onMouseEnter: (e) => this.onMouseEnterHandler(index$1, e.currentTarget), onMouseLeave: this.onMouseLeaveHandler }, index.h("span", { class: "info-item__label" }, item.lable), item.value, this.tooltipIndex === index$1 && index.h("div", { class: "info-item__tooltip" }, item.value)));
368
+ }
369
+ get getCardBadge() {
370
+ return (index.h("div", { class: `card__badge ${ChallengeStatusDictionary[this.challenge.Status]}` }, this.getBadgeContent()));
371
+ }
372
+ get isChallengeGrayed() {
373
+ return [EChallengeStatus.Expired, EChallengeStatus.Forfeited, EChallengeStatus.Completed].includes(this.challenge.Status)
374
+ ? 'grayed'
375
+ : '';
376
+ }
377
+ get getChallengeProgress() {
378
+ var _a;
379
+ const currLevel = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressStatus.InProgress);
380
+ if (!this.isUserAuthorized || !currLevel)
381
+ return null;
382
+ const { Status, LevelProgresses } = this.challenge;
383
+ if (Status === EChallengeStatus.Expired || Status === EChallengeStatus.Started) {
384
+ return index.h("div", { class: "progress__placeholder" });
385
+ }
386
+ const barValue = Status === EChallengeStatus.Paused
387
+ ? translate$1('suspended', this.language)
388
+ : Status === EChallengeStatus.Completed
389
+ ? translate$1('finished', this.language)
390
+ : `${currLevel.ProgressPercentage}%`;
391
+ const isLastLevel = !LevelProgresses.some((x) => x.OrderNumber > currLevel.OrderNumber);
392
+ const secondImgSrc = Status === EChallengeStatus.Completed ? trophySvg : isLastLevel ? finishSvg : '';
393
+ return (index.h("div", { class: {
394
+ progress: true,
395
+ paused: Status === EChallengeStatus.Paused,
396
+ grayed: Status === EChallengeStatus.Forfeited
397
+ } }, index.h("div", { class: {
398
+ progress__point: true,
399
+ start: true,
400
+ hidden: Status === EChallengeStatus.Completed
401
+ } }, currLevel.OrderNumber + 1), index.h("div", { class: {
402
+ progress__bar: true,
403
+ finished: Status === EChallengeStatus.Completed
404
+ }, style: { width: `${currLevel.ProgressPercentage}%` } }, barValue), index.h("div", { class: {
405
+ progress__point: true,
406
+ end: true,
407
+ finished: Status === EChallengeStatus.Completed
408
+ } }, secondImgSrc ? index.h("img", { class: "progress__icon", src: secondImgSrc }) : currLevel.OrderNumber + 2)));
409
+ }
410
+ get getCardButton() {
411
+ if (this.isUserAuthorized) {
412
+ if (this.challenge.Status === EChallengeStatus.Started) {
413
+ return (index.h("button", { class: "card__button filled", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(true) }, translate$1('start', this.language)));
414
+ }
415
+ if (this.challenge.Status === EChallengeStatus.Paused) {
416
+ return (index.h("button", { class: "card__button grayed", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(true) }, translate$1('resume', this.language)));
417
+ }
418
+ if (this.challenge.Status === EChallengeStatus.InProgress ||
419
+ this.challenge.Status === EChallengeStatus.PendingLevelReward) {
420
+ return (index.h("button", { class: "card__button grayed", disabled: this.actionLoading, onClick: () => this.joinUnjoinProgress(false) }, translate$1('pause', this.language)));
421
+ }
422
+ }
423
+ return (index.h("button", { class: "card__button", onClick: this.goToDetailsPage(this.challenge.ChallengeId) }, translate$1('viewDetails', this.language)));
424
+ }
425
+ async joinUnjoinProgress(join) {
426
+ var _a;
427
+ const progress = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.LevelProgresses.find((x) => x.ProgressStatus === EChallengeProgressStatus.InProgress);
428
+ if (!this.checkAttrs()) {
429
+ const url = `${this.endpoint}/challenge/ChangeProgressStatus`;
430
+ const body = Object.assign(Object.assign({ DomainId: this.domain }, (this.session && { PlayerSessionId: this.session })), (join ? { ProgressToActivate: progress.LevelId } : { ProgressToDeactivate: progress.LevelId }));
431
+ this.actionLoading = true;
432
+ return fetch(url, {
433
+ method: 'POST',
434
+ headers: {
435
+ 'Content-Type': 'application/json'
436
+ },
437
+ body: JSON.stringify(body)
438
+ })
439
+ .then((res) => res.json())
440
+ .finally(() => (this.actionLoading = false));
441
+ }
442
+ }
443
+ render() {
444
+ var _a, _b, _c, _d;
445
+ return (index.h("div", { key: '7d075d85a754e70a62910c2b3994ee10f4e289f6', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '0d8b0c19b9cfd582588d3a8f62364753ddb6c391', class: "card" }, index.h("img", { key: '1547104e52b2f755bbe4f9b7acedc949990d5df8', class: `card__image ${this.isChallengeGrayed}`, src: (_b = (_a = this.challenge) === null || _a === void 0 ? void 0 : _a.ChallengePresentation) === null || _b === void 0 ? void 0 : _b.Url }), this.getCardBadge, index.h("div", { key: '34474831cd774f48f2730d77c82e46252b857f75', class: "card__content" }, index.h("h1", { key: 'a3ea4dab06b090c96961f7fa3e958a1a577100ef', class: "card__title" }, (_d = (_c = this.challenge) === null || _c === void 0 ? void 0 : _c.ChallengePresentation) === null || _d === void 0 ? void 0 : _d.PresentationName), this.getChallengeProgress, this.infoItems.map((x, index) => this.renderInfoItem(x, index)), this.getCardButton))));
446
+ }
447
+ static get watchers() { return {
448
+ "clientStyling": ["handleClientStylingChange"],
449
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
450
+ "mbSource": ["handleMbSourceChange"]
451
+ }; }
452
+ };
453
+ CasinoChallengeCard.style = CasinoChallengeCardStyle0;
454
+
455
+ const casinoChallengesListCss = ".challenges-list {\n display: flex;\n flex-wrap: wrap;\n gap: 30px;\n width: 100%;\n}\n\n.loader {\n width: 308px;\n border-radius: 16px;\n border: 2px solid var(--emw--button-border-color, rgba(221, 255, 207, 0.1019607843));\n background-color: var(--emw--color-background, #141515);\n box-sizing: border-box;\n position: relative;\n}\n@container challenge-list (max-width: 576px) {\n .loader {\n width: 100%;\n }\n}\n.loader:hover {\n background: linear-gradient(90deg, rgb(0, 62, 92) 0%, rgb(17, 59, 33) 100%);\n cursor: pointer;\n}\n.loader .SkeletonRows .SkeletonContainer {\n padding: 0 20px 0 20px;\n}\n.loader .SkeletonButton .Skeleton.Text {\n margin: 0;\n height: 28px;\n margin: 0 20px 20px 20px;\n border-radius: var(--emw--button-border-radius, 99px);\n width: auto;\n}\n.loader .Skeleton.Image {\n border-radius: 16px 16px 0 0;\n}\n.loader .Skeleton.Text {\n margin: 20px 0;\n}";
456
+ const CasinoChallengesListStyle0 = casinoChallengesListCss;
457
+
458
+ const skeletons$1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
459
+ const CasinoChallengeList = class {
460
+ constructor(hostRef) {
461
+ index.registerInstance(this, hostRef);
462
+ this.loadMore = index.createEvent(this, "loadMore", 7);
463
+ this.timerExpired = index.createEvent(this, "timerExpired", 7);
464
+ this.setLastItemRef = (el) => {
465
+ if (this.lastItemRef && this.observer) {
466
+ this.observer.unobserve(this.lastItemRef);
467
+ }
468
+ this.lastItemRef = el;
469
+ if (el && this.observer && !this.loading) {
470
+ this.observer.observe(el);
471
+ }
472
+ };
473
+ this.mbSource = undefined;
474
+ this.clientStyling = undefined;
475
+ this.clientStylingUrl = undefined;
476
+ this.language = 'en';
477
+ this.translationUrl = undefined;
478
+ this.challenges = [];
479
+ this.loading = false;
480
+ this.hasMore = false;
481
+ this.activeTabIndex = 0;
482
+ }
483
+ handleClientStylingChange(newValue, oldValue) {
484
+ if (newValue != oldValue) {
485
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
486
+ }
487
+ }
488
+ handleClientStylingUrlChange(newValue, oldValue) {
489
+ if (newValue != oldValue) {
490
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
491
+ }
492
+ }
493
+ handleMbSourceChange(newValue, oldValue) {
494
+ if (newValue != oldValue) {
495
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
496
+ }
497
+ }
498
+ setupObserver() {
499
+ if (!this.lastItemRef || this.loading || !this.hasMore)
500
+ return;
501
+ if (!this.observer) {
502
+ this.observer = new IntersectionObserver(([entry]) => {
503
+ if (entry.isIntersecting && !this.loading && this.hasMore) {
504
+ this.observer.unobserve(entry.target);
505
+ this.loadMore.emit();
506
+ }
507
+ }, {
508
+ root: null,
509
+ rootMargin: '0px',
510
+ threshold: 0.1
511
+ });
512
+ }
513
+ this.observer.disconnect();
514
+ this.observer.observe(this.lastItemRef);
515
+ }
516
+ componentDidRender() {
517
+ this.setupObserver();
518
+ }
519
+ disconnectedCallback() {
520
+ var _a;
521
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
522
+ this.observer = undefined;
523
+ }
524
+ componentDidLoad() {
525
+ if (this.stylingContainer) {
526
+ if (this.mbSource)
527
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
528
+ if (this.clientStyling)
529
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
530
+ if (this.clientStylingUrl)
531
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
532
+ }
533
+ }
534
+ renderSkeletons() {
535
+ return skeletons$1.map((skeleton) => (index.h("div", { class: "loader", key: skeleton }, index.h("ui-skeleton", { structure: "image", height: "200px", "border-radius": "16px 16px 0 0" }), index.h("ui-skeleton", { class: "SkeletonRows", structure: "text", width: "220px", height: "16px", rows: "3" }), index.h("ui-skeleton", { class: "SkeletonButton", structure: "text", width: "100%" }))));
536
+ }
537
+ onTimerExpired(e) {
538
+ if (this.timerExpired) {
539
+ this.timerExpired.emit(e.detail);
540
+ }
541
+ }
542
+ render() {
543
+ return (index.h("div", { key: 'a86f75428a1ada59409164e3c83582794d186c5c', ref: (el) => (this.stylingContainer = el), class: "challenges-list" }, this.challenges.map((challenge, index$1) => (index.h("div", { key: challenge.Id, ref: index$1 === this.challenges.length - 1 ? this.setLastItemRef : null }, index.h("casino-challenge-card", { challenge: challenge, language: this.language, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, translationUrl: this.translationUrl, onTimerExpired: this.onTimerExpired, activeTabIndex: this.activeTabIndex })))), this.loading && this.renderSkeletons()));
544
+ }
545
+ get el() { return index.getElement(this); }
546
+ static get watchers() { return {
547
+ "clientStyling": ["handleClientStylingChange"],
548
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
549
+ "mbSource": ["handleMbSourceChange"]
550
+ }; }
551
+ };
552
+ CasinoChallengeList.style = CasinoChallengesListStyle0;
553
+
554
+ var EHistoryItemLevelStatus;
555
+ (function (EHistoryItemLevelStatus) {
556
+ EHistoryItemLevelStatus[EHistoryItemLevelStatus["Completed"] = 0] = "Completed";
557
+ EHistoryItemLevelStatus[EHistoryItemLevelStatus["Expired"] = 1] = "Expired";
558
+ EHistoryItemLevelStatus[EHistoryItemLevelStatus["Forfeited"] = 2] = "Forfeited";
559
+ })(EHistoryItemLevelStatus || (EHistoryItemLevelStatus = {}));
560
+ const HistoryItemLevelStatusDictionary = ['Completed', 'Expired', 'Forfeited'];
561
+
562
+ const DEFAULT_LANGUAGE = 'en';
563
+ const TRANSLATIONS = {
564
+ en: {
565
+ level: 'Level',
566
+ status: 'Status',
567
+ time: 'Time'
568
+ },
569
+ ro: {
570
+ level: 'Nivel',
571
+ status: 'Stare',
572
+ time: 'Timp'
573
+ },
574
+ fr: {
575
+ level: 'Niveau',
576
+ status: 'Statut',
577
+ time: 'Temps'
578
+ },
579
+ ar: {
580
+ level: 'المستوى',
581
+ status: 'الحالة',
582
+ time: 'الوقت'
583
+ },
584
+ hr: {
585
+ level: 'Razina',
586
+ status: 'Status',
587
+ time: 'Vrijeme'
588
+ }
589
+ };
590
+ const translate = (key, customLang) => {
591
+ const lang = customLang;
592
+ return TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
593
+ };
594
+ const getTranslations = (data) => {
595
+ Object.keys(data).forEach((item) => {
596
+ for (let key in data[item]) {
597
+ TRANSLATIONS[item][key] = data[item][key];
598
+ }
599
+ });
600
+ };
601
+ const resolveTranslationUrl = async (translationUrl) => {
602
+ if (translationUrl) {
603
+ try {
604
+ const response = await fetch(translationUrl);
605
+ if (!response.ok) {
606
+ throw new Error(`HTTP error! status: ${response.status}`);
607
+ }
608
+ const translations = await response.json();
609
+ getTranslations(translations);
610
+ }
611
+ catch (error) {
612
+ console.error('Failed to fetch or parse translations from URL:', error);
613
+ }
614
+ }
615
+ };
616
+
617
+ const arrowUpSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEyIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1yd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HcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K';
622
+
623
+ function _typeof(o) {
624
+ "@babel/helpers - typeof";
625
+
626
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
627
+ return typeof o;
628
+ } : function (o) {
629
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
630
+ }, _typeof(o);
631
+ }
632
+
633
+ function toInteger(dirtyNumber) {
634
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
635
+ return NaN;
636
+ }
637
+ var number = Number(dirtyNumber);
638
+ if (isNaN(number)) {
639
+ return number;
640
+ }
641
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
642
+ }
643
+
644
+ function requiredArgs(required, args) {
645
+ if (args.length < required) {
646
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
647
+ }
648
+ }
649
+
650
+ /**
651
+ * @name toDate
652
+ * @category Common Helpers
653
+ * @summary Convert the given argument to an instance of Date.
654
+ *
655
+ * @description
656
+ * Convert the given argument to an instance of Date.
657
+ *
658
+ * If the argument is an instance of Date, the function returns its clone.
659
+ *
660
+ * If the argument is a number, it is treated as a timestamp.
661
+ *
662
+ * If the argument is none of the above, the function returns Invalid Date.
663
+ *
664
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
665
+ *
666
+ * @param {Date|Number} argument - the value to convert
667
+ * @returns {Date} the parsed date in the local time zone
668
+ * @throws {TypeError} 1 argument required
669
+ *
670
+ * @example
671
+ * // Clone the date:
672
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
673
+ * //=> Tue Feb 11 2014 11:30:30
674
+ *
675
+ * @example
676
+ * // Convert the timestamp to date:
677
+ * const result = toDate(1392098430000)
678
+ * //=> Tue Feb 11 2014 11:30:30
679
+ */
680
+ function toDate(argument) {
681
+ requiredArgs(1, arguments);
682
+ var argStr = Object.prototype.toString.call(argument);
683
+
684
+ // Clone the date
685
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
686
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
687
+ return new Date(argument.getTime());
688
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
689
+ return new Date(argument);
690
+ } else {
691
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
692
+ // eslint-disable-next-line no-console
693
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
694
+ // eslint-disable-next-line no-console
695
+ console.warn(new Error().stack);
696
+ }
697
+ return new Date(NaN);
698
+ }
699
+ }
700
+
701
+ /**
702
+ * @name addMilliseconds
703
+ * @category Millisecond Helpers
704
+ * @summary Add the specified number of milliseconds to the given date.
705
+ *
706
+ * @description
707
+ * Add the specified number of milliseconds to the given date.
708
+ *
709
+ * @param {Date|Number} date - the date to be changed
710
+ * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
711
+ * @returns {Date} the new date with the milliseconds added
712
+ * @throws {TypeError} 2 arguments required
713
+ *
714
+ * @example
715
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
716
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
717
+ * //=> Thu Jul 10 2014 12:45:30.750
718
+ */
719
+ function addMilliseconds(dirtyDate, dirtyAmount) {
720
+ requiredArgs(2, arguments);
721
+ var timestamp = toDate(dirtyDate).getTime();
722
+ var amount = toInteger(dirtyAmount);
723
+ return new Date(timestamp + amount);
724
+ }
725
+
726
+ var defaultOptions = {};
727
+ function getDefaultOptions() {
728
+ return defaultOptions;
729
+ }
730
+
731
+ /**
732
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
733
+ * They usually appear for dates that denote time before the timezones were introduced
734
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
735
+ * and GMT+01:00:00 after that date)
736
+ *
737
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
738
+ * which would lead to incorrect calculations.
739
+ *
740
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
741
+ */
742
+ function getTimezoneOffsetInMilliseconds(date) {
743
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
744
+ utcDate.setUTCFullYear(date.getFullYear());
745
+ return date.getTime() - utcDate.getTime();
746
+ }
747
+
748
+ /**
749
+ * @name isDate
750
+ * @category Common Helpers
751
+ * @summary Is the given value a date?
752
+ *
753
+ * @description
754
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
755
+ *
756
+ * @param {*} value - the value to check
757
+ * @returns {boolean} true if the given value is a date
758
+ * @throws {TypeError} 1 arguments required
759
+ *
760
+ * @example
761
+ * // For a valid date:
762
+ * const result = isDate(new Date())
763
+ * //=> true
764
+ *
765
+ * @example
766
+ * // For an invalid date:
767
+ * const result = isDate(new Date(NaN))
768
+ * //=> true
769
+ *
770
+ * @example
771
+ * // For some value:
772
+ * const result = isDate('2014-02-31')
773
+ * //=> false
774
+ *
775
+ * @example
776
+ * // For an object:
777
+ * const result = isDate({})
778
+ * //=> false
779
+ */
780
+ function isDate(value) {
781
+ requiredArgs(1, arguments);
782
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
783
+ }
784
+
785
+ /**
786
+ * @name isValid
787
+ * @category Common Helpers
788
+ * @summary Is the given date valid?
789
+ *
790
+ * @description
791
+ * Returns false if argument is Invalid Date and true otherwise.
792
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
793
+ * Invalid Date is a Date, whose time value is NaN.
794
+ *
795
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
796
+ *
797
+ * @param {*} date - the date to check
798
+ * @returns {Boolean} the date is valid
799
+ * @throws {TypeError} 1 argument required
800
+ *
801
+ * @example
802
+ * // For the valid date:
803
+ * const result = isValid(new Date(2014, 1, 31))
804
+ * //=> true
805
+ *
806
+ * @example
807
+ * // For the value, convertable into a date:
808
+ * const result = isValid(1393804800000)
809
+ * //=> true
810
+ *
811
+ * @example
812
+ * // For the invalid date:
813
+ * const result = isValid(new Date(''))
814
+ * //=> false
815
+ */
816
+ function isValid(dirtyDate) {
817
+ requiredArgs(1, arguments);
818
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
819
+ return false;
820
+ }
821
+ var date = toDate(dirtyDate);
822
+ return !isNaN(Number(date));
823
+ }
824
+
825
+ /**
826
+ * @name subMilliseconds
827
+ * @category Millisecond Helpers
828
+ * @summary Subtract the specified number of milliseconds from the given date.
829
+ *
830
+ * @description
831
+ * Subtract the specified number of milliseconds from the given date.
832
+ *
833
+ * @param {Date|Number} date - the date to be changed
834
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
835
+ * @returns {Date} the new date with the milliseconds subtracted
836
+ * @throws {TypeError} 2 arguments required
837
+ *
838
+ * @example
839
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
840
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
841
+ * //=> Thu Jul 10 2014 12:45:29.250
842
+ */
843
+ function subMilliseconds(dirtyDate, dirtyAmount) {
844
+ requiredArgs(2, arguments);
845
+ var amount = toInteger(dirtyAmount);
846
+ return addMilliseconds(dirtyDate, -amount);
847
+ }
848
+
849
+ var MILLISECONDS_IN_DAY = 86400000;
850
+ function getUTCDayOfYear(dirtyDate) {
851
+ requiredArgs(1, arguments);
852
+ var date = toDate(dirtyDate);
853
+ var timestamp = date.getTime();
854
+ date.setUTCMonth(0, 1);
855
+ date.setUTCHours(0, 0, 0, 0);
856
+ var startOfYearTimestamp = date.getTime();
857
+ var difference = timestamp - startOfYearTimestamp;
858
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
859
+ }
860
+
861
+ function startOfUTCISOWeek(dirtyDate) {
862
+ requiredArgs(1, arguments);
863
+ var weekStartsOn = 1;
864
+ var date = toDate(dirtyDate);
865
+ var day = date.getUTCDay();
866
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
867
+ date.setUTCDate(date.getUTCDate() - diff);
868
+ date.setUTCHours(0, 0, 0, 0);
869
+ return date;
870
+ }
871
+
872
+ function getUTCISOWeekYear(dirtyDate) {
873
+ requiredArgs(1, arguments);
874
+ var date = toDate(dirtyDate);
875
+ var year = date.getUTCFullYear();
876
+ var fourthOfJanuaryOfNextYear = new Date(0);
877
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
878
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
879
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
880
+ var fourthOfJanuaryOfThisYear = new Date(0);
881
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
882
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
883
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
884
+ if (date.getTime() >= startOfNextYear.getTime()) {
885
+ return year + 1;
886
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
887
+ return year;
888
+ } else {
889
+ return year - 1;
890
+ }
891
+ }
892
+
893
+ function startOfUTCISOWeekYear(dirtyDate) {
894
+ requiredArgs(1, arguments);
895
+ var year = getUTCISOWeekYear(dirtyDate);
896
+ var fourthOfJanuary = new Date(0);
897
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
898
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
899
+ var date = startOfUTCISOWeek(fourthOfJanuary);
900
+ return date;
901
+ }
902
+
903
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
904
+ function getUTCISOWeek(dirtyDate) {
905
+ requiredArgs(1, arguments);
906
+ var date = toDate(dirtyDate);
907
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
908
+
909
+ // Round the number of days to the nearest integer
910
+ // because the number of milliseconds in a week is not constant
911
+ // (e.g. it's different in the week of the daylight saving time clock shift)
912
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
913
+ }
914
+
915
+ function startOfUTCWeek(dirtyDate, options) {
916
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
917
+ requiredArgs(1, arguments);
918
+ var defaultOptions = getDefaultOptions();
919
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
920
+
921
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
922
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
923
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
924
+ }
925
+ var date = toDate(dirtyDate);
926
+ var day = date.getUTCDay();
927
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
928
+ date.setUTCDate(date.getUTCDate() - diff);
929
+ date.setUTCHours(0, 0, 0, 0);
930
+ return date;
931
+ }
932
+
933
+ function getUTCWeekYear(dirtyDate, options) {
934
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
935
+ requiredArgs(1, arguments);
936
+ var date = toDate(dirtyDate);
937
+ var year = date.getUTCFullYear();
938
+ var defaultOptions = getDefaultOptions();
939
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
940
+
941
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
942
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
943
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
944
+ }
945
+ var firstWeekOfNextYear = new Date(0);
946
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
947
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
948
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
949
+ var firstWeekOfThisYear = new Date(0);
950
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
951
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
952
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
953
+ if (date.getTime() >= startOfNextYear.getTime()) {
954
+ return year + 1;
955
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
956
+ return year;
957
+ } else {
958
+ return year - 1;
959
+ }
960
+ }
961
+
962
+ function startOfUTCWeekYear(dirtyDate, options) {
963
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
964
+ requiredArgs(1, arguments);
965
+ var defaultOptions = getDefaultOptions();
966
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
967
+ var year = getUTCWeekYear(dirtyDate, options);
968
+ var firstWeek = new Date(0);
969
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
970
+ firstWeek.setUTCHours(0, 0, 0, 0);
971
+ var date = startOfUTCWeek(firstWeek, options);
972
+ return date;
973
+ }
974
+
975
+ var MILLISECONDS_IN_WEEK = 604800000;
976
+ function getUTCWeek(dirtyDate, options) {
977
+ requiredArgs(1, arguments);
978
+ var date = toDate(dirtyDate);
979
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
980
+
981
+ // Round the number of days to the nearest integer
982
+ // because the number of milliseconds in a week is not constant
983
+ // (e.g. it's different in the week of the daylight saving time clock shift)
984
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
985
+ }
986
+
987
+ function addLeadingZeros(number, targetLength) {
988
+ var sign = number < 0 ? '-' : '';
989
+ var output = Math.abs(number).toString();
990
+ while (output.length < targetLength) {
991
+ output = '0' + output;
992
+ }
993
+ return sign + output;
994
+ }
995
+
996
+ /*
997
+ * | | Unit | | Unit |
998
+ * |-----|--------------------------------|-----|--------------------------------|
999
+ * | a | AM, PM | A* | |
1000
+ * | d | Day of month | D | |
1001
+ * | h | Hour [1-12] | H | Hour [0-23] |
1002
+ * | m | Minute | M | Month |
1003
+ * | s | Second | S | Fraction of second |
1004
+ * | y | Year (abs) | Y | |
1005
+ *
1006
+ * Letters marked by * are not implemented but reserved by Unicode standard.
1007
+ */
1008
+ var formatters$2 = {
1009
+ // Year
1010
+ y: function y(date, token) {
1011
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
1012
+ // | Year | y | yy | yyy | yyyy | yyyyy |
1013
+ // |----------|-------|----|-------|-------|-------|
1014
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
1015
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
1016
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
1017
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
1018
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
1019
+
1020
+ var signedYear = date.getUTCFullYear();
1021
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
1022
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
1023
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
1024
+ },
1025
+ // Month
1026
+ M: function M(date, token) {
1027
+ var month = date.getUTCMonth();
1028
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
1029
+ },
1030
+ // Day of the month
1031
+ d: function d(date, token) {
1032
+ return addLeadingZeros(date.getUTCDate(), token.length);
1033
+ },
1034
+ // AM or PM
1035
+ a: function a(date, token) {
1036
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
1037
+ switch (token) {
1038
+ case 'a':
1039
+ case 'aa':
1040
+ return dayPeriodEnumValue.toUpperCase();
1041
+ case 'aaa':
1042
+ return dayPeriodEnumValue;
1043
+ case 'aaaaa':
1044
+ return dayPeriodEnumValue[0];
1045
+ case 'aaaa':
1046
+ default:
1047
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
1048
+ }
1049
+ },
1050
+ // Hour [1-12]
1051
+ h: function h(date, token) {
1052
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
1053
+ },
1054
+ // Hour [0-23]
1055
+ H: function H(date, token) {
1056
+ return addLeadingZeros(date.getUTCHours(), token.length);
1057
+ },
1058
+ // Minute
1059
+ m: function m(date, token) {
1060
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
1061
+ },
1062
+ // Second
1063
+ s: function s(date, token) {
1064
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
1065
+ },
1066
+ // Fraction of second
1067
+ S: function S(date, token) {
1068
+ var numberOfDigits = token.length;
1069
+ var milliseconds = date.getUTCMilliseconds();
1070
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
1071
+ return addLeadingZeros(fractionalSeconds, token.length);
1072
+ }
1073
+ };
1074
+ const formatters$3 = formatters$2;
1075
+
1076
+ var dayPeriodEnum = {
1077
+ am: 'am',
1078
+ pm: 'pm',
1079
+ midnight: 'midnight',
1080
+ noon: 'noon',
1081
+ morning: 'morning',
1082
+ afternoon: 'afternoon',
1083
+ evening: 'evening',
1084
+ night: 'night'
1085
+ };
1086
+ /*
1087
+ * | | Unit | | Unit |
1088
+ * |-----|--------------------------------|-----|--------------------------------|
1089
+ * | a | AM, PM | A* | Milliseconds in day |
1090
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
1091
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
1092
+ * | d | Day of month | D | Day of year |
1093
+ * | e | Local day of week | E | Day of week |
1094
+ * | f | | F* | Day of week in month |
1095
+ * | g* | Modified Julian day | G | Era |
1096
+ * | h | Hour [1-12] | H | Hour [0-23] |
1097
+ * | i! | ISO day of week | I! | ISO week of year |
1098
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
1099
+ * | k | Hour [1-24] | K | Hour [0-11] |
1100
+ * | l* | (deprecated) | L | Stand-alone month |
1101
+ * | m | Minute | M | Month |
1102
+ * | n | | N | |
1103
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
1104
+ * | p! | Long localized time | P! | Long localized date |
1105
+ * | q | Stand-alone quarter | Q | Quarter |
1106
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
1107
+ * | s | Second | S | Fraction of second |
1108
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
1109
+ * | u | Extended year | U* | Cyclic year |
1110
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
1111
+ * | w | Local week of year | W* | Week of month |
1112
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
1113
+ * | y | Year (abs) | Y | Local week-numbering year |
1114
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
1115
+ *
1116
+ * Letters marked by * are not implemented but reserved by Unicode standard.
1117
+ *
1118
+ * Letters marked by ! are non-standard, but implemented by date-fns:
1119
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
1120
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
1121
+ * i.e. 7 for Sunday, 1 for Monday, etc.
1122
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
1123
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
1124
+ * `R` is supposed to be used in conjunction with `I` and `i`
1125
+ * for universal ISO week-numbering date, whereas
1126
+ * `Y` is supposed to be used in conjunction with `w` and `e`
1127
+ * for week-numbering date specific to the locale.
1128
+ * - `P` is long localized date format
1129
+ * - `p` is long localized time format
1130
+ */
1131
+
1132
+ var formatters = {
1133
+ // Era
1134
+ G: function G(date, token, localize) {
1135
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
1136
+ switch (token) {
1137
+ // AD, BC
1138
+ case 'G':
1139
+ case 'GG':
1140
+ case 'GGG':
1141
+ return localize.era(era, {
1142
+ width: 'abbreviated'
1143
+ });
1144
+ // A, B
1145
+ case 'GGGGG':
1146
+ return localize.era(era, {
1147
+ width: 'narrow'
1148
+ });
1149
+ // Anno Domini, Before Christ
1150
+ case 'GGGG':
1151
+ default:
1152
+ return localize.era(era, {
1153
+ width: 'wide'
1154
+ });
1155
+ }
1156
+ },
1157
+ // Year
1158
+ y: function y(date, token, localize) {
1159
+ // Ordinal number
1160
+ if (token === 'yo') {
1161
+ var signedYear = date.getUTCFullYear();
1162
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
1163
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
1164
+ return localize.ordinalNumber(year, {
1165
+ unit: 'year'
1166
+ });
1167
+ }
1168
+ return formatters$3.y(date, token);
1169
+ },
1170
+ // Local week-numbering year
1171
+ Y: function Y(date, token, localize, options) {
1172
+ var signedWeekYear = getUTCWeekYear(date, options);
1173
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
1174
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1175
+
1176
+ // Two digit year
1177
+ if (token === 'YY') {
1178
+ var twoDigitYear = weekYear % 100;
1179
+ return addLeadingZeros(twoDigitYear, 2);
1180
+ }
1181
+
1182
+ // Ordinal number
1183
+ if (token === 'Yo') {
1184
+ return localize.ordinalNumber(weekYear, {
1185
+ unit: 'year'
1186
+ });
1187
+ }
1188
+
1189
+ // Padding
1190
+ return addLeadingZeros(weekYear, token.length);
1191
+ },
1192
+ // ISO week-numbering year
1193
+ R: function R(date, token) {
1194
+ var isoWeekYear = getUTCISOWeekYear(date);
1195
+
1196
+ // Padding
1197
+ return addLeadingZeros(isoWeekYear, token.length);
1198
+ },
1199
+ // Extended year. This is a single number designating the year of this calendar system.
1200
+ // The main difference between `y` and `u` localizers are B.C. years:
1201
+ // | Year | `y` | `u` |
1202
+ // |------|-----|-----|
1203
+ // | AC 1 | 1 | 1 |
1204
+ // | BC 1 | 1 | 0 |
1205
+ // | BC 2 | 2 | -1 |
1206
+ // Also `yy` always returns the last two digits of a year,
1207
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1208
+ u: function u(date, token) {
1209
+ var year = date.getUTCFullYear();
1210
+ return addLeadingZeros(year, token.length);
1211
+ },
1212
+ // Quarter
1213
+ Q: function Q(date, token, localize) {
1214
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1215
+ switch (token) {
1216
+ // 1, 2, 3, 4
1217
+ case 'Q':
1218
+ return String(quarter);
1219
+ // 01, 02, 03, 04
1220
+ case 'QQ':
1221
+ return addLeadingZeros(quarter, 2);
1222
+ // 1st, 2nd, 3rd, 4th
1223
+ case 'Qo':
1224
+ return localize.ordinalNumber(quarter, {
1225
+ unit: 'quarter'
1226
+ });
1227
+ // Q1, Q2, Q3, Q4
1228
+ case 'QQQ':
1229
+ return localize.quarter(quarter, {
1230
+ width: 'abbreviated',
1231
+ context: 'formatting'
1232
+ });
1233
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1234
+ case 'QQQQQ':
1235
+ return localize.quarter(quarter, {
1236
+ width: 'narrow',
1237
+ context: 'formatting'
1238
+ });
1239
+ // 1st quarter, 2nd quarter, ...
1240
+ case 'QQQQ':
1241
+ default:
1242
+ return localize.quarter(quarter, {
1243
+ width: 'wide',
1244
+ context: 'formatting'
1245
+ });
1246
+ }
1247
+ },
1248
+ // Stand-alone quarter
1249
+ q: function q(date, token, localize) {
1250
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1251
+ switch (token) {
1252
+ // 1, 2, 3, 4
1253
+ case 'q':
1254
+ return String(quarter);
1255
+ // 01, 02, 03, 04
1256
+ case 'qq':
1257
+ return addLeadingZeros(quarter, 2);
1258
+ // 1st, 2nd, 3rd, 4th
1259
+ case 'qo':
1260
+ return localize.ordinalNumber(quarter, {
1261
+ unit: 'quarter'
1262
+ });
1263
+ // Q1, Q2, Q3, Q4
1264
+ case 'qqq':
1265
+ return localize.quarter(quarter, {
1266
+ width: 'abbreviated',
1267
+ context: 'standalone'
1268
+ });
1269
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1270
+ case 'qqqqq':
1271
+ return localize.quarter(quarter, {
1272
+ width: 'narrow',
1273
+ context: 'standalone'
1274
+ });
1275
+ // 1st quarter, 2nd quarter, ...
1276
+ case 'qqqq':
1277
+ default:
1278
+ return localize.quarter(quarter, {
1279
+ width: 'wide',
1280
+ context: 'standalone'
1281
+ });
1282
+ }
1283
+ },
1284
+ // Month
1285
+ M: function M(date, token, localize) {
1286
+ var month = date.getUTCMonth();
1287
+ switch (token) {
1288
+ case 'M':
1289
+ case 'MM':
1290
+ return formatters$3.M(date, token);
1291
+ // 1st, 2nd, ..., 12th
1292
+ case 'Mo':
1293
+ return localize.ordinalNumber(month + 1, {
1294
+ unit: 'month'
1295
+ });
1296
+ // Jan, Feb, ..., Dec
1297
+ case 'MMM':
1298
+ return localize.month(month, {
1299
+ width: 'abbreviated',
1300
+ context: 'formatting'
1301
+ });
1302
+ // J, F, ..., D
1303
+ case 'MMMMM':
1304
+ return localize.month(month, {
1305
+ width: 'narrow',
1306
+ context: 'formatting'
1307
+ });
1308
+ // January, February, ..., December
1309
+ case 'MMMM':
1310
+ default:
1311
+ return localize.month(month, {
1312
+ width: 'wide',
1313
+ context: 'formatting'
1314
+ });
1315
+ }
1316
+ },
1317
+ // Stand-alone month
1318
+ L: function L(date, token, localize) {
1319
+ var month = date.getUTCMonth();
1320
+ switch (token) {
1321
+ // 1, 2, ..., 12
1322
+ case 'L':
1323
+ return String(month + 1);
1324
+ // 01, 02, ..., 12
1325
+ case 'LL':
1326
+ return addLeadingZeros(month + 1, 2);
1327
+ // 1st, 2nd, ..., 12th
1328
+ case 'Lo':
1329
+ return localize.ordinalNumber(month + 1, {
1330
+ unit: 'month'
1331
+ });
1332
+ // Jan, Feb, ..., Dec
1333
+ case 'LLL':
1334
+ return localize.month(month, {
1335
+ width: 'abbreviated',
1336
+ context: 'standalone'
1337
+ });
1338
+ // J, F, ..., D
1339
+ case 'LLLLL':
1340
+ return localize.month(month, {
1341
+ width: 'narrow',
1342
+ context: 'standalone'
1343
+ });
1344
+ // January, February, ..., December
1345
+ case 'LLLL':
1346
+ default:
1347
+ return localize.month(month, {
1348
+ width: 'wide',
1349
+ context: 'standalone'
1350
+ });
1351
+ }
1352
+ },
1353
+ // Local week of year
1354
+ w: function w(date, token, localize, options) {
1355
+ var week = getUTCWeek(date, options);
1356
+ if (token === 'wo') {
1357
+ return localize.ordinalNumber(week, {
1358
+ unit: 'week'
1359
+ });
1360
+ }
1361
+ return addLeadingZeros(week, token.length);
1362
+ },
1363
+ // ISO week of year
1364
+ I: function I(date, token, localize) {
1365
+ var isoWeek = getUTCISOWeek(date);
1366
+ if (token === 'Io') {
1367
+ return localize.ordinalNumber(isoWeek, {
1368
+ unit: 'week'
1369
+ });
1370
+ }
1371
+ return addLeadingZeros(isoWeek, token.length);
1372
+ },
1373
+ // Day of the month
1374
+ d: function d(date, token, localize) {
1375
+ if (token === 'do') {
1376
+ return localize.ordinalNumber(date.getUTCDate(), {
1377
+ unit: 'date'
1378
+ });
1379
+ }
1380
+ return formatters$3.d(date, token);
1381
+ },
1382
+ // Day of year
1383
+ D: function D(date, token, localize) {
1384
+ var dayOfYear = getUTCDayOfYear(date);
1385
+ if (token === 'Do') {
1386
+ return localize.ordinalNumber(dayOfYear, {
1387
+ unit: 'dayOfYear'
1388
+ });
1389
+ }
1390
+ return addLeadingZeros(dayOfYear, token.length);
1391
+ },
1392
+ // Day of week
1393
+ E: function E(date, token, localize) {
1394
+ var dayOfWeek = date.getUTCDay();
1395
+ switch (token) {
1396
+ // Tue
1397
+ case 'E':
1398
+ case 'EE':
1399
+ case 'EEE':
1400
+ return localize.day(dayOfWeek, {
1401
+ width: 'abbreviated',
1402
+ context: 'formatting'
1403
+ });
1404
+ // T
1405
+ case 'EEEEE':
1406
+ return localize.day(dayOfWeek, {
1407
+ width: 'narrow',
1408
+ context: 'formatting'
1409
+ });
1410
+ // Tu
1411
+ case 'EEEEEE':
1412
+ return localize.day(dayOfWeek, {
1413
+ width: 'short',
1414
+ context: 'formatting'
1415
+ });
1416
+ // Tuesday
1417
+ case 'EEEE':
1418
+ default:
1419
+ return localize.day(dayOfWeek, {
1420
+ width: 'wide',
1421
+ context: 'formatting'
1422
+ });
1423
+ }
1424
+ },
1425
+ // Local day of week
1426
+ e: function e(date, token, localize, options) {
1427
+ var dayOfWeek = date.getUTCDay();
1428
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1429
+ switch (token) {
1430
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
1431
+ case 'e':
1432
+ return String(localDayOfWeek);
1433
+ // Padded numerical value
1434
+ case 'ee':
1435
+ return addLeadingZeros(localDayOfWeek, 2);
1436
+ // 1st, 2nd, ..., 7th
1437
+ case 'eo':
1438
+ return localize.ordinalNumber(localDayOfWeek, {
1439
+ unit: 'day'
1440
+ });
1441
+ case 'eee':
1442
+ return localize.day(dayOfWeek, {
1443
+ width: 'abbreviated',
1444
+ context: 'formatting'
1445
+ });
1446
+ // T
1447
+ case 'eeeee':
1448
+ return localize.day(dayOfWeek, {
1449
+ width: 'narrow',
1450
+ context: 'formatting'
1451
+ });
1452
+ // Tu
1453
+ case 'eeeeee':
1454
+ return localize.day(dayOfWeek, {
1455
+ width: 'short',
1456
+ context: 'formatting'
1457
+ });
1458
+ // Tuesday
1459
+ case 'eeee':
1460
+ default:
1461
+ return localize.day(dayOfWeek, {
1462
+ width: 'wide',
1463
+ context: 'formatting'
1464
+ });
1465
+ }
1466
+ },
1467
+ // Stand-alone local day of week
1468
+ c: function c(date, token, localize, options) {
1469
+ var dayOfWeek = date.getUTCDay();
1470
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1471
+ switch (token) {
1472
+ // Numerical value (same as in `e`)
1473
+ case 'c':
1474
+ return String(localDayOfWeek);
1475
+ // Padded numerical value
1476
+ case 'cc':
1477
+ return addLeadingZeros(localDayOfWeek, token.length);
1478
+ // 1st, 2nd, ..., 7th
1479
+ case 'co':
1480
+ return localize.ordinalNumber(localDayOfWeek, {
1481
+ unit: 'day'
1482
+ });
1483
+ case 'ccc':
1484
+ return localize.day(dayOfWeek, {
1485
+ width: 'abbreviated',
1486
+ context: 'standalone'
1487
+ });
1488
+ // T
1489
+ case 'ccccc':
1490
+ return localize.day(dayOfWeek, {
1491
+ width: 'narrow',
1492
+ context: 'standalone'
1493
+ });
1494
+ // Tu
1495
+ case 'cccccc':
1496
+ return localize.day(dayOfWeek, {
1497
+ width: 'short',
1498
+ context: 'standalone'
1499
+ });
1500
+ // Tuesday
1501
+ case 'cccc':
1502
+ default:
1503
+ return localize.day(dayOfWeek, {
1504
+ width: 'wide',
1505
+ context: 'standalone'
1506
+ });
1507
+ }
1508
+ },
1509
+ // ISO day of week
1510
+ i: function i(date, token, localize) {
1511
+ var dayOfWeek = date.getUTCDay();
1512
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1513
+ switch (token) {
1514
+ // 2
1515
+ case 'i':
1516
+ return String(isoDayOfWeek);
1517
+ // 02
1518
+ case 'ii':
1519
+ return addLeadingZeros(isoDayOfWeek, token.length);
1520
+ // 2nd
1521
+ case 'io':
1522
+ return localize.ordinalNumber(isoDayOfWeek, {
1523
+ unit: 'day'
1524
+ });
1525
+ // Tue
1526
+ case 'iii':
1527
+ return localize.day(dayOfWeek, {
1528
+ width: 'abbreviated',
1529
+ context: 'formatting'
1530
+ });
1531
+ // T
1532
+ case 'iiiii':
1533
+ return localize.day(dayOfWeek, {
1534
+ width: 'narrow',
1535
+ context: 'formatting'
1536
+ });
1537
+ // Tu
1538
+ case 'iiiiii':
1539
+ return localize.day(dayOfWeek, {
1540
+ width: 'short',
1541
+ context: 'formatting'
1542
+ });
1543
+ // Tuesday
1544
+ case 'iiii':
1545
+ default:
1546
+ return localize.day(dayOfWeek, {
1547
+ width: 'wide',
1548
+ context: 'formatting'
1549
+ });
1550
+ }
1551
+ },
1552
+ // AM or PM
1553
+ a: function a(date, token, localize) {
1554
+ var hours = date.getUTCHours();
1555
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1556
+ switch (token) {
1557
+ case 'a':
1558
+ case 'aa':
1559
+ return localize.dayPeriod(dayPeriodEnumValue, {
1560
+ width: 'abbreviated',
1561
+ context: 'formatting'
1562
+ });
1563
+ case 'aaa':
1564
+ return localize.dayPeriod(dayPeriodEnumValue, {
1565
+ width: 'abbreviated',
1566
+ context: 'formatting'
1567
+ }).toLowerCase();
1568
+ case 'aaaaa':
1569
+ return localize.dayPeriod(dayPeriodEnumValue, {
1570
+ width: 'narrow',
1571
+ context: 'formatting'
1572
+ });
1573
+ case 'aaaa':
1574
+ default:
1575
+ return localize.dayPeriod(dayPeriodEnumValue, {
1576
+ width: 'wide',
1577
+ context: 'formatting'
1578
+ });
1579
+ }
1580
+ },
1581
+ // AM, PM, midnight, noon
1582
+ b: function b(date, token, localize) {
1583
+ var hours = date.getUTCHours();
1584
+ var dayPeriodEnumValue;
1585
+ if (hours === 12) {
1586
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1587
+ } else if (hours === 0) {
1588
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1589
+ } else {
1590
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1591
+ }
1592
+ switch (token) {
1593
+ case 'b':
1594
+ case 'bb':
1595
+ return localize.dayPeriod(dayPeriodEnumValue, {
1596
+ width: 'abbreviated',
1597
+ context: 'formatting'
1598
+ });
1599
+ case 'bbb':
1600
+ return localize.dayPeriod(dayPeriodEnumValue, {
1601
+ width: 'abbreviated',
1602
+ context: 'formatting'
1603
+ }).toLowerCase();
1604
+ case 'bbbbb':
1605
+ return localize.dayPeriod(dayPeriodEnumValue, {
1606
+ width: 'narrow',
1607
+ context: 'formatting'
1608
+ });
1609
+ case 'bbbb':
1610
+ default:
1611
+ return localize.dayPeriod(dayPeriodEnumValue, {
1612
+ width: 'wide',
1613
+ context: 'formatting'
1614
+ });
1615
+ }
1616
+ },
1617
+ // in the morning, in the afternoon, in the evening, at night
1618
+ B: function B(date, token, localize) {
1619
+ var hours = date.getUTCHours();
1620
+ var dayPeriodEnumValue;
1621
+ if (hours >= 17) {
1622
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1623
+ } else if (hours >= 12) {
1624
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1625
+ } else if (hours >= 4) {
1626
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1627
+ } else {
1628
+ dayPeriodEnumValue = dayPeriodEnum.night;
1629
+ }
1630
+ switch (token) {
1631
+ case 'B':
1632
+ case 'BB':
1633
+ case 'BBB':
1634
+ return localize.dayPeriod(dayPeriodEnumValue, {
1635
+ width: 'abbreviated',
1636
+ context: 'formatting'
1637
+ });
1638
+ case 'BBBBB':
1639
+ return localize.dayPeriod(dayPeriodEnumValue, {
1640
+ width: 'narrow',
1641
+ context: 'formatting'
1642
+ });
1643
+ case 'BBBB':
1644
+ default:
1645
+ return localize.dayPeriod(dayPeriodEnumValue, {
1646
+ width: 'wide',
1647
+ context: 'formatting'
1648
+ });
1649
+ }
1650
+ },
1651
+ // Hour [1-12]
1652
+ h: function h(date, token, localize) {
1653
+ if (token === 'ho') {
1654
+ var hours = date.getUTCHours() % 12;
1655
+ if (hours === 0) hours = 12;
1656
+ return localize.ordinalNumber(hours, {
1657
+ unit: 'hour'
1658
+ });
1659
+ }
1660
+ return formatters$3.h(date, token);
1661
+ },
1662
+ // Hour [0-23]
1663
+ H: function H(date, token, localize) {
1664
+ if (token === 'Ho') {
1665
+ return localize.ordinalNumber(date.getUTCHours(), {
1666
+ unit: 'hour'
1667
+ });
1668
+ }
1669
+ return formatters$3.H(date, token);
1670
+ },
1671
+ // Hour [0-11]
1672
+ K: function K(date, token, localize) {
1673
+ var hours = date.getUTCHours() % 12;
1674
+ if (token === 'Ko') {
1675
+ return localize.ordinalNumber(hours, {
1676
+ unit: 'hour'
1677
+ });
1678
+ }
1679
+ return addLeadingZeros(hours, token.length);
1680
+ },
1681
+ // Hour [1-24]
1682
+ k: function k(date, token, localize) {
1683
+ var hours = date.getUTCHours();
1684
+ if (hours === 0) hours = 24;
1685
+ if (token === 'ko') {
1686
+ return localize.ordinalNumber(hours, {
1687
+ unit: 'hour'
1688
+ });
1689
+ }
1690
+ return addLeadingZeros(hours, token.length);
1691
+ },
1692
+ // Minute
1693
+ m: function m(date, token, localize) {
1694
+ if (token === 'mo') {
1695
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1696
+ unit: 'minute'
1697
+ });
1698
+ }
1699
+ return formatters$3.m(date, token);
1700
+ },
1701
+ // Second
1702
+ s: function s(date, token, localize) {
1703
+ if (token === 'so') {
1704
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1705
+ unit: 'second'
1706
+ });
1707
+ }
1708
+ return formatters$3.s(date, token);
1709
+ },
1710
+ // Fraction of second
1711
+ S: function S(date, token) {
1712
+ return formatters$3.S(date, token);
1713
+ },
1714
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1715
+ X: function X(date, token, _localize, options) {
1716
+ var originalDate = options._originalDate || date;
1717
+ var timezoneOffset = originalDate.getTimezoneOffset();
1718
+ if (timezoneOffset === 0) {
1719
+ return 'Z';
1720
+ }
1721
+ switch (token) {
1722
+ // Hours and optional minutes
1723
+ case 'X':
1724
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1725
+
1726
+ // Hours, minutes and optional seconds without `:` delimiter
1727
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1728
+ // so this token always has the same output as `XX`
1729
+ case 'XXXX':
1730
+ case 'XX':
1731
+ // Hours and minutes without `:` delimiter
1732
+ return formatTimezone(timezoneOffset);
1733
+
1734
+ // Hours, minutes and optional seconds with `:` delimiter
1735
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1736
+ // so this token always has the same output as `XXX`
1737
+ case 'XXXXX':
1738
+ case 'XXX': // Hours and minutes with `:` delimiter
1739
+ default:
1740
+ return formatTimezone(timezoneOffset, ':');
1741
+ }
1742
+ },
1743
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1744
+ x: function x(date, token, _localize, options) {
1745
+ var originalDate = options._originalDate || date;
1746
+ var timezoneOffset = originalDate.getTimezoneOffset();
1747
+ switch (token) {
1748
+ // Hours and optional minutes
1749
+ case 'x':
1750
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1751
+
1752
+ // Hours, minutes and optional seconds without `:` delimiter
1753
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1754
+ // so this token always has the same output as `xx`
1755
+ case 'xxxx':
1756
+ case 'xx':
1757
+ // Hours and minutes without `:` delimiter
1758
+ return formatTimezone(timezoneOffset);
1759
+
1760
+ // Hours, minutes and optional seconds with `:` delimiter
1761
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1762
+ // so this token always has the same output as `xxx`
1763
+ case 'xxxxx':
1764
+ case 'xxx': // Hours and minutes with `:` delimiter
1765
+ default:
1766
+ return formatTimezone(timezoneOffset, ':');
1767
+ }
1768
+ },
1769
+ // Timezone (GMT)
1770
+ O: function O(date, token, _localize, options) {
1771
+ var originalDate = options._originalDate || date;
1772
+ var timezoneOffset = originalDate.getTimezoneOffset();
1773
+ switch (token) {
1774
+ // Short
1775
+ case 'O':
1776
+ case 'OO':
1777
+ case 'OOO':
1778
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1779
+ // Long
1780
+ case 'OOOO':
1781
+ default:
1782
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1783
+ }
1784
+ },
1785
+ // Timezone (specific non-location)
1786
+ z: function z(date, token, _localize, options) {
1787
+ var originalDate = options._originalDate || date;
1788
+ var timezoneOffset = originalDate.getTimezoneOffset();
1789
+ switch (token) {
1790
+ // Short
1791
+ case 'z':
1792
+ case 'zz':
1793
+ case 'zzz':
1794
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1795
+ // Long
1796
+ case 'zzzz':
1797
+ default:
1798
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1799
+ }
1800
+ },
1801
+ // Seconds timestamp
1802
+ t: function t(date, token, _localize, options) {
1803
+ var originalDate = options._originalDate || date;
1804
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1805
+ return addLeadingZeros(timestamp, token.length);
1806
+ },
1807
+ // Milliseconds timestamp
1808
+ T: function T(date, token, _localize, options) {
1809
+ var originalDate = options._originalDate || date;
1810
+ var timestamp = originalDate.getTime();
1811
+ return addLeadingZeros(timestamp, token.length);
1812
+ }
1813
+ };
1814
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1815
+ var sign = offset > 0 ? '-' : '+';
1816
+ var absOffset = Math.abs(offset);
1817
+ var hours = Math.floor(absOffset / 60);
1818
+ var minutes = absOffset % 60;
1819
+ if (minutes === 0) {
1820
+ return sign + String(hours);
1821
+ }
1822
+ var delimiter = dirtyDelimiter || '';
1823
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1824
+ }
1825
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1826
+ if (offset % 60 === 0) {
1827
+ var sign = offset > 0 ? '-' : '+';
1828
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1829
+ }
1830
+ return formatTimezone(offset, dirtyDelimiter);
1831
+ }
1832
+ function formatTimezone(offset, dirtyDelimiter) {
1833
+ var delimiter = dirtyDelimiter || '';
1834
+ var sign = offset > 0 ? '-' : '+';
1835
+ var absOffset = Math.abs(offset);
1836
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1837
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1838
+ return sign + hours + delimiter + minutes;
1839
+ }
1840
+ const formatters$1 = formatters;
1841
+
1842
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1843
+ switch (pattern) {
1844
+ case 'P':
1845
+ return formatLong.date({
1846
+ width: 'short'
1847
+ });
1848
+ case 'PP':
1849
+ return formatLong.date({
1850
+ width: 'medium'
1851
+ });
1852
+ case 'PPP':
1853
+ return formatLong.date({
1854
+ width: 'long'
1855
+ });
1856
+ case 'PPPP':
1857
+ default:
1858
+ return formatLong.date({
1859
+ width: 'full'
1860
+ });
1861
+ }
1862
+ };
1863
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1864
+ switch (pattern) {
1865
+ case 'p':
1866
+ return formatLong.time({
1867
+ width: 'short'
1868
+ });
1869
+ case 'pp':
1870
+ return formatLong.time({
1871
+ width: 'medium'
1872
+ });
1873
+ case 'ppp':
1874
+ return formatLong.time({
1875
+ width: 'long'
1876
+ });
1877
+ case 'pppp':
1878
+ default:
1879
+ return formatLong.time({
1880
+ width: 'full'
1881
+ });
1882
+ }
1883
+ };
1884
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1885
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1886
+ var datePattern = matchResult[1];
1887
+ var timePattern = matchResult[2];
1888
+ if (!timePattern) {
1889
+ return dateLongFormatter(pattern, formatLong);
1890
+ }
1891
+ var dateTimeFormat;
1892
+ switch (datePattern) {
1893
+ case 'P':
1894
+ dateTimeFormat = formatLong.dateTime({
1895
+ width: 'short'
1896
+ });
1897
+ break;
1898
+ case 'PP':
1899
+ dateTimeFormat = formatLong.dateTime({
1900
+ width: 'medium'
1901
+ });
1902
+ break;
1903
+ case 'PPP':
1904
+ dateTimeFormat = formatLong.dateTime({
1905
+ width: 'long'
1906
+ });
1907
+ break;
1908
+ case 'PPPP':
1909
+ default:
1910
+ dateTimeFormat = formatLong.dateTime({
1911
+ width: 'full'
1912
+ });
1913
+ break;
1914
+ }
1915
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1916
+ };
1917
+ var longFormatters = {
1918
+ p: timeLongFormatter,
1919
+ P: dateTimeLongFormatter
1920
+ };
1921
+ const longFormatters$1 = longFormatters;
1922
+
1923
+ var protectedDayOfYearTokens = ['D', 'DD'];
1924
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1925
+ function isProtectedDayOfYearToken(token) {
1926
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1927
+ }
1928
+ function isProtectedWeekYearToken(token) {
1929
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1930
+ }
1931
+ function throwProtectedError(token, format, input) {
1932
+ if (token === 'YYYY') {
1933
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1934
+ } else if (token === 'YY') {
1935
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1936
+ } else if (token === 'D') {
1937
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1938
+ } else if (token === 'DD') {
1939
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1940
+ }
1941
+ }
1942
+
1943
+ var formatDistanceLocale = {
1944
+ lessThanXSeconds: {
1945
+ one: 'less than a second',
1946
+ other: 'less than {{count}} seconds'
1947
+ },
1948
+ xSeconds: {
1949
+ one: '1 second',
1950
+ other: '{{count}} seconds'
1951
+ },
1952
+ halfAMinute: 'half a minute',
1953
+ lessThanXMinutes: {
1954
+ one: 'less than a minute',
1955
+ other: 'less than {{count}} minutes'
1956
+ },
1957
+ xMinutes: {
1958
+ one: '1 minute',
1959
+ other: '{{count}} minutes'
1960
+ },
1961
+ aboutXHours: {
1962
+ one: 'about 1 hour',
1963
+ other: 'about {{count}} hours'
1964
+ },
1965
+ xHours: {
1966
+ one: '1 hour',
1967
+ other: '{{count}} hours'
1968
+ },
1969
+ xDays: {
1970
+ one: '1 day',
1971
+ other: '{{count}} days'
1972
+ },
1973
+ aboutXWeeks: {
1974
+ one: 'about 1 week',
1975
+ other: 'about {{count}} weeks'
1976
+ },
1977
+ xWeeks: {
1978
+ one: '1 week',
1979
+ other: '{{count}} weeks'
1980
+ },
1981
+ aboutXMonths: {
1982
+ one: 'about 1 month',
1983
+ other: 'about {{count}} months'
1984
+ },
1985
+ xMonths: {
1986
+ one: '1 month',
1987
+ other: '{{count}} months'
1988
+ },
1989
+ aboutXYears: {
1990
+ one: 'about 1 year',
1991
+ other: 'about {{count}} years'
1992
+ },
1993
+ xYears: {
1994
+ one: '1 year',
1995
+ other: '{{count}} years'
1996
+ },
1997
+ overXYears: {
1998
+ one: 'over 1 year',
1999
+ other: 'over {{count}} years'
2000
+ },
2001
+ almostXYears: {
2002
+ one: 'almost 1 year',
2003
+ other: 'almost {{count}} years'
2004
+ }
2005
+ };
2006
+ var formatDistance = function formatDistance(token, count, options) {
2007
+ var result;
2008
+ var tokenValue = formatDistanceLocale[token];
2009
+ if (typeof tokenValue === 'string') {
2010
+ result = tokenValue;
2011
+ } else if (count === 1) {
2012
+ result = tokenValue.one;
2013
+ } else {
2014
+ result = tokenValue.other.replace('{{count}}', count.toString());
2015
+ }
2016
+ if (options !== null && options !== void 0 && options.addSuffix) {
2017
+ if (options.comparison && options.comparison > 0) {
2018
+ return 'in ' + result;
2019
+ } else {
2020
+ return result + ' ago';
2021
+ }
2022
+ }
2023
+ return result;
2024
+ };
2025
+ const formatDistance$1 = formatDistance;
2026
+
2027
+ function buildFormatLongFn(args) {
2028
+ return function () {
2029
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2030
+ // TODO: Remove String()
2031
+ var width = options.width ? String(options.width) : args.defaultWidth;
2032
+ var format = args.formats[width] || args.formats[args.defaultWidth];
2033
+ return format;
2034
+ };
2035
+ }
2036
+
2037
+ var dateFormats = {
2038
+ full: 'EEEE, MMMM do, y',
2039
+ long: 'MMMM do, y',
2040
+ medium: 'MMM d, y',
2041
+ short: 'MM/dd/yyyy'
2042
+ };
2043
+ var timeFormats = {
2044
+ full: 'h:mm:ss a zzzz',
2045
+ long: 'h:mm:ss a z',
2046
+ medium: 'h:mm:ss a',
2047
+ short: 'h:mm a'
2048
+ };
2049
+ var dateTimeFormats = {
2050
+ full: "{{date}} 'at' {{time}}",
2051
+ long: "{{date}} 'at' {{time}}",
2052
+ medium: '{{date}}, {{time}}',
2053
+ short: '{{date}}, {{time}}'
2054
+ };
2055
+ var formatLong = {
2056
+ date: buildFormatLongFn({
2057
+ formats: dateFormats,
2058
+ defaultWidth: 'full'
2059
+ }),
2060
+ time: buildFormatLongFn({
2061
+ formats: timeFormats,
2062
+ defaultWidth: 'full'
2063
+ }),
2064
+ dateTime: buildFormatLongFn({
2065
+ formats: dateTimeFormats,
2066
+ defaultWidth: 'full'
2067
+ })
2068
+ };
2069
+ const formatLong$1 = formatLong;
2070
+
2071
+ var formatRelativeLocale = {
2072
+ lastWeek: "'last' eeee 'at' p",
2073
+ yesterday: "'yesterday at' p",
2074
+ today: "'today at' p",
2075
+ tomorrow: "'tomorrow at' p",
2076
+ nextWeek: "eeee 'at' p",
2077
+ other: 'P'
2078
+ };
2079
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
2080
+ return formatRelativeLocale[token];
2081
+ };
2082
+ const formatRelative$1 = formatRelative;
2083
+
2084
+ function buildLocalizeFn(args) {
2085
+ return function (dirtyIndex, options) {
2086
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
2087
+ var valuesArray;
2088
+ if (context === 'formatting' && args.formattingValues) {
2089
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
2090
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
2091
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
2092
+ } else {
2093
+ var _defaultWidth = args.defaultWidth;
2094
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
2095
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
2096
+ }
2097
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
2098
+ // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
2099
+ return valuesArray[index];
2100
+ };
2101
+ }
2102
+
2103
+ var eraValues = {
2104
+ narrow: ['B', 'A'],
2105
+ abbreviated: ['BC', 'AD'],
2106
+ wide: ['Before Christ', 'Anno Domini']
2107
+ };
2108
+ var quarterValues = {
2109
+ narrow: ['1', '2', '3', '4'],
2110
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
2111
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
2112
+ };
2113
+
2114
+ // Note: in English, the names of days of the week and months are capitalized.
2115
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
2116
+ // Generally, formatted dates should look like they are in the middle of a sentence,
2117
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
2118
+ var monthValues = {
2119
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
2120
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
2121
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
2122
+ };
2123
+ var dayValues = {
2124
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
2125
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
2126
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
2127
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
2128
+ };
2129
+ var dayPeriodValues = {
2130
+ narrow: {
2131
+ am: 'a',
2132
+ pm: 'p',
2133
+ midnight: 'mi',
2134
+ noon: 'n',
2135
+ morning: 'morning',
2136
+ afternoon: 'afternoon',
2137
+ evening: 'evening',
2138
+ night: 'night'
2139
+ },
2140
+ abbreviated: {
2141
+ am: 'AM',
2142
+ pm: 'PM',
2143
+ midnight: 'midnight',
2144
+ noon: 'noon',
2145
+ morning: 'morning',
2146
+ afternoon: 'afternoon',
2147
+ evening: 'evening',
2148
+ night: 'night'
2149
+ },
2150
+ wide: {
2151
+ am: 'a.m.',
2152
+ pm: 'p.m.',
2153
+ midnight: 'midnight',
2154
+ noon: 'noon',
2155
+ morning: 'morning',
2156
+ afternoon: 'afternoon',
2157
+ evening: 'evening',
2158
+ night: 'night'
2159
+ }
2160
+ };
2161
+ var formattingDayPeriodValues = {
2162
+ narrow: {
2163
+ am: 'a',
2164
+ pm: 'p',
2165
+ midnight: 'mi',
2166
+ noon: 'n',
2167
+ morning: 'in the morning',
2168
+ afternoon: 'in the afternoon',
2169
+ evening: 'in the evening',
2170
+ night: 'at night'
2171
+ },
2172
+ abbreviated: {
2173
+ am: 'AM',
2174
+ pm: 'PM',
2175
+ midnight: 'midnight',
2176
+ noon: 'noon',
2177
+ morning: 'in the morning',
2178
+ afternoon: 'in the afternoon',
2179
+ evening: 'in the evening',
2180
+ night: 'at night'
2181
+ },
2182
+ wide: {
2183
+ am: 'a.m.',
2184
+ pm: 'p.m.',
2185
+ midnight: 'midnight',
2186
+ noon: 'noon',
2187
+ morning: 'in the morning',
2188
+ afternoon: 'in the afternoon',
2189
+ evening: 'in the evening',
2190
+ night: 'at night'
2191
+ }
2192
+ };
2193
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
2194
+ var number = Number(dirtyNumber);
2195
+
2196
+ // If ordinal numbers depend on context, for example,
2197
+ // if they are different for different grammatical genders,
2198
+ // use `options.unit`.
2199
+ //
2200
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
2201
+ // 'day', 'hour', 'minute', 'second'.
2202
+
2203
+ var rem100 = number % 100;
2204
+ if (rem100 > 20 || rem100 < 10) {
2205
+ switch (rem100 % 10) {
2206
+ case 1:
2207
+ return number + 'st';
2208
+ case 2:
2209
+ return number + 'nd';
2210
+ case 3:
2211
+ return number + 'rd';
2212
+ }
2213
+ }
2214
+ return number + 'th';
2215
+ };
2216
+ var localize = {
2217
+ ordinalNumber: ordinalNumber,
2218
+ era: buildLocalizeFn({
2219
+ values: eraValues,
2220
+ defaultWidth: 'wide'
2221
+ }),
2222
+ quarter: buildLocalizeFn({
2223
+ values: quarterValues,
2224
+ defaultWidth: 'wide',
2225
+ argumentCallback: function argumentCallback(quarter) {
2226
+ return quarter - 1;
2227
+ }
2228
+ }),
2229
+ month: buildLocalizeFn({
2230
+ values: monthValues,
2231
+ defaultWidth: 'wide'
2232
+ }),
2233
+ day: buildLocalizeFn({
2234
+ values: dayValues,
2235
+ defaultWidth: 'wide'
2236
+ }),
2237
+ dayPeriod: buildLocalizeFn({
2238
+ values: dayPeriodValues,
2239
+ defaultWidth: 'wide',
2240
+ formattingValues: formattingDayPeriodValues,
2241
+ defaultFormattingWidth: 'wide'
2242
+ })
2243
+ };
2244
+ const localize$1 = localize;
2245
+
2246
+ function buildMatchFn(args) {
2247
+ return function (string) {
2248
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2249
+ var width = options.width;
2250
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
2251
+ var matchResult = string.match(matchPattern);
2252
+ if (!matchResult) {
2253
+ return null;
2254
+ }
2255
+ var matchedString = matchResult[0];
2256
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
2257
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
2258
+ return pattern.test(matchedString);
2259
+ }) : findKey(parsePatterns, function (pattern) {
2260
+ return pattern.test(matchedString);
2261
+ });
2262
+ var value;
2263
+ value = args.valueCallback ? args.valueCallback(key) : key;
2264
+ value = options.valueCallback ? options.valueCallback(value) : value;
2265
+ var rest = string.slice(matchedString.length);
2266
+ return {
2267
+ value: value,
2268
+ rest: rest
2269
+ };
2270
+ };
2271
+ }
2272
+ function findKey(object, predicate) {
2273
+ for (var key in object) {
2274
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
2275
+ return key;
2276
+ }
2277
+ }
2278
+ return undefined;
2279
+ }
2280
+ function findIndex(array, predicate) {
2281
+ for (var key = 0; key < array.length; key++) {
2282
+ if (predicate(array[key])) {
2283
+ return key;
2284
+ }
2285
+ }
2286
+ return undefined;
2287
+ }
2288
+
2289
+ function buildMatchPatternFn(args) {
2290
+ return function (string) {
2291
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2292
+ var matchResult = string.match(args.matchPattern);
2293
+ if (!matchResult) return null;
2294
+ var matchedString = matchResult[0];
2295
+ var parseResult = string.match(args.parsePattern);
2296
+ if (!parseResult) return null;
2297
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2298
+ value = options.valueCallback ? options.valueCallback(value) : value;
2299
+ var rest = string.slice(matchedString.length);
2300
+ return {
2301
+ value: value,
2302
+ rest: rest
2303
+ };
2304
+ };
2305
+ }
2306
+
2307
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
2308
+ var parseOrdinalNumberPattern = /\d+/i;
2309
+ var matchEraPatterns = {
2310
+ narrow: /^(b|a)/i,
2311
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2312
+ wide: /^(before christ|before common era|anno domini|common era)/i
2313
+ };
2314
+ var parseEraPatterns = {
2315
+ any: [/^b/i, /^(a|c)/i]
2316
+ };
2317
+ var matchQuarterPatterns = {
2318
+ narrow: /^[1234]/i,
2319
+ abbreviated: /^q[1234]/i,
2320
+ wide: /^[1234](th|st|nd|rd)? quarter/i
2321
+ };
2322
+ var parseQuarterPatterns = {
2323
+ any: [/1/i, /2/i, /3/i, /4/i]
2324
+ };
2325
+ var matchMonthPatterns = {
2326
+ narrow: /^[jfmasond]/i,
2327
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2328
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2329
+ };
2330
+ var parseMonthPatterns = {
2331
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
2332
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
2333
+ };
2334
+ var matchDayPatterns = {
2335
+ narrow: /^[smtwf]/i,
2336
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
2337
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2338
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2339
+ };
2340
+ var parseDayPatterns = {
2341
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2342
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2343
+ };
2344
+ var matchDayPeriodPatterns = {
2345
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2346
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2347
+ };
2348
+ var parseDayPeriodPatterns = {
2349
+ any: {
2350
+ am: /^a/i,
2351
+ pm: /^p/i,
2352
+ midnight: /^mi/i,
2353
+ noon: /^no/i,
2354
+ morning: /morning/i,
2355
+ afternoon: /afternoon/i,
2356
+ evening: /evening/i,
2357
+ night: /night/i
2358
+ }
2359
+ };
2360
+ var match = {
2361
+ ordinalNumber: buildMatchPatternFn({
2362
+ matchPattern: matchOrdinalNumberPattern,
2363
+ parsePattern: parseOrdinalNumberPattern,
2364
+ valueCallback: function valueCallback(value) {
2365
+ return parseInt(value, 10);
2366
+ }
2367
+ }),
2368
+ era: buildMatchFn({
2369
+ matchPatterns: matchEraPatterns,
2370
+ defaultMatchWidth: 'wide',
2371
+ parsePatterns: parseEraPatterns,
2372
+ defaultParseWidth: 'any'
2373
+ }),
2374
+ quarter: buildMatchFn({
2375
+ matchPatterns: matchQuarterPatterns,
2376
+ defaultMatchWidth: 'wide',
2377
+ parsePatterns: parseQuarterPatterns,
2378
+ defaultParseWidth: 'any',
2379
+ valueCallback: function valueCallback(index) {
2380
+ return index + 1;
2381
+ }
2382
+ }),
2383
+ month: buildMatchFn({
2384
+ matchPatterns: matchMonthPatterns,
2385
+ defaultMatchWidth: 'wide',
2386
+ parsePatterns: parseMonthPatterns,
2387
+ defaultParseWidth: 'any'
2388
+ }),
2389
+ day: buildMatchFn({
2390
+ matchPatterns: matchDayPatterns,
2391
+ defaultMatchWidth: 'wide',
2392
+ parsePatterns: parseDayPatterns,
2393
+ defaultParseWidth: 'any'
2394
+ }),
2395
+ dayPeriod: buildMatchFn({
2396
+ matchPatterns: matchDayPeriodPatterns,
2397
+ defaultMatchWidth: 'any',
2398
+ parsePatterns: parseDayPeriodPatterns,
2399
+ defaultParseWidth: 'any'
2400
+ })
2401
+ };
2402
+ const match$1 = match;
2403
+
2404
+ /**
2405
+ * @type {Locale}
2406
+ * @category Locales
2407
+ * @summary English locale (United States).
2408
+ * @language English
2409
+ * @iso-639-2 eng
2410
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
2411
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
2412
+ */
2413
+ var locale = {
2414
+ code: 'en-US',
2415
+ formatDistance: formatDistance$1,
2416
+ formatLong: formatLong$1,
2417
+ formatRelative: formatRelative$1,
2418
+ localize: localize$1,
2419
+ match: match$1,
2420
+ options: {
2421
+ weekStartsOn: 0 /* Sunday */,
2422
+ firstWeekContainsDate: 1
2423
+ }
2424
+ };
2425
+ const defaultLocale = locale;
2426
+
2427
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2428
+ // (one of the certain letters followed by `o`)
2429
+ // - (\w)\1* matches any sequences of the same letter
2430
+ // - '' matches two quote characters in a row
2431
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
2432
+ // except a single quote symbol, which ends the sequence.
2433
+ // Two quote characters do not end the sequence.
2434
+ // If there is no matching single quote
2435
+ // then the sequence will continue until the end of the string.
2436
+ // - . matches any single character unmatched by previous parts of the RegExps
2437
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2438
+
2439
+ // This RegExp catches symbols escaped by quotes, and also
2440
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2441
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2442
+ var escapedStringRegExp = /^'([^]*?)'?$/;
2443
+ var doubleQuoteRegExp = /''/g;
2444
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2445
+
2446
+ /**
2447
+ * @name format
2448
+ * @category Common Helpers
2449
+ * @summary Format the date.
2450
+ *
2451
+ * @description
2452
+ * Return the formatted date string in the given format. The result may vary by locale.
2453
+ *
2454
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2455
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2456
+ *
2457
+ * The characters wrapped between two single quotes characters (') are escaped.
2458
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
2459
+ * (see the last example)
2460
+ *
2461
+ * Format of the string is based on Unicode Technical Standard #35:
2462
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
2463
+ * with a few additions (see note 7 below the table).
2464
+ *
2465
+ * Accepted patterns:
2466
+ * | Unit | Pattern | Result examples | Notes |
2467
+ * |---------------------------------|---------|-----------------------------------|-------|
2468
+ * | Era | G..GGG | AD, BC | |
2469
+ * | | GGGG | Anno Domini, Before Christ | 2 |
2470
+ * | | GGGGG | A, B | |
2471
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
2472
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
2473
+ * | | yy | 44, 01, 00, 17 | 5 |
2474
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
2475
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
2476
+ * | | yyyyy | ... | 3,5 |
2477
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
2478
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
2479
+ * | | YY | 44, 01, 00, 17 | 5,8 |
2480
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
2481
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
2482
+ * | | YYYYY | ... | 3,5 |
2483
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
2484
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
2485
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
2486
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
2487
+ * | | RRRRR | ... | 3,5,7 |
2488
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
2489
+ * | | uu | -43, 01, 1900, 2017 | 5 |
2490
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
2491
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
2492
+ * | | uuuuu | ... | 3,5 |
2493
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2494
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2495
+ * | | QQ | 01, 02, 03, 04 | |
2496
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
2497
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2498
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
2499
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2500
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2501
+ * | | qq | 01, 02, 03, 04 | |
2502
+ * | | qqq | Q1, Q2, Q3, Q4 | |
2503
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2504
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
2505
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
2506
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
2507
+ * | | MM | 01, 02, ..., 12 | |
2508
+ * | | MMM | Jan, Feb, ..., Dec | |
2509
+ * | | MMMM | January, February, ..., December | 2 |
2510
+ * | | MMMMM | J, F, ..., D | |
2511
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2512
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
2513
+ * | | LL | 01, 02, ..., 12 | |
2514
+ * | | LLL | Jan, Feb, ..., Dec | |
2515
+ * | | LLLL | January, February, ..., December | 2 |
2516
+ * | | LLLLL | J, F, ..., D | |
2517
+ * | Local week of year | w | 1, 2, ..., 53 | |
2518
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
2519
+ * | | ww | 01, 02, ..., 53 | |
2520
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2521
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
2522
+ * | | II | 01, 02, ..., 53 | 7 |
2523
+ * | Day of month | d | 1, 2, ..., 31 | |
2524
+ * | | do | 1st, 2nd, ..., 31st | 7 |
2525
+ * | | dd | 01, 02, ..., 31 | |
2526
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2527
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2528
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
2529
+ * | | DDD | 001, 002, ..., 365, 366 | |
2530
+ * | | DDDD | ... | 3 |
2531
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2532
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2533
+ * | | EEEEE | M, T, W, T, F, S, S | |
2534
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2535
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2536
+ * | | io | 1st, 2nd, ..., 7th | 7 |
2537
+ * | | ii | 01, 02, ..., 07 | 7 |
2538
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2539
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2540
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
2541
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
2542
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2543
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
2544
+ * | | ee | 02, 03, ..., 01 | |
2545
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
2546
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2547
+ * | | eeeee | M, T, W, T, F, S, S | |
2548
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2549
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2550
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
2551
+ * | | cc | 02, 03, ..., 01 | |
2552
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
2553
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2554
+ * | | ccccc | M, T, W, T, F, S, S | |
2555
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2556
+ * | AM, PM | a..aa | AM, PM | |
2557
+ * | | aaa | am, pm | |
2558
+ * | | aaaa | a.m., p.m. | 2 |
2559
+ * | | aaaaa | a, p | |
2560
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2561
+ * | | bbb | am, pm, noon, midnight | |
2562
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
2563
+ * | | bbbbb | a, p, n, mi | |
2564
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
2565
+ * | | BBBB | at night, in the morning, ... | 2 |
2566
+ * | | BBBBB | at night, in the morning, ... | |
2567
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2568
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2569
+ * | | hh | 01, 02, ..., 11, 12 | |
2570
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2571
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2572
+ * | | HH | 00, 01, 02, ..., 23 | |
2573
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2574
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2575
+ * | | KK | 01, 02, ..., 11, 00 | |
2576
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2577
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2578
+ * | | kk | 24, 01, 02, ..., 23 | |
2579
+ * | Minute | m | 0, 1, ..., 59 | |
2580
+ * | | mo | 0th, 1st, ..., 59th | 7 |
2581
+ * | | mm | 00, 01, ..., 59 | |
2582
+ * | Second | s | 0, 1, ..., 59 | |
2583
+ * | | so | 0th, 1st, ..., 59th | 7 |
2584
+ * | | ss | 00, 01, ..., 59 | |
2585
+ * | Fraction of second | S | 0, 1, ..., 9 | |
2586
+ * | | SS | 00, 01, ..., 99 | |
2587
+ * | | SSS | 000, 001, ..., 999 | |
2588
+ * | | SSSS | ... | 3 |
2589
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2590
+ * | | XX | -0800, +0530, Z | |
2591
+ * | | XXX | -08:00, +05:30, Z | |
2592
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2593
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2594
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2595
+ * | | xx | -0800, +0530, +0000 | |
2596
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
2597
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
2598
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2599
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2600
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2601
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2602
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2603
+ * | Seconds timestamp | t | 512969520 | 7 |
2604
+ * | | tt | ... | 3,7 |
2605
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
2606
+ * | | TT | ... | 3,7 |
2607
+ * | Long localized date | P | 04/29/1453 | 7 |
2608
+ * | | PP | Apr 29, 1453 | 7 |
2609
+ * | | PPP | April 29th, 1453 | 7 |
2610
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2611
+ * | Long localized time | p | 12:00 AM | 7 |
2612
+ * | | pp | 12:00:00 AM | 7 |
2613
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
2614
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2615
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2616
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2617
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
2618
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2619
+ * Notes:
2620
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2621
+ * are the same as "stand-alone" units, but are different in some languages.
2622
+ * "Formatting" units are declined according to the rules of the language
2623
+ * in the context of a date. "Stand-alone" units are always nominative singular:
2624
+ *
2625
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2626
+ *
2627
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2628
+ *
2629
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2630
+ * the single quote characters (see below).
2631
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2632
+ * the output will be the same as default pattern for this unit, usually
2633
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2634
+ * are marked with "2" in the last column of the table.
2635
+ *
2636
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2637
+ *
2638
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2639
+ *
2640
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2641
+ *
2642
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2643
+ *
2644
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2645
+ *
2646
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2647
+ * The output will be padded with zeros to match the length of the pattern.
2648
+ *
2649
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2650
+ *
2651
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2652
+ * These tokens represent the shortest form of the quarter.
2653
+ *
2654
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2655
+ *
2656
+ * | Year | `y` | `u` |
2657
+ * |------|-----|-----|
2658
+ * | AC 1 | 1 | 1 |
2659
+ * | BC 1 | 1 | 0 |
2660
+ * | BC 2 | 2 | -1 |
2661
+ *
2662
+ * Also `yy` always returns the last two digits of a year,
2663
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2664
+ *
2665
+ * | Year | `yy` | `uu` |
2666
+ * |------|------|------|
2667
+ * | 1 | 01 | 01 |
2668
+ * | 14 | 14 | 14 |
2669
+ * | 376 | 76 | 376 |
2670
+ * | 1453 | 53 | 1453 |
2671
+ *
2672
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2673
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2674
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2675
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2676
+ *
2677
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2678
+ * so right now these tokens fall back to GMT timezones.
2679
+ *
2680
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2681
+ * - `i`: ISO day of week
2682
+ * - `I`: ISO week of year
2683
+ * - `R`: ISO week-numbering year
2684
+ * - `t`: seconds timestamp
2685
+ * - `T`: milliseconds timestamp
2686
+ * - `o`: ordinal number modifier
2687
+ * - `P`: long localized date
2688
+ * - `p`: long localized time
2689
+ *
2690
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2691
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2692
+ *
2693
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2694
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2695
+ *
2696
+ * @param {Date|Number} date - the original date
2697
+ * @param {String} format - the string of tokens
2698
+ * @param {Object} [options] - an object with options.
2699
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2700
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2701
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2702
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2703
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2704
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2705
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2706
+ * @returns {String} the formatted date string
2707
+ * @throws {TypeError} 2 arguments required
2708
+ * @throws {RangeError} `date` must not be Invalid Date
2709
+ * @throws {RangeError} `options.locale` must contain `localize` property
2710
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2711
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2712
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2713
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2714
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2715
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2716
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2717
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2718
+ *
2719
+ * @example
2720
+ * // Represent 11 February 2014 in middle-endian format:
2721
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2722
+ * //=> '02/11/2014'
2723
+ *
2724
+ * @example
2725
+ * // Represent 2 July 2014 in Esperanto:
2726
+ * import { eoLocale } from 'date-fns/locale/eo'
2727
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2728
+ * locale: eoLocale
2729
+ * })
2730
+ * //=> '2-a de julio 2014'
2731
+ *
2732
+ * @example
2733
+ * // Escape string by single quote characters:
2734
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2735
+ * //=> "3 o'clock"
2736
+ */
2737
+
2738
+ function format(dirtyDate, dirtyFormatStr, options) {
2739
+ var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
2740
+ requiredArgs(2, arguments);
2741
+ var formatStr = String(dirtyFormatStr);
2742
+ var defaultOptions = getDefaultOptions();
2743
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
2744
+ var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2745
+
2746
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2747
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2748
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2749
+ }
2750
+ var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2751
+
2752
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2753
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2754
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2755
+ }
2756
+ if (!locale.localize) {
2757
+ throw new RangeError('locale must contain localize property');
2758
+ }
2759
+ if (!locale.formatLong) {
2760
+ throw new RangeError('locale must contain formatLong property');
2761
+ }
2762
+ var originalDate = toDate(dirtyDate);
2763
+ if (!isValid(originalDate)) {
2764
+ throw new RangeError('Invalid time value');
2765
+ }
2766
+
2767
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2768
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2769
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2770
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2771
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2772
+ var formatterOptions = {
2773
+ firstWeekContainsDate: firstWeekContainsDate,
2774
+ weekStartsOn: weekStartsOn,
2775
+ locale: locale,
2776
+ _originalDate: originalDate
2777
+ };
2778
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2779
+ var firstCharacter = substring[0];
2780
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2781
+ var longFormatter = longFormatters$1[firstCharacter];
2782
+ return longFormatter(substring, locale.formatLong);
2783
+ }
2784
+ return substring;
2785
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2786
+ // Replace two single quote characters with one single quote character
2787
+ if (substring === "''") {
2788
+ return "'";
2789
+ }
2790
+ var firstCharacter = substring[0];
2791
+ if (firstCharacter === "'") {
2792
+ return cleanEscapedString(substring);
2793
+ }
2794
+ var formatter = formatters$1[firstCharacter];
2795
+ if (formatter) {
2796
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2797
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2798
+ }
2799
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2800
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2801
+ }
2802
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2803
+ }
2804
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2805
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2806
+ }
2807
+ return substring;
2808
+ }).join('');
2809
+ return result;
2810
+ }
2811
+ function cleanEscapedString(input) {
2812
+ var matched = input.match(escapedStringRegExp);
2813
+ if (!matched) {
2814
+ return input;
2815
+ }
2816
+ return matched[1].replace(doubleQuoteRegExp, "'");
2817
+ }
2818
+
2819
+ const casinoChallengesPlayerHistoryCss = ".history {\n width: 100%;\n padding: 0 10%;\n box-sizing: border-box;\n display: flex;\n gap: 16px;\n flex-direction: column;\n}\n@container challenges-container (max-width: 800px) {\n .history {\n padding: 0;\n }\n}\n\n.item {\n background-color: var(--emw--history-item-background, rgba(114, 118, 114, 0.2));\n border-radius: 12px;\n padding: 20px;\n}\n\n.header {\n cursor: pointer;\n border: none;\n width: 100%;\n text-align: left;\n background: transparent;\n color: var(--emw--color-white, white);\n font-size: var(--emw--font-size-medium, 16px);\n font-weight: var(--emw--font-weight-bold, 700);\n display: flex;\n justify-content: space-between;\n padding: 0;\n}\n@container challenges-container (max-width: 800px) {\n .header {\n line-height: var(--emw--font-size-medium, 14px);\n }\n}\n\n.content {\n max-height: 0;\n overflow: auto;\n transition: max-height 0.3s ease;\n background: transparent;\n color: var(--emw--color-white, white);\n}\n.content.open {\n max-height: 400px;\n}\n.content .row {\n display: flex;\n font-size: var(--emw--font-size-medium, 14px);\n font-weight: var(--emw--font-weight-medium, 500);\n line-height: 24px;\n padding: 10px 12px 4px;\n box-sizing: border-box;\n color: var(--emw--color-gray-150, #c8d6ce);\n}\n.content .row .col-1 {\n flex-grow: 1;\n}\n.content .row .col-2 {\n width: 120px;\n}\n.content .row .col-2.errored {\n color: var(--emw--color-error, #D6421E);\n}\n@container challenges-container (max-width: 800px) {\n .content .row {\n font-size: var(--emw--font-size-small, 12px);\n line-height: 22px;\n }\n}\n@container challenges-container (max-width: 620px) {\n .content .row .col-1,\n .content .row .col-2 {\n width: 91px;\n }\n}\n.content .reward {\n margin: 0;\n padding: 0 12px 10px;\n box-sizing: border-box;\n font-size: var(--emw--font-size-small, 12px);\n font-weight: var(--emw--font-weight-medium, 500);\n line-height: 19px;\n color: var(--emw--color-valid, #03873e);\n border-bottom: 1px solid var(--emw--button-border-color, rgba(200, 214, 206, 0.1019607843));\n display: flex;\n gap: 8px;\n}\n.content .reward.grayed {\n color: var(--emw--color-gray-300, #555a57);\n}\n@container challenges-container (max-width: 800px) {\n .content .reward {\n font-size: var(--emw--font-size-small, 12px);\n line-height: 14px;\n }\n .content .reward img {\n width: 12px;\n height: 12px;\n }\n}\n.content .list-header {\n padding: 0 12px;\n margin-top: 20px;\n border-radius: 6px 6px 0 0;\n color: var(--emw--history-header-color, #727672);\n background: var(--emw--history-item-header-background, #202120);\n}\n.content .list-header span {\n font-size: var(--emw--font-size-small, 12px);\n font-weight: var(--emw--font-weight-bold, 700);\n line-height: 28px;\n}\n@container challenges-container (max-width: 800px) {\n .content .list-header span {\n font-size: var(--emw--font-size-x-small, 10px);\n line-height: 20px;\n }\n}";
2820
+ const CasinoChallengesPlayerHistoryStyle0 = casinoChallengesPlayerHistoryCss;
2821
+
2822
+ const skeletons = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
2823
+ const CasinoChallengesPlayerHistory = class {
2824
+ constructor(hostRef) {
2825
+ index.registerInstance(this, hostRef);
2826
+ this.loadMore = index.createEvent(this, "loadMore", 7);
2827
+ this.setLastItemRef = (el) => {
2828
+ if (this.lastItemRef && this.observer) {
2829
+ this.observer.unobserve(this.lastItemRef);
2830
+ }
2831
+ this.lastItemRef = el;
2832
+ if (el && this.observer && !this.loading) {
2833
+ this.observer.observe(el);
2834
+ }
2835
+ };
2836
+ this.mbSource = undefined;
2837
+ this.clientStyling = undefined;
2838
+ this.clientStylingUrl = undefined;
2839
+ this.translationUrl = '';
2840
+ this.language = 'en';
2841
+ this.playerHistory = [];
2842
+ this.loading = false;
2843
+ this.hasMore = false;
2844
+ this.openItems = [];
2845
+ }
2846
+ handleClientStylingChange(newValue, oldValue) {
2847
+ if (newValue != oldValue) {
2848
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
2849
+ }
2850
+ }
2851
+ handleClientStylingUrlChange(newValue, oldValue) {
2852
+ if (newValue != oldValue) {
2853
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2854
+ }
2855
+ }
2856
+ handleMbSourceChange(newValue, oldValue) {
2857
+ if (newValue != oldValue) {
2858
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
2859
+ }
2860
+ }
2861
+ handlePlayerHistoryChange() {
2862
+ this.openItems = this.playerHistory.map(() => false);
2863
+ }
2864
+ setupObserver() {
2865
+ if (!this.lastItemRef || this.loading || !this.hasMore)
2866
+ return;
2867
+ if (!this.observer) {
2868
+ this.observer = new IntersectionObserver(([entry]) => {
2869
+ if (entry.isIntersecting && !this.loading && this.hasMore) {
2870
+ this.observer.unobserve(entry.target);
2871
+ this.loadMore.emit();
2872
+ }
2873
+ }, {
2874
+ root: null,
2875
+ rootMargin: '0px',
2876
+ threshold: 0.1
2877
+ });
2878
+ }
2879
+ this.observer.disconnect();
2880
+ this.observer.observe(this.lastItemRef);
2881
+ }
2882
+ componentDidLoad() {
2883
+ if (this.stylingContainer) {
2884
+ if (this.mbSource)
2885
+ casinoChallengesContainer.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
2886
+ if (this.clientStyling)
2887
+ casinoChallengesContainer.setClientStyling(this.stylingContainer, this.clientStyling);
2888
+ if (this.clientStylingUrl)
2889
+ casinoChallengesContainer.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2890
+ }
2891
+ }
2892
+ componentWillLoad() {
2893
+ if (this.translationUrl) {
2894
+ resolveTranslationUrl(this.translationUrl);
2895
+ }
2896
+ }
2897
+ componentDidRender() {
2898
+ this.setupObserver();
2899
+ }
2900
+ disconnectedCallback() {
2901
+ var _a;
2902
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2903
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
2904
+ this.observer = undefined;
2905
+ }
2906
+ toggle(index) {
2907
+ this.openItems = this.openItems.map((open, i) => (i === index ? !open : open));
2908
+ }
2909
+ renderLevel(level) {
2910
+ const rewards = Object.values(level.Rewards)
2911
+ .map((r) => r.RewardDescription)
2912
+ .join(', ');
2913
+ return (index.h("div", null, index.h("div", { class: "row" }, index.h("span", { class: "col-1" }, `${translate('level', this.language)} ${level.OrderNumber + 1}`), index.h("span", { class: `col-2 ${level.Status === EHistoryItemLevelStatus.Forfeited ? 'errored' : ''}` }, HistoryItemLevelStatusDictionary[level.Status]), index.h("span", { class: "col-2" }, format(new Date(level.Time), 'dd/MM/yy HH:mm'))), index.h("p", { class: `reward ${level.Status === EHistoryItemLevelStatus.Completed ? '' : 'grayed'}` }, index.h("img", { src: giftSvg }), rewards)));
2914
+ }
2915
+ renderSkeletons() {
2916
+ return skeletons.map((skeleton) => (index.h("div", { class: "loader", key: skeleton }, index.h("ui-skeleton", { structure: "title", width: "auto", height: "60px", marginBottom: 0 }))));
2917
+ }
2918
+ render() {
2919
+ return (index.h("div", { key: '0781f3ee74b3f3b8b5b09e3269974e876ece82ef', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '78108ee5c86b0e87363e9ed980c242890f2453b1', class: "history" }, this.playerHistory.map((item, index$1) => (index.h("div", { class: "item", ref: index$1 === this.playerHistory.length - 1 ? this.setLastItemRef : null }, index.h("button", { class: "header", onClick: () => this.toggle(index$1) }, index.h("span", null, item.Name), index.h("img", { src: this.openItems[index$1] ? arrowUpSvg : arrowDownSvg })), index.h("div", { class: `content ${this.openItems[index$1] ? 'open' : ''}` }, index.h("div", { class: "row list-header" }, index.h("span", { class: "col-1", style: { textTransform: 'uppercase' } }, translate('level', this.language)), index.h("span", { class: "col-2", style: { textTransform: 'uppercase' } }, translate('status', this.language)), index.h("span", { class: "col-2", style: { textTransform: 'uppercase' } }, translate('time', this.language))), item.Levels.map((level) => this.renderLevel(level)))))), this.loading && this.renderSkeletons())));
2920
+ }
2921
+ static get watchers() { return {
2922
+ "clientStyling": ["handleClientStylingChange"],
2923
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2924
+ "mbSource": ["handleMbSourceChange"],
2925
+ "playerHistory": ["handlePlayerHistoryChange"]
2926
+ }; }
2927
+ };
2928
+ CasinoChallengesPlayerHistory.style = CasinoChallengesPlayerHistoryStyle0;
2929
+
2930
+ const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
2931
+ const UiSkeletonStyle0 = uiSkeletonCss;
2932
+
2933
+ const UiSkeleton = class {
2934
+ constructor(hostRef) {
2935
+ index.registerInstance(this, hostRef);
2936
+ this.stylingValue = {
2937
+ width: this.handleStylingProps(this.width),
2938
+ height: this.handleStylingProps(this.height),
2939
+ borderRadius: this.handleStylingProps(this.borderRadius),
2940
+ marginBottom: this.handleStylingProps(this.marginBottom),
2941
+ marginTop: this.handleStylingProps(this.marginTop),
2942
+ marginLeft: this.handleStylingProps(this.marginLeft),
2943
+ marginRight: this.handleStylingProps(this.marginRight),
2944
+ size: this.handleStylingProps(this.size)
2945
+ };
2946
+ this.structure = undefined;
2947
+ this.width = 'unset';
2948
+ this.height = 'unset';
2949
+ this.borderRadius = 'unset';
2950
+ this.marginBottom = 'unset';
2951
+ this.marginTop = 'unset';
2952
+ this.marginLeft = 'unset';
2953
+ this.marginRight = 'unset';
2954
+ this.animation = true;
2955
+ this.rows = 0;
2956
+ this.size = '100%';
2957
+ }
2958
+ handleStructureChange(newValue, oldValue) {
2959
+ if (oldValue !== newValue) {
2960
+ this.handleStructure(newValue);
2961
+ }
2962
+ }
2963
+ handleStylingProps(value) {
2964
+ switch (typeof value) {
2965
+ case 'number':
2966
+ return value === 0 ? 0 : `${value}px`;
2967
+ case 'undefined':
2968
+ return 'unset';
2969
+ case 'string':
2970
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
2971
+ value.endsWith('px') ||
2972
+ value.endsWith('%')) {
2973
+ return value;
2974
+ }
2975
+ else {
2976
+ return 'unset';
2977
+ }
2978
+ default:
2979
+ return 'unset';
2980
+ }
2981
+ }
2982
+ handleStructure(structure) {
2983
+ switch (structure) {
2984
+ case 'logo':
2985
+ return this.renderLogo();
2986
+ case 'image':
2987
+ return this.renderImage();
2988
+ case 'title':
2989
+ return this.renderTitle();
2990
+ case 'text':
2991
+ return this.renderText();
2992
+ case 'rectangle':
2993
+ return this.renderRectangle();
2994
+ case 'circle':
2995
+ return this.renderCircle();
2996
+ default:
2997
+ return null;
2998
+ }
2999
+ }
3000
+ renderLogo() {
3001
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Logo ' + (this.animation ? 'Skeleton' : '') })));
3002
+ }
3003
+ renderImage() {
3004
+ return index.h("div", { class: 'Image ' + (this.animation ? 'Skeleton' : '') });
3005
+ }
3006
+ renderTitle() {
3007
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Title ' + (this.animation ? 'Skeleton' : '') })));
3008
+ }
3009
+ renderText() {
3010
+ return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: 'Text ' + (this.animation ? 'Skeleton' : '') })))));
3011
+ }
3012
+ renderRectangle() {
3013
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Rectangle ' + (this.animation ? 'Skeleton' : '') })));
3014
+ }
3015
+ renderCircle() {
3016
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Circle ' + (this.animation ? 'Skeleton' : '') })));
3017
+ }
3018
+ render() {
3019
+ let styleBlock = '';
3020
+ switch (this.structure) {
3021
+ case 'logo':
3022
+ styleBlock = `
3023
+ :host {
3024
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
3025
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
3026
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
3027
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
3028
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
3029
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
3030
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
3031
+ }
3032
+ `;
3033
+ break;
3034
+ case 'image':
3035
+ styleBlock = `
3036
+ :host {
3037
+ --emw-skeleton-image-width: ${this.stylingValue.width};
3038
+ --emw-skeleton-image-height: ${this.stylingValue.height};
3039
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
3040
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
3041
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
3042
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
3043
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
3044
+ }
3045
+ `;
3046
+ break;
3047
+ case 'title':
3048
+ styleBlock = `
3049
+ :host {
3050
+ --emw-skeleton-title-width: ${this.stylingValue.width};
3051
+ --emw-skeleton-title-height: ${this.stylingValue.height};
3052
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
3053
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
3054
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
3055
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
3056
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
3057
+ }
3058
+ `;
3059
+ break;
3060
+ case 'text':
3061
+ styleBlock = `
3062
+ :host {
3063
+ --emw-skeleton-text-width: ${this.stylingValue.width};
3064
+ --emw-skeleton-text-height: ${this.stylingValue.height};
3065
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
3066
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
3067
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
3068
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
3069
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
3070
+ }
3071
+ `;
3072
+ break;
3073
+ case 'rectangle':
3074
+ styleBlock = `
3075
+ :host {
3076
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
3077
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
3078
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
3079
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
3080
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
3081
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
3082
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
3083
+ }
3084
+ `;
3085
+ break;
3086
+ case 'circle':
3087
+ styleBlock = `
3088
+ :host {
3089
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
3090
+ }
3091
+ `;
3092
+ break;
3093
+ default:
3094
+ styleBlock = '';
3095
+ }
3096
+ return (index.h(index.Host, { key: 'e6b885bfd985ce7663d990756fe9101e25eb97f0' }, index.h("style", { key: '06ae24c7bb74f4dacfc12ae58085333f9dc89da5' }, styleBlock), this.handleStructure(this.structure)));
3097
+ }
3098
+ static get watchers() { return {
3099
+ "structure": ["handleStructureChange"]
3100
+ }; }
3101
+ };
3102
+ UiSkeleton.style = UiSkeletonStyle0;
3103
+
3104
+ exports.casino_challenges_container = casinoChallengesContainer.CasinoChallengesContainer;
3105
+ exports.casino_challenge_card = CasinoChallengeCard;
3106
+ exports.casino_challenges_list = CasinoChallengeList;
3107
+ exports.casino_challenges_player_history = CasinoChallengesPlayerHistory;
3108
+ exports.ui_skeleton = UiSkeleton;