@wordpress/i18n 4.38.0 → 4.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/create-i18n.js +57 -128
- package/build/create-i18n.js.map +1 -1
- package/build/default-i18n.js +11 -24
- package/build/default-i18n.js.map +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/sprintf.js +0 -6
- package/build/sprintf.js.map +1 -1
- package/build-module/create-i18n.js +58 -125
- package/build-module/create-i18n.js.map +1 -1
- package/build-module/default-i18n.js +12 -12
- package/build-module/default-i18n.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/sprintf.js +1 -3
- package/build-module/sprintf.js.map +1 -1
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
package/build/default-i18n.js
CHANGED
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.subscribe = exports.setLocaleData = exports.resetLocaleData = exports.isRTL = exports.hasTranslation = exports.getLocaleData = exports.default = exports._x = exports._nx = exports._n = exports.__ = void 0;
|
|
7
|
-
|
|
8
7
|
var _createI18n = require("./create-i18n");
|
|
9
|
-
|
|
10
8
|
var _hooks = require("@wordpress/hooks");
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* Internal dependencies
|
|
14
11
|
*/
|
|
@@ -16,23 +13,22 @@ var _hooks = require("@wordpress/hooks");
|
|
|
16
13
|
/**
|
|
17
14
|
* WordPress dependencies
|
|
18
15
|
*/
|
|
16
|
+
|
|
19
17
|
const i18n = (0, _createI18n.createI18n)(undefined, undefined, _hooks.defaultHooks);
|
|
18
|
+
|
|
20
19
|
/**
|
|
21
20
|
* Default, singleton instance of `I18n`.
|
|
22
21
|
*/
|
|
23
|
-
|
|
24
22
|
var _default = i18n;
|
|
25
23
|
/*
|
|
26
24
|
* Comments in this file are duplicated from ./i18n due to
|
|
27
25
|
* https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
|
|
28
26
|
*/
|
|
29
|
-
|
|
30
27
|
/**
|
|
31
28
|
* @typedef {import('./create-i18n').LocaleData} LocaleData
|
|
32
29
|
* @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback
|
|
33
30
|
* @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback
|
|
34
31
|
*/
|
|
35
|
-
|
|
36
32
|
/**
|
|
37
33
|
* Returns locale data by domain in a Jed-formatted JSON object shape.
|
|
38
34
|
*
|
|
@@ -41,9 +37,9 @@ var _default = i18n;
|
|
|
41
37
|
* @param {string} [domain] Domain for which to get the data.
|
|
42
38
|
* @return {LocaleData} Locale data.
|
|
43
39
|
*/
|
|
44
|
-
|
|
45
40
|
exports.default = _default;
|
|
46
41
|
const getLocaleData = i18n.getLocaleData.bind(i18n);
|
|
42
|
+
|
|
47
43
|
/**
|
|
48
44
|
* Merges locale data into the Tannin instance by domain. Accepts data in a
|
|
49
45
|
* Jed-formatted JSON object shape.
|
|
@@ -53,9 +49,9 @@ const getLocaleData = i18n.getLocaleData.bind(i18n);
|
|
|
53
49
|
* @param {LocaleData} [data] Locale data configuration.
|
|
54
50
|
* @param {string} [domain] Domain for which configuration applies.
|
|
55
51
|
*/
|
|
56
|
-
|
|
57
52
|
exports.getLocaleData = getLocaleData;
|
|
58
53
|
const setLocaleData = i18n.setLocaleData.bind(i18n);
|
|
54
|
+
|
|
59
55
|
/**
|
|
60
56
|
* Resets all current Tannin instance locale data and sets the specified
|
|
61
57
|
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
@@ -65,18 +61,18 @@ const setLocaleData = i18n.setLocaleData.bind(i18n);
|
|
|
65
61
|
* @param {LocaleData} [data] Locale data configuration.
|
|
66
62
|
* @param {string} [domain] Domain for which configuration applies.
|
|
67
63
|
*/
|
|
68
|
-
|
|
69
64
|
exports.setLocaleData = setLocaleData;
|
|
70
65
|
const resetLocaleData = i18n.resetLocaleData.bind(i18n);
|
|
66
|
+
|
|
71
67
|
/**
|
|
72
68
|
* Subscribes to changes of locale data
|
|
73
69
|
*
|
|
74
70
|
* @param {SubscribeCallback} callback Subscription callback
|
|
75
71
|
* @return {UnsubscribeCallback} Unsubscribe callback
|
|
76
72
|
*/
|
|
77
|
-
|
|
78
73
|
exports.resetLocaleData = resetLocaleData;
|
|
79
74
|
const subscribe = i18n.subscribe.bind(i18n);
|
|
75
|
+
|
|
80
76
|
/**
|
|
81
77
|
* Retrieve the translation of text.
|
|
82
78
|
*
|
|
@@ -87,10 +83,9 @@ const subscribe = i18n.subscribe.bind(i18n);
|
|
|
87
83
|
*
|
|
88
84
|
* @return {string} Translated text.
|
|
89
85
|
*/
|
|
90
|
-
|
|
91
86
|
exports.subscribe = subscribe;
|
|
92
|
-
|
|
93
87
|
const __ = i18n.__.bind(i18n);
|
|
88
|
+
|
|
94
89
|
/**
|
|
95
90
|
* Retrieve translated string with gettext context.
|
|
96
91
|
*
|
|
@@ -102,11 +97,9 @@ const __ = i18n.__.bind(i18n);
|
|
|
102
97
|
*
|
|
103
98
|
* @return {string} Translated context string without pipe.
|
|
104
99
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
100
|
exports.__ = __;
|
|
108
|
-
|
|
109
101
|
const _x = i18n._x.bind(i18n);
|
|
102
|
+
|
|
110
103
|
/**
|
|
111
104
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
112
105
|
* number.
|
|
@@ -121,11 +114,9 @@ const _x = i18n._x.bind(i18n);
|
|
|
121
114
|
*
|
|
122
115
|
* @return {string} The translated singular or plural form.
|
|
123
116
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
117
|
exports._x = _x;
|
|
127
|
-
|
|
128
118
|
const _n = i18n._n.bind(i18n);
|
|
119
|
+
|
|
129
120
|
/**
|
|
130
121
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
131
122
|
* number, with gettext context.
|
|
@@ -141,11 +132,9 @@ const _n = i18n._n.bind(i18n);
|
|
|
141
132
|
*
|
|
142
133
|
* @return {string} The translated singular or plural form.
|
|
143
134
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
135
|
exports._n = _n;
|
|
147
|
-
|
|
148
136
|
const _nx = i18n._nx.bind(i18n);
|
|
137
|
+
|
|
149
138
|
/**
|
|
150
139
|
* Check if current locale is RTL.
|
|
151
140
|
*
|
|
@@ -156,10 +145,9 @@ const _nx = i18n._nx.bind(i18n);
|
|
|
156
145
|
*
|
|
157
146
|
* @return {boolean} Whether locale is RTL.
|
|
158
147
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
148
|
exports._nx = _nx;
|
|
162
149
|
const isRTL = i18n.isRTL.bind(i18n);
|
|
150
|
+
|
|
163
151
|
/**
|
|
164
152
|
* Check if there is a translation for a given string (in singular form).
|
|
165
153
|
*
|
|
@@ -168,7 +156,6 @@ const isRTL = i18n.isRTL.bind(i18n);
|
|
|
168
156
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
169
157
|
* @return {boolean} Whether the translation exists or not.
|
|
170
158
|
*/
|
|
171
|
-
|
|
172
159
|
exports.isRTL = isRTL;
|
|
173
160
|
const hasTranslation = i18n.hasTranslation.bind(i18n);
|
|
174
161
|
exports.hasTranslation = hasTranslation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_createI18n","require","_hooks","i18n","createI18n","undefined","defaultHooks","_default","exports","default","getLocaleData","bind","setLocaleData","resetLocaleData","subscribe","__","_x","_n","_nx","isRTL","hasTranslation"],"sources":["@wordpress/i18n/src/default-i18n.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { createI18n } from './create-i18n';\n\n/**\n * WordPress dependencies\n */\nimport { defaultHooks } from '@wordpress/hooks';\n\nconst i18n = createI18n( undefined, undefined, defaultHooks );\n\n/**\n * Default, singleton instance of `I18n`.\n */\nexport default i18n;\n\n/*\n * Comments in this file are duplicated from ./i18n due to\n * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722\n */\n\n/**\n * @typedef {import('./create-i18n').LocaleData} LocaleData\n * @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback\n * @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback\n */\n\n/**\n * Returns locale data by domain in a Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n *\n * @param {string} [domain] Domain for which to get the data.\n * @return {LocaleData} Locale data.\n */\nexport const getLocaleData = i18n.getLocaleData.bind( i18n );\n\n/**\n * Merges locale data into the Tannin instance by domain. Accepts data in a\n * Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n *\n * @param {LocaleData} [data] Locale data configuration.\n * @param {string} [domain] Domain for which configuration applies.\n */\nexport const setLocaleData = i18n.setLocaleData.bind( i18n );\n\n/**\n * Resets all current Tannin instance locale data and sets the specified\n * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n *\n * @param {LocaleData} [data] Locale data configuration.\n * @param {string} [domain] Domain for which configuration applies.\n */\nexport const resetLocaleData = i18n.resetLocaleData.bind( i18n );\n\n/**\n * Subscribes to changes of locale data\n *\n * @param {SubscribeCallback} callback Subscription callback\n * @return {UnsubscribeCallback} Unsubscribe callback\n */\nexport const subscribe = i18n.subscribe.bind( i18n );\n\n/**\n * Retrieve the translation of text.\n *\n * @see https://developer.wordpress.org/reference/functions/__/\n *\n * @param {string} text Text to translate.\n * @param {string} [domain] Domain to retrieve the translated text.\n *\n * @return {string} Translated text.\n */\nexport const __ = i18n.__.bind( i18n );\n\n/**\n * Retrieve translated string with gettext context.\n *\n * @see https://developer.wordpress.org/reference/functions/_x/\n *\n * @param {string} text Text to translate.\n * @param {string} context Context information for the translators.\n * @param {string} [domain] Domain to retrieve the translated text.\n *\n * @return {string} Translated context string without pipe.\n */\nexport const _x = i18n._x.bind( i18n );\n\n/**\n * Translates and retrieves the singular or plural form based on the supplied\n * number.\n *\n * @see https://developer.wordpress.org/reference/functions/_n/\n *\n * @param {string} single The text to be used if the number is singular.\n * @param {string} plural The text to be used if the number is plural.\n * @param {number} number The number to compare against to use either the\n * singular or plural form.\n * @param {string} [domain] Domain to retrieve the translated text.\n *\n * @return {string} The translated singular or plural form.\n */\nexport const _n = i18n._n.bind( i18n );\n\n/**\n * Translates and retrieves the singular or plural form based on the supplied\n * number, with gettext context.\n *\n * @see https://developer.wordpress.org/reference/functions/_nx/\n *\n * @param {string} single The text to be used if the number is singular.\n * @param {string} plural The text to be used if the number is plural.\n * @param {number} number The number to compare against to use either the\n * singular or plural form.\n * @param {string} context Context information for the translators.\n * @param {string} [domain] Domain to retrieve the translated text.\n *\n * @return {string} The translated singular or plural form.\n */\nexport const _nx = i18n._nx.bind( i18n );\n\n/**\n * Check if current locale is RTL.\n *\n * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.\n * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common\n * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,\n * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).\n *\n * @return {boolean} Whether locale is RTL.\n */\nexport const isRTL = i18n.isRTL.bind( i18n );\n\n/**\n * Check if there is a translation for a given string (in singular form).\n *\n * @param {string} single Singular form of the string to look up.\n * @param {string} [context] Context information for the translators.\n * @param {string} [domain] Domain to retrieve the translated text.\n * @return {boolean} Whether the translation exists or not.\n */\nexport const hasTranslation = i18n.hasTranslation.bind( i18n );\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAME,IAAI,GAAG,IAAAC,sBAAU,EAAEC,SAAS,EAAEA,SAAS,EAAEC,mBAAa,CAAC;;AAE7D;AACA;AACA;AAFA,IAAAC,QAAA,GAGeJ,IAAI;AAEnB;AACA;AACA;AACA;AAEA;AACA;A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dAK,OAAA,CAAAS,EAAA,GAAAA,EAAA;AAeO,MAAMC,GAAG,GAAGf,IAAI,CAACe,GAAG,CAACP,IAAI,CAAER,IAAK,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATAK,OAAA,CAAAU,GAAA,GAAAA,GAAA;AAUO,MAAMC,KAAK,GAAGhB,IAAI,CAACgB,KAAK,CAACR,IAAI,CAAER,IAAK,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAK,OAAA,CAAAW,KAAA,GAAAA,KAAA;AAQO,MAAMC,cAAc,GAAGjB,IAAI,CAACiB,cAAc,CAACT,IAAI,CAAER,IAAK,CAAC;AAACK,OAAA,CAAAY,cAAA,GAAAA,cAAA"}
|
package/build/index.js
CHANGED
|
@@ -89,11 +89,8 @@ Object.defineProperty(exports, "subscribe", {
|
|
|
89
89
|
return _defaultI18n.subscribe;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
|
|
93
92
|
var _sprintf = require("./sprintf");
|
|
94
|
-
|
|
95
93
|
var _createI18n = require("./create-i18n");
|
|
96
|
-
|
|
97
94
|
Object.keys(_createI18n).forEach(function (key) {
|
|
98
95
|
if (key === "default" || key === "__esModule") return;
|
|
99
96
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -105,10 +102,7 @@ Object.keys(_createI18n).forEach(function (key) {
|
|
|
105
102
|
}
|
|
106
103
|
});
|
|
107
104
|
});
|
|
108
|
-
|
|
109
105
|
var _defaultI18n = _interopRequireWildcard(require("./default-i18n"));
|
|
110
|
-
|
|
111
106
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
112
|
-
|
|
113
107
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
114
108
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/i18n/src/index.js"],"
|
|
1
|
+
{"version":3,"names":["_sprintf","require","_createI18n","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_defaultI18n","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set"],"sources":["@wordpress/i18n/src/index.js"],"sourcesContent":["export { sprintf } from './sprintf';\nexport * from './create-i18n';\nexport {\n\tdefault as defaultI18n,\n\tsetLocaleData,\n\tresetLocaleData,\n\tgetLocaleData,\n\tsubscribe,\n\t__,\n\t_x,\n\t_n,\n\t_nx,\n\tisRTL,\n\thasTranslation,\n} from './default-i18n';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;E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GAAA,IAAAgB,IAAA,CAAAC,GAAA,KAAA5B,MAAA,CAAAS,cAAA,CAAAe,MAAA,EAAArB,GAAA,EAAAwB,IAAA,YAAAH,MAAA,CAAArB,GAAA,IAAAgB,GAAA,CAAAhB,GAAA,SAAAqB,MAAA,CAAAH,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAM,GAAA,CAAAT,GAAA,EAAAK,MAAA,YAAAA,MAAA"}
|
package/build/sprintf.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.sprintf = sprintf;
|
|
9
|
-
|
|
10
8
|
var _memize = _interopRequireDefault(require("memize"));
|
|
11
|
-
|
|
12
9
|
var _sprintfJs = _interopRequireDefault(require("sprintf-js"));
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* External dependencies
|
|
16
12
|
*/
|
|
@@ -35,7 +31,6 @@ const logErrorOnce = (0, _memize.default)(console.error); // eslint-disable-line
|
|
|
35
31
|
*
|
|
36
32
|
* @return {string} The formatted string.
|
|
37
33
|
*/
|
|
38
|
-
|
|
39
34
|
function sprintf(format, ...args) {
|
|
40
35
|
try {
|
|
41
36
|
return _sprintfJs.default.sprintf(format, ...args);
|
|
@@ -43,7 +38,6 @@ function sprintf(format, ...args) {
|
|
|
43
38
|
if (error instanceof Error) {
|
|
44
39
|
logErrorOnce('sprintf error: \n\n' + error.toString());
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
return format;
|
|
48
42
|
}
|
|
49
43
|
}
|
package/build/sprintf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_memize","_interopRequireDefault","require","_sprintfJs","logErrorOnce","memoize","console","error","sprintf","format","args","sprintfjs","Error","toString"],"sources":["@wordpress/i18n/src/sprintf.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\nimport sprintfjs from 'sprintf-js';\n\n/**\n * Log to console, once per message; or more precisely, per referentially equal\n * argument set. Because Jed throws errors, we log these to the console instead\n * to avoid crashing the application.\n *\n * @param {...*} args Arguments to pass to `console.error`\n */\nconst logErrorOnce = memoize( console.error ); // eslint-disable-line no-console\n\n/**\n * Returns a formatted string. If an error occurs in applying the format, the\n * original format string is returned.\n *\n * @param {string} format The format of the string to generate.\n * @param {...*} args Arguments to apply to the format.\n *\n * @see https://www.npmjs.com/package/sprintf-js\n *\n * @return {string} The formatted string.\n */\nexport function sprintf( format, ...args ) {\n\ttry {\n\t\treturn sprintfjs.sprintf( format, ...args );\n\t} catch ( error ) {\n\t\tif ( error instanceof Error ) {\n\t\t\tlogErrorOnce( 'sprintf error: \\n\\n' + error.toString() );\n\t\t}\n\t\treturn format;\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,YAAY,GAAG,IAAAC,eAAO,EAAEC,OAAO,CAACC,KAAM,CAAC,CAAC,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,OAAOA,CAAEC,MAAM,EAAE,GAAGC,IAAI,EAAG;EAC1C,IAAI;IACH,OAAOC,kBAAS,CAACH,OAAO,CAAEC,MAAM,EAAE,GAAGC,IAAK,CAAC;EAC5C,CAAC,CAAC,OAAQH,KAAK,EAAG;IACjB,IAAKA,KAAK,YAAYK,KAAK,EAAG;MAC7BR,YAAY,CAAE,qBAAqB,GAAGG,KAAK,CAACM,QAAQ,CAAC,CAAE,CAAC;IACzD;IACA,OAAOJ,MAAM;EACd;AACD"}
|