@coveo/atomic 3.34.0-pre.ebcb0fe404 → 3.34.0-pre.f1c934eae1

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 (765) hide show
  1. package/dist/atomic/_atomic.esm.js +1 -1
  2. package/dist/atomic/atomic.esm.js.map +1 -1
  3. package/dist/atomic/components/_index.d.ts +2 -2
  4. package/dist/atomic/components/_index.js +1 -1
  5. package/dist/atomic/components/analytics-config.js +2918 -0
  6. package/dist/atomic/components/analytics-config.js.map +1 -0
  7. package/dist/atomic/components/atomic-category-facet.js +1 -1
  8. package/dist/atomic/components/atomic-citation.js +1 -1
  9. package/dist/atomic/components/atomic-facet-manager.js +1 -1
  10. package/dist/atomic/components/atomic-facet.js +1 -1
  11. package/dist/atomic/components/atomic-format-currency.js +1 -1
  12. package/dist/atomic/components/atomic-format-number.js +1 -1
  13. package/dist/atomic/components/atomic-format-unit.js +1 -1
  14. package/dist/atomic/components/atomic-generated-answer-feedback-modal.js +1 -1
  15. package/dist/atomic/components/atomic-html2.js +1 -1
  16. package/dist/atomic/components/atomic-insight-edit-toggle.js +1 -1
  17. package/dist/atomic/components/atomic-insight-facet.js +1 -1
  18. package/dist/atomic/components/atomic-insight-folded-result-list.js +1 -1
  19. package/dist/atomic/components/atomic-insight-full-search-button.js +1 -1
  20. package/dist/atomic/components/atomic-insight-history-toggle.js +2 -2
  21. package/dist/atomic/components/atomic-insight-history-toggle.js.map +1 -1
  22. package/dist/atomic/components/atomic-insight-interface.d.ts +11 -0
  23. package/dist/atomic/components/atomic-insight-interface.js +332 -0
  24. package/dist/atomic/components/atomic-insight-interface.js.map +1 -0
  25. package/dist/atomic/components/atomic-insight-layout.js +1 -82
  26. package/dist/atomic/components/atomic-insight-layout.js.map +1 -1
  27. package/dist/atomic/components/atomic-insight-no-results.js +1 -1
  28. package/dist/atomic/components/atomic-insight-numeric-facet.js +1 -1
  29. package/dist/atomic/components/atomic-insight-pager.js +3 -3
  30. package/dist/atomic/components/atomic-insight-query-error.js +1 -1
  31. package/dist/atomic/components/atomic-insight-refine-modal2.js +2 -2
  32. package/dist/atomic/components/atomic-insight-refine-toggle.js +1 -1
  33. package/dist/atomic/components/atomic-insight-result-action.js +1 -1
  34. package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js +1 -1
  35. package/dist/atomic/components/atomic-insight-result-attach-to-case-indicator.js +1 -1
  36. package/dist/atomic/components/atomic-insight-result-children.js +1 -1
  37. package/dist/atomic/components/atomic-insight-result-list.js +1 -1
  38. package/dist/atomic/components/atomic-insight-result-quickview-action.js +1 -1
  39. package/dist/atomic/components/atomic-insight-result2.js +1 -1
  40. package/dist/atomic/components/atomic-insight-search-box.js +2 -2
  41. package/dist/atomic/components/atomic-insight-smart-snippet-feedback-modal2.js +2 -2
  42. package/dist/atomic/components/atomic-insight-tabs.js +1 -1
  43. package/dist/atomic/components/atomic-insight-user-actions-session2.js +1 -1
  44. package/dist/atomic/components/atomic-insight-user-actions-toggle.js +2 -2
  45. package/dist/atomic/components/atomic-insight-user-actions-toggle.js.map +1 -1
  46. package/dist/atomic/components/atomic-ipx-body2.js +2 -2
  47. package/dist/atomic/components/atomic-ipx-button.js +2 -2
  48. package/dist/atomic/components/atomic-ipx-embedded.js +1 -1
  49. package/dist/atomic/components/atomic-ipx-modal.js +2 -2
  50. package/dist/atomic/components/atomic-ipx-recs-list.js +1 -1
  51. package/dist/atomic/components/atomic-ipx-refine-modal2.js +1 -1
  52. package/dist/atomic/components/atomic-ipx-refine-toggle.js +1 -1
  53. package/dist/atomic/components/atomic-ipx-result-link.js +1 -1
  54. package/dist/atomic/components/atomic-ipx-tabs.js +1 -1
  55. package/dist/{esm/sections-ae00b53a.js → atomic/components/atomic-layout-section-utils.js} +1 -1
  56. package/dist/atomic/components/atomic-layout-section-utils.js.map +1 -0
  57. package/dist/atomic/components/atomic-load-more-results.js +1 -1
  58. package/dist/atomic/components/atomic-no-results.js +1 -1
  59. package/dist/atomic/components/atomic-numeric-facet.js +1 -1
  60. package/dist/atomic/components/atomic-query-error.js +1 -1
  61. package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
  62. package/dist/atomic/components/atomic-quickview.js +1 -1
  63. package/dist/atomic/components/atomic-recs-error.js +1 -1
  64. package/dist/atomic/components/atomic-recs-interface.js +3 -2915
  65. package/dist/atomic/components/atomic-recs-interface.js.map +1 -1
  66. package/dist/atomic/components/atomic-recs-list.js +1 -1
  67. package/dist/atomic/components/atomic-refine-modal2.js +2 -2
  68. package/dist/atomic/components/atomic-refine-modal2.js.map +1 -1
  69. package/dist/atomic/components/atomic-refine-toggle.js +1 -1
  70. package/dist/atomic/components/atomic-result-children.js +1 -1
  71. package/dist/atomic/components/atomic-result-fields-list.js +1 -1
  72. package/dist/atomic/components/atomic-result-link.js +1 -1
  73. package/dist/atomic/components/atomic-result-list.js +1 -1
  74. package/dist/atomic/components/atomic-result-placeholder2.js +2 -2
  75. package/dist/atomic/components/atomic-result-table-placeholder2.js +1 -1
  76. package/dist/atomic/components/atomic-search-box-instant-results.js +1 -1
  77. package/dist/atomic/components/atomic-search-box-query-suggestions2.js +1 -1
  78. package/dist/atomic/components/atomic-search-box.js +5 -11
  79. package/dist/atomic/components/atomic-search-box.js.map +1 -1
  80. package/dist/atomic/components/atomic-smart-snippet-answer2.js +1 -1
  81. package/dist/atomic/components/atomic-smart-snippet-collapse-wrapper2.js +2 -2
  82. package/dist/atomic/components/atomic-smart-snippet-expandable-answer2.js +1 -1
  83. package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
  84. package/dist/atomic/components/atomic-smart-snippet-source2.js +1 -1
  85. package/dist/atomic/components/atomic-sort-dropdown.js +2 -2
  86. package/dist/atomic/components/atomic-sort-expression.js +1 -1
  87. package/dist/atomic/components/atomic-stencil-facet-date-input.js +3 -3
  88. package/dist/atomic/components/atomic-suggestion-renderer2.js +1 -1
  89. package/dist/atomic/components/atomic-tab-manager.js +1 -1
  90. package/dist/atomic/components/clock.js +2 -2
  91. package/dist/atomic/components/components/common/atomic-layout-section/layout.js +1 -1
  92. package/dist/atomic/components/components/common/layout/display-options.js +1 -1
  93. package/dist/atomic/components/components/common/layout/{sections.js → item-layout-sections.js} +1 -1
  94. package/dist/atomic/components/components/common/product-template/product-template-common.js +1 -1
  95. package/dist/atomic/components/components/insight/atomic-insight-layout/insight-layout.js +1 -1
  96. package/dist/atomic/components/components/insight/index.js +1 -2
  97. package/dist/atomic/components/components/insight/lazy-index.js +1 -3
  98. package/dist/atomic/components/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.js +137 -0
  99. package/dist/atomic/components/components/search/index.js +1 -0
  100. package/dist/atomic/components/components/search/lazy-index.js +1 -0
  101. package/dist/atomic/components/display-options.js +1 -1
  102. package/dist/atomic/components/display-options.js.map +1 -1
  103. package/dist/atomic/components/facet-number-input.js +2 -2
  104. package/dist/atomic/components/global/environment.js +1 -1
  105. package/dist/atomic/components/insight-layout.js +87 -0
  106. package/dist/atomic/components/insight-layout.js.map +1 -0
  107. package/dist/atomic/components/{sections2.js → item-layout-sections.js} +1 -1
  108. package/dist/atomic/components/item-layout-sections.js.map +1 -0
  109. package/dist/atomic/components/item-section-utils.js +1 -1
  110. package/dist/atomic/components/replace-breakpoint-utils.js +1 -1
  111. package/dist/atomic/components/replace-breakpoint-utils.js.map +1 -1
  112. package/dist/atomic/components/result-template-common.js +1 -1
  113. package/dist/atomic/components/result-template-common.js.map +1 -1
  114. package/dist/atomic/components/store.js +30 -2
  115. package/dist/atomic/components/store.js.map +1 -1
  116. package/dist/atomic/components/tab-button.js +1 -1
  117. package/dist/atomic/components/tab-popover.js +1 -1
  118. package/dist/atomic/components/utils.js +17 -1
  119. package/dist/atomic/components/utils.js.map +1 -1
  120. package/dist/atomic/{p-1910eb7f.entry.js → p-00069a4b.entry.js} +2 -2
  121. package/dist/atomic/{p-a0ebbbdf.entry.js → p-00a6ab8c.entry.js} +2 -2
  122. package/dist/atomic/{p-15547bd5.entry.js → p-01511388.entry.js} +2 -2
  123. package/dist/atomic/{p-6819f12c.entry.js → p-0610b3e7.entry.js} +2 -2
  124. package/dist/atomic/{p-318c96f5.entry.js → p-06284430.entry.js} +2 -2
  125. package/dist/atomic/{p-4cb91ee7.entry.js → p-0c8e7d5f.entry.js} +2 -2
  126. package/dist/atomic/p-0e62bdd6.js +2 -0
  127. package/dist/atomic/p-0e62bdd6.js.map +1 -0
  128. package/dist/atomic/{p-3272a04b.entry.js → p-0ed76e65.entry.js} +2 -2
  129. package/dist/atomic/{p-05f1ff6f.entry.js → p-0edea6f9.entry.js} +2 -2
  130. package/dist/atomic/{p-dea22a8d.entry.js → p-0f39889d.entry.js} +2 -2
  131. package/dist/atomic/{p-14bad769.entry.js → p-0f449e9d.entry.js} +2 -2
  132. package/dist/atomic/{p-5b8cc4bc.entry.js → p-10b5e0f3.entry.js} +2 -2
  133. package/dist/atomic/{p-7741124a.entry.js → p-1435fb6f.entry.js} +2 -2
  134. package/dist/atomic/{p-831519c0.entry.js → p-170c7da6.entry.js} +2 -2
  135. package/dist/atomic/{p-831b1340.entry.js → p-1bbaf206.entry.js} +2 -2
  136. package/dist/atomic/{p-5f4724c9.entry.js → p-20b33c18.entry.js} +2 -2
  137. package/dist/atomic/{p-4fc7e58e.js → p-2250f505.js} +2 -2
  138. package/dist/atomic/p-2250f505.js.map +1 -0
  139. package/dist/atomic/{p-558f2191.entry.js → p-23d4dc54.entry.js} +2 -2
  140. package/dist/atomic/{p-a6dde0f6.entry.js → p-24fd7df6.entry.js} +2 -2
  141. package/dist/atomic/p-26598ee0.js +2 -0
  142. package/dist/atomic/{p-1fca38e1.js.map → p-26598ee0.js.map} +1 -1
  143. package/dist/atomic/{p-025a346a.js → p-27cf779a.js} +2 -2
  144. package/dist/atomic/p-28e882e8.js +2 -0
  145. package/dist/atomic/{p-57049cd2.entry.js → p-2e4628bb.entry.js} +2 -2
  146. package/dist/atomic/{p-d8caa4d8.entry.js → p-2fb49fe8.entry.js} +2 -2
  147. package/dist/atomic/{p-e6871a3f.entry.js → p-30c09377.entry.js} +2 -2
  148. package/dist/atomic/{p-0580b866.js → p-31a13850.js} +2 -2
  149. package/dist/atomic/p-345c425d.entry.js +2 -0
  150. package/dist/atomic/{p-ef8f2239.entry.js.map → p-345c425d.entry.js.map} +1 -1
  151. package/dist/atomic/{p-f0c657f4.entry.js → p-3549a469.entry.js} +2 -2
  152. package/dist/atomic/{p-3fcf37f8.entry.js → p-36112c34.entry.js} +2 -2
  153. package/dist/atomic/p-36112c34.entry.js.map +1 -0
  154. package/dist/atomic/{p-c619df9b.js → p-3622ed6c.js} +2 -2
  155. package/dist/atomic/{p-db2d92c5.entry.js → p-367ec37d.entry.js} +2 -2
  156. package/dist/atomic/{p-26e0c1f8.entry.js → p-36f63642.entry.js} +2 -2
  157. package/dist/atomic/{p-af2855cc.entry.js → p-373448df.entry.js} +2 -2
  158. package/dist/atomic/{p-7427daa3.js → p-3af2fca0.js} +2 -2
  159. package/dist/atomic/{p-b29d121c.js → p-3c9289b5.js} +2 -2
  160. package/dist/atomic/{p-36e2c945.entry.js → p-3d55fce6.entry.js} +2 -2
  161. package/dist/atomic/{p-088d634c.entry.js → p-3e9db2b5.entry.js} +2 -2
  162. package/dist/atomic/{p-36905dd1.entry.js → p-40c1dfcb.entry.js} +2 -2
  163. package/dist/atomic/{p-be011bd1.entry.js → p-416d088e.entry.js} +2 -2
  164. package/dist/atomic/{p-99d4c4bf.entry.js → p-47ab6c9f.entry.js} +2 -2
  165. package/dist/atomic/{p-7242b46e.entry.js → p-4830b9bb.entry.js} +2 -2
  166. package/dist/atomic/{p-0ee7cab8.entry.js → p-4bdc6d5a.entry.js} +2 -2
  167. package/dist/atomic/{p-c2a5dac0.entry.js → p-4f4c9a03.entry.js} +2 -2
  168. package/dist/atomic/{p-7fd58269.entry.js → p-519d9abd.entry.js} +2 -2
  169. package/dist/atomic/{p-7f56351b.entry.js → p-52d5461a.entry.js} +2 -2
  170. package/dist/atomic/p-56c97c3e.js +2 -0
  171. package/dist/atomic/{p-ae69f519.entry.js → p-59b15bd6.entry.js} +2 -2
  172. package/dist/atomic/{p-e49ad083.entry.js → p-59f043a0.entry.js} +2 -2
  173. package/dist/atomic/{p-ca37969c.js → p-5ca21deb.js} +2 -2
  174. package/dist/atomic/{p-e34dafbb.entry.js → p-6078667f.entry.js} +2 -2
  175. package/dist/atomic/{p-2f437b47.entry.js → p-6098b906.entry.js} +2 -2
  176. package/dist/atomic/{p-c467674f.entry.js → p-62e85c20.entry.js} +2 -2
  177. package/dist/atomic/p-6f1bffa2.entry.js +2 -0
  178. package/dist/atomic/p-6f1bffa2.entry.js.map +1 -0
  179. package/dist/atomic/{p-3b49d42d.entry.js → p-6f34dd3a.entry.js} +2 -2
  180. package/dist/atomic/{p-82cd6398.entry.js → p-723f76a1.entry.js} +2 -2
  181. package/dist/atomic/{p-6439156c.entry.js → p-740cd5bc.entry.js} +2 -2
  182. package/dist/atomic/p-768b172e.entry.js +2 -0
  183. package/dist/atomic/p-768b172e.entry.js.map +1 -0
  184. package/dist/atomic/p-7bbd3d7f.js +2 -0
  185. package/dist/atomic/p-7bbd3d7f.js.map +1 -0
  186. package/dist/atomic/{p-d0ab0125.entry.js → p-7cced247.entry.js} +2 -2
  187. package/dist/atomic/{p-044de1f9.entry.js → p-7e971d15.entry.js} +2 -2
  188. package/dist/atomic/{p-66166975.entry.js → p-7e9a1a1a.entry.js} +2 -2
  189. package/dist/atomic/{p-5e1018bb.entry.js → p-7fd5b6ac.entry.js} +2 -2
  190. package/dist/atomic/{p-36ff2bc3.entry.js → p-83d3857f.entry.js} +2 -2
  191. package/dist/atomic/{p-1c8bcadf.entry.js → p-85145c88.entry.js} +2 -2
  192. package/dist/atomic/{p-55c41e00.entry.js → p-8572a953.entry.js} +2 -2
  193. package/dist/atomic/{p-5cab535b.entry.js → p-87f69e53.entry.js} +2 -2
  194. package/dist/atomic/{p-22b76c96.entry.js → p-89d8bb0d.entry.js} +2 -2
  195. package/dist/atomic/{p-87e2c8ae.entry.js → p-9239be63.entry.js} +2 -2
  196. package/dist/atomic/{p-89abfaec.entry.js → p-9260dd7d.entry.js} +2 -2
  197. package/dist/atomic/p-92d6dd55.entry.js +2 -0
  198. package/dist/atomic/p-92d6dd55.entry.js.map +1 -0
  199. package/dist/atomic/{p-bd01acd5.entry.js → p-93601dc0.entry.js} +2 -2
  200. package/dist/atomic/{p-c5164dbf.entry.js → p-93f1d551.entry.js} +2 -2
  201. package/dist/atomic/{p-6698d5e9.entry.js → p-97538903.entry.js} +2 -2
  202. package/dist/atomic/{p-fc71835d.entry.js → p-97829295.entry.js} +2 -2
  203. package/dist/atomic/{p-18dc558c.entry.js → p-98dd6df1.entry.js} +2 -2
  204. package/dist/atomic/{p-2f517a54.entry.js → p-998393ec.entry.js} +2 -2
  205. package/dist/atomic/{p-39fe9c1e.entry.js → p-9a6ec803.entry.js} +2 -2
  206. package/dist/atomic/p-a12e1c59.js +2 -0
  207. package/dist/atomic/p-a12e1c59.js.map +1 -0
  208. package/dist/atomic/{p-70747efa.entry.js → p-a130b00b.entry.js} +2 -2
  209. package/dist/atomic/p-a1522fe5.entry.js +2 -0
  210. package/dist/atomic/{p-ca1425cc.entry.js.map → p-a1522fe5.entry.js.map} +1 -1
  211. package/dist/atomic/{p-94adab79.entry.js → p-a1e5f767.entry.js} +2 -2
  212. package/dist/atomic/p-a1ee594f.entry.js +2 -0
  213. package/dist/atomic/{p-b628ed03.entry.js.map → p-a1ee594f.entry.js.map} +1 -1
  214. package/dist/atomic/{p-a7189b06.entry.js → p-a5f66ecd.entry.js} +2 -2
  215. package/dist/atomic/{p-47b41b27.entry.js → p-a9383817.entry.js} +2 -2
  216. package/dist/atomic/{p-b1ffa893.entry.js → p-af1b4924.entry.js} +2 -2
  217. package/dist/atomic/{p-bc43df67.entry.js → p-b2b9e83f.entry.js} +2 -2
  218. package/dist/atomic/{p-182f9112.entry.js → p-b313058c.entry.js} +2 -2
  219. package/dist/atomic/{p-76c14d82.entry.js → p-b320f270.entry.js} +2 -2
  220. package/dist/atomic/p-b6415814.entry.js +2 -0
  221. package/dist/atomic/{p-f37dea9e.entry.js.map → p-b6415814.entry.js.map} +1 -1
  222. package/dist/atomic/{p-81bdbd07.entry.js → p-b6ae0244.entry.js} +2 -2
  223. package/dist/atomic/{p-df8d38ca.entry.js → p-bbfe727a.entry.js} +2 -2
  224. package/dist/atomic/{p-48bab1a6.entry.js → p-be2a43f4.entry.js} +2 -2
  225. package/dist/atomic/{p-955092ed.entry.js → p-c25f1437.entry.js} +2 -2
  226. package/dist/atomic/p-c2b4b401.entry.js +2 -0
  227. package/dist/atomic/{p-3e62ef5c.entry.js → p-c4fb6426.entry.js} +2 -2
  228. package/dist/atomic/p-c7af4b9e.entry.js +2 -0
  229. package/dist/atomic/{p-7fe23afc.entry.js.map → p-c7af4b9e.entry.js.map} +1 -1
  230. package/dist/atomic/{p-e6dc9de7.entry.js → p-c9f1790d.entry.js} +2 -2
  231. package/dist/atomic/{p-21ab7750.entry.js → p-cafa4083.entry.js} +2 -2
  232. package/dist/atomic/{p-b84108f3.entry.js → p-cb3fd0f4.entry.js} +2 -2
  233. package/dist/atomic/p-cc0bf58b.js +2 -0
  234. package/dist/atomic/p-cc0bf58b.js.map +1 -0
  235. package/dist/atomic/{p-9c7dbbdf.js → p-cc2b2231.js} +1 -1
  236. package/dist/atomic/p-cc2b2231.js.map +1 -0
  237. package/dist/atomic/{p-77d00da1.entry.js → p-cdeb5f2a.entry.js} +2 -2
  238. package/dist/atomic/{p-e455330c.entry.js → p-ce5b896e.entry.js} +2 -2
  239. package/dist/atomic/{p-3291adda.entry.js → p-d211a422.entry.js} +2 -2
  240. package/dist/atomic/{p-463336ca.entry.js → p-da845e35.entry.js} +2 -2
  241. package/dist/atomic/{p-33245038.entry.js → p-dbc0ce5c.entry.js} +2 -2
  242. package/dist/atomic/{p-db3b11ca.entry.js → p-dbf0c5a3.entry.js} +2 -2
  243. package/dist/atomic/{p-ba95a7d1.entry.js → p-dc128135.entry.js} +2 -2
  244. package/dist/atomic/{p-7e636397.js → p-dc28ee14.js} +2 -2
  245. package/dist/{esm/sections-3f12bc7d.js.map → atomic/p-dc28ee14.js.map} +1 -1
  246. package/dist/atomic/{p-f65ca329.entry.js → p-dd35e7ad.entry.js} +2 -2
  247. package/dist/atomic/{p-c280cd05.js → p-e1cc5150.js} +1 -1
  248. package/dist/atomic/{p-dbb680bd.js → p-e62fc40e.js} +2 -2
  249. package/dist/atomic/p-e62fc40e.js.map +1 -0
  250. package/dist/atomic/{p-a5922586.entry.js → p-e7a25b00.entry.js} +2 -2
  251. package/dist/atomic/{p-5a2ef889.js → p-edd4d5f7.js} +2 -2
  252. package/dist/atomic/{p-9aad555a.entry.js → p-edede7d1.entry.js} +2 -2
  253. package/dist/atomic/{p-8d5228da.entry.js → p-ee957926.entry.js} +2 -2
  254. package/dist/atomic/p-f0464fa6.entry.js +2 -0
  255. package/dist/atomic/p-f0464fa6.entry.js.map +1 -0
  256. package/dist/atomic/{p-80290dd3.entry.js → p-f76b7ac3.entry.js} +2 -2
  257. package/dist/atomic/{p-f1241140.entry.js → p-f936f55e.entry.js} +2 -2
  258. package/dist/atomic/{p-e276c7e0.entry.js → p-f9608731.entry.js} +2 -2
  259. package/dist/atomic/{p-479cb38a.entry.js → p-f9dd14b2.entry.js} +2 -2
  260. package/dist/atomic/{p-35c2ee5f.entry.js → p-fa658ef2.entry.js} +2 -2
  261. package/dist/atomic/{p-448091f7.entry.js → p-fafd5042.entry.js} +2 -2
  262. package/dist/atomic/{p-b85c2c46.entry.js → p-fb1a1e2e.entry.js} +2 -2
  263. package/dist/atomic/{p-851b9735.entry.js → p-fdcd187d.entry.js} +2 -2
  264. package/dist/atomic/{p-b1b583a0.entry.js → p-fdd0aa42.entry.js} +2 -2
  265. package/dist/atomic/{p-44d96103.entry.js → p-fe3cd55b.entry.js} +2 -2
  266. package/dist/atomic/{p-0535b93d.entry.js → p-fe59fb2d.entry.js} +2 -2
  267. package/dist/cjs/_loader.cjs.js +1 -1
  268. package/dist/cjs/analytics-config-6594edc6.js +2927 -0
  269. package/dist/cjs/analytics-config-6594edc6.js.map +1 -0
  270. package/dist/cjs/atomic-automatic-facet_2.cjs.entry.js +3 -3
  271. package/dist/cjs/atomic-breadbox.cjs.entry.js +2 -2
  272. package/dist/cjs/atomic-category-facet.cjs.entry.js +4 -4
  273. package/dist/cjs/atomic-citation.cjs.entry.js +1 -1
  274. package/dist/cjs/atomic-color-facet.cjs.entry.js +3 -3
  275. package/dist/cjs/atomic-facet-manager.cjs.entry.js +1 -1
  276. package/dist/cjs/atomic-facet-number-input.cjs.entry.js +2 -2
  277. package/dist/cjs/atomic-facet.cjs.entry.js +6 -6
  278. package/dist/cjs/atomic-field-condition.cjs.entry.js +4 -4
  279. package/dist/cjs/atomic-focus-trap.cjs.entry.js +2 -2
  280. package/dist/cjs/atomic-folded-result-list.cjs.entry.js +8 -8
  281. package/dist/cjs/atomic-format-currency.cjs.entry.js +1 -1
  282. package/dist/cjs/atomic-format-number.cjs.entry.js +1 -1
  283. package/dist/cjs/atomic-format-unit.cjs.entry.js +1 -1
  284. package/dist/cjs/atomic-generated-answer-feedback-modal.cjs.entry.js +3 -3
  285. package/dist/cjs/atomic-generated-answer.cjs.entry.js +3 -3
  286. package/dist/cjs/atomic-html.cjs.entry.js +1 -1
  287. package/dist/cjs/atomic-insight-edit-toggle.cjs.entry.js +1 -1
  288. package/dist/cjs/atomic-insight-facet.cjs.entry.js +5 -5
  289. package/dist/cjs/atomic-insight-folded-result-list.cjs.entry.js +8 -8
  290. package/dist/cjs/atomic-insight-full-search-button.cjs.entry.js +1 -1
  291. package/dist/cjs/atomic-insight-generated-answer.cjs.entry.js +2 -2
  292. package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js +2 -2
  293. package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js.map +1 -1
  294. package/dist/cjs/atomic-insight-interface.cjs.entry.js +307 -0
  295. package/dist/cjs/atomic-insight-interface.cjs.entry.js.map +1 -0
  296. package/dist/cjs/atomic-insight-layout.cjs.entry.js +5 -85
  297. package/dist/cjs/atomic-insight-layout.cjs.entry.js.map +1 -1
  298. package/dist/cjs/atomic-insight-no-results.cjs.entry.js +3 -3
  299. package/dist/cjs/atomic-insight-numeric-facet.cjs.entry.js +6 -6
  300. package/dist/cjs/atomic-insight-pager.cjs.entry.js +4 -4
  301. package/dist/cjs/atomic-insight-query-error.cjs.entry.js +3 -3
  302. package/dist/cjs/atomic-insight-query-summary.cjs.entry.js +2 -2
  303. package/dist/cjs/atomic-insight-refine-modal.cjs.entry.js +5 -4
  304. package/dist/cjs/atomic-insight-refine-modal.cjs.entry.js.map +1 -1
  305. package/dist/cjs/atomic-insight-refine-toggle.cjs.entry.js +1 -1
  306. package/dist/cjs/atomic-insight-result-action-bar.cjs.entry.js +2 -2
  307. package/dist/cjs/atomic-insight-result-action.cjs.entry.js +1 -1
  308. package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js +1 -1
  309. package/dist/cjs/atomic-insight-result-attach-to-case-indicator.cjs.entry.js +1 -1
  310. package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js +4 -4
  311. package/dist/cjs/atomic-insight-result-children.cjs.entry.js +2 -2
  312. package/dist/cjs/atomic-insight-result-list.cjs.entry.js +8 -8
  313. package/dist/cjs/atomic-insight-result-quickview-action.cjs.entry.js +3 -3
  314. package/dist/cjs/atomic-insight-result-template.cjs.entry.js +4 -4
  315. package/dist/cjs/atomic-insight-result.cjs.entry.js +7 -7
  316. package/dist/cjs/atomic-insight-search-box.cjs.entry.js +4 -4
  317. package/dist/cjs/atomic-insight-smart-snippet-feedback-modal.cjs.entry.js +4 -4
  318. package/dist/cjs/atomic-insight-smart-snippet-suggestions.cjs.entry.js +1 -1
  319. package/dist/cjs/atomic-insight-smart-snippet.cjs.entry.js +1 -1
  320. package/dist/cjs/atomic-insight-tab.cjs.entry.js +2 -2
  321. package/dist/cjs/atomic-insight-tabs.cjs.entry.js +1 -1
  322. package/dist/cjs/atomic-insight-timeframe-facet.cjs.entry.js +4 -4
  323. package/dist/cjs/atomic-insight-user-actions-session_2.cjs.entry.js +1 -1
  324. package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js +2 -2
  325. package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js.map +1 -1
  326. package/dist/cjs/atomic-ipx-body.cjs.entry.js +4 -4
  327. package/dist/cjs/atomic-ipx-button.cjs.entry.js +2 -2
  328. package/dist/cjs/atomic-ipx-embedded.cjs.entry.js +3 -3
  329. package/dist/cjs/atomic-ipx-modal.cjs.entry.js +4 -4
  330. package/dist/cjs/atomic-ipx-recs-list.cjs.entry.js +8 -8
  331. package/dist/cjs/atomic-ipx-refine-modal.cjs.entry.js +4 -3
  332. package/dist/cjs/atomic-ipx-refine-modal.cjs.entry.js.map +1 -1
  333. package/dist/cjs/atomic-ipx-refine-toggle.cjs.entry.js +1 -1
  334. package/dist/cjs/atomic-ipx-result-link.cjs.entry.js +1 -1
  335. package/dist/cjs/atomic-ipx-tab.cjs.entry.js +2 -1
  336. package/dist/cjs/atomic-ipx-tab.cjs.entry.js.map +1 -1
  337. package/dist/cjs/atomic-ipx-tabs.cjs.entry.js +1 -1
  338. package/dist/cjs/{sections-4b4af2f8.js → atomic-layout-section-utils-08b4fbcd.js} +1 -1
  339. package/dist/cjs/atomic-layout-section-utils-08b4fbcd.js.map +1 -0
  340. package/dist/cjs/atomic-load-more-results.cjs.entry.js +3 -2
  341. package/dist/cjs/atomic-load-more-results.cjs.entry.js.map +1 -1
  342. package/dist/cjs/atomic-no-results.cjs.entry.js +3 -3
  343. package/dist/cjs/atomic-notifications.cjs.entry.js +2 -2
  344. package/dist/cjs/atomic-numeric-facet.cjs.entry.js +6 -6
  345. package/dist/cjs/atomic-query-error.cjs.entry.js +3 -3
  346. package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
  347. package/dist/cjs/atomic-quickview.cjs.entry.js +3 -3
  348. package/dist/cjs/atomic-rating-facet.cjs.entry.js +4 -4
  349. package/dist/cjs/atomic-rating-range-facet.cjs.entry.js +3 -3
  350. package/dist/cjs/atomic-recs-error.cjs.entry.js +3 -3
  351. package/dist/cjs/atomic-recs-interface.cjs.entry.js +18 -2927
  352. package/dist/cjs/atomic-recs-interface.cjs.entry.js.map +1 -1
  353. package/dist/cjs/atomic-recs-list.cjs.entry.js +8 -8
  354. package/dist/cjs/atomic-recs-result-template.cjs.entry.js +4 -4
  355. package/dist/cjs/atomic-recs-result.cjs.entry.js +6 -6
  356. package/dist/cjs/atomic-refine-modal.cjs.entry.js +6 -6
  357. package/dist/cjs/atomic-refine-modal.cjs.entry.js.map +1 -1
  358. package/dist/cjs/atomic-refine-toggle.cjs.entry.js +1 -1
  359. package/dist/cjs/atomic-result-children-template.cjs.entry.js +4 -4
  360. package/dist/cjs/atomic-result-children.cjs.entry.js +2 -2
  361. package/dist/cjs/atomic-result-fields-list.cjs.entry.js +1 -1
  362. package/dist/cjs/atomic-result-icon.cjs.entry.js +1 -1
  363. package/dist/cjs/atomic-result-link.cjs.entry.js +1 -1
  364. package/dist/cjs/atomic-result-list.cjs.entry.js +9 -9
  365. package/dist/cjs/atomic-result-localized-text.cjs.entry.js +2 -2
  366. package/dist/cjs/atomic-result-multi-value-text.cjs.entry.js +1 -1
  367. package/dist/cjs/atomic-result-placeholder_8.cjs.entry.js +7 -7
  368. package/dist/cjs/atomic-result-printable-uri.cjs.entry.js +2 -2
  369. package/dist/cjs/atomic-result-section-children.cjs.entry.js +2 -2
  370. package/dist/cjs/atomic-result-section-emphasized.cjs.entry.js +2 -2
  371. package/dist/cjs/atomic-result-section-title-metadata.cjs.entry.js +2 -2
  372. package/dist/cjs/atomic-result-template.cjs.entry.js +4 -4
  373. package/dist/cjs/atomic-result.cjs.entry.js +6 -6
  374. package/dist/cjs/atomic-search-box-instant-results.cjs.entry.js +1 -1
  375. package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js +76 -0
  376. package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js.map +1 -0
  377. package/dist/cjs/atomic-search-box.cjs.entry.js +6 -6
  378. package/dist/cjs/atomic-segmented-facet.cjs.entry.js +2 -2
  379. package/dist/cjs/atomic-smart-snippet-answer_2.cjs.entry.js +3 -3
  380. package/dist/cjs/atomic-smart-snippet-collapse-wrapper_2.cjs.entry.js +3 -3
  381. package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +4 -4
  382. package/dist/cjs/atomic-smart-snippet-suggestions.cjs.entry.js +1 -1
  383. package/dist/cjs/atomic-smart-snippet.cjs.entry.js +2 -2
  384. package/dist/cjs/atomic-sort-dropdown.cjs.entry.js +3 -3
  385. package/dist/cjs/atomic-sort-expression.cjs.entry.js +3 -3
  386. package/dist/cjs/atomic-stencil-facet-date-input.cjs.entry.js +3 -3
  387. package/dist/cjs/atomic-suggestion-renderer.cjs.entry.js +1 -1
  388. package/dist/cjs/atomic-tab-bar_2.cjs.entry.js +1 -1
  389. package/dist/cjs/atomic-tab-button.cjs.entry.js +1 -1
  390. package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
  391. package/dist/cjs/atomic-timeframe-facet.cjs.entry.js +4 -4
  392. package/dist/cjs/atomic.cjs.js +1 -1
  393. package/dist/cjs/clock-7aeb19d0.js +7 -0
  394. package/dist/cjs/clock-7aeb19d0.js.map +1 -0
  395. package/dist/cjs/{cloned-facet-elements-3c7ea837.js → cloned-facet-elements-70cd1601.js} +2 -2
  396. package/dist/cjs/{cloned-facet-elements-3c7ea837.js.map → cloned-facet-elements-70cd1601.js.map} +1 -1
  397. package/dist/cjs/{display-options-09a8fab8.js → display-options-69531e8d.js} +4 -4
  398. package/dist/cjs/display-options-69531e8d.js.map +1 -0
  399. package/dist/cjs/index-757bc886.js +6 -2
  400. package/dist/cjs/insight-layout-b6ff92fd.js +90 -0
  401. package/dist/cjs/insight-layout-b6ff92fd.js.map +1 -0
  402. package/dist/cjs/{sections-a6a40eaa.js → item-layout-sections-b09ba4b3.js} +2 -2
  403. package/dist/cjs/item-layout-sections-b09ba4b3.js.map +1 -0
  404. package/dist/cjs/{item-section-utils-37848715.js → item-section-utils-8579462c.js} +2 -2
  405. package/dist/cjs/{item-section-utils-37848715.js.map → item-section-utils-8579462c.js.map} +1 -1
  406. package/dist/cjs/{props-utils-15a042f3.js → props-utils-1e4ba1b0.js} +2 -2
  407. package/dist/cjs/{props-utils-15a042f3.js.map → props-utils-1e4ba1b0.js.map} +1 -1
  408. package/dist/cjs/{replace-breakpoint-utils-47f2eaa4.js → replace-breakpoint-utils-7a084f54.js} +2 -1
  409. package/dist/cjs/replace-breakpoint-utils-7a084f54.js.map +1 -0
  410. package/dist/cjs/{result-template-common-023d3060.js → result-template-common-84bd4057.js} +4 -4
  411. package/dist/cjs/result-template-common-84bd4057.js.map +1 -0
  412. package/dist/cjs/{stencil-accessibility-utils-86cc7071.js → stencil-accessibility-utils-aa4c9f6c.js} +2 -2
  413. package/dist/cjs/{stencil-accessibility-utils-86cc7071.js.map → stencil-accessibility-utils-aa4c9f6c.js.map} +1 -1
  414. package/dist/cjs/{stencil-facet-value-checkbox-fed178ad.js → stencil-facet-value-checkbox-62f07459.js} +2 -2
  415. package/dist/cjs/{stencil-facet-value-checkbox-fed178ad.js.map → stencil-facet-value-checkbox-62f07459.js.map} +1 -1
  416. package/dist/cjs/{stencil-facet-value-5957b403.js → stencil-facet-value-e67c9332.js} +2 -2
  417. package/dist/cjs/{stencil-facet-value-5957b403.js.map → stencil-facet-value-e67c9332.js.map} +1 -1
  418. package/dist/cjs/{stencil-item-list-common-b08abf21.js → stencil-item-list-common-17bd1046.js} +4 -4
  419. package/dist/cjs/{stencil-item-list-common-b08abf21.js.map → stencil-item-list-common-17bd1046.js.map} +1 -1
  420. package/dist/cjs/{stencil-values-container-d20f9b28.js → stencil-values-container-9f50ec1a.js} +2 -2
  421. package/dist/cjs/{stencil-values-container-d20f9b28.js.map → stencil-values-container-9f50ec1a.js.map} +1 -1
  422. package/dist/cjs/{store-7927ea61.js → store-82abd941.js} +33 -2
  423. package/dist/cjs/store-82abd941.js.map +1 -0
  424. package/dist/cjs/{timeframe-facet-common-4ea96ccb.js → timeframe-facet-common-b5535cca.js} +2 -2
  425. package/dist/cjs/{timeframe-facet-common-4ea96ccb.js.map → timeframe-facet-common-b5535cca.js.map} +1 -1
  426. package/dist/cjs/{utils-12b49e87.js → utils-7153ae6b.js} +18 -1
  427. package/dist/cjs/utils-7153ae6b.js.map +1 -0
  428. package/dist/cjs/version.cjs.js +1 -1
  429. package/dist/esm/_loader.js +1 -1
  430. package/dist/esm/analytics-config-8c1a2cb2.js +2918 -0
  431. package/dist/esm/analytics-config-8c1a2cb2.js.map +1 -0
  432. package/dist/esm/atomic-automatic-facet_2.entry.js +3 -3
  433. package/dist/esm/atomic-breadbox.entry.js +2 -2
  434. package/dist/esm/atomic-category-facet.entry.js +4 -4
  435. package/dist/esm/atomic-citation.entry.js +1 -1
  436. package/dist/esm/atomic-color-facet.entry.js +3 -3
  437. package/dist/esm/atomic-facet-manager.entry.js +1 -1
  438. package/dist/esm/atomic-facet-number-input.entry.js +2 -2
  439. package/dist/esm/atomic-facet.entry.js +6 -6
  440. package/dist/esm/atomic-field-condition.entry.js +4 -4
  441. package/dist/esm/atomic-focus-trap.entry.js +2 -2
  442. package/dist/esm/atomic-folded-result-list.entry.js +8 -8
  443. package/dist/esm/atomic-format-currency.entry.js +1 -1
  444. package/dist/esm/atomic-format-number.entry.js +1 -1
  445. package/dist/esm/atomic-format-unit.entry.js +1 -1
  446. package/dist/esm/atomic-generated-answer-feedback-modal.entry.js +3 -3
  447. package/dist/esm/atomic-generated-answer.entry.js +3 -3
  448. package/dist/esm/atomic-html.entry.js +1 -1
  449. package/dist/esm/atomic-insight-edit-toggle.entry.js +1 -1
  450. package/dist/esm/atomic-insight-facet.entry.js +5 -5
  451. package/dist/esm/atomic-insight-folded-result-list.entry.js +8 -8
  452. package/dist/esm/atomic-insight-full-search-button.entry.js +1 -1
  453. package/dist/esm/atomic-insight-generated-answer.entry.js +2 -2
  454. package/dist/esm/atomic-insight-history-toggle.entry.js +2 -2
  455. package/dist/esm/atomic-insight-history-toggle.entry.js.map +1 -1
  456. package/dist/esm/atomic-insight-interface.entry.js +303 -0
  457. package/dist/esm/atomic-insight-interface.entry.js.map +1 -0
  458. package/dist/esm/atomic-insight-layout.entry.js +3 -83
  459. package/dist/esm/atomic-insight-layout.entry.js.map +1 -1
  460. package/dist/esm/atomic-insight-no-results.entry.js +3 -3
  461. package/dist/esm/atomic-insight-numeric-facet.entry.js +6 -6
  462. package/dist/esm/atomic-insight-pager.entry.js +4 -4
  463. package/dist/esm/atomic-insight-query-error.entry.js +3 -3
  464. package/dist/esm/atomic-insight-query-summary.entry.js +2 -2
  465. package/dist/esm/atomic-insight-refine-modal.entry.js +5 -4
  466. package/dist/esm/atomic-insight-refine-modal.entry.js.map +1 -1
  467. package/dist/esm/atomic-insight-refine-toggle.entry.js +1 -1
  468. package/dist/esm/atomic-insight-result-action-bar.entry.js +2 -2
  469. package/dist/esm/atomic-insight-result-action.entry.js +1 -1
  470. package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js +1 -1
  471. package/dist/esm/atomic-insight-result-attach-to-case-indicator.entry.js +1 -1
  472. package/dist/esm/atomic-insight-result-children-template.entry.js +4 -4
  473. package/dist/esm/atomic-insight-result-children.entry.js +2 -2
  474. package/dist/esm/atomic-insight-result-list.entry.js +8 -8
  475. package/dist/esm/atomic-insight-result-quickview-action.entry.js +3 -3
  476. package/dist/esm/atomic-insight-result-template.entry.js +4 -4
  477. package/dist/esm/atomic-insight-result.entry.js +7 -7
  478. package/dist/esm/atomic-insight-search-box.entry.js +4 -4
  479. package/dist/esm/atomic-insight-smart-snippet-feedback-modal.entry.js +4 -4
  480. package/dist/esm/atomic-insight-smart-snippet-suggestions.entry.js +1 -1
  481. package/dist/esm/atomic-insight-smart-snippet.entry.js +1 -1
  482. package/dist/esm/atomic-insight-tab.entry.js +2 -2
  483. package/dist/esm/atomic-insight-tabs.entry.js +1 -1
  484. package/dist/esm/atomic-insight-timeframe-facet.entry.js +4 -4
  485. package/dist/esm/atomic-insight-user-actions-session_2.entry.js +1 -1
  486. package/dist/esm/atomic-insight-user-actions-toggle.entry.js +2 -2
  487. package/dist/esm/atomic-insight-user-actions-toggle.entry.js.map +1 -1
  488. package/dist/esm/atomic-ipx-body.entry.js +4 -4
  489. package/dist/esm/atomic-ipx-button.entry.js +2 -2
  490. package/dist/esm/atomic-ipx-embedded.entry.js +3 -3
  491. package/dist/esm/atomic-ipx-modal.entry.js +4 -4
  492. package/dist/esm/atomic-ipx-recs-list.entry.js +8 -8
  493. package/dist/esm/atomic-ipx-refine-modal.entry.js +4 -3
  494. package/dist/esm/atomic-ipx-refine-modal.entry.js.map +1 -1
  495. package/dist/esm/atomic-ipx-refine-toggle.entry.js +1 -1
  496. package/dist/esm/atomic-ipx-result-link.entry.js +1 -1
  497. package/dist/esm/atomic-ipx-tab.entry.js +2 -1
  498. package/dist/esm/atomic-ipx-tab.entry.js.map +1 -1
  499. package/dist/esm/atomic-ipx-tabs.entry.js +1 -1
  500. package/dist/{atomic/components/sections.js → esm/atomic-layout-section-utils-c8ca7445.js} +1 -1
  501. package/dist/esm/atomic-layout-section-utils-c8ca7445.js.map +1 -0
  502. package/dist/esm/atomic-load-more-results.entry.js +3 -2
  503. package/dist/esm/atomic-load-more-results.entry.js.map +1 -1
  504. package/dist/esm/atomic-no-results.entry.js +3 -3
  505. package/dist/esm/atomic-notifications.entry.js +2 -2
  506. package/dist/esm/atomic-numeric-facet.entry.js +6 -6
  507. package/dist/esm/atomic-query-error.entry.js +3 -3
  508. package/dist/esm/atomic-quickview-modal.entry.js +1 -1
  509. package/dist/esm/atomic-quickview.entry.js +3 -3
  510. package/dist/esm/atomic-rating-facet.entry.js +4 -4
  511. package/dist/esm/atomic-rating-range-facet.entry.js +3 -3
  512. package/dist/esm/atomic-recs-error.entry.js +3 -3
  513. package/dist/esm/atomic-recs-interface.entry.js +10 -2919
  514. package/dist/esm/atomic-recs-interface.entry.js.map +1 -1
  515. package/dist/esm/atomic-recs-list.entry.js +8 -8
  516. package/dist/esm/atomic-recs-result-template.entry.js +4 -4
  517. package/dist/esm/atomic-recs-result.entry.js +6 -6
  518. package/dist/esm/atomic-refine-modal.entry.js +4 -4
  519. package/dist/esm/atomic-refine-modal.entry.js.map +1 -1
  520. package/dist/esm/atomic-refine-toggle.entry.js +1 -1
  521. package/dist/esm/atomic-result-children-template.entry.js +4 -4
  522. package/dist/esm/atomic-result-children.entry.js +2 -2
  523. package/dist/esm/atomic-result-fields-list.entry.js +1 -1
  524. package/dist/esm/atomic-result-icon.entry.js +1 -1
  525. package/dist/esm/atomic-result-link.entry.js +1 -1
  526. package/dist/esm/atomic-result-list.entry.js +9 -9
  527. package/dist/esm/atomic-result-localized-text.entry.js +2 -2
  528. package/dist/esm/atomic-result-multi-value-text.entry.js +1 -1
  529. package/dist/esm/atomic-result-placeholder_8.entry.js +7 -7
  530. package/dist/esm/atomic-result-printable-uri.entry.js +2 -2
  531. package/dist/esm/atomic-result-section-children.entry.js +2 -2
  532. package/dist/esm/atomic-result-section-emphasized.entry.js +2 -2
  533. package/dist/esm/atomic-result-section-title-metadata.entry.js +2 -2
  534. package/dist/esm/atomic-result-template.entry.js +4 -4
  535. package/dist/esm/atomic-result.entry.js +6 -6
  536. package/dist/esm/atomic-search-box-instant-results.entry.js +1 -1
  537. package/dist/esm/atomic-search-box-query-suggestions.entry.js +72 -0
  538. package/dist/esm/atomic-search-box-query-suggestions.entry.js.map +1 -0
  539. package/dist/esm/atomic-search-box.entry.js +6 -6
  540. package/dist/esm/atomic-segmented-facet.entry.js +2 -2
  541. package/dist/esm/atomic-smart-snippet-answer_2.entry.js +3 -3
  542. package/dist/esm/atomic-smart-snippet-collapse-wrapper_2.entry.js +3 -3
  543. package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +4 -4
  544. package/dist/esm/atomic-smart-snippet-suggestions.entry.js +1 -1
  545. package/dist/esm/atomic-smart-snippet.entry.js +2 -2
  546. package/dist/esm/atomic-sort-dropdown.entry.js +3 -3
  547. package/dist/esm/atomic-sort-expression.entry.js +3 -3
  548. package/dist/esm/atomic-stencil-facet-date-input.entry.js +3 -3
  549. package/dist/esm/atomic-suggestion-renderer.entry.js +1 -1
  550. package/dist/esm/atomic-tab-bar_2.entry.js +1 -1
  551. package/dist/esm/atomic-tab-button.entry.js +1 -1
  552. package/dist/esm/atomic-tab-manager.entry.js +1 -1
  553. package/dist/esm/atomic-timeframe-facet.entry.js +4 -4
  554. package/dist/esm/atomic.js +1 -1
  555. package/dist/esm/clock-b1f5d7f7.js +5 -0
  556. package/dist/esm/clock-b1f5d7f7.js.map +1 -0
  557. package/dist/esm/{cloned-facet-elements-82071d0c.js → cloned-facet-elements-807b566b.js} +2 -2
  558. package/dist/esm/{cloned-facet-elements-82071d0c.js.map → cloned-facet-elements-807b566b.js.map} +1 -1
  559. package/dist/esm/{display-options-aede159b.js → display-options-1199eed5.js} +2 -2
  560. package/dist/esm/display-options-1199eed5.js.map +1 -0
  561. package/dist/esm/index-3f35faca.js +6 -2
  562. package/dist/esm/insight-layout-a1e4b795.js +87 -0
  563. package/dist/esm/insight-layout-a1e4b795.js.map +1 -0
  564. package/dist/esm/{sections-3f12bc7d.js → item-layout-sections-8afb5049.js} +2 -2
  565. package/dist/esm/item-layout-sections-8afb5049.js.map +1 -0
  566. package/dist/esm/{item-section-utils-d8aa24b7.js → item-section-utils-46828f30.js} +2 -2
  567. package/dist/esm/{item-section-utils-d8aa24b7.js.map → item-section-utils-46828f30.js.map} +1 -1
  568. package/dist/esm/{props-utils-6040b5d2.js → props-utils-e97ad6bd.js} +2 -2
  569. package/dist/esm/{props-utils-6040b5d2.js.map → props-utils-e97ad6bd.js.map} +1 -1
  570. package/dist/esm/{replace-breakpoint-utils-13ff9ca5.js → replace-breakpoint-utils-7a336631.js} +2 -2
  571. package/dist/esm/replace-breakpoint-utils-7a336631.js.map +1 -0
  572. package/dist/esm/{result-template-common-efcc3c0e.js → result-template-common-995b94f8.js} +3 -3
  573. package/dist/esm/result-template-common-995b94f8.js.map +1 -0
  574. package/dist/esm/{stencil-accessibility-utils-ae75044b.js → stencil-accessibility-utils-196a08f3.js} +2 -2
  575. package/dist/esm/{stencil-accessibility-utils-ae75044b.js.map → stencil-accessibility-utils-196a08f3.js.map} +1 -1
  576. package/dist/esm/{stencil-facet-value-9deafe8e.js → stencil-facet-value-30dc9b6c.js} +2 -2
  577. package/dist/esm/{stencil-facet-value-9deafe8e.js.map → stencil-facet-value-30dc9b6c.js.map} +1 -1
  578. package/dist/esm/{stencil-facet-value-checkbox-c0df7c4e.js → stencil-facet-value-checkbox-0637f7f8.js} +2 -2
  579. package/dist/esm/{stencil-facet-value-checkbox-c0df7c4e.js.map → stencil-facet-value-checkbox-0637f7f8.js.map} +1 -1
  580. package/dist/esm/{stencil-item-list-common-d2833d51.js → stencil-item-list-common-fc95e16b.js} +4 -4
  581. package/dist/esm/{stencil-item-list-common-d2833d51.js.map → stencil-item-list-common-fc95e16b.js.map} +1 -1
  582. package/dist/esm/{stencil-values-container-9b9cd73f.js → stencil-values-container-55a7e816.js} +2 -2
  583. package/dist/esm/{stencil-values-container-9b9cd73f.js.map → stencil-values-container-55a7e816.js.map} +1 -1
  584. package/dist/esm/{store-7d2c2a8c.js → store-015afa83.js} +31 -3
  585. package/dist/esm/store-015afa83.js.map +1 -0
  586. package/dist/esm/{timeframe-facet-common-55fc72f3.js → timeframe-facet-common-eb1016d2.js} +2 -2
  587. package/dist/esm/{timeframe-facet-common-55fc72f3.js.map → timeframe-facet-common-eb1016d2.js.map} +1 -1
  588. package/dist/esm/{utils-6400ebde.js → utils-7161486d.js} +18 -2
  589. package/dist/esm/utils-7161486d.js.map +1 -0
  590. package/dist/esm/version.js +1 -1
  591. package/dist/types/components/common/atomic-layout-section/atomic-layout-section.d.ts +1 -1
  592. package/dist/types/components/insight/atomic-insight-interface/atomic-insight-interface.d.ts +42 -35
  593. package/dist/types/components/insight/index.d.ts +1 -1
  594. package/dist/types/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.d.ts +45 -0
  595. package/dist/types/components/search/index.d.ts +1 -0
  596. package/dist/types/components.d.ts +113 -53
  597. package/docs/atomic-docs.json +421 -103
  598. package/package.json +1 -1
  599. package/dist/atomic/components/atomic-search-box-recent-queries.d.ts +0 -11
  600. package/dist/atomic/components/atomic-search-box-recent-queries.js +0 -8
  601. package/dist/atomic/components/atomic-search-box-recent-queries.js.map +0 -1
  602. package/dist/atomic/components/atomic-search-box-recent-queries2.js +0 -183
  603. package/dist/atomic/components/atomic-search-box-recent-queries2.js.map +0 -1
  604. package/dist/atomic/components/components/insight/atomic-insight-interface/analytics-config.js +0 -31
  605. package/dist/atomic/components/components/insight/atomic-insight-interface/atomic-insight-interface.js +0 -258
  606. package/dist/atomic/components/sections.js.map +0 -1
  607. package/dist/atomic/components/sections2.js.map +0 -1
  608. package/dist/atomic/p-1fca38e1.js +0 -2
  609. package/dist/atomic/p-3fcf37f8.entry.js.map +0 -1
  610. package/dist/atomic/p-40b7b8f6.entry.js +0 -2
  611. package/dist/atomic/p-40b7b8f6.entry.js.map +0 -1
  612. package/dist/atomic/p-4fc7e58e.js.map +0 -1
  613. package/dist/atomic/p-5d0fc7e2.js +0 -2
  614. package/dist/atomic/p-6b3429d3.js +0 -2
  615. package/dist/atomic/p-7e636397.js.map +0 -1
  616. package/dist/atomic/p-7fe23afc.entry.js +0 -2
  617. package/dist/atomic/p-8ace4e12.entry.js +0 -2
  618. package/dist/atomic/p-8ace4e12.entry.js.map +0 -1
  619. package/dist/atomic/p-9c7dbbdf.js.map +0 -1
  620. package/dist/atomic/p-aaa5a853.js +0 -2
  621. package/dist/atomic/p-aaa5a853.js.map +0 -1
  622. package/dist/atomic/p-b380f118.entry.js +0 -2
  623. package/dist/atomic/p-b380f118.entry.js.map +0 -1
  624. package/dist/atomic/p-b628ed03.entry.js +0 -2
  625. package/dist/atomic/p-ca1425cc.entry.js +0 -2
  626. package/dist/atomic/p-dbb680bd.js.map +0 -1
  627. package/dist/atomic/p-ef8f2239.entry.js +0 -2
  628. package/dist/atomic/p-f37dea9e.entry.js +0 -2
  629. package/dist/atomic/p-f4818e53.entry.js +0 -2
  630. package/dist/atomic/p-f537c5af.js +0 -2
  631. package/dist/atomic/p-f537c5af.js.map +0 -1
  632. package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js +0 -234
  633. package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +0 -1
  634. package/dist/cjs/clock-f03ff827.js +0 -7
  635. package/dist/cjs/clock-f03ff827.js.map +0 -1
  636. package/dist/cjs/display-options-09a8fab8.js.map +0 -1
  637. package/dist/cjs/replace-breakpoint-utils-47f2eaa4.js.map +0 -1
  638. package/dist/cjs/result-template-common-023d3060.js.map +0 -1
  639. package/dist/cjs/sections-4b4af2f8.js.map +0 -1
  640. package/dist/cjs/sections-a6a40eaa.js.map +0 -1
  641. package/dist/cjs/store-7927ea61.js.map +0 -1
  642. package/dist/cjs/utils-12b49e87.js.map +0 -1
  643. package/dist/esm/atomic-search-box-query-suggestions_2.entry.js +0 -229
  644. package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +0 -1
  645. package/dist/esm/clock-add3e9a5.js +0 -5
  646. package/dist/esm/clock-add3e9a5.js.map +0 -1
  647. package/dist/esm/display-options-aede159b.js.map +0 -1
  648. package/dist/esm/replace-breakpoint-utils-13ff9ca5.js.map +0 -1
  649. package/dist/esm/result-template-common-efcc3c0e.js.map +0 -1
  650. package/dist/esm/sections-ae00b53a.js.map +0 -1
  651. package/dist/esm/store-7d2c2a8c.js.map +0 -1
  652. package/dist/esm/utils-6400ebde.js.map +0 -1
  653. package/dist/types/components/search/search-box-suggestions/atomic-search-box-recent-queries/atomic-search-box-recent-queries.d.ts +0 -37
  654. /package/dist/atomic/components/components/common/atomic-layout-section/{sections.js → atomic-layout-section-utils.js} +0 -0
  655. /package/dist/atomic/{p-1910eb7f.entry.js.map → p-00069a4b.entry.js.map} +0 -0
  656. /package/dist/atomic/{p-a0ebbbdf.entry.js.map → p-00a6ab8c.entry.js.map} +0 -0
  657. /package/dist/atomic/{p-15547bd5.entry.js.map → p-01511388.entry.js.map} +0 -0
  658. /package/dist/atomic/{p-6819f12c.entry.js.map → p-0610b3e7.entry.js.map} +0 -0
  659. /package/dist/atomic/{p-318c96f5.entry.js.map → p-06284430.entry.js.map} +0 -0
  660. /package/dist/atomic/{p-4cb91ee7.entry.js.map → p-0c8e7d5f.entry.js.map} +0 -0
  661. /package/dist/atomic/{p-3272a04b.entry.js.map → p-0ed76e65.entry.js.map} +0 -0
  662. /package/dist/atomic/{p-05f1ff6f.entry.js.map → p-0edea6f9.entry.js.map} +0 -0
  663. /package/dist/atomic/{p-dea22a8d.entry.js.map → p-0f39889d.entry.js.map} +0 -0
  664. /package/dist/atomic/{p-14bad769.entry.js.map → p-0f449e9d.entry.js.map} +0 -0
  665. /package/dist/atomic/{p-5b8cc4bc.entry.js.map → p-10b5e0f3.entry.js.map} +0 -0
  666. /package/dist/atomic/{p-7741124a.entry.js.map → p-1435fb6f.entry.js.map} +0 -0
  667. /package/dist/atomic/{p-831519c0.entry.js.map → p-170c7da6.entry.js.map} +0 -0
  668. /package/dist/atomic/{p-831b1340.entry.js.map → p-1bbaf206.entry.js.map} +0 -0
  669. /package/dist/atomic/{p-5f4724c9.entry.js.map → p-20b33c18.entry.js.map} +0 -0
  670. /package/dist/atomic/{p-558f2191.entry.js.map → p-23d4dc54.entry.js.map} +0 -0
  671. /package/dist/atomic/{p-a6dde0f6.entry.js.map → p-24fd7df6.entry.js.map} +0 -0
  672. /package/dist/atomic/{p-025a346a.js.map → p-27cf779a.js.map} +0 -0
  673. /package/dist/atomic/{p-6b3429d3.js.map → p-28e882e8.js.map} +0 -0
  674. /package/dist/atomic/{p-57049cd2.entry.js.map → p-2e4628bb.entry.js.map} +0 -0
  675. /package/dist/atomic/{p-d8caa4d8.entry.js.map → p-2fb49fe8.entry.js.map} +0 -0
  676. /package/dist/atomic/{p-e6871a3f.entry.js.map → p-30c09377.entry.js.map} +0 -0
  677. /package/dist/atomic/{p-0580b866.js.map → p-31a13850.js.map} +0 -0
  678. /package/dist/atomic/{p-f0c657f4.entry.js.map → p-3549a469.entry.js.map} +0 -0
  679. /package/dist/atomic/{p-c619df9b.js.map → p-3622ed6c.js.map} +0 -0
  680. /package/dist/atomic/{p-db2d92c5.entry.js.map → p-367ec37d.entry.js.map} +0 -0
  681. /package/dist/atomic/{p-26e0c1f8.entry.js.map → p-36f63642.entry.js.map} +0 -0
  682. /package/dist/atomic/{p-af2855cc.entry.js.map → p-373448df.entry.js.map} +0 -0
  683. /package/dist/atomic/{p-7427daa3.js.map → p-3af2fca0.js.map} +0 -0
  684. /package/dist/atomic/{p-b29d121c.js.map → p-3c9289b5.js.map} +0 -0
  685. /package/dist/atomic/{p-36e2c945.entry.js.map → p-3d55fce6.entry.js.map} +0 -0
  686. /package/dist/atomic/{p-088d634c.entry.js.map → p-3e9db2b5.entry.js.map} +0 -0
  687. /package/dist/atomic/{p-36905dd1.entry.js.map → p-40c1dfcb.entry.js.map} +0 -0
  688. /package/dist/atomic/{p-be011bd1.entry.js.map → p-416d088e.entry.js.map} +0 -0
  689. /package/dist/atomic/{p-99d4c4bf.entry.js.map → p-47ab6c9f.entry.js.map} +0 -0
  690. /package/dist/atomic/{p-7242b46e.entry.js.map → p-4830b9bb.entry.js.map} +0 -0
  691. /package/dist/atomic/{p-0ee7cab8.entry.js.map → p-4bdc6d5a.entry.js.map} +0 -0
  692. /package/dist/atomic/{p-c2a5dac0.entry.js.map → p-4f4c9a03.entry.js.map} +0 -0
  693. /package/dist/atomic/{p-7fd58269.entry.js.map → p-519d9abd.entry.js.map} +0 -0
  694. /package/dist/atomic/{p-7f56351b.entry.js.map → p-52d5461a.entry.js.map} +0 -0
  695. /package/dist/atomic/{p-5d0fc7e2.js.map → p-56c97c3e.js.map} +0 -0
  696. /package/dist/atomic/{p-ae69f519.entry.js.map → p-59b15bd6.entry.js.map} +0 -0
  697. /package/dist/atomic/{p-e49ad083.entry.js.map → p-59f043a0.entry.js.map} +0 -0
  698. /package/dist/atomic/{p-ca37969c.js.map → p-5ca21deb.js.map} +0 -0
  699. /package/dist/atomic/{p-e34dafbb.entry.js.map → p-6078667f.entry.js.map} +0 -0
  700. /package/dist/atomic/{p-2f437b47.entry.js.map → p-6098b906.entry.js.map} +0 -0
  701. /package/dist/atomic/{p-c467674f.entry.js.map → p-62e85c20.entry.js.map} +0 -0
  702. /package/dist/atomic/{p-3b49d42d.entry.js.map → p-6f34dd3a.entry.js.map} +0 -0
  703. /package/dist/atomic/{p-82cd6398.entry.js.map → p-723f76a1.entry.js.map} +0 -0
  704. /package/dist/atomic/{p-6439156c.entry.js.map → p-740cd5bc.entry.js.map} +0 -0
  705. /package/dist/atomic/{p-d0ab0125.entry.js.map → p-7cced247.entry.js.map} +0 -0
  706. /package/dist/atomic/{p-044de1f9.entry.js.map → p-7e971d15.entry.js.map} +0 -0
  707. /package/dist/atomic/{p-66166975.entry.js.map → p-7e9a1a1a.entry.js.map} +0 -0
  708. /package/dist/atomic/{p-5e1018bb.entry.js.map → p-7fd5b6ac.entry.js.map} +0 -0
  709. /package/dist/atomic/{p-36ff2bc3.entry.js.map → p-83d3857f.entry.js.map} +0 -0
  710. /package/dist/atomic/{p-1c8bcadf.entry.js.map → p-85145c88.entry.js.map} +0 -0
  711. /package/dist/atomic/{p-55c41e00.entry.js.map → p-8572a953.entry.js.map} +0 -0
  712. /package/dist/atomic/{p-5cab535b.entry.js.map → p-87f69e53.entry.js.map} +0 -0
  713. /package/dist/atomic/{p-22b76c96.entry.js.map → p-89d8bb0d.entry.js.map} +0 -0
  714. /package/dist/atomic/{p-87e2c8ae.entry.js.map → p-9239be63.entry.js.map} +0 -0
  715. /package/dist/atomic/{p-89abfaec.entry.js.map → p-9260dd7d.entry.js.map} +0 -0
  716. /package/dist/atomic/{p-bd01acd5.entry.js.map → p-93601dc0.entry.js.map} +0 -0
  717. /package/dist/atomic/{p-c5164dbf.entry.js.map → p-93f1d551.entry.js.map} +0 -0
  718. /package/dist/atomic/{p-6698d5e9.entry.js.map → p-97538903.entry.js.map} +0 -0
  719. /package/dist/atomic/{p-fc71835d.entry.js.map → p-97829295.entry.js.map} +0 -0
  720. /package/dist/atomic/{p-18dc558c.entry.js.map → p-98dd6df1.entry.js.map} +0 -0
  721. /package/dist/atomic/{p-2f517a54.entry.js.map → p-998393ec.entry.js.map} +0 -0
  722. /package/dist/atomic/{p-39fe9c1e.entry.js.map → p-9a6ec803.entry.js.map} +0 -0
  723. /package/dist/atomic/{p-70747efa.entry.js.map → p-a130b00b.entry.js.map} +0 -0
  724. /package/dist/atomic/{p-94adab79.entry.js.map → p-a1e5f767.entry.js.map} +0 -0
  725. /package/dist/atomic/{p-a7189b06.entry.js.map → p-a5f66ecd.entry.js.map} +0 -0
  726. /package/dist/atomic/{p-47b41b27.entry.js.map → p-a9383817.entry.js.map} +0 -0
  727. /package/dist/atomic/{p-b1ffa893.entry.js.map → p-af1b4924.entry.js.map} +0 -0
  728. /package/dist/atomic/{p-bc43df67.entry.js.map → p-b2b9e83f.entry.js.map} +0 -0
  729. /package/dist/atomic/{p-182f9112.entry.js.map → p-b313058c.entry.js.map} +0 -0
  730. /package/dist/atomic/{p-76c14d82.entry.js.map → p-b320f270.entry.js.map} +0 -0
  731. /package/dist/atomic/{p-81bdbd07.entry.js.map → p-b6ae0244.entry.js.map} +0 -0
  732. /package/dist/atomic/{p-df8d38ca.entry.js.map → p-bbfe727a.entry.js.map} +0 -0
  733. /package/dist/atomic/{p-48bab1a6.entry.js.map → p-be2a43f4.entry.js.map} +0 -0
  734. /package/dist/atomic/{p-955092ed.entry.js.map → p-c25f1437.entry.js.map} +0 -0
  735. /package/dist/atomic/{p-f4818e53.entry.js.map → p-c2b4b401.entry.js.map} +0 -0
  736. /package/dist/atomic/{p-3e62ef5c.entry.js.map → p-c4fb6426.entry.js.map} +0 -0
  737. /package/dist/atomic/{p-e6dc9de7.entry.js.map → p-c9f1790d.entry.js.map} +0 -0
  738. /package/dist/atomic/{p-21ab7750.entry.js.map → p-cafa4083.entry.js.map} +0 -0
  739. /package/dist/atomic/{p-b84108f3.entry.js.map → p-cb3fd0f4.entry.js.map} +0 -0
  740. /package/dist/atomic/{p-77d00da1.entry.js.map → p-cdeb5f2a.entry.js.map} +0 -0
  741. /package/dist/atomic/{p-e455330c.entry.js.map → p-ce5b896e.entry.js.map} +0 -0
  742. /package/dist/atomic/{p-3291adda.entry.js.map → p-d211a422.entry.js.map} +0 -0
  743. /package/dist/atomic/{p-463336ca.entry.js.map → p-da845e35.entry.js.map} +0 -0
  744. /package/dist/atomic/{p-33245038.entry.js.map → p-dbc0ce5c.entry.js.map} +0 -0
  745. /package/dist/atomic/{p-db3b11ca.entry.js.map → p-dbf0c5a3.entry.js.map} +0 -0
  746. /package/dist/atomic/{p-ba95a7d1.entry.js.map → p-dc128135.entry.js.map} +0 -0
  747. /package/dist/atomic/{p-f65ca329.entry.js.map → p-dd35e7ad.entry.js.map} +0 -0
  748. /package/dist/atomic/{p-c280cd05.js.map → p-e1cc5150.js.map} +0 -0
  749. /package/dist/atomic/{p-a5922586.entry.js.map → p-e7a25b00.entry.js.map} +0 -0
  750. /package/dist/atomic/{p-5a2ef889.js.map → p-edd4d5f7.js.map} +0 -0
  751. /package/dist/atomic/{p-9aad555a.entry.js.map → p-edede7d1.entry.js.map} +0 -0
  752. /package/dist/atomic/{p-8d5228da.entry.js.map → p-ee957926.entry.js.map} +0 -0
  753. /package/dist/atomic/{p-80290dd3.entry.js.map → p-f76b7ac3.entry.js.map} +0 -0
  754. /package/dist/atomic/{p-f1241140.entry.js.map → p-f936f55e.entry.js.map} +0 -0
  755. /package/dist/atomic/{p-e276c7e0.entry.js.map → p-f9608731.entry.js.map} +0 -0
  756. /package/dist/atomic/{p-479cb38a.entry.js.map → p-f9dd14b2.entry.js.map} +0 -0
  757. /package/dist/atomic/{p-35c2ee5f.entry.js.map → p-fa658ef2.entry.js.map} +0 -0
  758. /package/dist/atomic/{p-448091f7.entry.js.map → p-fafd5042.entry.js.map} +0 -0
  759. /package/dist/atomic/{p-b85c2c46.entry.js.map → p-fb1a1e2e.entry.js.map} +0 -0
  760. /package/dist/atomic/{p-851b9735.entry.js.map → p-fdcd187d.entry.js.map} +0 -0
  761. /package/dist/atomic/{p-b1b583a0.entry.js.map → p-fdd0aa42.entry.js.map} +0 -0
  762. /package/dist/atomic/{p-44d96103.entry.js.map → p-fe3cd55b.entry.js.map} +0 -0
  763. /package/dist/atomic/{p-0535b93d.entry.js.map → p-fe59fb2d.entry.js.map} +0 -0
  764. /package/dist/types/components/common/atomic-layout-section/{sections.d.ts → atomic-layout-section-utils.d.ts} +0 -0
  765. /package/dist/types/components/common/layout/{sections.d.ts → item-layout-sections.d.ts} +0 -0
