@flarehr/apollo-benefits 1.2.97 → 1.3.54109

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 (376) hide show
  1. package/README.md +19 -0
  2. package/dist/assets/@splitsoftware-7d799540.js +18 -0
  3. package/dist/assets/all_tab_color-548783b9.svg +21 -0
  4. package/dist/assets/all_tab_gray-a5051313.svg +6 -0
  5. package/dist/assets/check-57fe1dcb.svg +15 -0
  6. package/dist/assets/datadog-9aa4bf28.js +5 -0
  7. package/dist/assets/date-fns-c5d8fbc0.js +1 -0
  8. package/dist/assets/default_backdrop-fdd955b8.png +0 -0
  9. package/dist/assets/external_link-599a0aec.svg +3 -0
  10. package/dist/assets/external_link_white-55111b2e.svg +3 -0
  11. package/dist/assets/framer-motion-bb8d6b82.js +1 -0
  12. package/dist/assets/index-18cd5088.js +35 -0
  13. package/dist/assets/index-cfa25e28.css +1 -0
  14. package/dist/assets/index-e4f1c441.js +5 -0
  15. package/dist/assets/lodash-5d893f8c.js +1 -0
  16. package/dist/assets/logo-a34e9b4b.png +0 -0
  17. package/dist/assets/oidc-client-6f6e47c2.js +101 -0
  18. package/dist/assets/padlock-8c081120.svg +26 -0
  19. package/dist/assets/suitcase-6471ad05.svg +17 -0
  20. package/dist/assets/vendor-2d0139ca.js +788 -0
  21. package/dist/assets/warning-a7f1af23.svg +14 -0
  22. package/dist/assets/welcome_image_mobile-dbde6c80.png +0 -0
  23. package/dist/assets/welcome_image_v2-869c59e4.png +0 -0
  24. package/dist/assets/wellbeing_banner-6903d615.png +0 -0
  25. package/dist/assets/workplace_link_banner_mobile-6ebaa24b.png +0 -0
  26. package/dist/assets/workplace_link_banner_v2-c81ed849.png +0 -0
  27. package/dist/config.json +14 -0
  28. package/dist/favicon.ico +0 -0
  29. package/dist/icons/android-chrome-192x192.png +0 -0
  30. package/dist/icons/android-chrome-512x512.png +0 -0
  31. package/dist/icons/apple-touch-icon.png +0 -0
  32. package/dist/icons/favicon-16x16.png +0 -0
  33. package/dist/icons/favicon-32x32.png +0 -0
  34. package/dist/index.html +114 -0
  35. package/dist/manifest.json +21 -0
  36. package/dist/sw-esm.js +16 -0
  37. package/package.json +127 -69
  38. package/LICENSE +0 -21
  39. package/dist/lib/apollo-benefits/apollo-benefits.esm.js +0 -1
  40. package/dist/lib/apollo-benefits/assets/Hero_Background.png +0 -0
  41. package/dist/lib/apollo-benefits/assets/car-placeholder.svg +0 -5
  42. package/dist/lib/apollo-benefits/assets/check.svg +0 -13
  43. package/dist/lib/apollo-benefits/common-assets/icon-info.svg +0 -4
  44. package/dist/lib/apollo-benefits/index.esm.js +0 -0
  45. package/dist/lib/apollo-benefits/p-054d1471.js +0 -1
  46. package/dist/lib/apollo-benefits/p-066d8e7b.js +0 -15
  47. package/dist/lib/apollo-benefits/p-08376428.entry.js +0 -1
  48. package/dist/lib/apollo-benefits/p-1d7ab1b9.entry.js +0 -1
  49. package/dist/lib/apollo-benefits/p-25a89275.entry.js +0 -1
  50. package/dist/lib/apollo-benefits/p-26d363c9.entry.js +0 -1
  51. package/dist/lib/apollo-benefits/p-337ce3df.js +0 -1
  52. package/dist/lib/apollo-benefits/p-3dc9a379.js +0 -1
  53. package/dist/lib/apollo-benefits/p-4376366b.js +0 -46
  54. package/dist/lib/apollo-benefits/p-4e2d34f4.entry.js +0 -1
  55. package/dist/lib/apollo-benefits/p-50bbf713.js +0 -1
  56. package/dist/lib/apollo-benefits/p-53c5e861.entry.js +0 -1
  57. package/dist/lib/apollo-benefits/p-556fdb43.js +0 -1
  58. package/dist/lib/apollo-benefits/p-57d4702d.entry.js +0 -1
  59. package/dist/lib/apollo-benefits/p-58ee670f.js +0 -1
  60. package/dist/lib/apollo-benefits/p-6a54654f.entry.js +0 -11
  61. package/dist/lib/apollo-benefits/p-6bd33850.js +0 -1
  62. package/dist/lib/apollo-benefits/p-79c3b633.entry.js +0 -1
  63. package/dist/lib/apollo-benefits/p-7f3a2f3b.entry.js +0 -1
  64. package/dist/lib/apollo-benefits/p-82d42c2b.js +0 -1
  65. package/dist/lib/apollo-benefits/p-9b3e978e.js +0 -1
  66. package/dist/lib/apollo-benefits/p-a1dd0cba.entry.js +0 -1
  67. package/dist/lib/apollo-benefits/p-aa379cfe.entry.js +0 -1
  68. package/dist/lib/apollo-benefits/p-aaf0e527.entry.js +0 -1
  69. package/dist/lib/apollo-benefits/p-b0b9425b.js +0 -1
  70. package/dist/lib/apollo-benefits/p-d0ef83f8.entry.js +0 -1
  71. package/dist/lib/apollo-benefits/p-db4a65f0.entry.js +0 -1
  72. package/dist/lib/apollo-benefits/p-dc67f942.entry.js +0 -1
  73. package/dist/lib/apollo-benefits/p-e1fd79bb.entry.js +0 -1
  74. package/dist/lib/apollo-benefits/p-ea120e31.js +0 -1
  75. package/dist/lib/apollo-benefits/p-ef5f33ca.js +0 -1
  76. package/dist/lib/apollo-benefits/p-f5254031.js +0 -1
  77. package/dist/lib/apollo-benefits/p-f63d9d89.js +0 -1
  78. package/dist/lib/apollo-benefits/p-fcfa5255.entry.js +0 -1
  79. package/dist/lib/cjs/Option-98dab0b8.js +0 -1988
  80. package/dist/lib/cjs/active-router-90429847.js +0 -75
  81. package/dist/lib/cjs/ap-ben-asset_5.cjs.entry.js +0 -1856
  82. package/dist/lib/cjs/ap-ben-benefit-card.cjs.entry.js +0 -45
  83. package/dist/lib/cjs/ap-ben-benefit-list-item.cjs.entry.js +0 -56
  84. package/dist/lib/cjs/ap-ben-benefit-url_27.cjs.entry.js +0 -48767
  85. package/dist/lib/cjs/ap-ben-benefits-list_3.cjs.entry.js +0 -55
  86. package/dist/lib/cjs/ap-ben-benefits-page.cjs.entry.js +0 -55
  87. package/dist/lib/cjs/ap-ben-choose-vehicle-section_4.cjs.entry.js +0 -2779
  88. package/dist/lib/cjs/ap-ben-notifications-section.cjs.entry.js +0 -243
  89. package/dist/lib/cjs/ap-ben-oidc-callback-page.cjs.entry.js +0 -40
  90. package/dist/lib/cjs/apollo-benefits.cjs.js +0 -25
  91. package/dist/lib/cjs/app-globals-e04ab04b.js +0 -12
  92. package/dist/lib/cjs/authentication.service-11c30071.js +0 -237
  93. package/dist/lib/cjs/benefits.api-b46ee2ea.js +0 -35
  94. package/dist/lib/cjs/cars-calculator-app.cjs.entry.js +0 -60
  95. package/dist/lib/cjs/cars-calculator.service-a8beab79.js +0 -166
  96. package/dist/lib/cjs/context-consumer.cjs.entry.js +0 -29
  97. package/dist/lib/cjs/datorama-akita-792b4d1d.js +0 -2553
  98. package/dist/lib/cjs/delay-e91dba76.js +0 -206
  99. package/dist/lib/cjs/event-tracking.service-6f723d9c.js +0 -155
  100. package/dist/lib/cjs/event-tracking.service-d6f9a51c.js +0 -259
  101. package/dist/lib/cjs/filter-c38164e6.js +0 -378
  102. package/dist/lib/cjs/fl-dropdown-async.cjs.entry.js +0 -422
  103. package/dist/lib/cjs/fl-dropdown.cjs.entry.js +0 -232
  104. package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -91
  105. package/dist/lib/cjs/index-4f00f593.js +0 -994
  106. package/dist/lib/cjs/index-6e643fec.js +0 -1734
  107. package/dist/lib/cjs/index-889ce6c6.js +0 -27
  108. package/dist/lib/cjs/index.cjs.js +0 -2
  109. package/dist/lib/cjs/loader.cjs.js +0 -27
  110. package/dist/lib/cjs/scheduleArray-0ba3d6f8.js +0 -753
  111. package/dist/lib/cjs/stencil-async-content.cjs.entry.js +0 -32
  112. package/dist/lib/cjs/stencil-route-title.cjs.entry.js +0 -32
  113. package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +0 -59
  114. package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +0 -32
  115. package/dist/lib/cjs/view.service-ec43dea6.js +0 -21
  116. package/dist/lib/collection/assets/image/complete.svg +0 -122
  117. package/dist/lib/collection/collection-manifest.json +0 -81
  118. package/dist/lib/collection/components/benefits-app/apis/api-client.js +0 -16
  119. package/dist/lib/collection/components/benefits-app/apis/benefits-api/benefits-api.dto.js +0 -16
  120. package/dist/lib/collection/components/benefits-app/apis/benefits-api/benefits.api.js +0 -30
  121. package/dist/lib/collection/components/benefits-app/apis/event-tracking-api/event-tracking-api.dto.js +0 -1
  122. package/dist/lib/collection/components/benefits-app/apis/event-tracking-api/event-tracking-api.js +0 -7
  123. package/dist/lib/collection/components/benefits-app/apis/user-api/user-api.dto.js +0 -8
  124. package/dist/lib/collection/components/benefits-app/apis/user-api/user.api.js +0 -16
  125. package/dist/lib/collection/components/benefits-app/benefits-app.css +0 -399
  126. package/dist/lib/collection/components/benefits-app/benefits-app.js +0 -216
  127. package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-list/benefit-list-item.css +0 -23
  128. package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-list/benefits-list-item.js +0 -80
  129. package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-list/benefits-list.js +0 -32
  130. package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-page.js +0 -47
  131. package/dist/lib/collection/components/benefits-app/pages/benefits-page/hero-banner/assets/Hero_Background.png +0 -0
  132. package/dist/lib/collection/components/benefits-app/pages/benefits-page/hero-banner/hero-banner.css +0 -8
  133. package/dist/lib/collection/components/benefits-app/pages/benefits-page/hero-banner/hero-banner.js +0 -53
  134. package/dist/lib/collection/components/benefits-app/pages/benefits-page/promoted-benefits/benefit-card.css +0 -3
  135. package/dist/lib/collection/components/benefits-app/pages/benefits-page/promoted-benefits/benefit-card.js +0 -62
  136. package/dist/lib/collection/components/benefits-app/pages/benefits-page/promoted-benefits/promoted-benefits.js +0 -33
  137. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/api/manage-benefits-api.dto.js +0 -36
  138. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/api/manage-benefits.api.js +0 -23
  139. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/confirm-dialog.js +0 -158
  140. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/benefit-url.css +0 -8
  141. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/benefit-url.js +0 -126
  142. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/edit-benefit-form.js +0 -138
  143. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-benefit-icon.css +0 -24
  144. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-benefit-icon.js +0 -102
  145. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-file.css +0 -18
  146. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-file.js +0 -120
  147. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-page.js +0 -154
  148. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.query.js +0 -18
  149. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.service.js +0 -155
  150. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/empty-benefits.js +0 -36
  151. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-header-row.js +0 -13
  152. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.css +0 -3
  153. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.js +0 -88
  154. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.routes.js +0 -24
  155. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits.service.js +0 -37
  156. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/managed-benefit-item/managed-benefit-item.css +0 -10
  157. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/managed-benefit-item/managed-benefit-item.js +0 -89
  158. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.query.js +0 -11
  159. package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.store.js +0 -51
  160. package/dist/lib/collection/components/benefits-app/pages/role-management-page/api/role-management.api.js +0 -21
  161. package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-editors-section/role-editors-section.js +0 -104
  162. package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-management-page.js +0 -50
  163. package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-management.service.js +0 -44
  164. package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-owner-section/role-owner-section.js +0 -40
  165. package/dist/lib/collection/components/benefits-app/pages/role-management-page/store/role-management.query.js +0 -13
  166. package/dist/lib/collection/components/benefits-app/pages/role-management-page/store/role-management.store.js +0 -42
  167. package/dist/lib/collection/components/benefits-app/services/benefits-app.service.js +0 -36
  168. package/dist/lib/collection/components/benefits-app/services/benefits.service.js +0 -11
  169. package/dist/lib/collection/components/benefits-app/services/event-tracking.service.js +0 -40
  170. package/dist/lib/collection/components/benefits-app/services/navigation.service.js +0 -34
  171. package/dist/lib/collection/components/benefits-app/store/benefits-app.query.js +0 -13
  172. package/dist/lib/collection/components/benefits-app/store/benefits-app.store.js +0 -24
  173. package/dist/lib/collection/components/benefits-app-host/benefits-app-host.js +0 -48
  174. package/dist/lib/collection/components/benefits-app-host/loading-page.js +0 -9
  175. package/dist/lib/collection/components/benefits-app-host/oidc-callback-page/oidc-callback-page.js +0 -65
  176. package/dist/lib/collection/components/benefits-app-host/oidc-callback-page/oidc-callback-page.routes.js +0 -11
  177. package/dist/lib/collection/components/benefits-app-host/services/app-configuration.query.js +0 -18
  178. package/dist/lib/collection/components/benefits-app-host/services/app-configuration.service.js +0 -23
  179. package/dist/lib/collection/components/benefits-app-host/services/authentication.query.js +0 -21
  180. package/dist/lib/collection/components/benefits-app-host/services/authentication.service.js +0 -96
  181. package/dist/lib/collection/components/benefits-app-host/services/session.store.js +0 -33
  182. package/dist/lib/collection/components/cars-calculator-app/api/api-client.js +0 -5
  183. package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator-events.model.js +0 -1
  184. package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator.api.js +0 -45
  185. package/dist/lib/collection/components/cars-calculator-app/api/event-tracking.api.js +0 -7
  186. package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.css +0 -22
  187. package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.js +0 -97
  188. package/dist/lib/collection/components/cars-calculator-app/notifications-section/notifications-section.js +0 -25
  189. package/dist/lib/collection/components/cars-calculator-app/pages/asset.component.js +0 -27
  190. package/dist/lib/collection/components/cars-calculator-app/pages/assets/car-placeholder.svg +0 -5
  191. package/dist/lib/collection/components/cars-calculator-app/pages/assets/check.svg +0 -13
  192. package/dist/lib/collection/components/cars-calculator-app/pages/choose-vehicle-section.component.js +0 -234
  193. package/dist/lib/collection/components/cars-calculator-app/pages/common-assets/icon-info.svg +0 -4
  194. package/dist/lib/collection/components/cars-calculator-app/pages/complete-section.component.js +0 -38
  195. package/dist/lib/collection/components/cars-calculator-app/pages/cost-breakdown-section.component.js +0 -45
  196. package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.css +0 -34
  197. package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.js +0 -93
  198. package/dist/lib/collection/components/cars-calculator-app/pages/personal-info-section.component.js +0 -71
  199. package/dist/lib/collection/components/cars-calculator-app/pages/quote-result-section.component.js +0 -117
  200. package/dist/lib/collection/components/cars-calculator-app/pages/submit-quote-section.component.js +0 -87
  201. package/dist/lib/collection/components/cars-calculator-app/services/app-configuration.service.js +0 -13
  202. package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js +0 -117
  203. package/dist/lib/collection/components/cars-calculator-app/services/event-tracking.service.js +0 -37
  204. package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js +0 -37
  205. package/dist/lib/collection/components/cars-calculator-app/services/notifications.store.js +0 -3
  206. package/dist/lib/collection/components/cars-calculator-app/services/session.query.js +0 -38
  207. package/dist/lib/collection/components/cars-calculator-app/services/session.store.js +0 -80
  208. package/dist/lib/collection/components/cars-calculator-app/services/view.service.js +0 -16
  209. package/dist/lib/collection/components/shared/file-icon/file-icon.css +0 -15
  210. package/dist/lib/collection/components/shared/file-icon/file-icon.js +0 -84
  211. package/dist/lib/collection/components/shared/icon.js +0 -77
  212. package/dist/lib/collection/components/shared/icons-library.js +0 -11
  213. package/dist/lib/collection/components/shared/modal-section.js +0 -138
  214. package/dist/lib/collection/components/shared/tooltip.css +0 -3
  215. package/dist/lib/collection/components/shared/tooltip.js +0 -115
  216. package/dist/lib/collection/components/shared/ui-container/ui-container.css +0 -39
  217. package/dist/lib/collection/components/shared/ui-container/ui-container.js +0 -27
  218. package/dist/lib/collection/global/config.js +0 -2
  219. package/dist/lib/collection/global/main.dev.js +0 -31
  220. package/dist/lib/collection/global/main.js +0 -5
  221. package/dist/lib/collection/index.js +0 -2
  222. package/dist/lib/collection/utils/config.js +0 -2
  223. package/dist/lib/collection/utils/index.js +0 -28
  224. package/dist/lib/collection/utils/lazy.js +0 -29
  225. package/dist/lib/collection/utils/promise.js +0 -7
  226. package/dist/lib/esm/Option-53ef163a.js +0 -1982
  227. package/dist/lib/esm/active-router-134fe07f.js +0 -73
  228. package/dist/lib/esm/ap-ben-asset_5.entry.js +0 -1848
  229. package/dist/lib/esm/ap-ben-benefit-card.entry.js +0 -41
  230. package/dist/lib/esm/ap-ben-benefit-list-item.entry.js +0 -52
  231. package/dist/lib/esm/ap-ben-benefit-url_27.entry.js +0 -48737
  232. package/dist/lib/esm/ap-ben-benefits-list_3.entry.js +0 -49
  233. package/dist/lib/esm/ap-ben-benefits-page.entry.js +0 -51
  234. package/dist/lib/esm/ap-ben-choose-vehicle-section_4.entry.js +0 -2772
  235. package/dist/lib/esm/ap-ben-notifications-section.entry.js +0 -239
  236. package/dist/lib/esm/ap-ben-oidc-callback-page.entry.js +0 -36
  237. package/dist/lib/esm/apollo-benefits.js +0 -23
  238. package/dist/lib/esm/app-globals-ff43b669.js +0 -10
  239. package/dist/lib/esm/authentication.service-4dbff8a5.js +0 -232
  240. package/dist/lib/esm/benefits.api-5a0c5fa7.js +0 -33
  241. package/dist/lib/esm/cars-calculator-app.entry.js +0 -56
  242. package/dist/lib/esm/cars-calculator.service-1278f563.js +0 -163
  243. package/dist/lib/esm/context-consumer.entry.js +0 -25
  244. package/dist/lib/esm/datorama-akita-e42d9911.js +0 -2547
  245. package/dist/lib/esm/delay-d08c267f.js +0 -200
  246. package/dist/lib/esm/event-tracking.service-27d79066.js +0 -253
  247. package/dist/lib/esm/event-tracking.service-429d997c.js +0 -146
  248. package/dist/lib/esm/filter-aeb65cac.js +0 -370
  249. package/dist/lib/esm/fl-dropdown-async.entry.js +0 -418
  250. package/dist/lib/esm/fl-dropdown.entry.js +0 -228
  251. package/dist/lib/esm/fl-style-guide.entry.js +0 -87
  252. package/dist/lib/esm/index-1351f893.js +0 -979
  253. package/dist/lib/esm/index-8676bf1e.js +0 -22
  254. package/dist/lib/esm/index-d4b319a7.js +0 -1702
  255. package/dist/lib/esm/index.js +0 -1
  256. package/dist/lib/esm/loader.js +0 -23
  257. package/dist/lib/esm/polyfills/core-js.js +0 -11
  258. package/dist/lib/esm/polyfills/css-shim.js +0 -1
  259. package/dist/lib/esm/polyfills/dom.js +0 -79
  260. package/dist/lib/esm/polyfills/es5-html-element.js +0 -1
  261. package/dist/lib/esm/polyfills/index.js +0 -34
  262. package/dist/lib/esm/polyfills/system.js +0 -6
  263. package/dist/lib/esm/scheduleArray-b9669898.js +0 -738
  264. package/dist/lib/esm/stencil-async-content.entry.js +0 -28
  265. package/dist/lib/esm/stencil-route-title.entry.js +0 -28
  266. package/dist/lib/esm/stencil-router-prompt.entry.js +0 -55
  267. package/dist/lib/esm/stencil-router-redirect.entry.js +0 -28
  268. package/dist/lib/esm/view.service-6adbec31.js +0 -19
  269. package/dist/lib/index.cjs.js +0 -1
  270. package/dist/lib/index.js +0 -1
  271. package/dist/lib/loader/cdn.js +0 -3
  272. package/dist/lib/loader/index.cjs.js +0 -3
  273. package/dist/lib/loader/index.d.ts +0 -13
  274. package/dist/lib/loader/index.es2017.js +0 -3
  275. package/dist/lib/loader/index.js +0 -4
  276. package/dist/lib/loader/package.json +0 -10
  277. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -118
  278. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
  279. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
  280. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
  281. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
  282. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
  283. package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +0 -3
  284. package/dist/lib/types/components/benefits-app/apis/api-client.d.ts +0 -7
  285. package/dist/lib/types/components/benefits-app/apis/benefits-api/benefits-api.dto.d.ts +0 -44
  286. package/dist/lib/types/components/benefits-app/apis/benefits-api/benefits.api.d.ts +0 -9
  287. package/dist/lib/types/components/benefits-app/apis/event-tracking-api/event-tracking-api.d.ts +0 -6
  288. package/dist/lib/types/components/benefits-app/apis/event-tracking-api/event-tracking-api.dto.d.ts +0 -18
  289. package/dist/lib/types/components/benefits-app/apis/user-api/user-api.dto.d.ts +0 -30
  290. package/dist/lib/types/components/benefits-app/apis/user-api/user.api.d.ts +0 -8
  291. package/dist/lib/types/components/benefits-app/benefits-app.d.ts +0 -22
  292. package/dist/lib/types/components/benefits-app/pages/benefits-page/benefits-list/benefits-list-item.d.ts +0 -10
  293. package/dist/lib/types/components/benefits-app/pages/benefits-page/benefits-list/benefits-list.d.ts +0 -5
  294. package/dist/lib/types/components/benefits-app/pages/benefits-page/benefits-page.d.ts +0 -10
  295. package/dist/lib/types/components/benefits-app/pages/benefits-page/hero-banner/hero-banner.d.ts +0 -5
  296. package/dist/lib/types/components/benefits-app/pages/benefits-page/promoted-benefits/benefit-card.d.ts +0 -8
  297. package/dist/lib/types/components/benefits-app/pages/benefits-page/promoted-benefits/promoted-benefits.d.ts +0 -5
  298. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/api/manage-benefits-api.dto.d.ts +0 -39
  299. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/api/manage-benefits.api.d.ts +0 -9
  300. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/confirm-dialog.d.ts +0 -16
  301. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/benefit-url.d.ts +0 -21
  302. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/edit-benefit-form.d.ts +0 -12
  303. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-benefit-icon.d.ts +0 -16
  304. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-file.d.ts +0 -17
  305. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-page.d.ts +0 -24
  306. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.query.d.ts +0 -16
  307. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.service.d.ts +0 -20
  308. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/empty-benefits.d.ts +0 -5
  309. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits-header-row.d.ts +0 -3
  310. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.d.ts +0 -16
  311. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.routes.d.ts +0 -6
  312. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits.service.d.ts +0 -8
  313. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/managed-benefit-item/managed-benefit-item.d.ts +0 -11
  314. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.query.d.ts +0 -10
  315. package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.store.d.ts +0 -51
  316. package/dist/lib/types/components/benefits-app/pages/role-management-page/api/role-management.api.d.ts +0 -7
  317. package/dist/lib/types/components/benefits-app/pages/role-management-page/role-editors-section/role-editors-section.d.ts +0 -15
  318. package/dist/lib/types/components/benefits-app/pages/role-management-page/role-management-page.d.ts +0 -9
  319. package/dist/lib/types/components/benefits-app/pages/role-management-page/role-management.service.d.ts +0 -11
  320. package/dist/lib/types/components/benefits-app/pages/role-management-page/role-owner-section/role-owner-section.d.ts +0 -5
  321. package/dist/lib/types/components/benefits-app/pages/role-management-page/store/role-management.query.d.ts +0 -12
  322. package/dist/lib/types/components/benefits-app/pages/role-management-page/store/role-management.store.d.ts +0 -17
  323. package/dist/lib/types/components/benefits-app/services/benefits-app.service.d.ts +0 -13
  324. package/dist/lib/types/components/benefits-app/services/benefits.service.d.ts +0 -8
  325. package/dist/lib/types/components/benefits-app/services/event-tracking.service.d.ts +0 -11
  326. package/dist/lib/types/components/benefits-app/services/navigation.service.d.ts +0 -14
  327. package/dist/lib/types/components/benefits-app/store/benefits-app.query.d.ts +0 -12
  328. package/dist/lib/types/components/benefits-app/store/benefits-app.store.d.ts +0 -31
  329. package/dist/lib/types/components/benefits-app-host/benefits-app-host.d.ts +0 -9
  330. package/dist/lib/types/components/benefits-app-host/loading-page.d.ts +0 -3
  331. package/dist/lib/types/components/benefits-app-host/oidc-callback-page/oidc-callback-page.d.ts +0 -8
  332. package/dist/lib/types/components/benefits-app-host/oidc-callback-page/oidc-callback-page.routes.d.ts +0 -1
  333. package/dist/lib/types/components/benefits-app-host/services/app-configuration.query.d.ts +0 -11
  334. package/dist/lib/types/components/benefits-app-host/services/app-configuration.service.d.ts +0 -9
  335. package/dist/lib/types/components/benefits-app-host/services/authentication.query.d.ts +0 -13
  336. package/dist/lib/types/components/benefits-app-host/services/authentication.service.d.ts +0 -25
  337. package/dist/lib/types/components/benefits-app-host/services/session.store.d.ts +0 -25
  338. package/dist/lib/types/components/cars-calculator-app/api/api-client.d.ts +0 -2
  339. package/dist/lib/types/components/cars-calculator-app/api/cars-calculator-events.model.d.ts +0 -39
  340. package/dist/lib/types/components/cars-calculator-app/api/cars-calculator.api.d.ts +0 -100
  341. package/dist/lib/types/components/cars-calculator-app/api/event-tracking.api.d.ts +0 -6
  342. package/dist/lib/types/components/cars-calculator-app/cars-calculator-app.d.ts +0 -18
  343. package/dist/lib/types/components/cars-calculator-app/notifications-section/notifications-section.d.ts +0 -5
  344. package/dist/lib/types/components/cars-calculator-app/pages/asset.component.d.ts +0 -4
  345. package/dist/lib/types/components/cars-calculator-app/pages/choose-vehicle-section.component.d.ts +0 -23
  346. package/dist/lib/types/components/cars-calculator-app/pages/complete-section.component.d.ts +0 -5
  347. package/dist/lib/types/components/cars-calculator-app/pages/cost-breakdown-section.component.d.ts +0 -6
  348. package/dist/lib/types/components/cars-calculator-app/pages/model-variants-section.component.d.ts +0 -12
  349. package/dist/lib/types/components/cars-calculator-app/pages/personal-info-section.component.d.ts +0 -10
  350. package/dist/lib/types/components/cars-calculator-app/pages/quote-result-section.component.d.ts +0 -16
  351. package/dist/lib/types/components/cars-calculator-app/pages/submit-quote-section.component.d.ts +0 -12
  352. package/dist/lib/types/components/cars-calculator-app/services/app-configuration.service.d.ts +0 -7
  353. package/dist/lib/types/components/cars-calculator-app/services/cars-calculator.service.d.ts +0 -11
  354. package/dist/lib/types/components/cars-calculator-app/services/event-tracking.service.d.ts +0 -13
  355. package/dist/lib/types/components/cars-calculator-app/services/notifications.service.d.ts +0 -15
  356. package/dist/lib/types/components/cars-calculator-app/services/notifications.store.d.ts +0 -14
  357. package/dist/lib/types/components/cars-calculator-app/services/session.query.d.ts +0 -26
  358. package/dist/lib/types/components/cars-calculator-app/services/session.store.d.ts +0 -78
  359. package/dist/lib/types/components/cars-calculator-app/services/view.service.d.ts +0 -8
  360. package/dist/lib/types/components/shared/file-icon/file-icon.d.ts +0 -11
  361. package/dist/lib/types/components/shared/icon.d.ts +0 -7
  362. package/dist/lib/types/components/shared/icons-library.d.ts +0 -1
  363. package/dist/lib/types/components/shared/modal-section.d.ts +0 -16
  364. package/dist/lib/types/components/shared/tooltip.d.ts +0 -13
  365. package/dist/lib/types/components/shared/ui-container/ui-container.d.ts +0 -5
  366. package/dist/lib/types/components.d.ts +0 -606
  367. package/dist/lib/types/global/config.d.ts +0 -2
  368. package/dist/lib/types/global/main.d.ts +0 -1
  369. package/dist/lib/types/global/main.dev.d.ts +0 -1
  370. package/dist/lib/types/index.d.ts +0 -2
  371. package/dist/lib/types/stencil-public-runtime.d.ts +0 -1555
  372. package/dist/lib/types/utils/config.d.ts +0 -2
  373. package/dist/lib/types/utils/index.d.ts +0 -10
  374. package/dist/lib/types/utils/lazy.d.ts +0 -12
  375. package/dist/lib/types/utils/promise.d.ts +0 -1
  376. package/readme.md +0 -1
