rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -1,174 +1,6 @@
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 9756:
/***/ (function(module) {
/**
* 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.
*/
/**
* 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,
len = arguments.length,
args, i;
searchCache: while ( node ) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if ( node.args.length !== arguments.length ) {
node = node.next;
continue;
}
// Check whether node arguments match arguments values
for ( i = 0; i < len; i++ ) {
if ( node.args[ i ] !== arguments[ i ] ) {
node = node.next;
continue searchCache;
}
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if ( node !== head ) {
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
if ( node === tail ) {
tail = node.prev;
}
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
/** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
/** @type {MemizeCacheNode} */ ( head ).prev = node;
head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
// Create a copy of arguments (avoid leaking deoptimization)
args = new Array( len );
for ( i = 0; i < len; i++ ) {
args[ i ] = arguments[ i ];
}
node = {
args: args,
// Generate the result from original function
val: fn.apply( null, args ),
};
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if ( head ) {
head.prev = node;
node.next = head;
} else {
// If no head, follows that there's no tail (at initial or reset)
tail = node;
}
// Trim tail if we're reached max size and are pending cache insertion
if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
/** @type {MemizeCacheNode} */ ( tail ).next = null;
} else {
size++;
}
head = node;
return node.val;
}
memoized.clear = function() {
head = null;
tail = null;
size = 0;
};
if ( false ) {}
// 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.
// @ts-ignore
return memoized;
}
module.exports = memize;
/***/ }),
/***/ 124:
/***/ (function(module, exports, __webpack_require__) {
@@ -500,9 +332,168 @@ __webpack_require__.d(__webpack_exports__, {
"subscribe": function() { return /* reexport */ subscribe; }
});
// EXTERNAL MODULE: ./node_modules/memize/index.js
var memize = __webpack_require__(9756);
var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
/**
* 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.
*/
/**
* 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 {(...args: any[]) => any} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {((...args: Parameters<F>) => ReturnType<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,
len = arguments.length,
args,
i;
searchCache: while (node) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if (node.args.length !== arguments.length) {
node = node.next;
continue;
}
// Check whether node arguments match arguments values
for (i = 0; i < len; i++) {
if (node.args[i] !== arguments[i]) {
node = node.next;
continue searchCache;
}
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if (node !== head) {
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
if (node === tail) {
tail = node.prev;
}
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
/** @type {MemizeCacheNode} */ (node.prev).next = node.next;
if (node.next) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
/** @type {MemizeCacheNode} */ (head).prev = node;
head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
// Create a copy of arguments (avoid leaking deoptimization)
args = new Array(len);
for (i = 0; i < len; i++) {
args[i] = arguments[i];
}
node = {
args: args,
// Generate the result from original function
val: fn.apply(null, args),
};
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if (head) {
head.prev = node;
node.next = head;
} else {
// If no head, follows that there's no tail (at initial or reset)
tail = node;
}
// Trim tail if we're reached max size and are pending cache insertion
if (size === /** @type {MemizeOptions} */ (options).maxSize) {
tail = /** @type {MemizeCacheNode} */ (tail).prev;
/** @type {MemizeCacheNode} */ (tail).next = null;
} else {
size++;
}
head = node;
return node.val;
}
memoized.clear = function () {
head = null;
tail = null;
size = 0;
};
// 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.
// @ts-ignore
return memoized;
}
// EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
var sprintf = __webpack_require__(124);
var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
@@ -520,7 +511,7 @@ var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
* @param {...*} args Arguments to pass to `console.error`
*/
const logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
const logErrorOnce = memize(console.error); // eslint-disable-line no-console
/**
* Returns a formatted string. If an error occurs in applying the format, the
@@ -534,12 +525,8 @@ const logErrorOnce = memize_default()(console.error); // eslint-disable-line no-
* @return {string} The formatted string.
*/
function sprintf_sprintf(format) {
function sprintf_sprintf(format, ...args) {
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().sprintf(format, ...args);
} catch (error) {
if (error instanceof Error) {
@@ -1252,27 +1239,21 @@ const createI18n = (initialData, initialDomain, hooks) => {
/** @type {GetLocaleData} */
const getLocaleData = function () {
let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
return tannin.data[domain];
};
const getLocaleData = (domain = 'default') => tannin.data[domain];
/**
* @param {LocaleData} [data]
* @param {string} [domain]
*/
const doSetLocaleData = function (data) {
var _tannin$data$domain;
let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
const doSetLocaleData = (data, domain = 'default') => {
tannin.data[domain] = { ...tannin.data[domain],
...data
}; // Populate default domain configuration (supported locale date which omits
// a plural forms expression).
tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''],
...((_tannin$data$domain = tannin.data[domain]) === null || _tannin$data$domain === void 0 ? void 0 : _tannin$data$domain[''])
...tannin.data[domain]?.['']
}; // Clean up cached plural forms functions cache as it might be updated.
delete tannin.pluralForms[domain];
@@ -1287,17 +1268,14 @@ const createI18n = (initialData, initialDomain, hooks) => {
/** @type {AddLocaleData} */
const addLocaleData = function (data) {
var _tannin$data$domain2;
let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
const addLocaleData = (data, domain = 'default') => {
tannin.data[domain] = { ...tannin.data[domain],
...data,
// Populate default domain configuration (supported locale date which omits
// a plural forms expression).
'': { ...DEFAULT_LOCALE_DATA[''],
...((_tannin$data$domain2 = tannin.data[domain]) === null || _tannin$data$domain2 === void 0 ? void 0 : _tannin$data$domain2['']),
...(data === null || data === void 0 ? void 0 : data[''])
...tannin.data[domain]?.[''],
...data?.['']
}
}; // Clean up cached plural forms functions cache as it might be updated.
@@ -1331,13 +1309,7 @@ const createI18n = (initialData, initialDomain, hooks) => {
*/
const dcnpgettext = function () {
let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
let context = arguments.length > 1 ? arguments[1] : undefined;
let single = arguments.length > 2 ? arguments[2] : undefined;
let plural = arguments.length > 3 ? arguments[3] : undefined;
let number = arguments.length > 4 ? arguments[4] : undefined;
const dcnpgettext = (domain = 'default', context, single, plural, number) => {
if (!tannin.data[domain]) {
// Use `doSetLocaleData` to set silently, without notifying listeners.
doSetLocaleData(undefined, domain);
@@ -1348,10 +1320,7 @@ const createI18n = (initialData, initialDomain, hooks) => {
/** @type {GetFilterDomain} */
const getFilterDomain = function () {
let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
return domain;
};
const getFilterDomain = (domain = 'default') => domain;
/** @type {__} */
@@ -1488,10 +1457,8 @@ const createI18n = (initialData, initialDomain, hooks) => {
const hasTranslation = (single, context, domain) => {
var _tannin$data, _tannin$data2;
const key = context ? context + '\u0004' + single : single;
let result = !!((_tannin$data = tannin.data) !== null && _tannin$data !== void 0 && (_tannin$data2 = _tannin$data[domain !== null && domain !== void 0 ? domain : 'default']) !== null && _tannin$data2 !== void 0 && _tannin$data2[key]);
let result = !!tannin.data?.[domain !== null && domain !== void 0 ? domain : 'default']?.[key];
if (hooks) {
/**