@jackuait/blok 0.6.0-beta.8 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/dist/blok.mjs +2 -2
  2. package/dist/chunks/{blok-bzxy6Olq.mjs → blok-BAh1rvUC.mjs} +3410 -2927
  3. package/dist/chunks/i18next-B47TKgbU.mjs +1303 -0
  4. package/dist/chunks/{i18next-loader-CzL6YHyQ.mjs → i18next-loader-CHtGO6IK.mjs} +2 -2
  5. package/dist/chunks/{index-DSSrx_Co.mjs → index-DBWWKrDe.mjs} +12 -12
  6. package/dist/chunks/{inline-tool-convert-D4SXxjDd.mjs → inline-tool-convert-DduRc0fF.mjs} +1467 -951
  7. package/dist/chunks/{messages-BogRq8lt.mjs → messages-0AbcLMLm.mjs} +6 -0
  8. package/dist/chunks/{messages-DJDG55Vq.mjs → messages-0E0AkrNu.mjs} +6 -0
  9. package/dist/{messages-DnXLrlHh.mjs → chunks/messages-4v4MuVEc.mjs} +6 -0
  10. package/dist/chunks/{messages-DnIhyAJk.mjs → messages-62v-CLC-.mjs} +6 -0
  11. package/dist/chunks/{messages-Dzwxv9v1.mjs → messages-8DeO60Oo.mjs} +6 -0
  12. package/dist/chunks/{messages-B1Aww8q7.mjs → messages-8IPXkrDl.mjs} +6 -0
  13. package/dist/{messages-uKX8WBaD.mjs → chunks/messages-96kNZDll.mjs} +6 -0
  14. package/dist/chunks/{messages-BL0tXcDf.mjs → messages-B1FZ8lxU.mjs} +6 -0
  15. package/dist/{messages-DBn76jVV.mjs → chunks/messages-B217znr-.mjs} +8 -2
  16. package/dist/{messages-DT4dP5uK.mjs → chunks/messages-B8WNljW3.mjs} +6 -0
  17. package/dist/chunks/{messages-BdeLo0N9.mjs → messages-BC8IN4Bf.mjs} +6 -0
  18. package/dist/{messages-CZygwLwM.mjs → chunks/messages-BI43k_BD.mjs} +6 -0
  19. package/dist/{messages-CzTufCHu.mjs → chunks/messages-BJ6zrz2j.mjs} +6 -0
  20. package/dist/{messages-BoJc_p1r.mjs → chunks/messages-BUl_Rcnj.mjs} +6 -0
  21. package/dist/chunks/{messages-CnwibSvh.mjs → messages-BZlmVRwn.mjs} +6 -0
  22. package/dist/{messages-C2htQ_3F.mjs → chunks/messages-BcpCubnC.mjs} +6 -0
  23. package/dist/{messages-D5C3J9qr.mjs → chunks/messages-Bm-E4iRC.mjs} +6 -0
  24. package/dist/chunks/{messages-BELRf6DU.mjs → messages-C4jL-90N.mjs} +6 -0
  25. package/dist/chunks/{messages-1fC8IMyX.mjs → messages-CDBLbUOQ.mjs} +6 -0
  26. package/dist/chunks/{messages-7QoX8DkW.mjs → messages-CH4hrauY.mjs} +6 -0
  27. package/dist/{messages-Dz9L52ol.mjs → chunks/messages-CRJ_mchV.mjs} +6 -0
  28. package/dist/chunks/{messages-JELdtT6E.mjs → messages-CW4c4cRk.mjs} +6 -0
  29. package/dist/chunks/{messages-CKI54h6O.mjs → messages-C_4otP7U.mjs} +6 -0
  30. package/dist/{messages-R3hUSvr3.mjs → chunks/messages-CfiyT2Wi.mjs} +6 -0
  31. package/dist/{messages-CJdUsQ-c.mjs → chunks/messages-CgTq3QhU.mjs} +6 -0
  32. package/dist/chunks/{messages-D1Hv8XGo.mjs → messages-Chb7k3Rg.mjs} +6 -0
  33. package/dist/{messages-Q7AO_FLv.mjs → chunks/messages-Cjjo7yHR.mjs} +6 -0
  34. package/dist/{messages-C99mq906.mjs → chunks/messages-Cl6ayUaq.mjs} +6 -0
  35. package/dist/chunks/{messages-Diu6jAaR.mjs → messages-CmR9ftc_.mjs} +6 -0
  36. package/dist/chunks/{messages-LPVfA-8K.mjs → messages-Cr49Nt3U.mjs} +6 -0
  37. package/dist/chunks/{messages-DqM1LFg5.mjs → messages-Cr94GzbX.mjs} +6 -0
  38. package/dist/{messages-BWF-zUpY.mjs → chunks/messages-CrCYPCk3.mjs} +6 -0
  39. package/dist/{messages-D-ZtY5v0.mjs → chunks/messages-Cs8zmZ3L.mjs} +6 -0
  40. package/dist/{messages-DprmQg6V.mjs → chunks/messages-CzK0LEhb.mjs} +6 -0
  41. package/dist/chunks/{messages-BSbjsyHY.mjs → messages-D00x4S8o.mjs} +6 -0
  42. package/dist/chunks/{messages-Xq8UmkVs.mjs → messages-D1mn7Zd5.mjs} +6 -0
  43. package/dist/chunks/{messages-BC86qLvI.mjs → messages-D2NOpHn9.mjs} +6 -0
  44. package/dist/{messages-kep5wtm4.mjs → chunks/messages-D4qqwVgQ.mjs} +6 -0
  45. package/dist/chunks/{messages-7W4d0DwD.mjs → messages-D5S1Dnpm.mjs} +6 -0
  46. package/dist/{messages-CY8_RyFE.mjs → chunks/messages-D7u2bmP2.mjs} +6 -0
  47. package/dist/chunks/{messages-BFG6Wlgy.mjs → messages-D85FqxgY.mjs} +6 -0
  48. package/dist/{messages-DLfR5bMd.mjs → chunks/messages-D9ndgBnU.mjs} +6 -0
  49. package/dist/{messages-CVw84KdI.mjs → chunks/messages-DDTQgImT.mjs} +6 -0
  50. package/dist/{messages-_ErNTNhk.mjs → chunks/messages-DH_jBeED.mjs} +6 -0
  51. package/dist/chunks/{messages-CMkNSDTo.mjs → messages-DRXWF0PV.mjs} +6 -0
  52. package/dist/chunks/{messages-BYyy6Wqf.mjs → messages-DVQvl8Qj.mjs} +6 -0
  53. package/dist/chunks/{messages-CznZadDf.mjs → messages-DXktiao_.mjs} +6 -0
  54. package/dist/chunks/{messages-DhLKYm2j.mjs → messages-DdK-nFGm.mjs} +6 -0
  55. package/dist/chunks/{messages-BMXCuEKO.mjs → messages-DlJbPF2T.mjs} +6 -0
  56. package/dist/chunks/{messages-CvGLfqmV.mjs → messages-DnVlmiNT.mjs} +6 -0
  57. package/dist/{messages-Z9nEU2xK.mjs → chunks/messages-DviiFSv2.mjs} +6 -0
  58. package/dist/chunks/{messages-BB5z9Uba.mjs → messages-DzqM3Fel.mjs} +6 -0
  59. package/dist/{messages-w7v1GNaE.mjs → chunks/messages-Dzzn6XoD.mjs} +6 -0
  60. package/dist/{messages-CqWJcCbY.mjs → chunks/messages-GSByFygY.mjs} +6 -0
  61. package/dist/chunks/{messages-_ncGrKHh.mjs → messages-L_kl2Qvh.mjs} +6 -0
  62. package/dist/chunks/{messages-BrPFGbM-.mjs → messages-Phkd7XmE.mjs} +6 -0
  63. package/dist/{messages-BU2nlrLK.mjs → chunks/messages-RonBBCnh.mjs} +6 -0
  64. package/dist/{messages-Bmu_S7GM.mjs → chunks/messages-VDriF5Qy.mjs} +6 -0
  65. package/dist/{messages-CLhcMlTc.mjs → chunks/messages-ZjUAIWb1.mjs} +6 -0
  66. package/dist/{messages-9SihnaXQ.mjs → chunks/messages-b1EdvUm0.mjs} +6 -0
  67. package/dist/{messages-DvFLX36Q.mjs → chunks/messages-begYOTgC.mjs} +6 -0
  68. package/dist/{messages-BMv4xwIr.mjs → chunks/messages-jrncnb-H.mjs} +6 -0
  69. package/dist/{messages-D5iv1Kox.mjs → chunks/messages-nefz1S71.mjs} +6 -0
  70. package/dist/{messages-CQwpzUFp.mjs → chunks/messages-ucTVgS5G.mjs} +6 -0
  71. package/dist/chunks/{messages-DBRw-7Zc.mjs → messages-v3GipbFl.mjs} +6 -0
  72. package/dist/{messages-C9eaarcK.mjs → chunks/messages-wmi-iFkH.mjs} +6 -0
  73. package/dist/chunks/{messages-O5tQus_0.mjs → messages-yHcs38yI.mjs} +6 -0
  74. package/dist/full.mjs +2 -2
  75. package/dist/locales.mjs +90 -84
  76. package/dist/{messages-BogRq8lt.mjs → messages-0AbcLMLm.mjs} +6 -0
  77. package/dist/{messages-DJDG55Vq.mjs → messages-0E0AkrNu.mjs} +6 -0
  78. package/dist/{chunks/messages-DnXLrlHh.mjs → messages-4v4MuVEc.mjs} +6 -0
  79. package/dist/{messages-DnIhyAJk.mjs → messages-62v-CLC-.mjs} +6 -0
  80. package/dist/{messages-Dzwxv9v1.mjs → messages-8DeO60Oo.mjs} +6 -0
  81. package/dist/{messages-B1Aww8q7.mjs → messages-8IPXkrDl.mjs} +6 -0
  82. package/dist/{chunks/messages-uKX8WBaD.mjs → messages-96kNZDll.mjs} +6 -0
  83. package/dist/{messages-BL0tXcDf.mjs → messages-B1FZ8lxU.mjs} +6 -0
  84. package/dist/{chunks/messages-DBn76jVV.mjs → messages-B217znr-.mjs} +8 -2
  85. package/dist/{chunks/messages-DT4dP5uK.mjs → messages-B8WNljW3.mjs} +6 -0
  86. package/dist/{messages-BdeLo0N9.mjs → messages-BC8IN4Bf.mjs} +6 -0
  87. package/dist/{chunks/messages-CZygwLwM.mjs → messages-BI43k_BD.mjs} +6 -0
  88. package/dist/{chunks/messages-CzTufCHu.mjs → messages-BJ6zrz2j.mjs} +6 -0
  89. package/dist/{chunks/messages-BoJc_p1r.mjs → messages-BUl_Rcnj.mjs} +6 -0
  90. package/dist/{messages-CnwibSvh.mjs → messages-BZlmVRwn.mjs} +6 -0
  91. package/dist/{chunks/messages-C2htQ_3F.mjs → messages-BcpCubnC.mjs} +6 -0
  92. package/dist/{chunks/messages-D5C3J9qr.mjs → messages-Bm-E4iRC.mjs} +6 -0
  93. package/dist/{messages-BELRf6DU.mjs → messages-C4jL-90N.mjs} +6 -0
  94. package/dist/{messages-1fC8IMyX.mjs → messages-CDBLbUOQ.mjs} +6 -0
  95. package/dist/{messages-7QoX8DkW.mjs → messages-CH4hrauY.mjs} +6 -0
  96. package/dist/{chunks/messages-Dz9L52ol.mjs → messages-CRJ_mchV.mjs} +6 -0
  97. package/dist/{messages-JELdtT6E.mjs → messages-CW4c4cRk.mjs} +6 -0
  98. package/dist/{messages-CKI54h6O.mjs → messages-C_4otP7U.mjs} +6 -0
  99. package/dist/{chunks/messages-R3hUSvr3.mjs → messages-CfiyT2Wi.mjs} +6 -0
  100. package/dist/{chunks/messages-CJdUsQ-c.mjs → messages-CgTq3QhU.mjs} +6 -0
  101. package/dist/{messages-D1Hv8XGo.mjs → messages-Chb7k3Rg.mjs} +6 -0
  102. package/dist/{chunks/messages-Q7AO_FLv.mjs → messages-Cjjo7yHR.mjs} +6 -0
  103. package/dist/{chunks/messages-C99mq906.mjs → messages-Cl6ayUaq.mjs} +6 -0
  104. package/dist/{messages-Diu6jAaR.mjs → messages-CmR9ftc_.mjs} +6 -0
  105. package/dist/{messages-LPVfA-8K.mjs → messages-Cr49Nt3U.mjs} +6 -0
  106. package/dist/{messages-DqM1LFg5.mjs → messages-Cr94GzbX.mjs} +6 -0
  107. package/dist/{chunks/messages-BWF-zUpY.mjs → messages-CrCYPCk3.mjs} +6 -0
  108. package/dist/{chunks/messages-D-ZtY5v0.mjs → messages-Cs8zmZ3L.mjs} +6 -0
  109. package/dist/{chunks/messages-DprmQg6V.mjs → messages-CzK0LEhb.mjs} +6 -0
  110. package/dist/{messages-BSbjsyHY.mjs → messages-D00x4S8o.mjs} +6 -0
  111. package/dist/{messages-Xq8UmkVs.mjs → messages-D1mn7Zd5.mjs} +6 -0
  112. package/dist/{messages-BC86qLvI.mjs → messages-D2NOpHn9.mjs} +6 -0
  113. package/dist/{chunks/messages-kep5wtm4.mjs → messages-D4qqwVgQ.mjs} +6 -0
  114. package/dist/{messages-7W4d0DwD.mjs → messages-D5S1Dnpm.mjs} +6 -0
  115. package/dist/{chunks/messages-CY8_RyFE.mjs → messages-D7u2bmP2.mjs} +6 -0
  116. package/dist/{messages-BFG6Wlgy.mjs → messages-D85FqxgY.mjs} +6 -0
  117. package/dist/{chunks/messages-DLfR5bMd.mjs → messages-D9ndgBnU.mjs} +6 -0
  118. package/dist/{chunks/messages-CVw84KdI.mjs → messages-DDTQgImT.mjs} +6 -0
  119. package/dist/{chunks/messages-_ErNTNhk.mjs → messages-DH_jBeED.mjs} +6 -0
  120. package/dist/{messages-CMkNSDTo.mjs → messages-DRXWF0PV.mjs} +6 -0
  121. package/dist/{messages-BYyy6Wqf.mjs → messages-DVQvl8Qj.mjs} +6 -0
  122. package/dist/{messages-CznZadDf.mjs → messages-DXktiao_.mjs} +6 -0
  123. package/dist/{messages-DhLKYm2j.mjs → messages-DdK-nFGm.mjs} +6 -0
  124. package/dist/{messages-BMXCuEKO.mjs → messages-DlJbPF2T.mjs} +6 -0
  125. package/dist/{messages-CvGLfqmV.mjs → messages-DnVlmiNT.mjs} +6 -0
  126. package/dist/{chunks/messages-Z9nEU2xK.mjs → messages-DviiFSv2.mjs} +6 -0
  127. package/dist/{messages-BB5z9Uba.mjs → messages-DzqM3Fel.mjs} +6 -0
  128. package/dist/{chunks/messages-w7v1GNaE.mjs → messages-Dzzn6XoD.mjs} +6 -0
  129. package/dist/{chunks/messages-CqWJcCbY.mjs → messages-GSByFygY.mjs} +6 -0
  130. package/dist/{messages-_ncGrKHh.mjs → messages-L_kl2Qvh.mjs} +6 -0
  131. package/dist/{messages-BrPFGbM-.mjs → messages-Phkd7XmE.mjs} +6 -0
  132. package/dist/{chunks/messages-BU2nlrLK.mjs → messages-RonBBCnh.mjs} +6 -0
  133. package/dist/{chunks/messages-Bmu_S7GM.mjs → messages-VDriF5Qy.mjs} +6 -0
  134. package/dist/{chunks/messages-CLhcMlTc.mjs → messages-ZjUAIWb1.mjs} +6 -0
  135. package/dist/{chunks/messages-9SihnaXQ.mjs → messages-b1EdvUm0.mjs} +6 -0
  136. package/dist/{chunks/messages-DvFLX36Q.mjs → messages-begYOTgC.mjs} +6 -0
  137. package/dist/{chunks/messages-BMv4xwIr.mjs → messages-jrncnb-H.mjs} +6 -0
  138. package/dist/{chunks/messages-D5iv1Kox.mjs → messages-nefz1S71.mjs} +6 -0
  139. package/dist/{chunks/messages-CQwpzUFp.mjs → messages-ucTVgS5G.mjs} +6 -0
  140. package/dist/{messages-DBRw-7Zc.mjs → messages-v3GipbFl.mjs} +6 -0
  141. package/dist/{chunks/messages-C9eaarcK.mjs → messages-wmi-iFkH.mjs} +6 -0
  142. package/dist/{messages-O5tQus_0.mjs → messages-yHcs38yI.mjs} +6 -0
  143. package/dist/tools.mjs +3194 -1690
  144. package/dist/vendor.LICENSE.txt +109 -109
  145. package/package.json +43 -57
  146. package/src/blok.ts +12 -0
  147. package/src/components/__module.ts +21 -0
  148. package/src/components/block/api.ts +17 -0
  149. package/src/components/block/style-manager.ts +6 -2
  150. package/src/components/block/tool-renderer.ts +33 -30
  151. package/src/components/blocks.ts +132 -15
  152. package/src/components/i18n/locales/am/messages.json +6 -0
  153. package/src/components/i18n/locales/ar/messages.json +6 -0
  154. package/src/components/i18n/locales/az/messages.json +6 -0
  155. package/src/components/i18n/locales/bg/messages.json +6 -0
  156. package/src/components/i18n/locales/bn/messages.json +6 -0
  157. package/src/components/i18n/locales/bs/messages.json +6 -0
  158. package/src/components/i18n/locales/cs/messages.json +6 -0
  159. package/src/components/i18n/locales/da/messages.json +6 -0
  160. package/src/components/i18n/locales/de/messages.json +6 -0
  161. package/src/components/i18n/locales/dv/messages.json +6 -0
  162. package/src/components/i18n/locales/el/messages.json +6 -0
  163. package/src/components/i18n/locales/en/messages.json +6 -0
  164. package/src/components/i18n/locales/es/messages.json +6 -0
  165. package/src/components/i18n/locales/et/messages.json +6 -0
  166. package/src/components/i18n/locales/fa/messages.json +6 -0
  167. package/src/components/i18n/locales/fi/messages.json +6 -0
  168. package/src/components/i18n/locales/fil/messages.json +6 -0
  169. package/src/components/i18n/locales/fr/messages.json +6 -0
  170. package/src/components/i18n/locales/gu/messages.json +6 -0
  171. package/src/components/i18n/locales/he/messages.json +6 -0
  172. package/src/components/i18n/locales/hi/messages.json +6 -0
  173. package/src/components/i18n/locales/hr/messages.json +6 -0
  174. package/src/components/i18n/locales/hu/messages.json +6 -0
  175. package/src/components/i18n/locales/hy/messages.json +6 -0
  176. package/src/components/i18n/locales/id/messages.json +6 -0
  177. package/src/components/i18n/locales/it/messages.json +6 -0
  178. package/src/components/i18n/locales/ja/messages.json +6 -0
  179. package/src/components/i18n/locales/ka/messages.json +6 -0
  180. package/src/components/i18n/locales/km/messages.json +6 -0
  181. package/src/components/i18n/locales/kn/messages.json +6 -0
  182. package/src/components/i18n/locales/ko/messages.json +6 -0
  183. package/src/components/i18n/locales/ku/messages.json +6 -0
  184. package/src/components/i18n/locales/lo/messages.json +6 -0
  185. package/src/components/i18n/locales/lt/messages.json +6 -0
  186. package/src/components/i18n/locales/lv/messages.json +6 -0
  187. package/src/components/i18n/locales/mk/messages.json +6 -0
  188. package/src/components/i18n/locales/ml/messages.json +6 -0
  189. package/src/components/i18n/locales/mn/messages.json +6 -0
  190. package/src/components/i18n/locales/mr/messages.json +6 -0
  191. package/src/components/i18n/locales/ms/messages.json +6 -0
  192. package/src/components/i18n/locales/my/messages.json +6 -0
  193. package/src/components/i18n/locales/ne/messages.json +6 -0
  194. package/src/components/i18n/locales/nl/messages.json +6 -0
  195. package/src/components/i18n/locales/no/messages.json +6 -0
  196. package/src/components/i18n/locales/pa/messages.json +6 -0
  197. package/src/components/i18n/locales/pl/messages.json +6 -0
  198. package/src/components/i18n/locales/ps/messages.json +6 -0
  199. package/src/components/i18n/locales/pt/messages.json +6 -0
  200. package/src/components/i18n/locales/ro/messages.json +6 -0
  201. package/src/components/i18n/locales/ru/messages.json +6 -0
  202. package/src/components/i18n/locales/sd/messages.json +6 -0
  203. package/src/components/i18n/locales/si/messages.json +6 -0
  204. package/src/components/i18n/locales/sk/messages.json +6 -0
  205. package/src/components/i18n/locales/sl/messages.json +6 -0
  206. package/src/components/i18n/locales/sq/messages.json +6 -0
  207. package/src/components/i18n/locales/sr/messages.json +6 -0
  208. package/src/components/i18n/locales/sv/messages.json +6 -0
  209. package/src/components/i18n/locales/sw/messages.json +6 -0
  210. package/src/components/i18n/locales/ta/messages.json +6 -0
  211. package/src/components/i18n/locales/te/messages.json +6 -0
  212. package/src/components/i18n/locales/th/messages.json +6 -0
  213. package/src/components/i18n/locales/tr/messages.json +6 -0
  214. package/src/components/i18n/locales/ug/messages.json +6 -0
  215. package/src/components/i18n/locales/uk/messages.json +6 -0
  216. package/src/components/i18n/locales/ur/messages.json +6 -0
  217. package/src/components/i18n/locales/vi/messages.json +6 -0
  218. package/src/components/i18n/locales/yi/messages.json +6 -0
  219. package/src/components/i18n/locales/zh/messages.json +6 -0
  220. package/src/components/icons/index.ts +17 -0
  221. package/src/components/inline-tools/inline-tool-link.ts +1 -1
  222. package/src/components/inline-tools/inline-tool-marker.ts +737 -0
  223. package/src/components/inline-tools/utils/formatting-range-utils.ts +6 -3
  224. package/src/components/inline-tools/utils/marker-dom-utils.ts +17 -0
  225. package/src/components/modules/api/blocks.ts +34 -9
  226. package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +75 -29
  227. package/src/components/modules/blockEvents/index.ts +13 -5
  228. package/src/components/modules/blockManager/blockManager.ts +81 -2
  229. package/src/components/modules/blockManager/hierarchy.ts +20 -2
  230. package/src/components/modules/blockManager/operations.ts +70 -35
  231. package/src/components/modules/blockManager/repository.ts +22 -0
  232. package/src/components/modules/blockManager/types.ts +3 -1
  233. package/src/components/modules/blockManager/yjs-sync.ts +173 -39
  234. package/src/components/modules/blockSelection.ts +3 -0
  235. package/src/components/modules/crossBlockSelection.ts +11 -3
  236. package/src/components/modules/drag/preview/DragPreview.ts +10 -2
  237. package/src/components/modules/drag/target/DropTargetDetector.ts +100 -11
  238. package/src/components/modules/drag/utils/drag.constants.ts +1 -1
  239. package/src/components/modules/normalizeInlineImages.ts +263 -0
  240. package/src/components/modules/paste/google-docs-preprocessor.ts +197 -0
  241. package/src/components/modules/paste/handlers/base.ts +43 -2
  242. package/src/components/modules/paste/handlers/html-handler.ts +1 -1
  243. package/src/components/modules/paste/handlers/index.ts +1 -0
  244. package/src/components/modules/paste/handlers/table-cells-handler.ts +104 -0
  245. package/src/components/modules/paste/index.ts +20 -3
  246. package/src/components/modules/readonly.ts +8 -2
  247. package/src/components/modules/rectangleSelection.ts +5 -2
  248. package/src/components/modules/renderer.ts +35 -0
  249. package/src/components/modules/saver.ts +52 -2
  250. package/src/components/modules/toolbar/blockSettings.ts +52 -44
  251. package/src/components/modules/toolbar/index.ts +124 -17
  252. package/src/components/modules/toolbar/inline/index.ts +4 -4
  253. package/src/components/modules/toolbar/plus-button.ts +3 -3
  254. package/src/components/modules/toolbar/settings-toggler.ts +3 -3
  255. package/src/components/modules/toolbar/styles.ts +7 -7
  256. package/src/components/modules/ui.ts +6 -6
  257. package/src/components/modules/uiControllers/controllers/blockHover.ts +16 -2
  258. package/src/components/modules/uiControllers/handlers/touch.ts +83 -10
  259. package/src/components/modules/yjs/block-observer.ts +9 -3
  260. package/src/components/modules/yjs/document-store.ts +10 -7
  261. package/src/components/modules/yjs/types.ts +8 -6
  262. package/src/components/modules/yjs/undo-history.ts +90 -11
  263. package/src/components/selection/fake-background/shadows.ts +1 -1
  264. package/src/components/shared/color-picker.ts +211 -0
  265. package/src/components/shared/color-presets.ts +25 -0
  266. package/src/components/ui/toolbox.ts +19 -11
  267. package/src/components/utils/color-mapping.ts +241 -0
  268. package/src/components/utils/notifier/draw.ts +9 -9
  269. package/src/components/utils/placeholder.ts +24 -8
  270. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +2 -2
  271. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +14 -12
  272. package/src/components/utils/popover/components/search-input/search-input.const.ts +2 -2
  273. package/src/components/utils/popover/popover-abstract.ts +27 -3
  274. package/src/components/utils/popover/popover-desktop.ts +26 -3
  275. package/src/components/utils/popover/popover-inline.ts +14 -1
  276. package/src/components/utils/popover/popover-mobile.ts +4 -4
  277. package/src/components/utils/popover/popover.const.ts +2 -2
  278. package/src/components/utils/sanitizer.ts +24 -3
  279. package/src/components/utils/tw.ts +17 -5
  280. package/src/stories/Header.stories.ts +106 -0
  281. package/src/stories/MarkerColors.stories.ts +730 -0
  282. package/src/stories/Popover.stories.ts +1 -3
  283. package/src/stories/Table.stories.ts +1662 -0
  284. package/src/styles/main.css +207 -37
  285. package/src/tools/header/index.ts +1 -1
  286. package/src/tools/index.ts +3 -1
  287. package/src/tools/list/caret-manager.ts +28 -10
  288. package/src/tools/list/constants.ts +2 -2
  289. package/src/tools/list/dom-builder.ts +3 -3
  290. package/src/tools/list/static-configs.ts +0 -1
  291. package/src/tools/paragraph/index.ts +15 -7
  292. package/src/tools/table/core/table-commands.ts +99 -0
  293. package/src/tools/table/core/table-controller.ts +231 -0
  294. package/src/tools/table/core/table-events.ts +102 -0
  295. package/src/tools/table/index.ts +1070 -174
  296. package/src/tools/table/ownership/table-event-broker.ts +74 -0
  297. package/src/tools/table/ownership/table-ownership-registry.ts +126 -0
  298. package/src/tools/table/table-add-controls.ts +85 -15
  299. package/src/tools/table/table-cell-blocks.ts +336 -38
  300. package/src/tools/table/table-cell-clipboard.ts +415 -0
  301. package/src/tools/table/table-cell-color-picker.ts +34 -0
  302. package/src/tools/table/table-cell-selection.ts +264 -15
  303. package/src/tools/table/table-core.ts +3 -42
  304. package/src/tools/table/table-heading-toggle.ts +2 -2
  305. package/src/tools/table/table-model.ts +623 -0
  306. package/src/tools/table/table-operations.ts +59 -78
  307. package/src/tools/table/table-resize.ts +15 -11
  308. package/src/tools/table/table-restrictions.ts +69 -3
  309. package/src/tools/table/table-row-col-action-handler.ts +22 -7
  310. package/src/tools/table/table-row-col-controls.ts +129 -12
  311. package/src/tools/table/table-row-col-drag.ts +14 -0
  312. package/src/tools/table/table-scroll-haze.ts +152 -0
  313. package/src/tools/table/types.ts +22 -1
  314. package/src/tools/table/view/table-cell-blocks-adapter.ts +47 -0
  315. package/src/variants/blok-minimum.ts +13 -0
  316. package/types/api/block.d.ts +13 -0
  317. package/types/api/blocks.d.ts +16 -0
  318. package/types/tools/table.d.ts +2 -0
  319. package/dist/chunks/i18next-CugVlwWp.mjs +0 -1292
  320. package/src/tools/table/data-normalizer.ts +0 -32
