zignal-stencil-library 1.1.129 → 1.1.130

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 (271) hide show
  1. package/dist/cjs/autocomplete-address_44.cjs.entry.js +20336 -0
  2. package/dist/cjs/{dayjs-Btww0IBx.js → dayjs-BgYSOinw.js} +11 -3
  3. package/dist/cjs/{index-DBliBGHU.js → index-CnARINSp.js} +80 -7
  4. package/dist/cjs/{index-REEdj4HR.js → index-DHf9KFXq.js} +5 -3
  5. package/dist/cjs/index.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/quick-message-app.cjs.entry.js +5 -5
  8. package/dist/cjs/zignal-stencil-library.cjs.js +3 -3
  9. package/dist/collection/api/index.js +51 -0
  10. package/dist/collection/assets/images/logo/zerva.png +0 -0
  11. package/dist/collection/assets/images/logo/zrmz.png +0 -0
  12. package/dist/collection/collection-manifest.json +2 -1
  13. package/dist/collection/components/autocomplete-address/autocomplete-address.css +1 -1
  14. package/dist/collection/components/autocomplete-multiple-select/autocomplete-multiple-select.css +1 -1
  15. package/dist/collection/components/autocomplete-multiple-select/autocomplete-multiple-select.js +1 -1
  16. package/dist/collection/components/autocomplete-select/autocomplete-select.css +1 -1
  17. package/dist/collection/components/autocomplete-select/autocomplete-select.js +23 -3
  18. package/dist/collection/components/channel-box/channel-box.css +1 -1
  19. package/dist/collection/components/chat-app/chat-app.css +1 -1
  20. package/dist/collection/components/chat-header/chat-header.css +1 -1
  21. package/dist/collection/components/chat-input/chat-input.css +1 -1
  22. package/dist/collection/components/checkbox-list/checkbox-list.css +1 -1
  23. package/dist/collection/components/dialog-bill-editor/dialog-bill-editor.css +1 -1
  24. package/dist/collection/components/dialog-custom-filter/dialog-custom-filter.css +1 -0
  25. package/dist/collection/components/dialog-custom-filter/dialog-custom-filter.js +101 -0
  26. package/dist/collection/components/dialog-editor/dialog-editor.css +1 -1
  27. package/dist/collection/components/dialog-editor/dialog-editor.js +1 -1
  28. package/dist/collection/components/dialog-preview-media/dialog-preview-media.css +1 -1
  29. package/dist/collection/components/dialog-preview-media/dialog-preview-media.js +1 -1
  30. package/dist/collection/components/dialog-search/dialog-search.css +1 -1
  31. package/dist/collection/components/dialog-search/dialog-search.js +208 -15
  32. package/dist/collection/components/internal-component/icon.js +3 -1
  33. package/dist/collection/components/internal-component/z-button.js +19 -4
  34. package/dist/collection/components/internal-component/z-input.js +1 -1
  35. package/dist/collection/components/menu-chat-channel/menu-chat-channel.css +1 -1
  36. package/dist/collection/components/menu-chat-channel/menu-chat-channel.js +2 -2
  37. package/dist/collection/components/menu-chat-type/menu-chat-type.css +1 -1
  38. package/dist/collection/components/menu-chat-type/menu-chat-type.js +29 -3
  39. package/dist/collection/components/menu-list/menu-list.css +1 -1
  40. package/dist/collection/components/menu-list/menu-list.js +3 -3
  41. package/dist/collection/components/message-box/message-box.css +1 -1
  42. package/dist/collection/components/message-box/message-box.js +1 -1
  43. package/dist/collection/components/message-content/message-content.css +1 -1
  44. package/dist/collection/components/message-content/message-content.js +1 -1
  45. package/dist/collection/components/message-item/message-item.css +1 -1
  46. package/dist/collection/components/message-item/message-item.js +1 -1
  47. package/dist/collection/components/message-media/message-media.css +1 -1
  48. package/dist/collection/components/message-media/message-media.js +2 -2
  49. package/dist/collection/components/profile-history/profile-history.css +1 -1
  50. package/dist/collection/components/profile-history/profile-history.js +1 -1
  51. package/dist/collection/components/profile-info/profile-info.css +1 -1
  52. package/dist/collection/components/profile-info/user-info-section.js +4 -4
  53. package/dist/collection/components/profile-media/profile-media.css +1 -1
  54. package/dist/collection/components/profile-media/profile-media.js +1 -1
  55. package/dist/collection/components/profile-tabs/profile-tabs.css +1 -1
  56. package/dist/collection/components/profile-tabs/profile-tabs.js +2 -2
  57. package/dist/collection/components/quick-message-add-template/quick-message-add-template.css +1 -1
  58. package/dist/collection/components/quick-message-add-template/quick-message-add-template.js +3 -3
  59. package/dist/collection/components/quick-message-add-template/quick-message-text-content.js +1 -1
  60. package/dist/collection/components/quick-message-app/quick-message-app.css +1 -1
  61. package/dist/collection/components/quick-message-app/quick-message-app.js +1 -1
  62. package/dist/collection/components/quick-message-file/quick-message-file.css +1 -1
  63. package/dist/collection/components/quick-message-file/quick-message-file.js +1 -1
  64. package/dist/collection/components/quick-message-image/quick-message-image.css +1 -1
  65. package/dist/collection/components/quick-message-image/quick-message-image.js +1 -1
  66. package/dist/collection/components/quick-message-modal/quick-message-modal.css +1 -1
  67. package/dist/collection/components/quick-message-modal/quick-message-modal.js +1 -1
  68. package/dist/collection/components/quick-message-template/quick-message-template.css +1 -1
  69. package/dist/collection/components/quick-message-template/quick-message-template.js +2 -2
  70. package/dist/collection/components/search-box/search-box.css +1 -1
  71. package/dist/collection/components/search-box/search-box.js +64 -9
  72. package/dist/collection/components/status-badge/status-badge.css +1 -1
  73. package/dist/collection/components/status-badge/status-badge.js +2 -2
  74. package/dist/collection/components/tag-list/tag-list.css +1 -1
  75. package/dist/collection/components/tag-list/tag-list.js +1 -1
  76. package/dist/collection/components/tag-or-status-item/tag-or-status-item.css +1 -1
  77. package/dist/collection/components/tag-or-status-item/tag-or-status-item.js +2 -2
  78. package/dist/collection/components/tag-popper/tag-popper.css +1 -1
  79. package/dist/collection/components/tag-popper/tag-popper.js +2 -2
  80. package/dist/collection/components/typography-clamp/typography-clamp.css +1 -1
  81. package/dist/collection/components/typography-clamp/typography-clamp.js +2 -2
  82. package/dist/collection/components/z-avatar/z-avatar.css +1 -1
  83. package/dist/collection/components/z-dialog/z-dialog.css +1 -1
  84. package/dist/collection/store/chat.js +102 -2
  85. package/dist/collection/store/store.js +8 -1
  86. package/dist/components/autocomplete-address.js +1 -1
  87. package/dist/components/autocomplete-multiple-select.js +1 -1
  88. package/dist/components/autocomplete-select.js +1 -1
  89. package/dist/components/channel-box.js +1 -1
  90. package/dist/components/chat-app.js +65 -60
  91. package/dist/components/chat-header.js +1 -1
  92. package/dist/components/chat-input.js +1 -1
  93. package/dist/components/checkbox-list.js +1 -1
  94. package/dist/components/dialog-bill-editor.js +1 -1
  95. package/dist/components/dialog-custom-filter.d.ts +11 -0
  96. package/dist/components/dialog-custom-filter.js +6 -0
  97. package/dist/components/dialog-editor.js +1 -1
  98. package/dist/components/dialog-preview-media.js +1 -1
  99. package/dist/components/dialog-search.js +1 -1
  100. package/dist/components/index.js +2270 -6
  101. package/dist/components/menu-chat-channel.js +1 -1
  102. package/dist/components/menu-chat-type.js +1 -1
  103. package/dist/components/menu-list.js +1 -1
  104. package/dist/components/message-box.js +1 -1
  105. package/dist/components/message-content.js +1 -1
  106. package/dist/components/message-item.js +1 -1
  107. package/dist/components/message-media.js +1 -1
  108. package/dist/components/p-5IazAlrC.js +515 -0
  109. package/dist/components/p-B8heEJTO.js +215 -0
  110. package/dist/components/p-B8lXV1hG.js +107 -0
  111. package/dist/components/p-BKveoKtU.js +578 -0
  112. package/dist/components/p-BPgEBh_Q.js +599 -0
  113. package/dist/components/p-BTH3h2-a.js +158 -0
  114. package/dist/components/{p-CTJvvlwf.js → p-B_qzajME.js} +4 -4
  115. package/dist/components/p-BhcHJ8yw.js +121 -0
  116. package/dist/components/{p-CwmztnlQ.js → p-BjVLRS7n.js} +3 -3
  117. package/dist/components/p-Botb-fMM.js +231 -0
  118. package/dist/components/p-BsaAJCLP.js +175 -0
  119. package/dist/components/p-BxCKpbcC.js +32 -0
  120. package/dist/components/p-Byzk-_YW.js +122 -0
  121. package/dist/components/p-C5yFTPFW.js +155 -0
  122. package/dist/components/{p-BRjNz6ke.js → p-CAsWEhpU.js} +4 -4
  123. package/dist/components/p-CBOeK31J.js +155 -0
  124. package/dist/components/p-CBUfOt2_.js +102 -0
  125. package/dist/components/p-CCvemC7u.js +98 -0
  126. package/dist/components/p-CCyF6woR.js +184 -0
  127. package/dist/components/p-CEILBEig.js +156 -0
  128. package/dist/components/p-CJ3AZsG-.js +171 -0
  129. package/dist/components/{p-DvuE0BKi.js → p-CKkAP7cy.js} +4 -4
  130. package/dist/components/{p-Cq-rMEH9.js → p-COACytrs.js} +5 -5
  131. package/dist/components/p-COMb6IeI.js +35 -0
  132. package/dist/components/p-Cab3n575.js +65 -0
  133. package/dist/components/{p-rnwpU-MO.js → p-CiL7lbgr.js} +6 -6
  134. package/dist/components/p-CjA6vmi4.js +108 -0
  135. package/dist/components/{p-X0kRbis3.js → p-Cn0h1dTO.js} +56 -5
  136. package/dist/components/{p-ZODz3l7q.js → p-Co1JFxGT.js} +6 -6
  137. package/dist/components/{p-C64OG6Go.js → p-CtFQExqY.js} +4 -4
  138. package/dist/components/{p-yKfywTRY.js → p-CuN9hfaY.js} +1 -1
  139. package/dist/components/{p-D6E7AT0Y.js → p-CzLeqYlq.js} +10 -3
  140. package/dist/components/p-D1wLcFGi.js +214 -0
  141. package/dist/components/p-D2wI3wUk.js +96 -0
  142. package/dist/components/p-D40E1tJr.js +51 -0
  143. package/dist/components/{p-CvZQgYYK.js → p-D93wPIC3.js} +1 -2
  144. package/dist/components/{p-DAdBAzUE.js → p-DFkopdf7.js} +2 -2
  145. package/dist/components/p-DLTKEWS9.js +76 -0
  146. package/dist/components/p-DN-HKD1p.js +563 -0
  147. package/dist/components/p-DOOGrygy.js +223 -0
  148. package/dist/components/{p-BCLD-S_A.js → p-DQqW7ZTp.js} +94 -55
  149. package/dist/components/{p-BsVBC0QF.js → p-DRz4sc4i.js} +5 -3
  150. package/dist/components/p-DZ_Zpo-K.js +265 -0
  151. package/dist/components/{p-CEHfgumC.js → p-DbOnUYwI.js} +3 -3
  152. package/dist/components/{p-D3nAizga.js → p-DdzMJBz5.js} +3 -3
  153. package/dist/components/p-DgNQXZO6.js +308 -0
  154. package/dist/components/p-DhfEHxBZ.js +166 -0
  155. package/dist/components/{p-UNG2V2EJ.js → p-DqE1kPyH.js} +2 -2
  156. package/dist/components/p-DxS9Uoee.js +129 -0
  157. package/dist/components/p-Dyi4snnY.js +74 -0
  158. package/dist/components/{p-DoSaXyw1.js → p-IInEXDcl.js} +2 -2
  159. package/dist/components/{p-BkFRrRKV.js → p-KhSBCyat.js} +4 -4
  160. package/dist/components/p-PBolISVR.js +554 -0
  161. package/dist/components/p-T_0oGsyc.js +701 -0
  162. package/dist/components/p-cRvk8ROJ.js +57 -0
  163. package/dist/components/p-cw5fhckD.js +135 -0
  164. package/dist/components/{p-Bt6e__iP.js → p-dB4bgXH7.js} +2 -2
  165. package/dist/components/{p-Bu7d3mrb.js → p-iVQVNk9Z.js} +5 -5
  166. package/dist/components/p-ly8pbxdt.js +233 -0
  167. package/dist/components/p-r3HbBbws.js +133 -0
  168. package/dist/components/p-uRD_rTfg.js +119 -0
  169. package/dist/components/p-zp9foNtI.js +138 -0
  170. package/dist/components/profile-history.js +1 -1
  171. package/dist/components/profile-info.js +1 -1
  172. package/dist/components/profile-media.js +1 -1
  173. package/dist/components/profile-tabs.js +1 -1
  174. package/dist/components/quick-message-add-template.js +1 -1
  175. package/dist/components/quick-message-app.js +17 -18
  176. package/dist/components/quick-message-button-content.js +1 -1
  177. package/dist/components/quick-message-file.js +1 -1
  178. package/dist/components/quick-message-image-content.js +1 -1
  179. package/dist/components/quick-message-image.js +1 -1
  180. package/dist/components/quick-message-menu-list-content.js +1 -1
  181. package/dist/components/quick-message-modal.js +1 -1
  182. package/dist/components/quick-message-template.js +1 -1
  183. package/dist/components/quick-message-text-content.js +1 -1
  184. package/dist/components/quick-message-video-content.js +1 -1
  185. package/dist/components/search-box.js +1 -1
  186. package/dist/components/status-badge.js +1 -1
  187. package/dist/components/summarize-message-section.js +1 -1
  188. package/dist/components/tag-list.js +1 -1
  189. package/dist/components/tag-or-status-item.js +1 -1
  190. package/dist/components/tag-popper.js +1 -1
  191. package/dist/components/typography-clamp.js +1 -1
  192. package/dist/components/user-info-section.js +1 -1
  193. package/dist/components/z-avatar.js +1 -1
  194. package/dist/components/z-dialog.js +1 -1
  195. package/dist/esm/autocomplete-address_44.entry.js +20291 -0
  196. package/dist/esm/{dayjs-i8XfvNUE.js → dayjs-i2xBGlTG.js} +11 -4
  197. package/dist/esm/{index-DrJU7-bz.js → index-BnUowDzX.js} +5 -3
  198. package/dist/esm/{index-BsYB8kV0.js → index-DkxQAqgZ.js} +80 -7
  199. package/dist/esm/index.js +1 -1
  200. package/dist/esm/loader.js +3 -3
  201. package/dist/esm/quick-message-app.entry.js +5 -5
  202. package/dist/esm/zignal-stencil-library.js +4 -4
  203. package/dist/types/api/index.d.ts +4 -0
  204. package/dist/types/api/quick-message.d.ts +3 -3
  205. package/dist/types/api/type.d.ts +78 -0
  206. package/dist/types/components/autocomplete-select/autocomplete-select.d.ts +1 -0
  207. package/dist/types/components/dialog-custom-filter/dialog-custom-filter.d.ts +11 -0
  208. package/dist/types/components/dialog-search/dialog-search.d.ts +15 -2
  209. package/dist/types/components/internal-component/z-button.d.ts +2 -1
  210. package/dist/types/components/search-box/search-box.d.ts +11 -1
  211. package/dist/types/components.d.ts +47 -2
  212. package/dist/types/stencil-public-runtime.d.ts +1 -1
  213. package/dist/types/store/chat.d.ts +27 -1
  214. package/dist/types/store/store.d.ts +7 -1
  215. package/dist/zignal-stencil-library/assets/images/logo/zerva.png +0 -0
  216. package/dist/zignal-stencil-library/assets/images/logo/zrmz.png +0 -0
  217. package/dist/zignal-stencil-library/index.esm.js +1 -1
  218. package/dist/zignal-stencil-library/p-3dbfff3e.entry.js +2 -0
  219. package/dist/zignal-stencil-library/p-BnUowDzX.js +2 -0
  220. package/dist/zignal-stencil-library/p-DkxQAqgZ.js +1 -0
  221. package/dist/zignal-stencil-library/p-d7e0e728.entry.js +1 -0
  222. package/dist/zignal-stencil-library/p-vZoeheUl.js +1 -0
  223. package/dist/zignal-stencil-library/zignal-stencil-library.esm.js +1 -1
  224. package/package.json +1 -1
  225. package/dist/cjs/autocomplete-address_43.cjs.entry.js +0 -19868
  226. package/dist/components/p--2uPh98m.js +0 -173
  227. package/dist/components/p-4VtRaJ3s.js +0 -107
  228. package/dist/components/p-5oC4CRoP.js +0 -231
  229. package/dist/components/p-7jJKln0k.js +0 -155
  230. package/dist/components/p-B16voarw.js +0 -133
  231. package/dist/components/p-BFIFTMrY.js +0 -158
  232. package/dist/components/p-BGVN7Drg.js +0 -107
  233. package/dist/components/p-BH7MWaEm.js +0 -223
  234. package/dist/components/p-BQQE__zQ.js +0 -129
  235. package/dist/components/p-BTD3J3v6.js +0 -138
  236. package/dist/components/p-BX8sKLQ-.js +0 -148
  237. package/dist/components/p-BcnssswI.js +0 -32
  238. package/dist/components/p-BlDBX6wD.js +0 -133
  239. package/dist/components/p-Busq9xrD.js +0 -98
  240. package/dist/components/p-C9qH4kP3.js +0 -156
  241. package/dist/components/p-CBXm2OUy.js +0 -171
  242. package/dist/components/p-CHNajXFB.js +0 -701
  243. package/dist/components/p-CPZ9nOuH.js +0 -122
  244. package/dist/components/p-CW7_-hzK.js +0 -119
  245. package/dist/components/p-CdCDpC3-.js +0 -515
  246. package/dist/components/p-Cqfc6ySc.js +0 -135
  247. package/dist/components/p-D0Tke46Z.js +0 -121
  248. package/dist/components/p-D8-aPJYM.js +0 -74
  249. package/dist/components/p-DAoGutlB.js +0 -76
  250. package/dist/components/p-DPDx5rQM.js +0 -155
  251. package/dist/components/p-DaHmsqbO.js +0 -563
  252. package/dist/components/p-DcCoy5TC.js +0 -20
  253. package/dist/components/p-DhApSoyQ.js +0 -96
  254. package/dist/components/p-DhdQ-c2r.js +0 -214
  255. package/dist/components/p-Ds96RINY.js +0 -57
  256. package/dist/components/p-DxfQE8Dx.js +0 -108
  257. package/dist/components/p-Ij2dsIQ1.js +0 -2191
  258. package/dist/components/p-NqAhrUkX.js +0 -51
  259. package/dist/components/p-PjOxwy5b.js +0 -140
  260. package/dist/components/p-Wi-CJLal.js +0 -578
  261. package/dist/components/p-XNRZVnJm.js +0 -184
  262. package/dist/components/p-ZKLMD3_O.js +0 -102
  263. package/dist/components/p-fQie6nmM.js +0 -308
  264. package/dist/components/p-wiDfZE6o.js +0 -554
  265. package/dist/components/p-zreJIOvq.js +0 -599
  266. package/dist/esm/autocomplete-address_43.entry.js +0 -19824
  267. package/dist/zignal-stencil-library/p-9b4f0480.entry.js +0 -2
  268. package/dist/zignal-stencil-library/p-BsYB8kV0.js +0 -1
  269. package/dist/zignal-stencil-library/p-DZsPtXDQ.js +0 -1
  270. package/dist/zignal-stencil-library/p-DrJU7-bz.js +0 -2
  271. package/dist/zignal-stencil-library/p-c0c25f33.entry.js +0 -1
