locize 2.4.6 → 3.0.1

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 (903) hide show
  1. package/.babelrc +3 -0
  2. package/.ts.eslintrc +37 -0
  3. package/CHANGELOG.md +9 -0
  4. package/README.md +10 -19
  5. package/dist/cjs/api/handleCommitKey.js +17 -0
  6. package/dist/cjs/api/handleCommitKeys.js +39 -0
  7. package/dist/cjs/api/handleConfirmInitialized.js +11 -0
  8. package/dist/cjs/api/handleEditKey.js +60 -0
  9. package/dist/cjs/api/handleIsLocizeEnabled.js +11 -0
  10. package/dist/cjs/api/handleRequestPopupChanges.js +21 -0
  11. package/dist/cjs/api/handleRequestResourceBundle.js +27 -0
  12. package/dist/cjs/api/handleSelectedKeys.js +27 -0
  13. package/dist/cjs/api/handleTurnOff.js +8 -0
  14. package/dist/cjs/api/handleTurnOn.js +8 -0
  15. package/dist/cjs/api/postMessage.js +161 -0
  16. package/dist/cjs/clickHandler.js +48 -0
  17. package/dist/cjs/index.d.ts +15 -0
  18. package/dist/cjs/index.js +55 -0
  19. package/dist/cjs/locizePlugin.js +110 -0
  20. package/dist/cjs/observer.js +74 -0
  21. package/dist/cjs/package.json +1 -0
  22. package/dist/cjs/parser.js +122 -0
  23. package/dist/cjs/process.js +69 -0
  24. package/dist/cjs/processLegacy.js +80 -0
  25. package/dist/cjs/shims/uniqueID.js +31 -0
  26. package/dist/cjs/startStandalone.js +24 -0
  27. package/dist/cjs/store.js +49 -0
  28. package/dist/cjs/ui/elements/icons.js +48 -0
  29. package/dist/cjs/ui/elements/popup.js +80 -0
  30. package/dist/cjs/ui/elements/ribbonBox.js +67 -0
  31. package/dist/cjs/ui/highlightNode.js +167 -0
  32. package/dist/cjs/ui/mouseDistance.js +44 -0
  33. package/dist/cjs/ui/popup.js +113 -0
  34. package/dist/cjs/ui/stylesheet.js +12 -0
  35. package/dist/cjs/ui/utils.js +39 -0
  36. package/dist/cjs/uninstrumentedStore.js +43 -0
  37. package/dist/cjs/utils.js +138 -0
  38. package/dist/cjs/vars.js +22 -0
  39. package/dist/esm/api/handleCommitKey.js +15 -0
  40. package/dist/esm/api/handleCommitKeys.js +33 -0
  41. package/dist/esm/api/handleConfirmInitialized.js +9 -0
  42. package/dist/esm/api/handleEditKey.js +56 -0
  43. package/dist/esm/api/handleIsLocizeEnabled.js +9 -0
  44. package/dist/esm/api/handleRequestPopupChanges.js +19 -0
  45. package/dist/esm/api/handleRequestResourceBundle.js +20 -0
  46. package/dist/esm/api/handleSelectedKeys.js +25 -0
  47. package/dist/esm/api/handleTurnOff.js +6 -0
  48. package/dist/esm/api/handleTurnOn.js +6 -0
  49. package/dist/esm/api/postMessage.js +148 -0
  50. package/dist/esm/clickHandler.js +44 -0
  51. package/dist/esm/index.d.mts +1 -0
  52. package/dist/esm/index.d.ts +15 -0
  53. package/dist/esm/index.js +33 -0
  54. package/dist/esm/locizePlugin.js +99 -0
  55. package/dist/esm/observer.js +70 -0
  56. package/dist/esm/parser.js +113 -0
  57. package/dist/esm/process.js +61 -0
  58. package/dist/esm/processLegacy.js +72 -0
  59. package/dist/esm/shims/uniqueID.js +29 -0
  60. package/dist/esm/startStandalone.js +20 -0
  61. package/dist/esm/store.js +41 -0
  62. package/dist/esm/ui/elements/icons.js +39 -0
  63. package/dist/esm/ui/elements/popup.js +76 -0
  64. package/dist/esm/ui/elements/ribbonBox.js +62 -0
  65. package/dist/esm/ui/highlightNode.js +156 -0
  66. package/dist/esm/ui/mouseDistance.js +39 -0
  67. package/dist/esm/ui/popup.js +108 -0
  68. package/dist/esm/ui/stylesheet.js +8 -0
  69. package/dist/esm/ui/utils.js +34 -0
  70. package/dist/esm/uninstrumentedStore.js +35 -0
  71. package/dist/esm/utils.js +123 -0
  72. package/dist/esm/vars.js +16 -0
  73. package/dist/umd/locize.js +2796 -286
  74. package/dist/umd/locize.min.js +1 -1
  75. package/index.d.mts +1 -0
  76. package/index.d.ts +5 -6
  77. package/index.js +4 -4
  78. package/locize.js +2796 -286
  79. package/locize.min.js +1 -1
  80. package/package.json +64 -31
  81. package/rollup.config.js +62 -29
  82. package/src/api/handleCommitKey.js +17 -0
  83. package/src/api/handleCommitKeys.js +39 -0
  84. package/src/api/handleConfirmInitialized.js +10 -0
  85. package/src/api/handleEditKey.js +81 -0
  86. package/src/api/handleIsLocizeEnabled.js +13 -0
  87. package/src/api/handleRequestPopupChanges.js +25 -0
  88. package/src/api/handleRequestResourceBundle.js +11 -0
  89. package/src/api/handleSelectedKeys.js +32 -0
  90. package/src/api/handleTurnOff.js +8 -0
  91. package/src/api/handleTurnOn.js +8 -0
  92. package/src/api/index.js +19 -0
  93. package/src/api/postMessage.js +169 -0
  94. package/src/clickHandler.js +48 -0
  95. package/src/index.js +30 -0
  96. package/src/locizePlugin.js +117 -0
  97. package/src/observer.js +93 -0
  98. package/src/parser.js +162 -0
  99. package/src/process.js +62 -0
  100. package/src/processLegacy.js +69 -0
  101. package/src/shims/uniqueID.js +49 -0
  102. package/src/startStandalone.js +19 -0
  103. package/src/store.js +47 -0
  104. package/src/ui/elements/icons.js +92 -0
  105. package/src/ui/elements/popup.js +226 -0
  106. package/src/ui/elements/ribbonBox.js +76 -0
  107. package/src/ui/highlightNode.js +203 -0
  108. package/src/ui/mouseDistance.js +46 -0
  109. package/src/ui/popup.js +135 -0
  110. package/src/ui/stylesheet.js +8 -0
  111. package/src/ui/utils.js +37 -0
  112. package/src/uninstrumentedStore.js +39 -0
  113. package/src/utils.js +158 -0
  114. package/src/vars.js +18 -0
  115. package/tsconfig.json +4 -4
  116. package/.eslintrc.js +0 -20
  117. package/debuggingApp/README.md +0 -11
  118. package/debuggingApp/debugEditor.html +0 -28
  119. package/debuggingApp/index.html +0 -151
  120. package/debuggingApp/node_modules/.package-lock.json +0 -668
  121. package/debuggingApp/node_modules/@babel/runtime/LICENSE +0 -22
  122. package/debuggingApp/node_modules/@babel/runtime/README.md +0 -19
  123. package/debuggingApp/node_modules/@babel/runtime/helpers/AsyncGenerator.js +0 -98
  124. package/debuggingApp/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -5
  125. package/debuggingApp/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +0 -30
  126. package/debuggingApp/node_modules/@babel/runtime/helpers/applyDecs.js +0 -284
  127. package/debuggingApp/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -11
  128. package/debuggingApp/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -5
  129. package/debuggingApp/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -7
  130. package/debuggingApp/node_modules/@babel/runtime/helpers/assertThisInitialized.js +0 -9
  131. package/debuggingApp/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +0 -56
  132. package/debuggingApp/node_modules/@babel/runtime/helpers/asyncIterator.js +0 -50
  133. package/debuggingApp/node_modules/@babel/runtime/helpers/asyncToGenerator.js +0 -37
  134. package/debuggingApp/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +0 -7
  135. package/debuggingApp/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +0 -7
  136. package/debuggingApp/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -22
  137. package/debuggingApp/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -9
  138. package/debuggingApp/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -13
  139. package/debuggingApp/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -7
  140. package/debuggingApp/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -7
  141. package/debuggingApp/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -7
  142. package/debuggingApp/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -9
  143. package/debuggingApp/node_modules/@babel/runtime/helpers/classNameTDZError.js +0 -5
  144. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -10
  145. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -10
  146. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +0 -8
  147. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +0 -9
  148. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +0 -7
  149. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -11
  150. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -9
  151. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +0 -8
  152. package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -5
  153. package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -13
  154. package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -13
  155. package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -14
  156. package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +0 -8
  157. package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -5
  158. package/debuggingApp/node_modules/@babel/runtime/helpers/construct.js +0 -22
  159. package/debuggingApp/node_modules/@babel/runtime/helpers/createClass.js +0 -20
  160. package/debuggingApp/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +0 -60
  161. package/debuggingApp/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +0 -24
  162. package/debuggingApp/node_modules/@babel/runtime/helpers/createSuper.js +0 -24
  163. package/debuggingApp/node_modules/@babel/runtime/helpers/decorate.js +0 -400
  164. package/debuggingApp/node_modules/@babel/runtime/helpers/defaults.js +0 -16
  165. package/debuggingApp/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -24
  166. package/debuggingApp/node_modules/@babel/runtime/helpers/defineProperty.js +0 -16
  167. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +0 -95
  168. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -3
  169. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -28
  170. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/applyDecs.js +0 -282
  171. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -9
  172. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -3
  173. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -4
  174. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -7
  175. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -54
  176. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +0 -48
  177. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -35
  178. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +0 -4
  179. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -5
  180. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -20
  181. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -7
  182. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -11
  183. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -5
  184. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
  185. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -5
  186. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -7
  187. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +0 -3
  188. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -6
  189. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -6
  190. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -5
  191. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -7
  192. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -4
  193. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
  194. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -7
  195. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -5
  196. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -3
  197. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -8
  198. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -8
  199. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -9
  200. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -5
  201. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -3
  202. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/construct.js +0 -18
  203. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -18
  204. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +0 -57
  205. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -21
  206. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -19
  207. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -396
  208. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/defaults.js +0 -14
  209. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -22
  210. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -14
  211. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/extends.js +0 -16
  212. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/get.js +0 -20
  213. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -6
  214. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/identity.js +0 -3
  215. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -18
  216. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -6
  217. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +0 -9
  218. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +0 -3
  219. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/instanceof.js +0 -7
  220. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +0 -5
  221. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +0 -51
  222. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +0 -3
  223. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -12
  224. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -3
  225. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -29
  226. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +0 -14
  227. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/jsx.js +0 -26
  228. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +0 -9
  229. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +0 -5
  230. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -3
  231. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -3
  232. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +0 -3
  233. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -19
  234. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -27
  235. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -19
  236. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -14
  237. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/package.json +0 -3
  238. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -11
  239. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +0 -3
  240. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +0 -352
  241. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/set.js +0 -51
  242. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -7
  243. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -7
  244. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -7
  245. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +0 -7
  246. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/superPropBase.js +0 -9
  247. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -11
  248. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -8
  249. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/tdz.js +0 -3
  250. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/temporalRef.js +0 -5
  251. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +0 -1
  252. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -7
  253. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -7
  254. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -13
  255. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -6
  256. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -9
  257. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -9
  258. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +0 -6
  259. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +0 -37
  260. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +0 -50
  261. package/debuggingApp/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +0 -3
  262. package/debuggingApp/node_modules/@babel/runtime/helpers/extends.js +0 -18
  263. package/debuggingApp/node_modules/@babel/runtime/helpers/get.js +0 -23
  264. package/debuggingApp/node_modules/@babel/runtime/helpers/getPrototypeOf.js +0 -8
  265. package/debuggingApp/node_modules/@babel/runtime/helpers/identity.js +0 -5
  266. package/debuggingApp/node_modules/@babel/runtime/helpers/inherits.js +0 -21
  267. package/debuggingApp/node_modules/@babel/runtime/helpers/inheritsLoose.js +0 -9
  268. package/debuggingApp/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +0 -11
  269. package/debuggingApp/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +0 -5
  270. package/debuggingApp/node_modules/@babel/runtime/helpers/instanceof.js +0 -9
  271. package/debuggingApp/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -7
  272. package/debuggingApp/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +0 -53
  273. package/debuggingApp/node_modules/@babel/runtime/helpers/isNativeFunction.js +0 -5
  274. package/debuggingApp/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +0 -14
  275. package/debuggingApp/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -5
  276. package/debuggingApp/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -31
  277. package/debuggingApp/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +0 -16
  278. package/debuggingApp/node_modules/@babel/runtime/helpers/jsx.js +0 -29
  279. package/debuggingApp/node_modules/@babel/runtime/helpers/maybeArrayLike.js +0 -12
  280. package/debuggingApp/node_modules/@babel/runtime/helpers/newArrowCheck.js +0 -7
  281. package/debuggingApp/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -5
  282. package/debuggingApp/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -5
  283. package/debuggingApp/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +0 -5
  284. package/debuggingApp/node_modules/@babel/runtime/helpers/objectSpread.js +0 -22
  285. package/debuggingApp/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -29
  286. package/debuggingApp/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -22
  287. package/debuggingApp/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -16
  288. package/debuggingApp/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +0 -15
  289. package/debuggingApp/node_modules/@babel/runtime/helpers/readOnlyError.js +0 -5
  290. package/debuggingApp/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -354
  291. package/debuggingApp/node_modules/@babel/runtime/helpers/set.js +0 -54
  292. package/debuggingApp/node_modules/@babel/runtime/helpers/setPrototypeOf.js +0 -9
  293. package/debuggingApp/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +0 -9
  294. package/debuggingApp/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -13
  295. package/debuggingApp/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +0 -13
  296. package/debuggingApp/node_modules/@babel/runtime/helpers/superPropBase.js +0 -12
  297. package/debuggingApp/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -13
  298. package/debuggingApp/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +0 -10
  299. package/debuggingApp/node_modules/@babel/runtime/helpers/tdz.js +0 -5
  300. package/debuggingApp/node_modules/@babel/runtime/helpers/temporalRef.js +0 -9
  301. package/debuggingApp/node_modules/@babel/runtime/helpers/temporalUndefined.js +0 -3
  302. package/debuggingApp/node_modules/@babel/runtime/helpers/toArray.js +0 -13
  303. package/debuggingApp/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -13
  304. package/debuggingApp/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -16
  305. package/debuggingApp/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -10
  306. package/debuggingApp/node_modules/@babel/runtime/helpers/typeof.js +0 -11
  307. package/debuggingApp/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -12
  308. package/debuggingApp/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +0 -9
  309. package/debuggingApp/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +0 -42
  310. package/debuggingApp/node_modules/@babel/runtime/helpers/wrapRegExp.js +0 -55
  311. package/debuggingApp/node_modules/@babel/runtime/helpers/writeOnlyError.js +0 -5
  312. package/debuggingApp/node_modules/@babel/runtime/package.json +0 -876
  313. package/debuggingApp/node_modules/@babel/runtime/regenerator/index.js +0 -15
  314. package/debuggingApp/node_modules/accepts/HISTORY.md +0 -243
  315. package/debuggingApp/node_modules/accepts/LICENSE +0 -23
  316. package/debuggingApp/node_modules/accepts/README.md +0 -140
  317. package/debuggingApp/node_modules/accepts/index.js +0 -238
  318. package/debuggingApp/node_modules/accepts/package.json +0 -47
  319. package/debuggingApp/node_modules/array-flatten/LICENSE +0 -21
  320. package/debuggingApp/node_modules/array-flatten/README.md +0 -43
  321. package/debuggingApp/node_modules/array-flatten/array-flatten.js +0 -64
  322. package/debuggingApp/node_modules/array-flatten/package.json +0 -39
  323. package/debuggingApp/node_modules/body-parser/HISTORY.md +0 -651
  324. package/debuggingApp/node_modules/body-parser/LICENSE +0 -23
  325. package/debuggingApp/node_modules/body-parser/README.md +0 -464
  326. package/debuggingApp/node_modules/body-parser/SECURITY.md +0 -25
  327. package/debuggingApp/node_modules/body-parser/index.js +0 -157
  328. package/debuggingApp/node_modules/body-parser/lib/read.js +0 -205
  329. package/debuggingApp/node_modules/body-parser/lib/types/json.js +0 -236
  330. package/debuggingApp/node_modules/body-parser/lib/types/raw.js +0 -101
  331. package/debuggingApp/node_modules/body-parser/lib/types/text.js +0 -121
  332. package/debuggingApp/node_modules/body-parser/lib/types/urlencoded.js +0 -284
  333. package/debuggingApp/node_modules/body-parser/package.json +0 -56
  334. package/debuggingApp/node_modules/bytes/History.md +0 -97
  335. package/debuggingApp/node_modules/bytes/LICENSE +0 -23
  336. package/debuggingApp/node_modules/bytes/Readme.md +0 -152
  337. package/debuggingApp/node_modules/bytes/index.js +0 -170
  338. package/debuggingApp/node_modules/bytes/package.json +0 -42
  339. package/debuggingApp/node_modules/call-bind/.github/FUNDING.yml +0 -12
  340. package/debuggingApp/node_modules/call-bind/.nycrc +0 -13
  341. package/debuggingApp/node_modules/call-bind/CHANGELOG.md +0 -42
  342. package/debuggingApp/node_modules/call-bind/LICENSE +0 -21
  343. package/debuggingApp/node_modules/call-bind/README.md +0 -2
  344. package/debuggingApp/node_modules/call-bind/callBound.js +0 -15
  345. package/debuggingApp/node_modules/call-bind/index.js +0 -47
  346. package/debuggingApp/node_modules/call-bind/package.json +0 -80
  347. package/debuggingApp/node_modules/call-bind/test/callBound.js +0 -55
  348. package/debuggingApp/node_modules/call-bind/test/index.js +0 -66
  349. package/debuggingApp/node_modules/content-disposition/HISTORY.md +0 -60
  350. package/debuggingApp/node_modules/content-disposition/LICENSE +0 -22
  351. package/debuggingApp/node_modules/content-disposition/README.md +0 -142
  352. package/debuggingApp/node_modules/content-disposition/index.js +0 -458
  353. package/debuggingApp/node_modules/content-disposition/package.json +0 -44
  354. package/debuggingApp/node_modules/content-type/HISTORY.md +0 -24
  355. package/debuggingApp/node_modules/content-type/LICENSE +0 -22
  356. package/debuggingApp/node_modules/content-type/README.md +0 -92
  357. package/debuggingApp/node_modules/content-type/index.js +0 -222
  358. package/debuggingApp/node_modules/content-type/package.json +0 -40
  359. package/debuggingApp/node_modules/cookie/HISTORY.md +0 -142
  360. package/debuggingApp/node_modules/cookie/LICENSE +0 -24
  361. package/debuggingApp/node_modules/cookie/README.md +0 -302
  362. package/debuggingApp/node_modules/cookie/SECURITY.md +0 -25
  363. package/debuggingApp/node_modules/cookie/index.js +0 -270
  364. package/debuggingApp/node_modules/cookie/package.json +0 -44
  365. package/debuggingApp/node_modules/cookie-signature/History.md +0 -38
  366. package/debuggingApp/node_modules/cookie-signature/Readme.md +0 -42
  367. package/debuggingApp/node_modules/cookie-signature/index.js +0 -51
  368. package/debuggingApp/node_modules/cookie-signature/package.json +0 -18
  369. package/debuggingApp/node_modules/cookies/History.md +0 -62
  370. package/debuggingApp/node_modules/cookies/LICENSE.txt +0 -22
  371. package/debuggingApp/node_modules/cookies/README.md +0 -121
  372. package/debuggingApp/node_modules/cookies/lib/cookies.js +0 -181
  373. package/debuggingApp/node_modules/cookies/package.json +0 -24
  374. package/debuggingApp/node_modules/debug/.coveralls.yml +0 -1
  375. package/debuggingApp/node_modules/debug/.travis.yml +0 -14
  376. package/debuggingApp/node_modules/debug/CHANGELOG.md +0 -362
  377. package/debuggingApp/node_modules/debug/LICENSE +0 -19
  378. package/debuggingApp/node_modules/debug/Makefile +0 -50
  379. package/debuggingApp/node_modules/debug/README.md +0 -312
  380. package/debuggingApp/node_modules/debug/component.json +0 -19
  381. package/debuggingApp/node_modules/debug/node.js +0 -1
  382. package/debuggingApp/node_modules/debug/package.json +0 -49
  383. package/debuggingApp/node_modules/debug/src/browser.js +0 -185
  384. package/debuggingApp/node_modules/debug/src/debug.js +0 -202
  385. package/debuggingApp/node_modules/debug/src/index.js +0 -10
  386. package/debuggingApp/node_modules/debug/src/inspector-log.js +0 -15
  387. package/debuggingApp/node_modules/debug/src/node.js +0 -248
  388. package/debuggingApp/node_modules/depd/History.md +0 -103
  389. package/debuggingApp/node_modules/depd/LICENSE +0 -22
  390. package/debuggingApp/node_modules/depd/Readme.md +0 -280
  391. package/debuggingApp/node_modules/depd/index.js +0 -538
  392. package/debuggingApp/node_modules/depd/lib/browser/index.js +0 -77
  393. package/debuggingApp/node_modules/depd/package.json +0 -45
  394. package/debuggingApp/node_modules/destroy/LICENSE +0 -23
  395. package/debuggingApp/node_modules/destroy/README.md +0 -63
  396. package/debuggingApp/node_modules/destroy/index.js +0 -209
  397. package/debuggingApp/node_modules/destroy/package.json +0 -48
  398. package/debuggingApp/node_modules/ee-first/LICENSE +0 -22
  399. package/debuggingApp/node_modules/ee-first/README.md +0 -80
  400. package/debuggingApp/node_modules/ee-first/index.js +0 -95
  401. package/debuggingApp/node_modules/ee-first/package.json +0 -29
  402. package/debuggingApp/node_modules/encodeurl/HISTORY.md +0 -14
  403. package/debuggingApp/node_modules/encodeurl/LICENSE +0 -22
  404. package/debuggingApp/node_modules/encodeurl/README.md +0 -128
  405. package/debuggingApp/node_modules/encodeurl/index.js +0 -60
  406. package/debuggingApp/node_modules/encodeurl/package.json +0 -40
  407. package/debuggingApp/node_modules/escape-html/LICENSE +0 -24
  408. package/debuggingApp/node_modules/escape-html/Readme.md +0 -43
  409. package/debuggingApp/node_modules/escape-html/index.js +0 -78
  410. package/debuggingApp/node_modules/escape-html/package.json +0 -24
  411. package/debuggingApp/node_modules/etag/HISTORY.md +0 -83
  412. package/debuggingApp/node_modules/etag/LICENSE +0 -22
  413. package/debuggingApp/node_modules/etag/README.md +0 -159
  414. package/debuggingApp/node_modules/etag/index.js +0 -131
  415. package/debuggingApp/node_modules/etag/package.json +0 -47
  416. package/debuggingApp/node_modules/express/History.md +0 -3579
  417. package/debuggingApp/node_modules/express/LICENSE +0 -24
  418. package/debuggingApp/node_modules/express/Readme.md +0 -166
  419. package/debuggingApp/node_modules/express/index.js +0 -11
  420. package/debuggingApp/node_modules/express/lib/application.js +0 -661
  421. package/debuggingApp/node_modules/express/lib/express.js +0 -116
  422. package/debuggingApp/node_modules/express/lib/middleware/init.js +0 -43
  423. package/debuggingApp/node_modules/express/lib/middleware/query.js +0 -47
  424. package/debuggingApp/node_modules/express/lib/request.js +0 -525
  425. package/debuggingApp/node_modules/express/lib/response.js +0 -1169
  426. package/debuggingApp/node_modules/express/lib/router/index.js +0 -673
  427. package/debuggingApp/node_modules/express/lib/router/layer.js +0 -181
  428. package/debuggingApp/node_modules/express/lib/router/route.js +0 -225
  429. package/debuggingApp/node_modules/express/lib/utils.js +0 -304
  430. package/debuggingApp/node_modules/express/lib/view.js +0 -182
  431. package/debuggingApp/node_modules/express/package.json +0 -99
  432. package/debuggingApp/node_modules/finalhandler/HISTORY.md +0 -195
  433. package/debuggingApp/node_modules/finalhandler/LICENSE +0 -22
  434. package/debuggingApp/node_modules/finalhandler/README.md +0 -147
  435. package/debuggingApp/node_modules/finalhandler/SECURITY.md +0 -25
  436. package/debuggingApp/node_modules/finalhandler/index.js +0 -336
  437. package/debuggingApp/node_modules/finalhandler/package.json +0 -46
  438. package/debuggingApp/node_modules/forwarded/HISTORY.md +0 -21
  439. package/debuggingApp/node_modules/forwarded/LICENSE +0 -22
  440. package/debuggingApp/node_modules/forwarded/README.md +0 -57
  441. package/debuggingApp/node_modules/forwarded/index.js +0 -90
  442. package/debuggingApp/node_modules/forwarded/package.json +0 -45
  443. package/debuggingApp/node_modules/fresh/HISTORY.md +0 -70
  444. package/debuggingApp/node_modules/fresh/LICENSE +0 -23
  445. package/debuggingApp/node_modules/fresh/README.md +0 -119
  446. package/debuggingApp/node_modules/fresh/index.js +0 -137
  447. package/debuggingApp/node_modules/fresh/package.json +0 -46
  448. package/debuggingApp/node_modules/function-bind/.jscs.json +0 -176
  449. package/debuggingApp/node_modules/function-bind/.travis.yml +0 -168
  450. package/debuggingApp/node_modules/function-bind/LICENSE +0 -20
  451. package/debuggingApp/node_modules/function-bind/README.md +0 -48
  452. package/debuggingApp/node_modules/function-bind/implementation.js +0 -52
  453. package/debuggingApp/node_modules/function-bind/index.js +0 -5
  454. package/debuggingApp/node_modules/function-bind/package.json +0 -63
  455. package/debuggingApp/node_modules/function-bind/test/index.js +0 -252
  456. package/debuggingApp/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
  457. package/debuggingApp/node_modules/get-intrinsic/.nycrc +0 -9
  458. package/debuggingApp/node_modules/get-intrinsic/CHANGELOG.md +0 -91
  459. package/debuggingApp/node_modules/get-intrinsic/LICENSE +0 -21
  460. package/debuggingApp/node_modules/get-intrinsic/README.md +0 -71
  461. package/debuggingApp/node_modules/get-intrinsic/index.js +0 -334
  462. package/debuggingApp/node_modules/get-intrinsic/package.json +0 -88
  463. package/debuggingApp/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
  464. package/debuggingApp/node_modules/has/LICENSE-MIT +0 -22
  465. package/debuggingApp/node_modules/has/README.md +0 -18
  466. package/debuggingApp/node_modules/has/package.json +0 -48
  467. package/debuggingApp/node_modules/has/src/index.js +0 -5
  468. package/debuggingApp/node_modules/has/test/index.js +0 -10
  469. package/debuggingApp/node_modules/has-symbols/.github/FUNDING.yml +0 -12
  470. package/debuggingApp/node_modules/has-symbols/.nycrc +0 -9
  471. package/debuggingApp/node_modules/has-symbols/CHANGELOG.md +0 -75
  472. package/debuggingApp/node_modules/has-symbols/LICENSE +0 -21
  473. package/debuggingApp/node_modules/has-symbols/README.md +0 -46
  474. package/debuggingApp/node_modules/has-symbols/index.js +0 -13
  475. package/debuggingApp/node_modules/has-symbols/package.json +0 -101
  476. package/debuggingApp/node_modules/has-symbols/shams.js +0 -42
  477. package/debuggingApp/node_modules/has-symbols/test/index.js +0 -22
  478. package/debuggingApp/node_modules/has-symbols/test/shams/core-js.js +0 -28
  479. package/debuggingApp/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -28
  480. package/debuggingApp/node_modules/has-symbols/test/tests.js +0 -56
  481. package/debuggingApp/node_modules/http-errors/HISTORY.md +0 -180
  482. package/debuggingApp/node_modules/http-errors/LICENSE +0 -23
  483. package/debuggingApp/node_modules/http-errors/README.md +0 -169
  484. package/debuggingApp/node_modules/http-errors/index.js +0 -289
  485. package/debuggingApp/node_modules/http-errors/package.json +0 -50
  486. package/debuggingApp/node_modules/i18next/CONTRIBUTING.md +0 -22
  487. package/debuggingApp/node_modules/i18next/LICENSE +0 -21
  488. package/debuggingApp/node_modules/i18next/README.md +0 -60
  489. package/debuggingApp/node_modules/i18next/dist/cjs/i18next.js +0 -2801
  490. package/debuggingApp/node_modules/i18next/dist/esm/i18next.bundled.js +0 -2954
  491. package/debuggingApp/node_modules/i18next/dist/esm/i18next.js +0 -2802
  492. package/debuggingApp/node_modules/i18next/dist/esm/package.json +0 -1
  493. package/debuggingApp/node_modules/i18next/dist/umd/i18next.js +0 -2922
  494. package/debuggingApp/node_modules/i18next/dist/umd/i18next.min.js +0 -1
  495. package/debuggingApp/node_modules/i18next/i18next.js +0 -2922
  496. package/debuggingApp/node_modules/i18next/i18next.min.js +0 -1
  497. package/debuggingApp/node_modules/i18next/index.d.ts +0 -1257
  498. package/debuggingApp/node_modules/i18next/index.js +0 -5
  499. package/debuggingApp/node_modules/i18next/package.json +0 -126
  500. package/debuggingApp/node_modules/i18next-express-middleware/LICENSE +0 -22
  501. package/debuggingApp/node_modules/i18next-express-middleware/README.md +0 -167
  502. package/debuggingApp/node_modules/i18next-express-middleware/lib/LanguageDetector.js +0 -138
  503. package/debuggingApp/node_modules/i18next-express-middleware/lib/index.js +0 -152
  504. package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/cookie.js +0 -47
  505. package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/header.js +0 -59
  506. package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/path.js +0 -27
  507. package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/querystring.js +0 -31
  508. package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/session.js +0 -27
  509. package/debuggingApp/node_modules/i18next-express-middleware/lib/utils.js +0 -70
  510. package/debuggingApp/node_modules/i18next-express-middleware/package.json +0 -43
  511. package/debuggingApp/node_modules/i18next-node-fs-backend/LICENSE +0 -22
  512. package/debuggingApp/node_modules/i18next-node-fs-backend/README.md +0 -72
  513. package/debuggingApp/node_modules/i18next-node-fs-backend/lib/index.js +0 -162
  514. package/debuggingApp/node_modules/i18next-node-fs-backend/lib/utils.js +0 -78
  515. package/debuggingApp/node_modules/i18next-node-fs-backend/package.json +0 -43
  516. package/debuggingApp/node_modules/iconv-lite/Changelog.md +0 -162
  517. package/debuggingApp/node_modules/iconv-lite/LICENSE +0 -21
  518. package/debuggingApp/node_modules/iconv-lite/README.md +0 -156
  519. package/debuggingApp/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -555
  520. package/debuggingApp/node_modules/iconv-lite/encodings/dbcs-data.js +0 -176
  521. package/debuggingApp/node_modules/iconv-lite/encodings/index.js +0 -22
  522. package/debuggingApp/node_modules/iconv-lite/encodings/internal.js +0 -188
  523. package/debuggingApp/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  524. package/debuggingApp/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  525. package/debuggingApp/node_modules/iconv-lite/encodings/sbcs-data.js +0 -174
  526. package/debuggingApp/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  527. package/debuggingApp/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  528. package/debuggingApp/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  529. package/debuggingApp/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  530. package/debuggingApp/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  531. package/debuggingApp/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  532. package/debuggingApp/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -55
  533. package/debuggingApp/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  534. package/debuggingApp/node_modules/iconv-lite/encodings/utf16.js +0 -177
  535. package/debuggingApp/node_modules/iconv-lite/encodings/utf7.js +0 -290
  536. package/debuggingApp/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  537. package/debuggingApp/node_modules/iconv-lite/lib/extend-node.js +0 -217
  538. package/debuggingApp/node_modules/iconv-lite/lib/index.d.ts +0 -24
  539. package/debuggingApp/node_modules/iconv-lite/lib/index.js +0 -153
  540. package/debuggingApp/node_modules/iconv-lite/lib/streams.js +0 -121
  541. package/debuggingApp/node_modules/iconv-lite/package.json +0 -46
  542. package/debuggingApp/node_modules/inherits/LICENSE +0 -16
  543. package/debuggingApp/node_modules/inherits/README.md +0 -42
  544. package/debuggingApp/node_modules/inherits/inherits.js +0 -9
  545. package/debuggingApp/node_modules/inherits/inherits_browser.js +0 -27
  546. package/debuggingApp/node_modules/inherits/package.json +0 -29
  547. package/debuggingApp/node_modules/ipaddr.js/LICENSE +0 -19
  548. package/debuggingApp/node_modules/ipaddr.js/README.md +0 -233
  549. package/debuggingApp/node_modules/ipaddr.js/ipaddr.min.js +0 -1
  550. package/debuggingApp/node_modules/ipaddr.js/lib/ipaddr.js +0 -673
  551. package/debuggingApp/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +0 -68
  552. package/debuggingApp/node_modules/ipaddr.js/package.json +0 -35
  553. package/debuggingApp/node_modules/json5/.travis.yml +0 -5
  554. package/debuggingApp/node_modules/json5/CHANGELOG.md +0 -144
  555. package/debuggingApp/node_modules/json5/README.md +0 -271
  556. package/debuggingApp/node_modules/json5/lib/cli.js +0 -41
  557. package/debuggingApp/node_modules/json5/lib/json5.js +0 -754
  558. package/debuggingApp/node_modules/json5/lib/require.js +0 -18
  559. package/debuggingApp/node_modules/json5/package.json +0 -30
  560. package/debuggingApp/node_modules/json5/package.json5 +0 -30
  561. package/debuggingApp/node_modules/json5/test/parse-cases/arrays/empty-array.json +0 -1
  562. package/debuggingApp/node_modules/json5/test/parse-cases/arrays/leading-comma-array.js +0 -3
  563. package/debuggingApp/node_modules/json5/test/parse-cases/arrays/lone-trailing-comma-array.js +0 -3
  564. package/debuggingApp/node_modules/json5/test/parse-cases/arrays/no-comma-array.txt +0 -4
  565. package/debuggingApp/node_modules/json5/test/parse-cases/arrays/regular-array.json +0 -5
  566. package/debuggingApp/node_modules/json5/test/parse-cases/arrays/trailing-comma-array.json5 +0 -3
  567. package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-following-array-element.json5 +0 -6
  568. package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-following-top-level-value.json5 +0 -5
  569. package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-in-string.json +0 -1
  570. package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-preceding-top-level-value.json5 +0 -5
  571. package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-with-asterisks.json5 +0 -7
  572. package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-following-array-element.json5 +0 -3
  573. package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-following-top-level-value.json5 +0 -1
  574. package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-in-string.json +0 -1
  575. package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-preceding-top-level-value.json5 +0 -2
  576. package/debuggingApp/node_modules/json5/test/parse-cases/comments/top-level-block-comment.txt +0 -4
  577. package/debuggingApp/node_modules/json5/test/parse-cases/comments/top-level-inline-comment.txt +0 -1
  578. package/debuggingApp/node_modules/json5/test/parse-cases/comments/unterminated-block-comment.txt +0 -5
  579. package/debuggingApp/node_modules/json5/test/parse-cases/misc/empty.txt +0 -0
  580. package/debuggingApp/node_modules/json5/test/parse-cases/misc/npm-package.json +0 -106
  581. package/debuggingApp/node_modules/json5/test/parse-cases/misc/npm-package.json5 +0 -106
  582. package/debuggingApp/node_modules/json5/test/parse-cases/misc/readme-example.json5 +0 -25
  583. package/debuggingApp/node_modules/json5/test/parse-cases/misc/valid-whitespace.json5 +0 -5
  584. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/.gitattributes +0 -4
  585. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/comment-cr.json5 +0 -1
  586. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/comment-crlf.json5 +0 -3
  587. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/comment-lf.json5 +0 -3
  588. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/escaped-cr.json5 +0 -1
  589. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/escaped-crlf.json5 +0 -5
  590. package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/escaped-lf.json5 +0 -5
  591. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/binary-coffeescript.txt +0 -1
  592. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-leading-decimal-point.json5 +0 -1
  593. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-leading-zero.json +0 -1
  594. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-trailing-decimal-point-with-integer-exponent.json5 +0 -1
  595. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-trailing-decimal-point.json5 +0 -1
  596. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-with-integer-exponent.json +0 -1
  597. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float.json +0 -1
  598. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-empty.txt +0 -1
  599. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-lowercase-letter.json5 +0 -1
  600. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-uppercase-x.json5 +0 -1
  601. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-with-integer-exponent.json5 +0 -1
  602. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal.json5 +0 -1
  603. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/infinity.json5 +0 -1
  604. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-float-exponent.txt +0 -1
  605. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-hexadecimal-exponent.txt +0 -1
  606. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-integer-exponent.json +0 -1
  607. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-float-exponent.txt +0 -1
  608. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-hexadecimal-exponent.txt +0 -1
  609. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-integer-exponent.json +0 -1
  610. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-zero-integer-exponent.json +0 -1
  611. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-float-exponent.txt +0 -1
  612. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-hexadecimal-exponent.txt +0 -1
  613. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-integer-exponent.json +0 -1
  614. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-zero-integer-exponent.json +0 -1
  615. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-zero-integer-exponent.json +0 -1
  616. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer.json +0 -1
  617. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/lone-decimal-point.txt +0 -1
  618. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/nan.json5 +0 -1
  619. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-binary-coffeescript.txt +0 -1
  620. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float-leading-decimal-point.json5 +0 -1
  621. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float-leading-zero.json +0 -1
  622. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float-trailing-decimal-point.json5 +0 -1
  623. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float.json +0 -1
  624. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-hexadecimal.json5 +0 -1
  625. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-infinity.json5 +0 -1
  626. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-integer.json +0 -1
  627. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-noctal.js +0 -1
  628. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-octal-coffeescript.txt +0 -1
  629. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-octal.txt +0 -1
  630. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-binary-coffeescript.txt +0 -1
  631. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-float-leading-decimal-point.json5 +0 -1
  632. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-float-trailing-decimal-point.json5 +0 -1
  633. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-float.json +0 -1
  634. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-hexadecimal.json5 +0 -1
  635. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-integer.json +0 -1
  636. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-octal-coffeescript.txt +0 -1
  637. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-octal.txt +0 -1
  638. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/noctal-with-leading-octal-digit.js +0 -1
  639. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/noctal.js +0 -1
  640. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/octal-coffeescript.txt +0 -1
  641. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/octal.txt +0 -1
  642. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-binary-coffeescript.txt +0 -1
  643. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float-leading-decimal-point.json5 +0 -1
  644. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float-leading-zero.json5 +0 -1
  645. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float-trailing-decimal-point.json5 +0 -1
  646. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float.json5 +0 -1
  647. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-hexadecimal.json5 +0 -1
  648. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-infinity.json5 +0 -1
  649. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-integer.json5 +0 -1
  650. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-noctal.js +0 -1
  651. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-octal-coffeescript.txt +0 -1
  652. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-octal.txt +0 -1
  653. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-binary-coffeescript.txt +0 -1
  654. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-float-leading-decimal-point.json5 +0 -1
  655. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-float-trailing-decimal-point.json5 +0 -1
  656. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-float.json5 +0 -1
  657. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-hexadecimal.json5 +0 -1
  658. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-integer.json5 +0 -1
  659. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-octal-coffeescript.txt +0 -1
  660. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-octal.txt +0 -1
  661. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-binary-coffeescript.txt +0 -1
  662. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-float-leading-decimal-point.json5 +0 -1
  663. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-float-trailing-decimal-point.json5 +0 -1
  664. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-float.json +0 -1
  665. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-hexadecimal.json5 +0 -1
  666. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-integer-with-integer-exponent.json +0 -1
  667. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-integer.json +0 -1
  668. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-octal-coffeescript.txt +0 -1
  669. package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-octal.txt +0 -1
  670. package/debuggingApp/node_modules/json5/test/parse-cases/objects/duplicate-keys.json +0 -4
  671. package/debuggingApp/node_modules/json5/test/parse-cases/objects/empty-object.json +0 -1
  672. package/debuggingApp/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-number.txt +0 -3
  673. package/debuggingApp/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-symbol.txt +0 -3
  674. package/debuggingApp/node_modules/json5/test/parse-cases/objects/leading-comma-object.txt +0 -3
  675. package/debuggingApp/node_modules/json5/test/parse-cases/objects/lone-trailing-comma-object.txt +0 -3
  676. package/debuggingApp/node_modules/json5/test/parse-cases/objects/no-comma-object.txt +0 -4
  677. package/debuggingApp/node_modules/json5/test/parse-cases/objects/reserved-unquoted-key.json5 +0 -3
  678. package/debuggingApp/node_modules/json5/test/parse-cases/objects/single-quoted-key.json5 +0 -3
  679. package/debuggingApp/node_modules/json5/test/parse-cases/objects/trailing-comma-object.json5 +0 -3
  680. package/debuggingApp/node_modules/json5/test/parse-cases/objects/unquoted-keys.json5 +0 -8
  681. package/debuggingApp/node_modules/json5/test/parse-cases/strings/escaped-single-quoted-string.json5 +0 -1
  682. package/debuggingApp/node_modules/json5/test/parse-cases/strings/multi-line-string.json5 +0 -2
  683. package/debuggingApp/node_modules/json5/test/parse-cases/strings/single-quoted-string.json5 +0 -1
  684. package/debuggingApp/node_modules/json5/test/parse-cases/strings/unescaped-multi-line-string.txt +0 -2
  685. package/debuggingApp/node_modules/json5/test/parse-cases/todo/unicode-escaped-unquoted-key.json5 +0 -3
  686. package/debuggingApp/node_modules/json5/test/parse-cases/todo/unicode-unquoted-key.json5 +0 -3
  687. package/debuggingApp/node_modules/json5/test/parse.js +0 -89
  688. package/debuggingApp/node_modules/json5/test/readme.md +0 -23
  689. package/debuggingApp/node_modules/json5/test/require.js +0 -18
  690. package/debuggingApp/node_modules/json5/test/stringify.js +0 -498
  691. package/debuggingApp/node_modules/keygrip/HISTORY.md +0 -20
  692. package/debuggingApp/node_modules/keygrip/LICENSE +0 -21
  693. package/debuggingApp/node_modules/keygrip/README.md +0 -103
  694. package/debuggingApp/node_modules/keygrip/index.js +0 -71
  695. package/debuggingApp/node_modules/keygrip/package.json +0 -25
  696. package/debuggingApp/node_modules/media-typer/HISTORY.md +0 -22
  697. package/debuggingApp/node_modules/media-typer/LICENSE +0 -22
  698. package/debuggingApp/node_modules/media-typer/README.md +0 -81
  699. package/debuggingApp/node_modules/media-typer/index.js +0 -270
  700. package/debuggingApp/node_modules/media-typer/package.json +0 -26
  701. package/debuggingApp/node_modules/merge-descriptors/HISTORY.md +0 -21
  702. package/debuggingApp/node_modules/merge-descriptors/LICENSE +0 -23
  703. package/debuggingApp/node_modules/merge-descriptors/README.md +0 -48
  704. package/debuggingApp/node_modules/merge-descriptors/index.js +0 -60
  705. package/debuggingApp/node_modules/merge-descriptors/package.json +0 -32
  706. package/debuggingApp/node_modules/methods/HISTORY.md +0 -29
  707. package/debuggingApp/node_modules/methods/LICENSE +0 -24
  708. package/debuggingApp/node_modules/methods/README.md +0 -51
  709. package/debuggingApp/node_modules/methods/index.js +0 -69
  710. package/debuggingApp/node_modules/methods/package.json +0 -36
  711. package/debuggingApp/node_modules/mime/CHANGELOG.md +0 -164
  712. package/debuggingApp/node_modules/mime/LICENSE +0 -21
  713. package/debuggingApp/node_modules/mime/README.md +0 -90
  714. package/debuggingApp/node_modules/mime/cli.js +0 -8
  715. package/debuggingApp/node_modules/mime/mime.js +0 -108
  716. package/debuggingApp/node_modules/mime/package.json +0 -44
  717. package/debuggingApp/node_modules/mime/src/build.js +0 -53
  718. package/debuggingApp/node_modules/mime/src/test.js +0 -60
  719. package/debuggingApp/node_modules/mime/types.json +0 -1
  720. package/debuggingApp/node_modules/mime-db/HISTORY.md +0 -507
  721. package/debuggingApp/node_modules/mime-db/LICENSE +0 -23
  722. package/debuggingApp/node_modules/mime-db/README.md +0 -100
  723. package/debuggingApp/node_modules/mime-db/db.json +0 -8519
  724. package/debuggingApp/node_modules/mime-db/index.js +0 -12
  725. package/debuggingApp/node_modules/mime-db/package.json +0 -60
  726. package/debuggingApp/node_modules/mime-types/HISTORY.md +0 -397
  727. package/debuggingApp/node_modules/mime-types/LICENSE +0 -23
  728. package/debuggingApp/node_modules/mime-types/README.md +0 -113
  729. package/debuggingApp/node_modules/mime-types/index.js +0 -188
  730. package/debuggingApp/node_modules/mime-types/package.json +0 -44
  731. package/debuggingApp/node_modules/ms/index.js +0 -152
  732. package/debuggingApp/node_modules/ms/license.md +0 -21
  733. package/debuggingApp/node_modules/ms/package.json +0 -37
  734. package/debuggingApp/node_modules/ms/readme.md +0 -51
  735. package/debuggingApp/node_modules/negotiator/HISTORY.md +0 -108
  736. package/debuggingApp/node_modules/negotiator/LICENSE +0 -24
  737. package/debuggingApp/node_modules/negotiator/README.md +0 -203
  738. package/debuggingApp/node_modules/negotiator/index.js +0 -82
  739. package/debuggingApp/node_modules/negotiator/lib/charset.js +0 -169
  740. package/debuggingApp/node_modules/negotiator/lib/encoding.js +0 -184
  741. package/debuggingApp/node_modules/negotiator/lib/language.js +0 -179
  742. package/debuggingApp/node_modules/negotiator/lib/mediaType.js +0 -294
  743. package/debuggingApp/node_modules/negotiator/package.json +0 -42
  744. package/debuggingApp/node_modules/object-inspect/.github/FUNDING.yml +0 -12
  745. package/debuggingApp/node_modules/object-inspect/.nycrc +0 -13
  746. package/debuggingApp/node_modules/object-inspect/CHANGELOG.md +0 -360
  747. package/debuggingApp/node_modules/object-inspect/LICENSE +0 -21
  748. package/debuggingApp/node_modules/object-inspect/example/all.js +0 -23
  749. package/debuggingApp/node_modules/object-inspect/example/circular.js +0 -6
  750. package/debuggingApp/node_modules/object-inspect/example/fn.js +0 -5
  751. package/debuggingApp/node_modules/object-inspect/example/inspect.js +0 -10
  752. package/debuggingApp/node_modules/object-inspect/index.js +0 -512
  753. package/debuggingApp/node_modules/object-inspect/package-support.json +0 -20
  754. package/debuggingApp/node_modules/object-inspect/package.json +0 -94
  755. package/debuggingApp/node_modules/object-inspect/readme.markdown +0 -86
  756. package/debuggingApp/node_modules/object-inspect/test/bigint.js +0 -58
  757. package/debuggingApp/node_modules/object-inspect/test/browser/dom.js +0 -15
  758. package/debuggingApp/node_modules/object-inspect/test/circular.js +0 -16
  759. package/debuggingApp/node_modules/object-inspect/test/deep.js +0 -12
  760. package/debuggingApp/node_modules/object-inspect/test/element.js +0 -53
  761. package/debuggingApp/node_modules/object-inspect/test/err.js +0 -48
  762. package/debuggingApp/node_modules/object-inspect/test/fakes.js +0 -29
  763. package/debuggingApp/node_modules/object-inspect/test/fn.js +0 -76
  764. package/debuggingApp/node_modules/object-inspect/test/has.js +0 -15
  765. package/debuggingApp/node_modules/object-inspect/test/holes.js +0 -15
  766. package/debuggingApp/node_modules/object-inspect/test/indent-option.js +0 -271
  767. package/debuggingApp/node_modules/object-inspect/test/inspect.js +0 -139
  768. package/debuggingApp/node_modules/object-inspect/test/lowbyte.js +0 -12
  769. package/debuggingApp/node_modules/object-inspect/test/number.js +0 -58
  770. package/debuggingApp/node_modules/object-inspect/test/quoteStyle.js +0 -17
  771. package/debuggingApp/node_modules/object-inspect/test/toStringTag.js +0 -40
  772. package/debuggingApp/node_modules/object-inspect/test/undef.js +0 -12
  773. package/debuggingApp/node_modules/object-inspect/test/values.js +0 -211
  774. package/debuggingApp/node_modules/object-inspect/test-core-js.js +0 -26
  775. package/debuggingApp/node_modules/object-inspect/util.inspect.js +0 -1
  776. package/debuggingApp/node_modules/on-finished/HISTORY.md +0 -98
  777. package/debuggingApp/node_modules/on-finished/LICENSE +0 -23
  778. package/debuggingApp/node_modules/on-finished/README.md +0 -162
  779. package/debuggingApp/node_modules/on-finished/index.js +0 -234
  780. package/debuggingApp/node_modules/on-finished/package.json +0 -39
  781. package/debuggingApp/node_modules/parseurl/HISTORY.md +0 -58
  782. package/debuggingApp/node_modules/parseurl/LICENSE +0 -24
  783. package/debuggingApp/node_modules/parseurl/README.md +0 -133
  784. package/debuggingApp/node_modules/parseurl/index.js +0 -158
  785. package/debuggingApp/node_modules/parseurl/package.json +0 -40
  786. package/debuggingApp/node_modules/path-to-regexp/History.md +0 -36
  787. package/debuggingApp/node_modules/path-to-regexp/LICENSE +0 -21
  788. package/debuggingApp/node_modules/path-to-regexp/Readme.md +0 -35
  789. package/debuggingApp/node_modules/path-to-regexp/index.js +0 -129
  790. package/debuggingApp/node_modules/path-to-regexp/package.json +0 -30
  791. package/debuggingApp/node_modules/proxy-addr/HISTORY.md +0 -161
  792. package/debuggingApp/node_modules/proxy-addr/LICENSE +0 -22
  793. package/debuggingApp/node_modules/proxy-addr/README.md +0 -139
  794. package/debuggingApp/node_modules/proxy-addr/index.js +0 -327
  795. package/debuggingApp/node_modules/proxy-addr/package.json +0 -47
  796. package/debuggingApp/node_modules/qs/.github/FUNDING.yml +0 -12
  797. package/debuggingApp/node_modules/qs/.nycrc +0 -13
  798. package/debuggingApp/node_modules/qs/CHANGELOG.md +0 -388
  799. package/debuggingApp/node_modules/qs/LICENSE.md +0 -29
  800. package/debuggingApp/node_modules/qs/README.md +0 -623
  801. package/debuggingApp/node_modules/qs/dist/qs.js +0 -2044
  802. package/debuggingApp/node_modules/qs/lib/formats.js +0 -23
  803. package/debuggingApp/node_modules/qs/lib/index.js +0 -11
  804. package/debuggingApp/node_modules/qs/lib/parse.js +0 -263
  805. package/debuggingApp/node_modules/qs/lib/stringify.js +0 -317
  806. package/debuggingApp/node_modules/qs/lib/utils.js +0 -252
  807. package/debuggingApp/node_modules/qs/package.json +0 -73
  808. package/debuggingApp/node_modules/qs/test/parse.js +0 -841
  809. package/debuggingApp/node_modules/qs/test/stringify.js +0 -865
  810. package/debuggingApp/node_modules/qs/test/utils.js +0 -136
  811. package/debuggingApp/node_modules/range-parser/HISTORY.md +0 -56
  812. package/debuggingApp/node_modules/range-parser/LICENSE +0 -23
  813. package/debuggingApp/node_modules/range-parser/README.md +0 -84
  814. package/debuggingApp/node_modules/range-parser/index.js +0 -162
  815. package/debuggingApp/node_modules/range-parser/package.json +0 -44
  816. package/debuggingApp/node_modules/raw-body/HISTORY.md +0 -303
  817. package/debuggingApp/node_modules/raw-body/LICENSE +0 -22
  818. package/debuggingApp/node_modules/raw-body/README.md +0 -223
  819. package/debuggingApp/node_modules/raw-body/SECURITY.md +0 -24
  820. package/debuggingApp/node_modules/raw-body/index.d.ts +0 -87
  821. package/debuggingApp/node_modules/raw-body/index.js +0 -329
  822. package/debuggingApp/node_modules/raw-body/package.json +0 -49
  823. package/debuggingApp/node_modules/regenerator-runtime/LICENSE +0 -21
  824. package/debuggingApp/node_modules/regenerator-runtime/README.md +0 -31
  825. package/debuggingApp/node_modules/regenerator-runtime/package.json +0 -19
  826. package/debuggingApp/node_modules/regenerator-runtime/path.js +0 -11
  827. package/debuggingApp/node_modules/regenerator-runtime/runtime.js +0 -754
  828. package/debuggingApp/node_modules/safe-buffer/LICENSE +0 -21
  829. package/debuggingApp/node_modules/safe-buffer/README.md +0 -584
  830. package/debuggingApp/node_modules/safe-buffer/index.d.ts +0 -187
  831. package/debuggingApp/node_modules/safe-buffer/index.js +0 -65
  832. package/debuggingApp/node_modules/safe-buffer/package.json +0 -51
  833. package/debuggingApp/node_modules/safer-buffer/LICENSE +0 -21
  834. package/debuggingApp/node_modules/safer-buffer/Porting-Buffer.md +0 -268
  835. package/debuggingApp/node_modules/safer-buffer/Readme.md +0 -156
  836. package/debuggingApp/node_modules/safer-buffer/dangerous.js +0 -58
  837. package/debuggingApp/node_modules/safer-buffer/package.json +0 -34
  838. package/debuggingApp/node_modules/safer-buffer/safer.js +0 -77
  839. package/debuggingApp/node_modules/safer-buffer/tests.js +0 -406
  840. package/debuggingApp/node_modules/send/HISTORY.md +0 -521
  841. package/debuggingApp/node_modules/send/LICENSE +0 -23
  842. package/debuggingApp/node_modules/send/README.md +0 -327
  843. package/debuggingApp/node_modules/send/SECURITY.md +0 -24
  844. package/debuggingApp/node_modules/send/index.js +0 -1143
  845. package/debuggingApp/node_modules/send/node_modules/ms/index.js +0 -162
  846. package/debuggingApp/node_modules/send/node_modules/ms/license.md +0 -21
  847. package/debuggingApp/node_modules/send/node_modules/ms/package.json +0 -38
  848. package/debuggingApp/node_modules/send/node_modules/ms/readme.md +0 -59
  849. package/debuggingApp/node_modules/send/package.json +0 -62
  850. package/debuggingApp/node_modules/serve-static/HISTORY.md +0 -471
  851. package/debuggingApp/node_modules/serve-static/LICENSE +0 -25
  852. package/debuggingApp/node_modules/serve-static/README.md +0 -257
  853. package/debuggingApp/node_modules/serve-static/index.js +0 -210
  854. package/debuggingApp/node_modules/serve-static/package.json +0 -42
  855. package/debuggingApp/node_modules/setprototypeof/LICENSE +0 -13
  856. package/debuggingApp/node_modules/setprototypeof/README.md +0 -31
  857. package/debuggingApp/node_modules/setprototypeof/index.d.ts +0 -2
  858. package/debuggingApp/node_modules/setprototypeof/index.js +0 -17
  859. package/debuggingApp/node_modules/setprototypeof/package.json +0 -38
  860. package/debuggingApp/node_modules/setprototypeof/test/index.js +0 -24
  861. package/debuggingApp/node_modules/side-channel/.github/FUNDING.yml +0 -12
  862. package/debuggingApp/node_modules/side-channel/.nycrc +0 -13
  863. package/debuggingApp/node_modules/side-channel/CHANGELOG.md +0 -65
  864. package/debuggingApp/node_modules/side-channel/LICENSE +0 -21
  865. package/debuggingApp/node_modules/side-channel/README.md +0 -2
  866. package/debuggingApp/node_modules/side-channel/index.js +0 -124
  867. package/debuggingApp/node_modules/side-channel/package.json +0 -67
  868. package/debuggingApp/node_modules/side-channel/test/index.js +0 -78
  869. package/debuggingApp/node_modules/statuses/HISTORY.md +0 -82
  870. package/debuggingApp/node_modules/statuses/LICENSE +0 -23
  871. package/debuggingApp/node_modules/statuses/README.md +0 -136
  872. package/debuggingApp/node_modules/statuses/codes.json +0 -65
  873. package/debuggingApp/node_modules/statuses/index.js +0 -146
  874. package/debuggingApp/node_modules/statuses/package.json +0 -49
  875. package/debuggingApp/node_modules/toidentifier/HISTORY.md +0 -9
  876. package/debuggingApp/node_modules/toidentifier/LICENSE +0 -21
  877. package/debuggingApp/node_modules/toidentifier/README.md +0 -61
  878. package/debuggingApp/node_modules/toidentifier/index.js +0 -32
  879. package/debuggingApp/node_modules/toidentifier/package.json +0 -38
  880. package/debuggingApp/node_modules/type-is/HISTORY.md +0 -259
  881. package/debuggingApp/node_modules/type-is/LICENSE +0 -23
  882. package/debuggingApp/node_modules/type-is/README.md +0 -170
  883. package/debuggingApp/node_modules/type-is/index.js +0 -266
  884. package/debuggingApp/node_modules/type-is/package.json +0 -45
  885. package/debuggingApp/node_modules/unpipe/HISTORY.md +0 -4
  886. package/debuggingApp/node_modules/unpipe/LICENSE +0 -22
  887. package/debuggingApp/node_modules/unpipe/README.md +0 -43
  888. package/debuggingApp/node_modules/unpipe/index.js +0 -69
  889. package/debuggingApp/node_modules/unpipe/package.json +0 -27
  890. package/debuggingApp/node_modules/utils-merge/LICENSE +0 -20
  891. package/debuggingApp/node_modules/utils-merge/README.md +0 -34
  892. package/debuggingApp/node_modules/utils-merge/index.js +0 -23
  893. package/debuggingApp/node_modules/utils-merge/package.json +0 -40
  894. package/debuggingApp/node_modules/vary/HISTORY.md +0 -39
  895. package/debuggingApp/node_modules/vary/LICENSE +0 -22
  896. package/debuggingApp/node_modules/vary/README.md +0 -101
  897. package/debuggingApp/node_modules/vary/index.js +0 -149
  898. package/debuggingApp/node_modules/vary/package.json +0 -43
  899. package/debuggingApp/package-lock.json +0 -1162
  900. package/debuggingApp/package.json +0 -18
  901. package/debuggingApp/server.js +0 -42
  902. package/dist/cjs/locize.js +0 -464
  903. package/dist/esm/locize.js +0 -454