@@ -5,2929 +5,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-757bc886.js');
6
6
  const initQueue = require('./init-queue-a18aa323.js');
7
7
  const recommendation = require('@coveo/headless/recommendation');
8
- const propsUtils = require('./props-utils-15a042f3.js');
9
- const dayjs_min = require('./dayjs.min-8b80e6d1.js');
10
- const headless = require('@coveo/headless');
11
- const purify = require('./purify-85b542e2.js');
12
- const store = require('./store-7927ea61.js');
13
- require('@coveo/bueno');
14
- require('./utils-12b49e87.js');
8
+ const analyticsConfig = require('./analytics-config-6594edc6.js');
9
+ const propsUtils = require('./props-utils-1e4ba1b0.js');
10
+ const store = require('./store-82abd941.js');
11
+ require('./dayjs.min-8b80e6d1.js');
15
12
  require('./_commonjsHelpers-b3309d7b.js');
16
-
17
- const isString = obj => typeof obj === 'string';
18
- const defer = () => {
19
- let res;
20
- let rej;
21
- const promise = new Promise((resolve, reject) => {
22
- res = resolve;
23
- rej = reject;
24
- });
25
- promise.resolve = res;
26
- promise.reject = rej;
27
- return promise;
28
- };
29
- const makeString = object => {
30
- if (object == null) return '';
31
- return '' + object;
32
- };
33
- const copy = (a, s, t) => {
34
- a.forEach(m => {
35
- if (s[m]) t[m] = s[m];
36
- });
37
- };
38
- const lastOfPathSeparatorRegExp = /###/g;
39
- const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
40
- const canNotTraverseDeeper = object => !object || isString(object);
41
- const getLastOfPath = (object, path, Empty) => {
42
- const stack = !isString(path) ? path : path.split('.');
43
- let stackIndex = 0;
44
- while (stackIndex < stack.length - 1) {
45
- if (canNotTraverseDeeper(object)) return {};
46
- const key = cleanKey(stack[stackIndex]);
47
- if (!object[key] && Empty) object[key] = new Empty();
48
- if (Object.prototype.hasOwnProperty.call(object, key)) {
49
- object = object[key];
50
- } else {
51
- object = {};
52
- }
53
- ++stackIndex;
54
- }
55
- if (canNotTraverseDeeper(object)) return {};
56
- return {
57
- obj: object,
58
- k: cleanKey(stack[stackIndex])
59
- };
60
- };
61
- const setPath = (object, path, newValue) => {
62
- const {
63
- obj,
64
- k
65
- } = getLastOfPath(object, path, Object);
66
- if (obj !== undefined || path.length === 1) {
67
- obj[k] = newValue;
68
- return;
69
- }
70
- let e = path[path.length - 1];
71
- let p = path.slice(0, path.length - 1);
72
- let last = getLastOfPath(object, p, Object);
73
- while (last.obj === undefined && p.length) {
74
- e = `${p[p.length - 1]}.${e}`;
75
- p = p.slice(0, p.length - 1);
76
- last = getLastOfPath(object, p, Object);
77
- if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {
78
- last.obj = undefined;
79
- }
80
- }
81
- last.obj[`${last.k}.${e}`] = newValue;
82
- };
83
- const pushPath = (object, path, newValue, concat) => {
84
- const {
85
- obj,
86
- k
87
- } = getLastOfPath(object, path, Object);
88
- obj[k] = obj[k] || [];
89
- obj[k].push(newValue);
90
- };
91
- const getPath = (object, path) => {
92
- const {
93
- obj,
94
- k
95
- } = getLastOfPath(object, path);
96
- if (!obj) return undefined;
97
- if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined;
98
- return obj[k];
99
- };
100
- const getPathWithDefaults = (data, defaultData, key) => {
101
- const value = getPath(data, key);
102
- if (value !== undefined) {
103
- return value;
104
- }
105
- return getPath(defaultData, key);
106
- };
107
- const deepExtend = (target, source, overwrite) => {
108
- for (const prop in source) {
109
- if (prop !== '__proto__' && prop !== 'constructor') {
110
- if (prop in target) {
111
- if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
112
- if (overwrite) target[prop] = source[prop];
113
- } else {
114
- deepExtend(target[prop], source[prop], overwrite);
115
- }
116
- } else {
117
- target[prop] = source[prop];
118
- }
119
- }
120
- }
121
- return target;
122
- };
123
- const regexEscape = str => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
124
- var _entityMap = {
125
- '&': '&amp;',
126
- '<': '&lt;',
127
- '>': '&gt;',
128
- '"': '&quot;',
129
- "'": '&#39;',
130
- '/': '&#x2F;'
131
- };
132
- const escape = data => {
133
- if (isString(data)) {
134
- return data.replace(/[&<>"'\/]/g, s => _entityMap[s]);
135
- }
136
- return data;
137
- };
138
- class RegExpCache {
139
- constructor(capacity) {
140
- this.capacity = capacity;
141
- this.regExpMap = new Map();
142
- this.regExpQueue = [];
143
- }
144
- getRegExp(pattern) {
145
- const regExpFromCache = this.regExpMap.get(pattern);
146
- if (regExpFromCache !== undefined) {
147
- return regExpFromCache;
148
- }
149
- const regExpNew = new RegExp(pattern);
150
- if (this.regExpQueue.length === this.capacity) {
151
- this.regExpMap.delete(this.regExpQueue.shift());
152
- }
153
- this.regExpMap.set(pattern, regExpNew);
154
- this.regExpQueue.push(pattern);
155
- return regExpNew;
156
- }
157
- }
158
- const chars = [' ', ',', '?', '!', ';'];
159
- const looksLikeObjectPathRegExpCache = new RegExpCache(20);
160
- const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
161
- nsSeparator = nsSeparator || '';
162
- keySeparator = keySeparator || '';
163
- const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
164
- if (possibleChars.length === 0) return true;
165
- const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
166
- let matched = !r.test(key);
167
- if (!matched) {
168
- const ki = key.indexOf(keySeparator);
169
- if (ki > 0 && !r.test(key.substring(0, ki))) {
170
- matched = true;
171
- }
172
- }
173
- return matched;
174
- };
175
- const deepFind = (obj, path, keySeparator = '.') => {
176
- if (!obj) return undefined;
177
- if (obj[path]) {
178
- if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;
179
- return obj[path];
180
- }
181
- const tokens = path.split(keySeparator);
182
- let current = obj;
183
- for (let i = 0; i < tokens.length;) {
184
- if (!current || typeof current !== 'object') {
185
- return undefined;
186
- }
187
- let next;
188
- let nextPath = '';
189
- for (let j = i; j < tokens.length; ++j) {
190
- if (j !== i) {
191
- nextPath += keySeparator;
192
- }
193
- nextPath += tokens[j];
194
- next = current[nextPath];
195
- if (next !== undefined) {
196
- if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {
197
- continue;
198
- }
199
- i += j - i + 1;
200
- break;
201
- }
202
- }
203
- current = next;
204
- }
205
- return current;
206
- };
207
- const getCleanedCode = code => code?.replace('_', '-');
208
-
209
- const consoleLogger = {
210
- type: 'logger',
211
- log(args) {
212
- this.output('log', args);
213
- },
214
- warn(args) {
215
- this.output('warn', args);
216
- },
217
- error(args) {
218
- this.output('error', args);
219
- },
220
- output(type, args) {
221
- console?.[type]?.apply?.(console, args);
222
- }
223
- };
224
- class Logger {
225
- constructor(concreteLogger, options = {}) {
226
- this.init(concreteLogger, options);
227
- }
228
- init(concreteLogger, options = {}) {
229
- this.prefix = options.prefix || 'i18next:';
230
- this.logger = concreteLogger || consoleLogger;
231
- this.options = options;
232
- this.debug = options.debug;
233
- }
234
- log(...args) {
235
- return this.forward(args, 'log', '', true);
236
- }
237
- warn(...args) {
238
- return this.forward(args, 'warn', '', true);
239
- }
240
- error(...args) {
241
- return this.forward(args, 'error', '');
242
- }
243
- deprecate(...args) {
244
- return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
245
- }
246
- forward(args, lvl, prefix, debugOnly) {
247
- if (debugOnly && !this.debug) return null;
248
- if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
249
- return this.logger[lvl](args);
250
- }
251
- create(moduleName) {
252
- return new Logger(this.logger, {
253
- ...{
254
- prefix: `${this.prefix}:${moduleName}:`
255
- },
256
- ...this.options
257
- });
258
- }
259
- clone(options) {
260
- options = options || this.options;
261
- options.prefix = options.prefix || this.prefix;
262
- return new Logger(this.logger, options);
263
- }
264
- }
265
- var baseLogger = new Logger();
266
-
267
- class EventEmitter {
268
- constructor() {
269
- this.observers = {};
270
- }
271
- on(events, listener) {
272
- events.split(' ').forEach(event => {
273
- if (!this.observers[event]) this.observers[event] = new Map();
274
- const numListeners = this.observers[event].get(listener) || 0;
275
- this.observers[event].set(listener, numListeners + 1);
276
- });
277
- return this;
278
- }
279
- off(event, listener) {
280
- if (!this.observers[event]) return;
281
- if (!listener) {
282
- delete this.observers[event];
283
- return;
284
- }
285
- this.observers[event].delete(listener);
286
- }
287
- emit(event, ...args) {
288
- if (this.observers[event]) {
289
- const cloned = Array.from(this.observers[event].entries());
290
- cloned.forEach(([observer, numTimesAdded]) => {
291
- for (let i = 0; i < numTimesAdded; i++) {
292
- observer(...args);
293
- }
294
- });
295
- }
296
- if (this.observers['*']) {
297
- const cloned = Array.from(this.observers['*'].entries());
298
- cloned.forEach(([observer, numTimesAdded]) => {
299
- for (let i = 0; i < numTimesAdded; i++) {
300
- observer.apply(observer, [event, ...args]);
301
- }
302
- });
303
- }
304
- }
305
- }
306
-
307
- class ResourceStore extends EventEmitter {
308
- constructor(data, options = {
309
- ns: ['translation'],
310
- defaultNS: 'translation'
311
- }) {
312
- super();
313
- this.data = data || {};
314
- this.options = options;
315
- if (this.options.keySeparator === undefined) {
316
- this.options.keySeparator = '.';
317
- }
318
- if (this.options.ignoreJSONStructure === undefined) {
319
- this.options.ignoreJSONStructure = true;
320
- }
321
- }
322
- addNamespaces(ns) {
323
- if (this.options.ns.indexOf(ns) < 0) {
324
- this.options.ns.push(ns);
325
- }
326
- }
327
- removeNamespaces(ns) {
328
- const index = this.options.ns.indexOf(ns);
329
- if (index > -1) {
330
- this.options.ns.splice(index, 1);
331
- }
332
- }
333
- getResource(lng, ns, key, options = {}) {
334
- const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
335
- const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
336
- let path;
337
- if (lng.indexOf('.') > -1) {
338
- path = lng.split('.');
339
- } else {
340
- path = [lng, ns];
341
- if (key) {
342
- if (Array.isArray(key)) {
343
- path.push(...key);
344
- } else if (isString(key) && keySeparator) {
345
- path.push(...key.split(keySeparator));
346
- } else {
347
- path.push(key);
348
- }
349
- }
350
- }
351
- const result = getPath(this.data, path);
352
- if (!result && !ns && !key && lng.indexOf('.') > -1) {
353
- lng = path[0];
354
- ns = path[1];
355
- key = path.slice(2).join('.');
356
- }
357
- if (result || !ignoreJSONStructure || !isString(key)) return result;
358
- return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
359
- }
360
- addResource(lng, ns, key, value, options = {
361
- silent: false
362
- }) {
363
- const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
364
- let path = [lng, ns];
365
- if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
366
- if (lng.indexOf('.') > -1) {
367
- path = lng.split('.');
368
- value = ns;
369
- ns = path[1];
370
- }
371
- this.addNamespaces(ns);
372
- setPath(this.data, path, value);
373
- if (!options.silent) this.emit('added', lng, ns, key, value);
374
- }
375
- addResources(lng, ns, resources, options = {
376
- silent: false
377
- }) {
378
- for (const m in resources) {
379
- if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
380
- silent: true
381
- });
382
- }
383
- if (!options.silent) this.emit('added', lng, ns, resources);
384
- }
385
- addResourceBundle(lng, ns, resources, deep, overwrite, options = {
386
- silent: false,
387
- skipCopy: false
388
- }) {
389
- let path = [lng, ns];
390
- if (lng.indexOf('.') > -1) {
391
- path = lng.split('.');
392
- deep = resources;
393
- resources = ns;
394
- ns = path[1];
395
- }
396
- this.addNamespaces(ns);
397
- let pack = getPath(this.data, path) || {};
398
- if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
399
- if (deep) {
400
- deepExtend(pack, resources, overwrite);
401
- } else {
402
- pack = {
403
- ...pack,
404
- ...resources
405
- };
406
- }
407
- setPath(this.data, path, pack);
408
- if (!options.silent) this.emit('added', lng, ns, resources);
409
- }
410
- removeResourceBundle(lng, ns) {
411
- if (this.hasResourceBundle(lng, ns)) {
412
- delete this.data[lng][ns];
413
- }
414
- this.removeNamespaces(ns);
415
- this.emit('removed', lng, ns);
416
- }
417
- hasResourceBundle(lng, ns) {
418
- return this.getResource(lng, ns) !== undefined;
419
- }
420
- getResourceBundle(lng, ns) {
421
- if (!ns) ns = this.options.defaultNS;
422
- return this.getResource(lng, ns);
423
- }
424
- getDataByLanguage(lng) {
425
- return this.data[lng];
426
- }
427
- hasLanguageSomeTranslations(lng) {
428
- const data = this.getDataByLanguage(lng);
429
- const n = data && Object.keys(data) || [];
430
- return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);
431
- }
432
- toJSON() {
433
- return this.data;
434
- }
435
- }
436
-
437
- var postProcessor = {
438
- processors: {},
439
- addPostProcessor(module) {
440
- this.processors[module.name] = module;
441
- },
442
- handle(processors, value, key, options, translator) {
443
- processors.forEach(processor => {
444
- value = this.processors[processor]?.process(value, key, options, translator) ?? value;
445
- });
446
- return value;
447
- }
448
- };
449
-
450
- const checkedLoadedFor = {};
451
- const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
452
- class Translator extends EventEmitter {
453
- constructor(services, options = {}) {
454
- super();
455
- copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);
456
- this.options = options;
457
- if (this.options.keySeparator === undefined) {
458
- this.options.keySeparator = '.';
459
- }
460
- this.logger = baseLogger.create('translator');
461
- }
462
- changeLanguage(lng) {
463
- if (lng) this.language = lng;
464
- }
465
- exists(key, o = {
466
- interpolation: {}
467
- }) {
468
- const opt = {
469
- ...o
470
- };
471
- if (key == null) return false;
472
- const resolved = this.resolve(key, opt);
473
- return resolved?.res !== undefined;
474
- }
475
- extractFromKey(key, opt) {
476
- let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
477
- if (nsSeparator === undefined) nsSeparator = ':';
478
- const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
479
- let namespaces = opt.ns || this.options.defaultNS || [];
480
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
481
- const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
482
- if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
483
- const m = key.match(this.interpolator.nestingRegexp);
484
- if (m && m.length > 0) {
485
- return {
486
- key,
487
- namespaces: isString(namespaces) ? [namespaces] : namespaces
488
- };
489
- }
490
- const parts = key.split(nsSeparator);
491
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
492
- key = parts.join(keySeparator);
493
- }
494
- return {
495
- key,
496
- namespaces: isString(namespaces) ? [namespaces] : namespaces
497
- };
498
- }
499
- translate(keys, o, lastKey) {
500
- let opt = typeof o === 'object' ? {
501
- ...o
502
- } : o;
503
- if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) {
504
- opt = this.options.overloadTranslationOptionHandler(arguments);
505
- }
506
- if (typeof options === 'object') opt = {
507
- ...opt
508
- };
509
- if (!opt) opt = {};
510
- if (keys == null) return '';
511
- if (!Array.isArray(keys)) keys = [String(keys)];
512
- const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
513
- const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
514
- const {
515
- key,
516
- namespaces
517
- } = this.extractFromKey(keys[keys.length - 1], opt);
518
- const namespace = namespaces[namespaces.length - 1];
519
- let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
520
- if (nsSeparator === undefined) nsSeparator = ':';
521
- const lng = opt.lng || this.language;
522
- const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
523
- if (lng?.toLowerCase() === 'cimode') {
524
- if (appendNamespaceToCIMode) {
525
- if (returnDetails) {
526
- return {
527
- res: `${namespace}${nsSeparator}${key}`,
528
- usedKey: key,
529
- exactUsedKey: key,
530
- usedLng: lng,
531
- usedNS: namespace,
532
- usedParams: this.getUsedParamsDetails(opt)
533
- };
534
- }
535
- return `${namespace}${nsSeparator}${key}`;
536
- }
537
- if (returnDetails) {
538
- return {
539
- res: key,
540
- usedKey: key,
541
- exactUsedKey: key,
542
- usedLng: lng,
543
- usedNS: namespace,
544
- usedParams: this.getUsedParamsDetails(opt)
545
- };
546
- }
547
- return key;
548
- }
549
- const resolved = this.resolve(keys, opt);
550
- let res = resolved?.res;
551
- const resUsedKey = resolved?.usedKey || key;
552
- const resExactUsedKey = resolved?.exactUsedKey || key;
553
- const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
554
- const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;
555
- const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
556
- const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
557
- const hasDefaultValue = Translator.hasDefaultValue(opt);
558
- const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : '';
559
- const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
560
- ordinal: false
561
- }) : '';
562
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
563
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
564
- let resForObjHndl = res;
565
- if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
566
- resForObjHndl = defaultValue;
567
- }
568
- const handleAsObject = shouldHandleAsObject(resForObjHndl);
569
- const resType = Object.prototype.toString.apply(resForObjHndl);
570
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
571
- if (!opt.returnObjects && !this.options.returnObjects) {
572
- if (!this.options.returnedObjectHandler) {
573
- this.logger.warn('accessing an object - but returnObjects options is not enabled!');
574
- }
575
- const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
576
- ...opt,
577
- ns: namespaces
578
- }) : `key '${key} (${this.language})' returned an object instead of string.`;
579
- if (returnDetails) {
580
- resolved.res = r;
581
- resolved.usedParams = this.getUsedParamsDetails(opt);
582
- return resolved;
583
- }
584
- return r;
585
- }
586
- if (keySeparator) {
587
- const resTypeIsArray = Array.isArray(resForObjHndl);
588
- const copy = resTypeIsArray ? [] : {};
589
- const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
590
- for (const m in resForObjHndl) {
591
- if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
592
- const deepKey = `${newKeyToUse}${keySeparator}${m}`;
593
- if (hasDefaultValue && !res) {
594
- copy[m] = this.translate(deepKey, {
595
- ...opt,
596
- defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,
597
- ...{
598
- joinArrays: false,
599
- ns: namespaces
600
- }
601
- });
602
- } else {
603
- copy[m] = this.translate(deepKey, {
604
- ...opt,
605
- ...{
606
- joinArrays: false,
607
- ns: namespaces
608
- }
609
- });
610
- }
611
- if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
612
- }
613
- }
614
- res = copy;
615
- }
616
- } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
617
- res = res.join(joinArrays);
618
- if (res) res = this.extendTranslation(res, keys, opt, lastKey);
619
- } else {
620
- let usedDefault = false;
621
- let usedKey = false;
622
- if (!this.isValidLookup(res) && hasDefaultValue) {
623
- usedDefault = true;
624
- res = defaultValue;
625
- }
626
- if (!this.isValidLookup(res)) {
627
- usedKey = true;
628
- res = key;
629
- }
630
- const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
631
- const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
632
- const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
633
- if (usedKey || usedDefault || updateMissing) {
634
- this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
635
- if (keySeparator) {
636
- const fk = this.resolve(key, {
637
- ...opt,
638
- keySeparator: false
639
- });
640
- if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');
641
- }
642
- let lngs = [];
643
- const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
644
- if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
645
- for (let i = 0; i < fallbackLngs.length; i++) {
646
- lngs.push(fallbackLngs[i]);
647
- }
648
- } else if (this.options.saveMissingTo === 'all') {
649
- lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
650
- } else {
651
- lngs.push(opt.lng || this.language);
652
- }
653
- const send = (l, k, specificDefaultValue) => {
654
- const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
655
- if (this.options.missingKeyHandler) {
656
- this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
657
- } else if (this.backendConnector?.saveMissing) {
658
- this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
659
- }
660
- this.emit('missingKey', l, namespace, k, res);
661
- };
662
- if (this.options.saveMissing) {
663
- if (this.options.saveMissingPlurals && needsPluralHandling) {
664
- lngs.forEach(language => {
665
- const suffixes = this.pluralResolver.getSuffixes(language, opt);
666
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
667
- suffixes.push(`${this.options.pluralSeparator}zero`);
668
- }
669
- suffixes.forEach(suffix => {
670
- send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
671
- });
672
- });
673
- } else {
674
- send(lngs, key, defaultValue);
675
- }
676
- }
677
- }
678
- res = this.extendTranslation(res, keys, opt, resolved, lastKey);
679
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
680
- res = `${namespace}${nsSeparator}${key}`;
681
- }
682
- if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
683
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
684
- }
685
- }
686
- if (returnDetails) {
687
- resolved.res = res;
688
- resolved.usedParams = this.getUsedParamsDetails(opt);
689
- return resolved;
690
- }
691
- return res;
692
- }
693
- extendTranslation(res, key, opt, resolved, lastKey) {
694
- if (this.i18nFormat?.parse) {
695
- res = this.i18nFormat.parse(res, {
696
- ...this.options.interpolation.defaultVariables,
697
- ...opt
698
- }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
699
- resolved
700
- });
701
- } else if (!opt.skipInterpolation) {
702
- if (opt.interpolation) this.interpolator.init({
703
- ...opt,
704
- ...{
705
- interpolation: {
706
- ...this.options.interpolation,
707
- ...opt.interpolation
708
- }
709
- }
710
- });
711
- const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
712
- let nestBef;
713
- if (skipOnVariables) {
714
- const nb = res.match(this.interpolator.nestingRegexp);
715
- nestBef = nb && nb.length;
716
- }
717
- let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
718
- if (this.options.interpolation.defaultVariables) data = {
719
- ...this.options.interpolation.defaultVariables,
720
- ...data
721
- };
722
- res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
723
- if (skipOnVariables) {
724
- const na = res.match(this.interpolator.nestingRegexp);
725
- const nestAft = na && na.length;
726
- if (nestBef < nestAft) opt.nest = false;
727
- }
728
- if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
729
- if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
730
- if (lastKey?.[0] === args[0] && !opt.context) {
731
- this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
732
- return null;
733
- }
734
- return this.translate(...args, key);
735
- }, opt);
736
- if (opt.interpolation) this.interpolator.reset();
737
- }
738
- const postProcess = opt.postProcess || this.options.postProcess;
739
- const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
740
- if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
741
- res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
742
- i18nResolved: {
743
- ...resolved,
744
- usedParams: this.getUsedParamsDetails(opt)
745
- },
746
- ...opt
747
- } : opt, this);
748
- }
749
- return res;
750
- }
751
- resolve(keys, opt = {}) {
752
- let found;
753
- let usedKey;
754
- let exactUsedKey;
755
- let usedLng;
756
- let usedNS;
757
- if (isString(keys)) keys = [keys];
758
- keys.forEach(k => {
759
- if (this.isValidLookup(found)) return;
760
- const extracted = this.extractFromKey(k, opt);
761
- const key = extracted.key;
762
- usedKey = key;
763
- let namespaces = extracted.namespaces;
764
- if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
765
- const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
766
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
767
- const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === 'number') && opt.context !== '';
768
- const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
769
- namespaces.forEach(ns => {
770
- if (this.isValidLookup(found)) return;
771
- usedNS = ns;
772
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
773
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
774
- this.logger.warn(`key "${usedKey}" for languages "${codes.join(', ')}" won't get resolved as namespace "${usedNS}" was not yet loaded`, 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
775
- }
776
- codes.forEach(code => {
777
- if (this.isValidLookup(found)) return;
778
- usedLng = code;
779
- const finalKeys = [key];
780
- if (this.i18nFormat?.addLookupKeys) {
781
- this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
782
- } else {
783
- let pluralSuffix;
784
- if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
785
- const zeroSuffix = `${this.options.pluralSeparator}zero`;
786
- const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
787
- if (needsPluralHandling) {
788
- finalKeys.push(key + pluralSuffix);
789
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
790
- finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
791
- }
792
- if (needsZeroSuffixLookup) {
793
- finalKeys.push(key + zeroSuffix);
794
- }
795
- }
796
- if (needsContextHandling) {
797
- const contextKey = `${key}${this.options.contextSeparator}${opt.context}`;
798
- finalKeys.push(contextKey);
799
- if (needsPluralHandling) {
800
- finalKeys.push(contextKey + pluralSuffix);
801
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
802
- finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
803
- }
804
- if (needsZeroSuffixLookup) {
805
- finalKeys.push(contextKey + zeroSuffix);
806
- }
807
- }
808
- }
809
- }
810
- let possibleKey;
811
- while (possibleKey = finalKeys.pop()) {
812
- if (!this.isValidLookup(found)) {
813
- exactUsedKey = possibleKey;
814
- found = this.getResource(code, ns, possibleKey, opt);
815
- }
816
- }
817
- });
818
- });
819
- });
820
- return {
821
- res: found,
822
- usedKey,
823
- exactUsedKey,
824
- usedLng,
825
- usedNS
826
- };
827
- }
828
- isValidLookup(res) {
829
- return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
830
- }
831
- getResource(code, ns, key, options = {}) {
832
- if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
833
- return this.resourceStore.getResource(code, ns, key, options);
834
- }
835
- getUsedParamsDetails(options = {}) {
836
- const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
837
- const useOptionsReplaceForData = options.replace && !isString(options.replace);
838
- let data = useOptionsReplaceForData ? options.replace : options;
839
- if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
840
- data.count = options.count;
841
- }
842
- if (this.options.interpolation.defaultVariables) {
843
- data = {
844
- ...this.options.interpolation.defaultVariables,
845
- ...data
846
- };
847
- }
848
- if (!useOptionsReplaceForData) {
849
- data = {
850
- ...data
851
- };
852
- for (const key of optionsKeys) {
853
- delete data[key];
854
- }
855
- }
856
- return data;
857
- }
858
- static hasDefaultValue(options) {
859
- const prefix = 'defaultValue';
860
- for (const option in options) {
861
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
862
- return true;
863
- }
864
- }
865
- return false;
866
- }
867
- }
868
-
869
- class LanguageUtil {
870
- constructor(options) {
871
- this.options = options;
872
- this.supportedLngs = this.options.supportedLngs || false;
873
- this.logger = baseLogger.create('languageUtils');
874
- }
875
- getScriptPartFromCode(code) {
876
- code = getCleanedCode(code);
877
- if (!code || code.indexOf('-') < 0) return null;
878
- const p = code.split('-');
879
- if (p.length === 2) return null;
880
- p.pop();
881
- if (p[p.length - 1].toLowerCase() === 'x') return null;
882
- return this.formatLanguageCode(p.join('-'));
883
- }
884
- getLanguagePartFromCode(code) {
885
- code = getCleanedCode(code);
886
- if (!code || code.indexOf('-') < 0) return code;
887
- const p = code.split('-');
888
- return this.formatLanguageCode(p[0]);
889
- }
890
- formatLanguageCode(code) {
891
- if (isString(code) && code.indexOf('-') > -1) {
892
- let formattedCode;
893
- try {
894
- formattedCode = Intl.getCanonicalLocales(code)[0];
895
- } catch (e) {}
896
- if (formattedCode && this.options.lowerCaseLng) {
897
- formattedCode = formattedCode.toLowerCase();
898
- }
899
- if (formattedCode) return formattedCode;
900
- if (this.options.lowerCaseLng) {
901
- return code.toLowerCase();
902
- }
903
- return code;
904
- }
905
- return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
906
- }
907
- isSupportedCode(code) {
908
- if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
909
- code = this.getLanguagePartFromCode(code);
910
- }
911
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
912
- }
913
- getBestMatchFromCodes(codes) {
914
- if (!codes) return null;
915
- let found;
916
- codes.forEach(code => {
917
- if (found) return;
918
- const cleanedLng = this.formatLanguageCode(code);
919
- if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
920
- });
921
- if (!found && this.options.supportedLngs) {
922
- codes.forEach(code => {
923
- if (found) return;
924
- const lngScOnly = this.getScriptPartFromCode(code);
925
- if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;
926
- const lngOnly = this.getLanguagePartFromCode(code);
927
- if (this.isSupportedCode(lngOnly)) return found = lngOnly;
928
- found = this.options.supportedLngs.find(supportedLng => {
929
- if (supportedLng === lngOnly) return supportedLng;
930
- if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
931
- if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;
932
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
933
- });
934
- });
935
- }
936
- if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
937
- return found;
938
- }
939
- getFallbackCodes(fallbacks, code) {
940
- if (!fallbacks) return [];
941
- if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
942
- if (isString(fallbacks)) fallbacks = [fallbacks];
943
- if (Array.isArray(fallbacks)) return fallbacks;
944
- if (!code) return fallbacks.default || [];
945
- let found = fallbacks[code];
946
- if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
947
- if (!found) found = fallbacks[this.formatLanguageCode(code)];
948
- if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
949
- if (!found) found = fallbacks.default;
950
- return found || [];
951
- }
952
- toResolveHierarchy(code, fallbackCode) {
953
- const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
954
- const codes = [];
955
- const addCode = c => {
956
- if (!c) return;
957
- if (this.isSupportedCode(c)) {
958
- codes.push(c);
959
- } else {
960
- this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
961
- }
962
- };
963
- if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
964
- if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
965
- if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
966
- if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
967
- } else if (isString(code)) {
968
- addCode(this.formatLanguageCode(code));
969
- }
970
- fallbackCodes.forEach(fc => {
971
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
972
- });
973
- return codes;
974
- }
975
- }
976
-
977
- const suffixesOrder = {
978
- zero: 0,
979
- one: 1,
980
- two: 2,
981
- few: 3,
982
- many: 4,
983
- other: 5
984
- };
985
- const dummyRule = {
986
- select: count => count === 1 ? 'one' : 'other',
987
- resolvedOptions: () => ({
988
- pluralCategories: ['one', 'other']
989
- })
990
- };
991
- class PluralResolver {
992
- constructor(languageUtils, options = {}) {
993
- this.languageUtils = languageUtils;
994
- this.options = options;
995
- this.logger = baseLogger.create('pluralResolver');
996
- this.pluralRulesCache = {};
997
- }
998
- addRule(lng, obj) {
999
- this.rules[lng] = obj;
1000
- }
1001
- clearCache() {
1002
- this.pluralRulesCache = {};
1003
- }
1004
- getRule(code, options = {}) {
1005
- const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code);
1006
- const type = options.ordinal ? 'ordinal' : 'cardinal';
1007
- const cacheKey = JSON.stringify({
1008
- cleanedCode,
1009
- type
1010
- });
1011
- if (cacheKey in this.pluralRulesCache) {
1012
- return this.pluralRulesCache[cacheKey];
1013
- }
1014
- let rule;
1015
- try {
1016
- rule = new Intl.PluralRules(cleanedCode, {
1017
- type
1018
- });
1019
- } catch (err) {
1020
- if (!Intl) {
1021
- this.logger.error('No Intl support, please use an Intl polyfill!');
1022
- return dummyRule;
1023
- }
1024
- if (!code.match(/-|_/)) return dummyRule;
1025
- const lngPart = this.languageUtils.getLanguagePartFromCode(code);
1026
- rule = this.getRule(lngPart, options);
1027
- }
1028
- this.pluralRulesCache[cacheKey] = rule;
1029
- return rule;
1030
- }
1031
- needsPlural(code, options = {}) {
1032
- let rule = this.getRule(code, options);
1033
- if (!rule) rule = this.getRule('dev', options);
1034
- return rule?.resolvedOptions().pluralCategories.length > 1;
1035
- }
1036
- getPluralFormsOfKey(code, key, options = {}) {
1037
- return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);
1038
- }
1039
- getSuffixes(code, options = {}) {
1040
- let rule = this.getRule(code, options);
1041
- if (!rule) rule = this.getRule('dev', options);
1042
- if (!rule) return [];
1043
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);
1044
- }
1045
- getSuffix(code, count, options = {}) {
1046
- const rule = this.getRule(code, options);
1047
- if (rule) {
1048
- return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;
1049
- }
1050
- this.logger.warn(`no plural rule found for: ${code}`);
1051
- return this.getSuffix('dev', count, options);
1052
- }
1053
- }
1054
-
1055
- const deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true) => {
1056
- let path = getPathWithDefaults(data, defaultData, key);
1057
- if (!path && ignoreJSONStructure && isString(key)) {
1058
- path = deepFind(data, key, keySeparator);
1059
- if (path === undefined) path = deepFind(defaultData, key, keySeparator);
1060
- }
1061
- return path;
1062
- };
1063
- const regexSafe = val => val.replace(/\$/g, '$$$$');
1064
- class Interpolator {
1065
- constructor(options = {}) {
1066
- this.logger = baseLogger.create('interpolator');
1067
- this.options = options;
1068
- this.format = options?.interpolation?.format || (value => value);
1069
- this.init(options);
1070
- }
1071
- init(options = {}) {
1072
- if (!options.interpolation) options.interpolation = {
1073
- escapeValue: true
1074
- };
1075
- const {
1076
- escape: escape$1,
1077
- escapeValue,
1078
- useRawValueToEscape,
1079
- prefix,
1080
- prefixEscaped,
1081
- suffix,
1082
- suffixEscaped,
1083
- formatSeparator,
1084
- unescapeSuffix,
1085
- unescapePrefix,
1086
- nestingPrefix,
1087
- nestingPrefixEscaped,
1088
- nestingSuffix,
1089
- nestingSuffixEscaped,
1090
- nestingOptionsSeparator,
1091
- maxReplaces,
1092
- alwaysFormat
1093
- } = options.interpolation;
1094
- this.escape = escape$1 !== undefined ? escape$1 : escape;
1095
- this.escapeValue = escapeValue !== undefined ? escapeValue : true;
1096
- this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
1097
- this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{';
1098
- this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}';
1099
- this.formatSeparator = formatSeparator || ',';
1100
- this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';
1101
- this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';
1102
- this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t(');
1103
- this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')');
1104
- this.nestingOptionsSeparator = nestingOptionsSeparator || ',';
1105
- this.maxReplaces = maxReplaces || 1000;
1106
- this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
1107
- this.resetRegExp();
1108
- }
1109
- reset() {
1110
- if (this.options) this.init(this.options);
1111
- }
1112
- resetRegExp() {
1113
- const getOrResetRegExp = (existingRegExp, pattern) => {
1114
- if (existingRegExp?.source === pattern) {
1115
- existingRegExp.lastIndex = 0;
1116
- return existingRegExp;
1117
- }
1118
- return new RegExp(pattern, 'g');
1119
- };
1120
- this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
1121
- this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
1122
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
1123
- }
1124
- interpolate(str, data, lng, options) {
1125
- let match;
1126
- let value;
1127
- let replaces;
1128
- const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1129
- const handleFormat = key => {
1130
- if (key.indexOf(this.formatSeparator) < 0) {
1131
- const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
1132
- return this.alwaysFormat ? this.format(path, undefined, lng, {
1133
- ...options,
1134
- ...data,
1135
- interpolationkey: key
1136
- }) : path;
1137
- }
1138
- const p = key.split(this.formatSeparator);
1139
- const k = p.shift().trim();
1140
- const f = p.join(this.formatSeparator).trim();
1141
- return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
1142
- ...options,
1143
- ...data,
1144
- interpolationkey: k
1145
- });
1146
- };
1147
- this.resetRegExp();
1148
- const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
1149
- const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1150
- const todos = [{
1151
- regex: this.regexpUnescape,
1152
- safeValue: val => regexSafe(val)
1153
- }, {
1154
- regex: this.regexp,
1155
- safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
1156
- }];
1157
- todos.forEach(todo => {
1158
- replaces = 0;
1159
- while (match = todo.regex.exec(str)) {
1160
- const matchedVar = match[1].trim();
1161
- value = handleFormat(matchedVar);
1162
- if (value === undefined) {
1163
- if (typeof missingInterpolationHandler === 'function') {
1164
- const temp = missingInterpolationHandler(str, match, options);
1165
- value = isString(temp) ? temp : '';
1166
- } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1167
- value = '';
1168
- } else if (skipOnVariables) {
1169
- value = match[0];
1170
- continue;
1171
- } else {
1172
- this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
1173
- value = '';
1174
- }
1175
- } else if (!isString(value) && !this.useRawValueToEscape) {
1176
- value = makeString(value);
1177
- }
1178
- const safeValue = todo.safeValue(value);
1179
- str = str.replace(match[0], safeValue);
1180
- if (skipOnVariables) {
1181
- todo.regex.lastIndex += value.length;
1182
- todo.regex.lastIndex -= match[0].length;
1183
- } else {
1184
- todo.regex.lastIndex = 0;
1185
- }
1186
- replaces++;
1187
- if (replaces >= this.maxReplaces) {
1188
- break;
1189
- }
1190
- }
1191
- });
1192
- return str;
1193
- }
1194
- nest(str, fc, options = {}) {
1195
- let match;
1196
- let value;
1197
- let clonedOptions;
1198
- const handleHasOptions = (key, inheritedOptions) => {
1199
- const sep = this.nestingOptionsSeparator;
1200
- if (key.indexOf(sep) < 0) return key;
1201
- const c = key.split(new RegExp(`${sep}[ ]*{`));
1202
- let optionsString = `{${c[1]}`;
1203
- key = c[0];
1204
- optionsString = this.interpolate(optionsString, clonedOptions);
1205
- const matchedSingleQuotes = optionsString.match(/'/g);
1206
- const matchedDoubleQuotes = optionsString.match(/"/g);
1207
- if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1208
- optionsString = optionsString.replace(/'/g, '"');
1209
- }
1210
- try {
1211
- clonedOptions = JSON.parse(optionsString);
1212
- if (inheritedOptions) clonedOptions = {
1213
- ...inheritedOptions,
1214
- ...clonedOptions
1215
- };
1216
- } catch (e) {
1217
- this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
1218
- return `${key}${sep}${optionsString}`;
1219
- }
1220
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
1221
- return key;
1222
- };
1223
- while (match = this.nestingRegexp.exec(str)) {
1224
- let formatters = [];
1225
- clonedOptions = {
1226
- ...options
1227
- };
1228
- clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1229
- clonedOptions.applyPostProcessor = false;
1230
- delete clonedOptions.defaultValue;
1231
- const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf('}') + 1 : match[1].indexOf(this.formatSeparator);
1232
- if (keyEndIndex !== -1) {
1233
- formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map(elem => elem.trim()).filter(Boolean);
1234
- match[1] = match[1].slice(0, keyEndIndex);
1235
- }
1236
- value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1237
- if (value && match[0] === str && !isString(value)) return value;
1238
- if (!isString(value)) value = makeString(value);
1239
- if (!value) {
1240
- this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
1241
- value = '';
1242
- }
1243
- if (formatters.length) {
1244
- value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
1245
- ...options,
1246
- interpolationkey: match[1].trim()
1247
- }), value.trim());
1248
- }
1249
- str = str.replace(match[0], value);
1250
- this.regexp.lastIndex = 0;
1251
- }
1252
- return str;
1253
- }
1254
- }
1255
-
1256
- const parseFormatStr = formatStr => {
1257
- let formatName = formatStr.toLowerCase().trim();
1258
- const formatOptions = {};
1259
- if (formatStr.indexOf('(') > -1) {
1260
- const p = formatStr.split('(');
1261
- formatName = p[0].toLowerCase().trim();
1262
- const optStr = p[1].substring(0, p[1].length - 1);
1263
- if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1264
- if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1265
- } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
1266
- if (!formatOptions.range) formatOptions.range = optStr.trim();
1267
- } else {
1268
- const opts = optStr.split(';');
1269
- opts.forEach(opt => {
1270
- if (opt) {
1271
- const [key, ...rest] = opt.split(':');
1272
- const val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1273
- const trimmedKey = key.trim();
1274
- if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
1275
- if (val === 'false') formatOptions[trimmedKey] = false;
1276
- if (val === 'true') formatOptions[trimmedKey] = true;
1277
- if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
1278
- }
1279
- });
1280
- }
1281
- }
1282
- return {
1283
- formatName,
1284
- formatOptions
1285
- };
1286
- };
1287
- const createCachedFormatter = fn => {
1288
- const cache = {};
1289
- return (v, l, o) => {
1290
- let optForCache = o;
1291
- if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
1292
- optForCache = {
1293
- ...optForCache,
1294
- [o.interpolationkey]: undefined
1295
- };
1296
- }
1297
- const key = l + JSON.stringify(optForCache);
1298
- let frm = cache[key];
1299
- if (!frm) {
1300
- frm = fn(getCleanedCode(l), o);
1301
- cache[key] = frm;
1302
- }
1303
- return frm(v);
1304
- };
1305
- };
1306
- const createNonCachedFormatter = fn => (v, l, o) => fn(getCleanedCode(l), o)(v);
1307
- class Formatter {
1308
- constructor(options = {}) {
1309
- this.logger = baseLogger.create('formatter');
1310
- this.options = options;
1311
- this.init(options);
1312
- }
1313
- init(services, options = {
1314
- interpolation: {}
1315
- }) {
1316
- this.formatSeparator = options.interpolation.formatSeparator || ',';
1317
- const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1318
- this.formats = {
1319
- number: cf((lng, opt) => {
1320
- const formatter = new Intl.NumberFormat(lng, {
1321
- ...opt
1322
- });
1323
- return val => formatter.format(val);
1324
- }),
1325
- currency: cf((lng, opt) => {
1326
- const formatter = new Intl.NumberFormat(lng, {
1327
- ...opt,
1328
- style: 'currency'
1329
- });
1330
- return val => formatter.format(val);
1331
- }),
1332
- datetime: cf((lng, opt) => {
1333
- const formatter = new Intl.DateTimeFormat(lng, {
1334
- ...opt
1335
- });
1336
- return val => formatter.format(val);
1337
- }),
1338
- relativetime: cf((lng, opt) => {
1339
- const formatter = new Intl.RelativeTimeFormat(lng, {
1340
- ...opt
1341
- });
1342
- return val => formatter.format(val, opt.range || 'day');
1343
- }),
1344
- list: cf((lng, opt) => {
1345
- const formatter = new Intl.ListFormat(lng, {
1346
- ...opt
1347
- });
1348
- return val => formatter.format(val);
1349
- })
1350
- };
1351
- }
1352
- add(name, fc) {
1353
- this.formats[name.toLowerCase().trim()] = fc;
1354
- }
1355
- addCached(name, fc) {
1356
- this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1357
- }
1358
- format(value, format, lng, options = {}) {
1359
- const formats = format.split(this.formatSeparator);
1360
- if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
1361
- const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
1362
- formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
1363
- }
1364
- const result = formats.reduce((mem, f) => {
1365
- const {
1366
- formatName,
1367
- formatOptions
1368
- } = parseFormatStr(f);
1369
- if (this.formats[formatName]) {
1370
- let formatted = mem;
1371
- try {
1372
- const valOptions = options?.formatParams?.[options.interpolationkey] || {};
1373
- const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1374
- formatted = this.formats[formatName](mem, l, {
1375
- ...formatOptions,
1376
- ...options,
1377
- ...valOptions
1378
- });
1379
- } catch (error) {
1380
- this.logger.warn(error);
1381
- }
1382
- return formatted;
1383
- } else {
1384
- this.logger.warn(`there was no format function for ${formatName}`);
1385
- }
1386
- return mem;
1387
- }, value);
1388
- return result;
1389
- }
1390
- }
1391
-
1392
- const removePending = (q, name) => {
1393
- if (q.pending[name] !== undefined) {
1394
- delete q.pending[name];
1395
- q.pendingCount--;
1396
- }
1397
- };
1398
- class Connector extends EventEmitter {
1399
- constructor(backend, store, services, options = {}) {
1400
- super();
1401
- this.backend = backend;
1402
- this.store = store;
1403
- this.services = services;
1404
- this.languageUtils = services.languageUtils;
1405
- this.options = options;
1406
- this.logger = baseLogger.create('backendConnector');
1407
- this.waitingReads = [];
1408
- this.maxParallelReads = options.maxParallelReads || 10;
1409
- this.readingCalls = 0;
1410
- this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1411
- this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1412
- this.state = {};
1413
- this.queue = [];
1414
- this.backend?.init?.(services, options.backend, options);
1415
- }
1416
- queueLoad(languages, namespaces, options, callback) {
1417
- const toLoad = {};
1418
- const pending = {};
1419
- const toLoadLanguages = {};
1420
- const toLoadNamespaces = {};
1421
- languages.forEach(lng => {
1422
- let hasAllNamespaces = true;
1423
- namespaces.forEach(ns => {
1424
- const name = `${lng}|${ns}`;
1425
- if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
1426
- this.state[name] = 2;
1427
- } else if (this.state[name] < 0) ; else if (this.state[name] === 1) {
1428
- if (pending[name] === undefined) pending[name] = true;
1429
- } else {
1430
- this.state[name] = 1;
1431
- hasAllNamespaces = false;
1432
- if (pending[name] === undefined) pending[name] = true;
1433
- if (toLoad[name] === undefined) toLoad[name] = true;
1434
- if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
1435
- }
1436
- });
1437
- if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1438
- });
1439
- if (Object.keys(toLoad).length || Object.keys(pending).length) {
1440
- this.queue.push({
1441
- pending,
1442
- pendingCount: Object.keys(pending).length,
1443
- loaded: {},
1444
- errors: [],
1445
- callback
1446
- });
1447
- }
1448
- return {
1449
- toLoad: Object.keys(toLoad),
1450
- pending: Object.keys(pending),
1451
- toLoadLanguages: Object.keys(toLoadLanguages),
1452
- toLoadNamespaces: Object.keys(toLoadNamespaces)
1453
- };
1454
- }
1455
- loaded(name, err, data) {
1456
- const s = name.split('|');
1457
- const lng = s[0];
1458
- const ns = s[1];
1459
- if (err) this.emit('failedLoading', lng, ns, err);
1460
- if (!err && data) {
1461
- this.store.addResourceBundle(lng, ns, data, undefined, undefined, {
1462
- skipCopy: true
1463
- });
1464
- }
1465
- this.state[name] = err ? -1 : 2;
1466
- if (err && data) this.state[name] = 0;
1467
- const loaded = {};
1468
- this.queue.forEach(q => {
1469
- pushPath(q.loaded, [lng], ns);
1470
- removePending(q, name);
1471
- if (err) q.errors.push(err);
1472
- if (q.pendingCount === 0 && !q.done) {
1473
- Object.keys(q.loaded).forEach(l => {
1474
- if (!loaded[l]) loaded[l] = {};
1475
- const loadedKeys = q.loaded[l];
1476
- if (loadedKeys.length) {
1477
- loadedKeys.forEach(n => {
1478
- if (loaded[l][n] === undefined) loaded[l][n] = true;
1479
- });
1480
- }
1481
- });
1482
- q.done = true;
1483
- if (q.errors.length) {
1484
- q.callback(q.errors);
1485
- } else {
1486
- q.callback();
1487
- }
1488
- }
1489
- });
1490
- this.emit('loaded', loaded);
1491
- this.queue = this.queue.filter(q => !q.done);
1492
- }
1493
- read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1494
- if (!lng.length) return callback(null, {});
1495
- if (this.readingCalls >= this.maxParallelReads) {
1496
- this.waitingReads.push({
1497
- lng,
1498
- ns,
1499
- fcName,
1500
- tried,
1501
- wait,
1502
- callback
1503
- });
1504
- return;
1505
- }
1506
- this.readingCalls++;
1507
- const resolver = (err, data) => {
1508
- this.readingCalls--;
1509
- if (this.waitingReads.length > 0) {
1510
- const next = this.waitingReads.shift();
1511
- this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
1512
- }
1513
- if (err && data && tried < this.maxRetries) {
1514
- setTimeout(() => {
1515
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
1516
- }, wait);
1517
- return;
1518
- }
1519
- callback(err, data);
1520
- };
1521
- const fc = this.backend[fcName].bind(this.backend);
1522
- if (fc.length === 2) {
1523
- try {
1524
- const r = fc(lng, ns);
1525
- if (r && typeof r.then === 'function') {
1526
- r.then(data => resolver(null, data)).catch(resolver);
1527
- } else {
1528
- resolver(null, r);
1529
- }
1530
- } catch (err) {
1531
- resolver(err);
1532
- }
1533
- return;
1534
- }
1535
- return fc(lng, ns, resolver);
1536
- }
1537
- prepareLoading(languages, namespaces, options = {}, callback) {
1538
- if (!this.backend) {
1539
- this.logger.warn('No backend was added via i18next.use. Will not load resources.');
1540
- return callback && callback();
1541
- }
1542
- if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
1543
- if (isString(namespaces)) namespaces = [namespaces];
1544
- const toLoad = this.queueLoad(languages, namespaces, options, callback);
1545
- if (!toLoad.toLoad.length) {
1546
- if (!toLoad.pending.length) callback();
1547
- return null;
1548
- }
1549
- toLoad.toLoad.forEach(name => {
1550
- this.loadOne(name);
1551
- });
1552
- }
1553
- load(languages, namespaces, callback) {
1554
- this.prepareLoading(languages, namespaces, {}, callback);
1555
- }
1556
- reload(languages, namespaces, callback) {
1557
- this.prepareLoading(languages, namespaces, {
1558
- reload: true
1559
- }, callback);
1560
- }
1561
- loadOne(name, prefix = '') {
1562
- const s = name.split('|');
1563
- const lng = s[0];
1564
- const ns = s[1];
1565
- this.read(lng, ns, 'read', undefined, undefined, (err, data) => {
1566
- if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
1567
- if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
1568
- this.loaded(name, err, data);
1569
- });
1570
- }
1571
- saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
1572
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
1573
- this.logger.warn(`did not save key "${key}" as the namespace "${namespace}" was not yet loaded`, 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
1574
- return;
1575
- }
1576
- if (key === undefined || key === null || key === '') return;
1577
- if (this.backend?.create) {
1578
- const opts = {
1579
- ...options,
1580
- isUpdate
1581
- };
1582
- const fc = this.backend.create.bind(this.backend);
1583
- if (fc.length < 6) {
1584
- try {
1585
- let r;
1586
- if (fc.length === 5) {
1587
- r = fc(languages, namespace, key, fallbackValue, opts);
1588
- } else {
1589
- r = fc(languages, namespace, key, fallbackValue);
1590
- }
1591
- if (r && typeof r.then === 'function') {
1592
- r.then(data => clb(null, data)).catch(clb);
1593
- } else {
1594
- clb(null, r);
1595
- }
1596
- } catch (err) {
1597
- clb(err);
1598
- }
1599
- } else {
1600
- fc(languages, namespace, key, fallbackValue, clb, opts);
1601
- }
1602
- }
1603
- if (!languages || !languages[0]) return;
1604
- this.store.addResource(languages[0], namespace, key, fallbackValue);
1605
- }
1606
- }
1607
-
1608
- const get = () => ({
1609
- debug: false,
1610
- initAsync: true,
1611
- ns: ['translation'],
1612
- defaultNS: ['translation'],
1613
- fallbackLng: ['dev'],
1614
- fallbackNS: false,
1615
- supportedLngs: false,
1616
- nonExplicitSupportedLngs: false,
1617
- load: 'all',
1618
- preload: false,
1619
- simplifyPluralSuffix: true,
1620
- keySeparator: '.',
1621
- nsSeparator: ':',
1622
- pluralSeparator: '_',
1623
- contextSeparator: '_',
1624
- partialBundledLanguages: false,
1625
- saveMissing: false,
1626
- updateMissing: false,
1627
- saveMissingTo: 'fallback',
1628
- saveMissingPlurals: true,
1629
- missingKeyHandler: false,
1630
- missingInterpolationHandler: false,
1631
- postProcess: false,
1632
- postProcessPassResolved: false,
1633
- returnNull: false,
1634
- returnEmptyString: true,
1635
- returnObjects: false,
1636
- joinArrays: false,
1637
- returnedObjectHandler: false,
1638
- parseMissingKeyHandler: false,
1639
- appendNamespaceToMissingKey: false,
1640
- appendNamespaceToCIMode: false,
1641
- overloadTranslationOptionHandler: args => {
1642
- let ret = {};
1643
- if (typeof args[1] === 'object') ret = args[1];
1644
- if (isString(args[1])) ret.defaultValue = args[1];
1645
- if (isString(args[2])) ret.tDescription = args[2];
1646
- if (typeof args[2] === 'object' || typeof args[3] === 'object') {
1647
- const options = args[3] || args[2];
1648
- Object.keys(options).forEach(key => {
1649
- ret[key] = options[key];
1650
- });
1651
- }
1652
- return ret;
1653
- },
1654
- interpolation: {
1655
- escapeValue: true,
1656
- format: value => value,
1657
- prefix: '{{',
1658
- suffix: '}}',
1659
- formatSeparator: ',',
1660
- unescapePrefix: '-',
1661
- nestingPrefix: '$t(',
1662
- nestingSuffix: ')',
1663
- nestingOptionsSeparator: ',',
1664
- maxReplaces: 1000,
1665
- skipOnVariables: true
1666
- },
1667
- cacheInBuiltFormats: true
1668
- });
1669
- const transformOptions = options => {
1670
- if (isString(options.ns)) options.ns = [options.ns];
1671
- if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
1672
- if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
1673
- if (options.supportedLngs?.indexOf?.('cimode') < 0) {
1674
- options.supportedLngs = options.supportedLngs.concat(['cimode']);
1675
- }
1676
- if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
1677
- return options;
1678
- };
1679
-
1680
- const noop = () => {};
1681
- const bindMemberFunctions = inst => {
1682
- const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
1683
- mems.forEach(mem => {
1684
- if (typeof inst[mem] === 'function') {
1685
- inst[mem] = inst[mem].bind(inst);
1686
- }
1687
- });
1688
- };
1689
- class I18n extends EventEmitter {
1690
- constructor(options = {}, callback) {
1691
- super();
1692
- this.options = transformOptions(options);
1693
- this.services = {};
1694
- this.logger = baseLogger;
1695
- this.modules = {
1696
- external: []
1697
- };
1698
- bindMemberFunctions(this);
1699
- if (callback && !this.isInitialized && !options.isClone) {
1700
- if (!this.options.initAsync) {
1701
- this.init(options, callback);
1702
- return this;
1703
- }
1704
- setTimeout(() => {
1705
- this.init(options, callback);
1706
- }, 0);
1707
- }
1708
- }
1709
- init(options = {}, callback) {
1710
- this.isInitializing = true;
1711
- if (typeof options === 'function') {
1712
- callback = options;
1713
- options = {};
1714
- }
1715
- if (options.defaultNS == null && options.ns) {
1716
- if (isString(options.ns)) {
1717
- options.defaultNS = options.ns;
1718
- } else if (options.ns.indexOf('translation') < 0) {
1719
- options.defaultNS = options.ns[0];
1720
- }
1721
- }
1722
- const defOpts = get();
1723
- this.options = {
1724
- ...defOpts,
1725
- ...this.options,
1726
- ...transformOptions(options)
1727
- };
1728
- this.options.interpolation = {
1729
- ...defOpts.interpolation,
1730
- ...this.options.interpolation
1731
- };
1732
- if (options.keySeparator !== undefined) {
1733
- this.options.userDefinedKeySeparator = options.keySeparator;
1734
- }
1735
- if (options.nsSeparator !== undefined) {
1736
- this.options.userDefinedNsSeparator = options.nsSeparator;
1737
- }
1738
- const createClassOnDemand = ClassOrObject => {
1739
- if (!ClassOrObject) return null;
1740
- if (typeof ClassOrObject === 'function') return new ClassOrObject();
1741
- return ClassOrObject;
1742
- };
1743
- if (!this.options.isClone) {
1744
- if (this.modules.logger) {
1745
- baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
1746
- } else {
1747
- baseLogger.init(null, this.options);
1748
- }
1749
- let formatter;
1750
- if (this.modules.formatter) {
1751
- formatter = this.modules.formatter;
1752
- } else {
1753
- formatter = Formatter;
1754
- }
1755
- const lu = new LanguageUtil(this.options);
1756
- this.store = new ResourceStore(this.options.resources, this.options);
1757
- const s = this.services;
1758
- s.logger = baseLogger;
1759
- s.resourceStore = this.store;
1760
- s.languageUtils = lu;
1761
- s.pluralResolver = new PluralResolver(lu, {
1762
- prepend: this.options.pluralSeparator,
1763
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1764
- });
1765
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
1766
- if (usingLegacyFormatFunction) {
1767
- this.logger.warn(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1768
- }
1769
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1770
- s.formatter = createClassOnDemand(formatter);
1771
- if (s.formatter.init) s.formatter.init(s, this.options);
1772
- this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1773
- }
1774
- s.interpolator = new Interpolator(this.options);
1775
- s.utils = {
1776
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1777
- };
1778
- s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1779
- s.backendConnector.on('*', (event, ...args) => {
1780
- this.emit(event, ...args);
1781
- });
1782
- if (this.modules.languageDetector) {
1783
- s.languageDetector = createClassOnDemand(this.modules.languageDetector);
1784
- if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
1785
- }
1786
- if (this.modules.i18nFormat) {
1787
- s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
1788
- if (s.i18nFormat.init) s.i18nFormat.init(this);
1789
- }
1790
- this.translator = new Translator(this.services, this.options);
1791
- this.translator.on('*', (event, ...args) => {
1792
- this.emit(event, ...args);
1793
- });
1794
- this.modules.external.forEach(m => {
1795
- if (m.init) m.init(this);
1796
- });
1797
- }
1798
- this.format = this.options.interpolation.format;
1799
- if (!callback) callback = noop;
1800
- if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1801
- const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1802
- if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
1803
- }
1804
- if (!this.services.languageDetector && !this.options.lng) {
1805
- this.logger.warn('init: no languageDetector is used and no lng is defined');
1806
- }
1807
- const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
1808
- storeApi.forEach(fcName => {
1809
- this[fcName] = (...args) => this.store[fcName](...args);
1810
- });
1811
- const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
1812
- storeApiChained.forEach(fcName => {
1813
- this[fcName] = (...args) => {
1814
- this.store[fcName](...args);
1815
- return this;
1816
- };
1817
- });
1818
- const deferred = defer();
1819
- const load = () => {
1820
- const finish = (err, t) => {
1821
- this.isInitializing = false;
1822
- if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');
1823
- this.isInitialized = true;
1824
- if (!this.options.isClone) this.logger.log('initialized', this.options);
1825
- this.emit('initialized', this.options);
1826
- deferred.resolve(t);
1827
- callback(err, t);
1828
- };
1829
- if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
1830
- this.changeLanguage(this.options.lng, finish);
1831
- };
1832
- if (this.options.resources || !this.options.initAsync) {
1833
- load();
1834
- } else {
1835
- setTimeout(load, 0);
1836
- }
1837
- return deferred;
1838
- }
1839
- loadResources(language, callback = noop) {
1840
- let usedCallback = callback;
1841
- const usedLng = isString(language) ? language : this.language;
1842
- if (typeof language === 'function') usedCallback = language;
1843
- if (!this.options.resources || this.options.partialBundledLanguages) {
1844
- if (usedLng?.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
1845
- const toLoad = [];
1846
- const append = lng => {
1847
- if (!lng) return;
1848
- if (lng === 'cimode') return;
1849
- const lngs = this.services.languageUtils.toResolveHierarchy(lng);
1850
- lngs.forEach(l => {
1851
- if (l === 'cimode') return;
1852
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
1853
- });
1854
- };
1855
- if (!usedLng) {
1856
- const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1857
- fallbacks.forEach(l => append(l));
1858
- } else {
1859
- append(usedLng);
1860
- }
1861
- this.options.preload?.forEach?.(l => append(l));
1862
- this.services.backendConnector.load(toLoad, this.options.ns, e => {
1863
- if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
1864
- usedCallback(e);
1865
- });
1866
- } else {
1867
- usedCallback(null);
1868
- }
1869
- }
1870
- reloadResources(lngs, ns, callback) {
1871
- const deferred = defer();
1872
- if (typeof lngs === 'function') {
1873
- callback = lngs;
1874
- lngs = undefined;
1875
- }
1876
- if (typeof ns === 'function') {
1877
- callback = ns;
1878
- ns = undefined;
1879
- }
1880
- if (!lngs) lngs = this.languages;
1881
- if (!ns) ns = this.options.ns;
1882
- if (!callback) callback = noop;
1883
- this.services.backendConnector.reload(lngs, ns, err => {
1884
- deferred.resolve();
1885
- callback(err);
1886
- });
1887
- return deferred;
1888
- }
1889
- use(module) {
1890
- if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
1891
- if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
1892
- if (module.type === 'backend') {
1893
- this.modules.backend = module;
1894
- }
1895
- if (module.type === 'logger' || module.log && module.warn && module.error) {
1896
- this.modules.logger = module;
1897
- }
1898
- if (module.type === 'languageDetector') {
1899
- this.modules.languageDetector = module;
1900
- }
1901
- if (module.type === 'i18nFormat') {
1902
- this.modules.i18nFormat = module;
1903
- }
1904
- if (module.type === 'postProcessor') {
1905
- postProcessor.addPostProcessor(module);
1906
- }
1907
- if (module.type === 'formatter') {
1908
- this.modules.formatter = module;
1909
- }
1910
- if (module.type === '3rdParty') {
1911
- this.modules.external.push(module);
1912
- }
1913
- return this;
1914
- }
1915
- setResolvedLanguage(l) {
1916
- if (!l || !this.languages) return;
1917
- if (['cimode', 'dev'].indexOf(l) > -1) return;
1918
- for (let li = 0; li < this.languages.length; li++) {
1919
- const lngInLngs = this.languages[li];
1920
- if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
1921
- if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
1922
- this.resolvedLanguage = lngInLngs;
1923
- break;
1924
- }
1925
- }
1926
- if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
1927
- this.resolvedLanguage = l;
1928
- this.languages.unshift(l);
1929
- }
1930
- }
1931
- changeLanguage(lng, callback) {
1932
- this.isLanguageChangingTo = lng;
1933
- const deferred = defer();
1934
- this.emit('languageChanging', lng);
1935
- const setLngProps = l => {
1936
- this.language = l;
1937
- this.languages = this.services.languageUtils.toResolveHierarchy(l);
1938
- this.resolvedLanguage = undefined;
1939
- this.setResolvedLanguage(l);
1940
- };
1941
- const done = (err, l) => {
1942
- if (l) {
1943
- if (this.isLanguageChangingTo === lng) {
1944
- setLngProps(l);
1945
- this.translator.changeLanguage(l);
1946
- this.isLanguageChangingTo = undefined;
1947
- this.emit('languageChanged', l);
1948
- this.logger.log('languageChanged', l);
1949
- }
1950
- } else {
1951
- this.isLanguageChangingTo = undefined;
1952
- }
1953
- deferred.resolve((...args) => this.t(...args));
1954
- if (callback) callback(err, (...args) => this.t(...args));
1955
- };
1956
- const setLng = lngs => {
1957
- if (!lng && !lngs && this.services.languageDetector) lngs = [];
1958
- const fl = isString(lngs) ? lngs : lngs && lngs[0];
1959
- const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
1960
- if (l) {
1961
- if (!this.language) {
1962
- setLngProps(l);
1963
- }
1964
- if (!this.translator.language) this.translator.changeLanguage(l);
1965
- this.services.languageDetector?.cacheUserLanguage?.(l);
1966
- }
1967
- this.loadResources(l, err => {
1968
- done(err, l);
1969
- });
1970
- };
1971
- if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
1972
- setLng(this.services.languageDetector.detect());
1973
- } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
1974
- if (this.services.languageDetector.detect.length === 0) {
1975
- this.services.languageDetector.detect().then(setLng);
1976
- } else {
1977
- this.services.languageDetector.detect(setLng);
1978
- }
1979
- } else {
1980
- setLng(lng);
1981
- }
1982
- return deferred;
1983
- }
1984
- getFixedT(lng, ns, keyPrefix) {
1985
- const fixedT = (key, opts, ...rest) => {
1986
- let o;
1987
- if (typeof opts !== 'object') {
1988
- o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
1989
- } else {
1990
- o = {
1991
- ...opts
1992
- };
1993
- }
1994
- o.lng = o.lng || fixedT.lng;
1995
- o.lngs = o.lngs || fixedT.lngs;
1996
- o.ns = o.ns || fixedT.ns;
1997
- if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
1998
- const keySeparator = this.options.keySeparator || '.';
1999
- let resultKey;
2000
- if (o.keyPrefix && Array.isArray(key)) {
2001
- resultKey = key.map(k => `${o.keyPrefix}${keySeparator}${k}`);
2002
- } else {
2003
- resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
2004
- }
2005
- return this.t(resultKey, o);
2006
- };
2007
- if (isString(lng)) {
2008
- fixedT.lng = lng;
2009
- } else {
2010
- fixedT.lngs = lng;
2011
- }
2012
- fixedT.ns = ns;
2013
- fixedT.keyPrefix = keyPrefix;
2014
- return fixedT;
2015
- }
2016
- t(...args) {
2017
- return this.translator?.translate(...args);
2018
- }
2019
- exists(...args) {
2020
- return this.translator?.exists(...args);
2021
- }
2022
- setDefaultNamespace(ns) {
2023
- this.options.defaultNS = ns;
2024
- }
2025
- hasLoadedNamespace(ns, options = {}) {
2026
- if (!this.isInitialized) {
2027
- this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2028
- return false;
2029
- }
2030
- if (!this.languages || !this.languages.length) {
2031
- this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2032
- return false;
2033
- }
2034
- const lng = options.lng || this.resolvedLanguage || this.languages[0];
2035
- const fallbackLng = this.options ? this.options.fallbackLng : false;
2036
- const lastLng = this.languages[this.languages.length - 1];
2037
- if (lng.toLowerCase() === 'cimode') return true;
2038
- const loadNotPending = (l, n) => {
2039
- const loadState = this.services.backendConnector.state[`${l}|${n}`];
2040
- return loadState === -1 || loadState === 0 || loadState === 2;
2041
- };
2042
- if (options.precheck) {
2043
- const preResult = options.precheck(this, loadNotPending);
2044
- if (preResult !== undefined) return preResult;
2045
- }
2046
- if (this.hasResourceBundle(lng, ns)) return true;
2047
- if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2048
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
2049
- return false;
2050
- }
2051
- loadNamespaces(ns, callback) {
2052
- const deferred = defer();
2053
- if (!this.options.ns) {
2054
- if (callback) callback();
2055
- return Promise.resolve();
2056
- }
2057
- if (isString(ns)) ns = [ns];
2058
- ns.forEach(n => {
2059
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
2060
- });
2061
- this.loadResources(err => {
2062
- deferred.resolve();
2063
- if (callback) callback(err);
2064
- });
2065
- return deferred;
2066
- }
2067
- loadLanguages(lngs, callback) {
2068
- const deferred = defer();
2069
- if (isString(lngs)) lngs = [lngs];
2070
- const preloaded = this.options.preload || [];
2071
- const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
2072
- if (!newLngs.length) {
2073
- if (callback) callback();
2074
- return Promise.resolve();
2075
- }
2076
- this.options.preload = preloaded.concat(newLngs);
2077
- this.loadResources(err => {
2078
- deferred.resolve();
2079
- if (callback) callback(err);
2080
- });
2081
- return deferred;
2082
- }
2083
- dir(lng) {
2084
- if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
2085
- if (!lng) return 'rtl';
2086
- try {
2087
- const l = new Intl.Locale(lng);
2088
- if (l && l.getTextInfo) {
2089
- const ti = l.getTextInfo();
2090
- if (ti && ti.direction) return ti.direction;
2091
- }
2092
- } catch (e) {}
2093
- const rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
2094
- const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
2095
- if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
2096
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2097
- }
2098
- static createInstance(options = {}, callback) {
2099
- return new I18n(options, callback);
2100
- }
2101
- cloneInstance(options = {}, callback = noop) {
2102
- const forkResourceStore = options.forkResourceStore;
2103
- if (forkResourceStore) delete options.forkResourceStore;
2104
- const mergedOptions = {
2105
- ...this.options,
2106
- ...options,
2107
- ...{
2108
- isClone: true
2109
- }
2110
- };
2111
- const clone = new I18n(mergedOptions);
2112
- if (options.debug !== undefined || options.prefix !== undefined) {
2113
- clone.logger = clone.logger.clone(options);
2114
- }
2115
- const membersToCopy = ['store', 'services', 'language'];
2116
- membersToCopy.forEach(m => {
2117
- clone[m] = this[m];
2118
- });
2119
- clone.services = {
2120
- ...this.services
2121
- };
2122
- clone.services.utils = {
2123
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2124
- };
2125
- if (forkResourceStore) {
2126
- const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
2127
- prev[l] = {
2128
- ...this.store.data[l]
2129
- };
2130
- prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2131
- acc[n] = {
2132
- ...prev[l][n]
2133
- };
2134
- return acc;
2135
- }, prev[l]);
2136
- return prev;
2137
- }, {});
2138
- clone.store = new ResourceStore(clonedData, mergedOptions);
2139
- clone.services.resourceStore = clone.store;
2140
- }
2141
- clone.translator = new Translator(clone.services, mergedOptions);
2142
- clone.translator.on('*', (event, ...args) => {
2143
- clone.emit(event, ...args);
2144
- });
2145
- clone.init(mergedOptions, callback);
2146
- clone.translator.options = mergedOptions;
2147
- clone.translator.backendConnector.services.utils = {
2148
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2149
- };
2150
- return clone;
2151
- }
2152
- toJSON() {
2153
- return {
2154
- options: this.options,
2155
- store: this.store,
2156
- language: this.language,
2157
- languages: this.languages,
2158
- resolvedLanguage: this.resolvedLanguage
2159
- };
2160
- }
2161
- }
2162
- const instance = I18n.createInstance();
2163
- instance.createInstance = I18n.createInstance;
2164
-
2165
- function getWindow() {
2166
- return window;
2167
- }
2168
- function getAtomicEnvironment(headlessVersion) {
2169
- return {
2170
- version: "3.34.0-pre.ebcb0fe404",
2171
- headlessVersion,
2172
- };
2173
- }
2174
- function getAtomicVersion() {
2175
- return getAtomicEnvironment('').version;
2176
- }
2177
- function setCoveoGlobal(globalVariableName, headlessVersion) {
2178
- if (getWindow()[globalVariableName]) {
2179
- return;
2180
- }
2181
- getWindow()[globalVariableName] = getAtomicEnvironment(headlessVersion);
2182
- }
2183
-
2184
- const locales = {
2185
- af: () => Promise.resolve().then(function () { return require('./af-3cb14af3.js'); }).then(function (n) { return n.af; }),
2186
- am: () => Promise.resolve().then(function () { return require('./am-510642ea.js'); }).then(function (n) { return n.am; }),
2187
- 'ar-DZ': () => Promise.resolve().then(function () { return require('./ar-dz-9f84b9ec.js'); }).then(function (n) { return n.arDz; }),
2188
- 'ar-IQ': () => Promise.resolve().then(function () { return require('./ar-iq-82749a7b.js'); }).then(function (n) { return n.arIq; }),
2189
- 'ar-KW': () => Promise.resolve().then(function () { return require('./ar-kw-e6d3ff65.js'); }).then(function (n) { return n.arKw; }),
2190
- 'ar-LY': () => Promise.resolve().then(function () { return require('./ar-ly-4b4d7e0e.js'); }).then(function (n) { return n.arLy; }),
2191
- 'ar-MA': () => Promise.resolve().then(function () { return require('./ar-ma-29c6bdb4.js'); }).then(function (n) { return n.arMa; }),
2192
- 'ar-SA': () => Promise.resolve().then(function () { return require('./ar-sa-c224f9a4.js'); }).then(function (n) { return n.arSa; }),
2193
- 'ar-TN': () => Promise.resolve().then(function () { return require('./ar-tn-c1ce01e3.js'); }).then(function (n) { return n.arTn; }),
2194
- ar: () => Promise.resolve().then(function () { return require('./ar-86e1aad6.js'); }).then(function (n) { return n.ar; }),
2195
- az: () => Promise.resolve().then(function () { return require('./az-7bcdad3d.js'); }).then(function (n) { return n.az; }),
2196
- be: () => Promise.resolve().then(function () { return require('./be-9da1ff48.js'); }).then(function (n) { return n.be; }),
2197
- bg: () => Promise.resolve().then(function () { return require('./bg-1780c400.js'); }).then(function (n) { return n.bg; }),
2198
- bi: () => Promise.resolve().then(function () { return require('./bi-63811d4b.js'); }).then(function (n) { return n.bi; }),
2199
- bm: () => Promise.resolve().then(function () { return require('./bm-11d33058.js'); }).then(function (n) { return n.bm; }),
2200
- 'bn-BD': () => Promise.resolve().then(function () { return require('./bn-bd-4acb433e.js'); }).then(function (n) { return n.bnBd; }),
2201
- bn: () => Promise.resolve().then(function () { return require('./bn-2cff4366.js'); }).then(function (n) { return n.bn; }),
2202
- bo: () => Promise.resolve().then(function () { return require('./bo-bd8d86ce.js'); }).then(function (n) { return n.bo; }),
2203
- br: () => Promise.resolve().then(function () { return require('./br-ecbedea3.js'); }).then(function (n) { return n.br; }),
2204
- bs: () => Promise.resolve().then(function () { return require('./bs-c81d4a45.js'); }).then(function (n) { return n.bs; }),
2205
- ca: () => Promise.resolve().then(function () { return require('./ca-4c562cd2.js'); }).then(function (n) { return n.ca; }),
2206
- cs: () => Promise.resolve().then(function () { return require('./cs-c31a9767.js'); }).then(function (n) { return n.cs; }),
2207
- cv: () => Promise.resolve().then(function () { return require('./cv-60097186.js'); }).then(function (n) { return n.cv; }),
2208
- cy: () => Promise.resolve().then(function () { return require('./cy-1e7cc646.js'); }).then(function (n) { return n.cy; }),
2209
- 'de-AT': () => Promise.resolve().then(function () { return require('./de-at-153c9ef4.js'); }).then(function (n) { return n.deAt; }),
2210
- da: () => Promise.resolve().then(function () { return require('./da-eb7eb148.js'); }).then(function (n) { return n.da; }),
2211
- 'de-CH': () => Promise.resolve().then(function () { return require('./de-ch-2876802d.js'); }).then(function (n) { return n.deCh; }),
2212
- de: () => Promise.resolve().then(function () { return require('./de-ecdc4de7.js'); }).then(function (n) { return n.de; }),
2213
- dv: () => Promise.resolve().then(function () { return require('./dv-9ed5298e.js'); }).then(function (n) { return n.dv; }),
2214
- el: () => Promise.resolve().then(function () { return require('./el-554a10d4.js'); }).then(function (n) { return n.el; }),
2215
- 'en-AU': () => Promise.resolve().then(function () { return require('./en-au-ae506a50.js'); }).then(function (n) { return n.enAu; }),
2216
- 'en-CA': () => Promise.resolve().then(function () { return require('./en-ca-77cff63e.js'); }).then(function (n) { return n.enCa; }),
2217
- 'en-GB': () => Promise.resolve().then(function () { return require('./en-gb-839656cd.js'); }).then(function (n) { return n.enGb; }),
2218
- 'en-IE': () => Promise.resolve().then(function () { return require('./en-ie-a6e4b063.js'); }).then(function (n) { return n.enIe; }),
2219
- 'en-IL': () => Promise.resolve().then(function () { return require('./en-il-b7fe83df.js'); }).then(function (n) { return n.enIl; }),
2220
- 'en-IN': () => Promise.resolve().then(function () { return require('./en-in-c75ae3bb.js'); }).then(function (n) { return n.enIn; }),
2221
- 'en-NZ': () => Promise.resolve().then(function () { return require('./en-nz-beb1260b.js'); }).then(function (n) { return n.enNz; }),
2222
- 'en-SG': () => Promise.resolve().then(function () { return require('./en-sg-711fb5a9.js'); }).then(function (n) { return n.enSg; }),
2223
- 'en-TT': () => Promise.resolve().then(function () { return require('./en-tt-6df63ce2.js'); }).then(function (n) { return n.enTt; }),
2224
- eo: () => Promise.resolve().then(function () { return require('./eo-cf619487.js'); }).then(function (n) { return n.eo; }),
2225
- en: () => Promise.resolve().then(function () { return require('./en-d5fc11ea.js'); }).then(function (n) { return n.en; }),
2226
- 'es-DO': () => Promise.resolve().then(function () { return require('./es-do-da7561fe.js'); }).then(function (n) { return n.esDo; }),
2227
- 'es-MX': () => Promise.resolve().then(function () { return require('./es-mx-b86c5ced.js'); }).then(function (n) { return n.esMx; }),
2228
- 'es-PR': () => Promise.resolve().then(function () { return require('./es-pr-c64c4b1f.js'); }).then(function (n) { return n.esPr; }),
2229
- 'es-US': () => Promise.resolve().then(function () { return require('./es-us-eafcfe70.js'); }).then(function (n) { return n.esUs; }),
2230
- et: () => Promise.resolve().then(function () { return require('./et-2014946e.js'); }).then(function (n) { return n.et; }),
2231
- es: () => Promise.resolve().then(function () { return require('./es-ec9ef939.js'); }).then(function (n) { return n.es; }),
2232
- eu: () => Promise.resolve().then(function () { return require('./eu-2704a941.js'); }).then(function (n) { return n.eu; }),
2233
- fa: () => Promise.resolve().then(function () { return require('./fa-b4ce0828.js'); }).then(function (n) { return n.fa; }),
2234
- fo: () => Promise.resolve().then(function () { return require('./fo-847a4b87.js'); }).then(function (n) { return n.fo; }),
2235
- fi: () => Promise.resolve().then(function () { return require('./fi-418b62b3.js'); }).then(function (n) { return n.fi; }),
2236
- 'fr-CA': () => Promise.resolve().then(function () { return require('./fr-ca-683eb84d.js'); }).then(function (n) { return n.frCa; }),
2237
- 'fr-CH': () => Promise.resolve().then(function () { return require('./fr-ch-64ad6883.js'); }).then(function (n) { return n.frCh; }),
2238
- fr: () => Promise.resolve().then(function () { return require('./fr-02ad9e84.js'); }).then(function (n) { return n.fr; }),
2239
- fy: () => Promise.resolve().then(function () { return require('./fy-2bbc1932.js'); }).then(function (n) { return n.fy; }),
2240
- ga: () => Promise.resolve().then(function () { return require('./ga-7a270266.js'); }).then(function (n) { return n.ga; }),
2241
- gd: () => Promise.resolve().then(function () { return require('./gd-baafa243.js'); }).then(function (n) { return n.gd; }),
2242
- 'gom-LATN': () => Promise.resolve().then(function () { return require('./gom-latn-e8f97b3c.js'); }).then(function (n) { return n.gomLatn; }),
2243
- gl: () => Promise.resolve().then(function () { return require('./gl-7386ddb5.js'); }).then(function (n) { return n.gl; }),
2244
- gu: () => Promise.resolve().then(function () { return require('./gu-7effa611.js'); }).then(function (n) { return n.gu; }),
2245
- he: () => Promise.resolve().then(function () { return require('./he-f1c0bf01.js'); }).then(function (n) { return n.he; }),
2246
- hi: () => Promise.resolve().then(function () { return require('./hi-b27c247c.js'); }).then(function (n) { return n.hi; }),
2247
- hr: () => Promise.resolve().then(function () { return require('./hr-2a5465eb.js'); }).then(function (n) { return n.hr; }),
2248
- hu: () => Promise.resolve().then(function () { return require('./hu-b67baba1.js'); }).then(function (n) { return n.hu; }),
2249
- ht: () => Promise.resolve().then(function () { return require('./ht-95dbca9a.js'); }).then(function (n) { return n.ht; }),
2250
- 'hy-AM': () => Promise.resolve().then(function () { return require('./hy-am-1056024b.js'); }).then(function (n) { return n.hyAm; }),
2251
- id: () => Promise.resolve().then(function () { return require('./id-8d9d1934.js'); }).then(function (n) { return n.id; }),
2252
- is: () => Promise.resolve().then(function () { return require('./is-f2bfcd99.js'); }).then(function (n) { return n.is; }),
2253
- 'it-CH': () => Promise.resolve().then(function () { return require('./it-ch-aae915b1.js'); }).then(function (n) { return n.itCh; }),
2254
- it: () => Promise.resolve().then(function () { return require('./it-35cc21b8.js'); }).then(function (n) { return n.it; }),
2255
- ja: () => Promise.resolve().then(function () { return require('./ja-7bb6e892.js'); }).then(function (n) { return n.ja; }),
2256
- jv: () => Promise.resolve().then(function () { return require('./jv-9cde1ffe.js'); }).then(function (n) { return n.jv; }),
2257
- ka: () => Promise.resolve().then(function () { return require('./ka-7f526005.js'); }).then(function (n) { return n.ka; }),
2258
- kk: () => Promise.resolve().then(function () { return require('./kk-a594eeaa.js'); }).then(function (n) { return n.kk; }),
2259
- km: () => Promise.resolve().then(function () { return require('./km-5f37f151.js'); }).then(function (n) { return n.km; }),
2260
- kn: () => Promise.resolve().then(function () { return require('./kn-84a55197.js'); }).then(function (n) { return n.kn; }),
2261
- ko: () => Promise.resolve().then(function () { return require('./ko-d261b948.js'); }).then(function (n) { return n.ko; }),
2262
- ku: () => Promise.resolve().then(function () { return require('./ku-b2336eec.js'); }).then(function (n) { return n.ku; }),
2263
- ky: () => Promise.resolve().then(function () { return require('./ky-763fe4c8.js'); }).then(function (n) { return n.ky; }),
2264
- lb: () => Promise.resolve().then(function () { return require('./lb-6ca5b888.js'); }).then(function (n) { return n.lb; }),
2265
- lo: () => Promise.resolve().then(function () { return require('./lo-9bc2e80e.js'); }).then(function (n) { return n.lo; }),
2266
- lt: () => Promise.resolve().then(function () { return require('./lt-5f2d24f6.js'); }).then(function (n) { return n.lt; }),
2267
- lv: () => Promise.resolve().then(function () { return require('./lv-d556d12c.js'); }).then(function (n) { return n.lv; }),
2268
- me: () => Promise.resolve().then(function () { return require('./me-df56afb1.js'); }).then(function (n) { return n.me; }),
2269
- mi: () => Promise.resolve().then(function () { return require('./mi-f0b520a2.js'); }).then(function (n) { return n.mi; }),
2270
- mk: () => Promise.resolve().then(function () { return require('./mk-3187bb9b.js'); }).then(function (n) { return n.mk; }),
2271
- ml: () => Promise.resolve().then(function () { return require('./ml-260d4b1c.js'); }).then(function (n) { return n.ml; }),
2272
- mn: () => Promise.resolve().then(function () { return require('./mn-e636b053.js'); }).then(function (n) { return n.mn; }),
2273
- mr: () => Promise.resolve().then(function () { return require('./mr-d7ab5382.js'); }).then(function (n) { return n.mr; }),
2274
- 'ms-MY': () => Promise.resolve().then(function () { return require('./ms-my-c78cdffc.js'); }).then(function (n) { return n.msMy; }),
2275
- ms: () => Promise.resolve().then(function () { return require('./ms-ad12de06.js'); }).then(function (n) { return n.ms; }),
2276
- mt: () => Promise.resolve().then(function () { return require('./mt-51cb46e8.js'); }).then(function (n) { return n.mt; }),
2277
- my: () => Promise.resolve().then(function () { return require('./my-15440c7b.js'); }).then(function (n) { return n.my; }),
2278
- nb: () => Promise.resolve().then(function () { return require('./nb-88f0d23f.js'); }).then(function (n) { return n.nb; }),
2279
- ne: () => Promise.resolve().then(function () { return require('./ne-25d07cb0.js'); }).then(function (n) { return n.ne; }),
2280
- 'nl-BE': () => Promise.resolve().then(function () { return require('./nl-be-71bdf208.js'); }).then(function (n) { return n.nlBe; }),
2281
- nl: () => Promise.resolve().then(function () { return require('./nl-823d03bb.js'); }).then(function (n) { return n.nl; }),
2282
- pl: () => Promise.resolve().then(function () { return require('./pl-7b9e540b.js'); }).then(function (n) { return n.pl; }),
2283
- 'pt-BR': () => Promise.resolve().then(function () { return require('./pt-br-50134f1a.js'); }).then(function (n) { return n.ptBr; }),
2284
- pt: () => Promise.resolve().then(function () { return require('./pt-94c03016.js'); }).then(function (n) { return n.pt; }),
2285
- rn: () => Promise.resolve().then(function () { return require('./rn-bbc51301.js'); }).then(function (n) { return n.rn; }),
2286
- ro: () => Promise.resolve().then(function () { return require('./ro-6513dd0a.js'); }).then(function (n) { return n.ro; }),
2287
- ru: () => Promise.resolve().then(function () { return require('./ru-8cedefa3.js'); }).then(function (n) { return n.ru; }),
2288
- rw: () => Promise.resolve().then(function () { return require('./rw-20d11af0.js'); }).then(function (n) { return n.rw; }),
2289
- sd: () => Promise.resolve().then(function () { return require('./sd-56538a3c.js'); }).then(function (n) { return n.sd; }),
2290
- se: () => Promise.resolve().then(function () { return require('./se-e97faaf3.js'); }).then(function (n) { return n.se; }),
2291
- si: () => Promise.resolve().then(function () { return require('./si-f07356e4.js'); }).then(function (n) { return n.si; }),
2292
- sk: () => Promise.resolve().then(function () { return require('./sk-afb11dce.js'); }).then(function (n) { return n.sk; }),
2293
- sl: () => Promise.resolve().then(function () { return require('./sl-78defe5b.js'); }).then(function (n) { return n.sl; }),
2294
- sq: () => Promise.resolve().then(function () { return require('./sq-e0f08a12.js'); }).then(function (n) { return n.sq; }),
2295
- 'sr-CYRL': () => Promise.resolve().then(function () { return require('./sr-cyrl-21f60f73.js'); }).then(function (n) { return n.srCyrl; }),
2296
- ss: () => Promise.resolve().then(function () { return require('./ss-91e94d39.js'); }).then(function (n) { return n.ss; }),
2297
- 'sv-FI': () => Promise.resolve().then(function () { return require('./sv-fi-6958e268.js'); }).then(function (n) { return n.svFi; }),
2298
- sr: () => Promise.resolve().then(function () { return require('./sr-97a3e823.js'); }).then(function (n) { return n.sr; }),
2299
- sv: () => Promise.resolve().then(function () { return require('./sv-55b70625.js'); }).then(function (n) { return n.sv; }),
2300
- sw: () => Promise.resolve().then(function () { return require('./sw-dfa19fe5.js'); }).then(function (n) { return n.sw; }),
2301
- ta: () => Promise.resolve().then(function () { return require('./ta-32d249cc.js'); }).then(function (n) { return n.ta; }),
2302
- te: () => Promise.resolve().then(function () { return require('./te-6f7364a2.js'); }).then(function (n) { return n.te; }),
2303
- tet: () => Promise.resolve().then(function () { return require('./tet-3765fd11.js'); }).then(function (n) { return n.tet; }),
2304
- tg: () => Promise.resolve().then(function () { return require('./tg-3810a776.js'); }).then(function (n) { return n.tg; }),
2305
- th: () => Promise.resolve().then(function () { return require('./th-044656c6.js'); }).then(function (n) { return n.th; }),
2306
- tk: () => Promise.resolve().then(function () { return require('./tk-62196c48.js'); }).then(function (n) { return n.tk; }),
2307
- 'tl-PH': () => Promise.resolve().then(function () { return require('./tl-ph-427b3456.js'); }).then(function (n) { return n.tlPh; }),
2308
- tlh: () => Promise.resolve().then(function () { return require('./tlh-713bea77.js'); }).then(function (n) { return n.tlh; }),
2309
- tr: () => Promise.resolve().then(function () { return require('./tr-ba983dc9.js'); }).then(function (n) { return n.tr; }),
2310
- tzl: () => Promise.resolve().then(function () { return require('./tzl-8161bdec.js'); }).then(function (n) { return n.tzl; }),
2311
- 'tzm-LATN': () => Promise.resolve().then(function () { return require('./tzm-latn-091fa71f.js'); }).then(function (n) { return n.tzmLatn; }),
2312
- tzm: () => Promise.resolve().then(function () { return require('./tzm-ade56748.js'); }).then(function (n) { return n.tzm; }),
2313
- 'ug-CN': () => Promise.resolve().then(function () { return require('./ug-cn-182958d3.js'); }).then(function (n) { return n.ugCn; }),
2314
- uk: () => Promise.resolve().then(function () { return require('./uk-7158ef87.js'); }).then(function (n) { return n.uk; }),
2315
- ur: () => Promise.resolve().then(function () { return require('./ur-7feb599f.js'); }).then(function (n) { return n.ur; }),
2316
- 'uz-LATN': () => Promise.resolve().then(function () { return require('./uz-latn-b800ffa4.js'); }).then(function (n) { return n.uzLatn; }),
2317
- uz: () => Promise.resolve().then(function () { return require('./uz-2fe37acb.js'); }).then(function (n) { return n.uz; }),
2318
- vi: () => Promise.resolve().then(function () { return require('./vi-d94f5810.js'); }).then(function (n) { return n.vi; }),
2319
- 'x-PSEUDO': () => Promise.resolve().then(function () { return require('./x-pseudo-5ecae8d8.js'); }).then(function (n) { return n.xPseudo; }),
2320
- yo: () => Promise.resolve().then(function () { return require('./yo-17cefd48.js'); }).then(function (n) { return n.yo; }),
2321
- 'zh-CN': () => Promise.resolve().then(function () { return require('./zh-cn-47409213.js'); }).then(function (n) { return n.zhCn; }),
2322
- 'zh-HK': () => Promise.resolve().then(function () { return require('./zh-hk-fc2c8cb3.js'); }).then(function (n) { return n.zhHk; }),
2323
- 'zh-TW': () => Promise.resolve().then(function () { return require('./zh-tw-04831c3c.js'); }).then(function (n) { return n.zhTw; }),
2324
- zh: () => Promise.resolve().then(function () { return require('./zh-8200043a.js'); }).then(function (n) { return n.zh; }),
2325
- 'oc-LNC': () => Promise.resolve().then(function () { return require('./oc-lnc-f82a10b4.js'); }).then(function (n) { return n.ocLnc; }),
2326
- nn: () => Promise.resolve().then(function () { return require('./nn-b1177787.js'); }).then(function (n) { return n.nn; }),
2327
- 'pa-IN': () => Promise.resolve().then(function () { return require('./pa-in-74c30512.js'); }).then(function (n) { return n.paIn; }),
2328
- };
2329
-
2330
- const warn = (language) => console.warn(`Cannot load dayjs locale file for "${language}"`);
2331
- const resolveLanguage = (languageInput) => {
2332
- if (locales[languageInput]) {
2333
- return languageInput;
2334
- }
2335
- if (languageInput.includes('-')) {
2336
- const regionlessLanguage = languageInput.split('-')[0];
2337
- if (locales[regionlessLanguage]) {
2338
- return regionlessLanguage;
2339
- }
2340
- }
2341
- return languageInput;
2342
- };
2343
- function loadDayjsLocale(languageInput) {
2344
- const language = resolveLanguage(languageInput);
2345
- if (!locales[language]) {
2346
- warn(language);
2347
- return;
2348
- }
2349
- try {
2350
- locales[language]().then(() => dayjs_min.dayjs.locale(language));
2351
- }
2352
- catch (_) {
2353
- warn(language);
2354
- }
2355
- }
2356
-
2357
- function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$2(o); }
2358
- function hasXMLHttpRequest() {
2359
- return typeof XMLHttpRequest === 'function' || (typeof XMLHttpRequest === "undefined" ? "undefined" : _typeof$2(XMLHttpRequest)) === 'object';
2360
- }
2361
- function isPromise(maybePromise) {
2362
- return !!maybePromise && typeof maybePromise.then === 'function';
2363
- }
2364
- function makePromise(maybePromise) {
2365
- if (isPromise(maybePromise)) {
2366
- return maybePromise;
2367
- }
2368
- return Promise.resolve(maybePromise);
2369
- }
2370
-
2371
- function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2372
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2373
- function _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2374
- function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; }
2375
- function _toPrimitive$1(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2376
- function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); }
2377
- var fetchApi = typeof fetch === 'function' ? fetch : undefined;
2378
- if (typeof global !== 'undefined' && global.fetch) {
2379
- fetchApi = global.fetch;
2380
- } else if (typeof window !== 'undefined' && window.fetch) {
2381
- fetchApi = window.fetch;
2382
- }
2383
- var XmlHttpRequestApi;
2384
- if (hasXMLHttpRequest()) {
2385
- if (typeof global !== 'undefined' && global.XMLHttpRequest) {
2386
- XmlHttpRequestApi = global.XMLHttpRequest;
2387
- } else if (typeof window !== 'undefined' && window.XMLHttpRequest) {
2388
- XmlHttpRequestApi = window.XMLHttpRequest;
2389
- }
2390
- }
2391
- var ActiveXObjectApi;
2392
- if (typeof ActiveXObject === 'function') {
2393
- if (typeof global !== 'undefined' && global.ActiveXObject) {
2394
- ActiveXObjectApi = global.ActiveXObject;
2395
- } else if (typeof window !== 'undefined' && window.ActiveXObject) {
2396
- ActiveXObjectApi = window.ActiveXObject;
2397
- }
2398
- }
2399
- if (typeof fetchApi !== 'function') fetchApi = undefined;
2400
- if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
2401
- try {
2402
- Promise.resolve().then(function () { return require('./browser-ponyfill-b5a441f7.js'); }).then(function (n) { return n.browserPonyfill; }).then(function (mod) {
2403
- fetchApi = mod.default;
2404
- }).catch(function () {});
2405
- } catch (e) {}
2406
- }
2407
- var addQueryString = function addQueryString(url, params) {
2408
- if (params && _typeof$1(params) === 'object') {
2409
- var queryString = '';
2410
- for (var paramName in params) {
2411
- queryString += '&' + encodeURIComponent(paramName) + '=' + encodeURIComponent(params[paramName]);
2412
- }
2413
- if (!queryString) return url;
2414
- url = url + (url.indexOf('?') !== -1 ? '&' : '?') + queryString.slice(1);
2415
- }
2416
- return url;
2417
- };
2418
- var fetchIt = function fetchIt(url, fetchOptions, callback, altFetch) {
2419
- var resolver = function resolver(response) {
2420
- if (!response.ok) return callback(response.statusText || 'Error', {
2421
- status: response.status
2422
- });
2423
- response.text().then(function (data) {
2424
- callback(null, {
2425
- status: response.status,
2426
- data: data
2427
- });
2428
- }).catch(callback);
2429
- };
2430
- if (altFetch) {
2431
- var altResponse = altFetch(url, fetchOptions);
2432
- if (altResponse instanceof Promise) {
2433
- altResponse.then(resolver).catch(callback);
2434
- return;
2435
- }
2436
- }
2437
- if (typeof fetch === 'function') {
2438
- fetch(url, fetchOptions).then(resolver).catch(callback);
2439
- } else {
2440
- fetchApi(url, fetchOptions).then(resolver).catch(callback);
2441
- }
2442
- };
2443
- var omitFetchOptions = false;
2444
- var requestWithFetch = function requestWithFetch(options, url, payload, callback) {
2445
- if (options.queryStringParams) {
2446
- url = addQueryString(url, options.queryStringParams);
2447
- }
2448
- var headers = _objectSpread$1({}, typeof options.customHeaders === 'function' ? options.customHeaders() : options.customHeaders);
2449
- if (typeof window === 'undefined' && typeof global !== 'undefined' && typeof global.process !== 'undefined' && global.process.versions && global.process.versions.node) {
2450
- headers['User-Agent'] = "i18next-http-backend (node/".concat(global.process.version, "; ").concat(global.process.platform, " ").concat(global.process.arch, ")");
2451
- }
2452
- if (payload) headers['Content-Type'] = 'application/json';
2453
- var reqOptions = typeof options.requestOptions === 'function' ? options.requestOptions(payload) : options.requestOptions;
2454
- var fetchOptions = _objectSpread$1({
2455
- method: payload ? 'POST' : 'GET',
2456
- body: payload ? options.stringify(payload) : undefined,
2457
- headers: headers
2458
- }, omitFetchOptions ? {} : reqOptions);
2459
- var altFetch = typeof options.alternateFetch === 'function' && options.alternateFetch.length >= 1 ? options.alternateFetch : undefined;
2460
- try {
2461
- fetchIt(url, fetchOptions, callback, altFetch);
2462
- } catch (e) {
2463
- if (!reqOptions || Object.keys(reqOptions).length === 0 || !e.message || e.message.indexOf('not implemented') < 0) {
2464
- return callback(e);
2465
- }
2466
- try {
2467
- Object.keys(reqOptions).forEach(function (opt) {
2468
- delete fetchOptions[opt];
2469
- });
2470
- fetchIt(url, fetchOptions, callback, altFetch);
2471
- omitFetchOptions = true;
2472
- } catch (err) {
2473
- callback(err);
2474
- }
2475
- }
2476
- };
2477
- var requestWithXmlHttpRequest = function requestWithXmlHttpRequest(options, url, payload, callback) {
2478
- if (payload && _typeof$1(payload) === 'object') {
2479
- payload = addQueryString('', payload).slice(1);
2480
- }
2481
- if (options.queryStringParams) {
2482
- url = addQueryString(url, options.queryStringParams);
2483
- }
2484
- try {
2485
- var x = XmlHttpRequestApi ? new XmlHttpRequestApi() : new ActiveXObjectApi('MSXML2.XMLHTTP.3.0');
2486
- x.open(payload ? 'POST' : 'GET', url, 1);
2487
- if (!options.crossDomain) {
2488
- x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
2489
- }
2490
- x.withCredentials = !!options.withCredentials;
2491
- if (payload) {
2492
- x.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
2493
- }
2494
- if (x.overrideMimeType) {
2495
- x.overrideMimeType('application/json');
2496
- }
2497
- var h = options.customHeaders;
2498
- h = typeof h === 'function' ? h() : h;
2499
- if (h) {
2500
- for (var i in h) {
2501
- x.setRequestHeader(i, h[i]);
2502
- }
2503
- }
2504
- x.onreadystatechange = function () {
2505
- x.readyState > 3 && callback(x.status >= 400 ? x.statusText : null, {
2506
- status: x.status,
2507
- data: x.responseText
2508
- });
2509
- };
2510
- x.send(payload);
2511
- } catch (e) {
2512
- console && console.log(e);
2513
- }
2514
- };
2515
- var request = function request(options, url, payload, callback) {
2516
- if (typeof payload === 'function') {
2517
- callback = payload;
2518
- payload = undefined;
2519
- }
2520
- callback = callback || function () {};
2521
- if (fetchApi && url.indexOf('file:') !== 0) {
2522
- return requestWithFetch(options, url, payload, callback);
2523
- }
2524
- if (hasXMLHttpRequest() || typeof ActiveXObject === 'function') {
2525
- return requestWithXmlHttpRequest(options, url, payload, callback);
2526
- }
2527
- callback(new Error('No fetch and no xhr implementation found!'));
2528
- };
2529
-
2530
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2531
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2532
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2533
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
2534
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
2535
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
2536
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2537
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
2538
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2539
- var getDefaults = function getDefaults() {
2540
- return {
2541
- loadPath: '/locales/{{lng}}/{{ns}}.json',
2542
- addPath: '/locales/add/{{lng}}/{{ns}}',
2543
- parse: function parse(data) {
2544
- return JSON.parse(data);
2545
- },
2546
- stringify: JSON.stringify,
2547
- parsePayload: function parsePayload(namespace, key, fallbackValue) {
2548
- return _defineProperty({}, key, fallbackValue || '');
2549
- },
2550
- parseLoadPayload: function parseLoadPayload(languages, namespaces) {
2551
- return undefined;
2552
- },
2553
- request: request,
2554
- reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000,
2555
- customHeaders: {},
2556
- queryStringParams: {},
2557
- crossDomain: false,
2558
- withCredentials: false,
2559
- overrideMimeType: false,
2560
- requestOptions: {
2561
- mode: 'cors',
2562
- credentials: 'same-origin',
2563
- cache: 'default'
2564
- }
2565
- };
2566
- };
2567
- var Backend = function () {
2568
- function Backend(services) {
2569
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2570
- var allOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2571
- _classCallCheck(this, Backend);
2572
- this.services = services;
2573
- this.options = options;
2574
- this.allOptions = allOptions;
2575
- this.type = 'backend';
2576
- this.init(services, options, allOptions);
2577
- }
2578
- return _createClass(Backend, [{
2579
- key: "init",
2580
- value: function init(services) {
2581
- var _this = this;
2582
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2583
- var allOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2584
- this.services = services;
2585
- this.options = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), this.options || {}), options);
2586
- this.allOptions = allOptions;
2587
- if (this.services && this.options.reloadInterval) {
2588
- var timer = setInterval(function () {
2589
- return _this.reload();
2590
- }, this.options.reloadInterval);
2591
- if (_typeof(timer) === 'object' && typeof timer.unref === 'function') timer.unref();
2592
- }
2593
- }
2594
- }, {
2595
- key: "readMulti",
2596
- value: function readMulti(languages, namespaces, callback) {
2597
- this._readAny(languages, languages, namespaces, namespaces, callback);
2598
- }
2599
- }, {
2600
- key: "read",
2601
- value: function read(language, namespace, callback) {
2602
- this._readAny([language], language, [namespace], namespace, callback);
2603
- }
2604
- }, {
2605
- key: "_readAny",
2606
- value: function _readAny(languages, loadUrlLanguages, namespaces, loadUrlNamespaces, callback) {
2607
- var _this2 = this;
2608
- var loadPath = this.options.loadPath;
2609
- if (typeof this.options.loadPath === 'function') {
2610
- loadPath = this.options.loadPath(languages, namespaces);
2611
- }
2612
- loadPath = makePromise(loadPath);
2613
- loadPath.then(function (resolvedLoadPath) {
2614
- if (!resolvedLoadPath) return callback(null, {});
2615
- var url = _this2.services.interpolator.interpolate(resolvedLoadPath, {
2616
- lng: languages.join('+'),
2617
- ns: namespaces.join('+')
2618
- });
2619
- _this2.loadUrl(url, callback, loadUrlLanguages, loadUrlNamespaces);
2620
- });
2621
- }
2622
- }, {
2623
- key: "loadUrl",
2624
- value: function loadUrl(url, callback, languages, namespaces) {
2625
- var _this3 = this;
2626
- var lng = typeof languages === 'string' ? [languages] : languages;
2627
- var ns = typeof namespaces === 'string' ? [namespaces] : namespaces;
2628
- var payload = this.options.parseLoadPayload(lng, ns);
2629
- this.options.request(this.options, url, payload, function (err, res) {
2630
- if (res && (res.status >= 500 && res.status < 600 || !res.status)) return callback('failed loading ' + url + '; status code: ' + res.status, true);
2631
- if (res && res.status >= 400 && res.status < 500) return callback('failed loading ' + url + '; status code: ' + res.status, false);
2632
- if (!res && err && err.message) {
2633
- var errorMessage = err.message.toLowerCase();
2634
- var isNetworkError = ['failed', 'fetch', 'network', 'load'].find(function (term) {
2635
- return errorMessage.indexOf(term) > -1;
2636
- });
2637
- if (isNetworkError) {
2638
- return callback('failed loading ' + url + ': ' + err.message, true);
2639
- }
2640
- }
2641
- if (err) return callback(err, false);
2642
- var ret, parseErr;
2643
- try {
2644
- if (typeof res.data === 'string') {
2645
- ret = _this3.options.parse(res.data, languages, namespaces);
2646
- } else {
2647
- ret = res.data;
2648
- }
2649
- } catch (e) {
2650
- parseErr = 'failed parsing ' + url + ' to json';
2651
- }
2652
- if (parseErr) return callback(parseErr, false);
2653
- callback(null, ret);
2654
- });
2655
- }
2656
- }, {
2657
- key: "create",
2658
- value: function create(languages, namespace, key, fallbackValue, callback) {
2659
- var _this4 = this;
2660
- if (!this.options.addPath) return;
2661
- if (typeof languages === 'string') languages = [languages];
2662
- var payload = this.options.parsePayload(namespace, key, fallbackValue);
2663
- var finished = 0;
2664
- var dataArray = [];
2665
- var resArray = [];
2666
- languages.forEach(function (lng) {
2667
- var addPath = _this4.options.addPath;
2668
- if (typeof _this4.options.addPath === 'function') {
2669
- addPath = _this4.options.addPath(lng, namespace);
2670
- }
2671
- var url = _this4.services.interpolator.interpolate(addPath, {
2672
- lng: lng,
2673
- ns: namespace
2674
- });
2675
- _this4.options.request(_this4.options, url, payload, function (data, res) {
2676
- finished += 1;
2677
- dataArray.push(data);
2678
- resArray.push(res);
2679
- if (finished === languages.length) {
2680
- if (typeof callback === 'function') callback(dataArray, resArray);
2681
- }
2682
- });
2683
- });
2684
- }
2685
- }, {
2686
- key: "reload",
2687
- value: function reload() {
2688
- var _this5 = this;
2689
- var _this$services = this.services,
2690
- backendConnector = _this$services.backendConnector,
2691
- languageUtils = _this$services.languageUtils,
2692
- logger = _this$services.logger;
2693
- var currentLanguage = backendConnector.language;
2694
- if (currentLanguage && currentLanguage.toLowerCase() === 'cimode') return;
2695
- var toLoad = [];
2696
- var append = function append(lng) {
2697
- var lngs = languageUtils.toResolveHierarchy(lng);
2698
- lngs.forEach(function (l) {
2699
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
2700
- });
2701
- };
2702
- append(currentLanguage);
2703
- if (this.allOptions.preload) this.allOptions.preload.forEach(function (l) {
2704
- return append(l);
2705
- });
2706
- toLoad.forEach(function (lng) {
2707
- _this5.allOptions.ns.forEach(function (ns) {
2708
- backendConnector.read(lng, ns, 'read', null, null, function (err, data) {
2709
- if (err) logger.warn("loading namespace ".concat(ns, " for language ").concat(lng, " failed"), err);
2710
- if (!err && data) logger.log("loaded namespace ".concat(ns, " for language ").concat(lng), data);
2711
- backendConnector.loaded("".concat(lng, "|").concat(ns), err, data);
2712
- });
2713
- });
2714
- });
2715
- }
2716
- }]);
2717
- }();
2718
- Backend.type = 'backend';
2719
-
2720
- function getAssetPath(path) {
2721
- const baseUrl = new URL('./', window.document.baseURI).href;
2722
- const assetUrl = new URL(path, baseUrl);
2723
- return assetUrl.origin !== window.location.origin
2724
- ? assetUrl.href
2725
- : assetUrl.pathname;
2726
- }
2727
-
2728
- const availableLocales = [
2729
- "dev",
2730
- "en",
2731
- "fr",
2732
- "cs",
2733
- "da",
2734
- "de",
2735
- "el",
2736
- "es",
2737
- "fi",
2738
- "hu",
2739
- "id",
2740
- "it",
2741
- "ja",
2742
- "ko",
2743
- "nl",
2744
- "no",
2745
- "pl",
2746
- "pt",
2747
- "pt-br",
2748
- "ru",
2749
- "sv",
2750
- "th",
2751
- "tr",
2752
- "zh",
2753
- "zh-cn",
2754
- "zh-tw",
2755
- "zn",
2756
- "es-es"
2757
- ];
2758
-
2759
- const i18nTranslationNamespace = 'translation';
2760
- function isI18nLocaleAvailable(locale) {
2761
- return availableLocales.includes(locale.toLowerCase());
2762
- }
2763
- function i18nBackendOptions(atomicInterface) {
2764
- return {
2765
- loadPath: `${getAssetPath(atomicInterface.languageAssetsPath)}/{{lng}}.json?lng={{lng}}&ns={{ns}}`,
2766
- request: async (_options, url, _payload, callback) => {
2767
- try {
2768
- const [fetchUrl, searchParams] = url.split('?');
2769
- const urlParams = new URLSearchParams(searchParams);
2770
- const lng = urlParams.get('lng');
2771
- const ns = urlParams.get('ns');
2772
- if (!isI18nLocaleAvailable(lng)) {
2773
- throw new Error(`Unsupported locale "${lng}"`);
2774
- }
2775
- if (ns !== i18nTranslationNamespace) {
2776
- throw new Error(`Unsupported namespace "${ns}"`);
2777
- }
2778
- const response = await fetch(fetchUrl);
2779
- if (response.status !== 200 && response.status !== 304) {
2780
- throw new Error(`Unsuccessful request returned status "${response.status}"`);
2781
- }
2782
- callback(null, {
2783
- status: response.status,
2784
- data: await response.json(),
2785
- });
2786
- }
2787
- catch (error) {
2788
- callback(error, { status: 404, data: '' });
2789
- }
2790
- },
2791
- };
2792
- }
2793
- function init18n(atomicInterface) {
2794
- return atomicInterface.i18n.use(Backend).init({
2795
- debug: atomicInterface.logLevel === 'debug',
2796
- lng: atomicInterface.language,
2797
- nsSeparator: '___',
2798
- fallbackLng: 'en',
2799
- backend: i18nBackendOptions(atomicInterface),
2800
- interpolation: {
2801
- escape: (str) => purify.DOMPurify.sanitize(str),
2802
- },
2803
- compatibilityJSON: 'v4',
2804
- });
2805
- }
2806
-
2807
- const mismatchedInterfaceAndEnginePropError = (interfaceKind, configurationName) => `A ${configurationName} is configured on the ${interfaceKind} interface element, but the ${interfaceKind} interface was initialized with an engine. You should only configure the ${configurationName} in the target engine.`;
2808
- class CommonAtomicInterfaceHelper {
2809
- constructor(atomicInterface, globalVariableName) {
2810
- this.atomicInterface = atomicInterface;
2811
- this.hangingComponentsInitialization = [];
2812
- setCoveoGlobal(headless.VERSION, globalVariableName);
2813
- const { connectedCallback: originalConnectedCallback, render: originalRender, } = atomicInterface;
2814
- atomicInterface.connectedCallback = () => {
2815
- this.i18nPromise = init18n(atomicInterface);
2816
- return (originalConnectedCallback &&
2817
- originalConnectedCallback.call(atomicInterface));
2818
- };
2819
- atomicInterface.render = () => {
2820
- if (atomicInterface.error) {
2821
- return (index.h("atomic-component-error", { element: atomicInterface.host, error: atomicInterface.error }));
2822
- }
2823
- return originalRender && originalRender.call(atomicInterface);
2824
- };
2825
- }
2826
- onComponentInitializing(event) {
2827
- event.preventDefault();
2828
- event.stopPropagation();
2829
- if (this.atomicInterface.engine) {
2830
- event.detail(this.atomicInterface.bindings);
2831
- return;
2832
- }
2833
- this.hangingComponentsInitialization.push(event);
2834
- }
2835
- async onInitialization(initEngine) {
2836
- if (this.atomicInterface.engine) {
2837
- this.atomicInterface.engine.logger.warn(`The ${this.interfaceTagname} component "initialize" has already been called.`, this.atomicInterface.host);
2838
- return;
2839
- }
2840
- this.atomicInterface.updateIconAssetsPath();
2841
- initEngine();
2842
- if (this.atomicInterface.registerFieldsToInclude) {
2843
- this.atomicInterface.registerFieldsToInclude();
2844
- }
2845
- loadDayjsLocale(this.language);
2846
- await this.i18nPromise;
2847
- this.initComponents();
2848
- }
2849
- onAnalyticsChange() {
2850
- const { engine, analytics } = this.atomicInterface;
2851
- if (!this.engineIsCreated(engine)) {
2852
- return;
2853
- }
2854
- if (!analytics) {
2855
- engine.disableAnalytics();
2856
- return;
2857
- }
2858
- engine.enableAnalytics();
2859
- }
2860
- onLanguageChange() {
2861
- const { i18n, language } = this.atomicInterface;
2862
- loadDayjsLocale(this.language);
2863
- const { resolve, promise } = Promise.withResolvers();
2864
- new Backend(i18n.services, i18nBackendOptions(this.atomicInterface)).read(this.language, i18nTranslationNamespace, async (_, data) => {
2865
- i18n.addResourceBundle(this.language, i18nTranslationNamespace, data, true, false);
2866
- await i18n.changeLanguage(language);
2867
- resolve();
2868
- });
2869
- return promise;
2870
- }
2871
- engineIsCreated(engine) {
2872
- if (!engine) {
2873
- console.error(`You have to call "initialize" on the ${this.interfaceTagname} component before modifying the props or calling other public methods.`, this.atomicInterface.host);
2874
- return false;
2875
- }
2876
- return true;
2877
- }
2878
- get interfaceTagname() {
2879
- return this.atomicInterface.host.tagName.toLowerCase();
2880
- }
2881
- initComponents() {
2882
- this.hangingComponentsInitialization.forEach((event) => event.detail(this.atomicInterface.bindings));
2883
- }
2884
- get language() {
2885
- return this.atomicInterface.language || 'en';
2886
- }
2887
- }
2888
-
2889
- function augmentWithExternalMiddleware(event, payload, config) {
2890
- if (config.analytics?.analyticsClientMiddleware) {
2891
- return config.analytics.analyticsClientMiddleware(event, payload);
2892
- }
2893
- return payload;
2894
- }
2895
- function augmentAnalyticsWithAtomicVersion(payload) {
2896
- if (payload.customData) {
2897
- payload.customData.coveoAtomicVersion = getAtomicVersion();
2898
- }
2899
- return payload;
2900
- }
2901
- function augmentAnalyticsConfigWithDocument() {
2902
- return {
2903
- documentLocation: document.location.href,
2904
- ...(document.referrer && { originLevel3: document.referrer }),
2905
- };
2906
- }
2907
- const versionMatcher = /^(\d+\.\d+\.\d+)/;
2908
- function augmentAnalyticsConfigWithAtomicVersion() {
2909
- return {
2910
- source: {
2911
- '@coveo/atomic': versionMatcher.exec(getAtomicVersion())?.[0] || '0.0.0',
2912
- },
2913
- };
2914
- }
2915
- function getNextAnalyticsConfig(searchEngineConfig, enabled) {
2916
- const configuration = {
2917
- enabled,
2918
- documentLocation: document.location.href,
2919
- ...(document.referrer && { originLevel3: document.referrer }),
2920
- };
2921
- const analyticsConfiguration = searchEngineConfig.analytics ?? {};
2922
- Object.assign(analyticsConfiguration, augmentAnalyticsConfigWithAtomicVersion());
2923
- Object.assign(configuration, analyticsConfiguration);
2924
- return configuration;
2925
- }
13
+ require('@coveo/headless');
14
+ require('./purify-85b542e2.js');
15
+ require('@coveo/bueno');
16
+ require('./utils-7153ae6b.js');
2926
17
 
