@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jan Amann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @common.js/use-intl
2
+
3
+ The [use-intl](https://www.npmjs.com/package/use-intl) package exported as CommonJS modules.
4
+
5
+ Exported from [use-intl@4.13.1](https://www.npmjs.com/package/use-intl/v/4.13.1) using https://github.com/etienne-martin/common.js.
package/core.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Needed for projects with `moduleResolution: 'node'`
2
+ export * from './dist/types/core.d.ts';
@@ -0,0 +1,174 @@
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 _formattersR4AAmsMPJs.I;
14
+ },
15
+ IntlErrorCode: function() {
16
+ return _formattersR4AAmsMPJs.a;
17
+ },
18
+ createFormatter: function() {
19
+ return _initializeConfigCUsOI8U2Js.c;
20
+ },
21
+ initializeConfig: function() {
22
+ return _initializeConfigCUsOI8U2Js.i;
23
+ },
24
+ "_createCache": function() {
25
+ return _formattersR4AAmsMPJs.b;
26
+ },
27
+ "_createIntlFormatters": function() {
28
+ return _formattersR4AAmsMPJs.c;
29
+ },
30
+ createTranslator: function() {
31
+ return createTranslator;
32
+ },
33
+ hasLocale: function() {
34
+ return hasLocale;
35
+ }
36
+ });
37
+ var _formattersR4AAmsMPJs = require("./formatters-r4aAmsMP.js");
38
+ var _initializeConfigCUsOI8U2Js = require("./initializeConfig-CUsOI8u2.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 createTranslatorImpl(_param, namespacePrefix) {
119
+ var messages = _param.messages, namespace = _param.namespace, rest = _objectWithoutProperties(_param, [
120
+ "messages",
121
+ "namespace"
122
+ ]);
123
+ // The `namespacePrefix` is part of the type system.
124
+ // See the comment in the function invocation.
125
+ messages = messages[namespacePrefix];
126
+ namespace = (0, _initializeConfigCUsOI8U2Js.r)(namespace, namespacePrefix);
127
+ return (0, _initializeConfigCUsOI8U2Js.a)(_objectSpreadProps(_objectSpread({}, rest), {
128
+ messages: messages,
129
+ namespace: namespace
130
+ }));
131
+ }
132
+ // This type is slightly more loose than `AbstractIntlMessages`
133
+ // in order to avoid a type error.
134
+ /**
135
+ * @private Not intended for direct use.
136
+ */ /**
137
+ * Translates messages from the given namespace by using the ICU syntax.
138
+ * See https://formatjs.io/docs/core-concepts/icu-syntax.
139
+ *
140
+ * If no namespace is provided, all available messages are returned.
141
+ * The namespace can also indicate nesting by using a dot
142
+ * (e.g. `namespace.Component`).
143
+ */ function createTranslator(_param) {
144
+ var __cache = _param._cache, _cache = __cache === void 0 ? (0, _formattersR4AAmsMPJs.b)() : __cache, __formatters = _param._formatters, _formatters = __formatters === void 0 ? (0, _formattersR4AAmsMPJs.c)(_cache) : __formatters, _getMessageFallback = _param.getMessageFallback, getMessageFallback = _getMessageFallback === void 0 ? _initializeConfigCUsOI8U2Js.d : _getMessageFallback, messages = _param.messages, namespace = _param.namespace, _onError = _param.onError, onError = _onError === void 0 ? _initializeConfigCUsOI8U2Js.b : _onError, rest = _objectWithoutProperties(_param, [
145
+ "_cache",
146
+ "_formatters",
147
+ "getMessageFallback",
148
+ "messages",
149
+ "namespace",
150
+ "onError"
151
+ ]);
152
+ // We have to wrap the actual function so the type inference for the optional
153
+ // namespace works correctly. See https://stackoverflow.com/a/71529575/343045
154
+ // The prefix ("!") is arbitrary.
155
+ // @ts-expect-error Use the explicit annotation instead
156
+ return createTranslatorImpl(_objectSpreadProps(_objectSpread({}, rest), {
157
+ onError: onError,
158
+ cache: _cache,
159
+ formatters: _formatters,
160
+ getMessageFallback: getMessageFallback,
161
+ // @ts-expect-error `messages` is allowed to be `undefined` here and will be handled internally
162
+ messages: {
163
+ "!": messages
164
+ },
165
+ namespace: namespace ? "!.".concat(namespace) : "!"
166
+ }), "!");
167
+ }
168
+ /**
169
+ * Checks if a locale exists in a list of locales.
170
+ *
171
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale
172
+ */ function hasLocale(locales, candidate) {
173
+ return locales.includes(candidate);
174
+ }
@@ -0,0 +1,314 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return formatMessage;
9
+ }
10
+ });
11
+ function _arrayLikeToArray(arr, len) {
12
+ if (len == null || len > arr.length) len = arr.length;
13
+ for(var i1 = 0, arr2 = new Array(len); i1 < len; i1++)arr2[i1] = arr[i1];
14
+ return arr2;
15
+ }
16
+ function _arrayWithHoles(arr) {
17
+ if (Array.isArray(arr)) return arr;
18
+ }
19
+ function _arrayWithoutHoles(arr) {
20
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
21
+ }
22
+ function _defineProperty(obj, key, value) {
23
+ if (key in obj) {
24
+ Object.defineProperty(obj, key, {
25
+ value: value,
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true
29
+ });
30
+ } else {
31
+ obj[key] = value;
32
+ }
33
+ return obj;
34
+ }
35
+ function _iterableToArray(iter) {
36
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
37
+ }
38
+ function _iterableToArrayLimit(arr, i1) {
39
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
40
+ if (_i == null) return;
41
+ var _arr = [];
42
+ var _n = true;
43
+ var _d = false;
44
+ var _s, _e;
45
+ try {
46
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
47
+ _arr.push(_s.value);
48
+ if (i1 && _arr.length === i1) break;
49
+ }
50
+ } catch (err) {
51
+ _d = true;
52
+ _e = err;
53
+ } finally{
54
+ try {
55
+ if (!_n && _i["return"] != null) _i["return"]();
56
+ } finally{
57
+ if (_d) throw _e;
58
+ }
59
+ }
60
+ return _arr;
61
+ }
62
+ function _nonIterableRest() {
63
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
+ }
65
+ function _nonIterableSpread() {
66
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
67
+ }
68
+ function _objectSpread(target) {
69
+ for(var i1 = 1; i1 < arguments.length; i1++){
70
+ var source = arguments[i1] != null ? arguments[i1] : {};
71
+ var ownKeys = Object.keys(source);
72
+ if (typeof Object.getOwnPropertySymbols === "function") {
73
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
74
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
75
+ }));
76
+ }
77
+ ownKeys.forEach(function(key) {
78
+ _defineProperty(target, key, source[key]);
79
+ });
80
+ }
81
+ return target;
82
+ }
83
+ function ownKeys(object, enumerableOnly) {
84
+ var keys = Object.keys(object);
85
+ if (Object.getOwnPropertySymbols) {
86
+ var symbols = Object.getOwnPropertySymbols(object);
87
+ if (enumerableOnly) {
88
+ symbols = symbols.filter(function(sym) {
89
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
90
+ });
91
+ }
92
+ keys.push.apply(keys, symbols);
93
+ }
94
+ return keys;
95
+ }
96
+ function _objectSpreadProps(target, source) {
97
+ source = source != null ? source : {};
98
+ if (Object.getOwnPropertyDescriptors) {
99
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
100
+ } else {
101
+ ownKeys(Object(source)).forEach(function(key) {
102
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
103
+ });
104
+ }
105
+ return target;
106
+ }
107
+ function _objectWithoutProperties(source, excluded) {
108
+ if (source == null) return {};
109
+ var target = _objectWithoutPropertiesLoose(source, excluded);
110
+ var key, i1;
111
+ if (Object.getOwnPropertySymbols) {
112
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
113
+ for(i1 = 0; i1 < sourceSymbolKeys.length; i1++){
114
+ key = sourceSymbolKeys[i1];
115
+ if (excluded.indexOf(key) >= 0) continue;
116
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
117
+ target[key] = source[key];
118
+ }
119
+ }
120
+ return target;
121
+ }
122
+ function _objectWithoutPropertiesLoose(source, excluded) {
123
+ if (source == null) return {};
124
+ var target = {};
125
+ var sourceKeys = Object.keys(source);
126
+ var key, i1;
127
+ for(i1 = 0; i1 < sourceKeys.length; i1++){
128
+ key = sourceKeys[i1];
129
+ if (excluded.indexOf(key) >= 0) continue;
130
+ target[key] = source[key];
131
+ }
132
+ return target;
133
+ }
134
+ function _slicedToArray(arr, i1) {
135
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i1) || _unsupportedIterableToArray(arr, i1) || _nonIterableRest();
136
+ }
137
+ function _toArray(arr) {
138
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _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 a$1 = 0, s = 1, c$1 = 2, e = 3, o = 4, t = 5, b = 6;
152
+ function f(t, r) {
153
+ var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, e = arguments.length > 3 ? arguments[3] : void 0;
154
+ if ("string" == typeof t) return t;
155
+ return g(i1(t, r, n, e, void 0));
156
+ }
157
+ function i1(t, r, n, e, o) {
158
+ var u = [];
159
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
160
+ try {
161
+ for(var _iterator = t[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
162
+ var s = _step.value;
163
+ var _u;
164
+ var _$t = a(s, r, n, e, o);
165
+ Array.isArray(_$t) ? (_u = u).push.apply(_u, _toConsumableArray(_$t)) : u.push(_$t);
166
+ }
167
+ } catch (err) {
168
+ _didIteratorError = true;
169
+ _iteratorError = err;
170
+ } finally{
171
+ try {
172
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
173
+ _iterator.return();
174
+ }
175
+ } finally{
176
+ if (_didIteratorError) {
177
+ throw _iteratorError;
178
+ }
179
+ }
180
+ }
181
+ return u;
182
+ }
183
+ function a(f, a, y, d, h) {
184
+ if ("string" == typeof f) return f;
185
+ if (f === a$1) {
186
+ var t1 = h;
187
+ return d.formatters.getNumberFormat(t1.locale).format(t1.value);
188
+ }
189
+ var _f = _toArray(f), b$1 = _f[0], v = _f[1], A = _f.slice(2);
190
+ if (void 0 === v) {
191
+ var t2 = c(y, b$1);
192
+ return String(t2);
193
+ }
194
+ if ("number" != typeof v || v === a$1) return function(t, r, n, e, o, u) {
195
+ var s = c(e, t), _$f = s, _$a = i1(r, n, e, o, u), _$m = g(_$a), l = Array.isArray(_$m) ? _$m : [
196
+ _$m
197
+ ];
198
+ return _$f(l);
199
+ }(b$1, [
200
+ v
201
+ ].concat(_toConsumableArray(A)), a, y, d, h);
202
+ switch(v){
203
+ case s:
204
+ return function(t, r, n, e, o, u) {
205
+ var _s;
206
+ var s = String(c(e, t)), _$f = (_s = r[s]) !== null && _s !== void 0 ? _s : r.other;
207
+ return l(_$f, n, e, o, u);
208
+ }(b$1, A[0], a, y, d, h);
209
+ case c$1:
210
+ return m(b$1, A[0], a, y, d, "cardinal");
211
+ case e:
212
+ return m(b$1, A[0], a, y, d, "ordinal");
213
+ case o:
214
+ return function(t, r, n, e, o) {
215
+ var u = c(e, t), s = u, _$f = function(t, r) {
216
+ var ref, ref1;
217
+ if (!t) return;
218
+ if ("string" == typeof t) return ((ref = r.formats) === null || ref === void 0 ? void 0 : (ref1 = ref.number) === null || ref1 === void 0 ? void 0 : ref1[t]) ? r.formats.number[t] : void 0;
219
+ return t;
220
+ }(r, o);
221
+ return o.formatters.getNumberFormat(n, _$f).format(s);
222
+ }(b$1, A[0], a, y, d);
223
+ case t:
224
+ return p(b$1, A[0], a, y, d);
225
+ case b:
226
+ return p(b$1, A[0], a, y, d);
227
+ default:
228
+ return "";
229
+ }
230
+ }
231
+ function c(t, r) {
232
+ return t[r];
233
+ }
234
+ function m(t, r, n, e, o, u) {
235
+ var s = c(e, t), f = "=".concat(s);
236
+ if (f in r) return l(r[f], n, e, o, {
237
+ value: s,
238
+ locale: n
239
+ });
240
+ var ref;
241
+ return l((ref = r[o.formatters.getPluralRules(n, {
242
+ type: u
243
+ }).select(s)]) !== null && ref !== void 0 ? ref : r.other, n, e, o, {
244
+ value: s,
245
+ locale: n
246
+ });
247
+ }
248
+ function l(r, n, e, o, u) {
249
+ return "string" == typeof r ? r : r === a$1 ? a(r, n, e, o, u) : i1(r, n, e, o, u);
250
+ }
251
+ function p(t, r, n, e, o, u) {
252
+ var ref;
253
+ var s = c(e, t), f = function(t, r, n) {
254
+ if (!t) return;
255
+ if ("string" == typeof t) {
256
+ var ref, ref1;
257
+ var _$r = (ref = n.formats) === null || ref === void 0 ? void 0 : (ref1 = ref.dateTime) === null || ref1 === void 0 ? void 0 : ref1[t];
258
+ return _$r;
259
+ }
260
+ return t;
261
+ }(r, 0, o), i1 = _objectSpreadProps(_objectSpread({}, f), {
262
+ timeZone: (ref = f === null || f === void 0 ? void 0 : f.timeZone) !== null && ref !== void 0 ? ref : o.timeZone
263
+ });
264
+ return o.formatters.getDateTimeFormat(n, i1).format(s);
265
+ }
266
+ function g(t) {
267
+ if (0 === t.length) return "";
268
+ var r = [];
269
+ var n = "";
270
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
271
+ try {
272
+ for(var _iterator = t[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
273
+ var e = _step.value;
274
+ "string" == typeof e ? n += e : (n && (r.push(n), n = ""), r.push(e));
275
+ }
276
+ } catch (err) {
277
+ _didIteratorError = true;
278
+ _iteratorError = err;
279
+ } finally{
280
+ try {
281
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
282
+ _iterator.return();
283
+ }
284
+ } finally{
285
+ if (_didIteratorError) {
286
+ throw _iteratorError;
287
+ }
288
+ }
289
+ }
290
+ return n && r.push(n), 1 === r.length ? r[0] : r;
291
+ }
292
+ /**
293
+ * Formats a precompiled ICU message using icu-minify/format.
294
+ * This implementation requires messages to be precompiled at build time.
295
+ */ function formatMessage() {
296
+ /** The precompiled ICU message (CompiledMessage from icu-minify) */ for(var _len = arguments.length, _tmp = new Array(_len), _key = 0; _key < _len; _key++){
297
+ _tmp[_key] = arguments[_key];
298
+ }
299
+ var __tmp = _slicedToArray(_tmp, 4), message = __tmp[1], values = __tmp[2], options = __tmp[3];
300
+ var formats = options.formats, globalFormats = options.globalFormats, locale = options.locale, rest = _objectWithoutProperties(options, [
301
+ "formats",
302
+ "globalFormats",
303
+ "locale"
304
+ ]);
305
+ var result = f(message, locale, values, _objectSpread({
306
+ formats: {
307
+ dateTime: _objectSpread({}, globalFormats === null || globalFormats === void 0 ? void 0 : globalFormats.dateTime, formats === null || formats === void 0 ? void 0 : formats.dateTime),
308
+ number: _objectSpread({}, globalFormats === null || globalFormats === void 0 ? void 0 : globalFormats.number, formats === null || formats === void 0 ? void 0 : formats.number)
309
+ }
310
+ }, rest));
311
+ return result;
312
+ }
313
+ // `t.raw` is not supported
314
+ formatMessage.raw = false;