--- a/wp/wp-includes/js/dist/i18n.js Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/js/dist/i18n.js Tue Dec 15 13:49:49 2020 +0100
@@ -82,12 +82,12 @@
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 376);
+/******/ return __webpack_require__(__webpack_require__.s = 452);
/******/ })
/************************************************************************/
/******/ ({
-/***/ 137:
+/***/ 197:
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
@@ -326,36 +326,74 @@
/***/ }),
-/***/ 15:
+/***/ 452:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
-function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
+// ESM COMPAT FLAG
+__webpack_require__.r(__webpack_exports__);
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, "sprintf", function() { return /* reexport */ sprintf_sprintf; });
+__webpack_require__.d(__webpack_exports__, "createI18n", function() { return /* reexport */ create_i18n_createI18n; });
+__webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return /* reexport */ default_i18n_setLocaleData; });
+__webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ default_i18n_; });
+__webpack_require__.d(__webpack_exports__, "_x", function() { return /* reexport */ default_i18n_x; });
+__webpack_require__.d(__webpack_exports__, "_n", function() { return /* reexport */ default_i18n_n; });
+__webpack_require__.d(__webpack_exports__, "_nx", function() { return /* reexport */ default_i18n_nx; });
+__webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ default_i18n_isRTL; });
+
+// EXTERNAL MODULE: ./node_modules/memize/index.js
+var memize = __webpack_require__(60);
+var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
+
+// EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
+var sprintf = __webpack_require__(197);
+var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js
+/**
+ * External dependencies
+ */
+
+
+/**
+ * Log to console, once per message; or more precisely, per referentially equal
+ * argument set. Because Jed throws errors, we log these to the console instead
+ * to avoid crashing the application.
+ *
+ * @param {...*} args Arguments to pass to `console.error`
+ */
+
+var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
+
+/**
+ * Returns a formatted string. If an error occurs in applying the format, the
+ * original format string is returned.
+ *
+ * @param {string} format The format of the string to generate.
+ * @param {...*} args Arguments to apply to the format.
+ *
+ * @see http://www.diveintojavascript.com/projects/javascript-sprintf
+ *
+ * @return {string} The formatted string.
+ */
+
+function sprintf_sprintf(format) {
+ try {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
+ } catch (error) {
+ logErrorOnce('sprintf error: \n\n' + error.toString());
+ return format;
}
-
- return obj;
}
-/***/ }),
-
-/***/ 376:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
-var objectSpread = __webpack_require__(7);
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
+var defineProperty = __webpack_require__(5);
// CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
@@ -616,7 +654,7 @@
*
* @param {string} expression C expression.
*
- * @return {Function} Compiled evaluator.
+ * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator.
*/
function compile( expression ) {
var terms = postfix( expression );
@@ -652,12 +690,44 @@
/**
* Tannin constructor options.
*
- * @property {?string} contextDelimiter Joiner in string lookup with context.
- * @property {?Function} onMissingKey Callback to invoke when key missing.
+ * @typedef {Object} TanninOptions
+ *
+ * @property {string} [contextDelimiter] Joiner in string lookup with context.
+ * @property {Function} [onMissingKey] Callback to invoke when key missing.
+ */
+
+/**
+ * Domain metadata.
+ *
+ * @typedef {Object} TanninDomainMetadata
*
- * @type {Object}
+ * @property {string} [domain] Domain name.
+ * @property {string} [lang] Language code.
+ * @property {(string|Function)} [plural_forms] Plural forms expression or
+ * function evaluator.
+ */
+
+/**
+ * Domain translation pair respectively representing the singular and plural
+ * translation.
*
- * @typedef {TanninOptions}
+ * @typedef {[string,string]} TanninTranslation
+ */
+
+/**
+ * Locale data domain. The key is used as reference for lookup, the value an
+ * array of two string entries respectively representing the singular and plural
+ * translation.
+ *
+ * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain
+ */
+
+/**
+ * Jed-formatted locale data.
+ *
+ * @see http://messageformat.github.io/Jed/
+ *
+ * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData
*/
/**
@@ -700,19 +770,42 @@
/**
* Tannin constructor.
*
- * @param {Object} data Jed-formatted locale data.
- * @param {TanninOptions} options Tannin options.
+ * @class
+ *
+ * @param {TanninLocaleData} data Jed-formatted locale data.
+ * @param {TanninOptions} [options] Tannin options.
*/
function Tannin( data, options ) {
var key;
+ /**
+ * Jed-formatted locale data.
+ *
+ * @name Tannin#data
+ * @type {TanninLocaleData}
+ */
this.data = data;
+
+ /**
+ * Plural forms function cache, keyed by plural forms string.
+ *
+ * @name Tannin#pluralForms
+ * @type {Object<string,Function>}
+ */
this.pluralForms = {};
- options = options || {};
+ /**
+ * Effective options for instance, including defaults.
+ *
+ * @name Tannin#options
+ * @type {TanninOptions}
+ */
this.options = {};
+
for ( key in DEFAULT_OPTIONS ) {
- this.options[ key ] = options[ key ] || DEFAULT_OPTIONS[ key ];
+ this.options[ key ] = options !== undefined && key in options
+ ? options[ key ]
+ : DEFAULT_OPTIONS[ key ];
}
}
@@ -734,6 +827,9 @@
pf = (
config[ 'Plural-Forms' ] ||
config[ 'plural-forms' ] ||
+ // Ignore reason: As known, there's no way to document the empty
+ // string property on a key to guarantee this as metadata.
+ // @ts-ignore
config.plural_forms
);
@@ -741,6 +837,9 @@
plural = getPluralExpression(
config[ 'Plural-Forms' ] ||
config[ 'plural-forms' ] ||
+ // Ignore reason: As known, there's no way to document the empty
+ // string property on a key to guarantee this as metadata.
+ // @ts-ignore
config.plural_forms
);
@@ -756,11 +855,12 @@
/**
* Translate a string.
*
- * @param {string} domain Translation domain.
- * @param {string} context Context distinguishing terms of the same name.
- * @param {string} singular Primary key for translation lookup.
- * @param {string} plural Fallback value used for non-zero plural form index.
- * @param {number} n Value to use in calculating plural form.
+ * @param {string} domain Translation domain.
+ * @param {string|void} context Context distinguishing terms of the same name.
+ * @param {string} singular Primary key for translation lookup.
+ * @param {string=} plural Fallback value used for non-zero plural
+ * form index.
+ * @param {number=} n Value to use in calculating plural form.
*
* @return {string} Translated string.
*/
@@ -799,208 +899,392 @@
return index === 0 ? singular : plural;
};
-// EXTERNAL MODULE: ./node_modules/memize/index.js
-var memize = __webpack_require__(41);
-var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
+// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/create-i18n.js
-// EXTERNAL MODULE: ./node_modules/@wordpress/i18n/node_modules/sprintf-js/src/sprintf.js
-var sprintf = __webpack_require__(137);
-var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
-// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return setLocaleData; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__", function() { return __; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_x", function() { return _x; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_n", function() { return _n; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nx", function() { return _nx; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sprintf", function() { return build_module_sprintf; });
+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; }
+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) { Object(defineProperty["a" /* default */])(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; }
/**
* External dependencies
*/
-
+/**
+ * @typedef {Record<string,any>} LocaleData
+ */
/**
* Default locale data to use for Tannin domain when not otherwise provided.
* Assumes an English plural forms expression.
*
- * @type {Object}
+ * @type {LocaleData}
*/
var DEFAULT_LOCALE_DATA = {
'': {
- plural_forms: 'plural=(n!=1)'
+ /** @param {number} n */
+ plural_forms: function plural_forms(n) {
+ return n === 1 ? 0 : 1;
+ }
}
};
/**
- * Log to console, once per message; or more precisely, per referentially equal
- * argument set. Because Jed throws errors, we log these to the console instead
- * to avoid crashing the application.
+ * An i18n instance
*
- * @param {...*} args Arguments to pass to `console.error`
+ * @typedef {Object} I18n
+ * @property {Function} setLocaleData Merges locale data into the Tannin instance by domain. Accepts data in a
+ * Jed-formatted JSON object shape.
+ * @property {Function} __ Retrieve the translation of text.
+ * @property {Function} _x Retrieve translated string with gettext context.
+ * @property {Function} _n Translates and retrieves the singular or plural form based on the supplied
+ * number.
+ * @property {Function} _nx Translates and retrieves the singular or plural form based on the supplied
+ * number, with gettext context.
+ * @property {Function} isRTL Check if current locale is RTL.
+ */
+
+/**
+ * Create an i18n instance
+ *
+ * @param {LocaleData} [initialData] Locale data configuration.
+ * @param {string} [initialDomain] Domain for which configuration applies.
+ * @return {I18n} I18n instance
*/
-var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
+var create_i18n_createI18n = function createI18n(initialData, initialDomain) {
+ /**
+ * The underlying instance of Tannin to which exported functions interface.
+ *
+ * @type {Tannin}
+ */
+ var tannin = new Tannin({});
+ /**
+ * Merges locale data into the Tannin instance by domain. Accepts data in a
+ * Jed-formatted JSON object shape.
+ *
+ * @see http://messageformat.github.io/Jed/
+ *
+ * @param {LocaleData} [data] Locale data configuration.
+ * @param {string} [domain] Domain for which configuration applies.
+ */
+
+ var setLocaleData = function setLocaleData(data) {
+ var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
+ tannin.data[domain] = _objectSpread({}, DEFAULT_LOCALE_DATA, {}, tannin.data[domain], {}, data); // Populate default domain configuration (supported locale date which omits
+ // a plural forms expression).
+
+ tannin.data[domain][''] = _objectSpread({}, DEFAULT_LOCALE_DATA[''], {}, tannin.data[domain]['']);
+ };
+ /**
+ * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
+ * otherwise previously assigned.
+ *
+ * @param {string|undefined} domain Domain to retrieve the translated text.
+ * @param {string|undefined} context Context information for the translators.
+ * @param {string} single Text to translate if non-plural. Used as
+ * fallback return value on a caught error.
+ * @param {string} [plural] The text to be used if the number is
+ * plural.
+ * @param {number} [number] The number to compare against to use
+ * either the singular or plural form.
+ *
+ * @return {string} The translated string.
+ */
+
+
+ var dcnpgettext = function dcnpgettext() {
+ var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
+ var context = arguments.length > 1 ? arguments[1] : undefined;
+ var single = arguments.length > 2 ? arguments[2] : undefined;
+ var plural = arguments.length > 3 ? arguments[3] : undefined;
+ var number = arguments.length > 4 ? arguments[4] : undefined;
+
+ if (!tannin.data[domain]) {
+ setLocaleData(undefined, domain);
+ }
+
+ return tannin.dcnpgettext(domain, context, single, plural, number);
+ };
+ /**
+ * Retrieve the translation of text.
+ *
+ * @see https://developer.wordpress.org/reference/functions/__/
+ *
+ * @param {string} text Text to translate.
+ * @param {string} [domain] Domain to retrieve the translated text.
+ *
+ * @return {string} Translated text.
+ */
+
+
+ var __ = function __(text, domain) {
+ return dcnpgettext(domain, undefined, text);
+ };
+ /**
+ * Retrieve translated string with gettext context.
+ *
+ * @see https://developer.wordpress.org/reference/functions/_x/
+ *
+ * @param {string} text Text to translate.
+ * @param {string} context Context information for the translators.
+ * @param {string} [domain] Domain to retrieve the translated text.
+ *
+ * @return {string} Translated context string without pipe.
+ */
+
+
+ var _x = function _x(text, context, domain) {
+ return dcnpgettext(domain, context, text);
+ };
+ /**
+ * Translates and retrieves the singular or plural form based on the supplied
+ * number.
+ *
+ * @see https://developer.wordpress.org/reference/functions/_n/
+ *
+ * @param {string} single The text to be used if the number is singular.
+ * @param {string} plural The text to be used if the number is plural.
+ * @param {number} number The number to compare against to use either the
+ * singular or plural form.
+ * @param {string} [domain] Domain to retrieve the translated text.
+ *
+ * @return {string} The translated singular or plural form.
+ */
+
+
+ var _n = function _n(single, plural, number, domain) {
+ return dcnpgettext(domain, undefined, single, plural, number);
+ };
+ /**
+ * Translates and retrieves the singular or plural form based on the supplied
+ * number, with gettext context.
+ *
+ * @see https://developer.wordpress.org/reference/functions/_nx/
+ *
+ * @param {string} single The text to be used if the number is singular.
+ * @param {string} plural The text to be used if the number is plural.
+ * @param {number} number The number to compare against to use either the
+ * singular or plural form.
+ * @param {string} context Context information for the translators.
+ * @param {string} [domain] Domain to retrieve the translated text.
+ *
+ * @return {string} The translated singular or plural form.
+ */
+
+
+ var _nx = function _nx(single, plural, number, context, domain) {
+ return dcnpgettext(domain, context, single, plural, number);
+ };
+ /**
+ * Check if current locale is RTL.
+ *
+ * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
+ * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
+ * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
+ * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
+ *
+ * @return {boolean} Whether locale is RTL.
+ */
+
+
+ var isRTL = function isRTL() {
+ return 'rtl' === _x('ltr', 'text direction');
+ };
+
+ if (initialData) {
+ setLocaleData(initialData, initialDomain);
+ }
+
+ return {
+ setLocaleData: setLocaleData,
+ __: __,
+ _x: _x,
+ _n: _n,
+ _nx: _nx,
+ isRTL: isRTL
+ };
+};
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/default-i18n.js
+/**
+ * Internal dependencies
+ */
+
+var i18n = create_i18n_createI18n();
+/*
+ * Comments in this file are duplicated from ./i18n due to
+ * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
+ */
/**
- * The underlying instance of Tannin to which exported functions interface.
- *
- * @type {Tannin}
+ * @typedef {import('./create-i18n').LocaleData} LocaleData
*/
-var i18n = new Tannin({});
/**
* Merges locale data into the Tannin instance by domain. Accepts data in a
* Jed-formatted JSON object shape.
*
* @see http://messageformat.github.io/Jed/
*
- * @param {?Object} data Locale data configuration.
- * @param {?string} domain Domain for which configuration applies.
+ * @param {LocaleData} [data] Locale data configuration.
+ * @param {string} [domain] Domain for which configuration applies.
*/
-function setLocaleData(data) {
- var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
- i18n.data[domain] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA, i18n.data[domain], data); // Populate default domain configuration (supported locale date which omits
- // a plural forms expression).
-
- i18n.data[domain][''] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA[''], i18n.data[domain]['']);
-}
-/**
- * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
- * otherwise previously assigned.
- *
- * @param {?string} domain Domain to retrieve the translated text.
- * @param {?string} context Context information for the translators.
- * @param {string} single Text to translate if non-plural. Used as fallback
- * return value on a caught error.
- * @param {?string} plural The text to be used if the number is plural.
- * @param {?number} number The number to compare against to use either the
- * singular or plural form.
- *
- * @return {string} The translated string.
- */
-
-function dcnpgettext() {
- var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
- var context = arguments.length > 1 ? arguments[1] : undefined;
- var single = arguments.length > 2 ? arguments[2] : undefined;
- var plural = arguments.length > 3 ? arguments[3] : undefined;
- var number = arguments.length > 4 ? arguments[4] : undefined;
-
- if (!i18n.data[domain]) {
- setLocaleData(undefined, domain);
- }
-
- return i18n.dcnpgettext(domain, context, single, plural, number);
-}
+var default_i18n_setLocaleData = i18n.setLocaleData.bind(i18n);
/**
* Retrieve the translation of text.
*
* @see https://developer.wordpress.org/reference/functions/__/
*
- * @param {string} text Text to translate.
- * @param {?string} domain Domain to retrieve the translated text.
+ * @param {string} text Text to translate.
+ * @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} Translated text.
*/
-
-function __(text, domain) {
- return dcnpgettext(domain, undefined, text);
-}
+var default_i18n_ = i18n.__.bind(i18n);
/**
* Retrieve translated string with gettext context.
*
* @see https://developer.wordpress.org/reference/functions/_x/
*
- * @param {string} text Text to translate.
- * @param {string} context Context information for the translators.
- * @param {?string} domain Domain to retrieve the translated text.
+ * @param {string} text Text to translate.
+ * @param {string} context Context information for the translators.
+ * @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} Translated context string without pipe.
*/
-function _x(text, context, domain) {
- return dcnpgettext(domain, context, text);
-}
+var default_i18n_x = i18n._x.bind(i18n);
/**
* Translates and retrieves the singular or plural form based on the supplied
* number.
*
* @see https://developer.wordpress.org/reference/functions/_n/
*
- * @param {string} single The text to be used if the number is singular.
- * @param {string} plural The text to be used if the number is plural.
- * @param {number} number The number to compare against to use either the
- * singular or plural form.
- * @param {?string} domain Domain to retrieve the translated text.
+ * @param {string} single The text to be used if the number is singular.
+ * @param {string} plural The text to be used if the number is plural.
+ * @param {number} number The number to compare against to use either the
+ * singular or plural form.
+ * @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} The translated singular or plural form.
*/
-function _n(single, plural, number, domain) {
- return dcnpgettext(domain, undefined, single, plural, number);
-}
+var default_i18n_n = i18n._n.bind(i18n);
/**
* Translates and retrieves the singular or plural form based on the supplied
* number, with gettext context.
*
* @see https://developer.wordpress.org/reference/functions/_nx/
*
- * @param {string} single The text to be used if the number is singular.
- * @param {string} plural The text to be used if the number is plural.
- * @param {number} number The number to compare against to use either the
+ * @param {string} single The text to be used if the number is singular.
+ * @param {string} plural The text to be used if the number is plural.
+ * @param {number} number The number to compare against to use either the
* singular or plural form.
- * @param {string} context Context information for the translators.
- * @param {?string} domain Domain to retrieve the translated text.
+ * @param {string} context Context information for the translators.
+ * @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} The translated singular or plural form.
*/
-function _nx(single, plural, number, context, domain) {
- return dcnpgettext(domain, context, single, plural, number);
-}
+var default_i18n_nx = i18n._nx.bind(i18n);
/**
- * Returns a formatted string. If an error occurs in applying the format, the
- * original format string is returned.
+ * Check if current locale is RTL.
*
- * @param {string} format The format of the string to generate.
- * @param {...string} args Arguments to apply to the format.
+ * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
+ * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
+ * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
+ * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
*
- * @see http://www.diveintojavascript.com/projects/javascript-sprintf
- *
- * @return {string} The formatted string.
+ * @return {boolean} Whether locale is RTL.
*/
-function build_module_sprintf(format) {
- try {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
+var default_i18n_isRTL = i18n.isRTL.bind(i18n);
- return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
- } catch (error) {
- logErrorOnce('sprintf error: \n\n' + error.toString());
- return format;
- }
-}
+// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
+
+
+
/***/ }),
-/***/ 41:
+/***/ 5:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
+}
+
+/***/ }),
+
+/***/ 60:
/***/ (function(module, exports, __webpack_require__) {
-module.exports = function memize( fn, options ) {
- var size = 0,
- maxSize, head, tail;
+/**
+ * Memize options object.
+ *
+ * @typedef MemizeOptions
+ *
+ * @property {number} [maxSize] Maximum size of the cache.
+ */
+
+/**
+ * Internal cache entry.
+ *
+ * @typedef MemizeCacheNode
+ *
+ * @property {?MemizeCacheNode|undefined} [prev] Previous node.
+ * @property {?MemizeCacheNode|undefined} [next] Next node.
+ * @property {Array<*>} args Function arguments for cache
+ * entry.
+ * @property {*} val Function result.
+ */
- if ( options && options.maxSize ) {
- maxSize = options.maxSize;
- }
+/**
+ * Properties of the enhanced function for controlling cache.
+ *
+ * @typedef MemizeMemoizedFunction
+ *
+ * @property {()=>void} clear Clear the cache.
+ */
+
+/**
+ * Accepts a function to be memoized, and returns a new memoized function, with
+ * optional options.
+ *
+ * @template {Function} F
+ *
+ * @param {F} fn Function to memoize.
+ * @param {MemizeOptions} [options] Options object.
+ *
+ * @return {F & MemizeMemoizedFunction} Memoized function.
+ */
+function memize( fn, options ) {
+ var size = 0;
+
+ /** @type {?MemizeCacheNode|undefined} */
+ var head;
+
+ /** @type {?MemizeCacheNode|undefined} */
+ var tail;
+
+ options = options || {};
function memoized( /* ...args */ ) {
var node = head,
@@ -1040,14 +1324,14 @@
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
- node.prev.next = node.next;
+ /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
- head.prev = node;
+ /** @type {MemizeCacheNode} */ ( head ).prev = node;
head = node;
}
@@ -1067,7 +1351,7 @@
args: args,
// Generate the result from original function
- val: fn.apply( null, args )
+ val: fn.apply( null, args ),
};
// Don't need to check whether node is already head, since it would
@@ -1083,9 +1367,9 @@
}
// Trim tail if we're reached max size and are pending cache insertion
- if ( size === maxSize ) {
- tail = tail.prev;
- tail.next = null;
+ if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
+ tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
+ /** @type {MemizeCacheNode} */ ( tail ).next = null;
} else {
size++;
}
@@ -1103,37 +1387,17 @@
if ( false ) {}
- return memoized;
-};
-
-
-/***/ }),
-
-/***/ 7:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
-/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
+ // Ignore reason: There's not a clear solution to create an intersection of
+ // the function with additional properties, where the goal is to retain the
+ // function signature of the incoming argument and add control properties
+ // on the return value.
-function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
+ // @ts-ignore
+ return memoized;
+}
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
+module.exports = memize;
- ownKeys.forEach(function (key) {
- Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
- });
- }
-
- return target;
-}
/***/ })