@@ -1,2922 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.i18next = factory());
5
- }(this, (function () { 'use strict';
6
-
7
- function _typeof(obj) {
8
- "@babel/helpers - typeof";
9
-
10
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
11
- return typeof obj;
12
- } : function (obj) {
13
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14
- }, _typeof(obj);
15
- }
16
-
17
- function _classCallCheck(instance, Constructor) {
18
- if (!(instance instanceof Constructor)) {
19
- throw new TypeError("Cannot call a class as a function");
20
- }
21
- }
22
-
23
- function _defineProperties(target, props) {
24
- for (var i = 0; i < props.length; i++) {
25
- var descriptor = props[i];
26
- descriptor.enumerable = descriptor.enumerable || false;
27
- descriptor.configurable = true;
28
- if ("value" in descriptor) descriptor.writable = true;
29
- Object.defineProperty(target, descriptor.key, descriptor);
30
- }
31
- }
32
-
33
- function _createClass(Constructor, protoProps, staticProps) {
34
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
35
- if (staticProps) _defineProperties(Constructor, staticProps);
36
- Object.defineProperty(Constructor, "prototype", {
37
- writable: false
38
- });
39
- return Constructor;
40
- }
41
-
42
- function _assertThisInitialized(self) {
43
- if (self === void 0) {
44
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
45
- }
46
-
47
- return self;
48
- }
49
-
50
- function _setPrototypeOf(o, p) {
51
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
52
- o.__proto__ = p;
53
- return o;
54
- };
55
-
56
- return _setPrototypeOf(o, p);
57
- }
58
-
59
- function _inherits(subClass, superClass) {
60
- if (typeof superClass !== "function" && superClass !== null) {
61
- throw new TypeError("Super expression must either be null or a function");
62
- }
63
-
64
- subClass.prototype = Object.create(superClass && superClass.prototype, {
65
- constructor: {
66
- value: subClass,
67
- writable: true,
68
- configurable: true
69
- }
70
- });
71
- Object.defineProperty(subClass, "prototype", {
72
- writable: false
73
- });
74
- if (superClass) _setPrototypeOf(subClass, superClass);
75
- }
76
-
77
- function _possibleConstructorReturn(self, call) {
78
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
79
- return call;
80
- } else if (call !== void 0) {
81
- throw new TypeError("Derived constructors may only return object or undefined");
82
- }
83
-
84
- return _assertThisInitialized(self);
85
- }
86
-
87
- function _getPrototypeOf(o) {
88
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
89
- return o.__proto__ || Object.getPrototypeOf(o);
90
- };
91
- return _getPrototypeOf(o);
92
- }
93
-
94
- function _defineProperty(obj, key, value) {
95
- if (key in obj) {
96
- Object.defineProperty(obj, key, {
97
- value: value,
98
- enumerable: true,
99
- configurable: true,
100
- writable: true
101
- });
102
- } else {
103
- obj[key] = value;
104
- }
105
-
106
- return obj;
107
- }
108
-
109
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
110
-
111
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
112
-
113
- var consoleLogger = {
114
- type: 'logger',
115
- log: function log(args) {
116
- this.output('log', args);
117
- },
118
- warn: function warn(args) {
119
- this.output('warn', args);
120
- },
121
- error: function error(args) {
122
- this.output('error', args);
123
- },
124
- output: function output(type, args) {
125
- if (console && console[type]) console[type].apply(console, args);
126
- }
127
- };
128
-
129
- var Logger = function () {
130
- function Logger(concreteLogger) {
131
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
132
-
133
- _classCallCheck(this, Logger);
134
-
135
- this.init(concreteLogger, options);
136
- }
137
-
138
- _createClass(Logger, [{
139
- key: "init",
140
- value: function init(concreteLogger) {
141
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
142
- this.prefix = options.prefix || 'i18next:';
143
- this.logger = concreteLogger || consoleLogger;
144
- this.options = options;
145
- this.debug = options.debug;
146
- }
147
- }, {
148
- key: "setDebug",
149
- value: function setDebug(bool) {
150
- this.debug = bool;
151
- }
152
- }, {
153
- key: "log",
154
- value: function log() {
155
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
156
- args[_key] = arguments[_key];
157
- }
158
-
159
- return this.forward(args, 'log', '', true);
160
- }
161
- }, {
162
- key: "warn",
163
- value: function warn() {
164
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
165
- args[_key2] = arguments[_key2];
166
- }
167
-
168
- return this.forward(args, 'warn', '', true);
169
- }
170
- }, {
171
- key: "error",
172
- value: function error() {
173
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
174
- args[_key3] = arguments[_key3];
175
- }
176
-
177
- return this.forward(args, 'error', '');
178
- }
179
- }, {
180
- key: "deprecate",
181
- value: function deprecate() {
182
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
183
- args[_key4] = arguments[_key4];
184
- }
185
-
186
- return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
187
- }
188
- }, {
189
- key: "forward",
190
- value: function forward(args, lvl, prefix, debugOnly) {
191
- if (debugOnly && !this.debug) return null;
192
- if (typeof args[0] === 'string') args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]);
193
- return this.logger[lvl](args);
194
- }
195
- }, {
196
- key: "create",
197
- value: function create(moduleName) {
198
- return new Logger(this.logger, _objectSpread(_objectSpread({}, {
199
- prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
200
- }), this.options));
201
- }
202
- }]);
203
-
204
- return Logger;
205
- }();
206
-
207
- var baseLogger = new Logger();
208
-
209
- var EventEmitter = function () {
210
- function EventEmitter() {
211
- _classCallCheck(this, EventEmitter);
212
-
213
- this.observers = {};
214
- }
215
-
216
- _createClass(EventEmitter, [{
217
- key: "on",
218
- value: function on(events, listener) {
219
- var _this = this;
220
-
221
- events.split(' ').forEach(function (event) {
222
- _this.observers[event] = _this.observers[event] || [];
223
-
224
- _this.observers[event].push(listener);
225
- });
226
- return this;
227
- }
228
- }, {
229
- key: "off",
230
- value: function off(event, listener) {
231
- if (!this.observers[event]) return;
232
-
233
- if (!listener) {
234
- delete this.observers[event];
235
- return;
236
- }
237
-
238
- this.observers[event] = this.observers[event].filter(function (l) {
239
- return l !== listener;
240
- });
241
- }
242
- }, {
243
- key: "emit",
244
- value: function emit(event) {
245
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
246
- args[_key - 1] = arguments[_key];
247
- }
248
-
249
- if (this.observers[event]) {
250
- var cloned = [].concat(this.observers[event]);
251
- cloned.forEach(function (observer) {
252
- observer.apply(void 0, args);
253
- });
254
- }
255
-
256
- if (this.observers['*']) {
257
- var _cloned = [].concat(this.observers['*']);
258
-
259
- _cloned.forEach(function (observer) {
260
- observer.apply(observer, [event].concat(args));
261
- });
262
- }
263
- }
264
- }]);
265
-
266
- return EventEmitter;
267
- }();
268
-
269
- function defer() {
270
- var res;
271
- var rej;
272
- var promise = new Promise(function (resolve, reject) {
273
- res = resolve;
274
- rej = reject;
275
- });
276
- promise.resolve = res;
277
- promise.reject = rej;
278
- return promise;
279
- }
280
- function makeString(object) {
281
- if (object == null) return '';
282
- return '' + object;
283
- }
284
- function copy(a, s, t) {
285
- a.forEach(function (m) {
286
- if (s[m]) t[m] = s[m];
287
- });
288
- }
289
-
290
- function getLastOfPath(object, path, Empty) {
291
- function cleanKey(key) {
292
- return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
293
- }
294
-
295
- function canNotTraverseDeeper() {
296
- return !object || typeof object === 'string';
297
- }
298
-
299
- var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
300
-
301
- while (stack.length > 1) {
302
- if (canNotTraverseDeeper()) return {};
303
- var key = cleanKey(stack.shift());
304
- if (!object[key] && Empty) object[key] = new Empty();
305
-
306
- if (Object.prototype.hasOwnProperty.call(object, key)) {
307
- object = object[key];
308
- } else {
309
- object = {};
310
- }
311
- }
312
-
313
- if (canNotTraverseDeeper()) return {};
314
- return {
315
- obj: object,
316
- k: cleanKey(stack.shift())
317
- };
318
- }
319
-
320
- function setPath(object, path, newValue) {
321
- var _getLastOfPath = getLastOfPath(object, path, Object),
322
- obj = _getLastOfPath.obj,
323
- k = _getLastOfPath.k;
324
-
325
- obj[k] = newValue;
326
- }
327
- function pushPath(object, path, newValue, concat) {
328
- var _getLastOfPath2 = getLastOfPath(object, path, Object),
329
- obj = _getLastOfPath2.obj,
330
- k = _getLastOfPath2.k;
331
-
332
- obj[k] = obj[k] || [];
333
- if (concat) obj[k] = obj[k].concat(newValue);
334
- if (!concat) obj[k].push(newValue);
335
- }
336
- function getPath(object, path) {
337
- var _getLastOfPath3 = getLastOfPath(object, path),
338
- obj = _getLastOfPath3.obj,
339
- k = _getLastOfPath3.k;
340
-
341
- if (!obj) return undefined;
342
- return obj[k];
343
- }
344
- function getPathWithDefaults(data, defaultData, key) {
345
- var value = getPath(data, key);
346
-
347
- if (value !== undefined) {
348
- return value;
349
- }
350
-
351
- return getPath(defaultData, key);
352
- }
353
- function deepExtend(target, source, overwrite) {
354
- for (var prop in source) {
355
- if (prop !== '__proto__' && prop !== 'constructor') {
356
- if (prop in target) {
357
- if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
358
- if (overwrite) target[prop] = source[prop];
359
- } else {
360
- deepExtend(target[prop], source[prop], overwrite);
361
- }
362
- } else {
363
- target[prop] = source[prop];
364
- }
365
- }
366
- }
367
-
368
- return target;
369
- }
370
- function regexEscape(str) {
371
- return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
372
- }
373
- var _entityMap = {
374
- '&': '&amp;',
375
- '<': '&lt;',
376
- '>': '&gt;',
377
- '"': '&quot;',
378
- "'": '&#39;',
379
- '/': '&#x2F;'
380
- };
381
- function escape(data) {
382
- if (typeof data === 'string') {
383
- return data.replace(/[&<>"'\/]/g, function (s) {
384
- return _entityMap[s];
385
- });
386
- }
387
-
388
- return data;
389
- }
390
- var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
391
- var chars = [' ', ',', '?', '!', ';'];
392
- function looksLikeObjectPath(key, nsSeparator, keySeparator) {
393
- nsSeparator = nsSeparator || '';
394
- keySeparator = keySeparator || '';
395
- var possibleChars = chars.filter(function (c) {
396
- return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
397
- });
398
- if (possibleChars.length === 0) return true;
399
- var r = new RegExp("(".concat(possibleChars.map(function (c) {
400
- return c === '?' ? '\\?' : c;
401
- }).join('|'), ")"));
402
- var matched = !r.test(key);
403
-
404
- if (!matched) {
405
- var ki = key.indexOf(keySeparator);
406
-
407
- if (ki > 0 && !r.test(key.substring(0, ki))) {
408
- matched = true;
409
- }
410
- }
411
-
412
- return matched;
413
- }
414
-
415
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
416
-
417
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
418
-
419
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
420
-
421
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
422
-
423
- function deepFind(obj, path) {
424
- var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
425
- if (!obj) return undefined;
426
- if (obj[path]) return obj[path];
427
- var paths = path.split(keySeparator);
428
- var current = obj;
429
-
430
- for (var i = 0; i < paths.length; ++i) {
431
- if (!current) return undefined;
432
-
433
- if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
434
- return undefined;
435
- }
436
-
437
- if (current[paths[i]] === undefined) {
438
- var j = 2;
439
- var p = paths.slice(i, i + j).join(keySeparator);
440
- var mix = current[p];
441
-
442
- while (mix === undefined && paths.length > i + j) {
443
- j++;
444
- p = paths.slice(i, i + j).join(keySeparator);
445
- mix = current[p];
446
- }
447
-
448
- if (mix === undefined) return undefined;
449
- if (mix === null) return null;
450
-
451
- if (path.endsWith(p)) {
452
- if (typeof mix === 'string') return mix;
453
- if (p && typeof mix[p] === 'string') return mix[p];
454
- }
455
-
456
- var joinedPath = paths.slice(i + j).join(keySeparator);
457
- if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
458
- return undefined;
459
- }
460
-
461
- current = current[paths[i]];
462
- }
463
-
464
- return current;
465
- }
466
-
467
- var ResourceStore = function (_EventEmitter) {
468
- _inherits(ResourceStore, _EventEmitter);
469
-
470
- var _super = _createSuper(ResourceStore);
471
-
472
- function ResourceStore(data) {
473
- var _this;
474
-
475
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
476
- ns: ['translation'],
477
- defaultNS: 'translation'
478
- };
479
-
480
- _classCallCheck(this, ResourceStore);
481
-
482
- _this = _super.call(this);
483
-
484
- if (isIE10) {
485
- EventEmitter.call(_assertThisInitialized(_this));
486
- }
487
-
488
- _this.data = data || {};
489
- _this.options = options;
490
-
491
- if (_this.options.keySeparator === undefined) {
492
- _this.options.keySeparator = '.';
493
- }
494
-
495
- if (_this.options.ignoreJSONStructure === undefined) {
496
- _this.options.ignoreJSONStructure = true;
497
- }
498
-
499
- return _this;
500
- }
501
-
502
- _createClass(ResourceStore, [{
503
- key: "addNamespaces",
504
- value: function addNamespaces(ns) {
505
- if (this.options.ns.indexOf(ns) < 0) {
506
- this.options.ns.push(ns);
507
- }
508
- }
509
- }, {
510
- key: "removeNamespaces",
511
- value: function removeNamespaces(ns) {
512
- var index = this.options.ns.indexOf(ns);
513
-
514
- if (index > -1) {
515
- this.options.ns.splice(index, 1);
516
- }
517
- }
518
- }, {
519
- key: "getResource",
520
- value: function getResource(lng, ns, key) {
521
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
522
- var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
523
- var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
524
- var path = [lng, ns];
525
- if (key && typeof key !== 'string') path = path.concat(key);
526
- if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
527
-
528
- if (lng.indexOf('.') > -1) {
529
- path = lng.split('.');
530
- }
531
-
532
- var result = getPath(this.data, path);
533
- if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
534
- return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
535
- }
536
- }, {
537
- key: "addResource",
538
- value: function addResource(lng, ns, key, value) {
539
- var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
540
- silent: false
541
- };
542
- var keySeparator = this.options.keySeparator;
543
- if (keySeparator === undefined) keySeparator = '.';
544
- var path = [lng, ns];
545
- if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
546
-
547
- if (lng.indexOf('.') > -1) {
548
- path = lng.split('.');
549
- value = ns;
550
- ns = path[1];
551
- }
552
-
553
- this.addNamespaces(ns);
554
- setPath(this.data, path, value);
555
- if (!options.silent) this.emit('added', lng, ns, key, value);
556
- }
557
- }, {
558
- key: "addResources",
559
- value: function addResources(lng, ns, resources) {
560
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
561
- silent: false
562
- };
563
-
564
- for (var m in resources) {
565
- if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
566
- silent: true
567
- });
568
- }
569
-
570
- if (!options.silent) this.emit('added', lng, ns, resources);
571
- }
572
- }, {
573
- key: "addResourceBundle",
574
- value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
575
- var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
576
- silent: false
577
- };
578
- var path = [lng, ns];
579
-
580
- if (lng.indexOf('.') > -1) {
581
- path = lng.split('.');
582
- deep = resources;
583
- resources = ns;
584
- ns = path[1];
585
- }
586
-
587
- this.addNamespaces(ns);
588
- var pack = getPath(this.data, path) || {};
589
-
590
- if (deep) {
591
- deepExtend(pack, resources, overwrite);
592
- } else {
593
- pack = _objectSpread$1(_objectSpread$1({}, pack), resources);
594
- }
595
-
596
- setPath(this.data, path, pack);
597
- if (!options.silent) this.emit('added', lng, ns, resources);
598
- }
599
- }, {
600
- key: "removeResourceBundle",
601
- value: function removeResourceBundle(lng, ns) {
602
- if (this.hasResourceBundle(lng, ns)) {
603
- delete this.data[lng][ns];
604
- }
605
-
606
- this.removeNamespaces(ns);
607
- this.emit('removed', lng, ns);
608
- }
609
- }, {
610
- key: "hasResourceBundle",
611
- value: function hasResourceBundle(lng, ns) {
612
- return this.getResource(lng, ns) !== undefined;
613
- }
614
- }, {
615
- key: "getResourceBundle",
616
- value: function getResourceBundle(lng, ns) {
617
- if (!ns) ns = this.options.defaultNS;
618
- if (this.options.compatibilityAPI === 'v1') return _objectSpread$1(_objectSpread$1({}, {}), this.getResource(lng, ns));
619
- return this.getResource(lng, ns);
620
- }
621
- }, {
622
- key: "getDataByLanguage",
623
- value: function getDataByLanguage(lng) {
624
- return this.data[lng];
625
- }
626
- }, {
627
- key: "hasLanguageSomeTranslations",
628
- value: function hasLanguageSomeTranslations(lng) {
629
- var data = this.getDataByLanguage(lng);
630
- var n = data && Object.keys(data) || [];
631
- return !!n.find(function (v) {
632
- return data[v] && Object.keys(data[v]).length > 0;
633
- });
634
- }
635
- }, {
636
- key: "toJSON",
637
- value: function toJSON() {
638
- return this.data;
639
- }
640
- }]);
641
-
642
- return ResourceStore;
643
- }(EventEmitter);
644
-
645
- var postProcessor = {
646
- processors: {},
647
- addPostProcessor: function addPostProcessor(module) {
648
- this.processors[module.name] = module;
649
- },
650
- handle: function handle(processors, value, key, options, translator) {
651
- var _this = this;
652
-
653
- processors.forEach(function (processor) {
654
- if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
655
- });
656
- return value;
657
- }
658
- };
659
-
660
- function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
661
-
662
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
663
-
664
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
665
-
666
- function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
667
- var checkedLoadedFor = {};
668
-
669
- var Translator = function (_EventEmitter) {
670
- _inherits(Translator, _EventEmitter);
671
-
672
- var _super = _createSuper$1(Translator);
673
-
674
- function Translator(services) {
675
- var _this;
676
-
677
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
678
-
679
- _classCallCheck(this, Translator);
680
-
681
- _this = _super.call(this);
682
-
683
- if (isIE10) {
684
- EventEmitter.call(_assertThisInitialized(_this));
685
- }
686
-
687
- copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized(_this));
688
- _this.options = options;
689
-
690
- if (_this.options.keySeparator === undefined) {
691
- _this.options.keySeparator = '.';
692
- }
693
-
694
- _this.logger = baseLogger.create('translator');
695
- return _this;
696
- }
697
-
698
- _createClass(Translator, [{
699
- key: "changeLanguage",
700
- value: function changeLanguage(lng) {
701
- if (lng) this.language = lng;
702
- }
703
- }, {
704
- key: "exists",
705
- value: function exists(key) {
706
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
707
- interpolation: {}
708
- };
709
-
710
- if (key === undefined || key === null) {
711
- return false;
712
- }
713
-
714
- var resolved = this.resolve(key, options);
715
- return resolved && resolved.res !== undefined;
716
- }
717
- }, {
718
- key: "extractFromKey",
719
- value: function extractFromKey(key, options) {
720
- var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
721
- if (nsSeparator === undefined) nsSeparator = ':';
722
- var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
723
- var namespaces = options.ns || this.options.defaultNS || [];
724
- var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
725
- var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
726
-
727
- if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
728
- var m = key.match(this.interpolator.nestingRegexp);
729
-
730
- if (m && m.length > 0) {
731
- return {
732
- key: key,
733
- namespaces: namespaces
734
- };
735
- }
736
-
737
- var parts = key.split(nsSeparator);
738
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
739
- key = parts.join(keySeparator);
740
- }
741
-
742
- if (typeof namespaces === 'string') namespaces = [namespaces];
743
- return {
744
- key: key,
745
- namespaces: namespaces
746
- };
747
- }
748
- }, {
749
- key: "translate",
750
- value: function translate(keys, options, lastKey) {
751
- var _this2 = this;
752
-
753
- if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
754
- options = this.options.overloadTranslationOptionHandler(arguments);
755
- }
756
-
757
- if (!options) options = {};
758
- if (keys === undefined || keys === null) return '';
759
- if (!Array.isArray(keys)) keys = [String(keys)];
760
- var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
761
- var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
762
-
763
- var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
764
- key = _this$extractFromKey.key,
765
- namespaces = _this$extractFromKey.namespaces;
766
-
767
- var namespace = namespaces[namespaces.length - 1];
768
- var lng = options.lng || this.language;
769
- var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
770
-
771
- if (lng && lng.toLowerCase() === 'cimode') {
772
- if (appendNamespaceToCIMode) {
773
- var nsSeparator = options.nsSeparator || this.options.nsSeparator;
774
-
775
- if (returnDetails) {
776
- resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
777
- return resolved;
778
- }
779
-
780
- return "".concat(namespace).concat(nsSeparator).concat(key);
781
- }
782
-
783
- if (returnDetails) {
784
- resolved.res = key;
785
- return resolved;
786
- }
787
-
788
- return key;
789
- }
790
-
791
- var resolved = this.resolve(keys, options);
792
- var res = resolved && resolved.res;
793
- var resUsedKey = resolved && resolved.usedKey || key;
794
- var resExactUsedKey = resolved && resolved.exactUsedKey || key;
795
- var resType = Object.prototype.toString.apply(res);
796
- var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
797
- var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
798
- var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
799
- var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
800
-
801
- if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
802
- if (!options.returnObjects && !this.options.returnObjects) {
803
- if (!this.options.returnedObjectHandler) {
804
- this.logger.warn('accessing an object - but returnObjects options is not enabled!');
805
- }
806
-
807
- var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2(_objectSpread$2({}, options), {}, {
808
- ns: namespaces
809
- })) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
810
-
811
- if (returnDetails) {
812
- resolved.res = r;
813
- return resolved;
814
- }
815
-
816
- return r;
817
- }
818
-
819
- if (keySeparator) {
820
- var resTypeIsArray = resType === '[object Array]';
821
- var copy = resTypeIsArray ? [] : {};
822
- var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
823
-
824
- for (var m in res) {
825
- if (Object.prototype.hasOwnProperty.call(res, m)) {
826
- var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
827
- copy[m] = this.translate(deepKey, _objectSpread$2(_objectSpread$2({}, options), {
828
- joinArrays: false,
829
- ns: namespaces
830
- }));
831
- if (copy[m] === deepKey) copy[m] = res[m];
832
- }
833
- }
834
-
835
- res = copy;
836
- }
837
- } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
838
- res = res.join(joinArrays);
839
- if (res) res = this.extendTranslation(res, keys, options, lastKey);
840
- } else {
841
- var usedDefault = false;
842
- var usedKey = false;
843
- var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
844
- var hasDefaultValue = Translator.hasDefaultValue(options);
845
- var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
846
- var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
847
-
848
- if (!this.isValidLookup(res) && hasDefaultValue) {
849
- usedDefault = true;
850
- res = defaultValue;
851
- }
852
-
853
- if (!this.isValidLookup(res)) {
854
- usedKey = true;
855
- res = key;
856
- }
857
-
858
- var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
859
- var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
860
- var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
861
-
862
- if (usedKey || usedDefault || updateMissing) {
863
- this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
864
-
865
- if (keySeparator) {
866
- var fk = this.resolve(key, _objectSpread$2(_objectSpread$2({}, options), {}, {
867
- keySeparator: false
868
- }));
869
- 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.');
870
- }
871
-
872
- var lngs = [];
873
- var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
874
-
875
- if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
876
- for (var i = 0; i < fallbackLngs.length; i++) {
877
- lngs.push(fallbackLngs[i]);
878
- }
879
- } else if (this.options.saveMissingTo === 'all') {
880
- lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
881
- } else {
882
- lngs.push(options.lng || this.language);
883
- }
884
-
885
- var send = function send(l, k, specificDefaultValue) {
886
- var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
887
-
888
- if (_this2.options.missingKeyHandler) {
889
- _this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
890
- } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
891
- _this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
892
- }
893
-
894
- _this2.emit('missingKey', l, namespace, k, res);
895
- };
896
-
897
- if (this.options.saveMissing) {
898
- if (this.options.saveMissingPlurals && needsPluralHandling) {
899
- lngs.forEach(function (language) {
900
- _this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
901
- send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue);
902
- });
903
- });
904
- } else {
905
- send(lngs, key, defaultValue);
906
- }
907
- }
908
- }
909
-
910
- res = this.extendTranslation(res, keys, options, resolved, lastKey);
911
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key);
912
-
913
- if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
914
- if (this.options.compatibilityAPI !== 'v1') {
915
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
916
- } else {
917
- res = this.options.parseMissingKeyHandler(res);
918
- }
919
- }
920
- }
921
-
922
- if (returnDetails) {
923
- resolved.res = res;
924
- return resolved;
925
- }
926
-
927
- return res;
928
- }
929
- }, {
930
- key: "extendTranslation",
931
- value: function extendTranslation(res, key, options, resolved, lastKey) {
932
- var _this3 = this;
933
-
934
- if (this.i18nFormat && this.i18nFormat.parse) {
935
- res = this.i18nFormat.parse(res, _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
936
- resolved: resolved
937
- });
938
- } else if (!options.skipInterpolation) {
939
- if (options.interpolation) this.interpolator.init(_objectSpread$2(_objectSpread$2({}, options), {
940
- interpolation: _objectSpread$2(_objectSpread$2({}, this.options.interpolation), options.interpolation)
941
- }));
942
- var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
943
- var nestBef;
944
-
945
- if (skipOnVariables) {
946
- var nb = res.match(this.interpolator.nestingRegexp);
947
- nestBef = nb && nb.length;
948
- }
949
-
950
- var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
951
- if (this.options.interpolation.defaultVariables) data = _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), data);
952
- res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
953
-
954
- if (skipOnVariables) {
955
- var na = res.match(this.interpolator.nestingRegexp);
956
- var nestAft = na && na.length;
957
- if (nestBef < nestAft) options.nest = false;
958
- }
959
-
960
- if (options.nest !== false) res = this.interpolator.nest(res, function () {
961
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
962
- args[_key] = arguments[_key];
963
- }
964
-
965
- if (lastKey && lastKey[0] === args[0] && !options.context) {
966
- _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
967
-
968
- return null;
969
- }
970
-
971
- return _this3.translate.apply(_this3, args.concat([key]));
972
- }, options);
973
- if (options.interpolation) this.interpolator.reset();
974
- }
975
-
976
- var postProcess = options.postProcess || this.options.postProcess;
977
- var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
978
-
979
- if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
980
- res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2({
981
- i18nResolved: resolved
982
- }, options) : options, this);
983
- }
984
-
985
- return res;
986
- }
987
- }, {
988
- key: "resolve",
989
- value: function resolve(keys) {
990
- var _this4 = this;
991
-
992
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
993
- var found;
994
- var usedKey;
995
- var exactUsedKey;
996
- var usedLng;
997
- var usedNS;
998
- if (typeof keys === 'string') keys = [keys];
999
- keys.forEach(function (k) {
1000
- if (_this4.isValidLookup(found)) return;
1001
-
1002
- var extracted = _this4.extractFromKey(k, options);
1003
-
1004
- var key = extracted.key;
1005
- usedKey = key;
1006
- var namespaces = extracted.namespaces;
1007
- if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
1008
- var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
1009
-
1010
- var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
1011
-
1012
- var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
1013
- var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
1014
- namespaces.forEach(function (ns) {
1015
- if (_this4.isValidLookup(found)) return;
1016
- usedNS = ns;
1017
-
1018
- if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
1019
- checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
1020
-
1021
- _this4.logger.warn("key \"".concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(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!!!');
1022
- }
1023
-
1024
- codes.forEach(function (code) {
1025
- if (_this4.isValidLookup(found)) return;
1026
- usedLng = code;
1027
- var finalKeys = [key];
1028
-
1029
- if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
1030
- _this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
1031
- } else {
1032
- var pluralSuffix;
1033
- if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
1034
- var zeroSuffix = '_zero';
1035
-
1036
- if (needsPluralHandling) {
1037
- finalKeys.push(key + pluralSuffix);
1038
-
1039
- if (needsZeroSuffixLookup) {
1040
- finalKeys.push(key + zeroSuffix);
1041
- }
1042
- }
1043
-
1044
- if (needsContextHandling) {
1045
- var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
1046
- finalKeys.push(contextKey);
1047
-
1048
- if (needsPluralHandling) {
1049
- finalKeys.push(contextKey + pluralSuffix);
1050
-
1051
- if (needsZeroSuffixLookup) {
1052
- finalKeys.push(contextKey + zeroSuffix);
1053
- }
1054
- }
1055
- }
1056
- }
1057
-
1058
- var possibleKey;
1059
-
1060
- while (possibleKey = finalKeys.pop()) {
1061
- if (!_this4.isValidLookup(found)) {
1062
- exactUsedKey = possibleKey;
1063
- found = _this4.getResource(code, ns, possibleKey, options);
1064
- }
1065
- }
1066
- });
1067
- });
1068
- });
1069
- return {
1070
- res: found,
1071
- usedKey: usedKey,
1072
- exactUsedKey: exactUsedKey,
1073
- usedLng: usedLng,
1074
- usedNS: usedNS
1075
- };
1076
- }
1077
- }, {
1078
- key: "isValidLookup",
1079
- value: function isValidLookup(res) {
1080
- return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
1081
- }
1082
- }, {
1083
- key: "getResource",
1084
- value: function getResource(code, ns, key) {
1085
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1086
- if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
1087
- return this.resourceStore.getResource(code, ns, key, options);
1088
- }
1089
- }], [{
1090
- key: "hasDefaultValue",
1091
- value: function hasDefaultValue(options) {
1092
- var prefix = 'defaultValue';
1093
-
1094
- for (var option in options) {
1095
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
1096
- return true;
1097
- }
1098
- }
1099
-
1100
- return false;
1101
- }
1102
- }]);
1103
-
1104
- return Translator;
1105
- }(EventEmitter);
1106
-
1107
- function capitalize(string) {
1108
- return string.charAt(0).toUpperCase() + string.slice(1);
1109
- }
1110
-
1111
- var LanguageUtil = function () {
1112
- function LanguageUtil(options) {
1113
- _classCallCheck(this, LanguageUtil);
1114
-
1115
- this.options = options;
1116
- this.supportedLngs = this.options.supportedLngs || false;
1117
- this.logger = baseLogger.create('languageUtils');
1118
- }
1119
-
1120
- _createClass(LanguageUtil, [{
1121
- key: "getScriptPartFromCode",
1122
- value: function getScriptPartFromCode(code) {
1123
- if (!code || code.indexOf('-') < 0) return null;
1124
- var p = code.split('-');
1125
- if (p.length === 2) return null;
1126
- p.pop();
1127
- if (p[p.length - 1].toLowerCase() === 'x') return null;
1128
- return this.formatLanguageCode(p.join('-'));
1129
- }
1130
- }, {
1131
- key: "getLanguagePartFromCode",
1132
- value: function getLanguagePartFromCode(code) {
1133
- if (!code || code.indexOf('-') < 0) return code;
1134
- var p = code.split('-');
1135
- return this.formatLanguageCode(p[0]);
1136
- }
1137
- }, {
1138
- key: "formatLanguageCode",
1139
- value: function formatLanguageCode(code) {
1140
- if (typeof code === 'string' && code.indexOf('-') > -1) {
1141
- var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
1142
- var p = code.split('-');
1143
-
1144
- if (this.options.lowerCaseLng) {
1145
- p = p.map(function (part) {
1146
- return part.toLowerCase();
1147
- });
1148
- } else if (p.length === 2) {
1149
- p[0] = p[0].toLowerCase();
1150
- p[1] = p[1].toUpperCase();
1151
- if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
1152
- } else if (p.length === 3) {
1153
- p[0] = p[0].toLowerCase();
1154
- if (p[1].length === 2) p[1] = p[1].toUpperCase();
1155
- if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
1156
- if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
1157
- if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
1158
- }
1159
-
1160
- return p.join('-');
1161
- }
1162
-
1163
- return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
1164
- }
1165
- }, {
1166
- key: "isSupportedCode",
1167
- value: function isSupportedCode(code) {
1168
- if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
1169
- code = this.getLanguagePartFromCode(code);
1170
- }
1171
-
1172
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
1173
- }
1174
- }, {
1175
- key: "getBestMatchFromCodes",
1176
- value: function getBestMatchFromCodes(codes) {
1177
- var _this = this;
1178
-
1179
- if (!codes) return null;
1180
- var found;
1181
- codes.forEach(function (code) {
1182
- if (found) return;
1183
-
1184
- var cleanedLng = _this.formatLanguageCode(code);
1185
-
1186
- if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
1187
- });
1188
-
1189
- if (!found && this.options.supportedLngs) {
1190
- codes.forEach(function (code) {
1191
- if (found) return;
1192
-
1193
- var lngOnly = _this.getLanguagePartFromCode(code);
1194
-
1195
- if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
1196
- found = _this.options.supportedLngs.find(function (supportedLng) {
1197
- if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
1198
- });
1199
- });
1200
- }
1201
-
1202
- if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
1203
- return found;
1204
- }
1205
- }, {
1206
- key: "getFallbackCodes",
1207
- value: function getFallbackCodes(fallbacks, code) {
1208
- if (!fallbacks) return [];
1209
- if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
1210
- if (typeof fallbacks === 'string') fallbacks = [fallbacks];
1211
- if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
1212
- if (!code) return fallbacks["default"] || [];
1213
- var found = fallbacks[code];
1214
- if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
1215
- if (!found) found = fallbacks[this.formatLanguageCode(code)];
1216
- if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
1217
- if (!found) found = fallbacks["default"];
1218
- return found || [];
1219
- }
1220
- }, {
1221
- key: "toResolveHierarchy",
1222
- value: function toResolveHierarchy(code, fallbackCode) {
1223
- var _this2 = this;
1224
-
1225
- var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1226
- var codes = [];
1227
-
1228
- var addCode = function addCode(c) {
1229
- if (!c) return;
1230
-
1231
- if (_this2.isSupportedCode(c)) {
1232
- codes.push(c);
1233
- } else {
1234
- _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
1235
- }
1236
- };
1237
-
1238
- if (typeof code === 'string' && code.indexOf('-') > -1) {
1239
- if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
1240
- if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
1241
- if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
1242
- } else if (typeof code === 'string') {
1243
- addCode(this.formatLanguageCode(code));
1244
- }
1245
-
1246
- fallbackCodes.forEach(function (fc) {
1247
- if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
1248
- });
1249
- return codes;
1250
- }
1251
- }]);
1252
-
1253
- return LanguageUtil;
1254
- }();
1255
-
1256
- var sets = [{
1257
- lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
1258
- nr: [1, 2],
1259
- fc: 1
1260
- }, {
1261
- lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kk', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],
1262
- nr: [1, 2],
1263
- fc: 2
1264
- }, {
1265
- lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
1266
- nr: [1],
1267
- fc: 3
1268
- }, {
1269
- lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
1270
- nr: [1, 2, 5],
1271
- fc: 4
1272
- }, {
1273
- lngs: ['ar'],
1274
- nr: [0, 1, 2, 3, 11, 100],
1275
- fc: 5
1276
- }, {
1277
- lngs: ['cs', 'sk'],
1278
- nr: [1, 2, 5],
1279
- fc: 6
1280
- }, {
1281
- lngs: ['csb', 'pl'],
1282
- nr: [1, 2, 5],
1283
- fc: 7
1284
- }, {
1285
- lngs: ['cy'],
1286
- nr: [1, 2, 3, 8],
1287
- fc: 8
1288
- }, {
1289
- lngs: ['fr'],
1290
- nr: [1, 2],
1291
- fc: 9
1292
- }, {
1293
- lngs: ['ga'],
1294
- nr: [1, 2, 3, 7, 11],
1295
- fc: 10
1296
- }, {
1297
- lngs: ['gd'],
1298
- nr: [1, 2, 3, 20],
1299
- fc: 11
1300
- }, {
1301
- lngs: ['is'],
1302
- nr: [1, 2],
1303
- fc: 12
1304
- }, {
1305
- lngs: ['jv'],
1306
- nr: [0, 1],
1307
- fc: 13
1308
- }, {
1309
- lngs: ['kw'],
1310
- nr: [1, 2, 3, 4],
1311
- fc: 14
1312
- }, {
1313
- lngs: ['lt'],
1314
- nr: [1, 2, 10],
1315
- fc: 15
1316
- }, {
1317
- lngs: ['lv'],
1318
- nr: [1, 2, 0],
1319
- fc: 16
1320
- }, {
1321
- lngs: ['mk'],
1322
- nr: [1, 2],
1323
- fc: 17
1324
- }, {
1325
- lngs: ['mnk'],
1326
- nr: [0, 1, 2],
1327
- fc: 18
1328
- }, {
1329
- lngs: ['mt'],
1330
- nr: [1, 2, 11, 20],
1331
- fc: 19
1332
- }, {
1333
- lngs: ['or'],
1334
- nr: [2, 1],
1335
- fc: 2
1336
- }, {
1337
- lngs: ['ro'],
1338
- nr: [1, 2, 20],
1339
- fc: 20
1340
- }, {
1341
- lngs: ['sl'],
1342
- nr: [5, 1, 2, 3],
1343
- fc: 21
1344
- }, {
1345
- lngs: ['he', 'iw'],
1346
- nr: [1, 2, 20, 21],
1347
- fc: 22
1348
- }];
1349
- var _rulesPluralsTypes = {
1350
- 1: function _(n) {
1351
- return Number(n > 1);
1352
- },
1353
- 2: function _(n) {
1354
- return Number(n != 1);
1355
- },
1356
- 3: function _(n) {
1357
- return 0;
1358
- },
1359
- 4: function _(n) {
1360
- return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
1361
- },
1362
- 5: function _(n) {
1363
- return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
1364
- },
1365
- 6: function _(n) {
1366
- return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
1367
- },
1368
- 7: function _(n) {
1369
- return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
1370
- },
1371
- 8: function _(n) {
1372
- return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
1373
- },
1374
- 9: function _(n) {
1375
- return Number(n >= 2);
1376
- },
1377
- 10: function _(n) {
1378
- return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
1379
- },
1380
- 11: function _(n) {
1381
- return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
1382
- },
1383
- 12: function _(n) {
1384
- return Number(n % 10 != 1 || n % 100 == 11);
1385
- },
1386
- 13: function _(n) {
1387
- return Number(n !== 0);
1388
- },
1389
- 14: function _(n) {
1390
- return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
1391
- },
1392
- 15: function _(n) {
1393
- return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
1394
- },
1395
- 16: function _(n) {
1396
- return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
1397
- },
1398
- 17: function _(n) {
1399
- return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
1400
- },
1401
- 18: function _(n) {
1402
- return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
1403
- },
1404
- 19: function _(n) {
1405
- return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
1406
- },
1407
- 20: function _(n) {
1408
- return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
1409
- },
1410
- 21: function _(n) {
1411
- return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
1412
- },
1413
- 22: function _(n) {
1414
- return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
1415
- }
1416
- };
1417
- var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
1418
- var suffixesOrder = {
1419
- zero: 0,
1420
- one: 1,
1421
- two: 2,
1422
- few: 3,
1423
- many: 4,
1424
- other: 5
1425
- };
1426
-
1427
- function createRules() {
1428
- var rules = {};
1429
- sets.forEach(function (set) {
1430
- set.lngs.forEach(function (l) {
1431
- rules[l] = {
1432
- numbers: set.nr,
1433
- plurals: _rulesPluralsTypes[set.fc]
1434
- };
1435
- });
1436
- });
1437
- return rules;
1438
- }
1439
-
1440
- var PluralResolver = function () {
1441
- function PluralResolver(languageUtils) {
1442
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1443
-
1444
- _classCallCheck(this, PluralResolver);
1445
-
1446
- this.languageUtils = languageUtils;
1447
- this.options = options;
1448
- this.logger = baseLogger.create('pluralResolver');
1449
-
1450
- if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
1451
- this.options.compatibilityJSON = 'v3';
1452
- this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');
1453
- }
1454
-
1455
- this.rules = createRules();
1456
- }
1457
-
1458
- _createClass(PluralResolver, [{
1459
- key: "addRule",
1460
- value: function addRule(lng, obj) {
1461
- this.rules[lng] = obj;
1462
- }
1463
- }, {
1464
- key: "getRule",
1465
- value: function getRule(code) {
1466
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1467
-
1468
- if (this.shouldUseIntlApi()) {
1469
- try {
1470
- return new Intl.PluralRules(code, {
1471
- type: options.ordinal ? 'ordinal' : 'cardinal'
1472
- });
1473
- } catch (_unused) {
1474
- return;
1475
- }
1476
- }
1477
-
1478
- return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
1479
- }
1480
- }, {
1481
- key: "needsPlural",
1482
- value: function needsPlural(code) {
1483
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1484
- var rule = this.getRule(code, options);
1485
-
1486
- if (this.shouldUseIntlApi()) {
1487
- return rule && rule.resolvedOptions().pluralCategories.length > 1;
1488
- }
1489
-
1490
- return rule && rule.numbers.length > 1;
1491
- }
1492
- }, {
1493
- key: "getPluralFormsOfKey",
1494
- value: function getPluralFormsOfKey(code, key) {
1495
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1496
- return this.getSuffixes(code, options).map(function (suffix) {
1497
- return "".concat(key).concat(suffix);
1498
- });
1499
- }
1500
- }, {
1501
- key: "getSuffixes",
1502
- value: function getSuffixes(code) {
1503
- var _this = this;
1504
-
1505
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1506
- var rule = this.getRule(code, options);
1507
-
1508
- if (!rule) {
1509
- return [];
1510
- }
1511
-
1512
- if (this.shouldUseIntlApi()) {
1513
- return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
1514
- return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
1515
- }).map(function (pluralCategory) {
1516
- return "".concat(_this.options.prepend).concat(pluralCategory);
1517
- });
1518
- }
1519
-
1520
- return rule.numbers.map(function (number) {
1521
- return _this.getSuffix(code, number, options);
1522
- });
1523
- }
1524
- }, {
1525
- key: "getSuffix",
1526
- value: function getSuffix(code, count) {
1527
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1528
- var rule = this.getRule(code, options);
1529
-
1530
- if (rule) {
1531
- if (this.shouldUseIntlApi()) {
1532
- return "".concat(this.options.prepend).concat(rule.select(count));
1533
- }
1534
-
1535
- return this.getSuffixRetroCompatible(rule, count);
1536
- }
1537
-
1538
- this.logger.warn("no plural rule found for: ".concat(code));
1539
- return '';
1540
- }
1541
- }, {
1542
- key: "getSuffixRetroCompatible",
1543
- value: function getSuffixRetroCompatible(rule, count) {
1544
- var _this2 = this;
1545
-
1546
- var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
1547
- var suffix = rule.numbers[idx];
1548
-
1549
- if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1550
- if (suffix === 2) {
1551
- suffix = 'plural';
1552
- } else if (suffix === 1) {
1553
- suffix = '';
1554
- }
1555
- }
1556
-
1557
- var returnSuffix = function returnSuffix() {
1558
- return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
1559
- };
1560
-
1561
- if (this.options.compatibilityJSON === 'v1') {
1562
- if (suffix === 1) return '';
1563
- if (typeof suffix === 'number') return "_plural_".concat(suffix.toString());
1564
- return returnSuffix();
1565
- } else if (this.options.compatibilityJSON === 'v2') {
1566
- return returnSuffix();
1567
- } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1568
- return returnSuffix();
1569
- }
1570
-
1571
- return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
1572
- }
1573
- }, {
1574
- key: "shouldUseIntlApi",
1575
- value: function shouldUseIntlApi() {
1576
- return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
1577
- }
1578
- }]);
1579
-
1580
- return PluralResolver;
1581
- }();
1582
-
1583
- function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1584
-
1585
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1586
-
1587
- var Interpolator = function () {
1588
- function Interpolator() {
1589
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1590
-
1591
- _classCallCheck(this, Interpolator);
1592
-
1593
- this.logger = baseLogger.create('interpolator');
1594
- this.options = options;
1595
-
1596
- this.format = options.interpolation && options.interpolation.format || function (value) {
1597
- return value;
1598
- };
1599
-
1600
- this.init(options);
1601
- }
1602
-
1603
- _createClass(Interpolator, [{
1604
- key: "init",
1605
- value: function init() {
1606
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1607
- if (!options.interpolation) options.interpolation = {
1608
- escapeValue: true
1609
- };
1610
- var iOpts = options.interpolation;
1611
- this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
1612
- this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
1613
- this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
1614
- this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
1615
- this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
1616
- this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
1617
- this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
1618
- this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
1619
- this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
1620
- this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
1621
- this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
1622
- this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
1623
- this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
1624
- this.resetRegExp();
1625
- }
1626
- }, {
1627
- key: "reset",
1628
- value: function reset() {
1629
- if (this.options) this.init(this.options);
1630
- }
1631
- }, {
1632
- key: "resetRegExp",
1633
- value: function resetRegExp() {
1634
- var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix);
1635
- this.regexp = new RegExp(regexpStr, 'g');
1636
- var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
1637
- this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
1638
- var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
1639
- this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
1640
- }
1641
- }, {
1642
- key: "interpolate",
1643
- value: function interpolate(str, data, lng, options) {
1644
- var _this = this;
1645
-
1646
- var match;
1647
- var value;
1648
- var replaces;
1649
- var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1650
-
1651
- function regexSafe(val) {
1652
- return val.replace(/\$/g, '$$$$');
1653
- }
1654
-
1655
- var handleFormat = function handleFormat(key) {
1656
- if (key.indexOf(_this.formatSeparator) < 0) {
1657
- var path = getPathWithDefaults(data, defaultData, key);
1658
- return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1659
- interpolationkey: key
1660
- })) : path;
1661
- }
1662
-
1663
- var p = key.split(_this.formatSeparator);
1664
- var k = p.shift().trim();
1665
- var f = p.join(_this.formatSeparator).trim();
1666
- return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1667
- interpolationkey: k
1668
- }));
1669
- };
1670
-
1671
- this.resetRegExp();
1672
- var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
1673
- var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1674
- var todos = [{
1675
- regex: this.regexpUnescape,
1676
- safeValue: function safeValue(val) {
1677
- return regexSafe(val);
1678
- }
1679
- }, {
1680
- regex: this.regexp,
1681
- safeValue: function safeValue(val) {
1682
- return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
1683
- }
1684
- }];
1685
- todos.forEach(function (todo) {
1686
- replaces = 0;
1687
-
1688
- while (match = todo.regex.exec(str)) {
1689
- var matchedVar = match[1].trim();
1690
- value = handleFormat(matchedVar);
1691
-
1692
- if (value === undefined) {
1693
- if (typeof missingInterpolationHandler === 'function') {
1694
- var temp = missingInterpolationHandler(str, match, options);
1695
- value = typeof temp === 'string' ? temp : '';
1696
- } else if (options && options.hasOwnProperty(matchedVar)) {
1697
- value = '';
1698
- } else if (skipOnVariables) {
1699
- value = match[0];
1700
- continue;
1701
- } else {
1702
- _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
1703
-
1704
- value = '';
1705
- }
1706
- } else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
1707
- value = makeString(value);
1708
- }
1709
-
1710
- var safeValue = todo.safeValue(value);
1711
- str = str.replace(match[0], safeValue);
1712
-
1713
- if (skipOnVariables) {
1714
- todo.regex.lastIndex += value.length;
1715
- todo.regex.lastIndex -= match[0].length;
1716
- } else {
1717
- todo.regex.lastIndex = 0;
1718
- }
1719
-
1720
- replaces++;
1721
-
1722
- if (replaces >= _this.maxReplaces) {
1723
- break;
1724
- }
1725
- }
1726
- });
1727
- return str;
1728
- }
1729
- }, {
1730
- key: "nest",
1731
- value: function nest(str, fc) {
1732
- var _this2 = this;
1733
-
1734
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1735
- var match;
1736
- var value;
1737
-
1738
- var clonedOptions = _objectSpread$3({}, options);
1739
-
1740
- clonedOptions.applyPostProcessor = false;
1741
- delete clonedOptions.defaultValue;
1742
-
1743
- function handleHasOptions(key, inheritedOptions) {
1744
- var sep = this.nestingOptionsSeparator;
1745
- if (key.indexOf(sep) < 0) return key;
1746
- var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
1747
- var optionsString = "{".concat(c[1]);
1748
- key = c[0];
1749
- optionsString = this.interpolate(optionsString, clonedOptions);
1750
- optionsString = optionsString.replace(/'/g, '"');
1751
-
1752
- try {
1753
- clonedOptions = JSON.parse(optionsString);
1754
- if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
1755
- } catch (e) {
1756
- this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
1757
- return "".concat(key).concat(sep).concat(optionsString);
1758
- }
1759
-
1760
- delete clonedOptions.defaultValue;
1761
- return key;
1762
- }
1763
-
1764
- while (match = this.nestingRegexp.exec(str)) {
1765
- var formatters = [];
1766
- var doReduce = false;
1767
-
1768
- if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
1769
- var r = match[1].split(this.formatSeparator).map(function (elem) {
1770
- return elem.trim();
1771
- });
1772
- match[1] = r.shift();
1773
- formatters = r;
1774
- doReduce = true;
1775
- }
1776
-
1777
- value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1778
- if (value && match[0] === str && typeof value !== 'string') return value;
1779
- if (typeof value !== 'string') value = makeString(value);
1780
-
1781
- if (!value) {
1782
- this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str));
1783
- value = '';
1784
- }
1785
-
1786
- if (doReduce) {
1787
- value = formatters.reduce(function (v, f) {
1788
- return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
1789
- interpolationkey: match[1].trim()
1790
- }));
1791
- }, value.trim());
1792
- }
1793
-
1794
- str = str.replace(match[0], value);
1795
- this.regexp.lastIndex = 0;
1796
- }
1797
-
1798
- return str;
1799
- }
1800
- }]);
1801
-
1802
- return Interpolator;
1803
- }();
1804
-
1805
- function _arrayWithHoles(arr) {
1806
- if (Array.isArray(arr)) return arr;
1807
- }
1808
-
1809
- function _iterableToArray(iter) {
1810
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1811
- }
1812
-
1813
- function _arrayLikeToArray(arr, len) {
1814
- if (len == null || len > arr.length) len = arr.length;
1815
-
1816
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
1817
- arr2[i] = arr[i];
1818
- }
1819
-
1820
- return arr2;
1821
- }
1822
-
1823
- function _unsupportedIterableToArray(o, minLen) {
1824
- if (!o) return;
1825
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1826
- var n = Object.prototype.toString.call(o).slice(8, -1);
1827
- if (n === "Object" && o.constructor) n = o.constructor.name;
1828
- if (n === "Map" || n === "Set") return Array.from(o);
1829
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1830
- }
1831
-
1832
- function _nonIterableRest() {
1833
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1834
- }
1835
-
1836
- function _toArray(arr) {
1837
- return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
1838
- }
1839
-
1840
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1841
-
1842
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1843
-
1844
- function parseFormatStr(formatStr) {
1845
- var formatName = formatStr.toLowerCase().trim();
1846
- var formatOptions = {};
1847
-
1848
- if (formatStr.indexOf('(') > -1) {
1849
- var p = formatStr.split('(');
1850
- formatName = p[0].toLowerCase().trim();
1851
- var optStr = p[1].substring(0, p[1].length - 1);
1852
-
1853
- if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1854
- if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1855
- } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
1856
- if (!formatOptions.range) formatOptions.range = optStr.trim();
1857
- } else {
1858
- var opts = optStr.split(';');
1859
- opts.forEach(function (opt) {
1860
- if (!opt) return;
1861
-
1862
- var _opt$split = opt.split(':'),
1863
- _opt$split2 = _toArray(_opt$split),
1864
- key = _opt$split2[0],
1865
- rest = _opt$split2.slice(1);
1866
-
1867
- var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1868
- if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
1869
- if (val === 'false') formatOptions[key.trim()] = false;
1870
- if (val === 'true') formatOptions[key.trim()] = true;
1871
- if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
1872
- });
1873
- }
1874
- }
1875
-
1876
- return {
1877
- formatName: formatName,
1878
- formatOptions: formatOptions
1879
- };
1880
- }
1881
-
1882
- var Formatter = function () {
1883
- function Formatter() {
1884
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1885
-
1886
- _classCallCheck(this, Formatter);
1887
-
1888
- this.logger = baseLogger.create('formatter');
1889
- this.options = options;
1890
- this.formats = {
1891
- number: function number(val, lng, options) {
1892
- return new Intl.NumberFormat(lng, options).format(val);
1893
- },
1894
- currency: function currency(val, lng, options) {
1895
- return new Intl.NumberFormat(lng, _objectSpread$4(_objectSpread$4({}, options), {}, {
1896
- style: 'currency'
1897
- })).format(val);
1898
- },
1899
- datetime: function datetime(val, lng, options) {
1900
- return new Intl.DateTimeFormat(lng, _objectSpread$4({}, options)).format(val);
1901
- },
1902
- relativetime: function relativetime(val, lng, options) {
1903
- return new Intl.RelativeTimeFormat(lng, _objectSpread$4({}, options)).format(val, options.range || 'day');
1904
- },
1905
- list: function list(val, lng, options) {
1906
- return new Intl.ListFormat(lng, _objectSpread$4({}, options)).format(val);
1907
- }
1908
- };
1909
- this.init(options);
1910
- }
1911
-
1912
- _createClass(Formatter, [{
1913
- key: "init",
1914
- value: function init(services) {
1915
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
1916
- interpolation: {}
1917
- };
1918
- var iOpts = options.interpolation;
1919
- this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
1920
- }
1921
- }, {
1922
- key: "add",
1923
- value: function add(name, fc) {
1924
- this.formats[name.toLowerCase().trim()] = fc;
1925
- }
1926
- }, {
1927
- key: "format",
1928
- value: function format(value, _format, lng, options) {
1929
- var _this = this;
1930
-
1931
- var formats = _format.split(this.formatSeparator);
1932
-
1933
- var result = formats.reduce(function (mem, f) {
1934
- var _parseFormatStr = parseFormatStr(f),
1935
- formatName = _parseFormatStr.formatName,
1936
- formatOptions = _parseFormatStr.formatOptions;
1937
-
1938
- if (_this.formats[formatName]) {
1939
- var formatted = mem;
1940
-
1941
- try {
1942
- var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
1943
- var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1944
- formatted = _this.formats[formatName](mem, l, _objectSpread$4(_objectSpread$4(_objectSpread$4({}, formatOptions), options), valOptions));
1945
- } catch (error) {
1946
- _this.logger.warn(error);
1947
- }
1948
-
1949
- return formatted;
1950
- } else {
1951
- _this.logger.warn("there was no format function for ".concat(formatName));
1952
- }
1953
-
1954
- return mem;
1955
- }, value);
1956
- return result;
1957
- }
1958
- }]);
1959
-
1960
- return Formatter;
1961
- }();
1962
-
1963
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1964
-
1965
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1966
-
1967
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1968
-
1969
- function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1970
-
1971
- function removePending(q, name) {
1972
- if (q.pending[name] !== undefined) {
1973
- delete q.pending[name];
1974
- q.pendingCount--;
1975
- }
1976
- }
1977
-
1978
- var Connector = function (_EventEmitter) {
1979
- _inherits(Connector, _EventEmitter);
1980
-
1981
- var _super = _createSuper$2(Connector);
1982
-
1983
- function Connector(backend, store, services) {
1984
- var _this;
1985
-
1986
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1987
-
1988
- _classCallCheck(this, Connector);
1989
-
1990
- _this = _super.call(this);
1991
-
1992
- if (isIE10) {
1993
- EventEmitter.call(_assertThisInitialized(_this));
1994
- }
1995
-
1996
- _this.backend = backend;
1997
- _this.store = store;
1998
- _this.services = services;
1999
- _this.languageUtils = services.languageUtils;
2000
- _this.options = options;
2001
- _this.logger = baseLogger.create('backendConnector');
2002
- _this.waitingReads = [];
2003
- _this.maxParallelReads = options.maxParallelReads || 10;
2004
- _this.readingCalls = 0;
2005
- _this.state = {};
2006
- _this.queue = [];
2007
-
2008
- if (_this.backend && _this.backend.init) {
2009
- _this.backend.init(services, options.backend, options);
2010
- }
2011
-
2012
- return _this;
2013
- }
2014
-
2015
- _createClass(Connector, [{
2016
- key: "queueLoad",
2017
- value: function queueLoad(languages, namespaces, options, callback) {
2018
- var _this2 = this;
2019
-
2020
- var toLoad = {};
2021
- var pending = {};
2022
- var toLoadLanguages = {};
2023
- var toLoadNamespaces = {};
2024
- languages.forEach(function (lng) {
2025
- var hasAllNamespaces = true;
2026
- namespaces.forEach(function (ns) {
2027
- var name = "".concat(lng, "|").concat(ns);
2028
-
2029
- if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
2030
- _this2.state[name] = 2;
2031
- } else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
2032
- if (pending[name] === undefined) pending[name] = true;
2033
- } else {
2034
- _this2.state[name] = 1;
2035
- hasAllNamespaces = false;
2036
- if (pending[name] === undefined) pending[name] = true;
2037
- if (toLoad[name] === undefined) toLoad[name] = true;
2038
- if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
2039
- }
2040
- });
2041
- if (!hasAllNamespaces) toLoadLanguages[lng] = true;
2042
- });
2043
-
2044
- if (Object.keys(toLoad).length || Object.keys(pending).length) {
2045
- this.queue.push({
2046
- pending: pending,
2047
- pendingCount: Object.keys(pending).length,
2048
- loaded: {},
2049
- errors: [],
2050
- callback: callback
2051
- });
2052
- }
2053
-
2054
- return {
2055
- toLoad: Object.keys(toLoad),
2056
- pending: Object.keys(pending),
2057
- toLoadLanguages: Object.keys(toLoadLanguages),
2058
- toLoadNamespaces: Object.keys(toLoadNamespaces)
2059
- };
2060
- }
2061
- }, {
2062
- key: "loaded",
2063
- value: function loaded(name, err, data) {
2064
- var s = name.split('|');
2065
- var lng = s[0];
2066
- var ns = s[1];
2067
- if (err) this.emit('failedLoading', lng, ns, err);
2068
-
2069
- if (data) {
2070
- this.store.addResourceBundle(lng, ns, data);
2071
- }
2072
-
2073
- this.state[name] = err ? -1 : 2;
2074
- var loaded = {};
2075
- this.queue.forEach(function (q) {
2076
- pushPath(q.loaded, [lng], ns);
2077
- removePending(q, name);
2078
- if (err) q.errors.push(err);
2079
-
2080
- if (q.pendingCount === 0 && !q.done) {
2081
- Object.keys(q.loaded).forEach(function (l) {
2082
- if (!loaded[l]) loaded[l] = {};
2083
- var loadedKeys = q.loaded[l];
2084
-
2085
- if (loadedKeys.length) {
2086
- loadedKeys.forEach(function (ns) {
2087
- if (loaded[l][ns] === undefined) loaded[l][ns] = true;
2088
- });
2089
- }
2090
- });
2091
- q.done = true;
2092
-
2093
- if (q.errors.length) {
2094
- q.callback(q.errors);
2095
- } else {
2096
- q.callback();
2097
- }
2098
- }
2099
- });
2100
- this.emit('loaded', loaded);
2101
- this.queue = this.queue.filter(function (q) {
2102
- return !q.done;
2103
- });
2104
- }
2105
- }, {
2106
- key: "read",
2107
- value: function read(lng, ns, fcName) {
2108
- var _this3 = this;
2109
-
2110
- var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2111
- var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 350;
2112
- var callback = arguments.length > 5 ? arguments[5] : undefined;
2113
- if (!lng.length) return callback(null, {});
2114
-
2115
- if (this.readingCalls >= this.maxParallelReads) {
2116
- this.waitingReads.push({
2117
- lng: lng,
2118
- ns: ns,
2119
- fcName: fcName,
2120
- tried: tried,
2121
- wait: wait,
2122
- callback: callback
2123
- });
2124
- return;
2125
- }
2126
-
2127
- this.readingCalls++;
2128
- return this.backend[fcName](lng, ns, function (err, data) {
2129
- if (err && data && tried < 5) {
2130
- setTimeout(function () {
2131
- _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
2132
- }, wait);
2133
- return;
2134
- }
2135
-
2136
- _this3.readingCalls--;
2137
-
2138
- if (_this3.waitingReads.length > 0) {
2139
- var next = _this3.waitingReads.shift();
2140
-
2141
- _this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
2142
- }
2143
-
2144
- callback(err, data);
2145
- });
2146
- }
2147
- }, {
2148
- key: "prepareLoading",
2149
- value: function prepareLoading(languages, namespaces) {
2150
- var _this4 = this;
2151
-
2152
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2153
- var callback = arguments.length > 3 ? arguments[3] : undefined;
2154
-
2155
- if (!this.backend) {
2156
- this.logger.warn('No backend was added via i18next.use. Will not load resources.');
2157
- return callback && callback();
2158
- }
2159
-
2160
- if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
2161
- if (typeof namespaces === 'string') namespaces = [namespaces];
2162
- var toLoad = this.queueLoad(languages, namespaces, options, callback);
2163
-
2164
- if (!toLoad.toLoad.length) {
2165
- if (!toLoad.pending.length) callback();
2166
- return null;
2167
- }
2168
-
2169
- toLoad.toLoad.forEach(function (name) {
2170
- _this4.loadOne(name);
2171
- });
2172
- }
2173
- }, {
2174
- key: "load",
2175
- value: function load(languages, namespaces, callback) {
2176
- this.prepareLoading(languages, namespaces, {}, callback);
2177
- }
2178
- }, {
2179
- key: "reload",
2180
- value: function reload(languages, namespaces, callback) {
2181
- this.prepareLoading(languages, namespaces, {
2182
- reload: true
2183
- }, callback);
2184
- }
2185
- }, {
2186
- key: "loadOne",
2187
- value: function loadOne(name) {
2188
- var _this5 = this;
2189
-
2190
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2191
- var s = name.split('|');
2192
- var lng = s[0];
2193
- var ns = s[1];
2194
- this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
2195
- if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
2196
- if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
2197
-
2198
- _this5.loaded(name, err, data);
2199
- });
2200
- }
2201
- }, {
2202
- key: "saveMissing",
2203
- value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
2204
- var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2205
-
2206
- if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
2207
- this.logger.warn("did not save key \"".concat(key, "\" as the namespace \"").concat(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!!!');
2208
- return;
2209
- }
2210
-
2211
- if (key === undefined || key === null || key === '') return;
2212
-
2213
- if (this.backend && this.backend.create) {
2214
- this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5(_objectSpread$5({}, options), {}, {
2215
- isUpdate: isUpdate
2216
- }));
2217
- }
2218
-
2219
- if (!languages || !languages[0]) return;
2220
- this.store.addResource(languages[0], namespace, key, fallbackValue);
2221
- }
2222
- }]);
2223
-
2224
- return Connector;
2225
- }(EventEmitter);
2226
-
2227
- function get() {
2228
- return {
2229
- debug: false,
2230
- initImmediate: true,
2231
- ns: ['translation'],
2232
- defaultNS: ['translation'],
2233
- fallbackLng: ['dev'],
2234
- fallbackNS: false,
2235
- supportedLngs: false,
2236
- nonExplicitSupportedLngs: false,
2237
- load: 'all',
2238
- preload: false,
2239
- simplifyPluralSuffix: true,
2240
- keySeparator: '.',
2241
- nsSeparator: ':',
2242
- pluralSeparator: '_',
2243
- contextSeparator: '_',
2244
- partialBundledLanguages: false,
2245
- saveMissing: false,
2246
- updateMissing: false,
2247
- saveMissingTo: 'fallback',
2248
- saveMissingPlurals: true,
2249
- missingKeyHandler: false,
2250
- missingInterpolationHandler: false,
2251
- postProcess: false,
2252
- postProcessPassResolved: false,
2253
- returnNull: true,
2254
- returnEmptyString: true,
2255
- returnObjects: false,
2256
- joinArrays: false,
2257
- returnedObjectHandler: false,
2258
- parseMissingKeyHandler: false,
2259
- appendNamespaceToMissingKey: false,
2260
- appendNamespaceToCIMode: false,
2261
- overloadTranslationOptionHandler: function handle(args) {
2262
- var ret = {};
2263
- if (_typeof(args[1]) === 'object') ret = args[1];
2264
- if (typeof args[1] === 'string') ret.defaultValue = args[1];
2265
- if (typeof args[2] === 'string') ret.tDescription = args[2];
2266
-
2267
- if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {
2268
- var options = args[3] || args[2];
2269
- Object.keys(options).forEach(function (key) {
2270
- ret[key] = options[key];
2271
- });
2272
- }
2273
-
2274
- return ret;
2275
- },
2276
- interpolation: {
2277
- escapeValue: true,
2278
- format: function format(value, _format, lng, options) {
2279
- return value;
2280
- },
2281
- prefix: '{{',
2282
- suffix: '}}',
2283
- formatSeparator: ',',
2284
- unescapePrefix: '-',
2285
- nestingPrefix: '$t(',
2286
- nestingSuffix: ')',
2287
- nestingOptionsSeparator: ',',
2288
- maxReplaces: 1000,
2289
- skipOnVariables: true
2290
- }
2291
- };
2292
- }
2293
- function transformOptions(options) {
2294
- if (typeof options.ns === 'string') options.ns = [options.ns];
2295
- if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
2296
- if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
2297
-
2298
- if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
2299
- options.supportedLngs = options.supportedLngs.concat(['cimode']);
2300
- }
2301
-
2302
- return options;
2303
- }
2304
-
2305
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2306
-
2307
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2308
-
2309
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2310
-
2311
- function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2312
-
2313
- function noop() {}
2314
-
2315
- function bindMemberFunctions(inst) {
2316
- var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
2317
- mems.forEach(function (mem) {
2318
- if (typeof inst[mem] === 'function') {
2319
- inst[mem] = inst[mem].bind(inst);
2320
- }
2321
- });
2322
- }
2323
-
2324
- var I18n = function (_EventEmitter) {
2325
- _inherits(I18n, _EventEmitter);
2326
-
2327
- var _super = _createSuper$3(I18n);
2328
-
2329
- function I18n() {
2330
- var _this;
2331
-
2332
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2333
- var callback = arguments.length > 1 ? arguments[1] : undefined;
2334
-
2335
- _classCallCheck(this, I18n);
2336
-
2337
- _this = _super.call(this);
2338
-
2339
- if (isIE10) {
2340
- EventEmitter.call(_assertThisInitialized(_this));
2341
- }
2342
-
2343
- _this.options = transformOptions(options);
2344
- _this.services = {};
2345
- _this.logger = baseLogger;
2346
- _this.modules = {
2347
- external: []
2348
- };
2349
- bindMemberFunctions(_assertThisInitialized(_this));
2350
-
2351
- if (callback && !_this.isInitialized && !options.isClone) {
2352
- if (!_this.options.initImmediate) {
2353
- _this.init(options, callback);
2354
-
2355
- return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
2356
- }
2357
-
2358
- setTimeout(function () {
2359
- _this.init(options, callback);
2360
- }, 0);
2361
- }
2362
-
2363
- return _this;
2364
- }
2365
-
2366
- _createClass(I18n, [{
2367
- key: "init",
2368
- value: function init() {
2369
- var _this2 = this;
2370
-
2371
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2372
- var callback = arguments.length > 1 ? arguments[1] : undefined;
2373
-
2374
- if (typeof options === 'function') {
2375
- callback = options;
2376
- options = {};
2377
- }
2378
-
2379
- if (!options.defaultNS && options.ns) {
2380
- if (typeof options.ns === 'string') {
2381
- options.defaultNS = options.ns;
2382
- } else if (options.ns.indexOf('translation') < 0) {
2383
- options.defaultNS = options.ns[0];
2384
- }
2385
- }
2386
-
2387
- var defOpts = get();
2388
- this.options = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, defOpts), this.options), transformOptions(options));
2389
-
2390
- if (this.options.compatibilityAPI !== 'v1') {
2391
- this.options.interpolation = _objectSpread$6(_objectSpread$6({}, defOpts.interpolation), this.options.interpolation);
2392
- }
2393
-
2394
- if (options.keySeparator !== undefined) {
2395
- this.options.userDefinedKeySeparator = options.keySeparator;
2396
- }
2397
-
2398
- if (options.nsSeparator !== undefined) {
2399
- this.options.userDefinedNsSeparator = options.nsSeparator;
2400
- }
2401
-
2402
- function createClassOnDemand(ClassOrObject) {
2403
- if (!ClassOrObject) return null;
2404
- if (typeof ClassOrObject === 'function') return new ClassOrObject();
2405
- return ClassOrObject;
2406
- }
2407
-
2408
- if (!this.options.isClone) {
2409
- if (this.modules.logger) {
2410
- baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
2411
- } else {
2412
- baseLogger.init(null, this.options);
2413
- }
2414
-
2415
- var formatter;
2416
-
2417
- if (this.modules.formatter) {
2418
- formatter = this.modules.formatter;
2419
- } else if (typeof Intl !== 'undefined') {
2420
- formatter = Formatter;
2421
- }
2422
-
2423
- var lu = new LanguageUtil(this.options);
2424
- this.store = new ResourceStore(this.options.resources, this.options);
2425
- var s = this.services;
2426
- s.logger = baseLogger;
2427
- s.resourceStore = this.store;
2428
- s.languageUtils = lu;
2429
- s.pluralResolver = new PluralResolver(lu, {
2430
- prepend: this.options.pluralSeparator,
2431
- compatibilityJSON: this.options.compatibilityJSON,
2432
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
2433
- });
2434
-
2435
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
2436
- s.formatter = createClassOnDemand(formatter);
2437
- s.formatter.init(s, this.options);
2438
- this.options.interpolation.format = s.formatter.format.bind(s.formatter);
2439
- }
2440
-
2441
- s.interpolator = new Interpolator(this.options);
2442
- s.utils = {
2443
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
2444
- };
2445
- s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
2446
- s.backendConnector.on('*', function (event) {
2447
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2448
- args[_key - 1] = arguments[_key];
2449
- }
2450
-
2451
- _this2.emit.apply(_this2, [event].concat(args));
2452
- });
2453
-
2454
- if (this.modules.languageDetector) {
2455
- s.languageDetector = createClassOnDemand(this.modules.languageDetector);
2456
- s.languageDetector.init(s, this.options.detection, this.options);
2457
- }
2458
-
2459
- if (this.modules.i18nFormat) {
2460
- s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2461
- if (s.i18nFormat.init) s.i18nFormat.init(this);
2462
- }
2463
-
2464
- this.translator = new Translator(this.services, this.options);
2465
- this.translator.on('*', function (event) {
2466
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2467
- args[_key2 - 1] = arguments[_key2];
2468
- }
2469
-
2470
- _this2.emit.apply(_this2, [event].concat(args));
2471
- });
2472
- this.modules.external.forEach(function (m) {
2473
- if (m.init) m.init(_this2);
2474
- });
2475
- }
2476
-
2477
- this.format = this.options.interpolation.format;
2478
- if (!callback) callback = noop;
2479
-
2480
- if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2481
- var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2482
- if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
2483
- }
2484
-
2485
- if (!this.services.languageDetector && !this.options.lng) {
2486
- this.logger.warn('init: no languageDetector is used and no lng is defined');
2487
- }
2488
-
2489
- var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
2490
- storeApi.forEach(function (fcName) {
2491
- _this2[fcName] = function () {
2492
- var _this2$store;
2493
-
2494
- return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
2495
- };
2496
- });
2497
- var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
2498
- storeApiChained.forEach(function (fcName) {
2499
- _this2[fcName] = function () {
2500
- var _this2$store2;
2501
-
2502
- (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
2503
-
2504
- return _this2;
2505
- };
2506
- });
2507
- var deferred = defer();
2508
-
2509
- var load = function load() {
2510
- var finish = function finish(err, t) {
2511
- if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
2512
- _this2.isInitialized = true;
2513
- if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
2514
-
2515
- _this2.emit('initialized', _this2.options);
2516
-
2517
- deferred.resolve(t);
2518
- callback(err, t);
2519
- };
2520
-
2521
- if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
2522
-
2523
- _this2.changeLanguage(_this2.options.lng, finish);
2524
- };
2525
-
2526
- if (this.options.resources || !this.options.initImmediate) {
2527
- load();
2528
- } else {
2529
- setTimeout(load, 0);
2530
- }
2531
-
2532
- return deferred;
2533
- }
2534
- }, {
2535
- key: "loadResources",
2536
- value: function loadResources(language) {
2537
- var _this3 = this;
2538
-
2539
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
2540
- var usedCallback = callback;
2541
- var usedLng = typeof language === 'string' ? language : this.language;
2542
- if (typeof language === 'function') usedCallback = language;
2543
-
2544
- if (!this.options.resources || this.options.partialBundledLanguages) {
2545
- if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
2546
- var toLoad = [];
2547
-
2548
- var append = function append(lng) {
2549
- if (!lng) return;
2550
-
2551
- var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
2552
-
2553
- lngs.forEach(function (l) {
2554
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
2555
- });
2556
- };
2557
-
2558
- if (!usedLng) {
2559
- var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2560
- fallbacks.forEach(function (l) {
2561
- return append(l);
2562
- });
2563
- } else {
2564
- append(usedLng);
2565
- }
2566
-
2567
- if (this.options.preload) {
2568
- this.options.preload.forEach(function (l) {
2569
- return append(l);
2570
- });
2571
- }
2572
-
2573
- this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
2574
- if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
2575
- usedCallback(e);
2576
- });
2577
- } else {
2578
- usedCallback(null);
2579
- }
2580
- }
2581
- }, {
2582
- key: "reloadResources",
2583
- value: function reloadResources(lngs, ns, callback) {
2584
- var deferred = defer();
2585
- if (!lngs) lngs = this.languages;
2586
- if (!ns) ns = this.options.ns;
2587
- if (!callback) callback = noop;
2588
- this.services.backendConnector.reload(lngs, ns, function (err) {
2589
- deferred.resolve();
2590
- callback(err);
2591
- });
2592
- return deferred;
2593
- }
2594
- }, {
2595
- key: "use",
2596
- value: function use(module) {
2597
- if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
2598
- if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
2599
-
2600
- if (module.type === 'backend') {
2601
- this.modules.backend = module;
2602
- }
2603
-
2604
- if (module.type === 'logger' || module.log && module.warn && module.error) {
2605
- this.modules.logger = module;
2606
- }
2607
-
2608
- if (module.type === 'languageDetector') {
2609
- this.modules.languageDetector = module;
2610
- }
2611
-
2612
- if (module.type === 'i18nFormat') {
2613
- this.modules.i18nFormat = module;
2614
- }
2615
-
2616
- if (module.type === 'postProcessor') {
2617
- postProcessor.addPostProcessor(module);
2618
- }
2619
-
2620
- if (module.type === 'formatter') {
2621
- this.modules.formatter = module;
2622
- }
2623
-
2624
- if (module.type === '3rdParty') {
2625
- this.modules.external.push(module);
2626
- }
2627
-
2628
- return this;
2629
- }
2630
- }, {
2631
- key: "setResolvedLanguage",
2632
- value: function setResolvedLanguage(l) {
2633
- if (!l || !this.languages) return;
2634
- if (['cimode', 'dev'].indexOf(l) > -1) return;
2635
-
2636
- for (var li = 0; li < this.languages.length; li++) {
2637
- var lngInLngs = this.languages[li];
2638
- if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
2639
-
2640
- if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
2641
- this.resolvedLanguage = lngInLngs;
2642
- break;
2643
- }
2644
- }
2645
- }
2646
- }, {
2647
- key: "changeLanguage",
2648
- value: function changeLanguage(lng, callback) {
2649
- var _this4 = this;
2650
-
2651
- this.isLanguageChangingTo = lng;
2652
- var deferred = defer();
2653
- this.emit('languageChanging', lng);
2654
-
2655
- var setLngProps = function setLngProps(l) {
2656
- _this4.language = l;
2657
- _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
2658
- _this4.resolvedLanguage = undefined;
2659
-
2660
- _this4.setResolvedLanguage(l);
2661
- };
2662
-
2663
- var done = function done(err, l) {
2664
- if (l) {
2665
- setLngProps(l);
2666
-
2667
- _this4.translator.changeLanguage(l);
2668
-
2669
- _this4.isLanguageChangingTo = undefined;
2670
-
2671
- _this4.emit('languageChanged', l);
2672
-
2673
- _this4.logger.log('languageChanged', l);
2674
- } else {
2675
- _this4.isLanguageChangingTo = undefined;
2676
- }
2677
-
2678
- deferred.resolve(function () {
2679
- return _this4.t.apply(_this4, arguments);
2680
- });
2681
- if (callback) callback(err, function () {
2682
- return _this4.t.apply(_this4, arguments);
2683
- });
2684
- };
2685
-
2686
- var setLng = function setLng(lngs) {
2687
- if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
2688
- var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
2689
-
2690
- if (l) {
2691
- if (!_this4.language) {
2692
- setLngProps(l);
2693
- }
2694
-
2695
- if (!_this4.translator.language) _this4.translator.changeLanguage(l);
2696
- if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);
2697
- }
2698
-
2699
- _this4.loadResources(l, function (err) {
2700
- done(err, l);
2701
- });
2702
- };
2703
-
2704
- if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
2705
- setLng(this.services.languageDetector.detect());
2706
- } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
2707
- this.services.languageDetector.detect(setLng);
2708
- } else {
2709
- setLng(lng);
2710
- }
2711
-
2712
- return deferred;
2713
- }
2714
- }, {
2715
- key: "getFixedT",
2716
- value: function getFixedT(lng, ns, keyPrefix) {
2717
- var _this5 = this;
2718
-
2719
- var fixedT = function fixedT(key, opts) {
2720
- var options;
2721
-
2722
- if (_typeof(opts) !== 'object') {
2723
- for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2724
- rest[_key3 - 2] = arguments[_key3];
2725
- }
2726
-
2727
- options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
2728
- } else {
2729
- options = _objectSpread$6({}, opts);
2730
- }
2731
-
2732
- options.lng = options.lng || fixedT.lng;
2733
- options.lngs = options.lngs || fixedT.lngs;
2734
- options.ns = options.ns || fixedT.ns;
2735
- var keySeparator = _this5.options.keySeparator || '.';
2736
- var resultKey = keyPrefix ? "".concat(keyPrefix).concat(keySeparator).concat(key) : key;
2737
- return _this5.t(resultKey, options);
2738
- };
2739
-
2740
- if (typeof lng === 'string') {
2741
- fixedT.lng = lng;
2742
- } else {
2743
- fixedT.lngs = lng;
2744
- }
2745
-
2746
- fixedT.ns = ns;
2747
- fixedT.keyPrefix = keyPrefix;
2748
- return fixedT;
2749
- }
2750
- }, {
2751
- key: "t",
2752
- value: function t() {
2753
- var _this$translator;
2754
-
2755
- return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
2756
- }
2757
- }, {
2758
- key: "exists",
2759
- value: function exists() {
2760
- var _this$translator2;
2761
-
2762
- return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
2763
- }
2764
- }, {
2765
- key: "setDefaultNamespace",
2766
- value: function setDefaultNamespace(ns) {
2767
- this.options.defaultNS = ns;
2768
- }
2769
- }, {
2770
- key: "hasLoadedNamespace",
2771
- value: function hasLoadedNamespace(ns) {
2772
- var _this6 = this;
2773
-
2774
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2775
-
2776
- if (!this.isInitialized) {
2777
- this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2778
- return false;
2779
- }
2780
-
2781
- if (!this.languages || !this.languages.length) {
2782
- this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2783
- return false;
2784
- }
2785
-
2786
- var lng = this.resolvedLanguage || this.languages[0];
2787
- var fallbackLng = this.options ? this.options.fallbackLng : false;
2788
- var lastLng = this.languages[this.languages.length - 1];
2789
- if (lng.toLowerCase() === 'cimode') return true;
2790
-
2791
- var loadNotPending = function loadNotPending(l, n) {
2792
- var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)];
2793
-
2794
- return loadState === -1 || loadState === 2;
2795
- };
2796
-
2797
- if (options.precheck) {
2798
- var preResult = options.precheck(this, loadNotPending);
2799
- if (preResult !== undefined) return preResult;
2800
- }
2801
-
2802
- if (this.hasResourceBundle(lng, ns)) return true;
2803
- if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2804
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
2805
- return false;
2806
- }
2807
- }, {
2808
- key: "loadNamespaces",
2809
- value: function loadNamespaces(ns, callback) {
2810
- var _this7 = this;
2811
-
2812
- var deferred = defer();
2813
-
2814
- if (!this.options.ns) {
2815
- callback && callback();
2816
- return Promise.resolve();
2817
- }
2818
-
2819
- if (typeof ns === 'string') ns = [ns];
2820
- ns.forEach(function (n) {
2821
- if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
2822
- });
2823
- this.loadResources(function (err) {
2824
- deferred.resolve();
2825
- if (callback) callback(err);
2826
- });
2827
- return deferred;
2828
- }
2829
- }, {
2830
- key: "loadLanguages",
2831
- value: function loadLanguages(lngs, callback) {
2832
- var deferred = defer();
2833
- if (typeof lngs === 'string') lngs = [lngs];
2834
- var preloaded = this.options.preload || [];
2835
- var newLngs = lngs.filter(function (lng) {
2836
- return preloaded.indexOf(lng) < 0;
2837
- });
2838
-
2839
- if (!newLngs.length) {
2840
- if (callback) callback();
2841
- return Promise.resolve();
2842
- }
2843
-
2844
- this.options.preload = preloaded.concat(newLngs);
2845
- this.loadResources(function (err) {
2846
- deferred.resolve();
2847
- if (callback) callback(err);
2848
- });
2849
- return deferred;
2850
- }
2851
- }, {
2852
- key: "dir",
2853
- value: function dir(lng) {
2854
- if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
2855
- if (!lng) return 'rtl';
2856
- var 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'];
2857
- return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2858
- }
2859
- }, {
2860
- key: "cloneInstance",
2861
- value: function cloneInstance() {
2862
- var _this8 = this;
2863
-
2864
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2865
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
2866
-
2867
- var mergedOptions = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, this.options), options), {
2868
- isClone: true
2869
- });
2870
-
2871
- var clone = new I18n(mergedOptions);
2872
- var membersToCopy = ['store', 'services', 'language'];
2873
- membersToCopy.forEach(function (m) {
2874
- clone[m] = _this8[m];
2875
- });
2876
- clone.services = _objectSpread$6({}, this.services);
2877
- clone.services.utils = {
2878
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2879
- };
2880
- clone.translator = new Translator(clone.services, clone.options);
2881
- clone.translator.on('*', function (event) {
2882
- for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
2883
- args[_key4 - 1] = arguments[_key4];
2884
- }
2885
-
2886
- clone.emit.apply(clone, [event].concat(args));
2887
- });
2888
- clone.init(mergedOptions, callback);
2889
- clone.translator.options = clone.options;
2890
- clone.translator.backendConnector.services.utils = {
2891
- hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2892
- };
2893
- return clone;
2894
- }
2895
- }, {
2896
- key: "toJSON",
2897
- value: function toJSON() {
2898
- return {
2899
- options: this.options,
2900
- store: this.store,
2901
- language: this.language,
2902
- languages: this.languages,
2903
- resolvedLanguage: this.resolvedLanguage
2904
- };
2905
- }
2906
- }]);
2907
-
2908
- return I18n;
2909
- }(EventEmitter);
2910
-
2911
- _defineProperty(I18n, "createInstance", function () {
2912
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2913
- var callback = arguments.length > 1 ? arguments[1] : undefined;
2914
- return new I18n(options, callback);
2915
- });
2916
-
2917
- var instance = I18n.createInstance();
2918
- instance.createInstance = I18n.createInstance;
2919
-
2920
- return instance;
2921
-
2922
- })));