@@ -1,2779 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-6e643fec.js');
6
- const index$2 = require('./index-4f00f593.js');
7
- const index$1 = require('./index-889ce6c6.js');
8
- const carsCalculator_service = require('./cars-calculator.service-a8beab79.js');
9
- const eventTracking_service = require('./event-tracking.service-d6f9a51c.js');
10
- const view_service = require('./view.service-ec43dea6.js');
11
- require('./Option-98dab0b8.js');
12
- require('./datorama-akita-792b4d1d.js');
13
- require('./scheduleArray-0ba3d6f8.js');
14
- require('./delay-e91dba76.js');
15
- require('./filter-c38164e6.js');
16
-
17
- var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
18
- if (!Symbol.asyncIterator)
19
- throw new TypeError("Symbol.asyncIterator is not defined.");
20
- var m = o[Symbol.asyncIterator], i;
21
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
22
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
23
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
24
- };
25
- const ChooseVehicleSection = class {
26
- constructor(hostRef) {
27
- index.registerInstance(this, hostRef);
28
- this.toCapitalCase = (str) => str === null || str === void 0 ? void 0 : str.split(' ').map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join(' ');
29
- eventTracking_service.sessionQuery.vehicle$.subscribe((state) => (this.vehicleInfo = state));
30
- eventTracking_service.sessionQuery.makeList$.subscribe((state) => (this.makeList = index$1.getOrDefault(state, [])));
31
- eventTracking_service.sessionQuery.modelList$.subscribe((state) => (this.modelList = index$1.getOrDefault(state, [])));
32
- eventTracking_service.sessionQuery.yearList$.subscribe((state) => (this.yearList = index$1.getOrDefault(state, [])));
33
- eventTracking_service.sessionQuery.bodyTypeList$.subscribe((state) => (this.bodyTypeList = index$1.getOrDefault(state, [])));
34
- }
35
- render() {
36
- return (index.h(index.Host, null, index.h("div", { class: "d-flex flex-column flex-wrap flex-md-row align-items-center justify-content-center h4" }, index.h("div", { class: "d-flex align-items-center" }, "I'm looking to buy a"), index.h("div", { class: "d-flex mx-2 my-2 my-md-0" }, index.h("div", { class: "btn-group", role: "group", "aria-label": "New or used vehicle" }, index.h("button", { type: "button", class: {
37
- 'btn btn-outline-dark px-5': true,
38
- active: !this.isUsedCarSelected()
39
- }, onClick: (_event) => {
40
- eventTracking_service.sessionStore.setVehicleState('isUsedCarRequested', false);
41
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
42
- key: 'isUsedCar',
43
- value: 'false'
44
- });
45
- } }, "New"), index.h("button", { type: "button", class: {
46
- 'btn btn-outline-dark px-5': true,
47
- active: this.isUsedCarSelected()
48
- }, onClick: (_event) => {
49
- eventTracking_service.sessionStore.setVehicleState('isUsedCarRequested', true);
50
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
51
- key: 'isUsedCar',
52
- value: 'true'
53
- });
54
- } }, "Used"))), this.isUsedCarSelected() ? (index.h("div", { class: "d-flex flex-column flex-md-row align-items-center justify-content-center my-0 my-md-2 my-xl-0" }, index.h("span", { class: "pr-0 pr-sm-2 d-flex text-center" }, "vehicle, with a purchase price of"), index.h("input", { placeholder: "25000", type: "text", class: "form-control d-flex w-auto mt-2 mt-md-0", value: '$' + this.getVehicleInfo('approximatePrice'), onInput: (e) => {
55
- const el = e.target;
56
- el.value = el.value.replace(/\D/g, '');
57
- }, onFocus: (e) => {
58
- const el = e.target;
59
- el.value = el.value.replace('$', '');
60
- }, onBlur: (e) => {
61
- const el = e.target;
62
- el.value = '$' + el.value;
63
- }, onChange: (e) => {
64
- const elmValue = e.target.value;
65
- const newValue = (elmValue === null || elmValue === void 0 ? void 0 : elmValue.length) > 0 ? parseFloat(elmValue) : null;
66
- eventTracking_service.sessionStore.setVehicleState('approximatePrice', newValue);
67
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
68
- key: 'approximatePrice',
69
- value: String(newValue)
70
- });
71
- } }))) : (index.h("div", { class: "d-flex align-items-center" }, "vehicle"))), index.h("div", { class: "d-flex flex-wrap flex-column flex-md-row align-items-center justify-content-center mt-5 h4" }, index.h("div", { class: "d-flex align-items-center" }, "I'm interested in a"), index.h("div", { class: "d-flex mx-2 my-2 my-md-0" }, index.h("fl-dropdown", { options: this.makeList, requiredValidationMessage: "Select an option", placeholder: "select make", value: this.getVehicleInfo('makeId'), onValueChanged: (e) => this.chooseMake(e.detail.label, e.detail.value) })), index.h("div", { class: "d-flex mx-2 my-2 my-md-0" }, index.h("fl-dropdown", { options: this.modelList, requiredValidationMessage: "Select an option", placeholder: "select model", value: this.getVehicleInfo('modelId'), disabled: index$2.isNone(this.vehicleInfo.makeId), onValueChanged: (e) => this.chooseModel(e.detail.label, e.detail.value) })), index.h("div", { class: "d-flex mx-2 my-2 my-xl-0" }, index.h("fl-dropdown", { options: this.yearList, requiredValidationMessage: "Select an option", placeholder: "select year", value: this.getVehicleInfo('year'), disabled: index$2.isNone(this.vehicleInfo.modelId), onValueChanged: (e) => this.chooseYear(e.detail.value) }))), index.h("div", { class: "d-flex align-items-center justify-content-center justify-content-md-start mt-5" }, index.h("div", { class: "btn-group flex-wrap", role: "group", "aria-label": "Body types" }, this.bodyTypeList.map((bodyType) => (index.h("button", { type: "button", class: {
72
- 'btn btn-sm btn-outline-dark px-5': true,
73
- active: this.isBodyTypeSelected(bodyType.value)
74
- }, onClick: (_event) => this.chooseBodyType(bodyType.label, bodyType.value) }, bodyType.label)))))));
75
- }
76
- async componentDidLoad() {
77
- var _a;
78
- if (((_a = this.makeList) === null || _a === void 0 ? void 0 : _a.length) > 0)
79
- return;
80
- const carsMakes = await carsCalculator_service.backendApi.getCarsMakes();
81
- eventTracking_service.sessionStore.updateList('makeList', carsMakes.map((make) => ({
82
- label: this.toCapitalCase(make.name),
83
- value: make.make_id
84
- })));
85
- eventTracking_service.eventTrackingService.trackStepProgressedAsync({ stepName: 'carSelection' });
86
- }
87
- async chooseMake(make, makeId) {
88
- var _a;
89
- this.clearModelStates();
90
- this.clearYearStates();
91
- this.clearBodyTypeStates();
92
- this.clearVariantsList();
93
- if (((_a = this.modelList) === null || _a === void 0 ? void 0 : _a.length) === 0) {
94
- eventTracking_service.sessionStore.updateList('modelList', (await carsCalculator_service.backendApi.getCarsModels(makeId)).map((model) => ({
95
- label: this.toCapitalCase(model.model_code),
96
- value: model.model_id
97
- })));
98
- }
99
- eventTracking_service.sessionStore.setVehicleState('make', make);
100
- eventTracking_service.sessionStore.setVehicleState('makeId', makeId);
101
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
102
- key: 'make',
103
- value: make
104
- });
105
- }
106
- async chooseModel(model, modelId) {
107
- var _a;
108
- this.clearYearStates();
109
- this.clearBodyTypeStates();
110
- this.clearVariantsList();
111
- if (((_a = this.yearList) === null || _a === void 0 ? void 0 : _a.length) === 0) {
112
- eventTracking_service.sessionStore.updateList('yearList', (await carsCalculator_service.backendApi.getCarsModelYears(modelId))
113
- .sort()
114
- .reverse()
115
- .map((year) => ({
116
- label: year.toString(),
117
- value: year
118
- })));
119
- }
120
- eventTracking_service.sessionStore.setVehicleState('model', model);
121
- eventTracking_service.sessionStore.setVehicleState('modelId', modelId);
122
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
123
- key: 'model',
124
- value: model
125
- });
126
- }
127
- async chooseYear(year) {
128
- var _a;
129
- this.clearBodyTypeStates();
130
- this.clearVariantsList();
131
- const modelId = index$1.getOrError(this.vehicleInfo.modelId);
132
- if (((_a = this.bodyTypeList) === null || _a === void 0 ? void 0 : _a.length) === 0) {
133
- eventTracking_service.sessionStore.updateList('bodyTypeList', (await carsCalculator_service.backendApi.getCarsModelBodyTypes(modelId, year)).map((bodyType) => ({
134
- label: bodyType.body_type,
135
- value: bodyType.body_type_id
136
- })));
137
- }
138
- eventTracking_service.sessionStore.setVehicleState('year', year);
139
- this.chooseBodyType(this.bodyTypeList[0].label, this.bodyTypeList[0].value);
140
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
141
- key: 'year',
142
- value: year.toString()
143
- });
144
- }
145
- async chooseBodyType(bodyType, bodyTypeId) {
146
- var e_1, _a;
147
- this.clearVariantsList();
148
- eventTracking_service.sessionStore.setVehicleState('bodyType', bodyType);
149
- eventTracking_service.sessionStore.setVehicleState('bodyTypeId', bodyTypeId);
150
- const modelId = index$1.getOrError(this.vehicleInfo.modelId);
151
- const year = index$1.getOrError(this.vehicleInfo.year);
152
- const variantPromises = (await carsCalculator_service.backendApi.getCarsModelVariant(modelId, year, bodyTypeId)).map(async (variant) => {
153
- var _a;
154
- const photoUri = await carsCalculator_service.backendApi.getCarsVariantPhotos(variant.variant_id);
155
- return {
156
- variantId: variant.variant_id,
157
- description: variant.short_description,
158
- buildYear: variant.build_year,
159
- modelMonth: variant.model_month,
160
- listPriceGross: variant.list_price_gross,
161
- engineLitres: variant.engine_litres,
162
- transmission: variant.transmission,
163
- fuelTypeId: variant.fuel_type_translation_id,
164
- photoUri: index$2.fromNullable((_a = photoUri === null || photoUri === void 0 ? void 0 : photoUri[0]) === null || _a === void 0 ? void 0 : _a.photo_uri)
165
- };
166
- });
167
- const variantList = [];
168
- try {
169
- for (var variantPromises_1 = __asyncValues(variantPromises), variantPromises_1_1; variantPromises_1_1 = await variantPromises_1.next(), !variantPromises_1_1.done;) {
170
- const variant = variantPromises_1_1.value;
171
- variantList.push(variant);
172
- }
173
- }
174
- catch (e_1_1) {
175
- e_1 = { error: e_1_1 };
176
- }
177
- finally {
178
- try {
179
- if (variantPromises_1_1 && !variantPromises_1_1.done && (_a = variantPromises_1.return))
180
- await _a.call(variantPromises_1);
181
- }
182
- finally {
183
- if (e_1)
184
- throw e_1.error;
185
- }
186
- }
187
- eventTracking_service.sessionStore.updateList('modelVariantsList', variantList);
188
- eventTracking_service.eventTrackingService.trackStepProgressedAsync({ stepName: 'variantSelection' });
189
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
190
- key: 'bodyType',
191
- value: bodyType
192
- });
193
- }
194
- clearModelStates() {
195
- this.modelList = [];
196
- this.clearVehicleState('model');
197
- this.clearVehicleState('modelId');
198
- }
199
- clearYearStates() {
200
- this.yearList = [];
201
- this.clearVehicleState('year');
202
- }
203
- clearBodyTypeStates() {
204
- this.bodyTypeList = [];
205
- this.clearVehicleState('bodyType');
206
- this.clearVehicleState('bodyTypeId');
207
- }
208
- clearVariantsList() {
209
- eventTracking_service.sessionStore.updateList('modelVariantsList', []);
210
- }
211
- clearVehicleState(key) {
212
- eventTracking_service.sessionStore.setVehicleState(key, null);
213
- }
214
- getVehicleInfo(key) {
215
- return index$2.pipe(this.vehicleInfo[key], index$2.getOrElse(() => ''));
216
- }
217
- isBodyTypeSelected(bodyTypeId) {
218
- return index$2.pipe(this.vehicleInfo.bodyTypeId, index$2.fold(() => false, (selectedBodyTypeId) => selectedBodyTypeId === bodyTypeId));
219
- }
220
- isUsedCarSelected() {
221
- return index$2.pipe(this.vehicleInfo.isUsedCarRequested, index$2.getOrElse(() => false));
222
- }
223
- };
224
-
225
- function toInteger(dirtyNumber) {
226
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
227
- return NaN;
228
- }
229
-
230
- var number = Number(dirtyNumber);
231
-
232
- if (isNaN(number)) {
233
- return number;
234
- }
235
-
236
- return number < 0 ? Math.ceil(number) : Math.floor(number);
237
- }
238
-
239
- function requiredArgs(required, args) {
240
- if (args.length < required) {
241
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
242
- }
243
- }
244
-
245
- /**
246
- * @name toDate
247
- * @category Common Helpers
248
- * @summary Convert the given argument to an instance of Date.
249
- *
250
- * @description
251
- * Convert the given argument to an instance of Date.
252
- *
253
- * If the argument is an instance of Date, the function returns its clone.
254
- *
255
- * If the argument is a number, it is treated as a timestamp.
256
- *
257
- * If the argument is none of the above, the function returns Invalid Date.
258
- *
259
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
260
- *
261
- * @param {Date|Number} argument - the value to convert
262
- * @returns {Date} the parsed date in the local time zone
263
- * @throws {TypeError} 1 argument required
264
- *
265
- * @example
266
- * // Clone the date:
267
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
268
- * //=> Tue Feb 11 2014 11:30:30
269
- *
270
- * @example
271
- * // Convert the timestamp to date:
272
- * const result = toDate(1392098430000)
273
- * //=> Tue Feb 11 2014 11:30:30
274
- */
275
-
276
- function toDate(argument) {
277
- requiredArgs(1, arguments);
278
- var argStr = Object.prototype.toString.call(argument); // Clone the date
279
-
280
- if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
281
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
282
- return new Date(argument.getTime());
283
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
284
- return new Date(argument);
285
- } else {
286
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
287
- // eslint-disable-next-line no-console
288
- 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://git.io/fjule"); // eslint-disable-next-line no-console
289
-
290
- console.warn(new Error().stack);
291
- }
292
-
293
- return new Date(NaN);
294
- }
295
- }
296
-
297
- /**
298
- * @name addMilliseconds
299
- * @category Millisecond Helpers
300
- * @summary Add the specified number of milliseconds to the given date.
301
- *
302
- * @description
303
- * Add the specified number of milliseconds to the given date.
304
- *
305
- * ### v2.0.0 breaking changes:
306
- *
307
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
308
- *
309
- * @param {Date|Number} date - the date to be changed
310
- * @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`.
311
- * @returns {Date} the new date with the milliseconds added
312
- * @throws {TypeError} 2 arguments required
313
- *
314
- * @example
315
- * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
316
- * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
317
- * //=> Thu Jul 10 2014 12:45:30.750
318
- */
319
-
320
- function addMilliseconds(dirtyDate, dirtyAmount) {
321
- requiredArgs(2, arguments);
322
- var timestamp = toDate(dirtyDate).getTime();
323
- var amount = toInteger(dirtyAmount);
324
- return new Date(timestamp + amount);
325
- }
326
-
327
- /**
328
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
329
- * They usually appear for dates that denote time before the timezones were introduced
330
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
331
- * and GMT+01:00:00 after that date)
332
- *
333
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
334
- * which would lead to incorrect calculations.
335
- *
336
- * This function returns the timezone offset in milliseconds that takes seconds in account.
337
- */
338
- function getTimezoneOffsetInMilliseconds(date) {
339
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
340
- utcDate.setUTCFullYear(date.getFullYear());
341
- return date.getTime() - utcDate.getTime();
342
- }
343
-
344
- /**
345
- * @name isValid
346
- * @category Common Helpers
347
- * @summary Is the given date valid?
348
- *
349
- * @description
350
- * Returns false if argument is Invalid Date and true otherwise.
351
- * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
352
- * Invalid Date is a Date, whose time value is NaN.
353
- *
354
- * Time value of Date: http://es5.github.io/#x15.9.1.1
355
- *
356
- * ### v2.0.0 breaking changes:
357
- *
358
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
359
- *
360
- * - Now `isValid` doesn't throw an exception
361
- * if the first argument is not an instance of Date.
362
- * Instead, argument is converted beforehand using `toDate`.
363
- *
364
- * Examples:
365
- *
366
- * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
367
- * |---------------------------|---------------|---------------|
368
- * | `new Date()` | `true` | `true` |
369
- * | `new Date('2016-01-01')` | `true` | `true` |
370
- * | `new Date('')` | `false` | `false` |
371
- * | `new Date(1488370835081)` | `true` | `true` |
372
- * | `new Date(NaN)` | `false` | `false` |
373
- * | `'2016-01-01'` | `TypeError` | `false` |
374
- * | `''` | `TypeError` | `false` |
375
- * | `1488370835081` | `TypeError` | `true` |
376
- * | `NaN` | `TypeError` | `false` |
377
- *
378
- * We introduce this change to make *date-fns* consistent with ECMAScript behavior
379
- * that try to coerce arguments to the expected type
380
- * (which is also the case with other *date-fns* functions).
381
- *
382
- * @param {*} date - the date to check
383
- * @returns {Boolean} the date is valid
384
- * @throws {TypeError} 1 argument required
385
- *
386
- * @example
387
- * // For the valid date:
388
- * var result = isValid(new Date(2014, 1, 31))
389
- * //=> true
390
- *
391
- * @example
392
- * // For the value, convertable into a date:
393
- * var result = isValid(1393804800000)
394
- * //=> true
395
- *
396
- * @example
397
- * // For the invalid date:
398
- * var result = isValid(new Date(''))
399
- * //=> false
400
- */
401
-
402
- function isValid(dirtyDate) {
403
- requiredArgs(1, arguments);
404
- var date = toDate(dirtyDate);
405
- return !isNaN(date);
406
- }
407
-
408
- var formatDistanceLocale = {
409
- lessThanXSeconds: {
410
- one: 'less than a second',
411
- other: 'less than {{count}} seconds'
412
- },
413
- xSeconds: {
414
- one: '1 second',
415
- other: '{{count}} seconds'
416
- },
417
- halfAMinute: 'half a minute',
418
- lessThanXMinutes: {
419
- one: 'less than a minute',
420
- other: 'less than {{count}} minutes'
421
- },
422
- xMinutes: {
423
- one: '1 minute',
424
- other: '{{count}} minutes'
425
- },
426
- aboutXHours: {
427
- one: 'about 1 hour',
428
- other: 'about {{count}} hours'
429
- },
430
- xHours: {
431
- one: '1 hour',
432
- other: '{{count}} hours'
433
- },
434
- xDays: {
435
- one: '1 day',
436
- other: '{{count}} days'
437
- },
438
- aboutXWeeks: {
439
- one: 'about 1 week',
440
- other: 'about {{count}} weeks'
441
- },
442
- xWeeks: {
443
- one: '1 week',
444
- other: '{{count}} weeks'
445
- },
446
- aboutXMonths: {
447
- one: 'about 1 month',
448
- other: 'about {{count}} months'
449
- },
450
- xMonths: {
451
- one: '1 month',
452
- other: '{{count}} months'
453
- },
454
- aboutXYears: {
455
- one: 'about 1 year',
456
- other: 'about {{count}} years'
457
- },
458
- xYears: {
459
- one: '1 year',
460
- other: '{{count}} years'
461
- },
462
- overXYears: {
463
- one: 'over 1 year',
464
- other: 'over {{count}} years'
465
- },
466
- almostXYears: {
467
- one: 'almost 1 year',
468
- other: 'almost {{count}} years'
469
- }
470
- };
471
- function formatDistance(token, count, options) {
472
- options = options || {};
473
- var result;
474
-
475
- if (typeof formatDistanceLocale[token] === 'string') {
476
- result = formatDistanceLocale[token];
477
- } else if (count === 1) {
478
- result = formatDistanceLocale[token].one;
479
- } else {
480
- result = formatDistanceLocale[token].other.replace('{{count}}', count);
481
- }
482
-
483
- if (options.addSuffix) {
484
- if (options.comparison > 0) {
485
- return 'in ' + result;
486
- } else {
487
- return result + ' ago';
488
- }
489
- }
490
-
491
- return result;
492
- }
493
-
494
- function buildFormatLongFn(args) {
495
- return function (dirtyOptions) {
496
- var options = dirtyOptions || {};
497
- var width = options.width ? String(options.width) : args.defaultWidth;
498
- var format = args.formats[width] || args.formats[args.defaultWidth];
499
- return format;
500
- };
501
- }
502
-
503
- var dateFormats = {
504
- full: 'EEEE, MMMM do, y',
505
- long: 'MMMM do, y',
506
- medium: 'MMM d, y',
507
- short: 'MM/dd/yyyy'
508
- };
509
- var timeFormats = {
510
- full: 'h:mm:ss a zzzz',
511
- long: 'h:mm:ss a z',
512
- medium: 'h:mm:ss a',
513
- short: 'h:mm a'
514
- };
515
- var dateTimeFormats = {
516
- full: "{{date}} 'at' {{time}}",
517
- long: "{{date}} 'at' {{time}}",
518
- medium: '{{date}}, {{time}}',
519
- short: '{{date}}, {{time}}'
520
- };
521
- var formatLong = {
522
- date: buildFormatLongFn({
523
- formats: dateFormats,
524
- defaultWidth: 'full'
525
- }),
526
- time: buildFormatLongFn({
527
- formats: timeFormats,
528
- defaultWidth: 'full'
529
- }),
530
- dateTime: buildFormatLongFn({
531
- formats: dateTimeFormats,
532
- defaultWidth: 'full'
533
- })
534
- };
535
-
536
- var formatRelativeLocale = {
537
- lastWeek: "'last' eeee 'at' p",
538
- yesterday: "'yesterday at' p",
539
- today: "'today at' p",
540
- tomorrow: "'tomorrow at' p",
541
- nextWeek: "eeee 'at' p",
542
- other: 'P'
543
- };
544
- function formatRelative(token, _date, _baseDate, _options) {
545
- return formatRelativeLocale[token];
546
- }
547
-
548
- function buildLocalizeFn(args) {
549
- return function (dirtyIndex, dirtyOptions) {
550
- var options = dirtyOptions || {};
551
- var context = options.context ? String(options.context) : 'standalone';
552
- var valuesArray;
553
-
554
- if (context === 'formatting' && args.formattingValues) {
555
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
556
- var width = options.width ? String(options.width) : defaultWidth;
557
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
558
- } else {
559
- var _defaultWidth = args.defaultWidth;
560
-
561
- var _width = options.width ? String(options.width) : args.defaultWidth;
562
-
563
- valuesArray = args.values[_width] || args.values[_defaultWidth];
564
- }
565
-
566
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
567
- return valuesArray[index];
568
- };
569
- }
570
-
571
- var eraValues = {
572
- narrow: ['B', 'A'],
573
- abbreviated: ['BC', 'AD'],
574
- wide: ['Before Christ', 'Anno Domini']
575
- };
576
- var quarterValues = {
577
- narrow: ['1', '2', '3', '4'],
578
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
579
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] // Note: in English, the names of days of the week and months are capitalized.
580
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
581
- // Generally, formatted dates should look like they are in the middle of a sentence,
582
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
583
-
584
- };
585
- var monthValues = {
586
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
587
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
588
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
589
- };
590
- var dayValues = {
591
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
592
- short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
593
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
594
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
595
- };
596
- var dayPeriodValues = {
597
- narrow: {
598
- am: 'a',
599
- pm: 'p',
600
- midnight: 'mi',
601
- noon: 'n',
602
- morning: 'morning',
603
- afternoon: 'afternoon',
604
- evening: 'evening',
605
- night: 'night'
606
- },
607
- abbreviated: {
608
- am: 'AM',
609
- pm: 'PM',
610
- midnight: 'midnight',
611
- noon: 'noon',
612
- morning: 'morning',
613
- afternoon: 'afternoon',
614
- evening: 'evening',
615
- night: 'night'
616
- },
617
- wide: {
618
- am: 'a.m.',
619
- pm: 'p.m.',
620
- midnight: 'midnight',
621
- noon: 'noon',
622
- morning: 'morning',
623
- afternoon: 'afternoon',
624
- evening: 'evening',
625
- night: 'night'
626
- }
627
- };
628
- var formattingDayPeriodValues = {
629
- narrow: {
630
- am: 'a',
631
- pm: 'p',
632
- midnight: 'mi',
633
- noon: 'n',
634
- morning: 'in the morning',
635
- afternoon: 'in the afternoon',
636
- evening: 'in the evening',
637
- night: 'at night'
638
- },
639
- abbreviated: {
640
- am: 'AM',
641
- pm: 'PM',
642
- midnight: 'midnight',
643
- noon: 'noon',
644
- morning: 'in the morning',
645
- afternoon: 'in the afternoon',
646
- evening: 'in the evening',
647
- night: 'at night'
648
- },
649
- wide: {
650
- am: 'a.m.',
651
- pm: 'p.m.',
652
- midnight: 'midnight',
653
- noon: 'noon',
654
- morning: 'in the morning',
655
- afternoon: 'in the afternoon',
656
- evening: 'in the evening',
657
- night: 'at night'
658
- }
659
- };
660
-
661
- function ordinalNumber(dirtyNumber, _dirtyOptions) {
662
- var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
663
- // if they are different for different grammatical genders,
664
- // use `options.unit`:
665
- //
666
- // var options = dirtyOptions || {}
667
- // var unit = String(options.unit)
668
- //
669
- // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
670
- // 'day', 'hour', 'minute', 'second'
671
-
672
- var rem100 = number % 100;
673
-
674
- if (rem100 > 20 || rem100 < 10) {
675
- switch (rem100 % 10) {
676
- case 1:
677
- return number + 'st';
678
-
679
- case 2:
680
- return number + 'nd';
681
-
682
- case 3:
683
- return number + 'rd';
684
- }
685
- }
686
-
687
- return number + 'th';
688
- }
689
-
690
- var localize = {
691
- ordinalNumber: ordinalNumber,
692
- era: buildLocalizeFn({
693
- values: eraValues,
694
- defaultWidth: 'wide'
695
- }),
696
- quarter: buildLocalizeFn({
697
- values: quarterValues,
698
- defaultWidth: 'wide',
699
- argumentCallback: function (quarter) {
700
- return Number(quarter) - 1;
701
- }
702
- }),
703
- month: buildLocalizeFn({
704
- values: monthValues,
705
- defaultWidth: 'wide'
706
- }),
707
- day: buildLocalizeFn({
708
- values: dayValues,
709
- defaultWidth: 'wide'
710
- }),
711
- dayPeriod: buildLocalizeFn({
712
- values: dayPeriodValues,
713
- defaultWidth: 'wide',
714
- formattingValues: formattingDayPeriodValues,
715
- defaultFormattingWidth: 'wide'
716
- })
717
- };
718
-
719
- function buildMatchPatternFn(args) {
720
- return function (dirtyString, dirtyOptions) {
721
- var string = String(dirtyString);
722
- var options = dirtyOptions || {};
723
- var matchResult = string.match(args.matchPattern);
724
-
725
- if (!matchResult) {
726
- return null;
727
- }
728
-
729
- var matchedString = matchResult[0];
730
- var parseResult = string.match(args.parsePattern);
731
-
732
- if (!parseResult) {
733
- return null;
734
- }
735
-
736
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
737
- value = options.valueCallback ? options.valueCallback(value) : value;
738
- return {
739
- value: value,
740
- rest: string.slice(matchedString.length)
741
- };
742
- };
743
- }
744
-
745
- function buildMatchFn(args) {
746
- return function (dirtyString, dirtyOptions) {
747
- var string = String(dirtyString);
748
- var options = dirtyOptions || {};
749
- var width = options.width;
750
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
751
- var matchResult = string.match(matchPattern);
752
-
753
- if (!matchResult) {
754
- return null;
755
- }
756
-
757
- var matchedString = matchResult[0];
758
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
759
- var value;
760
-
761
- if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {
762
- value = findIndex(parsePatterns, function (pattern) {
763
- return pattern.test(matchedString);
764
- });
765
- } else {
766
- value = findKey(parsePatterns, function (pattern) {
767
- return pattern.test(matchedString);
768
- });
769
- }
770
-
771
- value = args.valueCallback ? args.valueCallback(value) : value;
772
- value = options.valueCallback ? options.valueCallback(value) : value;
773
- return {
774
- value: value,
775
- rest: string.slice(matchedString.length)
776
- };
777
- };
778
- }
779
-
780
- function findKey(object, predicate) {
781
- for (var key in object) {
782
- if (object.hasOwnProperty(key) && predicate(object[key])) {
783
- return key;
784
- }
785
- }
786
- }
787
-
788
- function findIndex(array, predicate) {
789
- for (var key = 0; key < array.length; key++) {
790
- if (predicate(array[key])) {
791
- return key;
792
- }
793
- }
794
- }
795
-
796
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
797
- var parseOrdinalNumberPattern = /\d+/i;
798
- var matchEraPatterns = {
799
- narrow: /^(b|a)/i,
800
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
801
- wide: /^(before christ|before common era|anno domini|common era)/i
802
- };
803
- var parseEraPatterns = {
804
- any: [/^b/i, /^(a|c)/i]
805
- };
806
- var matchQuarterPatterns = {
807
- narrow: /^[1234]/i,
808
- abbreviated: /^q[1234]/i,
809
- wide: /^[1234](th|st|nd|rd)? quarter/i
810
- };
811
- var parseQuarterPatterns = {
812
- any: [/1/i, /2/i, /3/i, /4/i]
813
- };
814
- var matchMonthPatterns = {
815
- narrow: /^[jfmasond]/i,
816
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
817
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
818
- };
819
- var parseMonthPatterns = {
820
- 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],
821
- 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]
822
- };
823
- var matchDayPatterns = {
824
- narrow: /^[smtwf]/i,
825
- short: /^(su|mo|tu|we|th|fr|sa)/i,
826
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
827
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
828
- };
829
- var parseDayPatterns = {
830
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
831
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
832
- };
833
- var matchDayPeriodPatterns = {
834
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
835
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
836
- };
837
- var parseDayPeriodPatterns = {
838
- any: {
839
- am: /^a/i,
840
- pm: /^p/i,
841
- midnight: /^mi/i,
842
- noon: /^no/i,
843
- morning: /morning/i,
844
- afternoon: /afternoon/i,
845
- evening: /evening/i,
846
- night: /night/i
847
- }
848
- };
849
- var match = {
850
- ordinalNumber: buildMatchPatternFn({
851
- matchPattern: matchOrdinalNumberPattern,
852
- parsePattern: parseOrdinalNumberPattern,
853
- valueCallback: function (value) {
854
- return parseInt(value, 10);
855
- }
856
- }),
857
- era: buildMatchFn({
858
- matchPatterns: matchEraPatterns,
859
- defaultMatchWidth: 'wide',
860
- parsePatterns: parseEraPatterns,
861
- defaultParseWidth: 'any'
862
- }),
863
- quarter: buildMatchFn({
864
- matchPatterns: matchQuarterPatterns,
865
- defaultMatchWidth: 'wide',
866
- parsePatterns: parseQuarterPatterns,
867
- defaultParseWidth: 'any',
868
- valueCallback: function (index) {
869
- return index + 1;
870
- }
871
- }),
872
- month: buildMatchFn({
873
- matchPatterns: matchMonthPatterns,
874
- defaultMatchWidth: 'wide',
875
- parsePatterns: parseMonthPatterns,
876
- defaultParseWidth: 'any'
877
- }),
878
- day: buildMatchFn({
879
- matchPatterns: matchDayPatterns,
880
- defaultMatchWidth: 'wide',
881
- parsePatterns: parseDayPatterns,
882
- defaultParseWidth: 'any'
883
- }),
884
- dayPeriod: buildMatchFn({
885
- matchPatterns: matchDayPeriodPatterns,
886
- defaultMatchWidth: 'any',
887
- parsePatterns: parseDayPeriodPatterns,
888
- defaultParseWidth: 'any'
889
- })
890
- };
891
-
892
- /**
893
- * @type {Locale}
894
- * @category Locales
895
- * @summary English locale (United States).
896
- * @language English
897
- * @iso-639-2 eng
898
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
899
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
900
- */
901
-
902
- var locale = {
903
- code: 'en-US',
904
- formatDistance: formatDistance,
905
- formatLong: formatLong,
906
- formatRelative: formatRelative,
907
- localize: localize,
908
- match: match,
909
- options: {
910
- weekStartsOn: 0
911
- /* Sunday */
912
- ,
913
- firstWeekContainsDate: 1
914
- }
915
- };
916
-
917
- /**
918
- * @name subMilliseconds
919
- * @category Millisecond Helpers
920
- * @summary Subtract the specified number of milliseconds from the given date.
921
- *
922
- * @description
923
- * Subtract the specified number of milliseconds from the given date.
924
- *
925
- * ### v2.0.0 breaking changes:
926
- *
927
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
928
- *
929
- * @param {Date|Number} date - the date to be changed
930
- * @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`.
931
- * @returns {Date} the new date with the milliseconds subtracted
932
- * @throws {TypeError} 2 arguments required
933
- *
934
- * @example
935
- * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
936
- * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
937
- * //=> Thu Jul 10 2014 12:45:29.250
938
- */
939
-
940
- function subMilliseconds(dirtyDate, dirtyAmount) {
941
- requiredArgs(2, arguments);
942
- var amount = toInteger(dirtyAmount);
943
- return addMilliseconds(dirtyDate, -amount);
944
- }
945
-
946
- function addLeadingZeros(number, targetLength) {
947
- var sign = number < 0 ? '-' : '';
948
- var output = Math.abs(number).toString();
949
-
950
- while (output.length < targetLength) {
951
- output = '0' + output;
952
- }
953
-
954
- return sign + output;
955
- }
956
-
957
- /*
958
- * | | Unit | | Unit |
959
- * |-----|--------------------------------|-----|--------------------------------|
960
- * | a | AM, PM | A* | |
961
- * | d | Day of month | D | |
962
- * | h | Hour [1-12] | H | Hour [0-23] |
963
- * | m | Minute | M | Month |
964
- * | s | Second | S | Fraction of second |
965
- * | y | Year (abs) | Y | |
966
- *
967
- * Letters marked by * are not implemented but reserved by Unicode standard.
968
- */
969
-
970
- var formatters$1 = {
971
- // Year
972
- y: function (date, token) {
973
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
974
- // | Year | y | yy | yyy | yyyy | yyyyy |
975
- // |----------|-------|----|-------|-------|-------|
976
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
977
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
978
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
979
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
980
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
981
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
982
-
983
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
984
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
985
- },
986
- // Month
987
- M: function (date, token) {
988
- var month = date.getUTCMonth();
989
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
990
- },
991
- // Day of the month
992
- d: function (date, token) {
993
- return addLeadingZeros(date.getUTCDate(), token.length);
994
- },
995
- // AM or PM
996
- a: function (date, token) {
997
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
998
-
999
- switch (token) {
1000
- case 'a':
1001
- case 'aa':
1002
- return dayPeriodEnumValue.toUpperCase();
1003
-
1004
- case 'aaa':
1005
- return dayPeriodEnumValue;
1006
-
1007
- case 'aaaaa':
1008
- return dayPeriodEnumValue[0];
1009
-
1010
- case 'aaaa':
1011
- default:
1012
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
1013
- }
1014
- },
1015
- // Hour [1-12]
1016
- h: function (date, token) {
1017
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
1018
- },
1019
- // Hour [0-23]
1020
- H: function (date, token) {
1021
- return addLeadingZeros(date.getUTCHours(), token.length);
1022
- },
1023
- // Minute
1024
- m: function (date, token) {
1025
- return addLeadingZeros(date.getUTCMinutes(), token.length);
1026
- },
1027
- // Second
1028
- s: function (date, token) {
1029
- return addLeadingZeros(date.getUTCSeconds(), token.length);
1030
- },
1031
- // Fraction of second
1032
- S: function (date, token) {
1033
- var numberOfDigits = token.length;
1034
- var milliseconds = date.getUTCMilliseconds();
1035
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
1036
- return addLeadingZeros(fractionalSeconds, token.length);
1037
- }
1038
- };
1039
-
1040
- var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
1041
- // See issue: https://github.com/date-fns/date-fns/issues/376
1042
-
1043
- function getUTCDayOfYear(dirtyDate) {
1044
- requiredArgs(1, arguments);
1045
- var date = toDate(dirtyDate);
1046
- var timestamp = date.getTime();
1047
- date.setUTCMonth(0, 1);
1048
- date.setUTCHours(0, 0, 0, 0);
1049
- var startOfYearTimestamp = date.getTime();
1050
- var difference = timestamp - startOfYearTimestamp;
1051
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
1052
- }
1053
-
1054
- // See issue: https://github.com/date-fns/date-fns/issues/376
1055
-
1056
- function startOfUTCISOWeek(dirtyDate) {
1057
- requiredArgs(1, arguments);
1058
- var weekStartsOn = 1;
1059
- var date = toDate(dirtyDate);
1060
- var day = date.getUTCDay();
1061
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
1062
- date.setUTCDate(date.getUTCDate() - diff);
1063
- date.setUTCHours(0, 0, 0, 0);
1064
- return date;
1065
- }
1066
-
1067
- // See issue: https://github.com/date-fns/date-fns/issues/376
1068
-
1069
- function getUTCISOWeekYear(dirtyDate) {
1070
- requiredArgs(1, arguments);
1071
- var date = toDate(dirtyDate);
1072
- var year = date.getUTCFullYear();
1073
- var fourthOfJanuaryOfNextYear = new Date(0);
1074
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
1075
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
1076
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
1077
- var fourthOfJanuaryOfThisYear = new Date(0);
1078
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
1079
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
1080
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
1081
-
1082
- if (date.getTime() >= startOfNextYear.getTime()) {
1083
- return year + 1;
1084
- } else if (date.getTime() >= startOfThisYear.getTime()) {
1085
- return year;
1086
- } else {
1087
- return year - 1;
1088
- }
1089
- }
1090
-
1091
- // See issue: https://github.com/date-fns/date-fns/issues/376
1092
-
1093
- function startOfUTCISOWeekYear(dirtyDate) {
1094
- requiredArgs(1, arguments);
1095
- var year = getUTCISOWeekYear(dirtyDate);
1096
- var fourthOfJanuary = new Date(0);
1097
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
1098
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
1099
- var date = startOfUTCISOWeek(fourthOfJanuary);
1100
- return date;
1101
- }
1102
-
1103
- var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
1104
- // See issue: https://github.com/date-fns/date-fns/issues/376
1105
-
1106
- function getUTCISOWeek(dirtyDate) {
1107
- requiredArgs(1, arguments);
1108
- var date = toDate(dirtyDate);
1109
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
1110
- // because the number of milliseconds in a week is not constant
1111
- // (e.g. it's different in the week of the daylight saving time clock shift)
1112
-
1113
- return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
1114
- }
1115
-
1116
- // See issue: https://github.com/date-fns/date-fns/issues/376
1117
-
1118
- function startOfUTCWeek(dirtyDate, dirtyOptions) {
1119
- requiredArgs(1, arguments);
1120
- var options = dirtyOptions || {};
1121
- var locale = options.locale;
1122
- var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
1123
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
1124
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
1125
-
1126
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
1127
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
1128
- }
1129
-
1130
- var date = toDate(dirtyDate);
1131
- var day = date.getUTCDay();
1132
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
1133
- date.setUTCDate(date.getUTCDate() - diff);
1134
- date.setUTCHours(0, 0, 0, 0);
1135
- return date;
1136
- }
1137
-
1138
- // See issue: https://github.com/date-fns/date-fns/issues/376
1139
-
1140
- function getUTCWeekYear(dirtyDate, dirtyOptions) {
1141
- requiredArgs(1, arguments);
1142
- var date = toDate(dirtyDate, dirtyOptions);
1143
- var year = date.getUTCFullYear();
1144
- var options = dirtyOptions || {};
1145
- var locale = options.locale;
1146
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
1147
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
1148
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
1149
-
1150
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
1151
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
1152
- }
1153
-
1154
- var firstWeekOfNextYear = new Date(0);
1155
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
1156
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
1157
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
1158
- var firstWeekOfThisYear = new Date(0);
1159
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
1160
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
1161
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
1162
-
1163
- if (date.getTime() >= startOfNextYear.getTime()) {
1164
- return year + 1;
1165
- } else if (date.getTime() >= startOfThisYear.getTime()) {
1166
- return year;
1167
- } else {
1168
- return year - 1;
1169
- }
1170
- }
1171
-
1172
- // See issue: https://github.com/date-fns/date-fns/issues/376
1173
-
1174
- function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
1175
- requiredArgs(1, arguments);
1176
- var options = dirtyOptions || {};
1177
- var locale = options.locale;
1178
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
1179
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
1180
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
1181
- var year = getUTCWeekYear(dirtyDate, dirtyOptions);
1182
- var firstWeek = new Date(0);
1183
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
1184
- firstWeek.setUTCHours(0, 0, 0, 0);
1185
- var date = startOfUTCWeek(firstWeek, dirtyOptions);
1186
- return date;
1187
- }
1188
-
1189
- var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
1190
- // See issue: https://github.com/date-fns/date-fns/issues/376
1191
-
1192
- function getUTCWeek(dirtyDate, options) {
1193
- requiredArgs(1, arguments);
1194
- var date = toDate(dirtyDate);
1195
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
1196
- // because the number of milliseconds in a week is not constant
1197
- // (e.g. it's different in the week of the daylight saving time clock shift)
1198
-
1199
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
1200
- }
1201
-
1202
- var dayPeriodEnum = {
1203
- am: 'am',
1204
- pm: 'pm',
1205
- midnight: 'midnight',
1206
- noon: 'noon',
1207
- morning: 'morning',
1208
- afternoon: 'afternoon',
1209
- evening: 'evening',
1210
- night: 'night'
1211
- /*
1212
- * | | Unit | | Unit |
1213
- * |-----|--------------------------------|-----|--------------------------------|
1214
- * | a | AM, PM | A* | Milliseconds in day |
1215
- * | b | AM, PM, noon, midnight | B | Flexible day period |
1216
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
1217
- * | d | Day of month | D | Day of year |
1218
- * | e | Local day of week | E | Day of week |
1219
- * | f | | F* | Day of week in month |
1220
- * | g* | Modified Julian day | G | Era |
1221
- * | h | Hour [1-12] | H | Hour [0-23] |
1222
- * | i! | ISO day of week | I! | ISO week of year |
1223
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
1224
- * | k | Hour [1-24] | K | Hour [0-11] |
1225
- * | l* | (deprecated) | L | Stand-alone month |
1226
- * | m | Minute | M | Month |
1227
- * | n | | N | |
1228
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
1229
- * | p! | Long localized time | P! | Long localized date |
1230
- * | q | Stand-alone quarter | Q | Quarter |
1231
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
1232
- * | s | Second | S | Fraction of second |
1233
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
1234
- * | u | Extended year | U* | Cyclic year |
1235
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
1236
- * | w | Local week of year | W* | Week of month |
1237
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
1238
- * | y | Year (abs) | Y | Local week-numbering year |
1239
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
1240
- *
1241
- * Letters marked by * are not implemented but reserved by Unicode standard.
1242
- *
1243
- * Letters marked by ! are non-standard, but implemented by date-fns:
1244
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
1245
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
1246
- * i.e. 7 for Sunday, 1 for Monday, etc.
1247
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
1248
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
1249
- * `R` is supposed to be used in conjunction with `I` and `i`
1250
- * for universal ISO week-numbering date, whereas
1251
- * `Y` is supposed to be used in conjunction with `w` and `e`
1252
- * for week-numbering date specific to the locale.
1253
- * - `P` is long localized date format
1254
- * - `p` is long localized time format
1255
- */
1256
-
1257
- };
1258
- var formatters = {
1259
- // Era
1260
- G: function (date, token, localize) {
1261
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
1262
-
1263
- switch (token) {
1264
- // AD, BC
1265
- case 'G':
1266
- case 'GG':
1267
- case 'GGG':
1268
- return localize.era(era, {
1269
- width: 'abbreviated'
1270
- });
1271
- // A, B
1272
-
1273
- case 'GGGGG':
1274
- return localize.era(era, {
1275
- width: 'narrow'
1276
- });
1277
- // Anno Domini, Before Christ
1278
-
1279
- case 'GGGG':
1280
- default:
1281
- return localize.era(era, {
1282
- width: 'wide'
1283
- });
1284
- }
1285
- },
1286
- // Year
1287
- y: function (date, token, localize) {
1288
- // Ordinal number
1289
- if (token === 'yo') {
1290
- var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
1291
-
1292
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
1293
- return localize.ordinalNumber(year, {
1294
- unit: 'year'
1295
- });
1296
- }
1297
-
1298
- return formatters$1.y(date, token);
1299
- },
1300
- // Local week-numbering year
1301
- Y: function (date, token, localize, options) {
1302
- var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
1303
-
1304
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
1305
-
1306
- if (token === 'YY') {
1307
- var twoDigitYear = weekYear % 100;
1308
- return addLeadingZeros(twoDigitYear, 2);
1309
- } // Ordinal number
1310
-
1311
-
1312
- if (token === 'Yo') {
1313
- return localize.ordinalNumber(weekYear, {
1314
- unit: 'year'
1315
- });
1316
- } // Padding
1317
-
1318
-
1319
- return addLeadingZeros(weekYear, token.length);
1320
- },
1321
- // ISO week-numbering year
1322
- R: function (date, token) {
1323
- var isoWeekYear = getUTCISOWeekYear(date); // Padding
1324
-
1325
- return addLeadingZeros(isoWeekYear, token.length);
1326
- },
1327
- // Extended year. This is a single number designating the year of this calendar system.
1328
- // The main difference between `y` and `u` localizers are B.C. years:
1329
- // | Year | `y` | `u` |
1330
- // |------|-----|-----|
1331
- // | AC 1 | 1 | 1 |
1332
- // | BC 1 | 1 | 0 |
1333
- // | BC 2 | 2 | -1 |
1334
- // Also `yy` always returns the last two digits of a year,
1335
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1336
- u: function (date, token) {
1337
- var year = date.getUTCFullYear();
1338
- return addLeadingZeros(year, token.length);
1339
- },
1340
- // Quarter
1341
- Q: function (date, token, localize) {
1342
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1343
-
1344
- switch (token) {
1345
- // 1, 2, 3, 4
1346
- case 'Q':
1347
- return String(quarter);
1348
- // 01, 02, 03, 04
1349
-
1350
- case 'QQ':
1351
- return addLeadingZeros(quarter, 2);
1352
- // 1st, 2nd, 3rd, 4th
1353
-
1354
- case 'Qo':
1355
- return localize.ordinalNumber(quarter, {
1356
- unit: 'quarter'
1357
- });
1358
- // Q1, Q2, Q3, Q4
1359
-
1360
- case 'QQQ':
1361
- return localize.quarter(quarter, {
1362
- width: 'abbreviated',
1363
- context: 'formatting'
1364
- });
1365
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1366
-
1367
- case 'QQQQQ':
1368
- return localize.quarter(quarter, {
1369
- width: 'narrow',
1370
- context: 'formatting'
1371
- });
1372
- // 1st quarter, 2nd quarter, ...
1373
-
1374
- case 'QQQQ':
1375
- default:
1376
- return localize.quarter(quarter, {
1377
- width: 'wide',
1378
- context: 'formatting'
1379
- });
1380
- }
1381
- },
1382
- // Stand-alone quarter
1383
- q: function (date, token, localize) {
1384
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1385
-
1386
- switch (token) {
1387
- // 1, 2, 3, 4
1388
- case 'q':
1389
- return String(quarter);
1390
- // 01, 02, 03, 04
1391
-
1392
- case 'qq':
1393
- return addLeadingZeros(quarter, 2);
1394
- // 1st, 2nd, 3rd, 4th
1395
-
1396
- case 'qo':
1397
- return localize.ordinalNumber(quarter, {
1398
- unit: 'quarter'
1399
- });
1400
- // Q1, Q2, Q3, Q4
1401
-
1402
- case 'qqq':
1403
- return localize.quarter(quarter, {
1404
- width: 'abbreviated',
1405
- context: 'standalone'
1406
- });
1407
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1408
-
1409
- case 'qqqqq':
1410
- return localize.quarter(quarter, {
1411
- width: 'narrow',
1412
- context: 'standalone'
1413
- });
1414
- // 1st quarter, 2nd quarter, ...
1415
-
1416
- case 'qqqq':
1417
- default:
1418
- return localize.quarter(quarter, {
1419
- width: 'wide',
1420
- context: 'standalone'
1421
- });
1422
- }
1423
- },
1424
- // Month
1425
- M: function (date, token, localize) {
1426
- var month = date.getUTCMonth();
1427
-
1428
- switch (token) {
1429
- case 'M':
1430
- case 'MM':
1431
- return formatters$1.M(date, token);
1432
- // 1st, 2nd, ..., 12th
1433
-
1434
- case 'Mo':
1435
- return localize.ordinalNumber(month + 1, {
1436
- unit: 'month'
1437
- });
1438
- // Jan, Feb, ..., Dec
1439
-
1440
- case 'MMM':
1441
- return localize.month(month, {
1442
- width: 'abbreviated',
1443
- context: 'formatting'
1444
- });
1445
- // J, F, ..., D
1446
-
1447
- case 'MMMMM':
1448
- return localize.month(month, {
1449
- width: 'narrow',
1450
- context: 'formatting'
1451
- });
1452
- // January, February, ..., December
1453
-
1454
- case 'MMMM':
1455
- default:
1456
- return localize.month(month, {
1457
- width: 'wide',
1458
- context: 'formatting'
1459
- });
1460
- }
1461
- },
1462
- // Stand-alone month
1463
- L: function (date, token, localize) {
1464
- var month = date.getUTCMonth();
1465
-
1466
- switch (token) {
1467
- // 1, 2, ..., 12
1468
- case 'L':
1469
- return String(month + 1);
1470
- // 01, 02, ..., 12
1471
-
1472
- case 'LL':
1473
- return addLeadingZeros(month + 1, 2);
1474
- // 1st, 2nd, ..., 12th
1475
-
1476
- case 'Lo':
1477
- return localize.ordinalNumber(month + 1, {
1478
- unit: 'month'
1479
- });
1480
- // Jan, Feb, ..., Dec
1481
-
1482
- case 'LLL':
1483
- return localize.month(month, {
1484
- width: 'abbreviated',
1485
- context: 'standalone'
1486
- });
1487
- // J, F, ..., D
1488
-
1489
- case 'LLLLL':
1490
- return localize.month(month, {
1491
- width: 'narrow',
1492
- context: 'standalone'
1493
- });
1494
- // January, February, ..., December
1495
-
1496
- case 'LLLL':
1497
- default:
1498
- return localize.month(month, {
1499
- width: 'wide',
1500
- context: 'standalone'
1501
- });
1502
- }
1503
- },
1504
- // Local week of year
1505
- w: function (date, token, localize, options) {
1506
- var week = getUTCWeek(date, options);
1507
-
1508
- if (token === 'wo') {
1509
- return localize.ordinalNumber(week, {
1510
- unit: 'week'
1511
- });
1512
- }
1513
-
1514
- return addLeadingZeros(week, token.length);
1515
- },
1516
- // ISO week of year
1517
- I: function (date, token, localize) {
1518
- var isoWeek = getUTCISOWeek(date);
1519
-
1520
- if (token === 'Io') {
1521
- return localize.ordinalNumber(isoWeek, {
1522
- unit: 'week'
1523
- });
1524
- }
1525
-
1526
- return addLeadingZeros(isoWeek, token.length);
1527
- },
1528
- // Day of the month
1529
- d: function (date, token, localize) {
1530
- if (token === 'do') {
1531
- return localize.ordinalNumber(date.getUTCDate(), {
1532
- unit: 'date'
1533
- });
1534
- }
1535
-
1536
- return formatters$1.d(date, token);
1537
- },
1538
- // Day of year
1539
- D: function (date, token, localize) {
1540
- var dayOfYear = getUTCDayOfYear(date);
1541
-
1542
- if (token === 'Do') {
1543
- return localize.ordinalNumber(dayOfYear, {
1544
- unit: 'dayOfYear'
1545
- });
1546
- }
1547
-
1548
- return addLeadingZeros(dayOfYear, token.length);
1549
- },
1550
- // Day of week
1551
- E: function (date, token, localize) {
1552
- var dayOfWeek = date.getUTCDay();
1553
-
1554
- switch (token) {
1555
- // Tue
1556
- case 'E':
1557
- case 'EE':
1558
- case 'EEE':
1559
- return localize.day(dayOfWeek, {
1560
- width: 'abbreviated',
1561
- context: 'formatting'
1562
- });
1563
- // T
1564
-
1565
- case 'EEEEE':
1566
- return localize.day(dayOfWeek, {
1567
- width: 'narrow',
1568
- context: 'formatting'
1569
- });
1570
- // Tu
1571
-
1572
- case 'EEEEEE':
1573
- return localize.day(dayOfWeek, {
1574
- width: 'short',
1575
- context: 'formatting'
1576
- });
1577
- // Tuesday
1578
-
1579
- case 'EEEE':
1580
- default:
1581
- return localize.day(dayOfWeek, {
1582
- width: 'wide',
1583
- context: 'formatting'
1584
- });
1585
- }
1586
- },
1587
- // Local day of week
1588
- e: function (date, token, localize, options) {
1589
- var dayOfWeek = date.getUTCDay();
1590
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1591
-
1592
- switch (token) {
1593
- // Numerical value (Nth day of week with current locale or weekStartsOn)
1594
- case 'e':
1595
- return String(localDayOfWeek);
1596
- // Padded numerical value
1597
-
1598
- case 'ee':
1599
- return addLeadingZeros(localDayOfWeek, 2);
1600
- // 1st, 2nd, ..., 7th
1601
-
1602
- case 'eo':
1603
- return localize.ordinalNumber(localDayOfWeek, {
1604
- unit: 'day'
1605
- });
1606
-
1607
- case 'eee':
1608
- return localize.day(dayOfWeek, {
1609
- width: 'abbreviated',
1610
- context: 'formatting'
1611
- });
1612
- // T
1613
-
1614
- case 'eeeee':
1615
- return localize.day(dayOfWeek, {
1616
- width: 'narrow',
1617
- context: 'formatting'
1618
- });
1619
- // Tu
1620
-
1621
- case 'eeeeee':
1622
- return localize.day(dayOfWeek, {
1623
- width: 'short',
1624
- context: 'formatting'
1625
- });
1626
- // Tuesday
1627
-
1628
- case 'eeee':
1629
- default:
1630
- return localize.day(dayOfWeek, {
1631
- width: 'wide',
1632
- context: 'formatting'
1633
- });
1634
- }
1635
- },
1636
- // Stand-alone local day of week
1637
- c: function (date, token, localize, options) {
1638
- var dayOfWeek = date.getUTCDay();
1639
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1640
-
1641
- switch (token) {
1642
- // Numerical value (same as in `e`)
1643
- case 'c':
1644
- return String(localDayOfWeek);
1645
- // Padded numerical value
1646
-
1647
- case 'cc':
1648
- return addLeadingZeros(localDayOfWeek, token.length);
1649
- // 1st, 2nd, ..., 7th
1650
-
1651
- case 'co':
1652
- return localize.ordinalNumber(localDayOfWeek, {
1653
- unit: 'day'
1654
- });
1655
-
1656
- case 'ccc':
1657
- return localize.day(dayOfWeek, {
1658
- width: 'abbreviated',
1659
- context: 'standalone'
1660
- });
1661
- // T
1662
-
1663
- case 'ccccc':
1664
- return localize.day(dayOfWeek, {
1665
- width: 'narrow',
1666
- context: 'standalone'
1667
- });
1668
- // Tu
1669
-
1670
- case 'cccccc':
1671
- return localize.day(dayOfWeek, {
1672
- width: 'short',
1673
- context: 'standalone'
1674
- });
1675
- // Tuesday
1676
-
1677
- case 'cccc':
1678
- default:
1679
- return localize.day(dayOfWeek, {
1680
- width: 'wide',
1681
- context: 'standalone'
1682
- });
1683
- }
1684
- },
1685
- // ISO day of week
1686
- i: function (date, token, localize) {
1687
- var dayOfWeek = date.getUTCDay();
1688
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1689
-
1690
- switch (token) {
1691
- // 2
1692
- case 'i':
1693
- return String(isoDayOfWeek);
1694
- // 02
1695
-
1696
- case 'ii':
1697
- return addLeadingZeros(isoDayOfWeek, token.length);
1698
- // 2nd
1699
-
1700
- case 'io':
1701
- return localize.ordinalNumber(isoDayOfWeek, {
1702
- unit: 'day'
1703
- });
1704
- // Tue
1705
-
1706
- case 'iii':
1707
- return localize.day(dayOfWeek, {
1708
- width: 'abbreviated',
1709
- context: 'formatting'
1710
- });
1711
- // T
1712
-
1713
- case 'iiiii':
1714
- return localize.day(dayOfWeek, {
1715
- width: 'narrow',
1716
- context: 'formatting'
1717
- });
1718
- // Tu
1719
-
1720
- case 'iiiiii':
1721
- return localize.day(dayOfWeek, {
1722
- width: 'short',
1723
- context: 'formatting'
1724
- });
1725
- // Tuesday
1726
-
1727
- case 'iiii':
1728
- default:
1729
- return localize.day(dayOfWeek, {
1730
- width: 'wide',
1731
- context: 'formatting'
1732
- });
1733
- }
1734
- },
1735
- // AM or PM
1736
- a: function (date, token, localize) {
1737
- var hours = date.getUTCHours();
1738
- var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1739
-
1740
- switch (token) {
1741
- case 'a':
1742
- case 'aa':
1743
- return localize.dayPeriod(dayPeriodEnumValue, {
1744
- width: 'abbreviated',
1745
- context: 'formatting'
1746
- });
1747
-
1748
- case 'aaa':
1749
- return localize.dayPeriod(dayPeriodEnumValue, {
1750
- width: 'abbreviated',
1751
- context: 'formatting'
1752
- }).toLowerCase();
1753
-
1754
- case 'aaaaa':
1755
- return localize.dayPeriod(dayPeriodEnumValue, {
1756
- width: 'narrow',
1757
- context: 'formatting'
1758
- });
1759
-
1760
- case 'aaaa':
1761
- default:
1762
- return localize.dayPeriod(dayPeriodEnumValue, {
1763
- width: 'wide',
1764
- context: 'formatting'
1765
- });
1766
- }
1767
- },
1768
- // AM, PM, midnight, noon
1769
- b: function (date, token, localize) {
1770
- var hours = date.getUTCHours();
1771
- var dayPeriodEnumValue;
1772
-
1773
- if (hours === 12) {
1774
- dayPeriodEnumValue = dayPeriodEnum.noon;
1775
- } else if (hours === 0) {
1776
- dayPeriodEnumValue = dayPeriodEnum.midnight;
1777
- } else {
1778
- dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1779
- }
1780
-
1781
- switch (token) {
1782
- case 'b':
1783
- case 'bb':
1784
- return localize.dayPeriod(dayPeriodEnumValue, {
1785
- width: 'abbreviated',
1786
- context: 'formatting'
1787
- });
1788
-
1789
- case 'bbb':
1790
- return localize.dayPeriod(dayPeriodEnumValue, {
1791
- width: 'abbreviated',
1792
- context: 'formatting'
1793
- }).toLowerCase();
1794
-
1795
- case 'bbbbb':
1796
- return localize.dayPeriod(dayPeriodEnumValue, {
1797
- width: 'narrow',
1798
- context: 'formatting'
1799
- });
1800
-
1801
- case 'bbbb':
1802
- default:
1803
- return localize.dayPeriod(dayPeriodEnumValue, {
1804
- width: 'wide',
1805
- context: 'formatting'
1806
- });
1807
- }
1808
- },
1809
- // in the morning, in the afternoon, in the evening, at night
1810
- B: function (date, token, localize) {
1811
- var hours = date.getUTCHours();
1812
- var dayPeriodEnumValue;
1813
-
1814
- if (hours >= 17) {
1815
- dayPeriodEnumValue = dayPeriodEnum.evening;
1816
- } else if (hours >= 12) {
1817
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
1818
- } else if (hours >= 4) {
1819
- dayPeriodEnumValue = dayPeriodEnum.morning;
1820
- } else {
1821
- dayPeriodEnumValue = dayPeriodEnum.night;
1822
- }
1823
-
1824
- switch (token) {
1825
- case 'B':
1826
- case 'BB':
1827
- case 'BBB':
1828
- return localize.dayPeriod(dayPeriodEnumValue, {
1829
- width: 'abbreviated',
1830
- context: 'formatting'
1831
- });
1832
-
1833
- case 'BBBBB':
1834
- return localize.dayPeriod(dayPeriodEnumValue, {
1835
- width: 'narrow',
1836
- context: 'formatting'
1837
- });
1838
-
1839
- case 'BBBB':
1840
- default:
1841
- return localize.dayPeriod(dayPeriodEnumValue, {
1842
- width: 'wide',
1843
- context: 'formatting'
1844
- });
1845
- }
1846
- },
1847
- // Hour [1-12]
1848
- h: function (date, token, localize) {
1849
- if (token === 'ho') {
1850
- var hours = date.getUTCHours() % 12;
1851
- if (hours === 0) hours = 12;
1852
- return localize.ordinalNumber(hours, {
1853
- unit: 'hour'
1854
- });
1855
- }
1856
-
1857
- return formatters$1.h(date, token);
1858
- },
1859
- // Hour [0-23]
1860
- H: function (date, token, localize) {
1861
- if (token === 'Ho') {
1862
- return localize.ordinalNumber(date.getUTCHours(), {
1863
- unit: 'hour'
1864
- });
1865
- }
1866
-
1867
- return formatters$1.H(date, token);
1868
- },
1869
- // Hour [0-11]
1870
- K: function (date, token, localize) {
1871
- var hours = date.getUTCHours() % 12;
1872
-
1873
- if (token === 'Ko') {
1874
- return localize.ordinalNumber(hours, {
1875
- unit: 'hour'
1876
- });
1877
- }
1878
-
1879
- return addLeadingZeros(hours, token.length);
1880
- },
1881
- // Hour [1-24]
1882
- k: function (date, token, localize) {
1883
- var hours = date.getUTCHours();
1884
- if (hours === 0) hours = 24;
1885
-
1886
- if (token === 'ko') {
1887
- return localize.ordinalNumber(hours, {
1888
- unit: 'hour'
1889
- });
1890
- }
1891
-
1892
- return addLeadingZeros(hours, token.length);
1893
- },
1894
- // Minute
1895
- m: function (date, token, localize) {
1896
- if (token === 'mo') {
1897
- return localize.ordinalNumber(date.getUTCMinutes(), {
1898
- unit: 'minute'
1899
- });
1900
- }
1901
-
1902
- return formatters$1.m(date, token);
1903
- },
1904
- // Second
1905
- s: function (date, token, localize) {
1906
- if (token === 'so') {
1907
- return localize.ordinalNumber(date.getUTCSeconds(), {
1908
- unit: 'second'
1909
- });
1910
- }
1911
-
1912
- return formatters$1.s(date, token);
1913
- },
1914
- // Fraction of second
1915
- S: function (date, token) {
1916
- return formatters$1.S(date, token);
1917
- },
1918
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1919
- X: function (date, token, _localize, options) {
1920
- var originalDate = options._originalDate || date;
1921
- var timezoneOffset = originalDate.getTimezoneOffset();
1922
-
1923
- if (timezoneOffset === 0) {
1924
- return 'Z';
1925
- }
1926
-
1927
- switch (token) {
1928
- // Hours and optional minutes
1929
- case 'X':
1930
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
1931
- // Hours, minutes and optional seconds without `:` delimiter
1932
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1933
- // so this token always has the same output as `XX`
1934
-
1935
- case 'XXXX':
1936
- case 'XX':
1937
- // Hours and minutes without `:` delimiter
1938
- return formatTimezone(timezoneOffset);
1939
- // Hours, minutes and optional seconds with `:` delimiter
1940
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1941
- // so this token always has the same output as `XXX`
1942
-
1943
- case 'XXXXX':
1944
- case 'XXX': // Hours and minutes with `:` delimiter
1945
-
1946
- default:
1947
- return formatTimezone(timezoneOffset, ':');
1948
- }
1949
- },
1950
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1951
- x: function (date, token, _localize, options) {
1952
- var originalDate = options._originalDate || date;
1953
- var timezoneOffset = originalDate.getTimezoneOffset();
1954
-
1955
- switch (token) {
1956
- // Hours and optional minutes
1957
- case 'x':
1958
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
1959
- // Hours, minutes and optional seconds without `:` delimiter
1960
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1961
- // so this token always has the same output as `xx`
1962
-
1963
- case 'xxxx':
1964
- case 'xx':
1965
- // Hours and minutes without `:` delimiter
1966
- return formatTimezone(timezoneOffset);
1967
- // Hours, minutes and optional seconds with `:` delimiter
1968
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1969
- // so this token always has the same output as `xxx`
1970
-
1971
- case 'xxxxx':
1972
- case 'xxx': // Hours and minutes with `:` delimiter
1973
-
1974
- default:
1975
- return formatTimezone(timezoneOffset, ':');
1976
- }
1977
- },
1978
- // Timezone (GMT)
1979
- O: function (date, token, _localize, options) {
1980
- var originalDate = options._originalDate || date;
1981
- var timezoneOffset = originalDate.getTimezoneOffset();
1982
-
1983
- switch (token) {
1984
- // Short
1985
- case 'O':
1986
- case 'OO':
1987
- case 'OOO':
1988
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1989
- // Long
1990
-
1991
- case 'OOOO':
1992
- default:
1993
- return 'GMT' + formatTimezone(timezoneOffset, ':');
1994
- }
1995
- },
1996
- // Timezone (specific non-location)
1997
- z: function (date, token, _localize, options) {
1998
- var originalDate = options._originalDate || date;
1999
- var timezoneOffset = originalDate.getTimezoneOffset();
2000
-
2001
- switch (token) {
2002
- // Short
2003
- case 'z':
2004
- case 'zz':
2005
- case 'zzz':
2006
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
2007
- // Long
2008
-
2009
- case 'zzzz':
2010
- default:
2011
- return 'GMT' + formatTimezone(timezoneOffset, ':');
2012
- }
2013
- },
2014
- // Seconds timestamp
2015
- t: function (date, token, _localize, options) {
2016
- var originalDate = options._originalDate || date;
2017
- var timestamp = Math.floor(originalDate.getTime() / 1000);
2018
- return addLeadingZeros(timestamp, token.length);
2019
- },
2020
- // Milliseconds timestamp
2021
- T: function (date, token, _localize, options) {
2022
- var originalDate = options._originalDate || date;
2023
- var timestamp = originalDate.getTime();
2024
- return addLeadingZeros(timestamp, token.length);
2025
- }
2026
- };
2027
-
2028
- function formatTimezoneShort(offset, dirtyDelimiter) {
2029
- var sign = offset > 0 ? '-' : '+';
2030
- var absOffset = Math.abs(offset);
2031
- var hours = Math.floor(absOffset / 60);
2032
- var minutes = absOffset % 60;
2033
-
2034
- if (minutes === 0) {
2035
- return sign + String(hours);
2036
- }
2037
-
2038
- var delimiter = dirtyDelimiter || '';
2039
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
2040
- }
2041
-
2042
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
2043
- if (offset % 60 === 0) {
2044
- var sign = offset > 0 ? '-' : '+';
2045
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
2046
- }
2047
-
2048
- return formatTimezone(offset, dirtyDelimiter);
2049
- }
2050
-
2051
- function formatTimezone(offset, dirtyDelimiter) {
2052
- var delimiter = dirtyDelimiter || '';
2053
- var sign = offset > 0 ? '-' : '+';
2054
- var absOffset = Math.abs(offset);
2055
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
2056
- var minutes = addLeadingZeros(absOffset % 60, 2);
2057
- return sign + hours + delimiter + minutes;
2058
- }
2059
-
2060
- function dateLongFormatter(pattern, formatLong) {
2061
- switch (pattern) {
2062
- case 'P':
2063
- return formatLong.date({
2064
- width: 'short'
2065
- });
2066
-
2067
- case 'PP':
2068
- return formatLong.date({
2069
- width: 'medium'
2070
- });
2071
-
2072
- case 'PPP':
2073
- return formatLong.date({
2074
- width: 'long'
2075
- });
2076
-
2077
- case 'PPPP':
2078
- default:
2079
- return formatLong.date({
2080
- width: 'full'
2081
- });
2082
- }
2083
- }
2084
-
2085
- function timeLongFormatter(pattern, formatLong) {
2086
- switch (pattern) {
2087
- case 'p':
2088
- return formatLong.time({
2089
- width: 'short'
2090
- });
2091
-
2092
- case 'pp':
2093
- return formatLong.time({
2094
- width: 'medium'
2095
- });
2096
-
2097
- case 'ppp':
2098
- return formatLong.time({
2099
- width: 'long'
2100
- });
2101
-
2102
- case 'pppp':
2103
- default:
2104
- return formatLong.time({
2105
- width: 'full'
2106
- });
2107
- }
2108
- }
2109
-
2110
- function dateTimeLongFormatter(pattern, formatLong) {
2111
- var matchResult = pattern.match(/(P+)(p+)?/);
2112
- var datePattern = matchResult[1];
2113
- var timePattern = matchResult[2];
2114
-
2115
- if (!timePattern) {
2116
- return dateLongFormatter(pattern, formatLong);
2117
- }
2118
-
2119
- var dateTimeFormat;
2120
-
2121
- switch (datePattern) {
2122
- case 'P':
2123
- dateTimeFormat = formatLong.dateTime({
2124
- width: 'short'
2125
- });
2126
- break;
2127
-
2128
- case 'PP':
2129
- dateTimeFormat = formatLong.dateTime({
2130
- width: 'medium'
2131
- });
2132
- break;
2133
-
2134
- case 'PPP':
2135
- dateTimeFormat = formatLong.dateTime({
2136
- width: 'long'
2137
- });
2138
- break;
2139
-
2140
- case 'PPPP':
2141
- default:
2142
- dateTimeFormat = formatLong.dateTime({
2143
- width: 'full'
2144
- });
2145
- break;
2146
- }
2147
-
2148
- return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
2149
- }
2150
-
2151
- var longFormatters = {
2152
- p: timeLongFormatter,
2153
- P: dateTimeLongFormatter
2154
- };
2155
-
2156
- var protectedDayOfYearTokens = ['D', 'DD'];
2157
- var protectedWeekYearTokens = ['YY', 'YYYY'];
2158
- function isProtectedDayOfYearToken(token) {
2159
- return protectedDayOfYearTokens.indexOf(token) !== -1;
2160
- }
2161
- function isProtectedWeekYearToken(token) {
2162
- return protectedWeekYearTokens.indexOf(token) !== -1;
2163
- }
2164
- function throwProtectedError(token, format, input) {
2165
- if (token === 'YYYY') {
2166
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2167
- } else if (token === 'YY') {
2168
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2169
- } else if (token === 'D') {
2170
- throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2171
- } else if (token === 'DD') {
2172
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
2173
- }
2174
- }
2175
-
2176
- // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2177
- // (one of the certain letters followed by `o`)
2178
- // - (\w)\1* matches any sequences of the same letter
2179
- // - '' matches two quote characters in a row
2180
- // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
2181
- // except a single quote symbol, which ends the sequence.
2182
- // Two quote characters do not end the sequence.
2183
- // If there is no matching single quote
2184
- // then the sequence will continue until the end of the string.
2185
- // - . matches any single character unmatched by previous parts of the RegExps
2186
-
2187
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
2188
- // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2189
-
2190
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2191
- var escapedStringRegExp = /^'([^]*?)'?$/;
2192
- var doubleQuoteRegExp = /''/g;
2193
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2194
- /**
2195
- * @name format
2196
- * @category Common Helpers
2197
- * @summary Format the date.
2198
- *
2199
- * @description
2200
- * Return the formatted date string in the given format. The result may vary by locale.
2201
- *
2202
- * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2203
- * > See: https://git.io/fxCyr
2204
- *
2205
- * The characters wrapped between two single quotes characters (') are escaped.
2206
- * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
2207
- * (see the last example)
2208
- *
2209
- * Format of the string is based on Unicode Technical Standard #35:
2210
- * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
2211
- * with a few additions (see note 7 below the table).
2212
- *
2213
- * Accepted patterns:
2214
- * | Unit | Pattern | Result examples | Notes |
2215
- * |---------------------------------|---------|-----------------------------------|-------|
2216
- * | Era | G..GGG | AD, BC | |
2217
- * | | GGGG | Anno Domini, Before Christ | 2 |
2218
- * | | GGGGG | A, B | |
2219
- * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
2220
- * | | yo | 44th, 1st, 0th, 17th | 5,7 |
2221
- * | | yy | 44, 01, 00, 17 | 5 |
2222
- * | | yyy | 044, 001, 1900, 2017 | 5 |
2223
- * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
2224
- * | | yyyyy | ... | 3,5 |
2225
- * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
2226
- * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
2227
- * | | YY | 44, 01, 00, 17 | 5,8 |
2228
- * | | YYY | 044, 001, 1900, 2017 | 5 |
2229
- * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
2230
- * | | YYYYY | ... | 3,5 |
2231
- * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
2232
- * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
2233
- * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
2234
- * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
2235
- * | | RRRRR | ... | 3,5,7 |
2236
- * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
2237
- * | | uu | -43, 01, 1900, 2017 | 5 |
2238
- * | | uuu | -043, 001, 1900, 2017 | 5 |
2239
- * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
2240
- * | | uuuuu | ... | 3,5 |
2241
- * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2242
- * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2243
- * | | QQ | 01, 02, 03, 04 | |
2244
- * | | QQQ | Q1, Q2, Q3, Q4 | |
2245
- * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2246
- * | | QQQQQ | 1, 2, 3, 4 | 4 |
2247
- * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2248
- * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2249
- * | | qq | 01, 02, 03, 04 | |
2250
- * | | qqq | Q1, Q2, Q3, Q4 | |
2251
- * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2252
- * | | qqqqq | 1, 2, 3, 4 | 4 |
2253
- * | Month (formatting) | M | 1, 2, ..., 12 | |
2254
- * | | Mo | 1st, 2nd, ..., 12th | 7 |
2255
- * | | MM | 01, 02, ..., 12 | |
2256
- * | | MMM | Jan, Feb, ..., Dec | |
2257
- * | | MMMM | January, February, ..., December | 2 |
2258
- * | | MMMMM | J, F, ..., D | |
2259
- * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2260
- * | | Lo | 1st, 2nd, ..., 12th | 7 |
2261
- * | | LL | 01, 02, ..., 12 | |
2262
- * | | LLL | Jan, Feb, ..., Dec | |
2263
- * | | LLLL | January, February, ..., December | 2 |
2264
- * | | LLLLL | J, F, ..., D | |
2265
- * | Local week of year | w | 1, 2, ..., 53 | |
2266
- * | | wo | 1st, 2nd, ..., 53th | 7 |
2267
- * | | ww | 01, 02, ..., 53 | |
2268
- * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2269
- * | | Io | 1st, 2nd, ..., 53th | 7 |
2270
- * | | II | 01, 02, ..., 53 | 7 |
2271
- * | Day of month | d | 1, 2, ..., 31 | |
2272
- * | | do | 1st, 2nd, ..., 31st | 7 |
2273
- * | | dd | 01, 02, ..., 31 | |
2274
- * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2275
- * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2276
- * | | DD | 01, 02, ..., 365, 366 | 9 |
2277
- * | | DDD | 001, 002, ..., 365, 366 | |
2278
- * | | DDDD | ... | 3 |
2279
- * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2280
- * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2281
- * | | EEEEE | M, T, W, T, F, S, S | |
2282
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |
2283
- * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2284
- * | | io | 1st, 2nd, ..., 7th | 7 |
2285
- * | | ii | 01, 02, ..., 07 | 7 |
2286
- * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2287
- * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2288
- * | | iiiii | M, T, W, T, F, S, S | 7 |
2289
- * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |
2290
- * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2291
- * | | eo | 2nd, 3rd, ..., 1st | 7 |
2292
- * | | ee | 02, 03, ..., 01 | |
2293
- * | | eee | Mon, Tue, Wed, ..., Sun | |
2294
- * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2295
- * | | eeeee | M, T, W, T, F, S, S | |
2296
- * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |
2297
- * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2298
- * | | co | 2nd, 3rd, ..., 1st | 7 |
2299
- * | | cc | 02, 03, ..., 01 | |
2300
- * | | ccc | Mon, Tue, Wed, ..., Sun | |
2301
- * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2302
- * | | ccccc | M, T, W, T, F, S, S | |
2303
- * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |
2304
- * | AM, PM | a..aa | AM, PM | |
2305
- * | | aaa | am, pm | |
2306
- * | | aaaa | a.m., p.m. | 2 |
2307
- * | | aaaaa | a, p | |
2308
- * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2309
- * | | bbb | am, pm, noon, midnight | |
2310
- * | | bbbb | a.m., p.m., noon, midnight | 2 |
2311
- * | | bbbbb | a, p, n, mi | |
2312
- * | Flexible day period | B..BBB | at night, in the morning, ... | |
2313
- * | | BBBB | at night, in the morning, ... | 2 |
2314
- * | | BBBBB | at night, in the morning, ... | |
2315
- * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2316
- * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2317
- * | | hh | 01, 02, ..., 11, 12 | |
2318
- * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2319
- * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2320
- * | | HH | 00, 01, 02, ..., 23 | |
2321
- * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2322
- * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2323
- * | | KK | 01, 02, ..., 11, 00 | |
2324
- * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2325
- * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2326
- * | | kk | 24, 01, 02, ..., 23 | |
2327
- * | Minute | m | 0, 1, ..., 59 | |
2328
- * | | mo | 0th, 1st, ..., 59th | 7 |
2329
- * | | mm | 00, 01, ..., 59 | |
2330
- * | Second | s | 0, 1, ..., 59 | |
2331
- * | | so | 0th, 1st, ..., 59th | 7 |
2332
- * | | ss | 00, 01, ..., 59 | |
2333
- * | Fraction of second | S | 0, 1, ..., 9 | |
2334
- * | | SS | 00, 01, ..., 99 | |
2335
- * | | SSS | 000, 001, ..., 999 | |
2336
- * | | SSSS | ... | 3 |
2337
- * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2338
- * | | XX | -0800, +0530, Z | |
2339
- * | | XXX | -08:00, +05:30, Z | |
2340
- * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2341
- * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2342
- * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2343
- * | | xx | -0800, +0530, +0000 | |
2344
- * | | xxx | -08:00, +05:30, +00:00 | 2 |
2345
- * | | xxxx | -0800, +0530, +0000, +123456 | |
2346
- * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2347
- * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2348
- * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2349
- * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2350
- * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2351
- * | Seconds timestamp | t | 512969520 | 7 |
2352
- * | | tt | ... | 3,7 |
2353
- * | Milliseconds timestamp | T | 512969520900 | 7 |
2354
- * | | TT | ... | 3,7 |
2355
- * | Long localized date | P | 04/29/1453 | 7 |
2356
- * | | PP | Apr 29, 1453 | 7 |
2357
- * | | PPP | April 29th, 1453 | 7 |
2358
- * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2359
- * | Long localized time | p | 12:00 AM | 7 |
2360
- * | | pp | 12:00:00 AM | 7 |
2361
- * | | ppp | 12:00:00 AM GMT+2 | 7 |
2362
- * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2363
- * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2364
- * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2365
- * | | PPPppp | April 29th, 1453 at ... | 7 |
2366
- * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2367
- * Notes:
2368
- * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2369
- * are the same as "stand-alone" units, but are different in some languages.
2370
- * "Formatting" units are declined according to the rules of the language
2371
- * in the context of a date. "Stand-alone" units are always nominative singular:
2372
- *
2373
- * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2374
- *
2375
- * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2376
- *
2377
- * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2378
- * the single quote characters (see below).
2379
- * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2380
- * the output will be the same as default pattern for this unit, usually
2381
- * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2382
- * are marked with "2" in the last column of the table.
2383
- *
2384
- * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2385
- *
2386
- * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2387
- *
2388
- * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2389
- *
2390
- * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2391
- *
2392
- * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2393
- *
2394
- * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2395
- * The output will be padded with zeros to match the length of the pattern.
2396
- *
2397
- * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2398
- *
2399
- * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2400
- * These tokens represent the shortest form of the quarter.
2401
- *
2402
- * 5. The main difference between `y` and `u` patterns are B.C. years:
2403
- *
2404
- * | Year | `y` | `u` |
2405
- * |------|-----|-----|
2406
- * | AC 1 | 1 | 1 |
2407
- * | BC 1 | 1 | 0 |
2408
- * | BC 2 | 2 | -1 |
2409
- *
2410
- * Also `yy` always returns the last two digits of a year,
2411
- * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2412
- *
2413
- * | Year | `yy` | `uu` |
2414
- * |------|------|------|
2415
- * | 1 | 01 | 01 |
2416
- * | 14 | 14 | 14 |
2417
- * | 376 | 76 | 376 |
2418
- * | 1453 | 53 | 1453 |
2419
- *
2420
- * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2421
- * except local week-numbering years are dependent on `options.weekStartsOn`
2422
- * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2423
- * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2424
- *
2425
- * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2426
- * so right now these tokens fall back to GMT timezones.
2427
- *
2428
- * 7. These patterns are not in the Unicode Technical Standard #35:
2429
- * - `i`: ISO day of week
2430
- * - `I`: ISO week of year
2431
- * - `R`: ISO week-numbering year
2432
- * - `t`: seconds timestamp
2433
- * - `T`: milliseconds timestamp
2434
- * - `o`: ordinal number modifier
2435
- * - `P`: long localized date
2436
- * - `p`: long localized time
2437
- *
2438
- * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2439
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
2440
- *
2441
- * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
2442
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
2443
- *
2444
- * ### v2.0.0 breaking changes:
2445
- *
2446
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
2447
- *
2448
- * - The second argument is now required for the sake of explicitness.
2449
- *
2450
- * ```javascript
2451
- * // Before v2.0.0
2452
- * format(new Date(2016, 0, 1))
2453
- *
2454
- * // v2.0.0 onward
2455
- * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
2456
- * ```
2457
- *
2458
- * - New format string API for `format` function
2459
- * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
2460
- * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
2461
- *
2462
- * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
2463
- *
2464
- * @param {Date|Number} date - the original date
2465
- * @param {String} format - the string of tokens
2466
- * @param {Object} [options] - an object with options.
2467
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2468
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2469
- * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2470
- * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2471
- * see: https://git.io/fxCyr
2472
- * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2473
- * see: https://git.io/fxCyr
2474
- * @returns {String} the formatted date string
2475
- * @throws {TypeError} 2 arguments required
2476
- * @throws {RangeError} `date` must not be Invalid Date
2477
- * @throws {RangeError} `options.locale` must contain `localize` property
2478
- * @throws {RangeError} `options.locale` must contain `formatLong` property
2479
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2480
- * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2481
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2482
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2483
- * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2484
- * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
2485
- * @throws {RangeError} format string contains an unescaped latin alphabet character
2486
- *
2487
- * @example
2488
- * // Represent 11 February 2014 in middle-endian format:
2489
- * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2490
- * //=> '02/11/2014'
2491
- *
2492
- * @example
2493
- * // Represent 2 July 2014 in Esperanto:
2494
- * import { eoLocale } from 'date-fns/locale/eo'
2495
- * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2496
- * locale: eoLocale
2497
- * })
2498
- * //=> '2-a de julio 2014'
2499
- *
2500
- * @example
2501
- * // Escape string by single quote characters:
2502
- * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2503
- * //=> "3 o'clock"
2504
- */
2505
-
2506
- function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
2507
- requiredArgs(2, arguments);
2508
- var formatStr = String(dirtyFormatStr);
2509
- var options = dirtyOptions || {};
2510
- var locale$1 = options.locale || locale;
2511
- var localeFirstWeekContainsDate = locale$1.options && locale$1.options.firstWeekContainsDate;
2512
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
2513
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2514
-
2515
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2516
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2517
- }
2518
-
2519
- var localeWeekStartsOn = locale$1.options && locale$1.options.weekStartsOn;
2520
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
2521
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2522
-
2523
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2524
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2525
- }
2526
-
2527
- if (!locale$1.localize) {
2528
- throw new RangeError('locale must contain localize property');
2529
- }
2530
-
2531
- if (!locale$1.formatLong) {
2532
- throw new RangeError('locale must contain formatLong property');
2533
- }
2534
-
2535
- var originalDate = toDate(dirtyDate);
2536
-
2537
- if (!isValid(originalDate)) {
2538
- throw new RangeError('Invalid time value');
2539
- } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2540
- // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2541
- // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2542
-
2543
-
2544
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2545
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
2546
- var formatterOptions = {
2547
- firstWeekContainsDate: firstWeekContainsDate,
2548
- weekStartsOn: weekStartsOn,
2549
- locale: locale$1,
2550
- _originalDate: originalDate
2551
- };
2552
- var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2553
- var firstCharacter = substring[0];
2554
-
2555
- if (firstCharacter === 'p' || firstCharacter === 'P') {
2556
- var longFormatter = longFormatters[firstCharacter];
2557
- return longFormatter(substring, locale$1.formatLong, formatterOptions);
2558
- }
2559
-
2560
- return substring;
2561
- }).join('').match(formattingTokensRegExp).map(function (substring) {
2562
- // Replace two single quote characters with one single quote character
2563
- if (substring === "''") {
2564
- return "'";
2565
- }
2566
-
2567
- var firstCharacter = substring[0];
2568
-
2569
- if (firstCharacter === "'") {
2570
- return cleanEscapedString(substring);
2571
- }
2572
-
2573
- var formatter = formatters[firstCharacter];
2574
-
2575
- if (formatter) {
2576
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
2577
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
2578
- }
2579
-
2580
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
2581
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
2582
- }
2583
-
2584
- return formatter(utcDate, substring, locale$1.localize, formatterOptions);
2585
- }
2586
-
2587
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2588
- throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2589
- }
2590
-
2591
- return substring;
2592
- }).join('');
2593
- return result;
2594
- }
2595
-
2596
- function cleanEscapedString(input) {
2597
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
2598
- }
2599
-
2600
- const modelVariantsSectionComponentCss = ".abe-car-icon{max-width:120px;height:80px;object-fit:contain}.abe-fade-in-bottom{-webkit-animation:fade-in-bottom 0.3s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:fade-in-bottom 0.3s cubic-bezier(0.39, 0.575, 0.565, 1) both}@-webkit-keyframes fade-in-bottom{0%{-webkit-transform:translateY(50px);transform:translateY(50px);opacity:0}100%{-webkit-transform:translateY(0);transform:translateY(0);opacity:1}}@keyframes fade-in-bottom{0%{-webkit-transform:translateY(50px);transform:translateY(50px);opacity:0}100%{-webkit-transform:translateY(0);transform:translateY(0);opacity:1}}";
2601
-
2602
- const ModelVariantsSection = class {
2603
- constructor(hostRef) {
2604
- index.registerInstance(this, hostRef);
2605
- this.variantsList = [];
2606
- this.selectedVariant = index$2.none;
2607
- this.placeholderImage = index.getAssetPath('./assets/car-placeholder.svg');
2608
- }
2609
- componentWillLoad() {
2610
- eventTracking_service.sessionQuery.selectedVariant$.subscribe((state) => {
2611
- this.selectedVariant = state;
2612
- });
2613
- eventTracking_service.sessionQuery.modelVariantsList$.subscribe((state) => {
2614
- this.variantsList = index$1.getOrDefault(state, []);
2615
- });
2616
- }
2617
- render() {
2618
- return (index.h(index.Host, { class: "d-flex flex-column justify-content-start align-items-center abe-fade-in-bottom" }, index$2.isNone(this.selectedVariant) ? (this.variantsList.length > 0 ? (this.variantsList.map((variant) => this.variantCard(variant, false))) : (index.h("fl-loading-indicator", { class: "mt-5" }))) : (this.variantCard(this.selectedVariant.value, true))));
2619
- }
2620
- variantCard(variant, isSelected) {
2621
- const imgSrc = index$1.getOrDefault(variant.photoUri, this.placeholderImage);
2622
- const toVariantFuelType = (fuelTypeId) => {
2623
- switch (fuelTypeId) {
2624
- case 100029:
2625
- case 100032:
2626
- return 'Diesel';
2627
- case 100035:
2628
- return 'Electric';
2629
- case 100030:
2630
- case 100031:
2631
- return 'LPG';
2632
- case 100033:
2633
- case 100034:
2634
- return 'Petrol';
2635
- default:
2636
- return '';
2637
- }
2638
- };
2639
- const toEngineDescription = (variant) => {
2640
- return `${variant.engineLitres.toFixed(1)}L ${toVariantFuelType(variant.fuelTypeId)}`.trimEnd();
2641
- };
2642
- const toVariantDescription = (variant) => `${variant.description.toLowerCase().trimEnd()}, ${toEngineDescription(variant)}, ${variant.transmission.toLowerCase()}`;
2643
- return (index.h("div", { class: "card d-flex w-100 flex-row justify-content-between align-items-center mt-3" }, index.h("img", { class: "abe-car-icon mx-4 d-none d-md-flex", src: imgSrc, alt: "", onError: (e) => this.handleImgError(e) }), index.h("div", { class: "d-flex flex-column align-items-start flex-grow-1 px-3 py-2 p-md-0" }, index.h("h5", { class: "card-title text-capitalize mb-0" }, toVariantDescription(variant)), index.h("p", { class: "card-text text-muted" }, "Built from ", this.toMonthName(variant.modelMonth), " ", variant.buildYear)), isSelected ? (index.h("fl-button", { class: "ml-3 mr-4", variant: "secondary", onClick: () => this.resetVariant() }, index.h("span", { class: "px-3" }, "Change"))) : (index.h("fl-button", { class: "ml-3 mr-4", onClick: () => this.chooseVariant(variant) }, index.h("span", { class: "px-3" }, "Select")))));
2644
- }
2645
- toMonthName(monthNumber) {
2646
- return format(new Date().setMonth(monthNumber), 'MMMM');
2647
- }
2648
- resetVariant() {
2649
- carsCalculator_service.carsCalculatorService.selectVariant(index$2.none);
2650
- eventTracking_service.eventTrackingService.trackStepProgressedAsync({ stepName: 'variantSelection' });
2651
- }
2652
- chooseVariant(variant) {
2653
- view_service.viewService.scrollToTop();
2654
- carsCalculator_service.carsCalculatorService.selectVariant(index$2.some(variant));
2655
- eventTracking_service.eventTrackingService.trackStepProgressedAsync({ stepName: 'leaseInformation' });
2656
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
2657
- key: 'variant',
2658
- value: variant.description
2659
- });
2660
- }
2661
- handleImgError(event) {
2662
- event.target.src = this.placeholderImage;
2663
- }
2664
- static get assetsDirs() { return ["assets"]; }
2665
- };
2666
- ModelVariantsSection.style = modelVariantsSectionComponentCss;
2667
-
2668
- const generateTermsOptionsArray = (years) => [...Array(years).keys()]
2669
- .map((n) => n + 1)
2670
- .map((n) => ({
2671
- label: `${n} Year${n > 1 ? 's' : ''}`,
2672
- value: n
2673
- }));
2674
- const PersonalInfoSection = class {
2675
- constructor(hostRef) {
2676
- index.registerInstance(this, hostRef);
2677
- this.terms = generateTermsOptionsArray(5);
2678
- this.states = ['ACT', 'NSW', 'NT', 'QLD', 'SA', 'TAS', 'VIC', 'WA'];
2679
- this.paymentPeriods = ['Monthly', 'Fortnightly', 'Weekly'];
2680
- eventTracking_service.sessionQuery.user$.subscribe((state) => (this.userInfo = state));
2681
- }
2682
- render() {
2683
- return (index.h(index.Host, { class: "d-flex flex-column align-items-start justify-content-between" }, index.h("div", { class: "d-flex flex-column flex-lg-row align-items-start align-items-lg-center justify-content-center mt-2 h4" }, index.h("span", { class: "pr-0 pr-sm-2 d-flex text-center" }, "My annual salary before tax is"), index.h("input", { placeholder: "50000", type: "text", class: "form-control d-flex w-auto mt-2 mt-lg-0", value: '$' + this.getUserInfo('annualSalary'), onInput: (e) => {
2684
- const el = e.target;
2685
- el.value = el.value.replace(/\D/g, '');
2686
- }, onFocus: (e) => {
2687
- const el = e.target;
2688
- el.value = el.value.replace('$', '');
2689
- }, onBlur: (e) => {
2690
- const el = e.target;
2691
- el.value = '$' + el.value;
2692
- }, onChange: (e) => this.updateUserInfo('annualSalary', parseFloat(e.target.value.trim())) })), index.h("div", { class: "d-flex flex-column flex-lg-row align-items-start align-items-lg-center justify-content-center mt-4 h4" }, index.h("span", { class: "pr-0 pr-sm-2 d-flex text-center" }, "I get paid"), index.h("fl-dropdown", { class: "d-flex my-2 my-lg-0", options: index$1.toSelectInputOptionsArray(this.paymentPeriods), requiredValidationMessage: "Select an option", placeholder: "Select...", value: this.getUserInfo('paymentPeriod'), onValueChanged: (e) => this.updateUserInfo('paymentPeriod', e.detail.value) })), index.h("div", { class: "d-flex flex-column flex-lg-row align-items-start align-items-lg-center justify-content-center mt-4 h4" }, index.h("span", { class: "pr-0 pr-sm-2 d-flex text-center" }, "Every year I expect to drive"), index.h("input", { placeholder: "10000", type: "text", class: "form-control d-flex w-auto mt-2 mt-lg-0", value: this.getUserInfo('annualKms') + ' km', onInput: (e) => {
2693
- const el = e.target;
2694
- el.value = el.value.replace(/\D/g, '');
2695
- }, onFocus: (e) => {
2696
- const el = e.target;
2697
- el.value = el.value.replace(' km', '');
2698
- }, onBlur: (e) => {
2699
- const el = e.target;
2700
- el.value += ' km';
2701
- }, onChange: (ev) => this.updateUserInfo('annualKms', parseInt(ev.target.value.trim())) })), index.h("div", { class: "d-flex flex-column flex-lg-row align-items-start align-items-lg-center justify-content-center mt-4 h4" }, index.h("span", { class: "pr-0 pr-sm-2 d-flex text-center" }, "I live in"), index.h("fl-dropdown", { class: "d-flex my-2 my-lg-0", options: index$1.toSelectInputOptionsArray(this.states), requiredValidationMessage: "Select an option", placeholder: "select state", value: this.getUserInfo('state'), onValueChanged: (e) => this.updateUserInfo('state', e.detail.value) })), index.h("div", { class: "d-flex flex-column flex-lg-row align-items-start align-items-lg-center justify-content-center mt-4 h4" }, index.h("span", { class: "pr-0 pr-sm-2 d-flex text-center" }, "I want my lease term to be"), index.h("fl-dropdown", { class: "d-flex my-2 my-lg-0", options: this.terms, requiredValidationMessage: "Select an option", placeholder: "Select...", value: this.getUserInfo('term'), onValueChanged: (e) => this.updateUserInfo('term', e.detail.value) }))));
2702
- }
2703
- updateUserInfo(key, value) {
2704
- eventTracking_service.sessionStore.update({ user: Object.assign(Object.assign({}, this.userInfo), { [key]: index$2.some(value) }) });
2705
- eventTracking_service.eventTrackingService.trackInputChangedAsync({
2706
- key: key,
2707
- value: value.toString()
2708
- });
2709
- }
2710
- getUserInfo(key) {
2711
- return index$2.pipe(this.userInfo[key], index$2.getOrElseW(() => ''));
2712
- }
2713
- };
2714
-
2715
- const QuoteResultSection = class {
2716
- constructor(hostRef) {
2717
- index.registerInstance(this, hostRef);
2718
- this.showRequestQuoteModal = false;
2719
- this.showBreakdownModal = false;
2720
- this.showCompletePage = false;
2721
- this.getRenderedPaymentPeriod = () => {
2722
- const selectedPaymentPeriod = index$2.getOrElse(() => 'Monthly')(eventTracking_service.sessionQuery.user.paymentPeriod);
2723
- let renderedPaymentPeriod = 'month';
2724
- switch (selectedPaymentPeriod) {
2725
- case 'Monthly':
2726
- renderedPaymentPeriod = 'month';
2727
- break;
2728
- case 'Fortnightly':
2729
- renderedPaymentPeriod = 'fortnight';
2730
- break;
2731
- case 'Weekly':
2732
- renderedPaymentPeriod = 'week';
2733
- }
2734
- return `Cost per ${renderedPaymentPeriod}`;
2735
- };
2736
- this.renderQuoteField = (quoteField) => {
2737
- var _a;
2738
- return (index.h("span", null, "$", this.quote.quoteState === 'Calculation pending' ? (index.h("fl-loading-indicator", { class: "ml-2" })) : ((_a = index$1.getOrDefault(quoteField, null)) === null || _a === void 0 ? void 0 : _a.toFixed(0))));
2739
- };
2740
- this.leaseInclusion = (props) => (index.h("p", { class: "font-weight-light d-inline-flex align-items-center" }, index.h("img", { class: "pr-1", src: index.getAssetPath('./assets/check.svg') }), props.inclusionName));
2741
- }
2742
- componentWillLoad() {
2743
- this.subscription = eventTracking_service.sessionQuery.result$.subscribe((_state) => {
2744
- this.quote = eventTracking_service.sessionQuery.result;
2745
- });
2746
- }
2747
- disconnectedCallback() {
2748
- this.subscription.unsubscribe();
2749
- }
2750
- render() {
2751
- return (index.h(index.Host, { class: "card d-flex flex-column justify-content-between w-100 h-100" }, index.h("div", { class: "d-flex flex-column flex-grow-1 justify-content-between p-4" }, index.h("span", { class: "mb-3 text-left" }, index.h("p", { class: "h1 text-muted font-weight-bold mb-0" }, this.renderQuoteField(this.quote.afterTaxEffectPerPayCycle)), index.h("p", { class: "mb-0 pt-1 h5" }, index.h("span", { ref: (el) => (this.costTitleElement = el) }, this.getRenderedPaymentPeriod(), index.h("ap-ben-asset", { class: "pl-2", image: "icon-info.svg" })), index.h("ap-ben-tooltip", { target: this.costTitleElement, style: { 'max-width': '15rem' } }, index.h("p", { class: "px-3 h6 py-2 mb-0 text-left text-break text-wrap" }, "The cost to you each pay cycle including all running costs.")))), index.h("span", { class: "mb-3 text-left" }, index.h("p", { class: "h1 text-info font-weight-bold mb-0" }, this.renderQuoteField(this.quote.taxSaving)), index.h("p", { class: "mb-0 pt-1 h5" }, index.h("span", { ref: (el) => (this.totalSavingsTitleElement = el) }, "Total tax savings", index.h("ap-ben-asset", { class: "pl-2", image: "icon-info.svg" })), index.h("ap-ben-tooltip", { target: this.totalSavingsTitleElement, style: { 'max-width': '15rem' } }, index.h("p", { class: "px-3 h6 py-2 mb-0 text-left text-break text-wrap" }, "The total amount you will save over the life of your lease term by salary packaging this vehicle.")))), index.h("span", { class: "mb-3 text-left" }, index.h("p", { class: "h1 text-muted font-weight-bold mb-0" }, this.renderQuoteField(this.quote.residualValue)), index.h("p", { class: "mb-0 pt-1 h5" }, index.h("span", { ref: (el) => (this.residualValueTitleElement = el) }, "Residual value", index.h("ap-ben-asset", { class: "pl-2", image: "icon-info.svg" })), index.h("ap-ben-tooltip", { target: this.residualValueTitleElement, style: { 'max-width': '15rem' } }, index.h("p", { class: "px-3 h6 py-2 mb-0 text-left text-break text-wrap" }, "The outstanding amount at the end of the lease term.")))), index.h("fl-button", { class: "mt-2", isBlockElement: true, onClick: () => {
2752
- this.showRequestQuoteModal = true;
2753
- eventTracking_service.eventTrackingService.trackStepProgressedAsync({ stepName: 'quote' });
2754
- eventTracking_service.eventTrackingService.trackModalViewedAsync({ modal: 'quoteRequest' });
2755
- } }, "Request a quote")), index.h("div", { class: "bg-light px-4 py-3" }, index.h("p", { class: "font-weight-bold text-center" }, "Your lease includes"), index.h("div", { class: "d-flex flex-row align-items-center justify-content-between" }, index.h("span", { class: "d-flex flex-column" }, index.h(this.leaseInclusion, { inclusionName: "Finance" }), index.h(this.leaseInclusion, { inclusionName: "Servicing" })), index.h("span", { class: "d-flex flex-column" }, index.h(this.leaseInclusion, { inclusionName: "Insurance" }), index.h(this.leaseInclusion, { inclusionName: "Registration" })), index.h("span", { class: "d-flex flex-column" }, index.h(this.leaseInclusion, { inclusionName: "Fuel" }), index.h(this.leaseInclusion, { inclusionName: "Tyres" }))), index.h("fl-button", { class: "mt-2", isBlockElement: true, variant: "secondary", onClick: () => {
2756
- this.showBreakdownModal = true;
2757
- eventTracking_service.eventTrackingService.trackModalViewedAsync({ modal: 'runningCostBreakdown' });
2758
- } }, "View running cost breakdown")), index.h("ap-ben-modal-section", { show: this.showRequestQuoteModal, showHeader: true, onModalClosed: () => {
2759
- this.showRequestQuoteModal = false;
2760
- this.showCompletePage = false;
2761
- eventTracking_service.eventTrackingService.trackStepProgressedAsync({ stepName: 'leaseInformation' });
2762
- eventTracking_service.eventTrackingService.trackModalClosedAsync({ modal: 'quoteRequest' });
2763
- } }, this.showCompletePage ? (index.h("ap-ben-complete-section", { onClosed: () => {
2764
- this.showRequestQuoteModal = false;
2765
- this.showCompletePage = false;
2766
- } })) : (index.h("ap-ben-submit-quote-section", { onEnquirySubmitted: () => {
2767
- this.showCompletePage = true;
2768
- } }))), index.h("ap-ben-modal-section", { show: this.showBreakdownModal, modalTitle: "Running cost breakdown", onModalClosed: () => {
2769
- this.showBreakdownModal = false;
2770
- eventTracking_service.eventTrackingService.trackModalClosedAsync({ modal: 'runningCostBreakdown' });
2771
- }, showHeader: true, showFooter: true }, index.h("ap-ben-cost-breakdown-section", { quote: this.quote }))));
2772
- }
2773
- static get assetsDirs() { return ["assets"]; }
2774
- };
2775
-
2776
- exports.ap_ben_choose_vehicle_section = ChooseVehicleSection;
2777
- exports.ap_ben_model_variants_section = ModelVariantsSection;
2778
- exports.ap_ben_personal_info_section = PersonalInfoSection;
2779
- exports.ap_ben_quote_result_section = QuoteResultSection;