@common.js/use-intl 4.13.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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/core.d.ts +2 -0
  4. package/dist/esm/development/core.js +174 -0
  5. package/dist/esm/development/format-message/format-only.js +314 -0
  6. package/dist/esm/development/format-message/index.js +238 -0
  7. package/dist/esm/development/formatters-r4aAmsMP.js +266 -0
  8. package/dist/esm/development/index.js +64 -0
  9. package/dist/esm/development/initializeConfig-CUsOI8u2.js +651 -0
  10. package/dist/esm/development/react.js +390 -0
  11. package/dist/esm/production/core.js +149 -0
  12. package/dist/esm/production/format-message/format-only.js +299 -0
  13. package/dist/esm/production/format-message/index.js +188 -0
  14. package/dist/esm/production/formatters-CJcico0N.js +244 -0
  15. package/dist/esm/production/index.js +64 -0
  16. package/dist/esm/production/initializeConfig-CHgjheii.js +399 -0
  17. package/dist/esm/production/react.js +270 -0
  18. package/dist/types/core/AbstractIntlMessages.d.ts +10 -0
  19. package/dist/types/core/AppConfig.d.ts +29 -0
  20. package/dist/types/core/DateTimeFormatOptions.d.ts +73 -0
  21. package/dist/types/core/Formats.d.ts +9 -0
  22. package/dist/types/core/ICUArgs.d.ts +3 -0
  23. package/dist/types/core/ICUTags.d.ts +2 -0
  24. package/dist/types/core/IntlConfig.d.ts +54 -0
  25. package/dist/types/core/IntlError.d.ts +6 -0
  26. package/dist/types/core/IntlErrorCode.d.ts +10 -0
  27. package/dist/types/core/MessageKeys.d.ts +10 -0
  28. package/dist/types/core/NumberFormatOptions.d.ts +3 -0
  29. package/dist/types/core/RelativeTimeFormatOptions.d.ts +7 -0
  30. package/dist/types/core/TimeZone.d.ts +2 -0
  31. package/dist/types/core/TranslationValues.d.ts +6 -0
  32. package/dist/types/core/convertFormatsToIntlMessageFormat.d.ts +11 -0
  33. package/dist/types/core/createBaseTranslator.d.ts +21 -0
  34. package/dist/types/core/createFormatter.d.ts +47 -0
  35. package/dist/types/core/createTranslator.d.ts +59 -0
  36. package/dist/types/core/createTranslatorImpl.d.ts +17 -0
  37. package/dist/types/core/defaults.d.ts +11 -0
  38. package/dist/types/core/format-message/compile-format.d.ts +12 -0
  39. package/dist/types/core/format-message/format-only.d.ts +13 -0
  40. package/dist/types/core/format-message/index.d.ts +5 -0
  41. package/dist/types/core/format-message/types.d.ts +15 -0
  42. package/dist/types/core/formatters.d.ts +25 -0
  43. package/dist/types/core/hasLocale.d.ts +7 -0
  44. package/dist/types/core/index.d.ts +22 -0
  45. package/dist/types/core/initializeConfig.d.ts +14 -0
  46. package/dist/types/core/joinPath.d.ts +1 -0
  47. package/dist/types/core/resolveNamespace.d.ts +5 -0
  48. package/dist/types/core/types.d.ts +6 -0
  49. package/dist/types/core/validateMessages.d.ts +3 -0
  50. package/dist/types/core.d.ts +1 -0
  51. package/dist/types/index.d.ts +2 -0
  52. package/dist/types/react/IntlContext.d.ts +8 -0
  53. package/dist/types/react/IntlProvider.d.ts +7 -0
  54. package/dist/types/react/index.d.ts +9 -0
  55. package/dist/types/react/useExtracted.d.ts +42 -0
  56. package/dist/types/react/useFormatter.d.ts +2 -0
  57. package/dist/types/react/useIntlContext.d.ts +2 -0
  58. package/dist/types/react/useLocale.d.ts +2 -0
  59. package/dist/types/react/useMessages.d.ts +2 -0
  60. package/dist/types/react/useNow.d.ts +8 -0
  61. package/dist/types/react/useTimeZone.d.ts +1 -0
  62. package/dist/types/react/useTranslations.d.ts +12 -0
  63. package/dist/types/react/useTranslationsImpl.d.ts +9 -0
  64. package/dist/types/react.d.ts +1 -0
  65. package/format-message/format-only.d.ts +2 -0
  66. package/format-message.d.ts +2 -0
  67. package/package.json +45 -0
  68. package/react.d.ts +2 -0