@@ -1,1292 +0,0 @@
1
- var Re = Object.defineProperty, Pe = Object.defineProperties;
2
- var $e = Object.getOwnPropertyDescriptors;
3
- var re = Object.getOwnPropertySymbols;
4
- var Ne = Object.prototype.hasOwnProperty, ke = Object.prototype.propertyIsEnumerable;
5
- var ae = (o, e, t) => e in o ? Re(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, d = (o, e) => {
6
- for (var t in e || (e = {}))
7
- Ne.call(e, t) && ae(o, t, e[t]);
8
- if (re)
9
- for (var t of re(e))
10
- ke.call(e, t) && ae(o, t, e[t]);
11
- return o;
12
- }, b = (o, e) => Pe(o, $e(e));
13
- const p = (o) => typeof o == "string", U = () => {
14
- let o, e;
15
- const t = new Promise((i, s) => {
16
- o = i, e = s;
17
- });
18
- return t.resolve = o, t.reject = e, t;
19
- }, oe = (o) => o == null ? "" : "" + o, Fe = (o, e, t) => {
20
- o.forEach((i) => {
21
- e[i] && (t[i] = e[i]);
22
- });
23
- }, je = /###/g, le = (o) => o && o.indexOf("###") > -1 ? o.replace(je, ".") : o, ue = (o) => !o || p(o), H = (o, e, t) => {
24
- const i = p(e) ? e.split(".") : e;
25
- let s = 0;
26
- for (; s < i.length - 1; ) {
27
- if (ue(o)) return {};
28
- const n = le(i[s]);
29
- !o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++s;
30
- }
31
- return ue(o) ? {} : {
32
- obj: o,
33
- k: le(i[s])
34
- };
35
- }, fe = (o, e, t) => {
36
- const {
37
- obj: i,
38
- k: s
39
- } = H(o, e, Object);
40
- if (i !== void 0 || e.length === 1) {
41
- i[s] = t;
42
- return;
43
- }
44
- let n = e[e.length - 1], r = e.slice(0, e.length - 1), a = H(o, r, Object);
45
- for (; a.obj === void 0 && r.length; )
46
- n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), a = H(o, r, Object), a != null && a.obj && typeof a.obj[`${a.k}.${n}`] != "undefined" && (a.obj = void 0);
47
- a.obj[`${a.k}.${n}`] = t;
48
- }, Ee = (o, e, t, i) => {
49
- const {
50
- obj: s,
51
- k: n
52
- } = H(o, e, Object);
53
- s[n] = s[n] || [], s[n].push(t);
54
- }, Y = (o, e) => {
55
- const {
56
- obj: t,
57
- k: i
58
- } = H(o, e);
59
- if (t && Object.prototype.hasOwnProperty.call(t, i))
60
- return t[i];
61
- }, Te = (o, e, t) => {
62
- const i = Y(o, t);
63
- return i !== void 0 ? i : Y(e, t);
64
- }, be = (o, e, t) => {
65
- for (const i in e)
66
- i !== "__proto__" && i !== "constructor" && (i in o ? p(o[i]) || o[i] instanceof String || p(e[i]) || e[i] instanceof String ? t && (o[i] = e[i]) : be(o[i], e[i], t) : o[i] = e[i]);
67
- return o;
68
- }, D = (o) => o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
69
- var Ie = {
70
- "&": "&amp;",
71
- "<": "&lt;",
72
- ">": "&gt;",
73
- '"': "&quot;",
74
- "'": "&#39;",
75
- "/": "&#x2F;"
76
- };
77
- const De = (o) => p(o) ? o.replace(/[&<>"'\/]/g, (e) => Ie[e]) : o;
78
- class Ve {
79
- constructor(e) {
80
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
81
- }
82
- getRegExp(e) {
83
- const t = this.regExpMap.get(e);
84
- if (t !== void 0)
85
- return t;
86
- const i = new RegExp(e);
87
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, i), this.regExpQueue.push(e), i;
88
- }
89
- }
90
- const Ke = [" ", ",", "?", "!", ";"], Ae = new Ve(20), Ue = (o, e, t) => {
91
- e = e || "", t = t || "";
92
- const i = Ke.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
93
- if (i.length === 0) return !0;
94
- const s = Ae.getRegExp(`(${i.map((r) => r === "?" ? "\\?" : r).join("|")})`);
95
- let n = !s.test(o);
96
- if (!n) {
97
- const r = o.indexOf(t);
98
- r > 0 && !s.test(o.substring(0, r)) && (n = !0);
99
- }
100
- return n;
101
- }, q = (o, e, t = ".") => {
102
- if (!o) return;
103
- if (o[e])
104
- return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
105
- const i = e.split(t);
106
- let s = o;
107
- for (let n = 0; n < i.length; ) {
108
- if (!s || typeof s != "object")
109
- return;
110
- let r, a = "";
111
- for (let u = n; u < i.length; ++u)
112
- if (u !== n && (a += t), a += i[u], r = s[a], r !== void 0) {
113
- if (["string", "number", "boolean"].indexOf(typeof r) > -1 && u < i.length - 1)
114
- continue;
115
- n += u - n + 1;
116
- break;
117
- }
118
- s = r;
119
- }
120
- return s;
121
- }, B = (o) => o == null ? void 0 : o.replace("_", "-"), He = {
122
- type: "logger",
123
- log(o) {
124
- this.output("log", o);
125
- },
126
- warn(o) {
127
- this.output("warn", o);
128
- },
129
- error(o) {
130
- this.output("error", o);
131
- },
132
- output(o, e) {
133
- var t, i;
134
- (i = (t = console == null ? void 0 : console[o]) == null ? void 0 : t.apply) == null || i.call(t, console, e);
135
- }
136
- };
137
- class _ {
138
- constructor(e, t = {}) {
139
- this.init(e, t);
140
- }
141
- init(e, t = {}) {
142
- this.prefix = t.prefix || "i18next:", this.logger = e || He, this.options = t, this.debug = t.debug;
143
- }
144
- log(...e) {
145
- return this.forward(e, "log", "", !0);
146
- }
147
- warn(...e) {
148
- return this.forward(e, "warn", "", !0);
149
- }
150
- error(...e) {
151
- return this.forward(e, "error", "");
152
- }
153
- deprecate(...e) {
154
- return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
155
- }
156
- forward(e, t, i, s) {
157
- return s && !this.debug ? null : (p(e[0]) && (e[0] = `${i}${this.prefix} ${e[0]}`), this.logger[t](e));
158
- }
159
- create(e) {
160
- return new _(this.logger, d({
161
- prefix: `${this.prefix}:${e}:`
162
- }, this.options));
163
- }
164
- clone(e) {
165
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new _(this.logger, e);
166
- }
167
- }
168
- var k = new _();
169
- class G {
170
- constructor() {
171
- this.observers = {};
172
- }
173
- on(e, t) {
174
- return e.split(" ").forEach((i) => {
175
- this.observers[i] || (this.observers[i] = /* @__PURE__ */ new Map());
176
- const s = this.observers[i].get(t) || 0;
177
- this.observers[i].set(t, s + 1);
178
- }), this;
179
- }
180
- off(e, t) {
181
- if (this.observers[e]) {
182
- if (!t) {
183
- delete this.observers[e];
184
- return;
185
- }
186
- this.observers[e].delete(t);
187
- }
188
- }
189
- emit(e, ...t) {
190
- this.observers[e] && Array.from(this.observers[e].entries()).forEach(([s, n]) => {
191
- for (let r = 0; r < n; r++)
192
- s(...t);
193
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([s, n]) => {
194
- for (let r = 0; r < n; r++)
195
- s.apply(s, [e, ...t]);
196
- });
197
- }
198
- }
199
- class he extends G {
200
- constructor(e, t = {
201
- ns: ["translation"],
202
- defaultNS: "translation"
203
- }) {
204
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
205
- }
206
- addNamespaces(e) {
207
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
208
- }
209
- removeNamespaces(e) {
210
- const t = this.options.ns.indexOf(e);
211
- t > -1 && this.options.ns.splice(t, 1);
212
- }
213
- getResource(e, t, i, s = {}) {
214
- var l, h;
215
- const n = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, r = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
216
- let a;
217
- e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], i && (Array.isArray(i) ? a.push(...i) : p(i) && n ? a.push(...i.split(n)) : a.push(i)));
218
- const u = Y(this.data, a);
219
- return !u && !t && !i && e.indexOf(".") > -1 && (e = a[0], t = a[1], i = a.slice(2).join(".")), u || !r || !p(i) ? u : q((h = (l = this.data) == null ? void 0 : l[e]) == null ? void 0 : h[t], i, n);
220
- }
221
- addResource(e, t, i, s, n = {
222
- silent: !1
223
- }) {
224
- const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
225
- let a = [e, t];
226
- i && (a = a.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (a = e.split("."), s = t, t = a[1]), this.addNamespaces(t), fe(this.data, a, s), n.silent || this.emit("added", e, t, i, s);
227
- }
228
- addResources(e, t, i, s = {
229
- silent: !1
230
- }) {
231
- for (const n in i)
232
- (p(i[n]) || Array.isArray(i[n])) && this.addResource(e, t, n, i[n], {
233
- silent: !0
234
- });
235
- s.silent || this.emit("added", e, t, i);
236
- }
237
- addResourceBundle(e, t, i, s, n, r = {
238
- silent: !1,
239
- skipCopy: !1
240
- }) {
241
- let a = [e, t];
242
- e.indexOf(".") > -1 && (a = e.split("."), s = i, i = t, t = a[1]), this.addNamespaces(t);
243
- let u = Y(this.data, a) || {};
244
- r.skipCopy || (i = JSON.parse(JSON.stringify(i))), s ? be(u, i, n) : u = d(d({}, u), i), fe(this.data, a, u), r.silent || this.emit("added", e, t, i);
245
- }
246
- removeResourceBundle(e, t) {
247
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
248
- }
249
- hasResourceBundle(e, t) {
250
- return this.getResource(e, t) !== void 0;
251
- }
252
- getResourceBundle(e, t) {
253
- return t || (t = this.options.defaultNS), this.getResource(e, t);
254
- }
255
- getDataByLanguage(e) {
256
- return this.data[e];
257
- }
258
- hasLanguageSomeTranslations(e) {
259
- const t = this.getDataByLanguage(e);
260
- return !!(t && Object.keys(t) || []).find((s) => t[s] && Object.keys(t[s]).length > 0);
261
- }
262
- toJSON() {
263
- return this.data;
264
- }
265
- }
266
- var Le = {
267
- processors: {},
268
- addPostProcessor(o) {
269
- this.processors[o.name] = o;
270
- },
271
- handle(o, e, t, i, s) {
272
- return o.forEach((n) => {
273
- var r, a;
274
- e = (a = (r = this.processors[n]) == null ? void 0 : r.process(e, t, i, s)) != null ? a : e;
275
- }), e;
276
- }
277
- };
278
- const we = Symbol("i18next/PATH_KEY");
279
- function Me() {
280
- const o = [], e = /* @__PURE__ */ Object.create(null);
281
- let t;
282
- return e.get = (i, s) => {
283
- var n;
284
- return (n = t == null ? void 0 : t.revoke) == null || n.call(t), s === we ? o : (o.push(s), t = Proxy.revocable(i, e), t.proxy);
285
- }, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
286
- }
287
- function ee(o, e) {
288
- var i;
289
- const {
290
- [we]: t
291
- } = o(Me());
292
- return t.join((i = e == null ? void 0 : e.keySeparator) != null ? i : ".");
293
- }
294
- const ce = {}, Z = (o) => !p(o) && typeof o != "boolean" && typeof o != "number";
295
- class Q extends G {
296
- constructor(e, t = {}) {
297
- super(), Fe(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = k.create("translator");
298
- }
299
- changeLanguage(e) {
300
- e && (this.language = e);
301
- }
302
- exists(e, t = {
303
- interpolation: {}
304
- }) {
305
- const i = d({}, t);
306
- if (e == null) return !1;
307
- const s = this.resolve(e, i);
308
- if ((s == null ? void 0 : s.res) === void 0) return !1;
309
- const n = Z(s.res);
310
- return !(i.returnObjects === !1 && n);
311
- }
312
- extractFromKey(e, t) {
313
- let i = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
314
- i === void 0 && (i = ":");
315
- const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
316
- let n = t.ns || this.options.defaultNS || [];
317
- const r = i && e.indexOf(i) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ue(e, i, s);
318
- if (r && !a) {
319
- const u = e.match(this.interpolator.nestingRegexp);
320
- if (u && u.length > 0)
321
- return {
322
- key: e,
323
- namespaces: p(n) ? [n] : n
324
- };
325
- const l = e.split(i);
326
- (i !== s || i === s && this.options.ns.indexOf(l[0]) > -1) && (n = l.shift()), e = l.join(s);
327
- }
328
- return {
329
- key: e,
330
- namespaces: p(n) ? [n] : n
331
- };
332
- }
333
- translate(e, t, i) {
334
- let s = typeof t == "object" ? d({}, t) : t;
335
- if (typeof s != "object" && this.options.overloadTranslationOptionHandler && (s = this.options.overloadTranslationOptionHandler(arguments)), typeof s == "object" && (s = d({}, s)), s || (s = {}), e == null) return "";
336
- typeof e == "function" && (e = ee(e, d(d({}, this.options), s))), Array.isArray(e) || (e = [String(e)]);
337
- const n = s.returnDetails !== void 0 ? s.returnDetails : this.options.returnDetails, r = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, {
338
- key: a,
339
- namespaces: u
340
- } = this.extractFromKey(e[e.length - 1], s), l = u[u.length - 1];
341
- let h = s.nsSeparator !== void 0 ? s.nsSeparator : this.options.nsSeparator;
342
- h === void 0 && (h = ":");
343
- const f = s.lng || this.language, m = s.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
344
- if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
345
- return m ? n ? {
346
- res: `${l}${h}${a}`,
347
- usedKey: a,
348
- exactUsedKey: a,
349
- usedLng: f,
350
- usedNS: l,
351
- usedParams: this.getUsedParamsDetails(s)
352
- } : `${l}${h}${a}` : n ? {
353
- res: a,
354
- usedKey: a,
355
- exactUsedKey: a,
356
- usedLng: f,
357
- usedNS: l,
358
- usedParams: this.getUsedParamsDetails(s)
359
- } : a;
360
- const g = this.resolve(e, s);
361
- let c = g == null ? void 0 : g.res;
362
- const x = (g == null ? void 0 : g.usedKey) || a, y = (g == null ? void 0 : g.exactUsedKey) || a, R = ["[object Number]", "[object Function]", "[object RegExp]"], C = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, T = !this.i18nFormat || this.i18nFormat.handleAsObject, O = s.count !== void 0 && !p(s.count), F = Q.hasDefaultValue(s), z = O ? this.pluralResolver.getSuffix(f, s.count, s) : "", j = s.ordinal && O ? this.pluralResolver.getSuffix(f, s.count, {
363
- ordinal: !1
364
- }) : "", V = O && !s.ordinal && s.count === 0, w = V && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${z}`] || s[`defaultValue${j}`] || s.defaultValue;
365
- let S = c;
366
- T && !c && F && (S = w);
367
- const ve = Z(S), Ce = Object.prototype.toString.apply(S);
368
- if (T && S && ve && R.indexOf(Ce) < 0 && !(p(C) && Array.isArray(S))) {
369
- if (!s.returnObjects && !this.options.returnObjects) {
370
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
371
- const $ = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(x, S, b(d({}, s), {
372
- ns: u
373
- })) : `key '${a} (${this.language})' returned an object instead of string.`;
374
- return n ? (g.res = $, g.usedParams = this.getUsedParamsDetails(s), g) : $;
375
- }
376
- if (r) {
377
- const $ = Array.isArray(S), P = $ ? [] : {}, te = $ ? y : x;
378
- for (const N in S)
379
- if (Object.prototype.hasOwnProperty.call(S, N)) {
380
- const E = `${te}${r}${N}`;
381
- F && !c ? P[N] = this.translate(E, b(d({}, s), {
382
- defaultValue: Z(w) ? w[N] : void 0,
383
- joinArrays: !1,
384
- ns: u
385
- })) : P[N] = this.translate(E, b(d({}, s), {
386
- joinArrays: !1,
387
- ns: u
388
- })), P[N] === E && (P[N] = S[N]);
389
- }
390
- c = P;
391
- }
392
- } else if (T && p(C) && Array.isArray(c))
393
- c = c.join(C), c && (c = this.extendTranslation(c, e, s, i));
394
- else {
395
- let $ = !1, P = !1;
396
- !this.isValidLookup(c) && F && ($ = !0, c = w), this.isValidLookup(c) || (P = !0, c = a);
397
- const N = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && P ? void 0 : c, E = F && w !== c && this.options.updateMissing;
398
- if (P || $ || E) {
399
- if (this.logger.log(E ? "updateKey" : "missingKey", f, l, a, E ? w : c), r) {
400
- const v = this.resolve(a, b(d({}, s), {
401
- keySeparator: !1
402
- }));
403
- v && v.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.");
404
- }
405
- let K = [];
406
- const J = this.languageUtils.getFallbackCodes(this.options.fallbackLng, s.lng || this.language);
407
- if (this.options.saveMissingTo === "fallback" && J && J[0])
408
- for (let v = 0; v < J.length; v++)
409
- K.push(J[v]);
410
- else this.options.saveMissingTo === "all" ? K = this.languageUtils.toResolveHierarchy(s.lng || this.language) : K.push(s.lng || this.language);
411
- const se = (v, I, A) => {
412
- var ne;
413
- const ie = F && A !== c ? A : N;
414
- this.options.missingKeyHandler ? this.options.missingKeyHandler(v, l, I, ie, E, s) : (ne = this.backendConnector) != null && ne.saveMissing && this.backendConnector.saveMissing(v, l, I, ie, E, s), this.emit("missingKey", v, l, I, c);
415
- };
416
- this.options.saveMissing && (this.options.saveMissingPlurals && O ? K.forEach((v) => {
417
- const I = this.pluralResolver.getSuffixes(v, s);
418
- V && s[`defaultValue${this.options.pluralSeparator}zero`] && I.indexOf(`${this.options.pluralSeparator}zero`) < 0 && I.push(`${this.options.pluralSeparator}zero`), I.forEach((A) => {
419
- se([v], a + A, s[`defaultValue${A}`] || w);
420
- });
421
- }) : se(K, a, w));
422
- }
423
- c = this.extendTranslation(c, e, s, g, i), P && c === a && this.options.appendNamespaceToMissingKey && (c = `${l}${h}${a}`), (P || $) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${h}${a}` : a, $ ? c : void 0, s));
424
- }
425
- return n ? (g.res = c, g.usedParams = this.getUsedParamsDetails(s), g) : c;
426
- }
427
- extendTranslation(e, t, i, s, n) {
428
- var u, l;
429
- if ((u = this.i18nFormat) != null && u.parse)
430
- e = this.i18nFormat.parse(e, d(d({}, this.options.interpolation.defaultVariables), i), i.lng || this.language || s.usedLng, s.usedNS, s.usedKey, {
431
- resolved: s
432
- });
433
- else if (!i.skipInterpolation) {
434
- i.interpolation && this.interpolator.init(b(d({}, i), {
435
- interpolation: d(d({}, this.options.interpolation), i.interpolation)
436
- }));
437
- const h = p(e) && (((l = i == null ? void 0 : i.interpolation) == null ? void 0 : l.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
438
- let f;
439
- if (h) {
440
- const g = e.match(this.interpolator.nestingRegexp);
441
- f = g && g.length;
442
- }
443
- let m = i.replace && !p(i.replace) ? i.replace : i;
444
- if (this.options.interpolation.defaultVariables && (m = d(d({}, this.options.interpolation.defaultVariables), m)), e = this.interpolator.interpolate(e, m, i.lng || this.language || s.usedLng, i), h) {
445
- const g = e.match(this.interpolator.nestingRegexp), c = g && g.length;
446
- f < c && (i.nest = !1);
447
- }
448
- !i.lng && s && s.res && (i.lng = this.language || s.usedLng), i.nest !== !1 && (e = this.interpolator.nest(e, (...g) => (n == null ? void 0 : n[0]) === g[0] && !i.context ? (this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${t[0]}`), null) : this.translate(...g, t), i)), i.interpolation && this.interpolator.reset();
449
- }
450
- const r = i.postProcess || this.options.postProcess, a = p(r) ? [r] : r;
451
- return e != null && (a != null && a.length) && i.applyPostProcessor !== !1 && (e = Le.handle(a, e, t, this.options && this.options.postProcessPassResolved ? d({
452
- i18nResolved: b(d({}, s), {
453
- usedParams: this.getUsedParamsDetails(i)
454
- })
455
- }, i) : i, this)), e;
456
- }
457
- resolve(e, t = {}) {
458
- let i, s, n, r, a;
459
- return p(e) && (e = [e]), e.forEach((u) => {
460
- if (this.isValidLookup(i)) return;
461
- const l = this.extractFromKey(u, t), h = l.key;
462
- s = h;
463
- let f = l.namespaces;
464
- this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
465
- const m = t.count !== void 0 && !p(t.count), g = m && !t.ordinal && t.count === 0, c = t.context !== void 0 && (p(t.context) || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
466
- f.forEach((y) => {
467
- var R, C;
468
- this.isValidLookup(i) || (a = y, !ce[`${x[0]}-${y}`] && ((R = this.utils) != null && R.hasLoadedNamespace) && !((C = this.utils) != null && C.hasLoadedNamespace(a)) && (ce[`${x[0]}-${y}`] = !0, this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" 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!!!")), x.forEach((T) => {
469
- var z;
470
- if (this.isValidLookup(i)) return;
471
- r = T;
472
- const O = [h];
473
- if ((z = this.i18nFormat) != null && z.addLookupKeys)
474
- this.i18nFormat.addLookupKeys(O, h, T, y, t);
475
- else {
476
- let j;
477
- m && (j = this.pluralResolver.getSuffix(T, t.count, t));
478
- const V = `${this.options.pluralSeparator}zero`, w = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
479
- if (m && (t.ordinal && j.indexOf(w) === 0 && O.push(h + j.replace(w, this.options.pluralSeparator)), O.push(h + j), g && O.push(h + V)), c) {
480
- const S = `${h}${this.options.contextSeparator || "_"}${t.context}`;
481
- O.push(S), m && (t.ordinal && j.indexOf(w) === 0 && O.push(S + j.replace(w, this.options.pluralSeparator)), O.push(S + j), g && O.push(S + V));
482
- }
483
- }
484
- let F;
485
- for (; F = O.pop(); )
486
- this.isValidLookup(i) || (n = F, i = this.getResource(T, y, F, t));
487
- }));
488
- });
489
- }), {
490
- res: i,
491
- usedKey: s,
492
- exactUsedKey: n,
493
- usedLng: r,
494
- usedNS: a
495
- };
496
- }
497
- isValidLookup(e) {
498
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
499
- }
500
- getResource(e, t, i, s = {}) {
501
- var n;
502
- return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, i, s) : this.resourceStore.getResource(e, t, i, s);
503
- }
504
- getUsedParamsDetails(e = {}) {
505
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], i = e.replace && !p(e.replace);
506
- let s = i ? e.replace : e;
507
- if (i && typeof e.count != "undefined" && (s.count = e.count), this.options.interpolation.defaultVariables && (s = d(d({}, this.options.interpolation.defaultVariables), s)), !i) {
508
- s = d({}, s);
509
- for (const n of t)
510
- delete s[n];
511
- }
512
- return s;
513
- }
514
- static hasDefaultValue(e) {
515
- const t = "defaultValue";
516
- for (const i in e)
517
- if (Object.prototype.hasOwnProperty.call(e, i) && t === i.substring(0, t.length) && e[i] !== void 0)
518
- return !0;
519
- return !1;
520
- }
521
- }
522
- class de {
523
- constructor(e) {
524
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = k.create("languageUtils");
525
- }
526
- getScriptPartFromCode(e) {
527
- if (e = B(e), !e || e.indexOf("-") < 0) return null;
528
- const t = e.split("-");
529
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
530
- }
531
- getLanguagePartFromCode(e) {
532
- if (e = B(e), !e || e.indexOf("-") < 0) return e;
533
- const t = e.split("-");
534
- return this.formatLanguageCode(t[0]);
535
- }
536
- formatLanguageCode(e) {
537
- if (p(e) && e.indexOf("-") > -1) {
538
- let t;
539
- try {
540
- t = Intl.getCanonicalLocales(e)[0];
541
- } catch (i) {
542
- }
543
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
544
- }
545
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
546
- }
547
- isSupportedCode(e) {
548
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
549
- }
550
- getBestMatchFromCodes(e) {
551
- if (!e) return null;
552
- let t;
553
- return e.forEach((i) => {
554
- if (t) return;
555
- const s = this.formatLanguageCode(i);
556
- (!this.options.supportedLngs || this.isSupportedCode(s)) && (t = s);
557
- }), !t && this.options.supportedLngs && e.forEach((i) => {
558
- if (t) return;
559
- const s = this.getScriptPartFromCode(i);
560
- if (this.isSupportedCode(s)) return t = s;
561
- const n = this.getLanguagePartFromCode(i);
562
- if (this.isSupportedCode(n)) return t = n;
563
- t = this.options.supportedLngs.find((r) => {
564
- if (r === n) return r;
565
- if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && (r.indexOf("-") > 0 && n.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === n || r.indexOf(n) === 0 && n.length > 1))
566
- return r;
567
- });
568
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
569
- }
570
- getFallbackCodes(e, t) {
571
- if (!e) return [];
572
- if (typeof e == "function" && (e = e(t)), p(e) && (e = [e]), Array.isArray(e)) return e;
573
- if (!t) return e.default || [];
574
- let i = e[t];
575
- return i || (i = e[this.getScriptPartFromCode(t)]), i || (i = e[this.formatLanguageCode(t)]), i || (i = e[this.getLanguagePartFromCode(t)]), i || (i = e.default), i || [];
576
- }
577
- toResolveHierarchy(e, t) {
578
- const i = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), s = [], n = (r) => {
579
- r && (this.isSupportedCode(r) ? s.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
580
- };
581
- return p(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : p(e) && n(this.formatLanguageCode(e)), i.forEach((r) => {
582
- s.indexOf(r) < 0 && n(this.formatLanguageCode(r));
583
- }), s;
584
- }
585
- }
586
- const ge = {
587
- zero: 0,
588
- one: 1,
589
- two: 2,
590
- few: 3,
591
- many: 4,
592
- other: 5
593
- }, pe = {
594
- select: (o) => o === 1 ? "one" : "other",
595
- resolvedOptions: () => ({
596
- pluralCategories: ["one", "other"]
597
- })
598
- };
599
- class Be {
600
- constructor(e, t = {}) {
601
- this.languageUtils = e, this.options = t, this.logger = k.create("pluralResolver"), this.pluralRulesCache = {};
602
- }
603
- addRule(e, t) {
604
- this.rules[e] = t;
605
- }
606
- clearCache() {
607
- this.pluralRulesCache = {};
608
- }
609
- getRule(e, t = {}) {
610
- const i = B(e === "dev" ? "en" : e), s = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
611
- cleanedCode: i,
612
- type: s
613
- });
614
- if (n in this.pluralRulesCache)
615
- return this.pluralRulesCache[n];
616
- let r;
617
- try {
618
- r = new Intl.PluralRules(i, {
619
- type: s
620
- });
621
- } catch (a) {
622
- if (!Intl)
623
- return this.logger.error("No Intl support, please use an Intl polyfill!"), pe;
624
- if (!e.match(/-|_/)) return pe;
625
- const u = this.languageUtils.getLanguagePartFromCode(e);
626
- r = this.getRule(u, t);
627
- }
628
- return this.pluralRulesCache[n] = r, r;
629
- }
630
- needsPlural(e, t = {}) {
631
- let i = this.getRule(e, t);
632
- return i || (i = this.getRule("dev", t)), (i == null ? void 0 : i.resolvedOptions().pluralCategories.length) > 1;
633
- }
634
- getPluralFormsOfKey(e, t, i = {}) {
635
- return this.getSuffixes(e, i).map((s) => `${t}${s}`);
636
- }
637
- getSuffixes(e, t = {}) {
638
- let i = this.getRule(e, t);
639
- return i || (i = this.getRule("dev", t)), i ? i.resolvedOptions().pluralCategories.sort((s, n) => ge[s] - ge[n]).map((s) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${s}`) : [];
640
- }
641
- getSuffix(e, t, i = {}) {
642
- const s = this.getRule(e, i);
643
- return s ? `${this.options.prepend}${i.ordinal ? `ordinal${this.options.prepend}` : ""}${s.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, i));
644
- }
645
- }
646
- const me = (o, e, t, i = ".", s = !0) => {
647
- let n = Te(o, e, t);
648
- return !n && s && p(t) && (n = q(o, t, i), n === void 0 && (n = q(e, t, i))), n;
649
- }, X = (o) => o.replace(/\$/g, "$$$$");
650
- class xe {
651
- constructor(e = {}) {
652
- var t;
653
- this.logger = k.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((i) => i), this.init(e);
654
- }
655
- init(e = {}) {
656
- e.interpolation || (e.interpolation = {
657
- escapeValue: !0
658
- });
659
- const {
660
- escape: t,
661
- escapeValue: i,
662
- useRawValueToEscape: s,
663
- prefix: n,
664
- prefixEscaped: r,
665
- suffix: a,
666
- suffixEscaped: u,
667
- formatSeparator: l,
668
- unescapeSuffix: h,
669
- unescapePrefix: f,
670
- nestingPrefix: m,
671
- nestingPrefixEscaped: g,
672
- nestingSuffix: c,
673
- nestingSuffixEscaped: x,
674
- nestingOptionsSeparator: y,
675
- maxReplaces: R,
676
- alwaysFormat: C
677
- } = e.interpolation;
678
- this.escape = t !== void 0 ? t : De, this.escapeValue = i !== void 0 ? i : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = n ? D(n) : r || "{{", this.suffix = a ? D(a) : u || "}}", this.formatSeparator = l || ",", this.unescapePrefix = h ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = m ? D(m) : g || D("$t("), this.nestingSuffix = c ? D(c) : x || D(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = R || 1e3, this.alwaysFormat = C !== void 0 ? C : !1, this.resetRegExp();
679
- }
680
- reset() {
681
- this.options && this.init(this.options);
682
- }
683
- resetRegExp() {
684
- const e = (t, i) => (t == null ? void 0 : t.source) === i ? (t.lastIndex = 0, t) : new RegExp(i, "g");
685
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
686
- }
687
- interpolate(e, t, i, s) {
688
- var g;
689
- let n, r, a;
690
- const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (c) => {
691
- if (c.indexOf(this.formatSeparator) < 0) {
692
- const C = me(t, u, c, this.options.keySeparator, this.options.ignoreJSONStructure);
693
- return this.alwaysFormat ? this.format(C, void 0, i, b(d(d({}, s), t), {
694
- interpolationkey: c
695
- })) : C;
696
- }
697
- const x = c.split(this.formatSeparator), y = x.shift().trim(), R = x.join(this.formatSeparator).trim();
698
- return this.format(me(t, u, y, this.options.keySeparator, this.options.ignoreJSONStructure), R, i, b(d(d({}, s), t), {
699
- interpolationkey: y
700
- }));
701
- };
702
- this.resetRegExp();
703
- const h = (s == null ? void 0 : s.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((g = s == null ? void 0 : s.interpolation) == null ? void 0 : g.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
704
- return [{
705
- regex: this.regexpUnescape,
706
- safeValue: (c) => X(c)
707
- }, {
708
- regex: this.regexp,
709
- safeValue: (c) => this.escapeValue ? X(this.escape(c)) : X(c)
710
- }].forEach((c) => {
711
- for (a = 0; n = c.regex.exec(e); ) {
712
- const x = n[1].trim();
713
- if (r = l(x), r === void 0)
714
- if (typeof h == "function") {
715
- const R = h(e, n, s);
716
- r = p(R) ? R : "";
717
- } else if (s && Object.prototype.hasOwnProperty.call(s, x))
718
- r = "";
719
- else if (f) {
720
- r = n[0];
721
- continue;
722
- } else
723
- this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`), r = "";
724
- else !p(r) && !this.useRawValueToEscape && (r = oe(r));
725
- const y = c.safeValue(r);
726
- if (e = e.replace(n[0], y), f ? (c.regex.lastIndex += r.length, c.regex.lastIndex -= n[0].length) : c.regex.lastIndex = 0, a++, a >= this.maxReplaces)
727
- break;
728
- }
729
- }), e;
730
- }
731
- nest(e, t, i = {}) {
732
- let s, n, r;
733
- const a = (u, l) => {
734
- var x;
735
- const h = this.nestingOptionsSeparator;
736
- if (u.indexOf(h) < 0) return u;
737
- const f = u.split(new RegExp(`${h}[ ]*{`));
738
- let m = `{${f[1]}`;
739
- u = f[0], m = this.interpolate(m, r);
740
- const g = m.match(/'/g), c = m.match(/"/g);
741
- (((x = g == null ? void 0 : g.length) != null ? x : 0) % 2 === 0 && !c || c.length % 2 !== 0) && (m = m.replace(/'/g, '"'));
742
- try {
743
- r = JSON.parse(m), l && (r = d(d({}, l), r));
744
- } catch (y) {
745
- return this.logger.warn(`failed parsing options string in nesting for key ${u}`, y), `${u}${h}${m}`;
746
- }
747
- return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, u;
748
- };
749
- for (; s = this.nestingRegexp.exec(e); ) {
750
- let u = [];
751
- r = d({}, i), r = r.replace && !p(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
752
- const l = /{.*}/.test(s[1]) ? s[1].lastIndexOf("}") + 1 : s[1].indexOf(this.formatSeparator);
753
- if (l !== -1 && (u = s[1].slice(l).split(this.formatSeparator).map((h) => h.trim()).filter(Boolean), s[1] = s[1].slice(0, l)), n = t(a.call(this, s[1].trim(), r), r), n && s[0] === e && !p(n)) return n;
754
- p(n) || (n = oe(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), u.length && (n = u.reduce((h, f) => this.format(h, f, i.lng, b(d({}, i), {
755
- interpolationkey: s[1].trim()
756
- })), n.trim())), e = e.replace(s[0], n), this.regexp.lastIndex = 0;
757
- }
758
- return e;
759
- }
760
- }
761
- const ze = (o) => {
762
- let e = o.toLowerCase().trim();
763
- const t = {};
764
- if (o.indexOf("(") > -1) {
765
- const i = o.split("(");
766
- e = i[0].toLowerCase().trim();
767
- const s = i[1].substring(0, i[1].length - 1);
768
- e === "currency" && s.indexOf(":") < 0 ? t.currency || (t.currency = s.trim()) : e === "relativetime" && s.indexOf(":") < 0 ? t.range || (t.range = s.trim()) : s.split(";").forEach((r) => {
769
- if (r) {
770
- const [a, ...u] = r.split(":"), l = u.join(":").trim().replace(/^'+|'+$/g, ""), h = a.trim();
771
- t[h] || (t[h] = l), l === "false" && (t[h] = !1), l === "true" && (t[h] = !0), isNaN(l) || (t[h] = parseInt(l, 10));
772
- }
773
- });
774
- }
775
- return {
776
- formatName: e,
777
- formatOptions: t
778
- };
779
- }, ye = (o) => {
780
- const e = {};
781
- return (t, i, s) => {
782
- let n = s;
783
- s && s.interpolationkey && s.formatParams && s.formatParams[s.interpolationkey] && s[s.interpolationkey] && (n = b(d({}, n), {
784
- [s.interpolationkey]: void 0
785
- }));
786
- const r = i + JSON.stringify(n);
787
- let a = e[r];
788
- return a || (a = o(B(i), s), e[r] = a), a(t);
789
- };
790
- }, Je = (o) => (e, t, i) => o(B(t), i)(e);
791
- class We {
792
- constructor(e = {}) {
793
- this.logger = k.create("formatter"), this.options = e, this.init(e);
794
- }
795
- init(e, t = {
796
- interpolation: {}
797
- }) {
798
- this.formatSeparator = t.interpolation.formatSeparator || ",";
799
- const i = t.cacheInBuiltFormats ? ye : Je;
800
- this.formats = {
801
- number: i((s, n) => {
802
- const r = new Intl.NumberFormat(s, d({}, n));
803
- return (a) => r.format(a);
804
- }),
805
- currency: i((s, n) => {
806
- const r = new Intl.NumberFormat(s, b(d({}, n), {
807
- style: "currency"
808
- }));
809
- return (a) => r.format(a);
810
- }),
811
- datetime: i((s, n) => {
812
- const r = new Intl.DateTimeFormat(s, d({}, n));
813
- return (a) => r.format(a);
814
- }),
815
- relativetime: i((s, n) => {
816
- const r = new Intl.RelativeTimeFormat(s, d({}, n));
817
- return (a) => r.format(a, n.range || "day");
818
- }),
819
- list: i((s, n) => {
820
- const r = new Intl.ListFormat(s, d({}, n));
821
- return (a) => r.format(a);
822
- })
823
- };
824
- }
825
- add(e, t) {
826
- this.formats[e.toLowerCase().trim()] = t;
827
- }
828
- addCached(e, t) {
829
- this.formats[e.toLowerCase().trim()] = ye(t);
830
- }
831
- format(e, t, i, s = {}) {
832
- const n = t.split(this.formatSeparator);
833
- if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((a) => a.indexOf(")") > -1)) {
834
- const a = n.findIndex((u) => u.indexOf(")") > -1);
835
- n[0] = [n[0], ...n.splice(1, a)].join(this.formatSeparator);
836
- }
837
- return n.reduce((a, u) => {
838
- var f;
839
- const {
840
- formatName: l,
841
- formatOptions: h
842
- } = ze(u);
843
- if (this.formats[l]) {
844
- let m = a;
845
- try {
846
- const g = ((f = s == null ? void 0 : s.formatParams) == null ? void 0 : f[s.interpolationkey]) || {}, c = g.locale || g.lng || s.locale || s.lng || i;
847
- m = this.formats[l](a, c, d(d(d({}, h), s), g));
848
- } catch (g) {
849
- this.logger.warn(g);
850
- }
851
- return m;
852
- } else
853
- this.logger.warn(`there was no format function for ${l}`);
854
- return a;
855
- }, e);
856
- }
857
- }
858
- const Ye = (o, e) => {
859
- o.pending[e] !== void 0 && (delete o.pending[e], o.pendingCount--);
860
- };
861
- class _e extends G {
862
- constructor(e, t, i, s = {}) {
863
- var n, r;
864
- super(), this.backend = e, this.store = t, this.services = i, this.languageUtils = i.languageUtils, this.options = s, this.logger = k.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = s.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = s.maxRetries >= 0 ? s.maxRetries : 5, this.retryTimeout = s.retryTimeout >= 1 ? s.retryTimeout : 350, this.state = {}, this.queue = [], (r = (n = this.backend) == null ? void 0 : n.init) == null || r.call(n, i, s.backend, s);
865
- }
866
- queueLoad(e, t, i, s) {
867
- const n = {}, r = {}, a = {}, u = {};
868
- return e.forEach((l) => {
869
- let h = !0;
870
- t.forEach((f) => {
871
- const m = `${l}|${f}`;
872
- !i.reload && this.store.hasResourceBundle(l, f) ? this.state[m] = 2 : this.state[m] < 0 || (this.state[m] === 1 ? r[m] === void 0 && (r[m] = !0) : (this.state[m] = 1, h = !1, r[m] === void 0 && (r[m] = !0), n[m] === void 0 && (n[m] = !0), u[f] === void 0 && (u[f] = !0)));
873
- }), h || (a[l] = !0);
874
- }), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
875
- pending: r,
876
- pendingCount: Object.keys(r).length,
877
- loaded: {},
878
- errors: [],
879
- callback: s
880
- }), {
881
- toLoad: Object.keys(n),
882
- pending: Object.keys(r),
883
- toLoadLanguages: Object.keys(a),
884
- toLoadNamespaces: Object.keys(u)
885
- };
886
- }
887
- loaded(e, t, i) {
888
- const s = e.split("|"), n = s[0], r = s[1];
889
- t && this.emit("failedLoading", n, r, t), !t && i && this.store.addResourceBundle(n, r, i, void 0, void 0, {
890
- skipCopy: !0
891
- }), this.state[e] = t ? -1 : 2, t && i && (this.state[e] = 0);
892
- const a = {};
893
- this.queue.forEach((u) => {
894
- Ee(u.loaded, [n], r), Ye(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((l) => {
895
- a[l] || (a[l] = {});
896
- const h = u.loaded[l];
897
- h.length && h.forEach((f) => {
898
- a[l][f] === void 0 && (a[l][f] = !0);
899
- });
900
- }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
901
- }), this.emit("loaded", a), this.queue = this.queue.filter((u) => !u.done);
902
- }
903
- read(e, t, i, s = 0, n = this.retryTimeout, r) {
904
- if (!e.length) return r(null, {});
905
- if (this.readingCalls >= this.maxParallelReads) {
906
- this.waitingReads.push({
907
- lng: e,
908
- ns: t,
909
- fcName: i,
910
- tried: s,
911
- wait: n,
912
- callback: r
913
- });
914
- return;
915
- }
916
- this.readingCalls++;
917
- const a = (l, h) => {
918
- if (this.readingCalls--, this.waitingReads.length > 0) {
919
- const f = this.waitingReads.shift();
920
- this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
921
- }
922
- if (l && h && s < this.maxRetries) {
923
- setTimeout(() => {
924
- this.read.call(this, e, t, i, s + 1, n * 2, r);
925
- }, n);
926
- return;
927
- }
928
- r(l, h);
929
- }, u = this.backend[i].bind(this.backend);
930
- if (u.length === 2) {
931
- try {
932
- const l = u(e, t);
933
- l && typeof l.then == "function" ? l.then((h) => a(null, h)).catch(a) : a(null, l);
934
- } catch (l) {
935
- a(l);
936
- }
937
- return;
938
- }
939
- return u(e, t, a);
940
- }
941
- prepareLoading(e, t, i = {}, s) {
942
- if (!this.backend)
943
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
944
- p(e) && (e = this.languageUtils.toResolveHierarchy(e)), p(t) && (t = [t]);
945
- const n = this.queueLoad(e, t, i, s);
946
- if (!n.toLoad.length)
947
- return n.pending.length || s(), null;
948
- n.toLoad.forEach((r) => {
949
- this.loadOne(r);
950
- });
951
- }
952
- load(e, t, i) {
953
- this.prepareLoading(e, t, {}, i);
954
- }
955
- reload(e, t, i) {
956
- this.prepareLoading(e, t, {
957
- reload: !0
958
- }, i);
959
- }
960
- loadOne(e, t = "") {
961
- const i = e.split("|"), s = i[0], n = i[1];
962
- this.read(s, n, "read", void 0, void 0, (r, a) => {
963
- r && this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`, r), !r && a && this.logger.log(`${t}loaded namespace ${n} for language ${s}`, a), this.loaded(e, r, a);
964
- });
965
- }
966
- saveMissing(e, t, i, s, n, r = {}, a = () => {
967
- }) {
968
- var u, l, h, f, m;
969
- if ((l = (u = this.services) == null ? void 0 : u.utils) != null && l.hasLoadedNamespace && !((f = (h = this.services) == null ? void 0 : h.utils) != null && f.hasLoadedNamespace(t))) {
970
- this.logger.warn(`did not save key "${i}" as the namespace "${t}" 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!!!");
971
- return;
972
- }
973
- if (!(i == null || i === "")) {
974
- if ((m = this.backend) != null && m.create) {
975
- const g = b(d({}, r), {
976
- isUpdate: n
977
- }), c = this.backend.create.bind(this.backend);
978
- if (c.length < 6)
979
- try {
980
- let x;
981
- c.length === 5 ? x = c(e, t, i, s, g) : x = c(e, t, i, s), x && typeof x.then == "function" ? x.then((y) => a(null, y)).catch(a) : a(null, x);
982
- } catch (x) {
983
- a(x);
984
- }
985
- else
986
- c(e, t, i, s, a, g);
987
- }
988
- !e || !e[0] || this.store.addResource(e[0], t, i, s);
989
- }
990
- }
991
- }
992
- const Se = () => ({
993
- debug: !1,
994
- initAsync: !0,
995
- ns: ["translation"],
996
- defaultNS: ["translation"],
997
- fallbackLng: ["dev"],
998
- fallbackNS: !1,
999
- supportedLngs: !1,
1000
- nonExplicitSupportedLngs: !1,
1001
- load: "all",
1002
- preload: !1,
1003
- simplifyPluralSuffix: !0,
1004
- keySeparator: ".",
1005
- nsSeparator: ":",
1006
- pluralSeparator: "_",
1007
- contextSeparator: "_",
1008
- partialBundledLanguages: !1,
1009
- saveMissing: !1,
1010
- updateMissing: !1,
1011
- saveMissingTo: "fallback",
1012
- saveMissingPlurals: !0,
1013
- missingKeyHandler: !1,
1014
- missingInterpolationHandler: !1,
1015
- postProcess: !1,
1016
- postProcessPassResolved: !1,
1017
- returnNull: !1,
1018
- returnEmptyString: !0,
1019
- returnObjects: !1,
1020
- joinArrays: !1,
1021
- returnedObjectHandler: !1,
1022
- parseMissingKeyHandler: !1,
1023
- appendNamespaceToMissingKey: !1,
1024
- appendNamespaceToCIMode: !1,
1025
- overloadTranslationOptionHandler: (o) => {
1026
- let e = {};
1027
- if (typeof o[1] == "object" && (e = o[1]), p(o[1]) && (e.defaultValue = o[1]), p(o[2]) && (e.tDescription = o[2]), typeof o[2] == "object" || typeof o[3] == "object") {
1028
- const t = o[3] || o[2];
1029
- Object.keys(t).forEach((i) => {
1030
- e[i] = t[i];
1031
- });
1032
- }
1033
- return e;
1034
- },
1035
- interpolation: {
1036
- escapeValue: !0,
1037
- format: (o) => o,
1038
- prefix: "{{",
1039
- suffix: "}}",
1040
- formatSeparator: ",",
1041
- unescapePrefix: "-",
1042
- nestingPrefix: "$t(",
1043
- nestingSuffix: ")",
1044
- nestingOptionsSeparator: ",",
1045
- maxReplaces: 1e3,
1046
- skipOnVariables: !0
1047
- },
1048
- cacheInBuiltFormats: !0
1049
- }), Oe = (o) => {
1050
- var e, t;
1051
- return p(o.ns) && (o.ns = [o.ns]), p(o.fallbackLng) && (o.fallbackLng = [o.fallbackLng]), p(o.fallbackNS) && (o.fallbackNS = [o.fallbackNS]), ((t = (e = o.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (o.supportedLngs = o.supportedLngs.concat(["cimode"])), typeof o.initImmediate == "boolean" && (o.initAsync = o.initImmediate), o;
1052
- }, W = () => {
1053
- }, Qe = (o) => {
1054
- Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach((t) => {
1055
- typeof o[t] == "function" && (o[t] = o[t].bind(o));
1056
- });
1057
- };
1058
- class M extends G {
1059
- constructor(e = {}, t) {
1060
- if (super(), this.options = Oe(e), this.services = {}, this.logger = k, this.modules = {
1061
- external: []
1062
- }, Qe(this), t && !this.isInitialized && !e.isClone) {
1063
- if (!this.options.initAsync)
1064
- return this.init(e, t), this;
1065
- setTimeout(() => {
1066
- this.init(e, t);
1067
- }, 0);
1068
- }
1069
- }
1070
- init(e = {}, t) {
1071
- this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (p(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1072
- const i = Se();
1073
- this.options = d(d(d({}, i), this.options), Oe(e)), this.options.interpolation = d(d({}, i.interpolation), this.options.interpolation), e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = i.overloadTranslationOptionHandler);
1074
- const s = (l) => l ? typeof l == "function" ? new l() : l : null;
1075
- if (!this.options.isClone) {
1076
- this.modules.logger ? k.init(s(this.modules.logger), this.options) : k.init(null, this.options);
1077
- let l;
1078
- this.modules.formatter ? l = this.modules.formatter : l = We;
1079
- const h = new de(this.options);
1080
- this.store = new he(this.options.resources, this.options);
1081
- const f = this.services;
1082
- f.logger = k, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Be(h, {
1083
- prepend: this.options.pluralSeparator,
1084
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1085
- }), this.options.interpolation.format && this.options.interpolation.format !== i.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), l && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (f.formatter = s(l), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new xe(this.options), f.utils = {
1086
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1087
- }, f.backendConnector = new _e(s(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (g, ...c) => {
1088
- this.emit(g, ...c);
1089
- }), this.modules.languageDetector && (f.languageDetector = s(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = s(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new Q(this.services, this.options), this.translator.on("*", (g, ...c) => {
1090
- this.emit(g, ...c);
1091
- }), this.modules.external.forEach((g) => {
1092
- g.init && g.init(this);
1093
- });
1094
- }
1095
- if (this.format = this.options.interpolation.format, t || (t = W), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1096
- const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1097
- l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
1098
- }
1099
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((l) => {
1100
- this[l] = (...h) => this.store[l](...h);
1101
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((l) => {
1102
- this[l] = (...h) => (this.store[l](...h), this);
1103
- });
1104
- const a = U(), u = () => {
1105
- const l = (h, f) => {
1106
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), a.resolve(f), t(h, f);
1107
- };
1108
- if (this.languages && !this.isInitialized) return l(null, this.t.bind(this));
1109
- this.changeLanguage(this.options.lng, l);
1110
- };
1111
- return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), a;
1112
- }
1113
- loadResources(e, t = W) {
1114
- var n, r;
1115
- let i = t;
1116
- const s = p(e) ? e : this.language;
1117
- if (typeof e == "function" && (i = e), !this.options.resources || this.options.partialBundledLanguages) {
1118
- if ((s == null ? void 0 : s.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return i();
1119
- const a = [], u = (l) => {
1120
- if (!l || l === "cimode") return;
1121
- this.services.languageUtils.toResolveHierarchy(l).forEach((f) => {
1122
- f !== "cimode" && a.indexOf(f) < 0 && a.push(f);
1123
- });
1124
- };
1125
- s ? u(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((h) => u(h)), (r = (n = this.options.preload) == null ? void 0 : n.forEach) == null || r.call(n, (l) => u(l)), this.services.backendConnector.load(a, this.options.ns, (l) => {
1126
- !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), i(l);
1127
- });
1128
- } else
1129
- i(null);
1130
- }
1131
- reloadResources(e, t, i) {
1132
- const s = U();
1133
- return typeof e == "function" && (i = e, e = void 0), typeof t == "function" && (i = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), i || (i = W), this.services.backendConnector.reload(e, t, (n) => {
1134
- s.resolve(), i(n);
1135
- }), s;
1136
- }
1137
- use(e) {
1138
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1139
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1140
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && Le.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1141
- }
1142
- setResolvedLanguage(e) {
1143
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1144
- for (let t = 0; t < this.languages.length; t++) {
1145
- const i = this.languages[t];
1146
- if (!(["cimode", "dev"].indexOf(i) > -1) && this.store.hasLanguageSomeTranslations(i)) {
1147
- this.resolvedLanguage = i;
1148
- break;
1149
- }
1150
- }
1151
- !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1152
- }
1153
- }
1154
- changeLanguage(e, t) {
1155
- this.isLanguageChangingTo = e;
1156
- const i = U();
1157
- this.emit("languageChanging", e);
1158
- const s = (a) => {
1159
- this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
1160
- }, n = (a, u) => {
1161
- u ? this.isLanguageChangingTo === e && (s(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, i.resolve((...l) => this.t(...l)), t && t(a, (...l) => this.t(...l));
1162
- }, r = (a) => {
1163
- var h, f;
1164
- !e && !a && this.services.languageDetector && (a = []);
1165
- const u = p(a) ? a : a && a[0], l = this.store.hasLanguageSomeTranslations(u) ? u : this.services.languageUtils.getBestMatchFromCodes(p(a) ? [a] : a);
1166
- l && (this.language || s(l), this.translator.language || this.translator.changeLanguage(l), (f = (h = this.services.languageDetector) == null ? void 0 : h.cacheUserLanguage) == null || f.call(h, l)), this.loadResources(l, (m) => {
1167
- n(m, l);
1168
- });
1169
- };
1170
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e), i;
1171
- }
1172
- getFixedT(e, t, i) {
1173
- const s = (n, r, ...a) => {
1174
- let u;
1175
- typeof r != "object" ? u = this.options.overloadTranslationOptionHandler([n, r].concat(a)) : u = d({}, r), u.lng = u.lng || s.lng, u.lngs = u.lngs || s.lngs, u.ns = u.ns || s.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || i || s.keyPrefix);
1176
- const l = this.options.keySeparator || ".";
1177
- let h;
1178
- return u.keyPrefix && Array.isArray(n) ? h = n.map((f) => (typeof f == "function" && (f = ee(f, d(d({}, this.options), r))), `${u.keyPrefix}${l}${f}`)) : (typeof n == "function" && (n = ee(n, d(d({}, this.options), r))), h = u.keyPrefix ? `${u.keyPrefix}${l}${n}` : n), this.t(h, u);
1179
- };
1180
- return p(e) ? s.lng = e : s.lngs = e, s.ns = t, s.keyPrefix = i, s;
1181
- }
1182
- t(...e) {
1183
- var t;
1184
- return (t = this.translator) == null ? void 0 : t.translate(...e);
1185
- }
1186
- exists(...e) {
1187
- var t;
1188
- return (t = this.translator) == null ? void 0 : t.exists(...e);
1189
- }
1190
- setDefaultNamespace(e) {
1191
- this.options.defaultNS = e;
1192
- }
1193
- hasLoadedNamespace(e, t = {}) {
1194
- if (!this.isInitialized)
1195
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1196
- if (!this.languages || !this.languages.length)
1197
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1198
- const i = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
1199
- if (i.toLowerCase() === "cimode") return !0;
1200
- const r = (a, u) => {
1201
- const l = this.services.backendConnector.state[`${a}|${u}`];
1202
- return l === -1 || l === 0 || l === 2;
1203
- };
1204
- if (t.precheck) {
1205
- const a = t.precheck(this, r);
1206
- if (a !== void 0) return a;
1207
- }
1208
- return !!(this.hasResourceBundle(i, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(i, e) && (!s || r(n, e)));
1209
- }
1210
- loadNamespaces(e, t) {
1211
- const i = U();
1212
- return this.options.ns ? (p(e) && (e = [e]), e.forEach((s) => {
1213
- this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
1214
- }), this.loadResources((s) => {
1215
- i.resolve(), t && t(s);
1216
- }), i) : (t && t(), Promise.resolve());
1217
- }
1218
- loadLanguages(e, t) {
1219
- const i = U();
1220
- p(e) && (e = [e]);
1221
- const s = this.options.preload || [], n = e.filter((r) => s.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
1222
- return n.length ? (this.options.preload = s.concat(n), this.loadResources((r) => {
1223
- i.resolve(), t && t(r);
1224
- }), i) : (t && t(), Promise.resolve());
1225
- }
1226
- dir(e) {
1227
- var s, n;
1228
- if (e || (e = this.resolvedLanguage || (((s = this.languages) == null ? void 0 : s.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1229
- try {
1230
- const r = new Intl.Locale(e);
1231
- if (r && r.getTextInfo) {
1232
- const a = r.getTextInfo();
1233
- if (a && a.direction) return a.direction;
1234
- }
1235
- } catch (r) {
1236
- }
1237
- const t = ["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"], i = ((n = this.services) == null ? void 0 : n.languageUtils) || new de(Se());
1238
- return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1239
- }
1240
- static createInstance(e = {}, t) {
1241
- const i = new M(e, t);
1242
- return i.createInstance = M.createInstance, i;
1243
- }
1244
- cloneInstance(e = {}, t = W) {
1245
- const i = e.forkResourceStore;
1246
- i && delete e.forkResourceStore;
1247
- const s = b(d(d({}, this.options), e), {
1248
- isClone: !0
1249
- }), n = new M(s);
1250
- if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
1251
- n[a] = this[a];
1252
- }), n.services = d({}, this.services), n.services.utils = {
1253
- hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
1254
- }, i) {
1255
- const a = Object.keys(this.store.data).reduce((u, l) => (u[l] = d({}, this.store.data[l]), u[l] = Object.keys(u[l]).reduce((h, f) => (h[f] = d({}, u[l][f]), h), u[l]), u), {});
1256
- n.store = new he(a, s), n.services.resourceStore = n.store;
1257
- }
1258
- return e.interpolation && (n.services.interpolator = new xe(s)), n.translator = new Q(n.services, s), n.translator.on("*", (a, ...u) => {
1259
- n.emit(a, ...u);
1260
- }), n.init(s, t), n.translator.options = s, n.translator.backendConnector.services.utils = {
1261
- hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
1262
- }, n;
1263
- }
1264
- toJSON() {
1265
- return {
1266
- options: this.options,
1267
- store: this.store,
1268
- language: this.language,
1269
- languages: this.languages,
1270
- resolvedLanguage: this.resolvedLanguage
1271
- };
1272
- }
1273
- }
1274
- const L = M.createInstance();
1275
- L.createInstance;
1276
- L.dir;
1277
- L.init;
1278
- L.loadResources;
1279
- L.reloadResources;
1280
- L.use;
1281
- L.changeLanguage;
1282
- L.getFixedT;
1283
- L.t;
1284
- L.exists;
1285
- L.setDefaultNamespace;
1286
- L.hasLoadedNamespace;
1287
- L.loadNamespaces;
1288
- L.loadLanguages;
1289
- export {
1290
- L as default,
1291
- ee as keyFromSelector
1292
- };