@@ -1,5 +1,2193 @@
1
- export { b as getAssetPath, r as render, s as setAssetPath, d as setNonce, e as setPlatformOptions } from './p-BsVBC0QF.js';
2
- import { i as instance } from './p-Ij2dsIQ1.js';
1
+ export { b as getAssetPath, r as render, s as setAssetPath, d as setNonce, e as setPlatformOptions } from './p-DRz4sc4i.js';
2
+
3
+ const isString = obj => typeof obj === 'string';
4
+ const defer = () => {
5
+ let res;
6
+ let rej;
7
+ const promise = new Promise((resolve, reject) => {
8
+ res = resolve;
9
+ rej = reject;
10
+ });
11
+ promise.resolve = res;
12
+ promise.reject = rej;
13
+ return promise;
14
+ };
15
+ const makeString = object => {
16
+ if (object == null) return '';
17
+ return '' + object;
18
+ };
19
+ const copy = (a, s, t) => {
20
+ a.forEach(m => {
21
+ if (s[m]) t[m] = s[m];
22
+ });
23
+ };
24
+ const lastOfPathSeparatorRegExp = /###/g;
25
+ const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
26
+ const canNotTraverseDeeper = object => !object || isString(object);
27
+ const getLastOfPath = (object, path, Empty) => {
28
+ const stack = !isString(path) ? path : path.split('.');
29
+ let stackIndex = 0;
30
+ while (stackIndex < stack.length - 1) {
31
+ if (canNotTraverseDeeper(object)) return {};
32
+ const key = cleanKey(stack[stackIndex]);
33
+ if (!object[key] && Empty) object[key] = new Empty();
34
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
35
+ object = object[key];
36
+ } else {
37
+ object = {};
38
+ }
39
+ ++stackIndex;
40
+ }
41
+ if (canNotTraverseDeeper(object)) return {};
42
+ return {
43
+ obj: object,
44
+ k: cleanKey(stack[stackIndex])
45
+ };
46
+ };
47
+ const setPath = (object, path, newValue) => {
48
+ const {
49
+ obj,
50
+ k
51
+ } = getLastOfPath(object, path, Object);
52
+ if (obj !== undefined || path.length === 1) {
53
+ obj[k] = newValue;
54
+ return;
55
+ }
56
+ let e = path[path.length - 1];
57
+ let p = path.slice(0, path.length - 1);
58
+ let last = getLastOfPath(object, p, Object);
59
+ while (last.obj === undefined && p.length) {
60
+ e = `${p[p.length - 1]}.${e}`;
61
+ p = p.slice(0, p.length - 1);
62
+ last = getLastOfPath(object, p, Object);
63
+ if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {
64
+ last.obj = undefined;
65
+ }
66
+ }
67
+ last.obj[`${last.k}.${e}`] = newValue;
68
+ };
69
+ const pushPath = (object, path, newValue, concat) => {
70
+ const {
71
+ obj,
72
+ k
73
+ } = getLastOfPath(object, path, Object);
74
+ obj[k] = obj[k] || [];
75
+ obj[k].push(newValue);
76
+ };
77
+ const getPath = (object, path) => {
78
+ const {
79
+ obj,
80
+ k
81
+ } = getLastOfPath(object, path);
82
+ if (!obj) return undefined;
83
+ if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined;
84
+ return obj[k];
85
+ };
86
+ const getPathWithDefaults = (data, defaultData, key) => {
87
+ const value = getPath(data, key);
88
+ if (value !== undefined) {
89
+ return value;
90
+ }
91
+ return getPath(defaultData, key);
92
+ };
93
+ const deepExtend = (target, source, overwrite) => {
94
+ for (const prop in source) {
95
+ if (prop !== '__proto__' && prop !== 'constructor') {
96
+ if (prop in target) {
97
+ if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
98
+ if (overwrite) target[prop] = source[prop];
99
+ } else {
100
+ deepExtend(target[prop], source[prop], overwrite);
101
+ }
102
+ } else {
103
+ target[prop] = source[prop];
104
+ }
105
+ }
106
+ }
107
+ return target;
108
+ };
109
+ const regexEscape = str => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
110
+ var _entityMap = {
111
+ '&': '&amp;',
112
+ '<': '&lt;',
113
+ '>': '&gt;',
114
+ '"': '&quot;',
115
+ "'": '&#39;',
116
+ '/': '&#x2F;'
117
+ };
118
+ const escape = data => {
119
+ if (isString(data)) {
120
+ return data.replace(/[&<>"'\/]/g, s => _entityMap[s]);
121
+ }
122
+ return data;
123
+ };
124
+ class RegExpCache {
125
+ constructor(capacity) {
126
+ this.capacity = capacity;
127
+ this.regExpMap = new Map();
128
+ this.regExpQueue = [];
129
+ }
130
+ getRegExp(pattern) {
131
+ const regExpFromCache = this.regExpMap.get(pattern);
132
+ if (regExpFromCache !== undefined) {
133
+ return regExpFromCache;
134
+ }
135
+ const regExpNew = new RegExp(pattern);
136
+ if (this.regExpQueue.length === this.capacity) {
137
+ this.regExpMap.delete(this.regExpQueue.shift());
138
+ }
139
+ this.regExpMap.set(pattern, regExpNew);
140
+ this.regExpQueue.push(pattern);
141
+ return regExpNew;
142
+ }
143
+ }
144
+ const chars = [' ', ',', '?', '!', ';'];
145
+ const looksLikeObjectPathRegExpCache = new RegExpCache(20);
146
+ const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
147
+ nsSeparator = nsSeparator || '';
148
+ keySeparator = keySeparator || '';
149
+ const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
150
+ if (possibleChars.length === 0) return true;
151
+ const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
152
+ let matched = !r.test(key);
153
+ if (!matched) {
154
+ const ki = key.indexOf(keySeparator);
155
+ if (ki > 0 && !r.test(key.substring(0, ki))) {
156
+ matched = true;
157
+ }
158
+ }
159
+ return matched;
160
+ };
161
+ const deepFind = (obj, path, keySeparator = '.') => {
162
+ if (!obj) return undefined;
163
+ if (obj[path]) {
164
+ if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;
165
+ return obj[path];
166
+ }
167
+ const tokens = path.split(keySeparator);
168
+ let current = obj;
169
+ for (let i = 0; i < tokens.length;) {
170
+ if (!current || typeof current !== 'object') {
171
+ return undefined;
172
+ }
173
+ let next;
174
+ let nextPath = '';
175
+ for (let j = i; j < tokens.length; ++j) {
176
+ if (j !== i) {
177
+ nextPath += keySeparator;
178
+ }
179
+ nextPath += tokens[j];
180
+ next = current[nextPath];
181
+ if (next !== undefined) {
182
+ if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {
183
+ continue;
184
+ }
185
+ i += j - i + 1;
186
+ break;
187
+ }
188
+ }
189
+ current = next;
190
+ }
191
+ return current;
192
+ };
193
+ const getCleanedCode = code => code?.replace('_', '-');
194
+
195
+ const consoleLogger = {
196
+ type: 'logger',
197
+ log(args) {
198
+ this.output('log', args);
199
+ },
200
+ warn(args) {
201
+ this.output('warn', args);
202
+ },
203
+ error(args) {
204
+ this.output('error', args);
205
+ },
206
+ output(type, args) {
207
+ console?.[type]?.apply?.(console, args);
208
+ }
209
+ };
210
+ class Logger {
211
+ constructor(concreteLogger, options = {}) {
212
+ this.init(concreteLogger, options);
213
+ }
214
+ init(concreteLogger, options = {}) {
215
+ this.prefix = options.prefix || 'i18next:';
216
+ this.logger = concreteLogger || consoleLogger;
217
+ this.options = options;
218
+ this.debug = options.debug;
219
+ }
220
+ log(...args) {
221
+ return this.forward(args, 'log', '', true);
222
+ }
223
+ warn(...args) {
224
+ return this.forward(args, 'warn', '', true);
225
+ }
226
+ error(...args) {
227
+ return this.forward(args, 'error', '');
228
+ }
229
+ deprecate(...args) {
230
+ return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
231
+ }
232
+ forward(args, lvl, prefix, debugOnly) {
233
+ if (debugOnly && !this.debug) return null;
234
+ if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
235
+ return this.logger[lvl](args);
236
+ }
237
+ create(moduleName) {
238
+ return new Logger(this.logger, {
239
+ ...{
240
+ prefix: `${this.prefix}:${moduleName}:`
241
+ },
242
+ ...this.options
243
+ });
244
+ }
245
+ clone(options) {
246
+ options = options || this.options;
247
+ options.prefix = options.prefix || this.prefix;
248
+ return new Logger(this.logger, options);
249
+ }
250
+ }
251
+ var baseLogger = new Logger();
252
+
253
+ class EventEmitter {
254
+ constructor() {
255
+ this.observers = {};
256
+ }
257
+ on(events, listener) {
258
+ events.split(' ').forEach(event => {
259
+ if (!this.observers[event]) this.observers[event] = new Map();
260
+ const numListeners = this.observers[event].get(listener) || 0;
261
+ this.observers[event].set(listener, numListeners + 1);
262
+ });
263
+ return this;
264
+ }
265
+ off(event, listener) {
266
+ if (!this.observers[event]) return;
267
+ if (!listener) {
268
+ delete this.observers[event];
269
+ return;
270
+ }
271
+ this.observers[event].delete(listener);
272
+ }
273
+ emit(event, ...args) {
274
+ if (this.observers[event]) {
275
+ const cloned = Array.from(this.observers[event].entries());
276
+ cloned.forEach(([observer, numTimesAdded]) => {
277
+ for (let i = 0; i < numTimesAdded; i++) {
278
+ observer(...args);
279
+ }
280
+ });
281
+ }
282
+ if (this.observers['*']) {
283
+ const cloned = Array.from(this.observers['*'].entries());
284
+ cloned.forEach(([observer, numTimesAdded]) => {
285
+ for (let i = 0; i < numTimesAdded; i++) {
286
+ observer.apply(observer, [event, ...args]);
287
+ }
288
+ });
289
+ }
290
+ }
291
+ }
292
+
293
+ class ResourceStore extends EventEmitter {
294
+ constructor(data, options = {
295
+ ns: ['translation'],
296
+ defaultNS: 'translation'
297
+ }) {
298
+ super();
299
+ this.data = data || {};
300
+ this.options = options;
301
+ if (this.options.keySeparator === undefined) {
302
+ this.options.keySeparator = '.';
303
+ }
304
+ if (this.options.ignoreJSONStructure === undefined) {
305
+ this.options.ignoreJSONStructure = true;
306
+ }
307
+ }
308
+ addNamespaces(ns) {
309
+ if (this.options.ns.indexOf(ns) < 0) {
310
+ this.options.ns.push(ns);
311
+ }
312
+ }
313
+ removeNamespaces(ns) {
314
+ const index = this.options.ns.indexOf(ns);
315
+ if (index > -1) {
316
+ this.options.ns.splice(index, 1);
317
+ }
318
+ }
319
+ getResource(lng, ns, key, options = {}) {
320
+ const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
321
+ const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
322
+ let path;
323
+ if (lng.indexOf('.') > -1) {
324
+ path = lng.split('.');
325
+ } else {
326
+ path = [lng, ns];
327
+ if (key) {
328
+ if (Array.isArray(key)) {
329
+ path.push(...key);
330
+ } else if (isString(key) && keySeparator) {
331
+ path.push(...key.split(keySeparator));
332
+ } else {
333
+ path.push(key);
334
+ }
335
+ }
336
+ }
337
+ const result = getPath(this.data, path);
338
+ if (!result && !ns && !key && lng.indexOf('.') > -1) {
339
+ lng = path[0];
340
+ ns = path[1];
341
+ key = path.slice(2).join('.');
342
+ }
343
+ if (result || !ignoreJSONStructure || !isString(key)) return result;
344
+ return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
345
+ }
346
+ addResource(lng, ns, key, value, options = {
347
+ silent: false
348
+ }) {
349
+ const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
350
+ let path = [lng, ns];
351
+ if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
352
+ if (lng.indexOf('.') > -1) {
353
+ path = lng.split('.');
354
+ value = ns;
355
+ ns = path[1];
356
+ }
357
+ this.addNamespaces(ns);
358
+ setPath(this.data, path, value);
359
+ if (!options.silent) this.emit('added', lng, ns, key, value);
360
+ }
361
+ addResources(lng, ns, resources, options = {
362
+ silent: false
363
+ }) {
364
+ for (const m in resources) {
365
+ if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
366
+ silent: true
367
+ });
368
+ }
369
+ if (!options.silent) this.emit('added', lng, ns, resources);
370
+ }
371
+ addResourceBundle(lng, ns, resources, deep, overwrite, options = {
372
+ silent: false,
373
+ skipCopy: false
374
+ }) {
375
+ let path = [lng, ns];
376
+ if (lng.indexOf('.') > -1) {
377
+ path = lng.split('.');
378
+ deep = resources;
379
+ resources = ns;
380
+ ns = path[1];
381
+ }
382
+ this.addNamespaces(ns);
383
+ let pack = getPath(this.data, path) || {};
384
+ if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
385
+ if (deep) {
386
+ deepExtend(pack, resources, overwrite);
387
+ } else {
388
+ pack = {
389
+ ...pack,
390
+ ...resources
391
+ };
392
+ }
393
+ setPath(this.data, path, pack);
394
+ if (!options.silent) this.emit('added', lng, ns, resources);
395
+ }
396
+ removeResourceBundle(lng, ns) {
397
+ if (this.hasResourceBundle(lng, ns)) {
398
+ delete this.data[lng][ns];
399
+ }
400
+ this.removeNamespaces(ns);
401
+ this.emit('removed', lng, ns);
402
+ }
403
+ hasResourceBundle(lng, ns) {
404
+ return this.getResource(lng, ns) !== undefined;
405
+ }
406
+ getResourceBundle(lng, ns) {
407
+ if (!ns) ns = this.options.defaultNS;
408
+ return this.getResource(lng, ns);
409
+ }
410
+ getDataByLanguage(lng) {
411
+ return this.data[lng];
412
+ }
413
+ hasLanguageSomeTranslations(lng) {
414
+ const data = this.getDataByLanguage(lng);
415
+ const n = data && Object.keys(data) || [];
416
+ return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);
417
+ }
418
+ toJSON() {
419
+ return this.data;
420
+ }
421
+ }
422
+
423
+ var postProcessor = {
424
+ processors: {},
425
+ addPostProcessor(module) {
426
+ this.processors[module.name] = module;
427
+ },
428
+ handle(processors, value, key, options, translator) {
429
+ processors.forEach(processor => {
430
+ value = this.processors[processor]?.process(value, key, options, translator) ?? value;
431
+ });
432
+ return value;
433
+ }
434
+ };
435
+
436
+ const PATH_KEY = Symbol('i18next/PATH_KEY');
437
+ function createProxy() {
438
+ const state = [];
439
+ const handler = Object.create(null);
440
+ let proxy;
441
+ handler.get = (target, key) => {
442
+ proxy?.revoke?.();
443
+ if (key === PATH_KEY) return state;
444
+ state.push(key);
445
+ proxy = Proxy.revocable(target, handler);
446
+ return proxy.proxy;
447
+ };
448
+ return Proxy.revocable(Object.create(null), handler).proxy;
449
+ }
450
+ function keysFromSelector(selector, opts) {
451
+ const {
452
+ [PATH_KEY]: path
453
+ } = selector(createProxy());
454
+ return path.join(opts?.keySeparator ?? '.');
455
+ }
456
+
457
+ const checkedLoadedFor = {};
458
+ const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
459
+ class Translator extends EventEmitter {
460
+ constructor(services, options = {}) {
461
+ super();
462
+ copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);
463
+ this.options = options;
464
+ if (this.options.keySeparator === undefined) {
465
+ this.options.keySeparator = '.';
466
+ }
467
+ this.logger = baseLogger.create('translator');
468
+ }
469
+ changeLanguage(lng) {
470
+ if (lng) this.language = lng;
471
+ }
472
+ exists(key, o = {
473
+ interpolation: {}
474
+ }) {
475
+ const opt = {
476
+ ...o
477
+ };
478
+ if (key == null) return false;
479
+ const resolved = this.resolve(key, opt);
480
+ if (resolved?.res === undefined) return false;
481
+ const isObject = shouldHandleAsObject(resolved.res);
482
+ if (opt.returnObjects === false && isObject) {
483
+ return false;
484
+ }
485
+ return true;
486
+ }
487
+ extractFromKey(key, opt) {
488
+ let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
489
+ if (nsSeparator === undefined) nsSeparator = ':';
490
+ const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
491
+ let namespaces = opt.ns || this.options.defaultNS || [];
492
+ const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
493
+ const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
494
+ if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
495
+ const m = key.match(this.interpolator.nestingRegexp);
496
+ if (m && m.length > 0) {
497
+ return {
498
+ key,
499
+ namespaces: isString(namespaces) ? [namespaces] : namespaces
500
+ };
501
+ }
502
+ const parts = key.split(nsSeparator);
503
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
504
+ key = parts.join(keySeparator);
505
+ }
506
+ return {
507
+ key,
508
+ namespaces: isString(namespaces) ? [namespaces] : namespaces
509
+ };
510
+ }
511
+ translate(keys, o, lastKey) {
512
+ let opt = typeof o === 'object' ? {
513
+ ...o
514
+ } : o;
515
+ if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) {
516
+ opt = this.options.overloadTranslationOptionHandler(arguments);
517
+ }
518
+ if (typeof opt === 'object') opt = {
519
+ ...opt
520
+ };
521
+ if (!opt) opt = {};
522
+ if (keys == null) return '';
523
+ if (typeof keys === 'function') keys = keysFromSelector(keys, {
524
+ ...this.options,
525
+ ...opt
526
+ });
527
+ if (!Array.isArray(keys)) keys = [String(keys)];
528
+ const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
529
+ const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
530
+ const {
531
+ key,
532
+ namespaces
533
+ } = this.extractFromKey(keys[keys.length - 1], opt);
534
+ const namespace = namespaces[namespaces.length - 1];
535
+ let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
536
+ if (nsSeparator === undefined) nsSeparator = ':';
537
+ const lng = opt.lng || this.language;
538
+ const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
539
+ if (lng?.toLowerCase() === 'cimode') {
540
+ if (appendNamespaceToCIMode) {
541
+ if (returnDetails) {
542
+ return {
543
+ res: `${namespace}${nsSeparator}${key}`,
544
+ usedKey: key,
545
+ exactUsedKey: key,
546
+ usedLng: lng,
547
+ usedNS: namespace,
548
+ usedParams: this.getUsedParamsDetails(opt)
549
+ };
550
+ }
551
+ return `${namespace}${nsSeparator}${key}`;
552
+ }
553
+ if (returnDetails) {
554
+ return {
555
+ res: key,
556
+ usedKey: key,
557
+ exactUsedKey: key,
558
+ usedLng: lng,
559
+ usedNS: namespace,
560
+ usedParams: this.getUsedParamsDetails(opt)
561
+ };
562
+ }
563
+ return key;
564
+ }
565
+ const resolved = this.resolve(keys, opt);
566
+ let res = resolved?.res;
567
+ const resUsedKey = resolved?.usedKey || key;
568
+ const resExactUsedKey = resolved?.exactUsedKey || key;
569
+ const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
570
+ const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;
571
+ const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
572
+ const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
573
+ const hasDefaultValue = Translator.hasDefaultValue(opt);
574
+ const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : '';
575
+ const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
576
+ ordinal: false
577
+ }) : '';
578
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
579
+ const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
580
+ let resForObjHndl = res;
581
+ if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
582
+ resForObjHndl = defaultValue;
583
+ }
584
+ const handleAsObject = shouldHandleAsObject(resForObjHndl);
585
+ const resType = Object.prototype.toString.apply(resForObjHndl);
586
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
587
+ if (!opt.returnObjects && !this.options.returnObjects) {
588
+ if (!this.options.returnedObjectHandler) {
589
+ this.logger.warn('accessing an object - but returnObjects options is not enabled!');
590
+ }
591
+ const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
592
+ ...opt,
593
+ ns: namespaces
594
+ }) : `key '${key} (${this.language})' returned an object instead of string.`;
595
+ if (returnDetails) {
596
+ resolved.res = r;
597
+ resolved.usedParams = this.getUsedParamsDetails(opt);
598
+ return resolved;
599
+ }
600
+ return r;
601
+ }
602
+ if (keySeparator) {
603
+ const resTypeIsArray = Array.isArray(resForObjHndl);
604
+ const copy = resTypeIsArray ? [] : {};
605
+ const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
606
+ for (const m in resForObjHndl) {
607
+ if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
608
+ const deepKey = `${newKeyToUse}${keySeparator}${m}`;
609
+ if (hasDefaultValue && !res) {
610
+ copy[m] = this.translate(deepKey, {
611
+ ...opt,
612
+ defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,
613
+ ...{
614
+ joinArrays: false,
615
+ ns: namespaces
616
+ }
617
+ });
618
+ } else {
619
+ copy[m] = this.translate(deepKey, {
620
+ ...opt,
621
+ ...{
622
+ joinArrays: false,
623
+ ns: namespaces
624
+ }
625
+ });
626
+ }
627
+ if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
628
+ }
629
+ }
630
+ res = copy;
631
+ }
632
+ } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
633
+ res = res.join(joinArrays);
634
+ if (res) res = this.extendTranslation(res, keys, opt, lastKey);
635
+ } else {
636
+ let usedDefault = false;
637
+ let usedKey = false;
638
+ if (!this.isValidLookup(res) && hasDefaultValue) {
639
+ usedDefault = true;
640
+ res = defaultValue;
641
+ }
642
+ if (!this.isValidLookup(res)) {
643
+ usedKey = true;
644
+ res = key;
645
+ }
646
+ const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
647
+ const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
648
+ const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
649
+ if (usedKey || usedDefault || updateMissing) {
650
+ this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
651
+ if (keySeparator) {
652
+ const fk = this.resolve(key, {
653
+ ...opt,
654
+ keySeparator: false
655
+ });
656
+ 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.');
657
+ }
658
+ let lngs = [];
659
+ const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
660
+ if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
661
+ for (let i = 0; i < fallbackLngs.length; i++) {
662
+ lngs.push(fallbackLngs[i]);
663
+ }
664
+ } else if (this.options.saveMissingTo === 'all') {
665
+ lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
666
+ } else {
667
+ lngs.push(opt.lng || this.language);
668
+ }
669
+ const send = (l, k, specificDefaultValue) => {
670
+ const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
671
+ if (this.options.missingKeyHandler) {
672
+ this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
673
+ } else if (this.backendConnector?.saveMissing) {
674
+ this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
675
+ }
676
+ this.emit('missingKey', l, namespace, k, res);
677
+ };
678
+ if (this.options.saveMissing) {
679
+ if (this.options.saveMissingPlurals && needsPluralHandling) {
680
+ lngs.forEach(language => {
681
+ const suffixes = this.pluralResolver.getSuffixes(language, opt);
682
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
683
+ suffixes.push(`${this.options.pluralSeparator}zero`);
684
+ }
685
+ suffixes.forEach(suffix => {
686
+ send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
687
+ });
688
+ });
689
+ } else {
690
+ send(lngs, key, defaultValue);
691
+ }
692
+ }
693
+ }
694
+ res = this.extendTranslation(res, keys, opt, resolved, lastKey);
695
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
696
+ res = `${namespace}${nsSeparator}${key}`;
697
+ }
698
+ if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
699
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
700
+ }
701
+ }
702
+ if (returnDetails) {
703
+ resolved.res = res;
704
+ resolved.usedParams = this.getUsedParamsDetails(opt);
705
+ return resolved;
706
+ }
707
+ return res;
708
+ }
709
+ extendTranslation(res, key, opt, resolved, lastKey) {
710
+ if (this.i18nFormat?.parse) {
711
+ res = this.i18nFormat.parse(res, {
712
+ ...this.options.interpolation.defaultVariables,
713
+ ...opt
714
+ }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
715
+ resolved
716
+ });
717
+ } else if (!opt.skipInterpolation) {
718
+ if (opt.interpolation) this.interpolator.init({
719
+ ...opt,
720
+ ...{
721
+ interpolation: {
722
+ ...this.options.interpolation,
723
+ ...opt.interpolation
724
+ }
725
+ }
726
+ });
727
+ const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
728
+ let nestBef;
729
+ if (skipOnVariables) {
730
+ const nb = res.match(this.interpolator.nestingRegexp);
731
+ nestBef = nb && nb.length;
732
+ }
733
+ let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
734
+ if (this.options.interpolation.defaultVariables) data = {
735
+ ...this.options.interpolation.defaultVariables,
736
+ ...data
737
+ };
738
+ res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
739
+ if (skipOnVariables) {
740
+ const na = res.match(this.interpolator.nestingRegexp);
741
+ const nestAft = na && na.length;
742
+ if (nestBef < nestAft) opt.nest = false;
743
+ }
744
+ if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
745
+ if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
746
+ if (lastKey?.[0] === args[0] && !opt.context) {
747
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
748
+ return null;
749
+ }
750
+ return this.translate(...args, key);
751
+ }, opt);
752
+ if (opt.interpolation) this.interpolator.reset();
753
+ }
754
+ const postProcess = opt.postProcess || this.options.postProcess;
755
+ const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
756
+ if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
757
+ res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
758
+ i18nResolved: {
759
+ ...resolved,
760
+ usedParams: this.getUsedParamsDetails(opt)
761
+ },
762
+ ...opt
763
+ } : opt, this);
764
+ }
765
+ return res;
766
+ }
767
+ resolve(keys, opt = {}) {
768
+ let found;
769
+ let usedKey;
770
+ let exactUsedKey;
771
+ let usedLng;
772
+ let usedNS;
773
+ if (isString(keys)) keys = [keys];
774
+ keys.forEach(k => {
775
+ if (this.isValidLookup(found)) return;
776
+ const extracted = this.extractFromKey(k, opt);
777
+ const key = extracted.key;
778
+ usedKey = key;
779
+ let namespaces = extracted.namespaces;
780
+ if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
781
+ const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
782
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
783
+ const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === 'number') && opt.context !== '';
784
+ const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
785
+ namespaces.forEach(ns => {
786
+ if (this.isValidLookup(found)) return;
787
+ usedNS = ns;
788
+ if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
789
+ checkedLoadedFor[`${codes[0]}-${ns}`] = true;
790
+ 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!!!');
791
+ }
792
+ codes.forEach(code => {
793
+ if (this.isValidLookup(found)) return;
794
+ usedLng = code;
795
+ const finalKeys = [key];
796
+ if (this.i18nFormat?.addLookupKeys) {
797
+ this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
798
+ } else {
799
+ let pluralSuffix;
800
+ if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
801
+ const zeroSuffix = `${this.options.pluralSeparator}zero`;
802
+ const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
803
+ if (needsPluralHandling) {
804
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
805
+ finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
806
+ }
807
+ finalKeys.push(key + pluralSuffix);
808
+ if (needsZeroSuffixLookup) {
809
+ finalKeys.push(key + zeroSuffix);
810
+ }
811
+ }
812
+ if (needsContextHandling) {
813
+ const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`;
814
+ finalKeys.push(contextKey);
815
+ if (needsPluralHandling) {
816
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
817
+ finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
818
+ }
819
+ finalKeys.push(contextKey + pluralSuffix);
820
+ if (needsZeroSuffixLookup) {
821
+ finalKeys.push(contextKey + zeroSuffix);
822
+ }
823
+ }
824
+ }
825
+ }
826
+ let possibleKey;
827
+ while (possibleKey = finalKeys.pop()) {
828
+ if (!this.isValidLookup(found)) {
829
+ exactUsedKey = possibleKey;
830
+ found = this.getResource(code, ns, possibleKey, opt);
831
+ }
832
+ }
833
+ });
834
+ });
835
+ });
836
+ return {
837
+ res: found,
838
+ usedKey,
839
+ exactUsedKey,
840
+ usedLng,
841
+ usedNS
842
+ };
843
+ }
844
+ isValidLookup(res) {
845
+ return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
846
+ }
847
+ getResource(code, ns, key, options = {}) {
848
+ if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
849
+ return this.resourceStore.getResource(code, ns, key, options);
850
+ }
851
+ getUsedParamsDetails(options = {}) {
852
+ const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
853
+ const useOptionsReplaceForData = options.replace && !isString(options.replace);
854
+ let data = useOptionsReplaceForData ? options.replace : options;
855
+ if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
856
+ data.count = options.count;
857
+ }
858
+ if (this.options.interpolation.defaultVariables) {
859
+ data = {
860
+ ...this.options.interpolation.defaultVariables,
861
+ ...data
862
+ };
863
+ }
864
+ if (!useOptionsReplaceForData) {
865
+ data = {
866
+ ...data
867
+ };
868
+ for (const key of optionsKeys) {
869
+ delete data[key];
870
+ }
871
+ }
872
+ return data;
873
+ }
874
+ static hasDefaultValue(options) {
875
+ const prefix = 'defaultValue';
876
+ for (const option in options) {
877
+ if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
878
+ return true;
879
+ }
880
+ }
881
+ return false;
882
+ }
883
+ }
884
+
885
+ class LanguageUtil {
886
+ constructor(options) {
887
+ this.options = options;
888
+ this.supportedLngs = this.options.supportedLngs || false;
889
+ this.logger = baseLogger.create('languageUtils');
890
+ }
891
+ getScriptPartFromCode(code) {
892
+ code = getCleanedCode(code);
893
+ if (!code || code.indexOf('-') < 0) return null;
894
+ const p = code.split('-');
895
+ if (p.length === 2) return null;
896
+ p.pop();
897
+ if (p[p.length - 1].toLowerCase() === 'x') return null;
898
+ return this.formatLanguageCode(p.join('-'));
899
+ }
900
+ getLanguagePartFromCode(code) {
901
+ code = getCleanedCode(code);
902
+ if (!code || code.indexOf('-') < 0) return code;
903
+ const p = code.split('-');
904
+ return this.formatLanguageCode(p[0]);
905
+ }
906
+ formatLanguageCode(code) {
907
+ if (isString(code) && code.indexOf('-') > -1) {
908
+ let formattedCode;
909
+ try {
910
+ formattedCode = Intl.getCanonicalLocales(code)[0];
911
+ } catch (e) {}
912
+ if (formattedCode && this.options.lowerCaseLng) {
913
+ formattedCode = formattedCode.toLowerCase();
914
+ }
915
+ if (formattedCode) return formattedCode;
916
+ if (this.options.lowerCaseLng) {
917
+ return code.toLowerCase();
918
+ }
919
+ return code;
920
+ }
921
+ return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
922
+ }
923
+ isSupportedCode(code) {
924
+ if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
925
+ code = this.getLanguagePartFromCode(code);
926
+ }
927
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
928
+ }
929
+ getBestMatchFromCodes(codes) {
930
+ if (!codes) return null;
931
+ let found;
932
+ codes.forEach(code => {
933
+ if (found) return;
934
+ const cleanedLng = this.formatLanguageCode(code);
935
+ if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
936
+ });
937
+ if (!found && this.options.supportedLngs) {
938
+ codes.forEach(code => {
939
+ if (found) return;
940
+ const lngScOnly = this.getScriptPartFromCode(code);
941
+ if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;
942
+ const lngOnly = this.getLanguagePartFromCode(code);
943
+ if (this.isSupportedCode(lngOnly)) return found = lngOnly;
944
+ found = this.options.supportedLngs.find(supportedLng => {
945
+ if (supportedLng === lngOnly) return supportedLng;
946
+ if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
947
+ if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;
948
+ if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
949
+ });
950
+ });
951
+ }
952
+ if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
953
+ return found;
954
+ }
955
+ getFallbackCodes(fallbacks, code) {
956
+ if (!fallbacks) return [];
957
+ if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
958
+ if (isString(fallbacks)) fallbacks = [fallbacks];
959
+ if (Array.isArray(fallbacks)) return fallbacks;
960
+ if (!code) return fallbacks.default || [];
961
+ let found = fallbacks[code];
962
+ if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
963
+ if (!found) found = fallbacks[this.formatLanguageCode(code)];
964
+ if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
965
+ if (!found) found = fallbacks.default;
966
+ return found || [];
967
+ }
968
+ toResolveHierarchy(code, fallbackCode) {
969
+ const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
970
+ const codes = [];
971
+ const addCode = c => {
972
+ if (!c) return;
973
+ if (this.isSupportedCode(c)) {
974
+ codes.push(c);
975
+ } else {
976
+ this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
977
+ }
978
+ };
979
+ if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
980
+ if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
981
+ if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
982
+ if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
983
+ } else if (isString(code)) {
984
+ addCode(this.formatLanguageCode(code));
985
+ }
986
+ fallbackCodes.forEach(fc => {
987
+ if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
988
+ });
989
+ return codes;
990
+ }
991
+ }
992
+
993
+ const suffixesOrder = {
994
+ zero: 0,
995
+ one: 1,
996
+ two: 2,
997
+ few: 3,
998
+ many: 4,
999
+ other: 5
1000
+ };
1001
+ const dummyRule = {
1002
+ select: count => count === 1 ? 'one' : 'other',
1003
+ resolvedOptions: () => ({
1004
+ pluralCategories: ['one', 'other']
1005
+ })
1006
+ };
1007
+ class PluralResolver {
1008
+ constructor(languageUtils, options = {}) {
1009
+ this.languageUtils = languageUtils;
1010
+ this.options = options;
1011
+ this.logger = baseLogger.create('pluralResolver');
1012
+ this.pluralRulesCache = {};
1013
+ }
1014
+ addRule(lng, obj) {
1015
+ this.rules[lng] = obj;
1016
+ }
1017
+ clearCache() {
1018
+ this.pluralRulesCache = {};
1019
+ }
1020
+ getRule(code, options = {}) {
1021
+ const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code);
1022
+ const type = options.ordinal ? 'ordinal' : 'cardinal';
1023
+ const cacheKey = JSON.stringify({
1024
+ cleanedCode,
1025
+ type
1026
+ });
1027
+ if (cacheKey in this.pluralRulesCache) {
1028
+ return this.pluralRulesCache[cacheKey];
1029
+ }
1030
+ let rule;
1031
+ try {
1032
+ rule = new Intl.PluralRules(cleanedCode, {
1033
+ type
1034
+ });
1035
+ } catch (err) {
1036
+ if (!Intl) {
1037
+ this.logger.error('No Intl support, please use an Intl polyfill!');
1038
+ return dummyRule;
1039
+ }
1040
+ if (!code.match(/-|_/)) return dummyRule;
1041
+ const lngPart = this.languageUtils.getLanguagePartFromCode(code);
1042
+ rule = this.getRule(lngPart, options);
1043
+ }
1044
+ this.pluralRulesCache[cacheKey] = rule;
1045
+ return rule;
1046
+ }
1047
+ needsPlural(code, options = {}) {
1048
+ let rule = this.getRule(code, options);
1049
+ if (!rule) rule = this.getRule('dev', options);
1050
+ return rule?.resolvedOptions().pluralCategories.length > 1;
1051
+ }
1052
+ getPluralFormsOfKey(code, key, options = {}) {
1053
+ return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);
1054
+ }
1055
+ getSuffixes(code, options = {}) {
1056
+ let rule = this.getRule(code, options);
1057
+ if (!rule) rule = this.getRule('dev', options);
1058
+ if (!rule) return [];
1059
+ return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);
1060
+ }
1061
+ getSuffix(code, count, options = {}) {
1062
+ const rule = this.getRule(code, options);
1063
+ if (rule) {
1064
+ return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;
1065
+ }
1066
+ this.logger.warn(`no plural rule found for: ${code}`);
1067
+ return this.getSuffix('dev', count, options);
1068
+ }
1069
+ }
1070
+
1071
+ const deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true) => {
1072
+ let path = getPathWithDefaults(data, defaultData, key);
1073
+ if (!path && ignoreJSONStructure && isString(key)) {
1074
+ path = deepFind(data, key, keySeparator);
1075
+ if (path === undefined) path = deepFind(defaultData, key, keySeparator);
1076
+ }
1077
+ return path;
1078
+ };
1079
+ const regexSafe = val => val.replace(/\$/g, '$$$$');
1080
+ class Interpolator {
1081
+ constructor(options = {}) {
1082
+ this.logger = baseLogger.create('interpolator');
1083
+ this.options = options;
1084
+ this.format = options?.interpolation?.format || (value => value);
1085
+ this.init(options);
1086
+ }
1087
+ init(options = {}) {
1088
+ if (!options.interpolation) options.interpolation = {
1089
+ escapeValue: true
1090
+ };
1091
+ const {
1092
+ escape: escape$1,
1093
+ escapeValue,
1094
+ useRawValueToEscape,
1095
+ prefix,
1096
+ prefixEscaped,
1097
+ suffix,
1098
+ suffixEscaped,
1099
+ formatSeparator,
1100
+ unescapeSuffix,
1101
+ unescapePrefix,
1102
+ nestingPrefix,
1103
+ nestingPrefixEscaped,
1104
+ nestingSuffix,
1105
+ nestingSuffixEscaped,
1106
+ nestingOptionsSeparator,
1107
+ maxReplaces,
1108
+ alwaysFormat
1109
+ } = options.interpolation;
1110
+ this.escape = escape$1 !== undefined ? escape$1 : escape;
1111
+ this.escapeValue = escapeValue !== undefined ? escapeValue : true;
1112
+ this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
1113
+ this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{';
1114
+ this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}';
1115
+ this.formatSeparator = formatSeparator || ',';
1116
+ this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';
1117
+ this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';
1118
+ this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t(');
1119
+ this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')');
1120
+ this.nestingOptionsSeparator = nestingOptionsSeparator || ',';
1121
+ this.maxReplaces = maxReplaces || 1000;
1122
+ this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
1123
+ this.resetRegExp();
1124
+ }
1125
+ reset() {
1126
+ if (this.options) this.init(this.options);
1127
+ }
1128
+ resetRegExp() {
1129
+ const getOrResetRegExp = (existingRegExp, pattern) => {
1130
+ if (existingRegExp?.source === pattern) {
1131
+ existingRegExp.lastIndex = 0;
1132
+ return existingRegExp;
1133
+ }
1134
+ return new RegExp(pattern, 'g');
1135
+ };
1136
+ this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
1137
+ this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
1138
+ this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
1139
+ }
1140
+ interpolate(str, data, lng, options) {
1141
+ let match;
1142
+ let value;
1143
+ let replaces;
1144
+ const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1145
+ const handleFormat = key => {
1146
+ if (key.indexOf(this.formatSeparator) < 0) {
1147
+ const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
1148
+ return this.alwaysFormat ? this.format(path, undefined, lng, {
1149
+ ...options,
1150
+ ...data,
1151
+ interpolationkey: key
1152
+ }) : path;
1153
+ }
1154
+ const p = key.split(this.formatSeparator);
1155
+ const k = p.shift().trim();
1156
+ const f = p.join(this.formatSeparator).trim();
1157
+ return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
1158
+ ...options,
1159
+ ...data,
1160
+ interpolationkey: k
1161
+ });
1162
+ };
1163
+ this.resetRegExp();
1164
+ const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
1165
+ const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1166
+ const todos = [{
1167
+ regex: this.regexpUnescape,
1168
+ safeValue: val => regexSafe(val)
1169
+ }, {
1170
+ regex: this.regexp,
1171
+ safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
1172
+ }];
1173
+ todos.forEach(todo => {
1174
+ replaces = 0;
1175
+ while (match = todo.regex.exec(str)) {
1176
+ const matchedVar = match[1].trim();
1177
+ value = handleFormat(matchedVar);
1178
+ if (value === undefined) {
1179
+ if (typeof missingInterpolationHandler === 'function') {
1180
+ const temp = missingInterpolationHandler(str, match, options);
1181
+ value = isString(temp) ? temp : '';
1182
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1183
+ value = '';
1184
+ } else if (skipOnVariables) {
1185
+ value = match[0];
1186
+ continue;
1187
+ } else {
1188
+ this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
1189
+ value = '';
1190
+ }
1191
+ } else if (!isString(value) && !this.useRawValueToEscape) {
1192
+ value = makeString(value);
1193
+ }
1194
+ const safeValue = todo.safeValue(value);
1195
+ str = str.replace(match[0], safeValue);
1196
+ if (skipOnVariables) {
1197
+ todo.regex.lastIndex += value.length;
1198
+ todo.regex.lastIndex -= match[0].length;
1199
+ } else {
1200
+ todo.regex.lastIndex = 0;
1201
+ }
1202
+ replaces++;
1203
+ if (replaces >= this.maxReplaces) {
1204
+ break;
1205
+ }
1206
+ }
1207
+ });
1208
+ return str;
1209
+ }
1210
+ nest(str, fc, options = {}) {
1211
+ let match;
1212
+ let value;
1213
+ let clonedOptions;
1214
+ const handleHasOptions = (key, inheritedOptions) => {
1215
+ const sep = this.nestingOptionsSeparator;
1216
+ if (key.indexOf(sep) < 0) return key;
1217
+ const c = key.split(new RegExp(`${sep}[ ]*{`));
1218
+ let optionsString = `{${c[1]}`;
1219
+ key = c[0];
1220
+ optionsString = this.interpolate(optionsString, clonedOptions);
1221
+ const matchedSingleQuotes = optionsString.match(/'/g);
1222
+ const matchedDoubleQuotes = optionsString.match(/"/g);
1223
+ if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1224
+ optionsString = optionsString.replace(/'/g, '"');
1225
+ }
1226
+ try {
1227
+ clonedOptions = JSON.parse(optionsString);
1228
+ if (inheritedOptions) clonedOptions = {
1229
+ ...inheritedOptions,
1230
+ ...clonedOptions
1231
+ };
1232
+ } catch (e) {
1233
+ this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
1234
+ return `${key}${sep}${optionsString}`;
1235
+ }
1236
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
1237
+ return key;
1238
+ };
1239
+ while (match = this.nestingRegexp.exec(str)) {
1240
+ let formatters = [];
1241
+ clonedOptions = {
1242
+ ...options
1243
+ };
1244
+ clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1245
+ clonedOptions.applyPostProcessor = false;
1246
+ delete clonedOptions.defaultValue;
1247
+ const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf('}') + 1 : match[1].indexOf(this.formatSeparator);
1248
+ if (keyEndIndex !== -1) {
1249
+ formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map(elem => elem.trim()).filter(Boolean);
1250
+ match[1] = match[1].slice(0, keyEndIndex);
1251
+ }
1252
+ value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1253
+ if (value && match[0] === str && !isString(value)) return value;
1254
+ if (!isString(value)) value = makeString(value);
1255
+ if (!value) {
1256
+ this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
1257
+ value = '';
1258
+ }
1259
+ if (formatters.length) {
1260
+ value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
1261
+ ...options,
1262
+ interpolationkey: match[1].trim()
1263
+ }), value.trim());
1264
+ }
1265
+ str = str.replace(match[0], value);
1266
+ this.regexp.lastIndex = 0;
1267
+ }
1268
+ return str;
1269
+ }
1270
+ }
1271
+
1272
+ const parseFormatStr = formatStr => {
1273
+ let formatName = formatStr.toLowerCase().trim();
1274
+ const formatOptions = {};
1275
+ if (formatStr.indexOf('(') > -1) {
1276
+ const p = formatStr.split('(');
1277
+ formatName = p[0].toLowerCase().trim();
1278
+ const optStr = p[1].substring(0, p[1].length - 1);
1279
+ if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1280
+ if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1281
+ } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
1282
+ if (!formatOptions.range) formatOptions.range = optStr.trim();
1283
+ } else {
1284
+ const opts = optStr.split(';');
1285
+ opts.forEach(opt => {
1286
+ if (opt) {
1287
+ const [key, ...rest] = opt.split(':');
1288
+ const val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1289
+ const trimmedKey = key.trim();
1290
+ if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
1291
+ if (val === 'false') formatOptions[trimmedKey] = false;
1292
+ if (val === 'true') formatOptions[trimmedKey] = true;
1293
+ if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
1294
+ }
1295
+ });
1296
+ }
1297
+ }
1298
+ return {
1299
+ formatName,
1300
+ formatOptions
1301
+ };
1302
+ };
1303
+ const createCachedFormatter = fn => {
1304
+ const cache = {};
1305
+ return (v, l, o) => {
1306
+ let optForCache = o;
1307
+ if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
1308
+ optForCache = {
1309
+ ...optForCache,
1310
+ [o.interpolationkey]: undefined
1311
+ };
1312
+ }
1313
+ const key = l + JSON.stringify(optForCache);
1314
+ let frm = cache[key];
1315
+ if (!frm) {
1316
+ frm = fn(getCleanedCode(l), o);
1317
+ cache[key] = frm;
1318
+ }
1319
+ return frm(v);
1320
+ };
1321
+ };
1322
+ const createNonCachedFormatter = fn => (v, l, o) => fn(getCleanedCode(l), o)(v);
1323
+ class Formatter {
1324
+ constructor(options = {}) {
1325
+ this.logger = baseLogger.create('formatter');
1326
+ this.options = options;
1327
+ this.init(options);
1328
+ }
1329
+ init(services, options = {
1330
+ interpolation: {}
1331
+ }) {
1332
+ this.formatSeparator = options.interpolation.formatSeparator || ',';
1333
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1334
+ this.formats = {
1335
+ number: cf((lng, opt) => {
1336
+ const formatter = new Intl.NumberFormat(lng, {
1337
+ ...opt
1338
+ });
1339
+ return val => formatter.format(val);
1340
+ }),
1341
+ currency: cf((lng, opt) => {
1342
+ const formatter = new Intl.NumberFormat(lng, {
1343
+ ...opt,
1344
+ style: 'currency'
1345
+ });
1346
+ return val => formatter.format(val);
1347
+ }),
1348
+ datetime: cf((lng, opt) => {
1349
+ const formatter = new Intl.DateTimeFormat(lng, {
1350
+ ...opt
1351
+ });
1352
+ return val => formatter.format(val);
1353
+ }),
1354
+ relativetime: cf((lng, opt) => {
1355
+ const formatter = new Intl.RelativeTimeFormat(lng, {
1356
+ ...opt
1357
+ });
1358
+ return val => formatter.format(val, opt.range || 'day');
1359
+ }),
1360
+ list: cf((lng, opt) => {
1361
+ const formatter = new Intl.ListFormat(lng, {
1362
+ ...opt
1363
+ });
1364
+ return val => formatter.format(val);
1365
+ })
1366
+ };
1367
+ }
1368
+ add(name, fc) {
1369
+ this.formats[name.toLowerCase().trim()] = fc;
1370
+ }
1371
+ addCached(name, fc) {
1372
+ this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1373
+ }
1374
+ format(value, format, lng, options = {}) {
1375
+ const formats = format.split(this.formatSeparator);
1376
+ if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
1377
+ const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
1378
+ formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
1379
+ }
1380
+ const result = formats.reduce((mem, f) => {
1381
+ const {
1382
+ formatName,
1383
+ formatOptions
1384
+ } = parseFormatStr(f);
1385
+ if (this.formats[formatName]) {
1386
+ let formatted = mem;
1387
+ try {
1388
+ const valOptions = options?.formatParams?.[options.interpolationkey] || {};
1389
+ const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1390
+ formatted = this.formats[formatName](mem, l, {
1391
+ ...formatOptions,
1392
+ ...options,
1393
+ ...valOptions
1394
+ });
1395
+ } catch (error) {
1396
+ this.logger.warn(error);
1397
+ }
1398
+ return formatted;
1399
+ } else {
1400
+ this.logger.warn(`there was no format function for ${formatName}`);
1401
+ }
1402
+ return mem;
1403
+ }, value);
1404
+ return result;
1405
+ }
1406
+ }
1407
+
1408
+ const removePending = (q, name) => {
1409
+ if (q.pending[name] !== undefined) {
1410
+ delete q.pending[name];
1411
+ q.pendingCount--;
1412
+ }
1413
+ };
1414
+ class Connector extends EventEmitter {
1415
+ constructor(backend, store, services, options = {}) {
1416
+ super();
1417
+ this.backend = backend;
1418
+ this.store = store;
1419
+ this.services = services;
1420
+ this.languageUtils = services.languageUtils;
1421
+ this.options = options;
1422
+ this.logger = baseLogger.create('backendConnector');
1423
+ this.waitingReads = [];
1424
+ this.maxParallelReads = options.maxParallelReads || 10;
1425
+ this.readingCalls = 0;
1426
+ this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1427
+ this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1428
+ this.state = {};
1429
+ this.queue = [];
1430
+ this.backend?.init?.(services, options.backend, options);
1431
+ }
1432
+ queueLoad(languages, namespaces, options, callback) {
1433
+ const toLoad = {};
1434
+ const pending = {};
1435
+ const toLoadLanguages = {};
1436
+ const toLoadNamespaces = {};
1437
+ languages.forEach(lng => {
1438
+ let hasAllNamespaces = true;
1439
+ namespaces.forEach(ns => {
1440
+ const name = `${lng}|${ns}`;
1441
+ if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
1442
+ this.state[name] = 2;
1443
+ } else if (this.state[name] < 0) ; else if (this.state[name] === 1) {
1444
+ if (pending[name] === undefined) pending[name] = true;
1445
+ } else {
1446
+ this.state[name] = 1;
1447
+ hasAllNamespaces = false;
1448
+ if (pending[name] === undefined) pending[name] = true;
1449
+ if (toLoad[name] === undefined) toLoad[name] = true;
1450
+ if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
1451
+ }
1452
+ });
1453
+ if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1454
+ });
1455
+ if (Object.keys(toLoad).length || Object.keys(pending).length) {
1456
+ this.queue.push({
1457
+ pending,
1458
+ pendingCount: Object.keys(pending).length,
1459
+ loaded: {},
1460
+ errors: [],
1461
+ callback
1462
+ });
1463
+ }
1464
+ return {
1465
+ toLoad: Object.keys(toLoad),
1466
+ pending: Object.keys(pending),
1467
+ toLoadLanguages: Object.keys(toLoadLanguages),
1468
+ toLoadNamespaces: Object.keys(toLoadNamespaces)
1469
+ };
1470
+ }
1471
+ loaded(name, err, data) {
1472
+ const s = name.split('|');
1473
+ const lng = s[0];
1474
+ const ns = s[1];
1475
+ if (err) this.emit('failedLoading', lng, ns, err);
1476
+ if (!err && data) {
1477
+ this.store.addResourceBundle(lng, ns, data, undefined, undefined, {
1478
+ skipCopy: true
1479
+ });
1480
+ }
1481
+ this.state[name] = err ? -1 : 2;
1482
+ if (err && data) this.state[name] = 0;
1483
+ const loaded = {};
1484
+ this.queue.forEach(q => {
1485
+ pushPath(q.loaded, [lng], ns);
1486
+ removePending(q, name);
1487
+ if (err) q.errors.push(err);
1488
+ if (q.pendingCount === 0 && !q.done) {
1489
+ Object.keys(q.loaded).forEach(l => {
1490
+ if (!loaded[l]) loaded[l] = {};
1491
+ const loadedKeys = q.loaded[l];
1492
+ if (loadedKeys.length) {
1493
+ loadedKeys.forEach(n => {
1494
+ if (loaded[l][n] === undefined) loaded[l][n] = true;
1495
+ });
1496
+ }
1497
+ });
1498
+ q.done = true;
1499
+ if (q.errors.length) {
1500
+ q.callback(q.errors);
1501
+ } else {
1502
+ q.callback();
1503
+ }
1504
+ }
1505
+ });
1506
+ this.emit('loaded', loaded);
1507
+ this.queue = this.queue.filter(q => !q.done);
1508
+ }
1509
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1510
+ if (!lng.length) return callback(null, {});
1511
+ if (this.readingCalls >= this.maxParallelReads) {
1512
+ this.waitingReads.push({
1513
+ lng,
1514
+ ns,
1515
+ fcName,
1516
+ tried,
1517
+ wait,
1518
+ callback
1519
+ });
1520
+ return;
1521
+ }
1522
+ this.readingCalls++;
1523
+ const resolver = (err, data) => {
1524
+ this.readingCalls--;
1525
+ if (this.waitingReads.length > 0) {
1526
+ const next = this.waitingReads.shift();
1527
+ this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
1528
+ }
1529
+ if (err && data && tried < this.maxRetries) {
1530
+ setTimeout(() => {
1531
+ this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
1532
+ }, wait);
1533
+ return;
1534
+ }
1535
+ callback(err, data);
1536
+ };
1537
+ const fc = this.backend[fcName].bind(this.backend);
1538
+ if (fc.length === 2) {
1539
+ try {
1540
+ const r = fc(lng, ns);
1541
+ if (r && typeof r.then === 'function') {
1542
+ r.then(data => resolver(null, data)).catch(resolver);
1543
+ } else {
1544
+ resolver(null, r);
1545
+ }
1546
+ } catch (err) {
1547
+ resolver(err);
1548
+ }
1549
+ return;
1550
+ }
1551
+ return fc(lng, ns, resolver);
1552
+ }
1553
+ prepareLoading(languages, namespaces, options = {}, callback) {
1554
+ if (!this.backend) {
1555
+ this.logger.warn('No backend was added via i18next.use. Will not load resources.');
1556
+ return callback && callback();
1557
+ }
1558
+ if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
1559
+ if (isString(namespaces)) namespaces = [namespaces];
1560
+ const toLoad = this.queueLoad(languages, namespaces, options, callback);
1561
+ if (!toLoad.toLoad.length) {
1562
+ if (!toLoad.pending.length) callback();
1563
+ return null;
1564
+ }
1565
+ toLoad.toLoad.forEach(name => {
1566
+ this.loadOne(name);
1567
+ });
1568
+ }
1569
+ load(languages, namespaces, callback) {
1570
+ this.prepareLoading(languages, namespaces, {}, callback);
1571
+ }
1572
+ reload(languages, namespaces, callback) {
1573
+ this.prepareLoading(languages, namespaces, {
1574
+ reload: true
1575
+ }, callback);
1576
+ }
1577
+ loadOne(name, prefix = '') {
1578
+ const s = name.split('|');
1579
+ const lng = s[0];
1580
+ const ns = s[1];
1581
+ this.read(lng, ns, 'read', undefined, undefined, (err, data) => {
1582
+ if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
1583
+ if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
1584
+ this.loaded(name, err, data);
1585
+ });
1586
+ }
1587
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
1588
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
1589
+ 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!!!');
1590
+ return;
1591
+ }
1592
+ if (key === undefined || key === null || key === '') return;
1593
+ if (this.backend?.create) {
1594
+ const opts = {
1595
+ ...options,
1596
+ isUpdate
1597
+ };
1598
+ const fc = this.backend.create.bind(this.backend);
1599
+ if (fc.length < 6) {
1600
+ try {
1601
+ let r;
1602
+ if (fc.length === 5) {
1603
+ r = fc(languages, namespace, key, fallbackValue, opts);
1604
+ } else {
1605
+ r = fc(languages, namespace, key, fallbackValue);
1606
+ }
1607
+ if (r && typeof r.then === 'function') {
1608
+ r.then(data => clb(null, data)).catch(clb);
1609
+ } else {
1610
+ clb(null, r);
1611
+ }
1612
+ } catch (err) {
1613
+ clb(err);
1614
+ }
1615
+ } else {
1616
+ fc(languages, namespace, key, fallbackValue, clb, opts);
1617
+ }
1618
+ }
1619
+ if (!languages || !languages[0]) return;
1620
+ this.store.addResource(languages[0], namespace, key, fallbackValue);
1621
+ }
1622
+ }
1623
+
1624
+ const get = () => ({
1625
+ debug: false,
1626
+ initAsync: true,
1627
+ ns: ['translation'],
1628
+ defaultNS: ['translation'],
1629
+ fallbackLng: ['dev'],
1630
+ fallbackNS: false,
1631
+ supportedLngs: false,
1632
+ nonExplicitSupportedLngs: false,
1633
+ load: 'all',
1634
+ preload: false,
1635
+ simplifyPluralSuffix: true,
1636
+ keySeparator: '.',
1637
+ nsSeparator: ':',
1638
+ pluralSeparator: '_',
1639
+ contextSeparator: '_',
1640
+ partialBundledLanguages: false,
1641
+ saveMissing: false,
1642
+ updateMissing: false,
1643
+ saveMissingTo: 'fallback',
1644
+ saveMissingPlurals: true,
1645
+ missingKeyHandler: false,
1646
+ missingInterpolationHandler: false,
1647
+ postProcess: false,
1648
+ postProcessPassResolved: false,
1649
+ returnNull: false,
1650
+ returnEmptyString: true,
1651
+ returnObjects: false,
1652
+ joinArrays: false,
1653
+ returnedObjectHandler: false,
1654
+ parseMissingKeyHandler: false,
1655
+ appendNamespaceToMissingKey: false,
1656
+ appendNamespaceToCIMode: false,
1657
+ overloadTranslationOptionHandler: args => {
1658
+ let ret = {};
1659
+ if (typeof args[1] === 'object') ret = args[1];
1660
+ if (isString(args[1])) ret.defaultValue = args[1];
1661
+ if (isString(args[2])) ret.tDescription = args[2];
1662
+ if (typeof args[2] === 'object' || typeof args[3] === 'object') {
1663
+ const options = args[3] || args[2];
1664
+ Object.keys(options).forEach(key => {
1665
+ ret[key] = options[key];
1666
+ });
1667
+ }
1668
+ return ret;
1669
+ },
1670
+ interpolation: {
1671
+ escapeValue: true,
1672
+ format: value => value,
1673
+ prefix: '{{',
1674
+ suffix: '}}',
1675
+ formatSeparator: ',',
1676
+ unescapePrefix: '-',
1677
+ nestingPrefix: '$t(',
1678
+ nestingSuffix: ')',
1679
+ nestingOptionsSeparator: ',',
1680
+ maxReplaces: 1000,
1681
+ skipOnVariables: true
1682
+ },
1683
+ cacheInBuiltFormats: true
1684
+ });
1685
+ const transformOptions = options => {
1686
+ if (isString(options.ns)) options.ns = [options.ns];
1687
+ if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
1688
+ if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
1689
+ if (options.supportedLngs?.indexOf?.('cimode') < 0) {
1690
+ options.supportedLngs = options.supportedLngs.concat(['cimode']);
1691
+ }
1692
+ if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
1693
+ return options;
1694
+ };
1695
+
1696
+ const noop = () => {};
1697
+ const bindMemberFunctions = inst => {
1698
+ const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
1699
+ mems.forEach(mem => {
1700
+ if (typeof inst[mem] === 'function') {
1701
+ inst[mem] = inst[mem].bind(inst);
1702
+ }
1703
+ });
1704
+ };
1705
+ class I18n extends EventEmitter {
1706
+ constructor(options = {}, callback) {
1707
+ super();
1708
+ this.options = transformOptions(options);
1709
+ this.services = {};
1710
+ this.logger = baseLogger;
1711
+ this.modules = {
1712
+ external: []
1713
+ };
1714
+ bindMemberFunctions(this);
1715
+ if (callback && !this.isInitialized && !options.isClone) {
1716
+ if (!this.options.initAsync) {
1717
+ this.init(options, callback);
1718
+ return this;
1719
+ }
1720
+ setTimeout(() => {
1721
+ this.init(options, callback);
1722
+ }, 0);
1723
+ }
1724
+ }
1725
+ init(options = {}, callback) {
1726
+ this.isInitializing = true;
1727
+ if (typeof options === 'function') {
1728
+ callback = options;
1729
+ options = {};
1730
+ }
1731
+ if (options.defaultNS == null && options.ns) {
1732
+ if (isString(options.ns)) {
1733
+ options.defaultNS = options.ns;
1734
+ } else if (options.ns.indexOf('translation') < 0) {
1735
+ options.defaultNS = options.ns[0];
1736
+ }
1737
+ }
1738
+ const defOpts = get();
1739
+ this.options = {
1740
+ ...defOpts,
1741
+ ...this.options,
1742
+ ...transformOptions(options)
1743
+ };
1744
+ this.options.interpolation = {
1745
+ ...defOpts.interpolation,
1746
+ ...this.options.interpolation
1747
+ };
1748
+ if (options.keySeparator !== undefined) {
1749
+ this.options.userDefinedKeySeparator = options.keySeparator;
1750
+ }
1751
+ if (options.nsSeparator !== undefined) {
1752
+ this.options.userDefinedNsSeparator = options.nsSeparator;
1753
+ }
1754
+ const createClassOnDemand = ClassOrObject => {
1755
+ if (!ClassOrObject) return null;
1756
+ if (typeof ClassOrObject === 'function') return new ClassOrObject();
1757
+ return ClassOrObject;
1758
+ };
1759
+ if (!this.options.isClone) {
1760
+ if (this.modules.logger) {
1761
+ baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
1762
+ } else {
1763
+ baseLogger.init(null, this.options);
1764
+ }
1765
+ let formatter;
1766
+ if (this.modules.formatter) {
1767
+ formatter = this.modules.formatter;
1768
+ } else {
1769
+ formatter = Formatter;
1770
+ }
1771
+ const lu = new LanguageUtil(this.options);
1772
+ this.store = new ResourceStore(this.options.resources, this.options);
1773
+ const s = this.services;
1774
+ s.logger = baseLogger;
1775
+ s.resourceStore = this.store;
1776
+ s.languageUtils = lu;
1777
+ s.pluralResolver = new PluralResolver(lu, {
1778
+ prepend: this.options.pluralSeparator,
1779
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1780
+ });
1781
+ const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
1782
+ if (usingLegacyFormatFunction) {
1783
+ this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1784
+ }
1785
+ if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1786
+ s.formatter = createClassOnDemand(formatter);
1787
+ if (s.formatter.init) s.formatter.init(s, this.options);
1788
+ this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1789
+ }
1790
+ s.interpolator = new Interpolator(this.options);
1791
+ s.utils = {
1792
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1793
+ };
1794
+ s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1795
+ s.backendConnector.on('*', (event, ...args) => {
1796
+ this.emit(event, ...args);
1797
+ });
1798
+ if (this.modules.languageDetector) {
1799
+ s.languageDetector = createClassOnDemand(this.modules.languageDetector);
1800
+ if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
1801
+ }
1802
+ if (this.modules.i18nFormat) {
1803
+ s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
1804
+ if (s.i18nFormat.init) s.i18nFormat.init(this);
1805
+ }
1806
+ this.translator = new Translator(this.services, this.options);
1807
+ this.translator.on('*', (event, ...args) => {
1808
+ this.emit(event, ...args);
1809
+ });
1810
+ this.modules.external.forEach(m => {
1811
+ if (m.init) m.init(this);
1812
+ });
1813
+ }
1814
+ this.format = this.options.interpolation.format;
1815
+ if (!callback) callback = noop;
1816
+ if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1817
+ const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1818
+ if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
1819
+ }
1820
+ if (!this.services.languageDetector && !this.options.lng) {
1821
+ this.logger.warn('init: no languageDetector is used and no lng is defined');
1822
+ }
1823
+ const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
1824
+ storeApi.forEach(fcName => {
1825
+ this[fcName] = (...args) => this.store[fcName](...args);
1826
+ });
1827
+ const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
1828
+ storeApiChained.forEach(fcName => {
1829
+ this[fcName] = (...args) => {
1830
+ this.store[fcName](...args);
1831
+ return this;
1832
+ };
1833
+ });
1834
+ const deferred = defer();
1835
+ const load = () => {
1836
+ const finish = (err, t) => {
1837
+ this.isInitializing = false;
1838
+ if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');
1839
+ this.isInitialized = true;
1840
+ if (!this.options.isClone) this.logger.log('initialized', this.options);
1841
+ this.emit('initialized', this.options);
1842
+ deferred.resolve(t);
1843
+ callback(err, t);
1844
+ };
1845
+ if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
1846
+ this.changeLanguage(this.options.lng, finish);
1847
+ };
1848
+ if (this.options.resources || !this.options.initAsync) {
1849
+ load();
1850
+ } else {
1851
+ setTimeout(load, 0);
1852
+ }
1853
+ return deferred;
1854
+ }
1855
+ loadResources(language, callback = noop) {
1856
+ let usedCallback = callback;
1857
+ const usedLng = isString(language) ? language : this.language;
1858
+ if (typeof language === 'function') usedCallback = language;
1859
+ if (!this.options.resources || this.options.partialBundledLanguages) {
1860
+ if (usedLng?.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
1861
+ const toLoad = [];
1862
+ const append = lng => {
1863
+ if (!lng) return;
1864
+ if (lng === 'cimode') return;
1865
+ const lngs = this.services.languageUtils.toResolveHierarchy(lng);
1866
+ lngs.forEach(l => {
1867
+ if (l === 'cimode') return;
1868
+ if (toLoad.indexOf(l) < 0) toLoad.push(l);
1869
+ });
1870
+ };
1871
+ if (!usedLng) {
1872
+ const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1873
+ fallbacks.forEach(l => append(l));
1874
+ } else {
1875
+ append(usedLng);
1876
+ }
1877
+ this.options.preload?.forEach?.(l => append(l));
1878
+ this.services.backendConnector.load(toLoad, this.options.ns, e => {
1879
+ if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
1880
+ usedCallback(e);
1881
+ });
1882
+ } else {
1883
+ usedCallback(null);
1884
+ }
1885
+ }
1886
+ reloadResources(lngs, ns, callback) {
1887
+ const deferred = defer();
1888
+ if (typeof lngs === 'function') {
1889
+ callback = lngs;
1890
+ lngs = undefined;
1891
+ }
1892
+ if (typeof ns === 'function') {
1893
+ callback = ns;
1894
+ ns = undefined;
1895
+ }
1896
+ if (!lngs) lngs = this.languages;
1897
+ if (!ns) ns = this.options.ns;
1898
+ if (!callback) callback = noop;
1899
+ this.services.backendConnector.reload(lngs, ns, err => {
1900
+ deferred.resolve();
1901
+ callback(err);
1902
+ });
1903
+ return deferred;
1904
+ }
1905
+ use(module) {
1906
+ if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
1907
+ if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
1908
+ if (module.type === 'backend') {
1909
+ this.modules.backend = module;
1910
+ }
1911
+ if (module.type === 'logger' || module.log && module.warn && module.error) {
1912
+ this.modules.logger = module;
1913
+ }
1914
+ if (module.type === 'languageDetector') {
1915
+ this.modules.languageDetector = module;
1916
+ }
1917
+ if (module.type === 'i18nFormat') {
1918
+ this.modules.i18nFormat = module;
1919
+ }
1920
+ if (module.type === 'postProcessor') {
1921
+ postProcessor.addPostProcessor(module);
1922
+ }
1923
+ if (module.type === 'formatter') {
1924
+ this.modules.formatter = module;
1925
+ }
1926
+ if (module.type === '3rdParty') {
1927
+ this.modules.external.push(module);
1928
+ }
1929
+ return this;
1930
+ }
1931
+ setResolvedLanguage(l) {
1932
+ if (!l || !this.languages) return;
1933
+ if (['cimode', 'dev'].indexOf(l) > -1) return;
1934
+ for (let li = 0; li < this.languages.length; li++) {
1935
+ const lngInLngs = this.languages[li];
1936
+ if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
1937
+ if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
1938
+ this.resolvedLanguage = lngInLngs;
1939
+ break;
1940
+ }
1941
+ }
1942
+ if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
1943
+ this.resolvedLanguage = l;
1944
+ this.languages.unshift(l);
1945
+ }
1946
+ }
1947
+ changeLanguage(lng, callback) {
1948
+ this.isLanguageChangingTo = lng;
1949
+ const deferred = defer();
1950
+ this.emit('languageChanging', lng);
1951
+ const setLngProps = l => {
1952
+ this.language = l;
1953
+ this.languages = this.services.languageUtils.toResolveHierarchy(l);
1954
+ this.resolvedLanguage = undefined;
1955
+ this.setResolvedLanguage(l);
1956
+ };
1957
+ const done = (err, l) => {
1958
+ if (l) {
1959
+ if (this.isLanguageChangingTo === lng) {
1960
+ setLngProps(l);
1961
+ this.translator.changeLanguage(l);
1962
+ this.isLanguageChangingTo = undefined;
1963
+ this.emit('languageChanged', l);
1964
+ this.logger.log('languageChanged', l);
1965
+ }
1966
+ } else {
1967
+ this.isLanguageChangingTo = undefined;
1968
+ }
1969
+ deferred.resolve((...args) => this.t(...args));
1970
+ if (callback) callback(err, (...args) => this.t(...args));
1971
+ };
1972
+ const setLng = lngs => {
1973
+ if (!lng && !lngs && this.services.languageDetector) lngs = [];
1974
+ const fl = isString(lngs) ? lngs : lngs && lngs[0];
1975
+ const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
1976
+ if (l) {
1977
+ if (!this.language) {
1978
+ setLngProps(l);
1979
+ }
1980
+ if (!this.translator.language) this.translator.changeLanguage(l);
1981
+ this.services.languageDetector?.cacheUserLanguage?.(l);
1982
+ }
1983
+ this.loadResources(l, err => {
1984
+ done(err, l);
1985
+ });
1986
+ };
1987
+ if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
1988
+ setLng(this.services.languageDetector.detect());
1989
+ } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
1990
+ if (this.services.languageDetector.detect.length === 0) {
1991
+ this.services.languageDetector.detect().then(setLng);
1992
+ } else {
1993
+ this.services.languageDetector.detect(setLng);
1994
+ }
1995
+ } else {
1996
+ setLng(lng);
1997
+ }
1998
+ return deferred;
1999
+ }
2000
+ getFixedT(lng, ns, keyPrefix) {
2001
+ const fixedT = (key, opts, ...rest) => {
2002
+ let o;
2003
+ if (typeof opts !== 'object') {
2004
+ o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
2005
+ } else {
2006
+ o = {
2007
+ ...opts
2008
+ };
2009
+ }
2010
+ o.lng = o.lng || fixedT.lng;
2011
+ o.lngs = o.lngs || fixedT.lngs;
2012
+ o.ns = o.ns || fixedT.ns;
2013
+ if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
2014
+ const keySeparator = this.options.keySeparator || '.';
2015
+ let resultKey;
2016
+ if (o.keyPrefix && Array.isArray(key)) {
2017
+ resultKey = key.map(k => {
2018
+ if (typeof k === 'function') k = keysFromSelector(k, {
2019
+ ...this.options,
2020
+ ...opts
2021
+ });
2022
+ return `${o.keyPrefix}${keySeparator}${k}`;
2023
+ });
2024
+ } else {
2025
+ if (typeof key === 'function') key = keysFromSelector(key, {
2026
+ ...this.options,
2027
+ ...opts
2028
+ });
2029
+ resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
2030
+ }
2031
+ return this.t(resultKey, o);
2032
+ };
2033
+ if (isString(lng)) {
2034
+ fixedT.lng = lng;
2035
+ } else {
2036
+ fixedT.lngs = lng;
2037
+ }
2038
+ fixedT.ns = ns;
2039
+ fixedT.keyPrefix = keyPrefix;
2040
+ return fixedT;
2041
+ }
2042
+ t(...args) {
2043
+ return this.translator?.translate(...args);
2044
+ }
2045
+ exists(...args) {
2046
+ return this.translator?.exists(...args);
2047
+ }
2048
+ setDefaultNamespace(ns) {
2049
+ this.options.defaultNS = ns;
2050
+ }
2051
+ hasLoadedNamespace(ns, options = {}) {
2052
+ if (!this.isInitialized) {
2053
+ this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2054
+ return false;
2055
+ }
2056
+ if (!this.languages || !this.languages.length) {
2057
+ this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2058
+ return false;
2059
+ }
2060
+ const lng = options.lng || this.resolvedLanguage || this.languages[0];
2061
+ const fallbackLng = this.options ? this.options.fallbackLng : false;
2062
+ const lastLng = this.languages[this.languages.length - 1];
2063
+ if (lng.toLowerCase() === 'cimode') return true;
2064
+ const loadNotPending = (l, n) => {
2065
+ const loadState = this.services.backendConnector.state[`${l}|${n}`];
2066
+ return loadState === -1 || loadState === 0 || loadState === 2;
2067
+ };
2068
+ if (options.precheck) {
2069
+ const preResult = options.precheck(this, loadNotPending);
2070
+ if (preResult !== undefined) return preResult;
2071
+ }
2072
+ if (this.hasResourceBundle(lng, ns)) return true;
2073
+ if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2074
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
2075
+ return false;
2076
+ }
2077
+ loadNamespaces(ns, callback) {
2078
+ const deferred = defer();
2079
+ if (!this.options.ns) {
2080
+ if (callback) callback();
2081
+ return Promise.resolve();
2082
+ }
2083
+ if (isString(ns)) ns = [ns];
2084
+ ns.forEach(n => {
2085
+ if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
2086
+ });
2087
+ this.loadResources(err => {
2088
+ deferred.resolve();
2089
+ if (callback) callback(err);
2090
+ });
2091
+ return deferred;
2092
+ }
2093
+ loadLanguages(lngs, callback) {
2094
+ const deferred = defer();
2095
+ if (isString(lngs)) lngs = [lngs];
2096
+ const preloaded = this.options.preload || [];
2097
+ const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
2098
+ if (!newLngs.length) {
2099
+ if (callback) callback();
2100
+ return Promise.resolve();
2101
+ }
2102
+ this.options.preload = preloaded.concat(newLngs);
2103
+ this.loadResources(err => {
2104
+ deferred.resolve();
2105
+ if (callback) callback(err);
2106
+ });
2107
+ return deferred;
2108
+ }
2109
+ dir(lng) {
2110
+ if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
2111
+ if (!lng) return 'rtl';
2112
+ try {
2113
+ const l = new Intl.Locale(lng);
2114
+ if (l && l.getTextInfo) {
2115
+ const ti = l.getTextInfo();
2116
+ if (ti && ti.direction) return ti.direction;
2117
+ }
2118
+ } catch (e) {}
2119
+ 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'];
2120
+ const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
2121
+ if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
2122
+ return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2123
+ }
2124
+ static createInstance(options = {}, callback) {
2125
+ return new I18n(options, callback);
2126
+ }
2127
+ cloneInstance(options = {}, callback = noop) {
2128
+ const forkResourceStore = options.forkResourceStore;
2129
+ if (forkResourceStore) delete options.forkResourceStore;
2130
+ const mergedOptions = {
2131
+ ...this.options,
2132
+ ...options,
2133
+ ...{
2134
+ isClone: true
2135
+ }
2136
+ };
2137
+ const clone = new I18n(mergedOptions);
2138
+ if (options.debug !== undefined || options.prefix !== undefined) {
2139
+ clone.logger = clone.logger.clone(options);
2140
+ }
2141
+ const membersToCopy = ['store', 'services', 'language'];
2142
+ membersToCopy.forEach(m => {
2143
+ clone[m] = this[m];
2144
+ });
2145
+ clone.services = {
2146
+ ...this.services
2147
+ };
2148
+ clone.services.utils = {
2149
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2150
+ };
2151
+ if (forkResourceStore) {
2152
+ const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
2153
+ prev[l] = {
2154
+ ...this.store.data[l]
2155
+ };
2156
+ prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2157
+ acc[n] = {
2158
+ ...prev[l][n]
2159
+ };
2160
+ return acc;
2161
+ }, prev[l]);
2162
+ return prev;
2163
+ }, {});
2164
+ clone.store = new ResourceStore(clonedData, mergedOptions);
2165
+ clone.services.resourceStore = clone.store;
2166
+ }
2167
+ clone.translator = new Translator(clone.services, mergedOptions);
2168
+ clone.translator.on('*', (event, ...args) => {
2169
+ clone.emit(event, ...args);
2170
+ });
2171
+ clone.init(mergedOptions, callback);
2172
+ clone.translator.options = mergedOptions;
2173
+ clone.translator.backendConnector.services.utils = {
2174
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2175
+ };
2176
+ return clone;
2177
+ }
2178
+ toJSON() {
2179
+ return {
2180
+ options: this.options,
2181
+ store: this.store,
2182
+ language: this.language,
2183
+ languages: this.languages,
2184
+ resolvedLanguage: this.resolvedLanguage
2185
+ };
2186
+ }
2187
+ }
2188
+ const instance = I18n.createInstance();
2189
+ instance.createInstance = I18n.createInstance;
2190
+ const t = instance.t;
3
2191
 
4
2192
  const chat_tab$1 = {
5
2193
  chat: "Chat",
@@ -33,7 +2221,10 @@ const chat_tab$1 = {
33
2221
  summary: "AI Summary",
34
2222
  reply_token_info: "You have a free message quota of {total} messages within {remaining} minutes.",
35
2223
  syncing_tag: "Retrieving the tag please wait a moment.",
36
- syncing_message: "Retrieving the chat please wait a moment."
2224
+ syncing_message: "Retrieving the chat please wait a moment.",
2225
+ advanced_search: "Advanced Search",
2226
+ add_custom_filter: "Add a custom filter",
2227
+ edit_custom_filter: "Edit custom filter"
37
2228
  };
38
2229
  const quick_message$1 = {
39
2230
  title: "Quick message",
@@ -179,6 +2370,39 @@ const create$1 = "Create";
179
2370
  const event$1 = "Event";
180
2371
  const amount$1 = "Amount";
181
2372
  const currency$1 = "Currency";
2373
+ const chat_filter$1 = {
2374
+ admin: "Admin",
2375
+ chat_bot: "Chatbot",
2376
+ group: "Group",
2377
+ reset: "Reset",
2378
+ all: "All",
2379
+ friend: "Friend",
2380
+ type: "Type",
2381
+ type_for_line_oa: "For Line OA channel",
2382
+ search_result: "Search results",
2383
+ add_custom_filter: "Add a filter",
2384
+ filter_name: "Filter name",
2385
+ confirm_delete_filter: "Are you sure you want to delete this filter?",
2386
+ custom_filter: "Custom filter",
2387
+ select_filter_to_search: "Select a filter to search.",
2388
+ no_filter: "No filter",
2389
+ verify_slip: "Verify slip",
2390
+ verify_slip_more_than: "Verify slip more than",
2391
+ only_customer_zrmz: "Select only ZRMZ customers",
2392
+ shop_name: "Shop name",
2393
+ name: "Name",
2394
+ total_point: "Total points",
2395
+ remaining_point: "Remaining points",
2396
+ only_customer_zerva: "Select only Zerva customers",
2397
+ booking_no: "Booking number",
2398
+ service_date: "Date of service",
2399
+ end_date: "End date",
2400
+ start_date: "Start date",
2401
+ booking_status: "Booking status",
2402
+ payment_status: "Payment status",
2403
+ quantity: "quantity",
2404
+ times: "times"
2405
+ };
182
2406
  var en = {
183
2407
  chat_tab: chat_tab$1,
184
2408
  quick_message: quick_message$1,
@@ -241,7 +2465,8 @@ var en = {
241
2465
  create: create$1,
242
2466
  event: event$1,
243
2467
  amount: amount$1,
244
- currency: currency$1
2468
+ currency: currency$1,
2469
+ chat_filter: chat_filter$1
245
2470
  };
246
2471
 
247
2472
  const chat_tab = {
@@ -276,7 +2501,10 @@ const chat_tab = {
276
2501
  summary: "AI สรุปข้อความ",
277
2502
  reply_token_info: "คุณมีโควต้าส่งข้อความฟรี {total} ข้อความ ภายใน {remaining} นาที",
278
2503
  syncing_message: "กำลังดึงประวัติแชท กรุณารอสักครู่",
279
- syncing_tag: "กำลังดึงป้ายกำกับ กรุณารอสักครู่"
2504
+ syncing_tag: "กำลังดึงป้ายกำกับ กรุณารอสักครู่",
2505
+ advanced_search: "ค้นหาขั้นสูง",
2506
+ add_custom_filter: "เพิ่มตัวกรองกำหนดเอง",
2507
+ edit_custom_filter: "แก้ไขตัวกรองกำหนดเอง"
280
2508
  };
281
2509
  const quick_message = {
282
2510
  title: "เทมเพลตคำตอบ",
@@ -422,6 +2650,39 @@ const create = "สร้าง";
422
2650
  const event = "อีเวนท์";
423
2651
  const amount = "จำนวนเงิน";
424
2652
  const currency = "หน่วยเงิน";
2653
+ const chat_filter = {
2654
+ admin: "แอดมิน",
2655
+ chat_bot: "แชทบอท",
2656
+ group: "กลุ่ม",
2657
+ reset: "ล้าง",
2658
+ all: "ทั้งหมด",
2659
+ friend: "เพื่อน",
2660
+ type: "รูปแบบ",
2661
+ type_for_line_oa: "สำหรับช่องทาง Line OA",
2662
+ search_result: "ผลลัพธ์การค้นหา",
2663
+ add_custom_filter: "เพิ่มตัวกรอง",
2664
+ filter_name: "ชื่อตัวกรอง",
2665
+ confirm_delete_filter: "คุณแน่ใจว่าต้องการลบตัวกรองนี้หรือไม่?",
2666
+ custom_filter: "ตัวกรองกำหนดเอง",
2667
+ select_filter_to_search: "เลือกตัวกรองเพื่อค้นหา",
2668
+ no_filter: "ไม่มีตัวกรอง",
2669
+ verify_slip: "ตรวจสลิป",
2670
+ verify_slip_more_than: "ตรวจสลิปมากกว่า",
2671
+ only_customer_zrmz: "เลือกเฉพาะลูกค้า ZRMZ",
2672
+ shop_name: "ชื่อร้านค้า",
2673
+ name: "ชื่อ - นามสกุล",
2674
+ total_point: "คะแนนทั้งหมด",
2675
+ remaining_point: "คะแนนคงเหลือ",
2676
+ only_customer_zerva: "เลือกเฉพาะลูกค้า Zerva",
2677
+ booking_no: "เลขที่การจอง",
2678
+ service_date: "วันที่เข้ารับบริการ",
2679
+ end_date: "วันที่สิ้นสุด",
2680
+ start_date: "วันที่เริ่มต้น",
2681
+ booking_status: "สถานะการจอง",
2682
+ payment_status: "สถานะการชำระเงิน",
2683
+ quantity: "จำนวน",
2684
+ times: "ครั้ง"
2685
+ };
425
2686
  var th = {
426
2687
  chat_tab: chat_tab,
427
2688
  quick_message: quick_message,
@@ -484,7 +2745,8 @@ var th = {
484
2745
  create: create,
485
2746
  event: event,
486
2747
  amount: amount,
487
- currency: currency
2748
+ currency: currency,
2749
+ chat_filter: chat_filter
488
2750
  };
489
2751
 
490
2752
  instance.init({
@@ -495,3 +2757,5 @@ instance.init({
495
2757
  fallbackLng: 'en',
496
2758
  interpolation: { escapeValue: false },
497
2759
  });
2760
+
2761
+ export { instance as i, t };