@@ -0,0 +1,390 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ IntlProvider: function() {
13
+ return IntlProvider;
14
+ },
15
+ "_useExtracted": function() {
16
+ return useExtracted;
17
+ },
18
+ useFormatter: function() {
19
+ return useFormatter;
20
+ },
21
+ useLocale: function() {
22
+ return useLocale;
23
+ },
24
+ useMessages: function() {
25
+ return useMessages;
26
+ },
27
+ useNow: function() {
28
+ return useNow;
29
+ },
30
+ useTimeZone: function() {
31
+ return useTimeZone;
32
+ },
33
+ useTranslations: function() {
34
+ return useTranslations;
35
+ }
36
+ });
37
+ var _react = require("react");
38
+ var _formattersR4AAmsMPJs = require("./formatters-r4aAmsMP.js");
39
+ var _initializeConfigCUsOI8U2Js = require("./initializeConfig-CUsOI8u2.js");
40
+ var _jsxRuntime = require("react/jsx-runtime");
41
+ function _arrayLikeToArray(arr, len) {
42
+ if (len == null || len > arr.length) len = arr.length;
43
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
44
+ return arr2;
45
+ }
46
+ function _arrayWithHoles(arr) {
47
+ if (Array.isArray(arr)) return arr;
48
+ }
49
+ function _arrayWithoutHoles(arr) {
50
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
51
+ }
52
+ function _defineProperty(obj, key, value) {
53
+ if (key in obj) {
54
+ Object.defineProperty(obj, key, {
55
+ value: value,
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true
59
+ });
60
+ } else {
61
+ obj[key] = value;
62
+ }
63
+ return obj;
64
+ }
65
+ function _iterableToArray(iter) {
66
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
67
+ }
68
+ function _iterableToArrayLimit(arr, i) {
69
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
70
+ if (_i == null) return;
71
+ var _arr = [];
72
+ var _n = true;
73
+ var _d = false;
74
+ var _s, _e;
75
+ try {
76
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
77
+ _arr.push(_s.value);
78
+ if (i && _arr.length === i) break;
79
+ }
80
+ } catch (err) {
81
+ _d = true;
82
+ _e = err;
83
+ } finally{
84
+ try {
85
+ if (!_n && _i["return"] != null) _i["return"]();
86
+ } finally{
87
+ if (_d) throw _e;
88
+ }
89
+ }
90
+ return _arr;
91
+ }
92
+ function _nonIterableRest() {
93
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
94
+ }
95
+ function _nonIterableSpread() {
96
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
97
+ }
98
+ function _objectSpread(target) {
99
+ for(var i = 1; i < arguments.length; i++){
100
+ var source = arguments[i] != null ? arguments[i] : {};
101
+ var ownKeys = Object.keys(source);
102
+ if (typeof Object.getOwnPropertySymbols === "function") {
103
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
104
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
105
+ }));
106
+ }
107
+ ownKeys.forEach(function(key) {
108
+ _defineProperty(target, key, source[key]);
109
+ });
110
+ }
111
+ return target;
112
+ }
113
+ function ownKeys(object, enumerableOnly) {
114
+ var keys = Object.keys(object);
115
+ if (Object.getOwnPropertySymbols) {
116
+ var symbols = Object.getOwnPropertySymbols(object);
117
+ if (enumerableOnly) {
118
+ symbols = symbols.filter(function(sym) {
119
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
120
+ });
121
+ }
122
+ keys.push.apply(keys, symbols);
123
+ }
124
+ return keys;
125
+ }
126
+ function _objectSpreadProps(target, source) {
127
+ source = source != null ? source : {};
128
+ if (Object.getOwnPropertyDescriptors) {
129
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
130
+ } else {
131
+ ownKeys(Object(source)).forEach(function(key) {
132
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
133
+ });
134
+ }
135
+ return target;
136
+ }
137
+ function _slicedToArray(arr, i) {
138
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
139
+ }
140
+ function _toConsumableArray(arr) {
141
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
142
+ }
143
+ function _unsupportedIterableToArray(o, minLen) {
144
+ if (!o) return;
145
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
146
+ var n = Object.prototype.toString.call(o).slice(8, -1);
147
+ if (n === "Object" && o.constructor) n = o.constructor.name;
148
+ if (n === "Map" || n === "Set") return Array.from(n);
149
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
150
+ }
151
+ var IntlContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
152
+ function IntlProvider(param) {
153
+ var children = param.children, formats = param.formats, getMessageFallback = param.getMessageFallback, locale = param.locale, messages = param.messages, now = param.now, onError = param.onError, timeZone = param.timeZone;
154
+ var prevContext = (0, _react.useContext)(IntlContext);
155
+ // The formatter cache is released when the locale changes. For
156
+ // long-running apps with a persistent `IntlProvider` at the root,
157
+ // this can reduce the memory footprint (e.g. in React Native).
158
+ var cache = (0, _react.useMemo)(function() {
159
+ return (prevContext === null || prevContext === void 0 ? void 0 : prevContext.cache) || (0, _formattersR4AAmsMPJs.b)();
160
+ }, [
161
+ locale,
162
+ prevContext === null || prevContext === void 0 ? void 0 : prevContext.cache
163
+ ]);
164
+ var formatters = (0, _react.useMemo)(function() {
165
+ return (prevContext === null || prevContext === void 0 ? void 0 : prevContext.formatters) || (0, _formattersR4AAmsMPJs.c)(cache);
166
+ }, [
167
+ cache,
168
+ prevContext === null || prevContext === void 0 ? void 0 : prevContext.formatters
169
+ ]);
170
+ // Memoizing this value helps to avoid triggering a re-render of all
171
+ // context consumers in case the configuration didn't change. However,
172
+ // if some of the non-primitive values change, a re-render will still
173
+ // be triggered. Note that there's no need to put `memo` on `IntlProvider`
174
+ // itself, because the `children` typically change on every render.
175
+ // There's some burden on the consumer side if it's important to reduce
176
+ // re-renders, put that's how React works.
177
+ // See: https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/#context-updates-and-render-optimizations
178
+ var value = (0, _react.useMemo)(function() {
179
+ return _objectSpreadProps(_objectSpread({}, (0, _initializeConfigCUsOI8U2Js.i)({
180
+ locale: locale,
181
+ // (required by provider)
182
+ formats: formats === undefined ? prevContext === null || prevContext === void 0 ? void 0 : prevContext.formats : formats,
183
+ getMessageFallback: getMessageFallback || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.getMessageFallback),
184
+ messages: messages === undefined ? prevContext === null || prevContext === void 0 ? void 0 : prevContext.messages : messages,
185
+ now: now || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.now),
186
+ onError: onError || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.onError),
187
+ timeZone: timeZone || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.timeZone)
188
+ })), {
189
+ formatters: formatters,
190
+ cache: cache
191
+ });
192
+ }, [
193
+ cache,
194
+ formats,
195
+ formatters,
196
+ getMessageFallback,
197
+ locale,
198
+ messages,
199
+ now,
200
+ onError,
201
+ prevContext,
202
+ timeZone
203
+ ]);
204
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)(IntlContext.Provider, {
205
+ value: value,
206
+ children: children
207
+ });
208
+ }
209
+ function useIntlContext() {
210
+ var context = (0, _react.useContext)(IntlContext);
211
+ if (!context) {
212
+ throw new Error("No intl context found. Have you configured the provider? See https://next-intl.dev/docs/usage/configuration#server-client-components");
213
+ }
214
+ return context;
215
+ }
216
+ var hasWarnedForMissingTimezone = false;
217
+ var isServer = typeof window === "undefined";
218
+ function useTranslationsImpl(allMessagesPrefixed, namespacePrefixed, namespacePrefix) {
219
+ var ref = useIntlContext(), cache = ref.cache, globalFormats = ref.formats, formatters = ref.formatters, getMessageFallback = ref.getMessageFallback, locale = ref.locale, onError = ref.onError, timeZone = ref.timeZone;
220
+ // The `namespacePrefix` is part of the type system.
221
+ // See the comment in the hook invocation.
222
+ var allMessages = allMessagesPrefixed[namespacePrefix];
223
+ var namespace = (0, _initializeConfigCUsOI8U2Js.r)(namespacePrefixed, namespacePrefix);
224
+ if (!timeZone && !hasWarnedForMissingTimezone && isServer) {
225
+ // eslint-disable-next-line react-compiler/react-compiler
226
+ hasWarnedForMissingTimezone = true;
227
+ onError(new _formattersR4AAmsMPJs.I(_formattersR4AAmsMPJs.a.ENVIRONMENT_FALLBACK, "There is no `timeZone` configured, this can lead to markup mismatches caused by environment differences. Consider adding a global default: https://next-intl.dev/docs/configuration#time-zone"));
228
+ }
229
+ var translate = (0, _react.useMemo)(function() {
230
+ return (0, _initializeConfigCUsOI8U2Js.a)({
231
+ cache: cache,
232
+ formatters: formatters,
233
+ getMessageFallback: getMessageFallback,
234
+ messages: allMessages,
235
+ namespace: namespace,
236
+ onError: onError,
237
+ formats: globalFormats,
238
+ locale: locale,
239
+ timeZone: timeZone
240
+ });
241
+ }, [
242
+ cache,
243
+ formatters,
244
+ getMessageFallback,
245
+ allMessages,
246
+ namespace,
247
+ onError,
248
+ globalFormats,
249
+ locale,
250
+ timeZone
251
+ ]);
252
+ return translate;
253
+ }
254
+ /**
255
+ * Translates messages from the given namespace by using the ICU syntax.
256
+ * See https://formatjs.io/docs/core-concepts/icu-syntax.
257
+ *
258
+ * If no namespace is provided, all available messages are returned.
259
+ * The namespace can also indicate nesting by using a dot
260
+ * (e.g. `namespace.Component`).
261
+ */ function useTranslations(namespace) {
262
+ var context = useIntlContext();
263
+ var messages = context.messages;
264
+ // We have to wrap the actual hook so the type inference for the optional
265
+ // namespace works correctly. See https://stackoverflow.com/a/71529575/343045
266
+ // The prefix ("!") is arbitrary.
267
+ // @ts-expect-error Use the explicit annotation instead
268
+ return useTranslationsImpl({
269
+ "!": messages
270
+ }, // @ts-expect-error
271
+ namespace ? "!.".concat(namespace) : "!", "!");
272
+ }
273
+ function useLocale() {
274
+ return useIntlContext().locale;
275
+ }
276
+ function getNow() {
277
+ return new Date();
278
+ }
279
+ /**
280
+ * @see https://next-intl.dev/docs/usage/dates-times#relative-times-usenow
281
+ */ function useNow(options) {
282
+ var updateInterval = options === null || options === void 0 ? void 0 : options.updateInterval;
283
+ var ref = useIntlContext(), globalNow = ref.now;
284
+ var ref1 = _slicedToArray((0, _react.useState)(globalNow || getNow()), 2), now = ref1[0], setNow = ref1[1];
285
+ (0, _react.useEffect)(function() {
286
+ if (!updateInterval) return;
287
+ var intervalId = setInterval(function() {
288
+ setNow(getNow());
289
+ }, updateInterval);
290
+ return function() {
291
+ clearInterval(intervalId);
292
+ };
293
+ }, [
294
+ globalNow,
295
+ updateInterval
296
+ ]);
297
+ return updateInterval == null && globalNow ? globalNow : now;
298
+ }
299
+ function useTimeZone() {
300
+ return useIntlContext().timeZone;
301
+ }
302
+ function useMessages() {
303
+ var context = useIntlContext();
304
+ if (!context.messages) {
305
+ throw new Error("No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages");
306
+ }
307
+ return context.messages;
308
+ }
309
+ function useFormatter() {
310
+ var ref = useIntlContext(), formats = ref.formats, formatters = ref.formatters, locale = ref.locale, globalNow = ref.now, onError = ref.onError, timeZone = ref.timeZone;
311
+ return (0, _react.useMemo)(function() {
312
+ return (0, _initializeConfigCUsOI8U2Js.c)({
313
+ formats: formats,
314
+ locale: locale,
315
+ now: globalNow,
316
+ onError: onError,
317
+ timeZone: timeZone,
318
+ _formatters: formatters
319
+ });
320
+ }, [
321
+ formats,
322
+ formatters,
323
+ globalNow,
324
+ locale,
325
+ onError,
326
+ timeZone
327
+ ]);
328
+ }
329
+ function getArgs(messageOrParams) {
330
+ for(var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
331
+ rest[_key - 1] = arguments[_key];
332
+ }
333
+ var message, values, formats;
334
+ if (typeof messageOrParams === "string") {
335
+ message = messageOrParams;
336
+ values = rest[0];
337
+ formats = rest[1];
338
+ } else {
339
+ message = messageOrParams.message;
340
+ values = messageOrParams.values;
341
+ formats = messageOrParams.formats;
342
+ // `description` is not used at runtime
343
+ }
344
+ // @ts-expect-error -- Secret fallback parameter
345
+ return [
346
+ undefined,
347
+ // Always use fallback if not compiled
348
+ values,
349
+ formats,
350
+ message
351
+ ];
352
+ }
353
+ // Note: This API is usually compiled into `useTranslations`,
354
+ // but there is some fallback handling which allows this hook
355
+ // to still work when not being compiled.
356
+ //
357
+ // This is relevant for:
358
+ // - Isolated environments like tests, Storybook, etc.
359
+ // - Fallbacks in case an extracted message is not yet available
360
+ function useExtracted(namespace) {
361
+ var // @ts-expect-error -- Passing `undefined` as an ID is secretly allowed here
362
+ _t, // @ts-expect-error -- Passing `undefined` as an ID is secretly allowed here
363
+ _t1;
364
+ var translateFn = function translateFn() {
365
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
366
+ params[_key] = arguments[_key];
367
+ }
368
+ // @ts-expect-error -- Passing `undefined` as an ID is secretly allowed here
369
+ return t.apply(void 0, _toConsumableArray(getArgs.apply(void 0, _toConsumableArray(params))));
370
+ };
371
+ var t = useTranslations(namespace);
372
+ translateFn.rich = function() {
373
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
374
+ params[_key] = arguments[_key];
375
+ }
376
+ return (_t = t).rich.apply(_t, _toConsumableArray(getArgs.apply(void 0, _toConsumableArray(params))));
377
+ };
378
+ translateFn.markup = function() {
379
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
380
+ params[_key] = arguments[_key];
381
+ }
382
+ return (_t1 = t).markup.apply(_t1, _toConsumableArray(getArgs.apply(void 0, _toConsumableArray(params))));
383
+ };
384
+ translateFn.has = function translateHasFn(// eslint-disable-next-line @typescript-eslint/no-unused-vars
385
+ message) {
386
+ // Not really something better we can do here
387
+ return true;
388
+ };
389
+ return translateFn;
390
+ }
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ IntlError: function() {
13
+ return _formattersCJcico0NJs.I;
14
+ },
15
+ IntlErrorCode: function() {
16
+ return _formattersCJcico0NJs.a;
17
+ },
18
+ createFormatter: function() {
19
+ return _initializeConfigCHgjheiiJs.c;
20
+ },
21
+ initializeConfig: function() {
22
+ return _initializeConfigCHgjheiiJs.i;
23
+ },
24
+ "_createCache": function() {
25
+ return _formattersCJcico0NJs.b;
26
+ },
27
+ "_createIntlFormatters": function() {
28
+ return _formattersCJcico0NJs.c;
29
+ },
30
+ createTranslator: function() {
31
+ return n;
32
+ },
33
+ hasLocale: function() {
34
+ return f;
35
+ }
36
+ });
37
+ var _formattersCJcico0NJs = require("./formatters-CJcico0N.js");
38
+ var _initializeConfigCHgjheiiJs = require("./initializeConfig-CHgjheii.js");
39
+ function _defineProperty(obj, key, value) {
40
+ if (key in obj) {
41
+ Object.defineProperty(obj, key, {
42
+ value: value,
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true
46
+ });
47
+ } else {
48
+ obj[key] = value;
49
+ }
50
+ return obj;
51
+ }
52
+ function _objectSpread(target) {
53
+ for(var i = 1; i < arguments.length; i++){
54
+ var source = arguments[i] != null ? arguments[i] : {};
55
+ var ownKeys = Object.keys(source);
56
+ if (typeof Object.getOwnPropertySymbols === "function") {
57
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
58
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
59
+ }));
60
+ }
61
+ ownKeys.forEach(function(key) {
62
+ _defineProperty(target, key, source[key]);
63
+ });
64
+ }
65
+ return target;
66
+ }
67
+ function ownKeys(object, enumerableOnly) {
68
+ var keys = Object.keys(object);
69
+ if (Object.getOwnPropertySymbols) {
70
+ var symbols = Object.getOwnPropertySymbols(object);
71
+ if (enumerableOnly) {
72
+ symbols = symbols.filter(function(sym) {
73
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
74
+ });
75
+ }
76
+ keys.push.apply(keys, symbols);
77
+ }
78
+ return keys;
79
+ }
80
+ function _objectSpreadProps(target, source) {
81
+ source = source != null ? source : {};
82
+ if (Object.getOwnPropertyDescriptors) {
83
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
84
+ } else {
85
+ ownKeys(Object(source)).forEach(function(key) {
86
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
87
+ });
88
+ }
89
+ return target;
90
+ }
91
+ function _objectWithoutProperties(source, excluded) {
92
+ if (source == null) return {};
93
+ var target = _objectWithoutPropertiesLoose(source, excluded);
94
+ var key, i;
95
+ if (Object.getOwnPropertySymbols) {
96
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
97
+ for(i = 0; i < sourceSymbolKeys.length; i++){
98
+ key = sourceSymbolKeys[i];
99
+ if (excluded.indexOf(key) >= 0) continue;
100
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
101
+ target[key] = source[key];
102
+ }
103
+ }
104
+ return target;
105
+ }
106
+ function _objectWithoutPropertiesLoose(source, excluded) {
107
+ if (source == null) return {};
108
+ var target = {};
109
+ var sourceKeys = Object.keys(source);
110
+ var key, i;
111
+ for(i = 0; i < sourceKeys.length; i++){
112
+ key = sourceKeys[i];
113
+ if (excluded.indexOf(key) >= 0) continue;
114
+ target[key] = source[key];
115
+ }
116
+ return target;
117
+ }
118
+ function n(_param) {
119
+ var tmp = _param._cache, a = tmp === void 0 ? (0, _formattersCJcico0NJs.b)() : tmp, tmp1 = _param._formatters, i = tmp1 === void 0 ? (0, _formattersCJcico0NJs.c)(a) : tmp1, tmp2 = _param.getMessageFallback, n = tmp2 === void 0 ? _initializeConfigCHgjheiiJs.d : tmp2, c = _param.messages, f = _param.namespace, tmp3 = _param.onError, g = tmp3 === void 0 ? _initializeConfigCHgjheiiJs.b : tmp3, l = _objectWithoutProperties(_param, [
120
+ "_cache",
121
+ "_formatters",
122
+ "getMessageFallback",
123
+ "messages",
124
+ "namespace",
125
+ "onError"
126
+ ]);
127
+ return function(_param, o) {
128
+ var _$e = _param.messages, a = _param.namespace, _$r = _objectWithoutProperties(_param, [
129
+ "messages",
130
+ "namespace"
131
+ ]);
132
+ return _$e = _$e[o], a = (0, _initializeConfigCHgjheiiJs.r)(a, o), (0, _initializeConfigCHgjheiiJs.a)(_objectSpreadProps(_objectSpread({}, _$r), {
133
+ messages: _$e,
134
+ namespace: a
135
+ }));
136
+ }(_objectSpreadProps(_objectSpread({}, l), {
137
+ onError: g,
138
+ cache: a,
139
+ formatters: i,
140
+ getMessageFallback: n,
141
+ messages: {
142
+ "!": c
143
+ },
144
+ namespace: f ? "!.".concat(f) : "!"
145
+ }), "!");
146
+ }
147
+ function f(e, a) {
148
+ return e.includes(a);
149
+ }