2927
18
  function getAnalyticsConfig(recsConfig, enabled) {
2928
19
  switch (recsConfig.analytics?.analyticsMode) {
2929
20
  case 'next':
2930
- return getNextAnalyticsConfig(recsConfig, enabled);
21
+ return analyticsConfig.getNextAnalyticsConfig(recsConfig, enabled);
2931
22
  default:
2932
23
  return getLegacyAnalyticsConfig(recsConfig, enabled);
2933
24
  }
@@ -2937,8 +28,8 @@ function getLegacyAnalyticsConfig(recsConfig, enabled) {
2937
28
  const defaultAnalyticsConfig = {
2938
29
  analyticsClientMiddleware,
2939
30
  enabled,
2940
- ...augmentAnalyticsConfigWithDocument(),
2941
- ...augmentAnalyticsConfigWithAtomicVersion(),
31
+ ...analyticsConfig.augmentAnalyticsConfigWithDocument(),
32
+ ...analyticsConfig.augmentAnalyticsConfigWithAtomicVersion(),
2942
33
  };
2943
34
  if (recsConfig.analytics) {
2944
35
  return {
@@ -2950,8 +41,8 @@ function getLegacyAnalyticsConfig(recsConfig, enabled) {
2950
41
  return defaultAnalyticsConfig;
2951
42
  }
2952
43
  function augmentAnalytics(event, payload, recsConfig) {
2953
- let result = augmentWithExternalMiddleware(event, payload, recsConfig);
2954
- result = augmentAnalyticsWithAtomicVersion(result);
44
+ let result = analyticsConfig.augmentWithExternalMiddleware(event, payload, recsConfig);
45
+ result = analyticsConfig.augmentAnalyticsWithAtomicVersion(result);
2955
46
  return result;
2956
47
  }
2957
48
 
@@ -3038,14 +129,14 @@ const AtomicRecsInterface = class {
3038
129
  this.languageAssetsPath = './lang';
3039
130
  this.iconAssetsPath = './assets';
3040
131
  this.CspNonce = undefined;
3041
- this.commonInterfaceHelper = new CommonAtomicInterfaceHelper(this, 'CoveoAtomicRecs');
132
+ this.commonInterfaceHelper = new analyticsConfig.CommonAtomicInterfaceHelper(this, 'CoveoAtomicRecs');
3042
133
  ({
3043
134
  promise: this.componentWillLoadCalledPromise,
3044
135
  resolve: this.componentWillLoadResolver,
3045
136
  } = Promise.withResolvers());
3046
137
  const { promise, resolve } = Promise.withResolvers();
3047
138
  this.i18Initialized = promise;
3048
- this.i18n = instance.createInstance(undefined, resolve);
139
+ this.i18n = analyticsConfig.instance.createInstance(undefined, resolve);
3049
140
  }
3050
141
  get bindings() {
3051
142
  return {
@@ -3076,10 +167,10 @@ const AtomicRecsInterface = class {
3076
167
  */
3077
168
  initializeWithRecommendationEngine(engine) {
3078
169
  if (this.pipeline && this.pipeline !== engine.state.pipeline) {
3079
- console.warn(mismatchedInterfaceAndEnginePropError('recommendation', 'query pipeline'));
170
+ console.warn(analyticsConfig.mismatchedInterfaceAndEnginePropError('recommendation', 'query pipeline'));
3080
171
  }
3081
172
  if (this.searchHub && this.searchHub !== engine.state.searchHub) {
3082
- console.warn(mismatchedInterfaceAndEnginePropError('recommendation', 'search hub'));
173
+ console.warn(analyticsConfig.mismatchedInterfaceAndEnginePropError('recommendation', 'search hub'));
3083
174
  }
3084
175
  return this.internalInitialization(() => (this.engine = engine));
3085
176
  }
@@ -3159,7 +250,7 @@ const AtomicRecsInterface = class {
3159
250
  }
3160
251
  }
3161
252
  render() {
3162
- return this.engine && index.h("slot", { key: 'be34a0736aec2334bc13b2d75623adc7c9bc6604' });
253
+ return this.engine && index.h("slot", { key: '6c09dd16d3a246fa7fe865f1b05ac899086da019' });
3163
254
  }
3164
255
  get host() { return index.getElement(this); }
3165
256
  static get watchers() { return {