: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
for (var i = 0; i < length; i++) {
if (!isFunction$1(obj[methods[i]])) return false;
// If we are testing against `WeakMap`, we need to ensure that
// `obj` doesn't have a `forEach` method in order to distinguish
// it from a regular `Map`.
return methods !== weakMapMethods || !isFunction$1(obj[forEachName]);
// In the interest of compact minification, we write
// each string in the fingerprints only once.
var forEachName = 'forEach',
commonInit = ['clear', 'delete'],
mapTail = ['get', hasName, 'set'];
// `Map`, `WeakMap` and `Set` each have slightly different
// combinations of the above sublists.
var mapMethods = commonInit.concat(forEachName, mapTail),
weakMapMethods = commonInit.concat(mapTail),
setMethods = ['add'].concat(commonInit, forEachName, hasName);
var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map');
var isWeakMap = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap');
var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester('Set');
var isWeakSet = tagTester('WeakSet');
// Retrieve the values of an object's properties.
var length = _keys.length;
var values = Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[_keys[i]];
// Convert an object into a list of `[key, value]` pairs.
// The opposite of `_.object` with one argument.
var length = _keys.length;
var pairs = Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [_keys[i], obj[_keys[i]]];
// Invert the keys and values of an object. The values must be serializable.
for (var i = 0, length = _keys.length; i < length; i++) {
result[obj[_keys[i]]] = _keys[i];
// Return a sorted list of the function names available on the object.
function functions(obj) {
if (isFunction$1(obj[key])) names.push(key);
// An internal function for creating assigner functions.
function createAssigner(keysFunc, defaults) {
var length = arguments.length;
if (defaults) obj = Object(obj);
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
var source = arguments[index],
for (var i = 0; i < l; i++) {
if (!defaults || obj[key] === void 0) obj[key] = source[key];
// Extend a given object with all the properties in passed-in object(s).
var extend = createAssigner(allKeys);
// Assigns a given object with all the own properties in the passed-in
// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
var extendOwn = createAssigner(keys);
// Fill in a given object with default properties.
var defaults = createAssigner(allKeys, true);
// Create a naked function reference for surrogate-prototype-swapping.
// An internal function for creating a new object that inherits from another.
function baseCreate(prototype) {
if (!isObject(prototype)) return {};
if (nativeCreate) return nativeCreate(prototype);
Ctor.prototype = prototype;
// Creates an object that inherits from the given prototype object.
// If additional properties are provided then they will be added to the
function create(prototype, props) {
var result = baseCreate(prototype);
if (props) extendOwn(result, props);
// Create a (shallow-cloned) duplicate of an object.
if (!isObject(obj)) return obj;
return isArray(obj) ? obj.slice() : extend({}, obj);
// Invokes `interceptor` with the `obj` and then returns `obj`.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
function tap(obj, interceptor) {
// Normalize a (deep) property `path` to array.
// Like `_.iteratee`, this function can be customized.
function toPath$1(path) {
return isArray(path) ? path : [path];
// Internal wrapper for `_.toPath` to enable minification.
// Similar to `cb` for `_.iteratee`.
// Internal function to obtain a nested property in `obj` along `path`.
function deepGet(obj, path) {
var length = path.length;
for (var i = 0; i < length; i++) {
if (obj == null) return void 0;
return length ? obj : void 0;
// Get the value of the (deep) property on `path` from `object`.
// If any property in `path` does not exist or if the value is
// `undefined`, return `defaultValue` instead.
// The `path` is normalized through `_.toPath`.
function get(object, path, defaultValue) {
var value = deepGet(object, toPath(path));
return isUndefined(value) ? defaultValue : value;
// Shortcut function for checking if an object has a given property directly on
// itself (in other words, not on a prototype). Unlike the internal `has`
// function, this public version can also traverse nested properties.
function has(obj, path) {
var length = path.length;
for (var i = 0; i < length; i++) {
if (!has$1(obj, key)) return false;
// Keep the identity function around for default iteratees.
function identity(value) {
// Returns a predicate for checking whether an object has a given set of
function matcher(attrs) {
attrs = extendOwn({}, attrs);
return isMatch(obj, attrs);
// Creates a function that, when passed an object, will traverse that object’s
// properties down the given `path`, specified as an array of keys or indices.
function property(path) {
return deepGet(obj, path);
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
function optimizeCb(func, context, argCount) {
if (context === void 0) return func;
switch (argCount == null ? 3 : argCount) {
case 1: return function(value) {
return func.call(context, value);
// The 2-argument case is omitted because we’re not using it.
case 3: return function(value, index, collection) {
return func.call(context, value, index, collection);
case 4: return function(accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
return func.apply(context, arguments);
// An internal function to generate callbacks that can be applied to each
// element in a collection, returning the desired result — either `_.identity`,
// an arbitrary callback, a property matcher, or a property accessor.
function baseIteratee(value, context, argCount) {
if (value == null) return identity;
if (isFunction$1(value)) return optimizeCb(value, context, argCount);
if (isObject(value) && !isArray(value)) return matcher(value);
// External wrapper for our callback generator. Users may customize
// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
// This abstraction hides the internal-only `argCount` argument.
function iteratee(value, context) {
return baseIteratee(value, context, Infinity);
// The function we call internally to generate a callback. It invokes
// `_.iteratee` if overridden, otherwise `baseIteratee`.
function cb(value, context, argCount) {
if (_$1.iteratee !== iteratee) return _$1.iteratee(value, context);
return baseIteratee(value, context, argCount);
// Returns the results of applying the `iteratee` to each element of `obj`.
// In contrast to `_.map` it returns an object.
function mapObject(obj, iteratee, context) {
iteratee = cb(iteratee, context);
for (var index = 0; index < length; index++) {
var currentKey = _keys[index];
results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
// Predicate-generating function. Often useful outside of Underscore.
// Generates a function for a given object that returns a given property.
function propertyOf(obj) {
if (obj == null) return noop;
// Run a function **n** times.
function times(n, iteratee, context) {
var accum = Array(Math.max(0, n));
iteratee = optimizeCb(iteratee, context, 1);
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
// Return a random integer between `min` and `max` (inclusive).
function random(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
// A (possibly faster) way to get the current timestamp as an integer.
var now = Date.now || function() {
return new Date().getTime();
// Internal helper to generate functions for escaping and unescaping strings
// to/from HTML interpolation.
function createEscaper(map) {
var escaper = function(match) {
// Regexes for identifying a key that needs to be escaped.
var source = '(?:' + keys(map).join('|') + ')';
var testRegexp = RegExp(source);
var replaceRegexp = RegExp(source, 'g');
return function(string) {
string = string == null ? '' : '' + string;
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
// Internal list of HTML entities for escaping.
// Function for escaping strings to HTML interpolation.
var _escape = createEscaper(escapeMap);
// Internal list of HTML entities for unescaping.
var unescapeMap = invert(escapeMap);
// Function for unescaping strings from HTML interpolation.
var _unescape = createEscaper(unescapeMap);
// By default, Underscore uses ERB-style template delimiters. Change the
// following template settings to use alternative delimiters.
var templateSettings = _$1.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
// When customizing `_.templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
// Certain characters need to be escaped so that they can be put into a
var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
function escapeChar(match) {
return '\\' + escapes[match];
// In order to prevent third-party code injection through
// `_.templateSettings.variable`, we test it against the following regular
// expression. It is intentionally a bit more liberal than just matching valid
// identifiers, but still prevents possible loopholes through defaults or
// destructuring assignment.
var bareIdentifier = /^\s*(\w|\$)+\s*$/;
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
// NB: `oldSettings` only exists for backwards compatibility.
function template(text, settings, oldSettings) {
if (!settings && oldSettings) settings = oldSettings;
settings = defaults({}, settings, _$1.templateSettings);
// Combine delimiters into one regular expression via alternation.
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source
].join('|') + '|$', 'g');
// Compile the template source, escaping string literals appropriately.
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
index = offset + match.length;
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
} else if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
source += "';\n" + evaluate + "\n__p+='";
// Adobe VMs need the match returned to produce the correct offset.
var argument = settings.variable;
// Insure against third-party code injection. (CVE-2021-23358)
if (!bareIdentifier.test(argument)) throw new Error(
'variable is not a bare identifier: ' + argument
// If a variable is not specified, place data values in local scope.
source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + 'return __p;\n';
render = new Function(argument, '_', source);
var template = function(data) {
return render.call(this, data, _$1);
// Provide the compiled source as a convenience for precompilation.
template.source = 'function(' + argument + '){\n' + source + '}';
// Traverses the children of `obj` along `path`. If a child is a function, it
// is invoked with its parent as context. Returns the value of the final
// child, or `fallback` if any child is undefined.
function result(obj, path, fallback) {
var length = path.length;
return isFunction$1(fallback) ? fallback.call(obj) : fallback;
for (var i = 0; i < length; i++) {
var prop = obj == null ? void 0 : obj[path[i]];
i = length; // Ensure we don't continue iterating.
obj = isFunction$1(prop) ? prop.call(obj) : prop;
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
function uniqueId(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
// Start chaining a wrapped Underscore object.
// Internal function to execute `sourceFunc` bound to `context` with optional
// `args`. Determines whether to execute a function as a constructor or as a
function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
var self = baseCreate(sourceFunc.prototype);
var result = sourceFunc.apply(self, args);
if (isObject(result)) return result;
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context. `_` acts
// as a placeholder by default, allowing any combination of arguments to be
// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
var partial = restArguments(function(func, boundArgs) {
var placeholder = partial.placeholder;
var position = 0, length = boundArgs.length;