PageSourceSearch

https://link4u.cc/assets/js/app.js

js link4u.cc collected 2026-10-01 12:17:48 UTC 688,620 bytes, 21,419 lines download raw bytes

vendor: 78 bytes, lines 1-3
1/******/ (() => { // webpackBootstrap
2/******/ 	var __webpack_modules__ = ({
3
vendor: 77,059 bytes, lines 4-1961
4/***/ "./node_modules/alpinejs/dist/alpine.js":
5/*!**********************************************!*\
6  !*** ./node_modules/alpinejs/dist/alpine.js ***!
7  \**********************************************/
8/***/ (function(module) {
9
10(function (global, factory) {
11   true ? module.exports = factory() :
12  0;
13}(this, (function () { 'use strict';
14
15  function _defineProperty(obj, key, value) {
16    if (key in obj) {
17      Object.defineProperty(obj, key, {
18        value: value,
19        enumerable: true,
20        configurable: true,
21        writable: true
22      });
23    } else {
24      obj[key] = value;
25    }
26
27    return obj;
28  }
29
30  function ownKeys(object, enumerableOnly) {
31    var keys = Object.keys(object);
32
33    if (Object.getOwnPropertySymbols) {
34      var symbols = Object.getOwnPropertySymbols(object);
35      if (enumerableOnly) symbols = symbols.filter(function (sym) {
36        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
37      });
38      keys.push.apply(keys, symbols);
39    }
40
41    return keys;
42  }
43
44  function _objectSpread2(target) {
45    for (var i = 1; i < arguments.length; i++) {
46      var source = arguments[i] != null ? arguments[i] : {};
47
48      if (i % 2) {
49        ownKeys(Object(source), true).forEach(function (key) {
50          _defineProperty(target, key, source[key]);
51        });
52      } else if (Object.getOwnPropertyDescriptors) {
53        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
54      } else {
55        ownKeys(Object(source)).forEach(function (key) {
56          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
57        });
58      }
59    }
60
61    return target;
62  }
63
64  // Thanks @stimulus:
65  // https://github.com/stimulusjs/stimulus/blob/master/packages/%40stimulus/core/src/application.ts
66  function domReady() {
67    return new Promise(resolve => {
68      if (document.readyState == "loading") {
69        document.addEventListener("DOMContentLoaded", resolve);
70      } else {
71        resolve();
72      }
73    });
74  }
75  function arrayUnique(array) {
76    return Array.from(new Set(array));
77  }
78  function isTesting() {
79    return navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom");
80  }
81  function checkedAttrLooseCompare(valueA, valueB) {
82    return valueA == valueB;
83  }
84  function warnIfMalformedTemplate(el, directive) {
85    if (el.tagName.toLowerCase() !== 'template') {
86      console.warn(`Alpine: [${directive}] directive should only be added to <template> tags. See https://github.com/alpinejs/alpine#${directive}`);
87    } else if (el.content.childElementCount !== 1) {
88      console.warn(`Alpine: <template> tag with [${directive}] encountered with an unexpected number of root elements. Make sure <template> has a single root element. `);
89    }
90  }
91  function kebabCase(subject) {
92    return subject.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/[_\s]/, '-').toLowerCase();
93  }
94  function camelCase(subject) {
95    return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
96  }
97  function walk(el, callback) {
98    if (callback(el) === false) return;
99    let node = el.firstElementChild;
100
101    while (node) {
102      walk(node, callback);
103      node = node.nextElementSibling;
104    }
105  }
106  function debounce(func, wait) {
107    var timeout;
108    return function () {
109      var context = this,
110          args = arguments;
111
112      var later = function later() {
113        timeout = null;
114        func.apply(context, args);
115      };
116
117      clearTimeout(timeout);
118      timeout = setTimeout(later, wait);
119    };
120  }
121
122  const handleError = (el, expression, error) => {
123    console.warn(`Alpine Error: "${error}"\n\nExpression: "${expression}"\nElement:`, el);
124
125    if (!isTesting()) {
126      Object.assign(error, {
127        el,
128        expression
129      });
130      throw error;
131    }
132  };
133
134  function tryCatch(cb, {
135    el,
136    expression
137  }) {
138    try {
139      const value = cb();
140      return value instanceof Promise ? value.catch(e => handleError(el, expression, e)) : value;
141    } catch (e) {
142      handleError(el, expression, e);
143    }
144  }
145
146  function saferEval(el, expression, dataContext, additionalHelperVariables = {}) {
147    return tryCatch(() => {
148      if (typeof expression === 'function') {
149        return expression.call(dataContext);
150      }
151
152      return new Function(['$data', ...Object.keys(additionalHelperVariables)], `var __alpine_result; with($data) { __alpine_result = ${expression} }; return __alpine_result`)(dataContext, ...Object.values(additionalHelperVariables));
153    }, {
154      el,
155      expression
156    });
157  }
158  function saferEvalNoReturn(el, expression, dataContext, additionalHelperVariables = {}) {
159    return tryCatch(() => {
160      if (typeof expression === 'function') {
161        return Promise.resolve(expression.call(dataContext, additionalHelperVariables['$event']));
162      }
163
164      let AsyncFunction = Function;
165      /* MODERN-ONLY:START */
166
167      AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
168      /* MODERN-ONLY:END */
169      // For the cases when users pass only a function reference to the caller: `x-on:click="foo"`
170      // Where "foo" is a function. Also, we'll pass the function the event instance when we call it.
171
172      if (Object.keys(dataContext).includes(expression)) {
173        let methodReference = new Function(['dataContext', ...Object.keys(additionalHelperVariables)], `with(dataContext) { return ${expression} }`)(dataContext, ...Object.values(additionalHelperVariables));
174
175        if (typeof methodReference === 'function') {
176          return Promise.resolve(methodReference.call(dataContext, additionalHelperVariables['$event']));
177        } else {
178          return Promise.resolve();
179        }
180      }
181
182      return Promise.resolve(new AsyncFunction(['dataContext', ...Object.keys(additionalHelperVariables)], `with(dataContext) { ${expression} }`)(dataContext, ...Object.values(additionalHelperVariables)));
183    }, {
184      el,
185      expression
186    });
187  }
188  const xAttrRE = /^x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref|spread)\b/;
189  function isXAttr(attr) {
190    const name = replaceAtAndColonWithStandardSyntax(attr.name);
191    return xAttrRE.test(name);
192  }
193  function getXAttrs(el, component, type) {
194    let directives = Array.from(el.attributes).filter(isXAttr).map(parseHtmlAttribute); // Get an object of directives from x-spread.
195
196    let spreadDirective = directives.filter(directive => directive.type === 'spread')[0];
197
198    if (spreadDirective) {
199      let spreadObject = saferEval(el, spreadDirective.expression, component.$data); // Add x-spread directives to the pile of existing directives.
200
201      directives = directives.concat(Object.entries(spreadObject).map(([name, value]) => parseHtmlAttribute({
202        name,
203        value
204      })));
205    }
206
207    if (type) return directives.filter(i => i.type === type);
208    return sortDirectives(directives);
209  }
210
211  function sortDirectives(directives) {
212    let directiveOrder = ['bind', 'model', 'show', 'catch-all'];
213    return directives.sort((a, b) => {
214      let typeA = directiveOrder.indexOf(a.type) === -1 ? 'catch-all' : a.type;
215      let typeB = directiveOrder.indexOf(b.type) === -1 ? 'catch-all' : b.type;
216      return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
217    });
218  }
219
220  function parseHtmlAttribute({
221    name,
222    value
223  }) {
224    const normalizedName = replaceAtAndColonWithStandardSyntax(name);
225    const typeMatch = normalizedName.match(xAttrRE);
226    const valueMatch = normalizedName.match(/:([a-zA-Z0-9\-:]+)/);
227    const modifiers = normalizedName.match(/\.[^.\]]+(?=[^\]]*$)/g) || [];
228    return {
229      type: typeMatch ? typeMatch[1] : null,
230      value: valueMatch ? valueMatch[1] : null,
231      modifiers: modifiers.map(i => i.replace('.', '')),
232      expression: value
233    };
234  }
235  function isBooleanAttr(attrName) {
236    // As per HTML spec table https://html.spec.whatwg.org/multipage/indices.html#attributes-3:boolean-attribute
237    // Array roughly ordered by estimated usage
238    const booleanAttributes = ['disabled', 'checked', 'required', 'readonly', 'hidden', 'open', 'selected', 'autofocus', 'itemscope', 'multiple', 'novalidate', 'allowfullscreen', 'allowpaymentrequest', 'formnovalidate', 'autoplay', 'controls', 'loop', 'muted', 'playsinline', 'default', 'ismap', 'reversed', 'async', 'defer', 'nomodule'];
239    return booleanAttributes.includes(attrName);
240  }
241  function replaceAtAndColonWithStandardSyntax(name) {
242    if (name.startsWith('@')) {
243      return name.replace('@', 'x-on:');
244    } else if (name.startsWith(':')) {
245      return name.replace(':', 'x-bind:');
246    }
247
248    return name;
249  }
250  function convertClassStringToArray(classList, filterFn = Boolean) {
251    return classList.split(' ').filter(filterFn);
252  }
253  const TRANSITION_TYPE_IN = 'in';
254  const TRANSITION_TYPE_OUT = 'out';
255  const TRANSITION_CANCELLED = 'cancelled';
256  function transitionIn(el, show, reject, component, forceSkip = false) {
257    // We don't want to transition on the initial page load.
258    if (forceSkip) return show();
259
260    if (el.__x_transition && el.__x_transition.type === TRANSITION_TYPE_IN) {
261      // there is already a similar transition going on, this was probably triggered by
262      // a change in a different property, let's just leave the previous one doing its job
263      return;
264    }
265
266    const attrs = getXAttrs(el, component, 'transition');
267    const showAttr = getXAttrs(el, component, 'show')[0]; // If this is triggered by a x-show.transition.
268
269    if (showAttr && showAttr.modifiers.includes('transition')) {
270      let modifiers = showAttr.modifiers; // If x-show.transition.out, we'll skip the "in" transition.
271
272      if (modifiers.includes('out') && !modifiers.includes('in')) return show();
273      const settingBothSidesOfTransition = modifiers.includes('in') && modifiers.includes('out'); // If x-show.transition.in...out... only use "in" related modifiers for this transition.
274
275      modifiers = settingBothSidesOfTransition ? modifiers.filter((i, index) => index < modifiers.indexOf('out')) : modifiers;
276      transitionHelperIn(el, modifiers, show, reject); // Otherwise, we can assume x-transition:enter.
277    } else if (attrs.some(attr => ['enter', 'enter-start', 'enter-end'].includes(attr.value))) {
278      transitionClassesIn(el, component, attrs, show, reject);
279    } else {
280      // If neither, just show that damn thing.
281      show();
282    }
283  }
284  function transitionOut(el, hide, reject, component, forceSkip = false) {
285    // We don't want to transition on the initial page load.
286    if (forceSkip) return hide();
287
288    if (el.__x_transition && el.__x_transition.type === TRANSITION_TYPE_OUT) {
289      // there is already a similar transition going on, this was probably triggered by
290      // a change in a different property, let's just leave the previous one doing its job
291      return;
292    }
293
294    const attrs = getXAttrs(el, component, 'transition');
295    const showAttr = getXAttrs(el, component, 'show')[0];
296
297    if (showAttr && showAttr.modifiers.includes('transition')) {
298      let modifiers = showAttr.modifiers;
299      if (modifiers.includes('in') && !modifiers.includes('out')) return hide();
300      const settingBothSidesOfTransition = modifiers.includes('in') && modifiers.includes('out');
301      modifiers = settingBothSidesOfTransition ? modifiers.filter((i, index) => index > modifiers.indexOf('out')) : modifiers;
302      transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hide, reject);
303    } else if (attrs.some(attr => ['leave', 'leave-start', 'leave-end'].includes(attr.value))) {
304      transitionClassesOut(el, component, attrs, hide, reject);
305    } else {
306      hide();
307    }
308  }
309  function transitionHelperIn(el, modifiers, showCallback, reject) {
310    // Default values inspired by: https://material.io/design/motion/speed.html#duration
311    const styleValues = {
312      duration: modifierValue(modifiers, 'duration', 150),
313      origin: modifierValue(modifiers, 'origin', 'center'),
314      first: {
315        opacity: 0,
316        scale: modifierValue(modifiers, 'scale', 95)
317      },
318      second: {
319        opacity: 1,
320        scale: 100
321      }
322    };
323    transitionHelper(el, modifiers, showCallback, () => {}, reject, styleValues, TRANSITION_TYPE_IN);
324  }
325  function transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hideCallback, reject) {
326    // Make the "out" transition .5x slower than the "in". (Visually better)
327    // HOWEVER, if they explicitly set a duration for the "out" transition,
328    // use that.
329    const duration = settingBothSidesOfTransition ? modifierValue(modifiers, 'duration', 150) : modifierValue(modifiers, 'duration', 150) / 2;
330    const styleValues = {
331      duration: duration,
332      origin: modifierValue(modifiers, 'origin', 'center'),
333      first: {
334        opacity: 1,
335        scale: 100
336      },
337      second: {
338        opacity: 0,
339        scale: modifierValue(modifiers, 'scale', 95)
340      }
341    };
342    transitionHelper(el, modifiers, () => {}, hideCallback, reject, styleValues, TRANSITION_TYPE_OUT);
343  }
344
345  function modifierValue(modifiers, key, fallback) {
346    // If the modifier isn't present, use the default.
347    if (modifiers.indexOf(key) === -1) return fallback; // If it IS present, grab the value after it: x-show.transition.duration.500ms
348
349    const rawValue = modifiers[modifiers.indexOf(key) + 1];
350    if (!rawValue) return fallback;
351
352    if (key === 'scale') {
353      // Check if the very next value is NOT a number and return the fallback.
354      // If x-show.transition.scale, we'll use the default scale value.
355      // That is how a user opts out of the opacity transition.
356      if (!isNumeric(rawValue)) return fallback;
357    }
358
359    if (key === 'duration') {
360      // Support x-show.transition.duration.500ms && duration.500
361      let match = rawValue.match(/([0-9]+)ms/);
362      if (match) return match[1];
363    }
364
365    if (key === 'origin') {
366      // Support chaining origin directions: x-show.transition.top.right
367      if (['top', 'right', 'left', 'center', 'bottom'].includes(modifiers[modifiers.indexOf(key) + 2])) {
368        return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(' ');
369      }
370    }
371
372    return rawValue;
373  }
374
375  function transitionHelper(el, modifiers, hook1, hook2, reject, styleValues, type) {
376    // clear the previous transition if exists to avoid caching the wrong styles
377    if (el.__x_transition) {
378      el.__x_transition.cancel && el.__x_transition.cancel();
379    } // If the user set these style values, we'll put them back when we're done with them.
380
381
382    const opacityCache = el.style.opacity;
383    const transformCache = el.style.transform;
384    const transformOriginCache = el.style.transformOrigin; // If no modifiers are present: x-show.transition, we'll default to both opacity and scale.
385
386    const noModifiers = !modifiers.includes('opacity') && !modifiers.includes('scale');
387    const transitionOpacity = noModifiers || modifiers.includes('opacity');
388    const transitionScale = noModifiers || modifiers.includes('scale'); // These are the explicit stages of a transition (same stages for in and for out).
389    // This way you can get a birds eye view of the hooks, and the differences
390    // between them.
391
392    const stages = {
393      start() {
394        if (transitionOpacity) el.style.opacity = styleValues.first.opacity;
395        if (transitionScale) el.style.transform = `scale(${styleValues.first.scale / 100})`;
396      },
397
398      during() {
399        if (transitionScale) el.style.transformOrigin = styleValues.origin;
400        el.style.transitionProperty = [transitionOpacity ? `opacity` : ``, transitionScale ? `transform` : ``].join(' ').trim();
401        el.style.transitionDuration = `${styleValues.duration / 1000}s`;
402        el.style.transitionTimingFunction = `cubic-bezier(0.4, 0.0, 0.2, 1)`;
403      },
404
405      show() {
406        hook1();
407      },
408
409      end() {
410        if (transitionOpacity) el.style.opacity = styleValues.second.opacity;
411        if (transitionScale) el.style.transform = `scale(${styleValues.second.scale / 100})`;
412      },
413
414      hide() {
415        hook2();
416      },
417
418      cleanup() {
419        if (transitionOpacity) el.style.opacity = opacityCache;
420        if (transitionScale) el.style.transform = transformCache;
421        if (transitionScale) el.style.transformOrigin = transformOriginCache;
422        el.style.transitionProperty = null;
423        el.style.transitionDuration = null;
424        el.style.transitionTimingFunction = null;
425      }
426
427    };
428    transition(el, stages, type, reject);
429  }
430
431  const ensureStringExpression = (expression, el, component) => {
432    return typeof expression === 'function' ? component.evaluateReturnExpression(el, expression) : expression;
433  };
434
435  function transitionClassesIn(el, component, directives, showCallback, reject) {
436    const enter = convertClassStringToArray(ensureStringExpression((directives.find(i => i.value === 'enter') || {
437      expression: ''
438    }).expression, el, component));
439    const enterStart = convertClassStringToArray(ensureStringExpression((directives.find(i => i.value === 'enter-start') || {
440      expression: ''
441    }).expression, el, component));
442    const enterEnd = convertClassStringToArray(ensureStringExpression((directives.find(i => i.value === 'enter-end') || {
443      expression: ''
444    }).expression, el, component));
445    transitionClasses(el, enter, enterStart, enterEnd, showCallback, () => {}, TRANSITION_TYPE_IN, reject);
446  }
447  function transitionClassesOut(el, component, directives, hideCallback, reject) {
448    const leave = convertClassStringToArray(ensureStringExpression((directives.find(i => i.value === 'leave') || {
449      expression: ''
450    }).expression, el, component));
451    const leaveStart = convertClassStringToArray(ensureStringExpression((directives.find(i => i.value === 'leave-start') || {
452      expression: ''
453    }).expression, el, component));
454    const leaveEnd = convertClassStringToArray(ensureStringExpression((directives.find(i => i.value === 'leave-end') || {
455      expression: ''
456    }).expression, el, component));
457    transitionClasses(el, leave, leaveStart, leaveEnd, () => {}, hideCallback, TRANSITION_TYPE_OUT, reject);
458  }
459  function transitionClasses(el, classesDuring, classesStart, classesEnd, hook1, hook2, type, reject) {
460    // clear the previous transition if exists to avoid caching the wrong classes
461    if (el.__x_transition) {
462      el.__x_transition.cancel && el.__x_transition.cancel();
463    }
464
465    const originalClasses = el.__x_original_classes || [];
466    const stages = {
467      start() {
468        el.classList.add(...classesStart);
469      },
470
471      during() {
472        el.classList.add(...classesDuring);
473      },
474
475      show() {
476        hook1();
477      },
478
479      end() {
480        // Don't remove classes that were in the original class attribute.
481        el.classList.remove(...classesStart.filter(i => !originalClasses.includes(i)));
482        el.classList.add(...classesEnd);
483      },
484
485      hide() {
486        hook2();
487      },
488
489      cleanup() {
490        el.classList.remove(...classesDuring.filter(i => !originalClasses.includes(i)));
491        el.classList.remove(...classesEnd.filter(i => !originalClasses.includes(i)));
492      }
493
494    };
495    transition(el, stages, type, reject);
496  }
497  function transition(el, stages, type, reject) {
498    const finish = once(() => {
499      stages.hide(); // Adding an "isConnected" check, in case the callback
500      // removed the element from the DOM.
501
502      if (el.isConnected) {
503        stages.cleanup();
504      }
505
506      delete el.__x_transition;
507    });
508    el.__x_transition = {
509      // Set transition type so we can avoid clearing transition if the direction is the same
510      type: type,
511      // create a callback for the last stages of the transition so we can call it
512      // from different point and early terminate it. Once will ensure that function
513      // is only called one time.
514      cancel: once(() => {
515        reject(TRANSITION_CANCELLED);
516        finish();
517      }),
518      finish,
519      // This store the next animation frame so we can cancel it
520      nextFrame: null
521    };
522    stages.start();
523    stages.during();
524    el.__x_transition.nextFrame = requestAnimationFrame(() => {
525      // Note: Safari's transitionDuration property will list out comma separated transition durations
526      // for every single transition property. Let's grab the first one and call it a day.
527      let duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, '').replace('s', '')) * 1000;
528
529      if (duration === 0) {
530        duration = Number(getComputedStyle(el).animationDuration.replace('s', '')) * 1000;
531      }
532
533      stages.show();
534      el.__x_transition.nextFrame = requestAnimationFrame(() => {
535        stages.end();
536        setTimeout(el.__x_transition.finish, duration);
537      });
538    });
539  }
540  function isNumeric(subject) {
541    return !Array.isArray(subject) && !isNaN(subject);
542  } // Thanks @vuejs
543  // https://github.com/vuejs/vue/blob/4de4649d9637262a9b007720b59f80ac72a5620c/src/shared/util.js
544
545  function once(callback) {
546    let called = false;
547    return function () {
548      if (!called) {
549        called = true;
550        callback.apply(this, arguments);
551      }
552    };
553  }
554
555  function handleForDirective(component, templateEl, expression, initialUpdate, extraVars) {
556    warnIfMalformedTemplate(templateEl, 'x-for');
557    let iteratorNames = typeof expression === 'function' ? parseForExpression(component.evaluateReturnExpression(templateEl, expression)) : parseForExpression(expression);
558    let items = evaluateItemsAndReturnEmptyIfXIfIsPresentAndFalseOnElement(component, templateEl, iteratorNames, extraVars); // As we walk the array, we'll also walk the DOM (updating/creating as we go).
559
560    let currentEl = templateEl;
561    items.forEach((item, index) => {
562      let iterationScopeVariables = getIterationScopeVariables(iteratorNames, item, index, items, extraVars());
563      let currentKey = generateKeyForIteration(component, templateEl, index, iterationScopeVariables);
564      let nextEl = lookAheadForMatchingKeyedElementAndMoveItIfFound(currentEl.nextElementSibling, currentKey); // If we haven't found a matching key, insert the element at the current position.
565
566      if (!nextEl) {
567        nextEl = addElementInLoopAfterCurrentEl(templateEl, currentEl); // And transition it in if it's not the first page load.
568
569        transitionIn(nextEl, () => {}, () => {}, component, initialUpdate);
570        nextEl.__x_for = iterationScopeVariables;
571        component.initializeElements(nextEl, () => nextEl.__x_for); // Otherwise update the element we found.
572      } else {
573        // Temporarily remove the key indicator to allow the normal "updateElements" to work.
574        delete nextEl.__x_for_key;
575        nextEl.__x_for = iterationScopeVariables;
576        component.updateElements(nextEl, () => nextEl.__x_for);
577      }
578
579      currentEl = nextEl;
580      currentEl.__x_for_key = currentKey;
581    });
582    removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component);
583  } // This was taken from VueJS 2.* core. Thanks Vue!
584
585  function parseForExpression(expression) {
586    let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
587    let stripParensRE = /^\(|\)$/g;
588    let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
589    let inMatch = String(expression).match(forAliasRE);
590    if (!inMatch) return;
591    let res = {};
592    res.items = inMatch[2].trim();
593    let item = inMatch[1].trim().replace(stripParensRE, '');
594    let iteratorMatch = item.match(forIteratorRE);
595
596    if (iteratorMatch) {
597      res.item = item.replace(forIteratorRE, '').trim();
598      res.index = iteratorMatch[1].trim();
599
600      if (iteratorMatch[2]) {
601        res.collection = iteratorMatch[2].trim();
602      }
603    } else {
604      res.item = item;
605    }
606
607    return res;
608  }
609
610  function getIterationScopeVariables(iteratorNames, item, index, items, extraVars) {
611    // We must create a new object, so each iteration has a new scope
612    let scopeVariables = extraVars ? _objectSpread2({}, extraVars) : {};
613    scopeVariables[iteratorNames.item] = item;
614    if (iteratorNames.index) scopeVariables[iteratorNames.index] = index;
615    if (iteratorNames.collection) scopeVariables[iteratorNames.collection] = items;
616    return scopeVariables;
617  }
618
619  function generateKeyForIteration(component, el, index, iterationScopeVariables) {
620    let bindKeyAttribute = getXAttrs(el, component, 'bind').filter(attr => attr.value === 'key')[0]; // If the dev hasn't specified a key, just return the index of the iteration.
621
622    if (!bindKeyAttribute) return index;
623    return component.evaluateReturnExpression(el, bindKeyAttribute.expression, () => iterationScopeVariables);
624  }
625
626  function evaluateItemsAndReturnEmptyIfXIfIsPresentAndFalseOnElement(component, el, iteratorNames, extraVars) {
627    let ifAttribute = getXAttrs(el, component, 'if')[0];
628
629    if (ifAttribute && !component.evaluateReturnExpression(el, ifAttribute.expression)) {
630      return [];
631    }
632
633    let items = component.evaluateReturnExpression(el, iteratorNames.items, extraVars); // This adds support for the `i in n` syntax.
634
635    if (isNumeric(items) && items >= 0) {
636      items = Array.from(Array(items).keys(), i => i + 1);
637    }
638
639    return items;
640  }
641
642  function addElementInLoopAfterCurrentEl(templateEl, currentEl) {
643    let clone = document.importNode(templateEl.content, true);
644    currentEl.parentElement.insertBefore(clone, currentEl.nextElementSibling);
645    return currentEl.nextElementSibling;
646  }
647
648  function lookAheadForMatchingKeyedElementAndMoveItIfFound(nextEl, currentKey) {
649    if (!nextEl) return; // If we are already past the x-for generated elements, we don't need to look ahead.
650
651    if (nextEl.__x_for_key === undefined) return; // If the the key's DO match, no need to look ahead.
652
653    if (nextEl.__x_for_key === currentKey) return nextEl; // If they don't, we'll look ahead for a match.
654    // If we find it, we'll move it to the current position in the loop.
655
656    let tmpNextEl = nextEl;
657
658    while (tmpNextEl) {
659      if (tmpNextEl.__x_for_key === currentKey) {
660        return tmpNextEl.parentElement.insertBefore(tmpNextEl, nextEl);
661      }
662
663      tmpNextEl = tmpNextEl.nextElementSibling && tmpNextEl.nextElementSibling.__x_for_key !== undefined ? tmpNextEl.nextElementSibling : false;
664    }
665  }
666
667  function removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component) {
668    var nextElementFromOldLoop = currentEl.nextElementSibling && currentEl.nextElementSibling.__x_for_key !== undefined ? currentEl.nextElementSibling : false;
669
670    while (nextElementFromOldLoop) {
671      let nextElementFromOldLoopImmutable = nextElementFromOldLoop;
672      let nextSibling = nextElementFromOldLoop.nextElementSibling;
673      transitionOut(nextElementFromOldLoop, () => {
674        nextElementFromOldLoopImmutable.remove();
675      }, () => {}, component);
676      nextElementFromOldLoop = nextSibling && nextSibling.__x_for_key !== undefined ? nextSibling : false;
677    }
678  }
679
680  function handleAttributeBindingDirective(component, el, attrName, expression, extraVars, attrType, modifiers) {
681    var value = component.evaluateReturnExpression(el, expression, extraVars);
682
683    if (attrName === 'value') {
684      if (Alpine.ignoreFocusedForValueBinding && document.activeElement.isSameNode(el)) return; // If nested model key is undefined, set the default value to empty string.
685
686      if (value === undefined && String(expression).match(/\./)) {
687        value = '';
688      }
689
690      if (el.type === 'radio') {
691        // Set radio value from x-bind:value, if no "value" attribute exists.
692        // If there are any initial state values, radio will have a correct
693        // "checked" value since x-bind:value is processed before x-model.
694        if (el.attributes.value === undefined && attrType === 'bind') {
695          el.value = value;
696        } else if (attrType !== 'bind') {
697          el.checked = checkedAttrLooseCompare(el.value, value);
698        }
699      } else if (el.type === 'checkbox') {
700        // If we are explicitly binding a string to the :value, set the string,
701        // If the value is a boolean, leave it alone, it will be set to "on"
702        // automatically.
703        if (typeof value !== 'boolean' && ![null, undefined].includes(value) && attrType === 'bind') {
704          el.value = String(value);
705        } else if (attrType !== 'bind') {
706          if (Array.isArray(value)) {
707            // I'm purposely not using Array.includes here because it's
708            // strict, and because of Numeric/String mis-casting, I
709            // want the "includes" to be "fuzzy".
710            el.checked = value.some(val => checkedAttrLooseCompare(val, el.value));
711          } else {
712            el.checked = !!value;
713          }
714        }
715      } else if (el.tagName === 'SELECT') {
716        updateSelect(el, value);
717      } else {
718        if (el.value === value) return;
719        el.value = value;
720      }
721    } else if (attrName === 'class') {
722      if (Array.isArray(value)) {
723        const originalClasses = el.__x_original_classes || [];
724        el.setAttribute('class', arrayUnique(originalClasses.concat(value)).join(' '));
725      } else if (typeof value === 'object') {
726        // Sorting the keys / class names by their boolean value will ensure that
727        // anything that evaluates to `false` and needs to remove classes is run first.
728        const keysSortedByBooleanValue = Object.keys(value).sort((a, b) => value[a] - value[b]);
729        keysSortedByBooleanValue.forEach(classNames => {
730          if (value[classNames]) {
731            convertClassStringToArray(classNames).forEach(className => el.classList.add(className));
732          } else {
733            convertClassStringToArray(classNames).forEach(className => el.classList.remove(className));
734          }
735        });
736      } else {
737        const originalClasses = el.__x_original_classes || [];
738        const newClasses = value ? convertClassStringToArray(value) : [];
739        el.setAttribute('class', arrayUnique(originalClasses.concat(newClasses)).join(' '));
740      }
741    } else {
742      attrName = modifiers.includes('camel') ? camelCase(attrName) : attrName; // If an attribute's bound value is null, undefined or false, remove the attribute
743
744      if ([null, undefined, false].includes(value)) {
745        el.removeAttribute(attrName);
746      } else {
747        isBooleanAttr(attrName) ? setIfChanged(el, attrName, attrName) : setIfChanged(el, attrName, value);
748      }
749    }
750  }
751
752  function setIfChanged(el, attrName, value) {
753    if (el.getAttribute(attrName) != value) {
754      el.setAttribute(attrName, value);
755    }
756  }
757
758  function updateSelect(el, value) {
759    const arrayWrappedValue = [].concat(value).map(value => {
760      return value + '';
761    });
762    Array.from(el.options).forEach(option => {
763      option.selected = arrayWrappedValue.includes(option.value || option.text);
764    });
765  }
766
767  function handleTextDirective(el, output, expression) {
768    // If nested model key is undefined, set the default value to empty string.
769    if (output === undefined && String(expression).match(/\./)) {
770      output = '';
771    }
772
773    el.textContent = output;
774  }
775
776  function handleHtmlDirective(component, el, expression, extraVars) {
777    el.innerHTML = component.evaluateReturnExpression(el, expression, extraVars);
778  }
779
780  function handleShowDirective(component, el, value, modifiers, initialUpdate = false) {
781    const hide = () => {
782      el.style.display = 'none';
783      el.__x_is_shown = false;
784    };
785
786    const show = () => {
787      if (el.style.length === 1 && el.style.display === 'none') {
788        el.removeAttribute('style');
789      } else {
790        el.style.removeProperty('display');
791      }
792
793      el.__x_is_shown = true;
794    };
795
796    if (initialUpdate === true) {
797      if (value) {
798        show();
799      } else {
800        hide();
801      }
802
803      return;
804    }
805
806    const handle = (resolve, reject) => {
807      if (value) {
808        if (el.style.display === 'none' || el.__x_transition) {
809          transitionIn(el, () => {
810            show();
811          }, reject, component);
812        }
813
814        resolve(() => {});
815      } else {
816        if (el.style.display !== 'none') {
817          transitionOut(el, () => {
818            resolve(() => {
819              hide();
820            });
821          }, reject, component);
822        } else {
823          resolve(() => {});
824        }
825      }
826    }; // The working of x-show is a bit complex because we need to
827    // wait for any child transitions to finish before hiding
828    // some element. Also, this has to be done recursively.
829    // If x-show.immediate, foregoe the waiting.
830
831
832    if (modifiers.includes('immediate')) {
833      handle(finish => finish(), () => {});
834      return;
835    } // x-show is encountered during a DOM tree walk. If an element
836    // we encounter is NOT a child of another x-show element we
837    // can execute the previous x-show stack (if one exists).
838
839
840    if (component.showDirectiveLastElement && !component.showDirectiveLastElement.contains(el)) {
841      component.executeAndClearRemainingShowDirectiveStack();
842    }
843
844    component.showDirectiveStack.push(handle);
845    component.showDirectiveLastElement = el;
846  }
847
848  function handleIfDirective(component, el, expressionResult, initialUpdate, extraVars) {
849    warnIfMalformedTemplate(el, 'x-if');
850    const elementHasAlreadyBeenAdded = el.nextElementSibling && el.nextElementSibling.__x_inserted_me === true;
851
852    if (expressionResult && (!elementHasAlreadyBeenAdded || el.__x_transition)) {
853      const clone = document.importNode(el.content, true);
854      el.parentElement.insertBefore(clone, el.nextElementSibling);
855      transitionIn(el.nextElementSibling, () => {}, () => {}, component, initialUpdate);
856      component.initializeElements(el.nextElementSibling, extraVars);
857      el.nextElementSibling.__x_inserted_me = true;
858    } else if (!expressionResult && elementHasAlreadyBeenAdded) {
859      transitionOut(el.nextElementSibling, () => {
860        el.nextElementSibling.remove();
861      }, () => {}, component, initialUpdate);
862    }
863  }
864
865  function registerListener(component, el, event, modifiers, expression, extraVars = {}) {
866    const options = {
867      passive: modifiers.includes('passive')
868    };
869
870    if (modifiers.includes('camel')) {
871      event = camelCase(event);
872    }
873
874    let handler, listenerTarget;
875
876    if (modifiers.includes('away')) {
877      listenerTarget = document;
878
879      handler = e => {
880        // Don't do anything if the click came from the element or within it.
881        if (el.contains(e.target)) return; // Don't do anything if this element isn't currently visible.
882
883        if (el.offsetWidth < 1 && el.offsetHeight < 1) return; // Now that we are sure the element is visible, AND the click
884        // is from outside it, let's run the expression.
885
886        runListenerHandler(component, expression, e, extraVars);
887
888        if (modifiers.includes('once')) {
889          document.removeEventListener(event, handler, options);
890        }
891      };
892    } else {
893      listenerTarget = modifiers.includes('window') ? window : modifiers.includes('document') ? document : el;
894
895      handler = e => {
896        // Remove this global event handler if the element that declared it
897        // has been removed. It's now stale.
898        if (listenerTarget === window || listenerTarget === document) {
899          if (!document.body.contains(el)) {
900            listenerTarget.removeEventListener(event, handler, options);
901            return;
902          }
903        }
904
905        if (isKeyEvent(event)) {
906          if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
907            return;
908          }
909        }
910
911        if (modifiers.includes('prevent')) e.preventDefault();
912        if (modifiers.includes('stop')) e.stopPropagation(); // If the .self modifier isn't present, or if it is present and
913        // the target element matches the element we are registering the
914        // event on, run the handler
915
916        if (!modifiers.includes('self') || e.target === el) {
917          const returnValue = runListenerHandler(component, expression, e, extraVars);
918          returnValue.then(value => {
919            if (value === false) {
920              e.preventDefault();
921            } else {
922              if (modifiers.includes('once')) {
923                listenerTarget.removeEventListener(event, handler, options);
924              }
925            }
926          });
927        }
928      };
929    }
930
931    if (modifiers.includes('debounce')) {
932      let nextModifier = modifiers[modifiers.indexOf('debounce') + 1] || 'invalid-wait';
933      let wait = isNumeric(nextModifier.split('ms')[0]) ? Number(nextModifier.split('ms')[0]) : 250;
934      handler = debounce(handler, wait);
935    }
936
937    listenerTarget.addEventListener(event, handler, options);
938  }
939
940  function runListenerHandler(component, expression, e, extraVars) {
941    return component.evaluateCommandExpression(e.target, expression, () => {
942      return _objectSpread2(_objectSpread2({}, extraVars()), {}, {
943        '$event': e
944      });
945    });
946  }
947
948  function isKeyEvent(event) {
949    return ['keydown', 'keyup'].includes(event);
950  }
951
952  function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) {
953    let keyModifiers = modifiers.filter(i => {
954      return !['window', 'document', 'prevent', 'stop'].includes(i);
955    });
956
957    if (keyModifiers.includes('debounce')) {
958      let debounceIndex = keyModifiers.indexOf('debounce');
959      keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || 'invalid-wait').split('ms')[0]) ? 2 : 1);
960    } // If no modifier is specified, we'll call it a press.
961
962
963    if (keyModifiers.length === 0) return false; // If one is passed, AND it matches the key pressed, we'll call it a press.
964
965    if (keyModifiers.length === 1 && keyModifiers[0] === keyToModifier(e.key)) return false; // The user is listening for key combinations.
966
967    const systemKeyModifiers = ['ctrl', 'shift', 'alt', 'meta', 'cmd', 'super'];
968    const selectedSystemKeyModifiers = systemKeyModifiers.filter(modifier => keyModifiers.includes(modifier));
969    keyModifiers = keyModifiers.filter(i => !selectedSystemKeyModifiers.includes(i));
970
971    if (selectedSystemKeyModifiers.length > 0) {
972      const activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter(modifier => {
973        // Alias "cmd" and "super" to "meta"
974        if (modifier === 'cmd' || modifier === 'super') modifier = 'meta';
975        return e[`${modifier}Key`];
976      }); // If all the modifiers selected are pressed, ...
977
978      if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) {
979        // AND the remaining key is pressed as well. It's a press.
980        if (keyModifiers[0] === keyToModifier(e.key)) return false;
981      }
982    } // We'll call it NOT a valid keypress.
983
984
985    return true;
986  }
987
988  function keyToModifier(key) {
989    switch (key) {
990      case '/':
991        return 'slash';
992
993      case ' ':
994      case 'Spacebar':
995        return 'space';
996
997      default:
998        return key && kebabCase(key);
999    }
1000  }
1001
1002  function registerModelListener(component, el, modifiers, expression, extraVars) {
1003    // If the element we are binding to is a select, a radio, or checkbox
1004    // we'll listen for the change event instead of the "input" event.
1005    var event = el.tagName.toLowerCase() === 'select' || ['checkbox', 'radio'].includes(el.type) || modifiers.includes('lazy') ? 'change' : 'input';
1006    const listenerExpression = `${expression} = rightSideOfExpression($event, ${expression})`;
1007    registerListener(component, el, event, modifiers, listenerExpression, () => {
1008      return _objectSpread2(_objectSpread2({}, extraVars()), {}, {
1009        rightSideOfExpression: generateModelAssignmentFunction(el, modifiers, expression)
1010      });
1011    });
1012  }
1013
1014  function generateModelAssignmentFunction(el, modifiers, expression) {
1015    if (el.type === 'radio') {
1016      // Radio buttons only work properly when they share a name attribute.
1017      // People might assume we take care of that for them, because
1018      // they already set a shared "x-model" attribute.
1019      if (!el.hasAttribute('name')) el.setAttribute('name', expression);
1020    }
1021
1022    return (event, currentValue) => {
1023      // Check for event.detail due to an issue where IE11 handles other events as a CustomEvent.
1024      if (event instanceof CustomEvent && event.detail) {
1025        return event.detail;
1026      } else if (el.type === 'checkbox') {
1027        // If the data we are binding to is an array, toggle its value inside the array.
1028        if (Array.isArray(currentValue)) {
1029          const newValue = modifiers.includes('number') ? safeParseNumber(event.target.value) : event.target.value;
1030          return event.target.checked ? currentValue.concat([newValue]) : currentValue.filter(el => !checkedAttrLooseCompare(el, newValue));
1031        } else {
1032          return event.target.checked;
1033        }
1034      } else if (el.tagName.toLowerCase() === 'select' && el.multiple) {
1035        return modifiers.includes('number') ? Array.from(event.target.selectedOptions).map(option => {
1036          const rawValue = option.value || option.text;
1037          return safeParseNumber(rawValue);
1038        }) : Array.from(event.target.selectedOptions).map(option => {
1039          return option.value || option.text;
1040        });
1041      } else {
1042        const rawValue = event.target.value;
1043        return modifiers.includes('number') ? safeParseNumber(rawValue) : modifiers.includes('trim') ? rawValue.trim() : rawValue;
1044      }
1045    };
1046  }
1047
1048  function safeParseNumber(rawValue) {
1049    const number = rawValue ? parseFloat(rawValue) : null;
1050    return isNumeric(number) ? number : rawValue;
1051  }
1052
1053  /**
1054   * Copyright (C) 2017 salesforce.com, inc.
1055   */
1056  const { isArray } = Array;
1057  const { getPrototypeOf, create: ObjectCreate, defineProperty: ObjectDefineProperty, defineProperties: ObjectDefineProperties, isExtensible, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, preventExtensions, hasOwnProperty, } = Object;
1058  const { push: ArrayPush, concat: ArrayConcat, map: ArrayMap, } = Array.prototype;
1059  function isUndefined(obj) {
1060      return obj === undefined;
1061  }
1062  function isFunction(obj) {
1063      return typeof obj === 'function';
1064  }
1065  function isObject(obj) {
1066      return typeof obj === 'object';
1067  }
1068  const proxyToValueMap = new WeakMap();
1069  function registerProxy(proxy, value) {
1070      proxyToValueMap.set(proxy, value);
1071  }
1072  const unwrap = (replicaOrAny) => proxyToValueMap.get(replicaOrAny) || replicaOrAny;
1073
1074  function wrapValue(membrane, value) {
1075      return membrane.valueIsObservable(value) ? membrane.getProxy(value) : value;
1076  }
1077  /**
1078   * Unwrap property descriptors will set value on original descriptor
1079   * We only need to unwrap if value is specified
1080   * @param descriptor external descrpitor provided to define new property on original value
1081   */
1082  function unwrapDescriptor(descriptor) {
1083      if (hasOwnProperty.call(descriptor, 'value')) {
1084          descriptor.value = unwrap(descriptor.value);
1085      }
1086      return descriptor;
1087  }
1088  function lockShadowTarget(membrane, shadowTarget, originalTarget) {
1089      const targetKeys = ArrayConcat.call(getOwnPropertyNames(originalTarget), getOwnPropertySymbols(originalTarget));
1090      targetKeys.forEach((key) => {
1091          let descriptor = getOwnPropertyDescriptor(originalTarget, key);
1092          // We do not need to wrap the descriptor if configurable
1093          // Because we can deal with wrapping it when user goes through
1094          // Get own property descriptor. There is also a chance that this descriptor
1095          // could change sometime in the future, so we can defer wrapping
1096          // until we need to
1097          if (!descriptor.configurable) {
1098              descriptor = wrapDescriptor(membrane, descriptor, wrapValue);
1099          }
1100          ObjectDefineProperty(shadowTarget, key, descriptor);
1101      });
1102      preventExtensions(shadowTarget);
1103  }
1104  class ReactiveProxyHandler {
1105      constructor(membrane, value) {
1106          this.originalTarget = value;
1107          this.membrane = membrane;
1108      }
1109      get(shadowTarget, key) {
1110          const { originalTarget, membrane } = this;
1111          const value = originalTarget[key];
1112          const { valueObserved } = membrane;
1113          valueObserved(originalTarget, key);
1114          return membrane.getProxy(value);
1115      }
1116      set(shadowTarget, key, value) {
1117          const { originalTarget, membrane: { valueMutated } } = this;
1118          const oldValue = originalTarget[key];
1119          if (oldValue !== value) {
1120              originalTarget[key] = value;
1121              valueMutated(originalTarget, key);
1122          }
1123          else if (key === 'length' && isArray(originalTarget)) {
1124              // fix for issue #236: push will add the new index, and by the time length
1125              // is updated, the internal length is already equal to the new length value
1126              // therefore, the oldValue is equal to the value. This is the forking logic
1127              // to support this use case.
1128              valueMutated(originalTarget, key);
1129          }
1130          return true;
1131      }
1132      deleteProperty(shadowTarget, key) {
1133          const { originalTarget, membrane: { valueMutated } } = this;
1134          delete originalTarget[key];
1135          valueMutated(originalTarget, key);
1136          return true;
1137      }
1138      apply(shadowTarget, thisArg, argArray) {
1139          /* No op */
1140      }
1141      construct(target, argArray, newTarget) {
1142          /* No op */
1143      }
1144      has(shadowTarget, key) {
1145          const { originalTarget, membrane: { valueObserved } } = this;
1146          valueObserved(originalTarget, key);
1147          return key in originalTarget;
1148      }
1149      ownKeys(shadowTarget) {
1150          const { originalTarget } = this;
1151          return ArrayConcat.call(getOwnPropertyNames(originalTarget), getOwnPropertySymbols(originalTarget));
1152      }
1153      isExtensible(shadowTarget) {
1154          const shadowIsExtensible = isExtensible(shadowTarget);
1155          if (!shadowIsExtensible) {
1156              return shadowIsExtensible;
1157          }
1158          const { originalTarget, membrane } = this;
1159          const targetIsExtensible = isExtensible(originalTarget);
1160          if (!targetIsExtensible) {
1161              lockShadowTarget(membrane, shadowTarget, originalTarget);
1162          }
1163          return targetIsExtensible;
1164      }
1165      setPrototypeOf(shadowTarget, prototype) {
1166      }
1167      getPrototypeOf(shadowTarget) {
1168          const { originalTarget } = this;
1169          return getPrototypeOf(originalTarget);
1170      }
1171      getOwnPropertyDescriptor(shadowTarget, key) {
1172          const { originalTarget, membrane } = this;
1173          const { valueObserved } = this.membrane;
1174          // keys looked up via hasOwnProperty need to be reactive
1175          valueObserved(originalTarget, key);
1176          let desc = getOwnPropertyDescriptor(originalTarget, key);
1177          if (isUndefined(desc)) {
1178              return desc;
1179          }
1180          const shadowDescriptor = getOwnPropertyDescriptor(shadowTarget, key);
1181          if (!isUndefined(shadowDescriptor)) {
1182              return shadowDescriptor;
1183          }
1184          // Note: by accessing the descriptor, the key is marked as observed
1185          // but access to the value, setter or getter (if available) cannot observe
1186          // mutations, just like regular methods, in which case we just do nothing.
1187          desc = wrapDescriptor(membrane, desc, wrapValue);
1188          if (!desc.configurable) {
1189              // If descriptor from original target is not configurable,
1190              // We must copy the wrapped descriptor over to the shadow target.
1191              // Otherwise, proxy will throw an invariant error.
1192              // This is our last chance to lock the value.
1193              // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/getOwnPropertyDescriptor#Invariants
1194              ObjectDefineProperty(shadowTarget, key, desc);
1195          }
1196          return desc;
1197      }
1198      preventExtensions(shadowTarget) {
1199          const { originalTarget, membrane } = this;
1200          lockShadowTarget(membrane, shadowTarget, originalTarget);
1201          preventExtensions(originalTarget);
1202          return true;
1203      }
1204      defineProperty(shadowTarget, key, descriptor) {
1205          const { originalTarget, membrane } = this;
1206          const { valueMutated } = membrane;
1207          const { configurable } = descriptor;
1208          // We have to check for value in descriptor
1209          // because Object.freeze(proxy) calls this method
1210          // with only { configurable: false, writeable: false }
1211          // Additionally, method will only be called with writeable:false
1212          // if the descriptor has a value, as opposed to getter/setter
1213          // So we can just check if writable is present and then see if
1214          // value is present. This eliminates getter and setter descriptors
1215          if (hasOwnProperty.call(descriptor, 'writable') && !hasOwnProperty.call(descriptor, 'value')) {
1216              const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key);
1217              descriptor.value = originalDescriptor.value;
1218          }
1219          ObjectDefineProperty(originalTarget, key, unwrapDescriptor(descriptor));
1220          if (configurable === false) {
1221              ObjectDefineProperty(shadowTarget, key, wrapDescriptor(membrane, descriptor, wrapValue));
1222          }
1223          valueMutated(originalTarget, key);
1224          return true;
1225      }
1226  }
1227
1228  function wrapReadOnlyValue(membrane, value) {
1229      return membrane.valueIsObservable(value) ? membrane.getReadOnlyProxy(value) : value;
1230  }
1231  class ReadOnlyHandler {
1232      constructor(membrane, value) {
1233          this.originalTarget = value;
1234          this.membrane = membrane;
1235      }
1236      get(shadowTarget, key) {
1237          const { membrane, originalTarget } = this;
1238          const value = originalTarget[key];
1239          const { valueObserved } = membrane;
1240          valueObserved(originalTarget, key);
1241          return membrane.getReadOnlyProxy(value);
1242      }
1243      set(shadowTarget, key, value) {
1244          return false;
1245      }
1246      deleteProperty(shadowTarget, key) {
1247          return false;
1248      }
1249      apply(shadowTarget, thisArg, argArray) {
1250          /* No op */
1251      }
1252      construct(target, argArray, newTarget) {
1253          /* No op */
1254      }
1255      has(shadowTarget, key) {
1256          const { originalTarget, membrane: { valueObserved } } = this;
1257          valueObserved(originalTarget, key);
1258          return key in originalTarget;
1259      }
1260      ownKeys(shadowTarget) {
1261          const { originalTarget } = this;
1262          return ArrayConcat.call(getOwnPropertyNames(originalTarget), getOwnPropertySymbols(originalTarget));
1263      }
1264      setPrototypeOf(shadowTarget, prototype) {
1265      }
1266      getOwnPropertyDescriptor(shadowTarget, key) {
1267          const { originalTarget, membrane } = this;
1268          const { valueObserved } = membrane;
1269          // keys looked up via hasOwnProperty need to be reactive
1270          valueObserved(originalTarget, key);
1271          let desc = getOwnPropertyDescriptor(originalTarget, key);
1272          if (isUndefined(desc)) {
1273              return desc;
1274          }
1275          const shadowDescriptor = getOwnPropertyDescriptor(shadowTarget, key);
1276          if (!isUndefined(shadowDescriptor)) {
1277              return shadowDescriptor;
1278          }
1279          // Note: by accessing the descriptor, the key is marked as observed
1280          // but access to the value or getter (if available) cannot be observed,
1281          // just like regular methods, in which case we just do nothing.
1282          desc = wrapDescriptor(membrane, desc, wrapReadOnlyValue);
1283          if (hasOwnProperty.call(desc, 'set')) {
1284              desc.set = undefined; // readOnly membrane does not allow setters
1285          }
1286          if (!desc.configurable) {
1287              // If descriptor from original target is not configurable,
1288              // We must copy the wrapped descriptor over to the shadow target.
1289              // Otherwise, proxy will throw an invariant error.
1290              // This is our last chance to lock the value.
1291              // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/getOwnPropertyDescriptor#Invariants
1292              ObjectDefineProperty(shadowTarget, key, desc);
1293          }
1294          return desc;
1295      }
1296      preventExtensions(shadowTarget) {
1297          return false;
1298      }
1299      defineProperty(shadowTarget, key, descriptor) {
1300          return false;
1301      }
1302  }
1303  function createShadowTarget(value) {
1304      let shadowTarget = undefined;
1305      if (isArray(value)) {
1306          shadowTarget = [];
1307      }
1308      else if (isObject(value)) {
1309          shadowTarget = {};
1310      }
1311      return shadowTarget;
1312  }
1313  const ObjectDotPrototype = Object.prototype;
1314  function defaultValueIsObservable(value) {
1315      // intentionally checking for null
1316      if (value === null) {
1317          return false;
1318      }
1319      // treat all non-object types, including undefined, as non-observable values
1320      if (typeof value !== 'object') {
1321          return false;
1322      }
1323      if (isArray(value)) {
1324          return true;
1325      }
1326      const proto = getPrototypeOf(value);
1327      return (proto === ObjectDotPrototype || proto === null || getPrototypeOf(proto) === null);
1328  }
1329  const defaultValueObserved = (obj, key) => {
1330      /* do nothing */
1331  };
1332  const defaultValueMutated = (obj, key) => {
1333      /* do nothing */
1334  };
1335  const defaultValueDistortion = (value) => value;
1336  function wrapDescriptor(membrane, descriptor, getValue) {
1337      const { set, get } = descriptor;
1338      if (hasOwnProperty.call(descriptor, 'value')) {
1339          descriptor.value = getValue(membrane, descriptor.value);
1340      }
1341      else {
1342          if (!isUndefined(get)) {
1343              descriptor.get = function () {
1344                  // invoking the original getter with the original target
1345                  return getValue(membrane, get.call(unwrap(this)));
1346              };
1347          }
1348          if (!isUndefined(set)) {
1349              descriptor.set = function (value) {
1350                  // At this point we don't have a clear indication of whether
1351                  // or not a valid mutation will occur, we don't have the key,
1352                  // and we are not sure why and how they are invoking this setter.
1353                  // Nevertheless we preserve the original semantics by invoking the
1354                  // original setter with the original target and the unwrapped value
1355                  set.call(unwrap(this), membrane.unwrapProxy(value));
1356              };
1357          }
1358      }
1359      return descriptor;
1360  }
1361  class ReactiveMembrane {
1362      constructor(options) {
1363          this.valueDistortion = defaultValueDistortion;
1364          this.valueMutated = defaultValueMutated;
1365          this.valueObserved = defaultValueObserved;
1366          this.valueIsObservable = defaultValueIsObservable;
1367          this.objectGraph = new WeakMap();
1368          if (!isUndefined(options)) {
1369              const { valueDistortion, valueMutated, valueObserved, valueIsObservable } = options;
1370              this.valueDistortion = isFunction(valueDistortion) ? valueDistortion : defaultValueDistortion;
1371              this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;
1372              this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;
1373              this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
1374          }
1375      }
1376      getProxy(value) {
1377          const unwrappedValue = unwrap(value);
1378          const distorted = this.valueDistortion(unwrappedValue);
1379          if (this.valueIsObservable(distorted)) {
1380              const o = this.getReactiveState(unwrappedValue, distorted);
1381              // when trying to extract the writable version of a readonly
1382              // we return the readonly.
1383              return o.readOnly === value ? value : o.reactive;
1384          }
1385          return distorted;
1386      }
1387      getReadOnlyProxy(value) {
1388          value = unwrap(value);
1389          const distorted = this.valueDistortion(value);
1390          if (this.valueIsObservable(distorted)) {
1391              return this.getReactiveState(value, distorted).readOnly;
1392          }
1393          return distorted;
1394      }
1395      unwrapProxy(p) {
1396          return unwrap(p);
1397      }
1398      getReactiveState(value, distortedValue) {
1399          const { objectGraph, } = this;
1400          let reactiveState = objectGraph.get(distortedValue);
1401          if (reactiveState) {
1402              return reactiveState;
1403          }
1404          const membrane = this;
1405          reactiveState = {
1406              get reactive() {
1407                  const reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue);
1408                  // caching the reactive proxy after the first time it is accessed
1409                  const proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
1410                  registerProxy(proxy, value);
1411                  ObjectDefineProperty(this, 'reactive', { value: proxy });
1412                  return proxy;
1413              },
1414              get readOnly() {
1415                  const readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue);
1416                  // caching the readOnly proxy after the first time it is accessed
1417                  const proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
1418                  registerProxy(proxy, value);
1419                  ObjectDefineProperty(this, 'readOnly', { value: proxy });
1420                  return proxy;
1421              }
1422          };
1423          objectGraph.set(distortedValue, reactiveState);
1424          return reactiveState;
1425      }
1426  }
1427  /** version: 0.26.0 */
1428
1429  function wrap(data, mutationCallback) {
1430
1431    let membrane = new ReactiveMembrane({
1432      valueMutated(target, key) {
1433        mutationCallback(target, key);
1434      }
1435
1436    });
1437    return {
1438      data: membrane.getProxy(data),
1439      membrane: membrane
1440    };
1441  }
1442  function unwrap$1(membrane, observable) {
1443    let unwrappedData = membrane.unwrapProxy(observable);
1444    let copy = {};
1445    Object.keys(unwrappedData).forEach(key => {
1446      if (['$el', '$refs', '$nextTick', '$watch'].includes(key)) return;
1447      copy[key] = unwrappedData[key];
1448    });
1449    return copy;
1450  }
1451
1452  class Component {
1453    constructor(el, componentForClone = null) {
1454      this.$el = el;
1455      const dataAttr = this.$el.getAttribute('x-data');
1456      const dataExpression = dataAttr === '' ? '{}' : dataAttr;
1457      const initExpression = this.$el.getAttribute('x-init');
1458      let dataExtras = {
1459        $el: this.$el
1460      };
1461      let canonicalComponentElementReference = componentForClone ? componentForClone.$el : this.$el;
1462      Object.entries(Alpine.magicProperties).forEach(([name, callback]) => {
1463        Object.defineProperty(dataExtras, `$${name}`, {
1464          get: function get() {
1465            return callback(canonicalComponentElementReference);
1466          }
1467        });
1468      });
1469      this.unobservedData = componentForClone ? componentForClone.getUnobservedData() : saferEval(el, dataExpression, dataExtras);
1470      // Construct a Proxy-based observable. This will be used to handle reactivity.
1471
1472      let {
1473        membrane,
1474        data
1475      } = this.wrapDataInObservable(this.unobservedData);
1476      this.$data = data;
1477      this.membrane = membrane; // After making user-supplied data methods reactive, we can now add
1478      // our magic properties to the original data for access.
1479
1480      this.unobservedData.$el = this.$el;
1481      this.unobservedData.$refs = this.getRefsProxy();
1482      this.nextTickStack = [];
1483
1484      this.unobservedData.$nextTick = callback => {
1485        this.nextTickStack.push(callback);
1486      };
1487
1488      this.watchers = {};
1489
1490      this.unobservedData.$watch = (property, callback) => {
1491        if (!this.watchers[property]) this.watchers[property] = [];
1492        this.watchers[property].push(callback);
1493      };
1494      /* MODERN-ONLY:START */
1495      // We remove this piece of code from the legacy build.
1496      // In IE11, we have already defined our helpers at this point.
1497      // Register custom magic properties.
1498
1499
1500      Object.entries(Alpine.magicProperties).forEach(([name, callback]) => {
1501        Object.defineProperty(this.unobservedData, `$${name}`, {
1502          get: function get() {
1503            return callback(canonicalComponentElementReference, this.$el);
1504          }
1505        });
1506      });
1507      /* MODERN-ONLY:END */
1508
1509      this.showDirectiveStack = [];
1510      this.showDirectiveLastElement;
1511      componentForClone || Alpine.onBeforeComponentInitializeds.forEach(callback => callback(this));
1512      var initReturnedCallback; // If x-init is present AND we aren't cloning (skip x-init on clone)
1513
1514      if (initExpression && !componentForClone) {
1515        // We want to allow data manipulation, but not trigger DOM updates just yet.
1516        // We haven't even initialized the elements with their Alpine bindings. I mean c'mon.
1517        this.pauseReactivity = true;
1518        initReturnedCallback = this.evaluateReturnExpression(this.$el, initExpression);
1519        this.pauseReactivity = false;
1520      } // Register all our listeners and set all our attribute bindings.
1521      // If we're cloning a component, the third parameter ensures no duplicate
1522      // event listeners are registered (the mutation observer will take care of them)
1523
1524
1525      this.initializeElements(this.$el, () => {}, componentForClone ? false : true); // Use mutation observer to detect new elements being added within this component at run-time.
1526      // Alpine's just so darn flexible amirite?
1527
1528      this.listenForNewElementsToInitialize();
1529
1530      if (typeof initReturnedCallback === 'function') {
1531        // Run the callback returned from the "x-init" hook to allow the user to do stuff after
1532        // Alpine's got it's grubby little paws all over everything.
1533        initReturnedCallback.call(this.$data);
1534      }
1535
1536      componentForClone || setTimeout(() => {
1537        Alpine.onComponentInitializeds.forEach(callback => callback(this));
1538      }, 0);
1539    }
1540
1541    getUnobservedData() {
1542      return unwrap$1(this.membrane, this.$data);
1543    }
1544
1545    wrapDataInObservable(data) {
1546      var self = this;
1547      let updateDom = debounce(function () {
1548        self.updateElements(self.$el);
1549      }, 0);
1550      return wrap(data, (target, key) => {
1551        if (self.watchers[key]) {
1552          // If there's a watcher for this specific key, run it.
1553          self.watchers[key].forEach(callback => callback(target[key]));
1554        } else if (Array.isArray(target)) {
1555          // Arrays are special cases, if any of the items change, we consider the array as mutated.
1556          Object.keys(self.watchers).forEach(fullDotNotationKey => {
1557            let dotNotationParts = fullDotNotationKey.split('.'); // Ignore length mutations since they would result in duplicate calls.
1558            // For example, when calling push, we would get a mutation for the item's key
1559            // and a second mutation for the length property.
1560
1561            if (key === 'length') return;
1562            dotNotationParts.reduce((comparisonData, part) => {
1563              if (Object.is(target, comparisonData[part])) {
1564                self.watchers[fullDotNotationKey].forEach(callback => callback(target));
1565              }
1566
1567              return comparisonData[part];
1568            }, self.unobservedData);
1569          });
1570        } else {
1571          // Let's walk through the watchers with "dot-notation" (foo.bar) and see
1572          // if this mutation fits any of them.
1573          Object.keys(self.watchers).filter(i => i.includes('.')).forEach(fullDotNotationKey => {
1574            let dotNotationParts = fullDotNotationKey.split('.'); // If this dot-notation watcher's last "part" doesn't match the current
1575            // key, then skip it early for performance reasons.
1576
1577            if (key !== dotNotationParts[dotNotationParts.length - 1]) return; // Now, walk through the dot-notation "parts" recursively to find
1578            // a match, and call the watcher if one's found.
1579
1580            dotNotationParts.reduce((comparisonData, part) => {
1581              if (Object.is(target, comparisonData)) {
1582                // Run the watchers.
1583                self.watchers[fullDotNotationKey].forEach(callback => callback(target[key]));
1584              }
1585
1586              return comparisonData[part];
1587            }, self.unobservedData);
1588          });
1589        } // Don't react to data changes for cases like the `x-created` hook.
1590
1591
1592        if (self.pauseReactivity) return;
1593        updateDom();
1594      });
1595    }
1596
1597    walkAndSkipNestedComponents(el, callback, initializeComponentCallback = () => {}) {
1598      walk(el, el => {
1599        // We've hit a component.
1600        if (el.hasAttribute('x-data')) {
1601          // If it's not the current one.
1602          if (!el.isSameNode(this.$el)) {
1603            // Initialize it if it's not.
1604            if (!el.__x) initializeComponentCallback(el); // Now we'll let that sub-component deal with itself.
1605
1606            return false;
1607          }
1608        }
1609
1610        return callback(el);
1611      });
1612    }
1613
1614    initializeElements(rootEl, extraVars = () => {}, shouldRegisterListeners = true) {
1615      this.walkAndSkipNestedComponents(rootEl, el => {
1616        // Don't touch spawns from for loop
1617        if (el.__x_for_key !== undefined) return false; // Don't touch spawns from if directives
1618
1619        if (el.__x_inserted_me !== undefined) return false;
1620        this.initializeElement(el, extraVars, shouldRegisterListeners);
1621      }, el => {
1622        el.__x = new Component(el);
1623      });
1624      this.executeAndClearRemainingShowDirectiveStack();
1625      this.executeAndClearNextTickStack(rootEl);
1626    }
1627
1628    initializeElement(el, extraVars, shouldRegisterListeners = true) {
1629      // To support class attribute merging, we have to know what the element's
1630      // original class attribute looked like for reference.
1631      if (el.hasAttribute('class') && getXAttrs(el, this).length > 0) {
1632        el.__x_original_classes = convertClassStringToArray(el.getAttribute('class'));
1633      }
1634
1635      shouldRegisterListeners && this.registerListeners(el, extraVars);
1636      this.resolveBoundAttributes(el, true, extraVars);
1637    }
1638
1639    updateElements(rootEl, extraVars = () => {}) {
1640      this.walkAndSkipNestedComponents(rootEl, el => {
1641        // Don't touch spawns from for loop (and check if the root is actually a for loop in a parent, don't skip it.)
1642        if (el.__x_for_key !== undefined && !el.isSameNode(this.$el)) return false;
1643        this.updateElement(el, extraVars);
1644      }, el => {
1645        el.__x = new Component(el);
1646      });
1647      this.executeAndClearRemainingShowDirectiveStack();
1648      this.executeAndClearNextTickStack(rootEl);
1649    }
1650
1651    executeAndClearNextTickStack(el) {
1652      // Skip spawns from alpine directives
1653      if (el === this.$el && this.nextTickStack.length > 0) {
1654        // We run the tick stack after the next frame to allow any
1655        // running transitions to pass the initial show stage.
1656        requestAnimationFrame(() => {
1657          while (this.nextTickStack.length > 0) {
1658            this.nextTickStack.shift()();
1659          }
1660        });
1661      }
1662    }
1663
1664    executeAndClearRemainingShowDirectiveStack() {
1665      // The goal here is to start all the x-show transitions
1666      // and build a nested promise chain so that elements
1667      // only hide when the children are finished hiding.
1668      this.showDirectiveStack.reverse().map(handler => {
1669        return new Promise((resolve, reject) => {
1670          handler(resolve, reject);
1671        });
1672      }).reduce((promiseChain, promise) => {
1673        return promiseChain.then(() => {
1674          return promise.then(finishElement => {
1675            finishElement();
1676          });
1677        });
1678      }, Promise.resolve(() => {})).catch(e => {
1679        if (e !== TRANSITION_CANCELLED) throw e;
1680      }); // We've processed the handler stack. let's clear it.
1681
1682      this.showDirectiveStack = [];
1683      this.showDirectiveLastElement = undefined;
1684    }
1685
1686    updateElement(el, extraVars) {
1687      this.resolveBoundAttributes(el, false, extraVars);
1688    }
1689
1690    registerListeners(el, extraVars) {
1691      getXAttrs(el, this).forEach(({
1692        type,
1693        value,
1694        modifiers,
1695        expression
1696      }) => {
1697        switch (type) {
1698          case 'on':
1699            registerListener(this, el, value, modifiers, expression, extraVars);
1700            break;
1701
1702          case 'model':
1703            registerModelListener(this, el, modifiers, expression, extraVars);
1704            break;
1705        }
1706      });
1707    }
1708
1709    resolveBoundAttributes(el, initialUpdate = false, extraVars) {
1710      let attrs = getXAttrs(el, this);
1711      attrs.forEach(({
1712        type,
1713        value,
1714        modifiers,
1715        expression
1716      }) => {
1717        switch (type) {
1718          case 'model':
1719            handleAttributeBindingDirective(this, el, 'value', expression, extraVars, type, modifiers);
1720            break;
1721
1722          case 'bind':
1723            // The :key binding on an x-for is special, ignore it.
1724            if (el.tagName.toLowerCase() === 'template' && value === 'key') return;
1725            handleAttributeBindingDirective(this, el, value, expression, extraVars, type, modifiers);
1726            break;
1727
1728          case 'text':
1729            var output = this.evaluateReturnExpression(el, expression, extraVars);
1730            handleTextDirective(el, output, expression);
1731            break;
1732
1733          case 'html':
1734            handleHtmlDirective(this, el, expression, extraVars);
1735            break;
1736
1737          case 'show':
1738            var output = this.evaluateReturnExpression(el, expression, extraVars);
1739            handleShowDirective(this, el, output, modifiers, initialUpdate);
1740            break;
1741
1742          case 'if':
1743            // If this element also has x-for on it, don't process x-if.
1744            // We will let the "x-for" directive handle the "if"ing.
1745            if (attrs.some(i => i.type === 'for')) return;
1746            var output = this.evaluateReturnExpression(el, expression, extraVars);
1747            handleIfDirective(this, el, output, initialUpdate, extraVars);
1748            break;
1749
1750          case 'for':
1751            handleForDirective(this, el, expression, initialUpdate, extraVars);
1752            break;
1753
1754          case 'cloak':
1755            el.removeAttribute('x-cloak');
1756            break;
1757        }
1758      });
1759    }
1760
1761    evaluateReturnExpression(el, expression, extraVars = () => {}) {
1762      return saferEval(el, expression, this.$data, _objectSpread2(_objectSpread2({}, extraVars()), {}, {
1763        $dispatch: this.getDispatchFunction(el)
1764      }));
1765    }
1766
1767    evaluateCommandExpression(el, expression, extraVars = () => {}) {
1768      return saferEvalNoReturn(el, expression, this.$data, _objectSpread2(_objectSpread2({}, extraVars()), {}, {
1769        $dispatch: this.getDispatchFunction(el)
1770      }));
1771    }
1772
1773    getDispatchFunction(el) {
1774      return (event, detail = {}) => {
1775        el.dispatchEvent(new CustomEvent(event, {
1776          detail,
1777          bubbles: true
1778        }));
1779      };
1780    }
1781
1782    listenForNewElementsToInitialize() {
1783      const targetNode = this.$el;
1784      const observerOptions = {
1785        childList: true,
1786        attributes: true,
1787        subtree: true
1788      };
1789      const observer = new MutationObserver(mutations => {
1790        for (let i = 0; i < mutations.length; i++) {
1791          // Filter out mutations triggered from child components.
1792          const closestParentComponent = mutations[i].target.closest('[x-data]');
1793          if (!(closestParentComponent && closestParentComponent.isSameNode(this.$el))) continue;
1794
1795          if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'x-data') {
1796            const xAttr = mutations[i].target.getAttribute('x-data') || '{}';
1797            const rawData = saferEval(this.$el, xAttr, {
1798              $el: this.$el
1799            });
1800            Object.keys(rawData).forEach(key => {
1801              if (this.$data[key] !== rawData[key]) {
1802                this.$data[key] = rawData[key];
1803              }
1804            });
1805          }
1806
1807          if (mutations[i].addedNodes.length > 0) {
1808            mutations[i].addedNodes.forEach(node => {
1809              if (node.nodeType !== 1 || node.__x_inserted_me) return;
1810
1811              if (node.matches('[x-data]') && !node.__x) {
1812                node.__x = new Component(node);
1813                return;
1814              }
1815
1816              this.initializeElements(node);
1817            });
1818          }
1819        }
1820      });
1821      observer.observe(targetNode, observerOptions);
1822    }
1823
1824    getRefsProxy() {
1825      var self = this;
1826      var refObj = {};
1827      // One of the goals of this is to not hold elements in memory, but rather re-evaluate
1828      // the DOM when the system needs something from it. This way, the framework is flexible and
1829      // friendly to outside DOM changes from libraries like Vue/Livewire.
1830      // For this reason, I'm using an "on-demand" proxy to fake a "$refs" object.
1831
1832      return new Proxy(refObj, {
1833        get(object, property) {
1834          if (property === '$isAlpineProxy') return true;
1835          var ref; // We can't just query the DOM because it's hard to filter out refs in
1836          // nested components.
1837
1838          self.walkAndSkipNestedComponents(self.$el, el => {
1839            if (el.hasAttribute('x-ref') && el.getAttribute('x-ref') === property) {
1840              ref = el;
1841            }
1842          });
1843          return ref;
1844        }
1845
1846      });
1847    }
1848
1849  }
1850
1851  const Alpine = {
1852    version: "2.8.1",
1853    pauseMutationObserver: false,
1854    magicProperties: {},
1855    onComponentInitializeds: [],
1856    onBeforeComponentInitializeds: [],
1857    ignoreFocusedForValueBinding: false,
1858    start: async function start() {
1859      if (!isTesting()) {
1860        await domReady();
1861      }
1862
1863      this.discoverComponents(el => {
1864        this.initializeComponent(el);
1865      }); // It's easier and more performant to just support Turbolinks than listen
1866      // to MutationObserver mutations at the document level.
1867
1868      document.addEventListener("turbolinks:load", () => {
1869        this.discoverUninitializedComponents(el => {
1870          this.initializeComponent(el);
1871        });
1872      });
1873      this.listenForNewUninitializedComponentsAtRunTime();
1874    },
1875    discoverComponents: function discoverComponents(callback) {
1876      const rootEls = document.querySelectorAll('[x-data]');
1877      rootEls.forEach(rootEl => {
1878        callback(rootEl);
1879      });
1880    },
1881    discoverUninitializedComponents: function discoverUninitializedComponents(callback, el = null) {
1882      const rootEls = (el || document).querySelectorAll('[x-data]');
1883      Array.from(rootEls).filter(el => el.__x === undefined).forEach(rootEl => {
1884        callback(rootEl);
1885      });
1886    },
1887    listenForNewUninitializedComponentsAtRunTime: function listenForNewUninitializedComponentsAtRunTime() {
1888      const targetNode = document.querySelector('body');
1889      const observerOptions = {
1890        childList: true,
1891        attributes: true,
1892        subtree: true
1893      };
1894      const observer = new MutationObserver(mutations => {
1895        if (this.pauseMutationObserver) return;
1896
1897        for (let i = 0; i < mutations.length; i++) {
1898          if (mutations[i].addedNodes.length > 0) {
1899            mutations[i].addedNodes.forEach(node => {
1900              // Discard non-element nodes (like line-breaks)
1901              if (node.nodeType !== 1) return; // Discard any changes happening within an existing component.
1902              // They will take care of themselves.
1903
1904              if (node.parentElement && node.parentElement.closest('[x-data]')) return;
1905              this.discoverUninitializedComponents(el => {
1906                this.initializeComponent(el);
1907              }, node.parentElement);
1908            });
1909          }
1910        }
1911      });
1912      observer.observe(targetNode, observerOptions);
1913    },
1914    initializeComponent: function initializeComponent(el) {
1915      if (!el.__x) {
1916        // Wrap in a try/catch so that we don't prevent other components
1917        // from initializing when one component contains an error.
1918        try {
1919          el.__x = new Component(el);
1920        } catch (error) {
1921          setTimeout(() => {
1922            throw error;
1923          }, 0);
1924        }
1925      }
1926    },
1927    clone: function clone(component, newEl) {
1928      if (!newEl.__x) {
1929        newEl.__x = new Component(newEl, component);
1930      }
1931    },
1932    addMagicProperty: function addMagicProperty(name, callback) {
1933      this.magicProperties[name] = callback;
1934    },
1935    onComponentInitialized: function onComponentInitialized(callback) {
1936      this.onComponentInitializeds.push(callback);
1937    },
1938    onBeforeComponentInitialized: function onBeforeComponentInitialized(callback) {
1939      this.onBeforeComponentInitializeds.push(callback);
1940    }
1941  };
1942
1943  if (!isTesting()) {
1944    window.Alpine = Alpine;
1945
1946    if (window.deferLoadingAlpine) {
1947      window.deferLoadingAlpine(function () {
1948        window.Alpine.start();
1949      });
1950    } else {
1951      window.Alpine.start();
1952    }
1953  }
1954
1955  return Alpine;
1956
1957})));
1958
1959
1960/***/ }),
1961
vendor: 342 bytes, lines 1962-1971
1962/***/ "./node_modules/axios/index.js":
1963/*!*************************************!*\
1964  !*** ./node_modules/axios/index.js ***!
1965  \*************************************/
1966/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1967
1968module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
1969
1970/***/ }),
1971
vendor: 6,671 bytes, lines 1972-2161
1972/***/ "./node_modules/axios/lib/adapters/xhr.js":
1973/*!************************************************!*\
1974  !*** ./node_modules/axios/lib/adapters/xhr.js ***!
1975  \************************************************/
1976/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1977
1978"use strict";
1979
1980
1981var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
1982var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
1983var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
1984var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
1985var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
1986var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
1987var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
1988var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
1989
1990module.exports = function xhrAdapter(config) {
1991  return new Promise(function dispatchXhrRequest(resolve, reject) {
1992    var requestData = config.data;
1993    var requestHeaders = config.headers;
1994
1995    if (utils.isFormData(requestData)) {
1996      delete requestHeaders['Content-Type']; // Let the browser set it
1997    }
1998
1999    var request = new XMLHttpRequest();
2000
2001    // HTTP basic authentication
2002    if (config.auth) {
2003      var username = config.auth.username || '';
2004      var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2005      requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
2006    }
2007
2008    var fullPath = buildFullPath(config.baseURL, config.url);
2009    request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2010
2011    // Set the request timeout in MS
2012    request.timeout = config.timeout;
2013
2014    // Listen for ready state
2015    request.onreadystatechange = function handleLoad() {
2016      if (!request || request.readyState !== 4) {
2017        return;
2018      }
2019
2020      // The request errored out and we didn't get a response, this will be
2021      // handled by onerror instead
2022      // With one exception: request that using file: protocol, most browsers
2023      // will return status as 0 even though it's a successful request
2024      if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2025        return;
2026      }
2027
2028      // Prepare the response
2029      var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
2030      var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
2031      var response = {
2032        data: responseData,
2033        status: request.status,
2034        statusText: request.statusText,
2035        headers: responseHeaders,
2036        config: config,
2037        request: request
2038      };
2039
2040      settle(resolve, reject, response);
2041
2042      // Clean up request
2043      request = null;
2044    };
2045
2046    // Handle browser request cancellation (as opposed to a manual cancellation)
2047    request.onabort = function handleAbort() {
2048      if (!request) {
2049        return;
2050      }
2051
2052      reject(createError('Request aborted', config, 'ECONNABORTED', request));
2053
2054      // Clean up request
2055      request = null;
2056    };
2057
2058    // Handle low level network errors
2059    request.onerror = function handleError() {
2060      // Real errors are hidden from us by the browser
2061      // onerror should only fire if it's a network error
2062      reject(createError('Network Error', config, null, request));
2063
2064      // Clean up request
2065      request = null;
2066    };
2067
2068    // Handle timeout
2069    request.ontimeout = function handleTimeout() {
2070      var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
2071      if (config.timeoutErrorMessage) {
2072        timeoutErrorMessage = config.timeoutErrorMessage;
2073      }
2074      reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
2075        request));
2076
2077      // Clean up request
2078      request = null;
2079    };
2080
2081    // Add xsrf header
2082    // This is only done if running in a standard browser environment.
2083    // Specifically not if we're in a web worker, or react-native.
2084    if (utils.isStandardBrowserEnv()) {
2085      // Add xsrf header
2086      var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
2087        cookies.read(config.xsrfCookieName) :
2088        undefined;
2089
2090      if (xsrfValue) {
2091        requestHeaders[config.xsrfHeaderName] = xsrfValue;
2092      }
2093    }
2094
2095    // Add headers to the request
2096    if ('setRequestHeader' in request) {
2097      utils.forEach(requestHeaders, function setRequestHeader(val, key) {
2098        if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
2099          // Remove Content-Type if data is undefined
2100          delete requestHeaders[key];
2101        } else {
2102          // Otherwise add header to the request
2103          request.setRequestHeader(key, val);
2104        }
2105      });
2106    }
2107
2108    // Add withCredentials to request if needed
2109    if (!utils.isUndefined(config.withCredentials)) {
2110      request.withCredentials = !!config.withCredentials;
2111    }
2112
2113    // Add responseType to request if needed
2114    if (config.responseType) {
2115      try {
2116        request.responseType = config.responseType;
2117      } catch (e) {
2118        // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
2119        // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
2120        if (config.responseType !== 'json') {
2121          throw e;
2122        }
2123      }
2124    }
2125
2126    // Handle progress if needed
2127    if (typeof config.onDownloadProgress === 'function') {
2128      request.addEventListener('progress', config.onDownloadProgress);
2129    }
2130
2131    // Not all browsers support upload events
2132    if (typeof config.onUploadProgress === 'function' && request.upload) {
2133      request.upload.addEventListener('progress', config.onUploadProgress);
2134    }
2135
2136    if (config.cancelToken) {
2137      // Handle cancellation
2138      config.cancelToken.promise.then(function onCanceled(cancel) {
2139        if (!request) {
2140          return;
2141        }
2142
2143        request.abort();
2144        reject(cancel);
2145        // Clean up request
2146        request = null;
2147      });
2148    }
2149
2150    if (!requestData) {
2151      requestData = null;
2152    }
2153
2154    // Send the request
2155    request.send(requestData);
2156  });
2157};
2158
2159
2160/***/ }),
2161
vendor: 2,380 bytes, lines 2162-2228
2162/***/ "./node_modules/axios/lib/axios.js":
2163/*!*****************************************!*\
2164  !*** ./node_modules/axios/lib/axios.js ***!
2165  \*****************************************/
2166/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2167
2168"use strict";
2169
2170
2171var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
2172var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
2173var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
2174var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
2175var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
2176
2177/**
2178 * Create an instance of Axios
2179 *
2180 * @param {Object} defaultConfig The default config for the instance
2181 * @return {Axios} A new instance of Axios
2182 */
2183function createInstance(defaultConfig) {
2184  var context = new Axios(defaultConfig);
2185  var instance = bind(Axios.prototype.request, context);
2186
2187  // Copy axios.prototype to instance
2188  utils.extend(instance, Axios.prototype, context);
2189
2190  // Copy context to instance
2191  utils.extend(instance, context);
2192
2193  return instance;
2194}
2195
2196// Create the default instance to be exported
2197var axios = createInstance(defaults);
2198
2199// Expose Axios class to allow class inheritance
2200axios.Axios = Axios;
2201
2202// Factory for creating new instances
2203axios.create = function create(instanceConfig) {
2204  return createInstance(mergeConfig(axios.defaults, instanceConfig));
2205};
2206
2207// Expose Cancel & CancelToken
2208axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
2209axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
2210axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
2211
2212// Expose all/spread
2213axios.all = function all(promises) {
2214  return Promise.all(promises);
2215};
2216axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
2217
2218// Expose isAxiosError
2219axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/axios/lib/helpers/isAxiosError.js");
2220
2221module.exports = axios;
2222
2223// Allow use of default import syntax in TypeScript
2224module.exports.default = axios;
2225
2226
2227/***/ }),
2228
vendor: 636 bytes, lines 2229-2258
2229/***/ "./node_modules/axios/lib/cancel/Cancel.js":
2230/*!*************************************************!*\
2231  !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
2232  \*************************************************/
2233/***/ ((module) => {
2234
2235"use strict";
2236
2237
2238/**
2239 * A `Cancel` is an object that is thrown when an operation is canceled.
2240 *
2241 * @class
2242 * @param {string=} message The message.
2243 */
2244function Cancel(message) {
2245  this.message = message;
2246}
2247
2248Cancel.prototype.toString = function toString() {
2249  return 'Cancel' + (this.message ? ': ' + this.message : '');
2250};
2251
2252Cancel.prototype.__CANCEL__ = true;
2253
2254module.exports = Cancel;
2255
2256
2257/***/ }),
2258
vendor: 1,619 bytes, lines 2259-2326
2259/***/ "./node_modules/axios/lib/cancel/CancelToken.js":
2260/*!******************************************************!*\
2261  !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
2262  \******************************************************/
2263/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2264
2265"use strict";
2266
2267
2268var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
2269
2270/**
2271 * A `CancelToken` is an object that can be used to request cancellation of an operation.
2272 *
2273 * @class
2274 * @param {Function} executor The executor function.
2275 */
2276function CancelToken(executor) {
2277  if (typeof executor !== 'function') {
2278    throw new TypeError('executor must be a function.');
2279  }
2280
2281  var resolvePromise;
2282  this.promise = new Promise(function promiseExecutor(resolve) {
2283    resolvePromise = resolve;
2284  });
2285
2286  var token = this;
2287  executor(function cancel(message) {
2288    if (token.reason) {
2289      // Cancellation has already been requested
2290      return;
2291    }
2292
2293    token.reason = new Cancel(message);
2294    resolvePromise(token.reason);
2295  });
2296}
2297
2298/**
2299 * Throws a `Cancel` if cancellation has been requested.
2300 */
2301CancelToken.prototype.throwIfRequested = function throwIfRequested() {
2302  if (this.reason) {
2303    throw this.reason;
2304  }
2305};
2306
2307/**
2308 * Returns an object that contains a new `CancelToken` and a function that, when called,
2309 * cancels the `CancelToken`.
2310 */
2311CancelToken.source = function source() {
2312  var cancel;
2313  var token = new CancelToken(function executor(c) {
2314    cancel = c;
2315  });
2316  return {
2317    token: token,
2318    cancel: cancel
2319  };
2320};
2321
2322module.exports = CancelToken;
2323
2324
2325/***/ }),
2326
vendor: 361 bytes, lines 2327-2342
2327/***/ "./node_modules/axios/lib/cancel/isCancel.js":
2328/*!***************************************************!*\
2329  !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
2330  \***************************************************/
2331/***/ ((module) => {
2332
2333"use strict";
2334
2335
2336module.exports = function isCancel(value) {
2337  return !!(value && value.__CANCEL__);
2338};
2339
2340
2341/***/ }),
2342
vendor: 3,254 bytes, lines 2343-2448
2343/***/ "./node_modules/axios/lib/core/Axios.js":
2344/*!**********************************************!*\
2345  !*** ./node_modules/axios/lib/core/Axios.js ***!
2346  \**********************************************/
2347/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2348
2349"use strict";
2350
2351
2352var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
2353var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
2354var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
2355var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
2356var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
2357
2358/**
2359 * Create a new instance of Axios
2360 *
2361 * @param {Object} instanceConfig The default config for the instance
2362 */
2363function Axios(instanceConfig) {
2364  this.defaults = instanceConfig;
2365  this.interceptors = {
2366    request: new InterceptorManager(),
2367    response: new InterceptorManager()
2368  };
2369}
2370
2371/**
2372 * Dispatch a request
2373 *
2374 * @param {Object} config The config specific for this request (merged with this.defaults)
2375 */
2376Axios.prototype.request = function request(config) {
2377  /*eslint no-param-reassign:0*/
2378  // Allow for axios('example/url'[, config]) a la fetch API
2379  if (typeof config === 'string') {
2380    config = arguments[1] || {};
2381    config.url = arguments[0];
2382  } else {
2383    config = config || {};
2384  }
2385
2386  config = mergeConfig(this.defaults, config);
2387
2388  // Set config.method
2389  if (config.method) {
2390    config.method = config.method.toLowerCase();
2391  } else if (this.defaults.method) {
2392    config.method = this.defaults.method.toLowerCase();
2393  } else {
2394    config.method = 'get';
2395  }
2396
2397  // Hook up interceptors middleware
2398  var chain = [dispatchRequest, undefined];
2399  var promise = Promise.resolve(config);
2400
2401  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2402    chain.unshift(interceptor.fulfilled, interceptor.rejected);
2403  });
2404
2405  this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2406    chain.push(interceptor.fulfilled, interceptor.rejected);
2407  });
2408
2409  while (chain.length) {
2410    promise = promise.then(chain.shift(), chain.shift());
2411  }
2412
2413  return promise;
2414};
2415
2416Axios.prototype.getUri = function getUri(config) {
2417  config = mergeConfig(this.defaults, config);
2418  return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
2419};
2420
2421// Provide aliases for supported request methods
2422utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2423  /*eslint func-names:0*/
2424  Axios.prototype[method] = function(url, config) {
2425    return this.request(mergeConfig(config || {}, {
2426      method: method,
2427      url: url,
2428      data: (config || {}).data
2429    }));
2430  };
2431});
2432
2433utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2434  /*eslint func-names:0*/
2435  Axios.prototype[method] = function(url, data, config) {
2436    return this.request(mergeConfig(config || {}, {
2437      method: method,
2438      url: url,
2439      data: data
2440    }));
2441  };
2442});
2443
2444module.exports = Axios;
2445
2446
2447/***/ }),
2448
vendor: 1,642 bytes, lines 2449-2511
2449/***/ "./node_modules/axios/lib/core/InterceptorManager.js":
2450/*!***********************************************************!*\
2451  !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
2452  \***********************************************************/
2453/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2454
2455"use strict";
2456
2457
2458var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
2459
2460function InterceptorManager() {
2461  this.handlers = [];
2462}
2463
2464/**
2465 * Add a new interceptor to the stack
2466 *
2467 * @param {Function} fulfilled The function to handle `then` for a `Promise`
2468 * @param {Function} rejected The function to handle `reject` for a `Promise`
2469 *
2470 * @return {Number} An ID used to remove interceptor later
2471 */
2472InterceptorManager.prototype.use = function use(fulfilled, rejected) {
2473  this.handlers.push({
2474    fulfilled: fulfilled,
2475    rejected: rejected
2476  });
2477  return this.handlers.length - 1;
2478};
2479
2480/**
2481 * Remove an interceptor from the stack
2482 *
2483 * @param {Number} id The ID that was returned by `use`
2484 */
2485InterceptorManager.prototype.eject = function eject(id) {
2486  if (this.handlers[id]) {
2487    this.handlers[id] = null;
2488  }
2489};
2490
2491/**
2492 * Iterate over all the registered interceptors
2493 *
2494 * This method is particularly useful for skipping over any
2495 * interceptors that may have become `null` calling `eject`.
2496 *
2497 * @param {Function} fn The function to call for each interceptor
2498 */
2499InterceptorManager.prototype.forEach = function forEach(fn) {
2500  utils.forEach(this.handlers, function forEachHandler(h) {
2501    if (h !== null) {
2502      fn(h);
2503    }
2504  });
2505};
2506
2507module.exports = InterceptorManager;
2508
2509
2510/***/ }),
2511
vendor: 1,149 bytes, lines 2512-2542
2512/***/ "./node_modules/axios/lib/core/buildFullPath.js":
2513/*!******************************************************!*\
2514  !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
2515  \******************************************************/
2516/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2517
2518"use strict";
2519
2520
2521var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
2522var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
2523
2524/**
2525 * Creates a new URL by combining the baseURL with the requestedURL,
2526 * only when the requestedURL is not already an absolute URL.
2527 * If the requestURL is absolute, this function returns the requestedURL untouched.
2528 *
2529 * @param {string} baseURL The base URL
2530 * @param {string} requestedURL Absolute or relative URL to combine
2531 * @returns {string} The combined full path
2532 */
2533module.exports = function buildFullPath(baseURL, requestedURL) {
2534  if (baseURL && !isAbsoluteURL(requestedURL)) {
2535    return combineURLs(baseURL, requestedURL);
2536  }
2537  return requestedURL;
2538};
2539
2540
2541/***/ }),
2542
vendor: 1,000 bytes, lines 2543-2571
2543/***/ "./node_modules/axios/lib/core/createError.js":
2544/*!****************************************************!*\
2545  !*** ./node_modules/axios/lib/core/createError.js ***!
2546  \****************************************************/
2547/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2548
2549"use strict";
2550
2551
2552var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
2553
2554/**
2555 * Create an Error with the specified message, config, error code, request and response.
2556 *
2557 * @param {string} message The error message.
2558 * @param {Object} config The config.
2559 * @param {string} [code] The error code (for example, 'ECONNABORTED').
2560 * @param {Object} [request] The request.
2561 * @param {Object} [response] The response.
2562 * @returns {Error} The created error.
2563 */
2564module.exports = function createError(message, config, code, request, response) {
2565  var error = new Error(message);
2566  return enhanceError(error, config, code, request, response);
2567};
2568
2569
2570/***/ }),
2571
vendor: 2,498 bytes, lines 2572-2661
2572/***/ "./node_modules/axios/lib/core/dispatchRequest.js":
2573/*!********************************************************!*\
2574  !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
2575  \********************************************************/
2576/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2577
2578"use strict";
2579
2580
2581var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
2582var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
2583var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
2584var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
2585
2586/**
2587 * Throws a `Cancel` if cancellation has been requested.
2588 */
2589function throwIfCancellationRequested(config) {
2590  if (config.cancelToken) {
2591    config.cancelToken.throwIfRequested();
2592  }
2593}
2594
2595/**
2596 * Dispatch a request to the server using the configured adapter.
2597 *
2598 * @param {object} config The config that is to be used for the request
2599 * @returns {Promise} The Promise to be fulfilled
2600 */
2601module.exports = function dispatchRequest(config) {
2602  throwIfCancellationRequested(config);
2603
2604  // Ensure headers exist
2605  config.headers = config.headers || {};
2606
2607  // Transform request data
2608  config.data = transformData(
2609    config.data,
2610    config.headers,
2611    config.transformRequest
2612  );
2613
2614  // Flatten headers
2615  config.headers = utils.merge(
2616    config.headers.common || {},
2617    config.headers[config.method] || {},
2618    config.headers
2619  );
2620
2621  utils.forEach(
2622    ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2623    function cleanHeaderConfig(method) {
2624      delete config.headers[method];
2625    }
2626  );
2627
2628  var adapter = config.adapter || defaults.adapter;
2629
2630  return adapter(config).then(function onAdapterResolution(response) {
2631    throwIfCancellationRequested(config);
2632
2633    // Transform response data
2634    response.data = transformData(
2635      response.data,
2636      response.headers,
2637      config.transformResponse
2638    );
2639
2640    return response;
2641  }, function onAdapterRejection(reason) {
2642    if (!isCancel(reason)) {
2643      throwIfCancellationRequested(config);
2644
2645      // Transform response data
2646      if (reason && reason.response) {
2647        reason.response.data = transformData(
2648          reason.response.data,
2649          reason.response.headers,
2650          config.transformResponse
2651        );
2652      }
2653    }
2654
2655    return Promise.reject(reason);
2656  });
2657};
2658
2659
2660/***/ }),
2661
vendor: 1,316 bytes, lines 2662-2714
2662/***/ "./node_modules/axios/lib/core/enhanceError.js":
2663/*!*****************************************************!*\
2664  !*** ./node_modules/axios/lib/core/enhanceError.js ***!
2665  \*****************************************************/
2666/***/ ((module) => {
2667
2668"use strict";
2669
2670
2671/**
2672 * Update an Error with the specified config, error code, and response.
2673 *
2674 * @param {Error} error The error to update.
2675 * @param {Object} config The config.
2676 * @param {string} [code] The error code (for example, 'ECONNABORTED').
2677 * @param {Object} [request] The request.
2678 * @param {Object} [response] The response.
2679 * @returns {Error} The error.
2680 */
2681module.exports = function enhanceError(error, config, code, request, response) {
2682  error.config = config;
2683  if (code) {
2684    error.code = code;
2685  }
2686
2687  error.request = request;
2688  error.response = response;
2689  error.isAxiosError = true;
2690
2691  error.toJSON = function toJSON() {
2692    return {
2693      // Standard
2694      message: this.message,
2695      name: this.name,
2696      // Microsoft
2697      description: this.description,
2698      number: this.number,
2699      // Mozilla
2700      fileName: this.fileName,
2701      lineNumber: this.lineNumber,
2702      columnNumber: this.columnNumber,
2703      stack: this.stack,
2704      // Axios
2705      config: this.config,
2706      code: this.code
2707    };
2708  };
2709  return error;
2710};
2711
2712
2713/***/ }),
2714
vendor: 3,258 bytes, lines 2715-2812
2715/***/ "./node_modules/axios/lib/core/mergeConfig.js":
2716/*!****************************************************!*\
2717  !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
2718  \****************************************************/
2719/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2720
2721"use strict";
2722
2723
2724var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
2725
2726/**
2727 * Config-specific merge-function which creates a new config-object
2728 * by merging two configuration objects together.
2729 *
2730 * @param {Object} config1
2731 * @param {Object} config2
2732 * @returns {Object} New object resulting from merging config2 to config1
2733 */
2734module.exports = function mergeConfig(config1, config2) {
2735  // eslint-disable-next-line no-param-reassign
2736  config2 = config2 || {};
2737  var config = {};
2738
2739  var valueFromConfig2Keys = ['url', 'method', 'data'];
2740  var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
2741  var defaultToConfig2Keys = [
2742    'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
2743    'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
2744    'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
2745    'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
2746    'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
2747  ];
2748  var directMergeKeys = ['validateStatus'];
2749
2750  function getMergedValue(target, source) {
2751    if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2752      return utils.merge(target, source);
2753    } else if (utils.isPlainObject(source)) {
2754      return utils.merge({}, source);
2755    } else if (utils.isArray(source)) {
2756      return source.slice();
2757    }
2758    return source;
2759  }
2760
2761  function mergeDeepProperties(prop) {
2762    if (!utils.isUndefined(config2[prop])) {
2763      config[prop] = getMergedValue(config1[prop], config2[prop]);
2764    } else if (!utils.isUndefined(config1[prop])) {
2765      config[prop] = getMergedValue(undefined, config1[prop]);
2766    }
2767  }
2768
2769  utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
2770    if (!utils.isUndefined(config2[prop])) {
2771      config[prop] = getMergedValue(undefined, config2[prop]);
2772    }
2773  });
2774
2775  utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
2776
2777  utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
2778    if (!utils.isUndefined(config2[prop])) {
2779      config[prop] = getMergedValue(undefined, config2[prop]);
2780    } else if (!utils.isUndefined(config1[prop])) {
2781      config[prop] = getMergedValue(undefined, config1[prop]);
2782    }
2783  });
2784
2785  utils.forEach(directMergeKeys, function merge(prop) {
2786    if (prop in config2) {
2787      config[prop] = getMergedValue(config1[prop], config2[prop]);
2788    } else if (prop in config1) {
2789      config[prop] = getMergedValue(undefined, config1[prop]);
2790    }
2791  });
2792
2793  var axiosKeys = valueFromConfig2Keys
2794    .concat(mergeDeepPropertiesKeys)
2795    .concat(defaultToConfig2Keys)
2796    .concat(directMergeKeys);
2797
2798  var otherKeys = Object
2799    .keys(config1)
2800    .concat(Object.keys(config2))
2801    .filter(function filterAxiosKeys(key) {
2802      return axiosKeys.indexOf(key) === -1;
2803    });
2804
2805  utils.forEach(otherKeys, mergeDeepProperties);
2806
2807  return config;
2808};
2809
2810
2811/***/ }),
2812
vendor: 1,060 bytes, lines 2813-2848
2813/***/ "./node_modules/axios/lib/core/settle.js":
2814/*!***********************************************!*\
2815  !*** ./node_modules/axios/lib/core/settle.js ***!
2816  \***********************************************/
2817/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2818
2819"use strict";
2820
2821
2822var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
2823
2824/**
2825 * Resolve or reject a Promise based on response status.
2826 *
2827 * @param {Function} resolve A function that resolves the promise.
2828 * @param {Function} reject A function that rejects the promise.
2829 * @param {object} response The response.
2830 */
2831module.exports = function settle(resolve, reject, response) {
2832  var validateStatus = response.config.validateStatus;
2833  if (!response.status || !validateStatus || validateStatus(response.status)) {
2834    resolve(response);
2835  } else {
2836    reject(createError(
2837      'Request failed with status code ' + response.status,
2838      response.config,
2839      null,
2840      response.request,
2841      response
2842    ));
2843  }
2844};
2845
2846
2847/***/ }),
2848
vendor: 921 bytes, lines 2849-2879
2849/***/ "./node_modules/axios/lib/core/transformData.js":
2850/*!******************************************************!*\
2851  !*** ./node_modules/axios/lib/core/transformData.js ***!
2852  \******************************************************/
2853/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2854
2855"use strict";
2856
2857
2858var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
2859
2860/**
2861 * Transform the data for a request or a response
2862 *
2863 * @param {Object|String} data The data to be transformed
2864 * @param {Array} headers The headers for the request or response
2865 * @param {Array|Function} fns A single function or Array of functions
2866 * @returns {*} The resulting transformed data
2867 */
2868module.exports = function transformData(data, headers, fns) {
2869  /*eslint no-param-reassign:0*/
2870  utils.forEach(fns, function transform(fn) {
2871    data = fn(data, headers);
2872  });
2873
2874  return data;
2875};
2876
2877
2878/***/ }),
2879
vendor: 3,210 bytes, lines 2880-2989
2880/***/ "./node_modules/axios/lib/defaults.js":
2881/*!********************************************!*\
2882  !*** ./node_modules/axios/lib/defaults.js ***!
2883  \********************************************/
2884/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2885
2886"use strict";
2887/* provided dependency */ var process = __webpack_require__(/*! process/browser */ "./node_modules/process/browser.js");
2888
2889
2890var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
2891var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
2892
2893var DEFAULT_CONTENT_TYPE = {
2894  'Content-Type': 'application/x-www-form-urlencoded'
2895};
2896
2897function setContentTypeIfUnset(headers, value) {
2898  if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
2899    headers['Content-Type'] = value;
2900  }
2901}
2902
2903function getDefaultAdapter() {
2904  var adapter;
2905  if (typeof XMLHttpRequest !== 'undefined') {
2906    // For browsers use XHR adapter
2907    adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
2908  } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
2909    // For node use HTTP adapter
2910    adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
2911  }
2912  return adapter;
2913}
2914
2915var defaults = {
2916  adapter: getDefaultAdapter(),
2917
2918  transformRequest: [function transformRequest(data, headers) {
2919    normalizeHeaderName(headers, 'Accept');
2920    normalizeHeaderName(headers, 'Content-Type');
2921    if (utils.isFormData(data) ||
2922      utils.isArrayBuffer(data) ||
2923      utils.isBuffer(data) ||
2924      utils.isStream(data) ||
2925      utils.isFile(data) ||
2926      utils.isBlob(data)
2927    ) {
2928      return data;
2929    }
2930    if (utils.isArrayBufferView(data)) {
2931      return data.buffer;
2932    }
2933    if (utils.isURLSearchParams(data)) {
2934      setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
2935      return data.toString();
2936    }
2937    if (utils.isObject(data)) {
2938      setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
2939      return JSON.stringify(data);
2940    }
2941    return data;
2942  }],
2943
2944  transformResponse: [function transformResponse(data) {
2945    /*eslint no-param-reassign:0*/
2946    if (typeof data === 'string') {
2947      try {
2948        data = JSON.parse(data);
2949      } catch (e) { /* Ignore */ }
2950    }
2951    return data;
2952  }],
2953
2954  /**
2955   * A timeout in milliseconds to abort a request. If set to 0 (default) a
2956   * timeout is not created.
2957   */
2958  timeout: 0,
2959
2960  xsrfCookieName: 'XSRF-TOKEN',
2961  xsrfHeaderName: 'X-XSRF-TOKEN',
2962
2963  maxContentLength: -1,
2964  maxBodyLength: -1,
2965
2966  validateStatus: function validateStatus(status) {
2967    return status >= 200 && status < 300;
2968  }
2969};
2970
2971defaults.headers = {
2972  common: {
2973    'Accept': 'application/json, text/plain, */*'
2974  }
2975};
2976
2977utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
2978  defaults.headers[method] = {};
2979});
2980
2981utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2982  defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
2983});
2984
2985module.exports = defaults;
2986
2987
2988/***/ }),
2989
vendor: 503 bytes, lines 2990-3011
2990/***/ "./node_modules/axios/lib/helpers/bind.js":
2991/*!************************************************!*\
2992  !*** ./node_modules/axios/lib/helpers/bind.js ***!
2993  \************************************************/
2994/***/ ((module) => {
2995
2996"use strict";
2997
2998
2999module.exports = function bind(fn, thisArg) {
3000  return function wrap() {
3001    var args = new Array(arguments.length);
3002    for (var i = 0; i < args.length; i++) {
3003      args[i] = arguments[i];
3004    }
3005    return fn.apply(thisArg, args);
3006  };
3007};
3008
3009
3010/***/ }),
3011
vendor: 2,007 bytes, lines 3012-3092
3012/***/ "./node_modules/axios/lib/helpers/buildURL.js":
3013/*!****************************************************!*\
3014  !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
3015  \****************************************************/
3016/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3017
3018"use strict";
3019
3020
3021var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
3022
3023function encode(val) {
3024  return encodeURIComponent(val).
3025    replace(/%3A/gi, ':').
3026    replace(/%24/g, '$').
3027    replace(/%2C/gi, ',').
3028    replace(/%20/g, '+').
3029    replace(/%5B/gi, '[').
3030    replace(/%5D/gi, ']');
3031}
3032
3033/**
3034 * Build a URL by appending params to the end
3035 *
3036 * @param {string} url The base of the url (e.g., http://www.google.com)
3037 * @param {object} [params] The params to be appended
3038 * @returns {string} The formatted url
3039 */
3040module.exports = function buildURL(url, params, paramsSerializer) {
3041  /*eslint no-param-reassign:0*/
3042  if (!params) {
3043    return url;
3044  }
3045
3046  var serializedParams;
3047  if (paramsSerializer) {
3048    serializedParams = paramsSerializer(params);
3049  } else if (utils.isURLSearchParams(params)) {
3050    serializedParams = params.toString();
3051  } else {
3052    var parts = [];
3053
3054    utils.forEach(params, function serialize(val, key) {
3055      if (val === null || typeof val === 'undefined') {
3056        return;
3057      }
3058
3059      if (utils.isArray(val)) {
3060        key = key + '[]';
3061      } else {
3062        val = [val];
3063      }
3064
3065      utils.forEach(val, function parseValue(v) {
3066        if (utils.isDate(v)) {
3067          v = v.toISOString();
3068        } else if (utils.isObject(v)) {
3069          v = JSON.stringify(v);
3070        }
3071        parts.push(encode(key) + '=' + encode(v));
3072      });
3073    });
3074
3075    serializedParams = parts.join('&');
3076  }
3077
3078  if (serializedParams) {
3079    var hashmarkIndex = url.indexOf('#');
3080    if (hashmarkIndex !== -1) {
3081      url = url.slice(0, hashmarkIndex);
3082    }
3083
3084    url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
3085  }
3086
3087  return url;
3088};
3089
3090
3091/***/ }),
3092
vendor: 655 bytes, lines 3093-3117
3093/***/ "./node_modules/axios/lib/helpers/combineURLs.js":
3094/*!*******************************************************!*\
3095  !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
3096  \*******************************************************/
3097/***/ ((module) => {
3098
3099"use strict";
3100
3101
3102/**
3103 * Creates a new URL by combining the specified URLs
3104 *
3105 * @param {string} baseURL The base URL
3106 * @param {string} relativeURL The relative URL
3107 * @returns {string} The combined URL
3108 */
3109module.exports = function combineURLs(baseURL, relativeURL) {
3110  return relativeURL
3111    ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
3112    : baseURL;
3113};
3114
3115
3116/***/ }),
3117
vendor: 1,794 bytes, lines 3118-3181
3118/***/ "./node_modules/axios/lib/helpers/cookies.js":
3119/*!***************************************************!*\
3120  !*** ./node_modules/axios/lib/helpers/cookies.js ***!
3121  \***************************************************/
3122/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3123
3124"use strict";
3125
3126
3127var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
3128
3129module.exports = (
3130  utils.isStandardBrowserEnv() ?
3131
3132  // Standard browser envs support document.cookie
3133    (function standardBrowserEnv() {
3134      return {
3135        write: function write(name, value, expires, path, domain, secure) {
3136          var cookie = [];
3137          cookie.push(name + '=' + encodeURIComponent(value));
3138
3139          if (utils.isNumber(expires)) {
3140            cookie.push('expires=' + new Date(expires).toGMTString());
3141          }
3142
3143          if (utils.isString(path)) {
3144            cookie.push('path=' + path);
3145          }
3146
3147          if (utils.isString(domain)) {
3148            cookie.push('domain=' + domain);
3149          }
3150
3151          if (secure === true) {
3152            cookie.push('secure');
3153          }
3154
3155          document.cookie = cookie.join('; ');
3156        },
3157
3158        read: function read(name) {
3159          var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
3160          return (match ? decodeURIComponent(match[3]) : null);
3161        },
3162
3163        remove: function remove(name) {
3164          this.write(name, '', Date.now() - 86400000);
3165        }
3166      };
3167    })() :
3168
3169  // Non standard browser env (web workers, react-native) lack needed support.
3170    (function nonStandardBrowserEnv() {
3171      return {
3172        write: function write() {},
3173        read: function read() { return null; },
3174        remove: function remove() {}
3175      };
3176    })()
3177);
3178
3179
3180/***/ }),
3181
vendor: 846 bytes, lines 3182-3206
3182/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
3183/*!*********************************************************!*\
3184  !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
3185  \*********************************************************/
3186/***/ ((module) => {
3187
3188"use strict";
3189
3190
3191/**
3192 * Determines whether the specified URL is absolute
3193 *
3194 * @param {string} url The URL to test
3195 * @returns {boolean} True if the specified URL is absolute, otherwise false
3196 */
3197module.exports = function isAbsoluteURL(url) {
3198  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
3199  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
3200  // by any combination of letters, digits, plus, period, or hyphen.
3201  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
3202};
3203
3204
3205/***/ }),
3206
vendor: 622 bytes, lines 3207-3228
3207/***/ "./node_modules/axios/lib/helpers/isAxiosError.js":
3208/*!********************************************************!*\
3209  !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***!
3210  \********************************************************/
3211/***/ ((module) => {
3212
3213"use strict";
3214
3215
3216/**
3217 * Determines whether the payload is an error thrown by Axios
3218 *
3219 * @param {*} payload The value to test
3220 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3221 */
3222module.exports = function isAxiosError(payload) {
3223  return (typeof payload === 'object') && (payload.isAxiosError === true);
3224};
3225
3226
3227/***/ }),
3228
vendor: 2,696 bytes, lines 3229-3307
3229/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
3230/*!***********************************************************!*\
3231  !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
3232  \***********************************************************/
3233/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3234
3235"use strict";
3236
3237
3238var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
3239
3240module.exports = (
3241  utils.isStandardBrowserEnv() ?
3242
3243  // Standard browser envs have full support of the APIs needed to test
3244  // whether the request URL is of the same origin as current location.
3245    (function standardBrowserEnv() {
3246      var msie = /(msie|trident)/i.test(navigator.userAgent);
3247      var urlParsingNode = document.createElement('a');
3248      var originURL;
3249
3250      /**
3251    * Parse a URL to discover it's components
3252    *
3253    * @param {String} url The URL to be parsed
3254    * @returns {Object}
3255    */
3256      function resolveURL(url) {
3257        var href = url;
3258
3259        if (msie) {
3260        // IE needs attribute set twice to normalize properties
3261          urlParsingNode.setAttribute('href', href);
3262          href = urlParsingNode.href;
3263        }
3264
3265        urlParsingNode.setAttribute('href', href);
3266
3267        // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
3268        return {
3269          href: urlParsingNode.href,
3270          protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
3271          host: urlParsingNode.host,
3272          search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
3273          hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
3274          hostname: urlParsingNode.hostname,
3275          port: urlParsingNode.port,
3276          pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
3277            urlParsingNode.pathname :
3278            '/' + urlParsingNode.pathname
3279        };
3280      }
3281
3282      originURL = resolveURL(window.location.href);
3283
3284      /**
3285    * Determine if a URL shares the same origin as the current location
3286    *
3287    * @param {String} requestURL The URL to test
3288    * @returns {boolean} True if URL shares the same origin, otherwise false
3289    */
3290      return function isURLSameOrigin(requestURL) {
3291        var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
3292        return (parsed.protocol === originURL.protocol &&
3293            parsed.host === originURL.host);
3294      };
3295    })() :
3296
3297  // Non standard browser envs (web workers, react-native) lack needed support.
3298    (function nonStandardBrowserEnv() {
3299      return function isURLSameOrigin() {
3300        return true;
3301      };
3302    })()
3303);
3304
3305
3306/***/ }),
3307
vendor: 764 bytes, lines 3308-3330
3308/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
3309/*!***************************************************************!*\
3310  !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
3311  \***************************************************************/
3312/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3313
3314"use strict";
3315
3316
3317var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
3318
3319module.exports = function normalizeHeaderName(headers, normalizedName) {
3320  utils.forEach(headers, function processHeader(value, name) {
3321    if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
3322      headers[normalizedName] = value;
3323      delete headers[name];
3324    }
3325  });
3326};
3327
3328
3329/***/ }),
3330
vendor: 1,772 bytes, lines 3331-3394
3331/***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
3332/*!********************************************************!*\
3333  !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
3334  \********************************************************/
3335/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3336
3337"use strict";
3338
3339
3340var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
3341
3342// Headers whose duplicates are ignored by node
3343// c.f. https://nodejs.org/api/http.html#http_message_headers
3344var ignoreDuplicateOf = [
3345  'age', 'authorization', 'content-length', 'content-type', 'etag',
3346  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
3347  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
3348  'referer', 'retry-after', 'user-agent'
3349];
3350
3351/**
3352 * Parse headers into an object
3353 *
3354 * ```
3355 * Date: Wed, 27 Aug 2014 08:58:49 GMT
3356 * Content-Type: application/json
3357 * Connection: keep-alive
3358 * Transfer-Encoding: chunked
3359 * ```
3360 *
3361 * @param {String} headers Headers needing to be parsed
3362 * @returns {Object} Headers parsed into an object
3363 */
3364module.exports = function parseHeaders(headers) {
3365  var parsed = {};
3366  var key;
3367  var val;
3368  var i;
3369
3370  if (!headers) { return parsed; }
3371
3372  utils.forEach(headers.split('\n'), function parser(line) {
3373    i = line.indexOf(':');
3374    key = utils.trim(line.substr(0, i)).toLowerCase();
3375    val = utils.trim(line.substr(i + 1));
3376
3377    if (key) {
3378      if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
3379        return;
3380      }
3381      if (key === 'set-cookie') {
3382        parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
3383      } else {
3384        parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
3385      }
3386    }
3387  });
3388
3389  return parsed;
3390};
3391
3392
3393/***/ }),
3394
vendor: 819 bytes, lines 3395-3432
3395/***/ "./node_modules/axios/lib/helpers/spread.js":
3396/*!**************************************************!*\
3397  !*** ./node_modules/axios/lib/helpers/spread.js ***!
3398  \**************************************************/
3399/***/ ((module) => {
3400
3401"use strict";
3402
3403
3404/**
3405 * Syntactic sugar for invoking a function and expanding an array for arguments.
3406 *
3407 * Common use case would be to use `Function.prototype.apply`.
3408 *
3409 *  ```js
3410 *  function f(x, y, z) {}
3411 *  var args = [1, 2, 3];
3412 *  f.apply(null, args);
3413 *  ```
3414 *
3415 * With `spread` this example can be re-written.
3416 *
3417 *  ```js
3418 *  spread(function(x, y, z) {})([1, 2, 3]);
3419 *  ```
3420 *
3421 * @param {Function} callback
3422 * @returns {Function}
3423 */
3424module.exports = function spread(callback) {
3425  return function wrap(arr) {
3426    return callback.apply(null, arr);
3427  };
3428};
3429
3430
3431/***/ }),
3432
vendor: 9,273 bytes, lines 3433-3794
3433/***/ "./node_modules/axios/lib/utils.js":
3434/*!*****************************************!*\
3435  !*** ./node_modules/axios/lib/utils.js ***!
3436  \*****************************************/
3437/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3438
3439"use strict";
3440
3441
3442var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
3443
3444/*global toString:true*/
3445
3446// utils is a library of generic helper functions non-specific to axios
3447
3448var toString = Object.prototype.toString;
3449
3450/**
3451 * Determine if a value is an Array
3452 *
3453 * @param {Object} val The value to test
3454 * @returns {boolean} True if value is an Array, otherwise false
3455 */
3456function isArray(val) {
3457  return toString.call(val) === '[object Array]';
3458}
3459
3460/**
3461 * Determine if a value is undefined
3462 *
3463 * @param {Object} val The value to test
3464 * @returns {boolean} True if the value is undefined, otherwise false
3465 */
3466function isUndefined(val) {
3467  return typeof val === 'undefined';
3468}
3469
3470/**
3471 * Determine if a value is a Buffer
3472 *
3473 * @param {Object} val The value to test
3474 * @returns {boolean} True if value is a Buffer, otherwise false
3475 */
3476function isBuffer(val) {
3477  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
3478    && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
3479}
3480
3481/**
3482 * Determine if a value is an ArrayBuffer
3483 *
3484 * @param {Object} val The value to test
3485 * @returns {boolean} True if value is an ArrayBuffer, otherwise false
3486 */
3487function isArrayBuffer(val) {
3488  return toString.call(val) === '[object ArrayBuffer]';
3489}
3490
3491/**
3492 * Determine if a value is a FormData
3493 *
3494 * @param {Object} val The value to test
3495 * @returns {boolean} True if value is an FormData, otherwise false
3496 */
3497function isFormData(val) {
3498  return (typeof FormData !== 'undefined') && (val instanceof FormData);
3499}
3500
3501/**
3502 * Determine if a value is a view on an ArrayBuffer
3503 *
3504 * @param {Object} val The value to test
3505 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
3506 */
3507function isArrayBufferView(val) {
3508  var result;
3509  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
3510    result = ArrayBuffer.isView(val);
3511  } else {
3512    result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
3513  }
3514  return result;
3515}
3516
3517/**
3518 * Determine if a value is a String
3519 *
3520 * @param {Object} val The value to test
3521 * @returns {boolean} True if value is a String, otherwise false
3522 */
3523function isString(val) {
3524  return typeof val === 'string';
3525}
3526
3527/**
3528 * Determine if a value is a Number
3529 *
3530 * @param {Object} val The value to test
3531 * @returns {boolean} True if value is a Number, otherwise false
3532 */
3533function isNumber(val) {
3534  return typeof val === 'number';
3535}
3536
3537/**
3538 * Determine if a value is an Object
3539 *
3540 * @param {Object} val The value to test
3541 * @returns {boolean} True if value is an Object, otherwise false
3542 */
3543function isObject(val) {
3544  return val !== null && typeof val === 'object';
3545}
3546
3547/**
3548 * Determine if a value is a plain Object
3549 *
3550 * @param {Object} val The value to test
3551 * @return {boolean} True if value is a plain Object, otherwise false
3552 */
3553function isPlainObject(val) {
3554  if (toString.call(val) !== '[object Object]') {
3555    return false;
3556  }
3557
3558  var prototype = Object.getPrototypeOf(val);
3559  return prototype === null || prototype === Object.prototype;
3560}
3561
3562/**
3563 * Determine if a value is a Date
3564 *
3565 * @param {Object} val The value to test
3566 * @returns {boolean} True if value is a Date, otherwise false
3567 */
3568function isDate(val) {
3569  return toString.call(val) === '[object Date]';
3570}
3571
3572/**
3573 * Determine if a value is a File
3574 *
3575 * @param {Object} val The value to test
3576 * @returns {boolean} True if value is a File, otherwise false
3577 */
3578function isFile(val) {
3579  return toString.call(val) === '[object File]';
3580}
3581
3582/**
3583 * Determine if a value is a Blob
3584 *
3585 * @param {Object} val The value to test
3586 * @returns {boolean} True if value is a Blob, otherwise false
3587 */
3588function isBlob(val) {
3589  return toString.call(val) === '[object Blob]';
3590}
3591
3592/**
3593 * Determine if a value is a Function
3594 *
3595 * @param {Object} val The value to test
3596 * @returns {boolean} True if value is a Function, otherwise false
3597 */
3598function isFunction(val) {
3599  return toString.call(val) === '[object Function]';
3600}
3601
3602/**
3603 * Determine if a value is a Stream
3604 *
3605 * @param {Object} val The value to test
3606 * @returns {boolean} True if value is a Stream, otherwise false
3607 */
3608function isStream(val) {
3609  return isObject(val) && isFunction(val.pipe);
3610}
3611
3612/**
3613 * Determine if a value is a URLSearchParams object
3614 *
3615 * @param {Object} val The value to test
3616 * @returns {boolean} True if value is a URLSearchParams object, otherwise false
3617 */
3618function isURLSearchParams(val) {
3619  return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
3620}
3621
3622/**
3623 * Trim excess whitespace off the beginning and end of a string
3624 *
3625 * @param {String} str The String to trim
3626 * @returns {String} The String freed of excess whitespace
3627 */
3628function trim(str) {
3629  return str.replace(/^\s*/, '').replace(/\s*$/, '');
3630}
3631
3632/**
3633 * Determine if we're running in a standard browser environment
3634 *
3635 * This allows axios to run in a web worker, and react-native.
3636 * Both environments support XMLHttpRequest, but not fully standard globals.
3637 *
3638 * web workers:
3639 *  typeof window -> undefined
3640 *  typeof document -> undefined
3641 *
3642 * react-native:
3643 *  navigator.product -> 'ReactNative'
3644 * nativescript
3645 *  navigator.product -> 'NativeScript' or 'NS'
3646 */
3647function isStandardBrowserEnv() {
3648  if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
3649                                           navigator.product === 'NativeScript' ||
3650                                           navigator.product === 'NS')) {
3651    return false;
3652  }
3653  return (
3654    typeof window !== 'undefined' &&
3655    typeof document !== 'undefined'
3656  );
3657}
3658
3659/**
3660 * Iterate over an Array or an Object invoking a function for each item.
3661 *
3662 * If `obj` is an Array callback will be called passing
3663 * the value, index, and complete array for each item.
3664 *
3665 * If 'obj' is an Object callback will be called passing
3666 * the value, key, and complete object for each property.
3667 *
3668 * @param {Object|Array} obj The object to iterate
3669 * @param {Function} fn The callback to invoke for each item
3670 */
3671function forEach(obj, fn) {
3672  // Don't bother if no value provided
3673  if (obj === null || typeof obj === 'undefined') {
3674    return;
3675  }
3676
3677  // Force an array if not already something iterable
3678  if (typeof obj !== 'object') {
3679    /*eslint no-param-reassign:0*/
3680    obj = [obj];
3681  }
3682
3683  if (isArray(obj)) {
3684    // Iterate over array values
3685    for (var i = 0, l = obj.length; i < l; i++) {
3686      fn.call(null, obj[i], i, obj);
3687    }
3688  } else {
3689    // Iterate over object keys
3690    for (var key in obj) {
3691      if (Object.prototype.hasOwnProperty.call(obj, key)) {
3692        fn.call(null, obj[key], key, obj);
3693      }
3694    }
3695  }
3696}
3697
3698/**
3699 * Accepts varargs expecting each argument to be an object, then
3700 * immutably merges the properties of each object and returns result.
3701 *
3702 * When multiple objects contain the same key the later object in
3703 * the arguments list will take precedence.
3704 *
3705 * Example:
3706 *
3707 * ```js
3708 * var result = merge({foo: 123}, {foo: 456});
3709 * console.log(result.foo); // outputs 456
3710 * ```
3711 *
3712 * @param {Object} obj1 Object to merge
3713 * @returns {Object} Result of all merge properties
3714 */
3715function merge(/* obj1, obj2, obj3, ... */) {
3716  var result = {};
3717  function assignValue(val, key) {
3718    if (isPlainObject(result[key]) && isPlainObject(val)) {
3719      result[key] = merge(result[key], val);
3720    } else if (isPlainObject(val)) {
3721      result[key] = merge({}, val);
3722    } else if (isArray(val)) {
3723      result[key] = val.slice();
3724    } else {
3725      result[key] = val;
3726    }
3727  }
3728
3729  for (var i = 0, l = arguments.length; i < l; i++) {
3730    forEach(arguments[i], assignValue);
3731  }
3732  return result;
3733}
3734
3735/**
3736 * Extends object a by mutably adding to it the properties of object b.
3737 *
3738 * @param {Object} a The object to be extended
3739 * @param {Object} b The object to copy properties from
3740 * @param {Object} thisArg The object to bind function to
3741 * @return {Object} The resulting value of object a
3742 */
3743function extend(a, b, thisArg) {
3744  forEach(b, function assignValue(val, key) {
3745    if (thisArg && typeof val === 'function') {
3746      a[key] = bind(val, thisArg);
3747    } else {
3748      a[key] = val;
3749    }
3750  });
3751  return a;
3752}
3753
3754/**
3755 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
3756 *
3757 * @param {string} content with BOM
3758 * @return {string} content value without BOM
3759 */
3760function stripBOM(content) {
3761  if (content.charCodeAt(0) === 0xFEFF) {
3762    content = content.slice(1);
3763  }
3764  return content;
3765}
3766
3767module.exports = {
3768  isArray: isArray,
3769  isArrayBuffer: isArrayBuffer,
3770  isBuffer: isBuffer,
3771  isFormData: isFormData,
3772  isArrayBufferView: isArrayBufferView,
3773  isString: isString,
3774  isNumber: isNumber,
3775  isObject: isObject,
3776  isPlainObject: isPlainObject,
3777  isUndefined: isUndefined,
3778  isDate: isDate,
3779  isFile: isFile,
3780  isBlob: isBlob,
3781  isFunction: isFunction,
3782  isStream: isStream,
3783  isURLSearchParams: isURLSearchParams,
3784  isStandardBrowserEnv: isStandardBrowserEnv,
3785  forEach: forEach,
3786  merge: merge,
3787  extend: extend,
3788  trim: trim,
3789  stripBOM: stripBOM
3790};
3791
3792
3793/***/ }),
3794
3795/***/ "./resources/js/app.js":
3796/*!*****************************!*\
3797  !*** ./resources/js/app.js ***!
3798  \*****************************/
3799/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
3800
3801__webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
3802
3803__webpack_require__(/*! alpinejs */ "./node_modules/alpinejs/dist/alpine.js");
3804
3805/***/ }),
3806
3807/***/ "./resources/js/bootstrap.js":
3808/*!***********************************!*\
3809  !*** ./resources/js/bootstrap.js ***!
3810  \***********************************/
3811/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
3812
3813window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
3814/**
3815 * We'll load the axios HTTP library which allows us to easily issue requests
3816 * to our Laravel back-end. This library automatically handles sending the
3817 * CSRF token as a header based on the value of the "XSRF" token cookie.
3818 */
3819
3820window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
3821window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
3822/**
3823 * Echo exposes an expressive API for subscribing to channels and listening
3824 * for events that are broadcast by Laravel. Echo and event broadcasting
3825 * allows your team to easily build robust real-time web applications.
3826 */
3827// import Echo from 'laravel-echo';
3828// window.Pusher = require('pusher-js');
3829// window.Echo = new Echo({
3830//     broadcaster: 'pusher',
3831//     key: process.env.MIX_PUSHER_APP_KEY,
3832//     cluster: process.env.MIX_PUSHER_APP_CLUSTER,
3833//     forceTLS: true
3834// });
3835
3836/***/ }),
3837
vendor: 544,380 bytes, lines 3838-21049
3838/***/ "./node_modules/lodash/lodash.js":
3839/*!***************************************!*\
3840  !*** ./node_modules/lodash/lodash.js ***!
3841  \***************************************/
3842/***/ (function(module, exports, __webpack_require__) {
3843
3844/* module decorator */ module = __webpack_require__.nmd(module);
3845var __WEBPACK_AMD_DEFINE_RESULT__;/**
3846 * @license
3847 * Lodash <https://lodash.com/>
3848 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
3849 * Released under MIT license <https://lodash.com/license>
3850 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
3851 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3852 */
3853;(function() {
3854
3855  /** Used as a safe reference for `undefined` in pre-ES5 environments. */
3856  var undefined;
3857
3858  /** Used as the semantic version number. */
3859  var VERSION = '4.17.21';
3860
3861  /** Used as the size to enable large array optimizations. */
3862  var LARGE_ARRAY_SIZE = 200;
3863
3864  /** Error message constants. */
3865  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
3866      FUNC_ERROR_TEXT = 'Expected a function',
3867      INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
3868
3869  /** Used to stand-in for `undefined` hash values. */
3870  var HASH_UNDEFINED = '__lodash_hash_undefined__';
3871
3872  /** Used as the maximum memoize cache size. */
3873  var MAX_MEMOIZE_SIZE = 500;
3874
3875  /** Used as the internal argument placeholder. */
3876  var PLACEHOLDER = '__lodash_placeholder__';
3877
3878  /** Used to compose bitmasks for cloning. */
3879  var CLONE_DEEP_FLAG = 1,
3880      CLONE_FLAT_FLAG = 2,
3881      CLONE_SYMBOLS_FLAG = 4;
3882
3883  /** Used to compose bitmasks for value comparisons. */
3884  var COMPARE_PARTIAL_FLAG = 1,
3885      COMPARE_UNORDERED_FLAG = 2;
3886
3887  /** Used to compose bitmasks for function metadata. */
3888  var WRAP_BIND_FLAG = 1,
3889      WRAP_BIND_KEY_FLAG = 2,
3890      WRAP_CURRY_BOUND_FLAG = 4,
3891      WRAP_CURRY_FLAG = 8,
3892      WRAP_CURRY_RIGHT_FLAG = 16,
3893      WRAP_PARTIAL_FLAG = 32,
3894      WRAP_PARTIAL_RIGHT_FLAG = 64,
3895      WRAP_ARY_FLAG = 128,
3896      WRAP_REARG_FLAG = 256,
3897      WRAP_FLIP_FLAG = 512;
3898
3899  /** Used as default options for `_.truncate`. */
3900  var DEFAULT_TRUNC_LENGTH = 30,
3901      DEFAULT_TRUNC_OMISSION = '...';
3902
3903  /** Used to detect hot functions by number of calls within a span of milliseconds. */
3904  var HOT_COUNT = 800,
3905      HOT_SPAN = 16;
3906
3907  /** Used to indicate the type of lazy iteratees. */
3908  var LAZY_FILTER_FLAG = 1,
3909      LAZY_MAP_FLAG = 2,
3910      LAZY_WHILE_FLAG = 3;
3911
3912  /** Used as references for various `Number` constants. */
3913  var INFINITY = 1 / 0,
3914      MAX_SAFE_INTEGER = 9007199254740991,
3915      MAX_INTEGER = 1.7976931348623157e+308,
3916      NAN = 0 / 0;
3917
3918  /** Used as references for the maximum length and index of an array. */
3919  var MAX_ARRAY_LENGTH = 4294967295,
3920      MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
3921      HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
3922
3923  /** Used to associate wrap methods with their bit flags. */
3924  var wrapFlags = [
3925    ['ary', WRAP_ARY_FLAG],
3926    ['bind', WRAP_BIND_FLAG],
3927    ['bindKey', WRAP_BIND_KEY_FLAG],
3928    ['curry', WRAP_CURRY_FLAG],
3929    ['curryRight', WRAP_CURRY_RIGHT_FLAG],
3930    ['flip', WRAP_FLIP_FLAG],
3931    ['partial', WRAP_PARTIAL_FLAG],
3932    ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
3933    ['rearg', WRAP_REARG_FLAG]
3934  ];
3935
3936  /** `Object#toString` result references. */
3937  var argsTag = '[object Arguments]',
3938      arrayTag = '[object Array]',
3939      asyncTag = '[object AsyncFunction]',
3940      boolTag = '[object Boolean]',
3941      dateTag = '[object Date]',
3942      domExcTag = '[object DOMException]',
3943      errorTag = '[object Error]',
3944      funcTag = '[object Function]',
3945      genTag = '[object GeneratorFunction]',
3946      mapTag = '[object Map]',
3947      numberTag = '[object Number]',
3948      nullTag = '[object Null]',
3949      objectTag = '[object Object]',
3950      promiseTag = '[object Promise]',
3951      proxyTag = '[object Proxy]',
3952      regexpTag = '[object RegExp]',
3953      setTag = '[object Set]',
3954      stringTag = '[object String]',
3955      symbolTag = '[object Symbol]',
3956      undefinedTag = '[object Undefined]',
3957      weakMapTag = '[object WeakMap]',
3958      weakSetTag = '[object WeakSet]';
3959
3960  var arrayBufferTag = '[object ArrayBuffer]',
3961      dataViewTag = '[object DataView]',
3962      float32Tag = '[object Float32Array]',
3963      float64Tag = '[object Float64Array]',
3964      int8Tag = '[object Int8Array]',
3965      int16Tag = '[object Int16Array]',
3966      int32Tag = '[object Int32Array]',
3967      uint8Tag = '[object Uint8Array]',
3968      uint8ClampedTag = '[object Uint8ClampedArray]',
3969      uint16Tag = '[object Uint16Array]',
3970      uint32Tag = '[object Uint32Array]';
3971
3972  /** Used to match empty string literals in compiled template source. */
3973  var reEmptyStringLeading = /\b__p \+= '';/g,
3974      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
3975      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
3976
3977  /** Used to match HTML entities and HTML characters. */
3978  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
3979      reUnescapedHtml = /[&<>"']/g,
3980      reHasEscapedHtml = RegExp(reEscapedHtml.source),
3981      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
3982
3983  /** Used to match template delimiters. */
3984  var reEscape = /<%-([\s\S]+?)%>/g,
3985      reEvaluate = /<%([\s\S]+?)%>/g,
3986      reInterpolate = /<%=([\s\S]+?)%>/g;
3987
3988  /** Used to match property names within property paths. */
3989  var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
3990      reIsPlainProp = /^\w*$/,
3991      rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
3992
3993  /**
3994   * Used to match `RegExp`
3995   * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
3996   */
3997  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
3998      reHasRegExpChar = RegExp(reRegExpChar.source);
3999
4000  /** Used to match leading whitespace. */
4001  var reTrimStart = /^\s+/;
4002
4003  /** Used to match a single whitespace character. */
4004  var reWhitespace = /\s/;
4005
4006  /** Used to match wrap detail comments. */
4007  var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
4008      reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
4009      reSplitDetails = /,? & /;
4010
4011  /** Used to match words composed of alphanumeric characters. */
4012  var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
4013
4014  /**
4015   * Used to validate the `validate` option in `_.template` variable.
4016   *
4017   * Forbids characters which could potentially change the meaning of the function argument definition:
4018   * - "()," (modification of function parameters)
4019   * - "=" (default value)
4020   * - "[]{}" (destructuring of function parameters)
4021   * - "/" (beginning of a comment)
4022   * - whitespace
4023   */
4024  var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
4025
4026  /** Used to match backslashes in property paths. */
4027  var reEscapeChar = /\\(\\)?/g;
4028
4029  /**
4030   * Used to match
4031   * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
4032   */
4033  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
4034
4035  /** Used to match `RegExp` flags from their coerced string values. */
4036  var reFlags = /\w*$/;
4037
4038  /** Used to detect bad signed hexadecimal string values. */
4039  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
4040
4041  /** Used to detect binary string values. */
4042  var reIsBinary = /^0b[01]+$/i;
4043
4044  /** Used to detect host constructors (Safari). */
4045  var reIsHostCtor = /^\[object .+?Constructor\]$/;
4046
4047  /** Used to detect octal string values. */
4048  var reIsOctal = /^0o[0-7]+$/i;
4049
4050  /** Used to detect unsigned integer values. */
4051  var reIsUint = /^(?:0|[1-9]\d*)$/;
4052
4053  /** Used to match Latin Unicode letters (excluding mathematical operators). */
4054  var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
4055
4056  /** Used to ensure capturing order of template delimiters. */
4057  var reNoMatch = /($^)/;
4058
4059  /** Used to match unescaped characters in compiled string literals. */
4060  var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
4061
4062  /** Used to compose unicode character classes. */
4063  var rsAstralRange = '\\ud800-\\udfff',
4064      rsComboMarksRange = '\\u0300-\\u036f',
4065      reComboHalfMarksRange = '\\ufe20-\\ufe2f',
4066      rsComboSymbolsRange = '\\u20d0-\\u20ff',
4067      rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
4068      rsDingbatRange = '\\u2700-\\u27bf',
4069      rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
4070      rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
4071      rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
4072      rsPunctuationRange = '\\u2000-\\u206f',
4073      rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
4074      rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
4075      rsVarRange = '\\ufe0e\\ufe0f',
4076      rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
4077
4078  /** Used to compose unicode capture groups. */
4079  var rsApos = "['\u2019]",
4080      rsAstral = '[' + rsAstralRange + ']',
4081      rsBreak = '[' + rsBreakRange + ']',
4082      rsCombo = '[' + rsComboRange + ']',
4083      rsDigits = '\\d+',
4084      rsDingbat = '[' + rsDingbatRange + ']',
4085      rsLower = '[' + rsLowerRange + ']',
4086      rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
4087      rsFitz = '\\ud83c[\\udffb-\\udfff]',
4088      rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
4089      rsNonAstral = '[^' + rsAstralRange + ']',
4090      rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
4091      rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
4092      rsUpper = '[' + rsUpperRange + ']',
4093      rsZWJ = '\\u200d';
4094
4095  /** Used to compose unicode regexes. */
4096  var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
4097      rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
4098      rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
4099      rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
4100      reOptMod = rsModifier + '?',
4101      rsOptVar = '[' + rsVarRange + ']?',
4102      rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
4103      rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
4104      rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
4105      rsSeq = rsOptVar + reOptMod + rsOptJoin,
4106      rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
4107      rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
4108
4109  /** Used to match apostrophes. */
4110  var reApos = RegExp(rsApos, 'g');
4111
4112  /**
4113   * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
4114   * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
4115   */
4116  var reComboMark = RegExp(rsCombo, 'g');
4117
4118  /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
4119  var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
4120
4121  /** Used to match complex or compound words. */
4122  var reUnicodeWord = RegExp([
4123    rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
4124    rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
4125    rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
4126    rsUpper + '+' + rsOptContrUpper,
4127    rsOrdUpper,
4128    rsOrdLower,
4129    rsDigits,
4130    rsEmoji
4131  ].join('|'), 'g');
4132
4133  /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
4134  var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange  + rsComboRange + rsVarRange + ']');
4135
4136  /** Used to detect strings that need a more robust regexp to match words. */
4137  var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
4138
4139  /** Used to assign default `context` object properties. */
4140  var contextProps = [
4141    'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
4142    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
4143    'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
4144    'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
4145    '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
4146  ];
4147
4148  /** Used to make template sourceURLs easier to identify. */
4149  var templateCounter = -1;
4150
4151  /** Used to identify `toStringTag` values of typed arrays. */
4152  var typedArrayTags = {};
4153  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
4154  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
4155  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
4156  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
4157  typedArrayTags[uint32Tag] = true;
4158  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
4159  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
4160  typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
4161  typedArrayTags[errorTag] = typedArrayTags[funcTag] =
4162  typedArrayTags[mapTag] = typedArrayTags[numberTag] =
4163  typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
4164  typedArrayTags[setTag] = typedArrayTags[stringTag] =
4165  typedArrayTags[weakMapTag] = false;
4166
4167  /** Used to identify `toStringTag` values supported by `_.clone`. */
4168  var cloneableTags = {};
4169  cloneableTags[argsTag] = cloneableTags[arrayTag] =
4170  cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
4171  cloneableTags[boolTag] = cloneableTags[dateTag] =
4172  cloneableTags[float32Tag] = cloneableTags[float64Tag] =
4173  cloneableTags[int8Tag] = cloneableTags[int16Tag] =
4174  cloneableTags[int32Tag] = cloneableTags[mapTag] =
4175  cloneableTags[numberTag] = cloneableTags[objectTag] =
4176  cloneableTags[regexpTag] = cloneableTags[setTag] =
4177  cloneableTags[stringTag] = cloneableTags[symbolTag] =
4178  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
4179  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
4180  cloneableTags[errorTag] = cloneableTags[funcTag] =
4181  cloneableTags[weakMapTag] = false;
4182
4183  /** Used to map Latin Unicode letters to basic Latin letters. */
4184  var deburredLetters = {
4185    // Latin-1 Supplement block.
4186    '\xc0': 'A',  '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
4187    '\xe0': 'a',  '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
4188    '\xc7': 'C',  '\xe7': 'c',
4189    '\xd0': 'D',  '\xf0': 'd',
4190    '\xc8': 'E',  '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
4191    '\xe8': 'e',  '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
4192    '\xcc': 'I',  '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
4193    '\xec': 'i',  '\xed': 'i', '\xee': 'i', '\xef': 'i',
4194    '\xd1': 'N',  '\xf1': 'n',
4195    '\xd2': 'O',  '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
4196    '\xf2': 'o',  '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
4197    '\xd9': 'U',  '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
4198    '\xf9': 'u',  '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
4199    '\xdd': 'Y',  '\xfd': 'y', '\xff': 'y',
4200    '\xc6': 'Ae', '\xe6': 'ae',
4201    '\xde': 'Th', '\xfe': 'th',
4202    '\xdf': 'ss',
4203    // Latin Extended-A block.
4204    '\u0100': 'A',  '\u0102': 'A', '\u0104': 'A',
4205    '\u0101': 'a',  '\u0103': 'a', '\u0105': 'a',
4206    '\u0106': 'C',  '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
4207    '\u0107': 'c',  '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
4208    '\u010e': 'D',  '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
4209    '\u0112': 'E',  '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
4210    '\u0113': 'e',  '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
4211    '\u011c': 'G',  '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
4212    '\u011d': 'g',  '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
4213    '\u0124': 'H',  '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
4214    '\u0128': 'I',  '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
4215    '\u0129': 'i',  '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
4216    '\u0134': 'J',  '\u0135': 'j',
4217    '\u0136': 'K',  '\u0137': 'k', '\u0138': 'k',
4218    '\u0139': 'L',  '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
4219    '\u013a': 'l',  '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
4220    '\u0143': 'N',  '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
4221    '\u0144': 'n',  '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
4222    '\u014c': 'O',  '\u014e': 'O', '\u0150': 'O',
4223    '\u014d': 'o',  '\u014f': 'o', '\u0151': 'o',
4224    '\u0154': 'R',  '\u0156': 'R', '\u0158': 'R',
4225    '\u0155': 'r',  '\u0157': 'r', '\u0159': 'r',
4226    '\u015a': 'S',  '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
4227    '\u015b': 's',  '\u015d': 's', '\u015f': 's', '\u0161': 's',
4228    '\u0162': 'T',  '\u0164': 'T', '\u0166': 'T',
4229    '\u0163': 't',  '\u0165': 't', '\u0167': 't',
4230    '\u0168': 'U',  '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
4231    '\u0169': 'u',  '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
4232    '\u0174': 'W',  '\u0175': 'w',
4233    '\u0176': 'Y',  '\u0177': 'y', '\u0178': 'Y',
4234    '\u0179': 'Z',  '\u017b': 'Z', '\u017d': 'Z',
4235    '\u017a': 'z',  '\u017c': 'z', '\u017e': 'z',
4236    '\u0132': 'IJ', '\u0133': 'ij',
4237    '\u0152': 'Oe', '\u0153': 'oe',
4238    '\u0149': "'n", '\u017f': 's'
4239  };
4240
4241  /** Used to map characters to HTML entities. */
4242  var htmlEscapes = {
4243    '&': '&amp;',
4244    '<': '&lt;',
4245    '>': '&gt;',
4246    '"': '&quot;',
4247    "'": '&#39;'
4248  };
4249
4250  /** Used to map HTML entities to characters. */
4251  var htmlUnescapes = {
4252    '&amp;': '&',
4253    '&lt;': '<',
4254    '&gt;': '>',
4255    '&quot;': '"',
4256    '&#39;': "'"
4257  };
4258
4259  /** Used to escape characters for inclusion in compiled string literals. */
4260  var stringEscapes = {
4261    '\\': '\\',
4262    "'": "'",
4263    '\n': 'n',
4264    '\r': 'r',
4265    '\u2028': 'u2028',
4266    '\u2029': 'u2029'
4267  };
4268
4269  /** Built-in method references without a dependency on `root`. */
4270  var freeParseFloat = parseFloat,
4271      freeParseInt = parseInt;
4272
4273  /** Detect free variable `global` from Node.js. */
4274  var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
4275
4276  /** Detect free variable `self`. */
4277  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
4278
4279  /** Used as a reference to the global object. */
4280  var root = freeGlobal || freeSelf || Function('return this')();
4281
4282  /** Detect free variable `exports`. */
4283  var freeExports =  true && exports && !exports.nodeType && exports;
4284
4285  /** Detect free variable `module`. */
4286  var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
4287
4288  /** Detect the popular CommonJS extension `module.exports`. */
4289  var moduleExports = freeModule && freeModule.exports === freeExports;
4290
4291  /** Detect free variable `process` from Node.js. */
4292  var freeProcess = moduleExports && freeGlobal.process;
4293
4294  /** Used to access faster Node.js helpers. */
4295  var nodeUtil = (function() {
4296    try {
4297      // Use `util.types` for Node.js 10+.
4298      var types = freeModule && freeModule.require && freeModule.require('util').types;
4299
4300      if (types) {
4301        return types;
4302      }
4303
4304      // Legacy `process.binding('util')` for Node.js < 10.
4305      return freeProcess && freeProcess.binding && freeProcess.binding('util');
4306    } catch (e) {}
4307  }());
4308
4309  /* Node.js helper references. */
4310  var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
4311      nodeIsDate = nodeUtil && nodeUtil.isDate,
4312      nodeIsMap = nodeUtil && nodeUtil.isMap,
4313      nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
4314      nodeIsSet = nodeUtil && nodeUtil.isSet,
4315      nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
4316
4317  /*--------------------------------------------------------------------------*/
4318
4319  /**
4320   * A faster alternative to `Function#apply`, this function invokes `func`
4321   * with the `this` binding of `thisArg` and the arguments of `args`.
4322   *
4323   * @private
4324   * @param {Function} func The function to invoke.
4325   * @param {*} thisArg The `this` binding of `func`.
4326   * @param {Array} args The arguments to invoke `func` with.
4327   * @returns {*} Returns the result of `func`.
4328   */
4329  function apply(func, thisArg, args) {
4330    switch (args.length) {
4331      case 0: return func.call(thisArg);
4332      case 1: return func.call(thisArg, args[0]);
4333      case 2: return func.call(thisArg, args[0], args[1]);
4334      case 3: return func.call(thisArg, args[0], args[1], args[2]);
4335    }
4336    return func.apply(thisArg, args);
4337  }
4338
4339  /**
4340   * A specialized version of `baseAggregator` for arrays.
4341   *
4342   * @private
4343   * @param {Array} [array] The array to iterate over.
4344   * @param {Function} setter The function to set `accumulator` values.
4345   * @param {Function} iteratee The iteratee to transform keys.
4346   * @param {Object} accumulator The initial aggregated object.
4347   * @returns {Function} Returns `accumulator`.
4348   */
4349  function arrayAggregator(array, setter, iteratee, accumulator) {
4350    var index = -1,
4351        length = array == null ? 0 : array.length;
4352
4353    while (++index < length) {
4354      var value = array[index];
4355      setter(accumulator, value, iteratee(value), array);
4356    }
4357    return accumulator;
4358  }
4359
4360  /**
4361   * A specialized version of `_.forEach` for arrays without support for
4362   * iteratee shorthands.
4363   *
4364   * @private
4365   * @param {Array} [array] The array to iterate over.
4366   * @param {Function} iteratee The function invoked per iteration.
4367   * @returns {Array} Returns `array`.
4368   */
4369  function arrayEach(array, iteratee) {
4370    var index = -1,
4371        length = array == null ? 0 : array.length;
4372
4373    while (++index < length) {
4374      if (iteratee(array[index], index, array) === false) {
4375        break;
4376      }
4377    }
4378    return array;
4379  }
4380
4381  /**
4382   * A specialized version of `_.forEachRight` for arrays without support for
4383   * iteratee shorthands.
4384   *
4385   * @private
4386   * @param {Array} [array] The array to iterate over.
4387   * @param {Function} iteratee The function invoked per iteration.
4388   * @returns {Array} Returns `array`.
4389   */
4390  function arrayEachRight(array, iteratee) {
4391    var length = array == null ? 0 : array.length;
4392
4393    while (length--) {
4394      if (iteratee(array[length], length, array) === false) {
4395        break;
4396      }
4397    }
4398    return array;
4399  }
4400
4401  /**
4402   * A specialized version of `_.every` for arrays without support for
4403   * iteratee shorthands.
4404   *
4405   * @private
4406   * @param {Array} [array] The array to iterate over.
4407   * @param {Function} predicate The function invoked per iteration.
4408   * @returns {boolean} Returns `true` if all elements pass the predicate check,
4409   *  else `false`.
4410   */
4411  function arrayEvery(array, predicate) {
4412    var index = -1,
4413        length = array == null ? 0 : array.length;
4414
4415    while (++index < length) {
4416      if (!predicate(array[index], index, array)) {
4417        return false;
4418      }
4419    }
4420    return true;
4421  }
4422
4423  /**
4424   * A specialized version of `_.filter` for arrays without support for
4425   * iteratee shorthands.
4426   *
4427   * @private
4428   * @param {Array} [array] The array to iterate over.
4429   * @param {Function} predicate The function invoked per iteration.
4430   * @returns {Array} Returns the new filtered array.
4431   */
4432  function arrayFilter(array, predicate) {
4433    var index = -1,
4434        length = array == null ? 0 : array.length,
4435        resIndex = 0,
4436        result = [];
4437
4438    while (++index < length) {
4439      var value = array[index];
4440      if (predicate(value, index, array)) {
4441        result[resIndex++] = value;
4442      }
4443    }
4444    return result;
4445  }
4446
4447  /**
4448   * A specialized version of `_.includes` for arrays without support for
4449   * specifying an index to search from.
4450   *
4451   * @private
4452   * @param {Array} [array] The array to inspect.
4453   * @param {*} target The value to search for.
4454   * @returns {boolean} Returns `true` if `target` is found, else `false`.
4455   */
4456  function arrayIncludes(array, value) {
4457    var length = array == null ? 0 : array.length;
4458    return !!length && baseIndexOf(array, value, 0) > -1;
4459  }
4460
4461  /**
4462   * This function is like `arrayIncludes` except that it accepts a comparator.
4463   *
4464   * @private
4465   * @param {Array} [array] The array to inspect.
4466   * @param {*} target The value to search for.
4467   * @param {Function} comparator The comparator invoked per element.
4468   * @returns {boolean} Returns `true` if `target` is found, else `false`.
4469   */
4470  function arrayIncludesWith(array, value, comparator) {
4471    var index = -1,
4472        length = array == null ? 0 : array.length;
4473
4474    while (++index < length) {
4475      if (comparator(value, array[index])) {
4476        return true;
4477      }
4478    }
4479    return false;
4480  }
4481
4482  /**
4483   * A specialized version of `_.map` for arrays without support for iteratee
4484   * shorthands.
4485   *
4486   * @private
4487   * @param {Array} [array] The array to iterate over.
4488   * @param {Function} iteratee The function invoked per iteration.
4489   * @returns {Array} Returns the new mapped array.
4490   */
4491  function arrayMap(array, iteratee) {
4492    var index = -1,
4493        length = array == null ? 0 : array.length,
4494        result = Array(length);
4495
4496    while (++index < length) {
4497      result[index] = iteratee(array[index], index, array);
4498    }
4499    return result;
4500  }
4501
4502  /**
4503   * Appends the elements of `values` to `array`.
4504   *
4505   * @private
4506   * @param {Array} array The array to modify.
4507   * @param {Array} values The values to append.
4508   * @returns {Array} Returns `array`.
4509   */
4510  function arrayPush(array, values) {
4511    var index = -1,
4512        length = values.length,
4513        offset = array.length;
4514
4515    while (++index < length) {
4516      array[offset + index] = values[index];
4517    }
4518    return array;
4519  }
4520
4521  /**
4522   * A specialized version of `_.reduce` for arrays without support for
4523   * iteratee shorthands.
4524   *
4525   * @private
4526   * @param {Array} [array] The array to iterate over.
4527   * @param {Function} iteratee The function invoked per iteration.
4528   * @param {*} [accumulator] The initial value.
4529   * @param {boolean} [initAccum] Specify using the first element of `array` as
4530   *  the initial value.
4531   * @returns {*} Returns the accumulated value.
4532   */
4533  function arrayReduce(array, iteratee, accumulator, initAccum) {
4534    var index = -1,
4535        length = array == null ? 0 : array.length;
4536
4537    if (initAccum && length) {
4538      accumulator = array[++index];
4539    }
4540    while (++index < length) {
4541      accumulator = iteratee(accumulator, array[index], index, array);
4542    }
4543    return accumulator;
4544  }
4545
4546  /**
4547   * A specialized version of `_.reduceRight` for arrays without support for
4548   * iteratee shorthands.
4549   *
4550   * @private
4551   * @param {Array} [array] The array to iterate over.
4552   * @param {Function} iteratee The function invoked per iteration.
4553   * @param {*} [accumulator] The initial value.
4554   * @param {boolean} [initAccum] Specify using the last element of `array` as
4555   *  the initial value.
4556   * @returns {*} Returns the accumulated value.
4557   */
4558  function arrayReduceRight(array, iteratee, accumulator, initAccum) {
4559    var length = array == null ? 0 : array.length;
4560    if (initAccum && length) {
4561      accumulator = array[--length];
4562    }
4563    while (length--) {
4564      accumulator = iteratee(accumulator, array[length], length, array);
4565    }
4566    return accumulator;
4567  }
4568
4569  /**
4570   * A specialized version of `_.some` for arrays without support for iteratee
4571   * shorthands.
4572   *
4573   * @private
4574   * @param {Array} [array] The array to iterate over.
4575   * @param {Function} predicate The function invoked per iteration.
4576   * @returns {boolean} Returns `true` if any element passes the predicate check,
4577   *  else `false`.
4578   */
4579  function arraySome(array, predicate) {
4580    var index = -1,
4581        length = array == null ? 0 : array.length;
4582
4583    while (++index < length) {
4584      if (predicate(array[index], index, array)) {
4585        return true;
4586      }
4587    }
4588    return false;
4589  }
4590
4591  /**
4592   * Gets the size of an ASCII `string`.
4593   *
4594   * @private
4595   * @param {string} string The string inspect.
4596   * @returns {number} Returns the string size.
4597   */
4598  var asciiSize = baseProperty('length');
4599
4600  /**
4601   * Converts an ASCII `string` to an array.
4602   *
4603   * @private
4604   * @param {string} string The string to convert.
4605   * @returns {Array} Returns the converted array.
4606   */
4607  function asciiToArray(string) {
4608    return string.split('');
4609  }
4610
4611  /**
4612   * Splits an ASCII `string` into an array of its words.
4613   *
4614   * @private
4615   * @param {string} The string to inspect.
4616   * @returns {Array} Returns the words of `string`.
4617   */
4618  function asciiWords(string) {
4619    return string.match(reAsciiWord) || [];
4620  }
4621
4622  /**
4623   * The base implementation of methods like `_.findKey` and `_.findLastKey`,
4624   * without support for iteratee shorthands, which iterates over `collection`
4625   * using `eachFunc`.
4626   *
4627   * @private
4628   * @param {Array|Object} collection The collection to inspect.
4629   * @param {Function} predicate The function invoked per iteration.
4630   * @param {Function} eachFunc The function to iterate over `collection`.
4631   * @returns {*} Returns the found element or its key, else `undefined`.
4632   */
4633  function baseFindKey(collection, predicate, eachFunc) {
4634    var result;
4635    eachFunc(collection, function(value, key, collection) {
4636      if (predicate(value, key, collection)) {
4637        result = key;
4638        return false;
4639      }
4640    });
4641    return result;
4642  }
4643
4644  /**
4645   * The base implementation of `_.findIndex` and `_.findLastIndex` without
4646   * support for iteratee shorthands.
4647   *
4648   * @private
4649   * @param {Array} array The array to inspect.
4650   * @param {Function} predicate The function invoked per iteration.
4651   * @param {number} fromIndex The index to search from.
4652   * @param {boolean} [fromRight] Specify iterating from right to left.
4653   * @returns {number} Returns the index of the matched value, else `-1`.
4654   */
4655  function baseFindIndex(array, predicate, fromIndex, fromRight) {
4656    var length = array.length,
4657        index = fromIndex + (fromRight ? 1 : -1);
4658
4659    while ((fromRight ? index-- : ++index < length)) {
4660      if (predicate(array[index], index, array)) {
4661        return index;
4662      }
4663    }
4664    return -1;
4665  }
4666
4667  /**
4668   * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
4669   *
4670   * @private
4671   * @param {Array} array The array to inspect.
4672   * @param {*} value The value to search for.
4673   * @param {number} fromIndex The index to search from.
4674   * @returns {number} Returns the index of the matched value, else `-1`.
4675   */
4676  function baseIndexOf(array, value, fromIndex) {
4677    return value === value
4678      ? strictIndexOf(array, value, fromIndex)
4679      : baseFindIndex(array, baseIsNaN, fromIndex);
4680  }
4681
4682  /**
4683   * This function is like `baseIndexOf` except that it accepts a comparator.
4684   *
4685   * @private
4686   * @param {Array} array The array to inspect.
4687   * @param {*} value The value to search for.
4688   * @param {number} fromIndex The index to search from.
4689   * @param {Function} comparator The comparator invoked per element.
4690   * @returns {number} Returns the index of the matched value, else `-1`.
4691   */
4692  function baseIndexOfWith(array, value, fromIndex, comparator) {
4693    var index = fromIndex - 1,
4694        length = array.length;
4695
4696    while (++index < length) {
4697      if (comparator(array[index], value)) {
4698        return index;
4699      }
4700    }
4701    return -1;
4702  }
4703
4704  /**
4705   * The base implementation of `_.isNaN` without support for number objects.
4706   *
4707   * @private
4708   * @param {*} value The value to check.
4709   * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
4710   */
4711  function baseIsNaN(value) {
4712    return value !== value;
4713  }
4714
4715  /**
4716   * The base implementation of `_.mean` and `_.meanBy` without support for
4717   * iteratee shorthands.
4718   *
4719   * @private
4720   * @param {Array} array The array to iterate over.
4721   * @param {Function} iteratee The function invoked per iteration.
4722   * @returns {number} Returns the mean.
4723   */
4724  function baseMean(array, iteratee) {
4725    var length = array == null ? 0 : array.length;
4726    return length ? (baseSum(array, iteratee) / length) : NAN;
4727  }
4728
4729  /**
4730   * The base implementation of `_.property` without support for deep paths.
4731   *
4732   * @private
4733   * @param {string} key The key of the property to get.
4734   * @returns {Function} Returns the new accessor function.
4735   */
4736  function baseProperty(key) {
4737    return function(object) {
4738      return object == null ? undefined : object[key];
4739    };
4740  }
4741
4742  /**
4743   * The base implementation of `_.propertyOf` without support for deep paths.
4744   *
4745   * @private
4746   * @param {Object} object The object to query.
4747   * @returns {Function} Returns the new accessor function.
4748   */
4749  function basePropertyOf(object) {
4750    return function(key) {
4751      return object == null ? undefined : object[key];
4752    };
4753  }
4754
4755  /**
4756   * The base implementation of `_.reduce` and `_.reduceRight`, without support
4757   * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
4758   *
4759   * @private
4760   * @param {Array|Object} collection The collection to iterate over.
4761   * @param {Function} iteratee The function invoked per iteration.
4762   * @param {*} accumulator The initial value.
4763   * @param {boolean} initAccum Specify using the first or last element of
4764   *  `collection` as the initial value.
4765   * @param {Function} eachFunc The function to iterate over `collection`.
4766   * @returns {*} Returns the accumulated value.
4767   */
4768  function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
4769    eachFunc(collection, function(value, index, collection) {
4770      accumulator = initAccum
4771        ? (initAccum = false, value)
4772        : iteratee(accumulator, value, index, collection);
4773    });
4774    return accumulator;
4775  }
4776
4777  /**
4778   * The base implementation of `_.sortBy` which uses `comparer` to define the
4779   * sort order of `array` and replaces criteria objects with their corresponding
4780   * values.
4781   *
4782   * @private
4783   * @param {Array} array The array to sort.
4784   * @param {Function} comparer The function to define sort order.
4785   * @returns {Array} Returns `array`.
4786   */
4787  function baseSortBy(array, comparer) {
4788    var length = array.length;
4789
4790    array.sort(comparer);
4791    while (length--) {
4792      array[length] = array[length].value;
4793    }
4794    return array;
4795  }
4796
4797  /**
4798   * The base implementation of `_.sum` and `_.sumBy` without support for
4799   * iteratee shorthands.
4800   *
4801   * @private
4802   * @param {Array} array The array to iterate over.
4803   * @param {Function} iteratee The function invoked per iteration.
4804   * @returns {number} Returns the sum.
4805   */
4806  function baseSum(array, iteratee) {
4807    var result,
4808        index = -1,
4809        length = array.length;
4810
4811    while (++index < length) {
4812      var current = iteratee(array[index]);
4813      if (current !== undefined) {
4814        result = result === undefined ? current : (result + current);
4815      }
4816    }
4817    return result;
4818  }
4819
4820  /**
4821   * The base implementation of `_.times` without support for iteratee shorthands
4822   * or max array length checks.
4823   *
4824   * @private
4825   * @param {number} n The number of times to invoke `iteratee`.
4826   * @param {Function} iteratee The function invoked per iteration.
4827   * @returns {Array} Returns the array of results.
4828   */
4829  function baseTimes(n, iteratee) {
4830    var index = -1,
4831        result = Array(n);
4832
4833    while (++index < n) {
4834      result[index] = iteratee(index);
4835    }
4836    return result;
4837  }
4838
4839  /**
4840   * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
4841   * of key-value pairs for `object` corresponding to the property names of `props`.
4842   *
4843   * @private
4844   * @param {Object} object The object to query.
4845   * @param {Array} props The property names to get values for.
4846   * @returns {Object} Returns the key-value pairs.
4847   */
4848  function baseToPairs(object, props) {
4849    return arrayMap(props, function(key) {
4850      return [key, object[key]];
4851    });
4852  }
4853
4854  /**
4855   * The base implementation of `_.trim`.
4856   *
4857   * @private
4858   * @param {string} string The string to trim.
4859   * @returns {string} Returns the trimmed string.
4860   */
4861  function baseTrim(string) {
4862    return string
4863      ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
4864      : string;
4865  }
4866
4867  /**
4868   * The base implementation of `_.unary` without support for storing metadata.
4869   *
4870   * @private
4871   * @param {Function} func The function to cap arguments for.
4872   * @returns {Function} Returns the new capped function.
4873   */
4874  function baseUnary(func) {
4875    return function(value) {
4876      return func(value);
4877    };
4878  }
4879
4880  /**
4881   * The base implementation of `_.values` and `_.valuesIn` which creates an
4882   * array of `object` property values corresponding to the property names
4883   * of `props`.
4884   *
4885   * @private
4886   * @param {Object} object The object to query.
4887   * @param {Array} props The property names to get values for.
4888   * @returns {Object} Returns the array of property values.
4889   */
4890  function baseValues(object, props) {
4891    return arrayMap(props, function(key) {
4892      return object[key];
4893    });
4894  }
4895
4896  /**
4897   * Checks if a `cache` value for `key` exists.
4898   *
4899   * @private
4900   * @param {Object} cache The cache to query.
4901   * @param {string} key The key of the entry to check.
4902   * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
4903   */
4904  function cacheHas(cache, key) {
4905    return cache.has(key);
4906  }
4907
4908  /**
4909   * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
4910   * that is not found in the character symbols.
4911   *
4912   * @private
4913   * @param {Array} strSymbols The string symbols to inspect.
4914   * @param {Array} chrSymbols The character symbols to find.
4915   * @returns {number} Returns the index of the first unmatched string symbol.
4916   */
4917  function charsStartIndex(strSymbols, chrSymbols) {
4918    var index = -1,
4919        length = strSymbols.length;
4920
4921    while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
4922    return index;
4923  }
4924
4925  /**
4926   * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
4927   * that is not found in the character symbols.
4928   *
4929   * @private
4930   * @param {Array} strSymbols The string symbols to inspect.
4931   * @param {Array} chrSymbols The character symbols to find.
4932   * @returns {number} Returns the index of the last unmatched string symbol.
4933   */
4934  function charsEndIndex(strSymbols, chrSymbols) {
4935    var index = strSymbols.length;
4936
4937    while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
4938    return index;
4939  }
4940
4941  /**
4942   * Gets the number of `placeholder` occurrences in `array`.
4943   *
4944   * @private
4945   * @param {Array} array The array to inspect.
4946   * @param {*} placeholder The placeholder to search for.
4947   * @returns {number} Returns the placeholder count.
4948   */
4949  function countHolders(array, placeholder) {
4950    var length = array.length,
4951        result = 0;
4952
4953    while (length--) {
4954      if (array[length] === placeholder) {
4955        ++result;
4956      }
4957    }
4958    return result;
4959  }
4960
4961  /**
4962   * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
4963   * letters to basic Latin letters.
4964   *
4965   * @private
4966   * @param {string} letter The matched letter to deburr.
4967   * @returns {string} Returns the deburred letter.
4968   */
4969  var deburrLetter = basePropertyOf(deburredLetters);
4970
4971  /**
4972   * Used by `_.escape` to convert characters to HTML entities.
4973   *
4974   * @private
4975   * @param {string} chr The matched character to escape.
4976   * @returns {string} Returns the escaped character.
4977   */
4978  var escapeHtmlChar = basePropertyOf(htmlEscapes);
4979
4980  /**
4981   * Used by `_.template` to escape characters for inclusion in compiled string literals.
4982   *
4983   * @private
4984   * @param {string} chr The matched character to escape.
4985   * @returns {string} Returns the escaped character.
4986   */
4987  function escapeStringChar(chr) {
4988    return '\\' + stringEscapes[chr];
4989  }
4990
4991  /**
4992   * Gets the value at `key` of `object`.
4993   *
4994   * @private
4995   * @param {Object} [object] The object to query.
4996   * @param {string} key The key of the property to get.
4997   * @returns {*} Returns the property value.
4998   */
4999  function getValue(object, key) {
5000    return object == null ? undefined : object[key];
5001  }
5002
5003  /**
5004   * Checks if `string` contains Unicode symbols.
5005   *
5006   * @private
5007   * @param {string} string The string to inspect.
5008   * @returns {boolean} Returns `true` if a symbol is found, else `false`.
5009   */
5010  function hasUnicode(string) {
5011    return reHasUnicode.test(string);
5012  }
5013
5014  /**
5015   * Checks if `string` contains a word composed of Unicode symbols.
5016   *
5017   * @private
5018   * @param {string} string The string to inspect.
5019   * @returns {boolean} Returns `true` if a word is found, else `false`.
5020   */
5021  function hasUnicodeWord(string) {
5022    return reHasUnicodeWord.test(string);
5023  }
5024
5025  /**
5026   * Converts `iterator` to an array.
5027   *
5028   * @private
5029   * @param {Object} iterator The iterator to convert.
5030   * @returns {Array} Returns the converted array.
5031   */
5032  function iteratorToArray(iterator) {
5033    var data,
5034        result = [];
5035
5036    while (!(data = iterator.next()).done) {
5037      result.push(data.value);
5038    }
5039    return result;
5040  }
5041
5042  /**
5043   * Converts `map` to its key-value pairs.
5044   *
5045   * @private
5046   * @param {Object} map The map to convert.
5047   * @returns {Array} Returns the key-value pairs.
5048   */
5049  function mapToArray(map) {
5050    var index = -1,
5051        result = Array(map.size);
5052
5053    map.forEach(function(value, key) {
5054      result[++index] = [key, value];
5055    });
5056    return result;
5057  }
5058
5059  /**
5060   * Creates a unary function that invokes `func` with its argument transformed.
5061   *
5062   * @private
5063   * @param {Function} func The function to wrap.
5064   * @param {Function} transform The argument transform.
5065   * @returns {Function} Returns the new function.
5066   */
5067  function overArg(func, transform) {
5068    return function(arg) {
5069      return func(transform(arg));
5070    };
5071  }
5072
5073  /**
5074   * Replaces all `placeholder` elements in `array` with an internal placeholder
5075   * and returns an array of their indexes.
5076   *
5077   * @private
5078   * @param {Array} array The array to modify.
5079   * @param {*} placeholder The placeholder to replace.
5080   * @returns {Array} Returns the new array of placeholder indexes.
5081   */
5082  function replaceHolders(array, placeholder) {
5083    var index = -1,
5084        length = array.length,
5085        resIndex = 0,
5086        result = [];
5087
5088    while (++index < length) {
5089      var value = array[index];
5090      if (value === placeholder || value === PLACEHOLDER) {
5091        array[index] = PLACEHOLDER;
5092        result[resIndex++] = index;
5093      }
5094    }
5095    return result;
5096  }
5097
5098  /**
5099   * Converts `set` to an array of its values.
5100   *
5101   * @private
5102   * @param {Object} set The set to convert.
5103   * @returns {Array} Returns the values.
5104   */
5105  function setToArray(set) {
5106    var index = -1,
5107        result = Array(set.size);
5108
5109    set.forEach(function(value) {
5110      result[++index] = value;
5111    });
5112    return result;
5113  }
5114
5115  /**
5116   * Converts `set` to its value-value pairs.
5117   *
5118   * @private
5119   * @param {Object} set The set to convert.
5120   * @returns {Array} Returns the value-value pairs.
5121   */
5122  function setToPairs(set) {
5123    var index = -1,
5124        result = Array(set.size);
5125
5126    set.forEach(function(value) {
5127      result[++index] = [value, value];
5128    });
5129    return result;
5130  }
5131
5132  /**
5133   * A specialized version of `_.indexOf` which performs strict equality
5134   * comparisons of values, i.e. `===`.
5135   *
5136   * @private
5137   * @param {Array} array The array to inspect.
5138   * @param {*} value The value to search for.
5139   * @param {number} fromIndex The index to search from.
5140   * @returns {number} Returns the index of the matched value, else `-1`.
5141   */
5142  function strictIndexOf(array, value, fromIndex) {
5143    var index = fromIndex - 1,
5144        length = array.length;
5145
5146    while (++index < length) {
5147      if (array[index] === value) {
5148        return index;
5149      }
5150    }
5151    return -1;
5152  }
5153
5154  /**
5155   * A specialized version of `_.lastIndexOf` which performs strict equality
5156   * comparisons of values, i.e. `===`.
5157   *
5158   * @private
5159   * @param {Array} array The array to inspect.
5160   * @param {*} value The value to search for.
5161   * @param {number} fromIndex The index to search from.
5162   * @returns {number} Returns the index of the matched value, else `-1`.
5163   */
5164  function strictLastIndexOf(array, value, fromIndex) {
5165    var index = fromIndex + 1;
5166    while (index--) {
5167      if (array[index] === value) {
5168        return index;
5169      }
5170    }
5171    return index;
5172  }
5173
5174  /**
5175   * Gets the number of symbols in `string`.
5176   *
5177   * @private
5178   * @param {string} string The string to inspect.
5179   * @returns {number} Returns the string size.
5180   */
5181  function stringSize(string) {
5182    return hasUnicode(string)
5183      ? unicodeSize(string)
5184      : asciiSize(string);
5185  }
5186
5187  /**
5188   * Converts `string` to an array.
5189   *
5190   * @private
5191   * @param {string} string The string to convert.
5192   * @returns {Array} Returns the converted array.
5193   */
5194  function stringToArray(string) {
5195    return hasUnicode(string)
5196      ? unicodeToArray(string)
5197      : asciiToArray(string);
5198  }
5199
5200  /**
5201   * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
5202   * character of `string`.
5203   *
5204   * @private
5205   * @param {string} string The string to inspect.
5206   * @returns {number} Returns the index of the last non-whitespace character.
5207   */
5208  function trimmedEndIndex(string) {
5209    var index = string.length;
5210
5211    while (index-- && reWhitespace.test(string.charAt(index))) {}
5212    return index;
5213  }
5214
5215  /**
5216   * Used by `_.unescape` to convert HTML entities to characters.
5217   *
5218   * @private
5219   * @param {string} chr The matched character to unescape.
5220   * @returns {string} Returns the unescaped character.
5221   */
5222  var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
5223
5224  /**
5225   * Gets the size of a Unicode `string`.
5226   *
5227   * @private
5228   * @param {string} string The string inspect.
5229   * @returns {number} Returns the string size.
5230   */
5231  function unicodeSize(string) {
5232    var result = reUnicode.lastIndex = 0;
5233    while (reUnicode.test(string)) {
5234      ++result;
5235    }
5236    return result;
5237  }
5238
5239  /**
5240   * Converts a Unicode `string` to an array.
5241   *
5242   * @private
5243   * @param {string} string The string to convert.
5244   * @returns {Array} Returns the converted array.
5245   */
5246  function unicodeToArray(string) {
5247    return string.match(reUnicode) || [];
5248  }
5249
5250  /**
5251   * Splits a Unicode `string` into an array of its words.
5252   *
5253   * @private
5254   * @param {string} The string to inspect.
5255   * @returns {Array} Returns the words of `string`.
5256   */
5257  function unicodeWords(string) {
5258    return string.match(reUnicodeWord) || [];
5259  }
5260
5261  /*--------------------------------------------------------------------------*/
5262
5263  /**
5264   * Create a new pristine `lodash` function using the `context` object.
5265   *
5266   * @static
5267   * @memberOf _
5268   * @since 1.1.0
5269   * @category Util
5270   * @param {Object} [context=root] The context object.
5271   * @returns {Function} Returns a new `lodash` function.
5272   * @example
5273   *
5274   * _.mixin({ 'foo': _.constant('foo') });
5275   *
5276   * var lodash = _.runInContext();
5277   * lodash.mixin({ 'bar': lodash.constant('bar') });
5278   *
5279   * _.isFunction(_.foo);
5280   * // => true
5281   * _.isFunction(_.bar);
5282   * // => false
5283   *
5284   * lodash.isFunction(lodash.foo);
5285   * // => false
5286   * lodash.isFunction(lodash.bar);
5287   * // => true
5288   *
5289   * // Create a suped-up `defer` in Node.js.
5290   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
5291   */
5292  var runInContext = (function runInContext(context) {
5293    context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
5294
5295    /** Built-in constructor references. */
5296    var Array = context.Array,
5297        Date = context.Date,
5298        Error = context.Error,
5299        Function = context.Function,
5300        Math = context.Math,
5301        Object = context.Object,
5302        RegExp = context.RegExp,
5303        String = context.String,
5304        TypeError = context.TypeError;
5305
5306    /** Used for built-in method references. */
5307    var arrayProto = Array.prototype,
5308        funcProto = Function.prototype,
5309        objectProto = Object.prototype;
5310
5311    /** Used to detect overreaching core-js shims. */
5312    var coreJsData = context['__core-js_shared__'];
5313
5314    /** Used to resolve the decompiled source of functions. */
5315    var funcToString = funcProto.toString;
5316
5317    /** Used to check objects for own properties. */
5318    var hasOwnProperty = objectProto.hasOwnProperty;
5319
5320    /** Used to generate unique IDs. */
5321    var idCounter = 0;
5322
5323    /** Used to detect methods masquerading as native. */
5324    var maskSrcKey = (function() {
5325      var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
5326      return uid ? ('Symbol(src)_1.' + uid) : '';
5327    }());
5328
5329    /**
5330     * Used to resolve the
5331     * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
5332     * of values.
5333     */
5334    var nativeObjectToString = objectProto.toString;
5335
5336    /** Used to infer the `Object` constructor. */
5337    var objectCtorString = funcToString.call(Object);
5338
5339    /** Used to restore the original `_` reference in `_.noConflict`. */
5340    var oldDash = root._;
5341
5342    /** Used to detect if a method is native. */
5343    var reIsNative = RegExp('^' +
5344      funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
5345      .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
5346    );
5347
5348    /** Built-in value references. */
5349    var Buffer = moduleExports ? context.Buffer : undefined,
5350        Symbol = context.Symbol,
5351        Uint8Array = context.Uint8Array,
5352        allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
5353        getPrototype = overArg(Object.getPrototypeOf, Object),
5354        objectCreate = Object.create,
5355        propertyIsEnumerable = objectProto.propertyIsEnumerable,
5356        splice = arrayProto.splice,
5357        spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
5358        symIterator = Symbol ? Symbol.iterator : undefined,
5359        symToStringTag = Symbol ? Symbol.toStringTag : undefined;
5360
5361    var defineProperty = (function() {
5362      try {
5363        var func = getNative(Object, 'defineProperty');
5364        func({}, '', {});
5365        return func;
5366      } catch (e) {}
5367    }());
5368
5369    /** Mocked built-ins. */
5370    var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
5371        ctxNow = Date && Date.now !== root.Date.now && Date.now,
5372        ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
5373
5374    /* Built-in method references for those with the same name as other `lodash` methods. */
5375    var nativeCeil = Math.ceil,
5376        nativeFloor = Math.floor,
5377        nativeGetSymbols = Object.getOwnPropertySymbols,
5378        nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
5379        nativeIsFinite = context.isFinite,
5380        nativeJoin = arrayProto.join,
5381        nativeKeys = overArg(Object.keys, Object),
5382        nativeMax = Math.max,
5383        nativeMin = Math.min,
5384        nativeNow = Date.now,
5385        nativeParseInt = context.parseInt,
5386        nativeRandom = Math.random,
5387        nativeReverse = arrayProto.reverse;
5388
5389    /* Built-in method references that are verified to be native. */
5390    var DataView = getNative(context, 'DataView'),
5391        Map = getNative(context, 'Map'),
5392        Promise = getNative(context, 'Promise'),
5393        Set = getNative(context, 'Set'),
5394        WeakMap = getNative(context, 'WeakMap'),
5395        nativeCreate = getNative(Object, 'create');
5396
5397    /** Used to store function metadata. */
5398    var metaMap = WeakMap && new WeakMap;
5399
5400    /** Used to lookup unminified function names. */
5401    var realNames = {};
5402
5403    /** Used to detect maps, sets, and weakmaps. */
5404    var dataViewCtorString = toSource(DataView),
5405        mapCtorString = toSource(Map),
5406        promiseCtorString = toSource(Promise),
5407        setCtorString = toSource(Set),
5408        weakMapCtorString = toSource(WeakMap);
5409
5410    /** Used to convert symbols to primitives and strings. */
5411    var symbolProto = Symbol ? Symbol.prototype : undefined,
5412        symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
5413        symbolToString = symbolProto ? symbolProto.toString : undefined;
5414
5415    /*------------------------------------------------------------------------*/
5416
5417    /**
5418     * Creates a `lodash` object which wraps `value` to enable implicit method
5419     * chain sequences. Methods that operate on and return arrays, collections,
5420     * and functions can be chained together. Methods that retrieve a single value
5421     * or may return a primitive value will automatically end the chain sequence
5422     * and return the unwrapped value. Otherwise, the value must be unwrapped
5423     * with `_#value`.
5424     *
5425     * Explicit chain sequences, which must be unwrapped with `_#value`, may be
5426     * enabled using `_.chain`.
5427     *
5428     * The execution of chained methods is lazy, that is, it's deferred until
5429     * `_#value` is implicitly or explicitly called.
5430     *
5431     * Lazy evaluation allows several methods to support shortcut fusion.
5432     * Shortcut fusion is an optimization to merge iteratee calls; this avoids
5433     * the creation of intermediate arrays and can greatly reduce the number of
5434     * iteratee executions. Sections of a chain sequence qualify for shortcut
5435     * fusion if the section is applied to an array and iteratees accept only
5436     * one argument. The heuristic for whether a section qualifies for shortcut
5437     * fusion is subject to change.
5438     *
5439     * Chaining is supported in custom builds as long as the `_#value` method is
5440     * directly or indirectly included in the build.
5441     *
5442     * In addition to lodash methods, wrappers have `Array` and `String` methods.
5443     *
5444     * The wrapper `Array` methods are:
5445     * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
5446     *
5447     * The wrapper `String` methods are:
5448     * `replace` and `split`
5449     *
5450     * The wrapper methods that support shortcut fusion are:
5451     * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
5452     * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
5453     * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
5454     *
5455     * The chainable wrapper methods are:
5456     * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
5457     * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
5458     * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
5459     * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
5460     * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
5461     * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
5462     * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
5463     * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
5464     * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
5465     * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
5466     * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
5467     * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
5468     * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
5469     * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
5470     * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
5471     * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
5472     * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
5473     * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
5474     * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
5475     * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
5476     * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
5477     * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
5478     * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
5479     * `zipObject`, `zipObjectDeep`, and `zipWith`
5480     *
5481     * The wrapper methods that are **not** chainable by default are:
5482     * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
5483     * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
5484     * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
5485     * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
5486     * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
5487     * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
5488     * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
5489     * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
5490     * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
5491     * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
5492     * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
5493     * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
5494     * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
5495     * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
5496     * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
5497     * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
5498     * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
5499     * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
5500     * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
5501     * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
5502     * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
5503     * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
5504     * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
5505     * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
5506     * `upperFirst`, `value`, and `words`
5507     *
5508     * @name _
5509     * @constructor
5510     * @category Seq
5511     * @param {*} value The value to wrap in a `lodash` instance.
5512     * @returns {Object} Returns the new `lodash` wrapper instance.
5513     * @example
5514     *
5515     * function square(n) {
5516     *   return n * n;
5517     * }
5518     *
5519     * var wrapped = _([1, 2, 3]);
5520     *
5521     * // Returns an unwrapped value.
5522     * wrapped.reduce(_.add);
5523     * // => 6
5524     *
5525     * // Returns a wrapped value.
5526     * var squares = wrapped.map(square);
5527     *
5528     * _.isArray(squares);
5529     * // => false
5530     *
5531     * _.isArray(squares.value());
5532     * // => true
5533     */
5534    function lodash(value) {
5535      if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
5536        if (value instanceof LodashWrapper) {
5537          return value;
5538        }
5539        if (hasOwnProperty.call(value, '__wrapped__')) {
5540          return wrapperClone(value);
5541        }
5542      }
5543      return new LodashWrapper(value);
5544    }
5545
5546    /**
5547     * The base implementation of `_.create` without support for assigning
5548     * properties to the created object.
5549     *
5550     * @private
5551     * @param {Object} proto The object to inherit from.
5552     * @returns {Object} Returns the new object.
5553     */
5554    var baseCreate = (function() {
5555      function object() {}
5556      return function(proto) {
5557        if (!isObject(proto)) {
5558          return {};
5559        }
5560        if (objectCreate) {
5561          return objectCreate(proto);
5562        }
5563        object.prototype = proto;
5564        var result = new object;
5565        object.prototype = undefined;
5566        return result;
5567      };
5568    }());
5569
5570    /**
5571     * The function whose prototype chain sequence wrappers inherit from.
5572     *
5573     * @private
5574     */
5575    function baseLodash() {
5576      // No operation performed.
5577    }
5578
5579    /**
5580     * The base constructor for creating `lodash` wrapper objects.
5581     *
5582     * @private
5583     * @param {*} value The value to wrap.
5584     * @param {boolean} [chainAll] Enable explicit method chain sequences.
5585     */
5586    function LodashWrapper(value, chainAll) {
5587      this.__wrapped__ = value;
5588      this.__actions__ = [];
5589      this.__chain__ = !!chainAll;
5590      this.__index__ = 0;
5591      this.__values__ = undefined;
5592    }
5593
5594    /**
5595     * By default, the template delimiters used by lodash are like those in
5596     * embedded Ruby (ERB) as well as ES2015 template strings. Change the
5597     * following template settings to use alternative delimiters.
5598     *
5599     * @static
5600     * @memberOf _
5601     * @type {Object}
5602     */
5603    lodash.templateSettings = {
5604
5605      /**
5606       * Used to detect `data` property values to be HTML-escaped.
5607       *
5608       * @memberOf _.templateSettings
5609       * @type {RegExp}
5610       */
5611      'escape': reEscape,
5612
5613      /**
5614       * Used to detect code to be evaluated.
5615       *
5616       * @memberOf _.templateSettings
5617       * @type {RegExp}
5618       */
5619      'evaluate': reEvaluate,
5620
5621      /**
5622       * Used to detect `data` property values to inject.
5623       *
5624       * @memberOf _.templateSettings
5625       * @type {RegExp}
5626       */
5627      'interpolate': reInterpolate,
5628
5629      /**
5630       * Used to reference the data object in the template text.
5631       *
5632       * @memberOf _.templateSettings
5633       * @type {string}
5634       */
5635      'variable': '',
5636
5637      /**
5638       * Used to import variables into the compiled template.
5639       *
5640       * @memberOf _.templateSettings
5641       * @type {Object}
5642       */
5643      'imports': {
5644
5645        /**
5646         * A reference to the `lodash` function.
5647         *
5648         * @memberOf _.templateSettings.imports
5649         * @type {Function}
5650         */
5651        '_': lodash
5652      }
5653    };
5654
5655    // Ensure wrappers are instances of `baseLodash`.
5656    lodash.prototype = baseLodash.prototype;
5657    lodash.prototype.constructor = lodash;
5658
5659    LodashWrapper.prototype = baseCreate(baseLodash.prototype);
5660    LodashWrapper.prototype.constructor = LodashWrapper;
5661
5662    /*------------------------------------------------------------------------*/
5663
5664    /**
5665     * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
5666     *
5667     * @private
5668     * @constructor
5669     * @param {*} value The value to wrap.
5670     */
5671    function LazyWrapper(value) {
5672      this.__wrapped__ = value;
5673      this.__actions__ = [];
5674      this.__dir__ = 1;
5675      this.__filtered__ = false;
5676      this.__iteratees__ = [];
5677      this.__takeCount__ = MAX_ARRAY_LENGTH;
5678      this.__views__ = [];
5679    }
5680
5681    /**
5682     * Creates a clone of the lazy wrapper object.
5683     *
5684     * @private
5685     * @name clone
5686     * @memberOf LazyWrapper
5687     * @returns {Object} Returns the cloned `LazyWrapper` object.
5688     */
5689    function lazyClone() {
5690      var result = new LazyWrapper(this.__wrapped__);
5691      result.__actions__ = copyArray(this.__actions__);
5692      result.__dir__ = this.__dir__;
5693      result.__filtered__ = this.__filtered__;
5694      result.__iteratees__ = copyArray(this.__iteratees__);
5695      result.__takeCount__ = this.__takeCount__;
5696      result.__views__ = copyArray(this.__views__);
5697      return result;
5698    }
5699
5700    /**
5701     * Reverses the direction of lazy iteration.
5702     *
5703     * @private
5704     * @name reverse
5705     * @memberOf LazyWrapper
5706     * @returns {Object} Returns the new reversed `LazyWrapper` object.
5707     */
5708    function lazyReverse() {
5709      if (this.__filtered__) {
5710        var result = new LazyWrapper(this);
5711        result.__dir__ = -1;
5712        result.__filtered__ = true;
5713      } else {
5714        result = this.clone();
5715        result.__dir__ *= -1;
5716      }
5717      return result;
5718    }
5719
5720    /**
5721     * Extracts the unwrapped value from its lazy wrapper.
5722     *
5723     * @private
5724     * @name value
5725     * @memberOf LazyWrapper
5726     * @returns {*} Returns the unwrapped value.
5727     */
5728    function lazyValue() {
5729      var array = this.__wrapped__.value(),
5730          dir = this.__dir__,
5731          isArr = isArray(array),
5732          isRight = dir < 0,
5733          arrLength = isArr ? array.length : 0,
5734          view = getView(0, arrLength, this.__views__),
5735          start = view.start,
5736          end = view.end,
5737          length = end - start,
5738          index = isRight ? end : (start - 1),
5739          iteratees = this.__iteratees__,
5740          iterLength = iteratees.length,
5741          resIndex = 0,
5742          takeCount = nativeMin(length, this.__takeCount__);
5743
5744      if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
5745        return baseWrapperValue(array, this.__actions__);
5746      }
5747      var result = [];
5748
5749      outer:
5750      while (length-- && resIndex < takeCount) {
5751        index += dir;
5752
5753        var iterIndex = -1,
5754            value = array[index];
5755
5756        while (++iterIndex < iterLength) {
5757          var data = iteratees[iterIndex],
5758              iteratee = data.iteratee,
5759              type = data.type,
5760              computed = iteratee(value);
5761
5762          if (type == LAZY_MAP_FLAG) {
5763            value = computed;
5764          } else if (!computed) {
5765            if (type == LAZY_FILTER_FLAG) {
5766              continue outer;
5767            } else {
5768              break outer;
5769            }
5770          }
5771        }
5772        result[resIndex++] = value;
5773      }
5774      return result;
5775    }
5776
5777    // Ensure `LazyWrapper` is an instance of `baseLodash`.
5778    LazyWrapper.prototype = baseCreate(baseLodash.prototype);
5779    LazyWrapper.prototype.constructor = LazyWrapper;
5780
5781    /*------------------------------------------------------------------------*/
5782
5783    /**
5784     * Creates a hash object.
5785     *
5786     * @private
5787     * @constructor
5788     * @param {Array} [entries] The key-value pairs to cache.
5789     */
5790    function Hash(entries) {
5791      var index = -1,
5792          length = entries == null ? 0 : entries.length;
5793
5794      this.clear();
5795      while (++index < length) {
5796        var entry = entries[index];
5797        this.set(entry[0], entry[1]);
5798      }
5799    }
5800
5801    /**
5802     * Removes all key-value entries from the hash.
5803     *
5804     * @private
5805     * @name clear
5806     * @memberOf Hash
5807     */
5808    function hashClear() {
5809      this.__data__ = nativeCreate ? nativeCreate(null) : {};
5810      this.size = 0;
5811    }
5812
5813    /**
5814     * Removes `key` and its value from the hash.
5815     *
5816     * @private
5817     * @name delete
5818     * @memberOf Hash
5819     * @param {Object} hash The hash to modify.
5820     * @param {string} key The key of the value to remove.
5821     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
5822     */
5823    function hashDelete(key) {
5824      var result = this.has(key) && delete this.__data__[key];
5825      this.size -= result ? 1 : 0;
5826      return result;
5827    }
5828
5829    /**
5830     * Gets the hash value for `key`.
5831     *
5832     * @private
5833     * @name get
5834     * @memberOf Hash
5835     * @param {string} key The key of the value to get.
5836     * @returns {*} Returns the entry value.
5837     */
5838    function hashGet(key) {
5839      var data = this.__data__;
5840      if (nativeCreate) {
5841        var result = data[key];
5842        return result === HASH_UNDEFINED ? undefined : result;
5843      }
5844      return hasOwnProperty.call(data, key) ? data[key] : undefined;
5845    }
5846
5847    /**
5848     * Checks if a hash value for `key` exists.
5849     *
5850     * @private
5851     * @name has
5852     * @memberOf Hash
5853     * @param {string} key The key of the entry to check.
5854     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
5855     */
5856    function hashHas(key) {
5857      var data = this.__data__;
5858      return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
5859    }
5860
5861    /**
5862     * Sets the hash `key` to `value`.
5863     *
5864     * @private
5865     * @name set
5866     * @memberOf Hash
5867     * @param {string} key The key of the value to set.
5868     * @param {*} value The value to set.
5869     * @returns {Object} Returns the hash instance.
5870     */
5871    function hashSet(key, value) {
5872      var data = this.__data__;
5873      this.size += this.has(key) ? 0 : 1;
5874      data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
5875      return this;
5876    }
5877
5878    // Add methods to `Hash`.
5879    Hash.prototype.clear = hashClear;
5880    Hash.prototype['delete'] = hashDelete;
5881    Hash.prototype.get = hashGet;
5882    Hash.prototype.has = hashHas;
5883    Hash.prototype.set = hashSet;
5884
5885    /*------------------------------------------------------------------------*/
5886
5887    /**
5888     * Creates an list cache object.
5889     *
5890     * @private
5891     * @constructor
5892     * @param {Array} [entries] The key-value pairs to cache.
5893     */
5894    function ListCache(entries) {
5895      var index = -1,
5896          length = entries == null ? 0 : entries.length;
5897
5898      this.clear();
5899      while (++index < length) {
5900        var entry = entries[index];
5901        this.set(entry[0], entry[1]);
5902      }
5903    }
5904
5905    /**
5906     * Removes all key-value entries from the list cache.
5907     *
5908     * @private
5909     * @name clear
5910     * @memberOf ListCache
5911     */
5912    function listCacheClear() {
5913      this.__data__ = [];
5914      this.size = 0;
5915    }
5916
5917    /**
5918     * Removes `key` and its value from the list cache.
5919     *
5920     * @private
5921     * @name delete
5922     * @memberOf ListCache
5923     * @param {string} key The key of the value to remove.
5924     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
5925     */
5926    function listCacheDelete(key) {
5927      var data = this.__data__,
5928          index = assocIndexOf(data, key);
5929
5930      if (index < 0) {
5931        return false;
5932      }
5933      var lastIndex = data.length - 1;
5934      if (index == lastIndex) {
5935        data.pop();
5936      } else {
5937        splice.call(data, index, 1);
5938      }
5939      --this.size;
5940      return true;
5941    }
5942
5943    /**
5944     * Gets the list cache value for `key`.
5945     *
5946     * @private
5947     * @name get
5948     * @memberOf ListCache
5949     * @param {string} key The key of the value to get.
5950     * @returns {*} Returns the entry value.
5951     */
5952    function listCacheGet(key) {
5953      var data = this.__data__,
5954          index = assocIndexOf(data, key);
5955
5956      return index < 0 ? undefined : data[index][1];
5957    }
5958
5959    /**
5960     * Checks if a list cache value for `key` exists.
5961     *
5962     * @private
5963     * @name has
5964     * @memberOf ListCache
5965     * @param {string} key The key of the entry to check.
5966     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
5967     */
5968    function listCacheHas(key) {
5969      return assocIndexOf(this.__data__, key) > -1;
5970    }
5971
5972    /**
5973     * Sets the list cache `key` to `value`.
5974     *
5975     * @private
5976     * @name set
5977     * @memberOf ListCache
5978     * @param {string} key The key of the value to set.
5979     * @param {*} value The value to set.
5980     * @returns {Object} Returns the list cache instance.
5981     */
5982    function listCacheSet(key, value) {
5983      var data = this.__data__,
5984          index = assocIndexOf(data, key);
5985
5986      if (index < 0) {
5987        ++this.size;
5988        data.push([key, value]);
5989      } else {
5990        data[index][1] = value;
5991      }
5992      return this;
5993    }
5994
5995    // Add methods to `ListCache`.
5996    ListCache.prototype.clear = listCacheClear;
5997    ListCache.prototype['delete'] = listCacheDelete;
5998    ListCache.prototype.get = listCacheGet;
5999    ListCache.prototype.has = listCacheHas;
6000    ListCache.prototype.set = listCacheSet;
6001
6002    /*------------------------------------------------------------------------*/
6003
6004    /**
6005     * Creates a map cache object to store key-value pairs.
6006     *
6007     * @private
6008     * @constructor
6009     * @param {Array} [entries] The key-value pairs to cache.
6010     */
6011    function MapCache(entries) {
6012      var index = -1,
6013          length = entries == null ? 0 : entries.length;
6014
6015      this.clear();
6016      while (++index < length) {
6017        var entry = entries[index];
6018        this.set(entry[0], entry[1]);
6019      }
6020    }
6021
6022    /**
6023     * Removes all key-value entries from the map.
6024     *
6025     * @private
6026     * @name clear
6027     * @memberOf MapCache
6028     */
6029    function mapCacheClear() {
6030      this.size = 0;
6031      this.__data__ = {
6032        'hash': new Hash,
6033        'map': new (Map || ListCache),
6034        'string': new Hash
6035      };
6036    }
6037
6038    /**
6039     * Removes `key` and its value from the map.
6040     *
6041     * @private
6042     * @name delete
6043     * @memberOf MapCache
6044     * @param {string} key The key of the value to remove.
6045     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
6046     */
6047    function mapCacheDelete(key) {
6048      var result = getMapData(this, key)['delete'](key);
6049      this.size -= result ? 1 : 0;
6050      return result;
6051    }
6052
6053    /**
6054     * Gets the map value for `key`.
6055     *
6056     * @private
6057     * @name get
6058     * @memberOf MapCache
6059     * @param {string} key The key of the value to get.
6060     * @returns {*} Returns the entry value.
6061     */
6062    function mapCacheGet(key) {
6063      return getMapData(this, key).get(key);
6064    }
6065
6066    /**
6067     * Checks if a map value for `key` exists.
6068     *
6069     * @private
6070     * @name has
6071     * @memberOf MapCache
6072     * @param {string} key The key of the entry to check.
6073     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
6074     */
6075    function mapCacheHas(key) {
6076      return getMapData(this, key).has(key);
6077    }
6078
6079    /**
6080     * Sets the map `key` to `value`.
6081     *
6082     * @private
6083     * @name set
6084     * @memberOf MapCache
6085     * @param {string} key The key of the value to set.
6086     * @param {*} value The value to set.
6087     * @returns {Object} Returns the map cache instance.
6088     */
6089    function mapCacheSet(key, value) {
6090      var data = getMapData(this, key),
6091          size = data.size;
6092
6093      data.set(key, value);
6094      this.size += data.size == size ? 0 : 1;
6095      return this;
6096    }
6097
6098    // Add methods to `MapCache`.
6099    MapCache.prototype.clear = mapCacheClear;
6100    MapCache.prototype['delete'] = mapCacheDelete;
6101    MapCache.prototype.get = mapCacheGet;
6102    MapCache.prototype.has = mapCacheHas;
6103    MapCache.prototype.set = mapCacheSet;
6104
6105    /*------------------------------------------------------------------------*/
6106
6107    /**
6108     *
6109     * Creates an array cache object to store unique values.
6110     *
6111     * @private
6112     * @constructor
6113     * @param {Array} [values] The values to cache.
6114     */
6115    function SetCache(values) {
6116      var index = -1,
6117          length = values == null ? 0 : values.length;
6118
6119      this.__data__ = new MapCache;
6120      while (++index < length) {
6121        this.add(values[index]);
6122      }
6123    }
6124
6125    /**
6126     * Adds `value` to the array cache.
6127     *
6128     * @private
6129     * @name add
6130     * @memberOf SetCache
6131     * @alias push
6132     * @param {*} value The value to cache.
6133     * @returns {Object} Returns the cache instance.
6134     */
6135    function setCacheAdd(value) {
6136      this.__data__.set(value, HASH_UNDEFINED);
6137      return this;
6138    }
6139
6140    /**
6141     * Checks if `value` is in the array cache.
6142     *
6143     * @private
6144     * @name has
6145     * @memberOf SetCache
6146     * @param {*} value The value to search for.
6147     * @returns {number} Returns `true` if `value` is found, else `false`.
6148     */
6149    function setCacheHas(value) {
6150      return this.__data__.has(value);
6151    }
6152
6153    // Add methods to `SetCache`.
6154    SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
6155    SetCache.prototype.has = setCacheHas;
6156
6157    /*------------------------------------------------------------------------*/
6158
6159    /**
6160     * Creates a stack cache object to store key-value pairs.
6161     *
6162     * @private
6163     * @constructor
6164     * @param {Array} [entries] The key-value pairs to cache.
6165     */
6166    function Stack(entries) {
6167      var data = this.__data__ = new ListCache(entries);
6168      this.size = data.size;
6169    }
6170
6171    /**
6172     * Removes all key-value entries from the stack.
6173     *
6174     * @private
6175     * @name clear
6176     * @memberOf Stack
6177     */
6178    function stackClear() {
6179      this.__data__ = new ListCache;
6180      this.size = 0;
6181    }
6182
6183    /**
6184     * Removes `key` and its value from the stack.
6185     *
6186     * @private
6187     * @name delete
6188     * @memberOf Stack
6189     * @param {string} key The key of the value to remove.
6190     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
6191     */
6192    function stackDelete(key) {
6193      var data = this.__data__,
6194          result = data['delete'](key);
6195
6196      this.size = data.size;
6197      return result;
6198    }
6199
6200    /**
6201     * Gets the stack value for `key`.
6202     *
6203     * @private
6204     * @name get
6205     * @memberOf Stack
6206     * @param {string} key The key of the value to get.
6207     * @returns {*} Returns the entry value.
6208     */
6209    function stackGet(key) {
6210      return this.__data__.get(key);
6211    }
6212
6213    /**
6214     * Checks if a stack value for `key` exists.
6215     *
6216     * @private
6217     * @name has
6218     * @memberOf Stack
6219     * @param {string} key The key of the entry to check.
6220     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
6221     */
6222    function stackHas(key) {
6223      return this.__data__.has(key);
6224    }
6225
6226    /**
6227     * Sets the stack `key` to `value`.
6228     *
6229     * @private
6230     * @name set
6231     * @memberOf Stack
6232     * @param {string} key The key of the value to set.
6233     * @param {*} value The value to set.
6234     * @returns {Object} Returns the stack cache instance.
6235     */
6236    function stackSet(key, value) {
6237      var data = this.__data__;
6238      if (data instanceof ListCache) {
6239        var pairs = data.__data__;
6240        if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
6241          pairs.push([key, value]);
6242          this.size = ++data.size;
6243          return this;
6244        }
6245        data = this.__data__ = new MapCache(pairs);
6246      }
6247      data.set(key, value);
6248      this.size = data.size;
6249      return this;
6250    }
6251
6252    // Add methods to `Stack`.
6253    Stack.prototype.clear = stackClear;
6254    Stack.prototype['delete'] = stackDelete;
6255    Stack.prototype.get = stackGet;
6256    Stack.prototype.has = stackHas;
6257    Stack.prototype.set = stackSet;
6258
6259    /*------------------------------------------------------------------------*/
6260
6261    /**
6262     * Creates an array of the enumerable property names of the array-like `value`.
6263     *
6264     * @private
6265     * @param {*} value The value to query.
6266     * @param {boolean} inherited Specify returning inherited property names.
6267     * @returns {Array} Returns the array of property names.
6268     */
6269    function arrayLikeKeys(value, inherited) {
6270      var isArr = isArray(value),
6271          isArg = !isArr && isArguments(value),
6272          isBuff = !isArr && !isArg && isBuffer(value),
6273          isType = !isArr && !isArg && !isBuff && isTypedArray(value),
6274          skipIndexes = isArr || isArg || isBuff || isType,
6275          result = skipIndexes ? baseTimes(value.length, String) : [],
6276          length = result.length;
6277
6278      for (var key in value) {
6279        if ((inherited || hasOwnProperty.call(value, key)) &&
6280            !(skipIndexes && (
6281               // Safari 9 has enumerable `arguments.length` in strict mode.
6282               key == 'length' ||
6283               // Node.js 0.10 has enumerable non-index properties on buffers.
6284               (isBuff && (key == 'offset' || key == 'parent')) ||
6285               // PhantomJS 2 has enumerable non-index properties on typed arrays.
6286               (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
6287               // Skip index properties.
6288               isIndex(key, length)
6289            ))) {
6290          result.push(key);
6291        }
6292      }
6293      return result;
6294    }
6295
6296    /**
6297     * A specialized version of `_.sample` for arrays.
6298     *
6299     * @private
6300     * @param {Array} array The array to sample.
6301     * @returns {*} Returns the random element.
6302     */
6303    function arraySample(array) {
6304      var length = array.length;
6305      return length ? array[baseRandom(0, length - 1)] : undefined;
6306    }
6307
6308    /**
6309     * A specialized version of `_.sampleSize` for arrays.
6310     *
6311     * @private
6312     * @param {Array} array The array to sample.
6313     * @param {number} n The number of elements to sample.
6314     * @returns {Array} Returns the random elements.
6315     */
6316    function arraySampleSize(array, n) {
6317      return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
6318    }
6319
6320    /**
6321     * A specialized version of `_.shuffle` for arrays.
6322     *
6323     * @private
6324     * @param {Array} array The array to shuffle.
6325     * @returns {Array} Returns the new shuffled array.
6326     */
6327    function arrayShuffle(array) {
6328      return shuffleSelf(copyArray(array));
6329    }
6330
6331    /**
6332     * This function is like `assignValue` except that it doesn't assign
6333     * `undefined` values.
6334     *
6335     * @private
6336     * @param {Object} object The object to modify.
6337     * @param {string} key The key of the property to assign.
6338     * @param {*} value The value to assign.
6339     */
6340    function assignMergeValue(object, key, value) {
6341      if ((value !== undefined && !eq(object[key], value)) ||
6342          (value === undefined && !(key in object))) {
6343        baseAssignValue(object, key, value);
6344      }
6345    }
6346
6347    /**
6348     * Assigns `value` to `key` of `object` if the existing value is not equivalent
6349     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
6350     * for equality comparisons.
6351     *
6352     * @private
6353     * @param {Object} object The object to modify.
6354     * @param {string} key The key of the property to assign.
6355     * @param {*} value The value to assign.
6356     */
6357    function assignValue(object, key, value) {
6358      var objValue = object[key];
6359      if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
6360          (value === undefined && !(key in object))) {
6361        baseAssignValue(object, key, value);
6362      }
6363    }
6364
6365    /**
6366     * Gets the index at which the `key` is found in `array` of key-value pairs.
6367     *
6368     * @private
6369     * @param {Array} array The array to inspect.
6370     * @param {*} key The key to search for.
6371     * @returns {number} Returns the index of the matched value, else `-1`.
6372     */
6373    function assocIndexOf(array, key) {
6374      var length = array.length;
6375      while (length--) {
6376        if (eq(array[length][0], key)) {
6377          return length;
6378        }
6379      }
6380      return -1;
6381    }
6382
6383    /**
6384     * Aggregates elements of `collection` on `accumulator` with keys transformed
6385     * by `iteratee` and values set by `setter`.
6386     *
6387     * @private
6388     * @param {Array|Object} collection The collection to iterate over.
6389     * @param {Function} setter The function to set `accumulator` values.
6390     * @param {Function} iteratee The iteratee to transform keys.
6391     * @param {Object} accumulator The initial aggregated object.
6392     * @returns {Function} Returns `accumulator`.
6393     */
6394    function baseAggregator(collection, setter, iteratee, accumulator) {
6395      baseEach(collection, function(value, key, collection) {
6396        setter(accumulator, value, iteratee(value), collection);
6397      });
6398      return accumulator;
6399    }
6400
6401    /**
6402     * The base implementation of `_.assign` without support for multiple sources
6403     * or `customizer` functions.
6404     *
6405     * @private
6406     * @param {Object} object The destination object.
6407     * @param {Object} source The source object.
6408     * @returns {Object} Returns `object`.
6409     */
6410    function baseAssign(object, source) {
6411      return object && copyObject(source, keys(source), object);
6412    }
6413
6414    /**
6415     * The base implementation of `_.assignIn` without support for multiple sources
6416     * or `customizer` functions.
6417     *
6418     * @private
6419     * @param {Object} object The destination object.
6420     * @param {Object} source The source object.
6421     * @returns {Object} Returns `object`.
6422     */
6423    function baseAssignIn(object, source) {
6424      return object && copyObject(source, keysIn(source), object);
6425    }
6426
6427    /**
6428     * The base implementation of `assignValue` and `assignMergeValue` without
6429     * value checks.
6430     *
6431     * @private
6432     * @param {Object} object The object to modify.
6433     * @param {string} key The key of the property to assign.
6434     * @param {*} value The value to assign.
6435     */
6436    function baseAssignValue(object, key, value) {
6437      if (key == '__proto__' && defineProperty) {
6438        defineProperty(object, key, {
6439          'configurable': true,
6440          'enumerable': true,
6441          'value': value,
6442          'writable': true
6443        });
6444      } else {
6445        object[key] = value;
6446      }
6447    }
6448
6449    /**
6450     * The base implementation of `_.at` without support for individual paths.
6451     *
6452     * @private
6453     * @param {Object} object The object to iterate over.
6454     * @param {string[]} paths The property paths to pick.
6455     * @returns {Array} Returns the picked elements.
6456     */
6457    function baseAt(object, paths) {
6458      var index = -1,
6459          length = paths.length,
6460          result = Array(length),
6461          skip = object == null;
6462
6463      while (++index < length) {
6464        result[index] = skip ? undefined : get(object, paths[index]);
6465      }
6466      return result;
6467    }
6468
6469    /**
6470     * The base implementation of `_.clamp` which doesn't coerce arguments.
6471     *
6472     * @private
6473     * @param {number} number The number to clamp.
6474     * @param {number} [lower] The lower bound.
6475     * @param {number} upper The upper bound.
6476     * @returns {number} Returns the clamped number.
6477     */
6478    function baseClamp(number, lower, upper) {
6479      if (number === number) {
6480        if (upper !== undefined) {
6481          number = number <= upper ? number : upper;
6482        }
6483        if (lower !== undefined) {
6484          number = number >= lower ? number : lower;
6485        }
6486      }
6487      return number;
6488    }
6489
6490    /**
6491     * The base implementation of `_.clone` and `_.cloneDeep` which tracks
6492     * traversed objects.
6493     *
6494     * @private
6495     * @param {*} value The value to clone.
6496     * @param {boolean} bitmask The bitmask flags.
6497     *  1 - Deep clone
6498     *  2 - Flatten inherited properties
6499     *  4 - Clone symbols
6500     * @param {Function} [customizer] The function to customize cloning.
6501     * @param {string} [key] The key of `value`.
6502     * @param {Object} [object] The parent object of `value`.
6503     * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
6504     * @returns {*} Returns the cloned value.
6505     */
6506    function baseClone(value, bitmask, customizer, key, object, stack) {
6507      var result,
6508          isDeep = bitmask & CLONE_DEEP_FLAG,
6509          isFlat = bitmask & CLONE_FLAT_FLAG,
6510          isFull = bitmask & CLONE_SYMBOLS_FLAG;
6511
6512      if (customizer) {
6513        result = object ? customizer(value, key, object, stack) : customizer(value);
6514      }
6515      if (result !== undefined) {
6516        return result;
6517      }
6518      if (!isObject(value)) {
6519        return value;
6520      }
6521      var isArr = isArray(value);
6522      if (isArr) {
6523        result = initCloneArray(value);
6524        if (!isDeep) {
6525          return copyArray(value, result);
6526        }
6527      } else {
6528        var tag = getTag(value),
6529            isFunc = tag == funcTag || tag == genTag;
6530
6531        if (isBuffer(value)) {
6532          return cloneBuffer(value, isDeep);
6533        }
6534        if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
6535          result = (isFlat || isFunc) ? {} : initCloneObject(value);
6536          if (!isDeep) {
6537            return isFlat
6538              ? copySymbolsIn(value, baseAssignIn(result, value))
6539              : copySymbols(value, baseAssign(result, value));
6540          }
6541        } else {
6542          if (!cloneableTags[tag]) {
6543            return object ? value : {};
6544          }
6545          result = initCloneByTag(value, tag, isDeep);
6546        }
6547      }
6548      // Check for circular references and return its corresponding clone.
6549      stack || (stack = new Stack);
6550      var stacked = stack.get(value);
6551      if (stacked) {
6552        return stacked;
6553      }
6554      stack.set(value, result);
6555
6556      if (isSet(value)) {
6557        value.forEach(function(subValue) {
6558          result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
6559        });
6560      } else if (isMap(value)) {
6561        value.forEach(function(subValue, key) {
6562          result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
6563        });
6564      }
6565
6566      var keysFunc = isFull
6567        ? (isFlat ? getAllKeysIn : getAllKeys)
6568        : (isFlat ? keysIn : keys);
6569
6570      var props = isArr ? undefined : keysFunc(value);
6571      arrayEach(props || value, function(subValue, key) {
6572        if (props) {
6573          key = subValue;
6574          subValue = value[key];
6575        }
6576        // Recursively populate clone (susceptible to call stack limits).
6577        assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
6578      });
6579      return result;
6580    }
6581
6582    /**
6583     * The base implementation of `_.conforms` which doesn't clone `source`.
6584     *
6585     * @private
6586     * @param {Object} source The object of property predicates to conform to.
6587     * @returns {Function} Returns the new spec function.
6588     */
6589    function baseConforms(source) {
6590      var props = keys(source);
6591      return function(object) {
6592        return baseConformsTo(object, source, props);
6593      };
6594    }
6595
6596    /**
6597     * The base implementation of `_.conformsTo` which accepts `props` to check.
6598     *
6599     * @private
6600     * @param {Object} object The object to inspect.
6601     * @param {Object} source The object of property predicates to conform to.
6602     * @returns {boolean} Returns `true` if `object` conforms, else `false`.
6603     */
6604    function baseConformsTo(object, source, props) {
6605      var length = props.length;
6606      if (object == null) {
6607        return !length;
6608      }
6609      object = Object(object);
6610      while (length--) {
6611        var key = props[length],
6612            predicate = source[key],
6613            value = object[key];
6614
6615        if ((value === undefined && !(key in object)) || !predicate(value)) {
6616          return false;
6617        }
6618      }
6619      return true;
6620    }
6621
6622    /**
6623     * The base implementation of `_.delay` and `_.defer` which accepts `args`
6624     * to provide to `func`.
6625     *
6626     * @private
6627     * @param {Function} func The function to delay.
6628     * @param {number} wait The number of milliseconds to delay invocation.
6629     * @param {Array} args The arguments to provide to `func`.
6630     * @returns {number|Object} Returns the timer id or timeout object.
6631     */
6632    function baseDelay(func, wait, args) {
6633      if (typeof func != 'function') {
6634        throw new TypeError(FUNC_ERROR_TEXT);
6635      }
6636      return setTimeout(function() { func.apply(undefined, args); }, wait);
6637    }
6638
6639    /**
6640     * The base implementation of methods like `_.difference` without support
6641     * for excluding multiple arrays or iteratee shorthands.
6642     *
6643     * @private
6644     * @param {Array} array The array to inspect.
6645     * @param {Array} values The values to exclude.
6646     * @param {Function} [iteratee] The iteratee invoked per element.
6647     * @param {Function} [comparator] The comparator invoked per element.
6648     * @returns {Array} Returns the new array of filtered values.
6649     */
6650    function baseDifference(array, values, iteratee, comparator) {
6651      var index = -1,
6652          includes = arrayIncludes,
6653          isCommon = true,
6654          length = array.length,
6655          result = [],
6656          valuesLength = values.length;
6657
6658      if (!length) {
6659        return result;
6660      }
6661      if (iteratee) {
6662        values = arrayMap(values, baseUnary(iteratee));
6663      }
6664      if (comparator) {
6665        includes = arrayIncludesWith;
6666        isCommon = false;
6667      }
6668      else if (values.length >= LARGE_ARRAY_SIZE) {
6669        includes = cacheHas;
6670        isCommon = false;
6671        values = new SetCache(values);
6672      }
6673      outer:
6674      while (++index < length) {
6675        var value = array[index],
6676            computed = iteratee == null ? value : iteratee(value);
6677
6678        value = (comparator || value !== 0) ? value : 0;
6679        if (isCommon && computed === computed) {
6680          var valuesIndex = valuesLength;
6681          while (valuesIndex--) {
6682            if (values[valuesIndex] === computed) {
6683              continue outer;
6684            }
6685          }
6686          result.push(value);
6687        }
6688        else if (!includes(values, computed, comparator)) {
6689          result.push(value);
6690        }
6691      }
6692      return result;
6693    }
6694
6695    /**
6696     * The base implementation of `_.forEach` without support for iteratee shorthands.
6697     *
6698     * @private
6699     * @param {Array|Object} collection The collection to iterate over.
6700     * @param {Function} iteratee The function invoked per iteration.
6701     * @returns {Array|Object} Returns `collection`.
6702     */
6703    var baseEach = createBaseEach(baseForOwn);
6704
6705    /**
6706     * The base implementation of `_.forEachRight` without support for iteratee shorthands.
6707     *
6708     * @private
6709     * @param {Array|Object} collection The collection to iterate over.
6710     * @param {Function} iteratee The function invoked per iteration.
6711     * @returns {Array|Object} Returns `collection`.
6712     */
6713    var baseEachRight = createBaseEach(baseForOwnRight, true);
6714
6715    /**
6716     * The base implementation of `_.every` without support for iteratee shorthands.
6717     *
6718     * @private
6719     * @param {Array|Object} collection The collection to iterate over.
6720     * @param {Function} predicate The function invoked per iteration.
6721     * @returns {boolean} Returns `true` if all elements pass the predicate check,
6722     *  else `false`
6723     */
6724    function baseEvery(collection, predicate) {
6725      var result = true;
6726      baseEach(collection, function(value, index, collection) {
6727        result = !!predicate(value, index, collection);
6728        return result;
6729      });
6730      return result;
6731    }
6732
6733    /**
6734     * The base implementation of methods like `_.max` and `_.min` which accepts a
6735     * `comparator` to determine the extremum value.
6736     *
6737     * @private
6738     * @param {Array} array The array to iterate over.
6739     * @param {Function} iteratee The iteratee invoked per iteration.
6740     * @param {Function} comparator The comparator used to compare values.
6741     * @returns {*} Returns the extremum value.
6742     */
6743    function baseExtremum(array, iteratee, comparator) {
6744      var index = -1,
6745          length = array.length;
6746
6747      while (++index < length) {
6748        var value = array[index],
6749            current = iteratee(value);
6750
6751        if (current != null && (computed === undefined
6752              ? (current === current && !isSymbol(current))
6753              : comparator(current, computed)
6754            )) {
6755          var computed = current,
6756              result = value;
6757        }
6758      }
6759      return result;
6760    }
6761
6762    /**
6763     * The base implementation of `_.fill` without an iteratee call guard.
6764     *
6765     * @private
6766     * @param {Array} array The array to fill.
6767     * @param {*} value The value to fill `array` with.
6768     * @param {number} [start=0] The start position.
6769     * @param {number} [end=array.length] The end position.
6770     * @returns {Array} Returns `array`.
6771     */
6772    function baseFill(array, value, start, end) {
6773      var length = array.length;
6774
6775      start = toInteger(start);
6776      if (start < 0) {
6777        start = -start > length ? 0 : (length + start);
6778      }
6779      end = (end === undefined || end > length) ? length : toInteger(end);
6780      if (end < 0) {
6781        end += length;
6782      }
6783      end = start > end ? 0 : toLength(end);
6784      while (start < end) {
6785        array[start++] = value;
6786      }
6787      return array;
6788    }
6789
6790    /**
6791     * The base implementation of `_.filter` without support for iteratee shorthands.
6792     *
6793     * @private
6794     * @param {Array|Object} collection The collection to iterate over.
6795     * @param {Function} predicate The function invoked per iteration.
6796     * @returns {Array} Returns the new filtered array.
6797     */
6798    function baseFilter(collection, predicate) {
6799      var result = [];
6800      baseEach(collection, function(value, index, collection) {
6801        if (predicate(value, index, collection)) {
6802          result.push(value);
6803        }
6804      });
6805      return result;
6806    }
6807
6808    /**
6809     * The base implementation of `_.flatten` with support for restricting flattening.
6810     *
6811     * @private
6812     * @param {Array} array The array to flatten.
6813     * @param {number} depth The maximum recursion depth.
6814     * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
6815     * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
6816     * @param {Array} [result=[]] The initial result value.
6817     * @returns {Array} Returns the new flattened array.
6818     */
6819    function baseFlatten(array, depth, predicate, isStrict, result) {
6820      var index = -1,
6821          length = array.length;
6822
6823      predicate || (predicate = isFlattenable);
6824      result || (result = []);
6825
6826      while (++index < length) {
6827        var value = array[index];
6828        if (depth > 0 && predicate(value)) {
6829          if (depth > 1) {
6830            // Recursively flatten arrays (susceptible to call stack limits).
6831            baseFlatten(value, depth - 1, predicate, isStrict, result);
6832          } else {
6833            arrayPush(result, value);
6834          }
6835        } else if (!isStrict) {
6836          result[result.length] = value;
6837        }
6838      }
6839      return result;
6840    }
6841
6842    /**
6843     * The base implementation of `baseForOwn` which iterates over `object`
6844     * properties returned by `keysFunc` and invokes `iteratee` for each property.
6845     * Iteratee functions may exit iteration early by explicitly returning `false`.
6846     *
6847     * @private
6848     * @param {Object} object The object to iterate over.
6849     * @param {Function} iteratee The function invoked per iteration.
6850     * @param {Function} keysFunc The function to get the keys of `object`.
6851     * @returns {Object} Returns `object`.
6852     */
6853    var baseFor = createBaseFor();
6854
6855    /**
6856     * This function is like `baseFor` except that it iterates over properties
6857     * in the opposite order.
6858     *
6859     * @private
6860     * @param {Object} object The object to iterate over.
6861     * @param {Function} iteratee The function invoked per iteration.
6862     * @param {Function} keysFunc The function to get the keys of `object`.
6863     * @returns {Object} Returns `object`.
6864     */
6865    var baseForRight = createBaseFor(true);
6866
6867    /**
6868     * The base implementation of `_.forOwn` without support for iteratee shorthands.
6869     *
6870     * @private
6871     * @param {Object} object The object to iterate over.
6872     * @param {Function} iteratee The function invoked per iteration.
6873     * @returns {Object} Returns `object`.
6874     */
6875    function baseForOwn(object, iteratee) {
6876      return object && baseFor(object, iteratee, keys);
6877    }
6878
6879    /**
6880     * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
6881     *
6882     * @private
6883     * @param {Object} object The object to iterate over.
6884     * @param {Function} iteratee The function invoked per iteration.
6885     * @returns {Object} Returns `object`.
6886     */
6887    function baseForOwnRight(object, iteratee) {
6888      return object && baseForRight(object, iteratee, keys);
6889    }
6890
6891    /**
6892     * The base implementation of `_.functions` which creates an array of
6893     * `object` function property names filtered from `props`.
6894     *
6895     * @private
6896     * @param {Object} object The object to inspect.
6897     * @param {Array} props The property names to filter.
6898     * @returns {Array} Returns the function names.
6899     */
6900    function baseFunctions(object, props) {
6901      return arrayFilter(props, function(key) {
6902        return isFunction(object[key]);
6903      });
6904    }
6905
6906    /**
6907     * The base implementation of `_.get` without support for default values.
6908     *
6909     * @private
6910     * @param {Object} object The object to query.
6911     * @param {Array|string} path The path of the property to get.
6912     * @returns {*} Returns the resolved value.
6913     */
6914    function baseGet(object, path) {
6915      path = castPath(path, object);
6916
6917      var index = 0,
6918          length = path.length;
6919
6920      while (object != null && index < length) {
6921        object = object[toKey(path[index++])];
6922      }
6923      return (index && index == length) ? object : undefined;
6924    }
6925
6926    /**
6927     * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
6928     * `keysFunc` and `symbolsFunc` to get the enumerable property names and
6929     * symbols of `object`.
6930     *
6931     * @private
6932     * @param {Object} object The object to query.
6933     * @param {Function} keysFunc The function to get the keys of `object`.
6934     * @param {Function} symbolsFunc The function to get the symbols of `object`.
6935     * @returns {Array} Returns the array of property names and symbols.
6936     */
6937    function baseGetAllKeys(object, keysFunc, symbolsFunc) {
6938      var result = keysFunc(object);
6939      return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
6940    }
6941
6942    /**
6943     * The base implementation of `getTag` without fallbacks for buggy environments.
6944     *
6945     * @private
6946     * @param {*} value The value to query.
6947     * @returns {string} Returns the `toStringTag`.
6948     */
6949    function baseGetTag(value) {
6950      if (value == null) {
6951        return value === undefined ? undefinedTag : nullTag;
6952      }
6953      return (symToStringTag && symToStringTag in Object(value))
6954        ? getRawTag(value)
6955        : objectToString(value);
6956    }
6957
6958    /**
6959     * The base implementation of `_.gt` which doesn't coerce arguments.
6960     *
6961     * @private
6962     * @param {*} value The value to compare.
6963     * @param {*} other The other value to compare.
6964     * @returns {boolean} Returns `true` if `value` is greater than `other`,
6965     *  else `false`.
6966     */
6967    function baseGt(value, other) {
6968      return value > other;
6969    }
6970
6971    /**
6972     * The base implementation of `_.has` without support for deep paths.
6973     *
6974     * @private
6975     * @param {Object} [object] The object to query.
6976     * @param {Array|string} key The key to check.
6977     * @returns {boolean} Returns `true` if `key` exists, else `false`.
6978     */
6979    function baseHas(object, key) {
6980      return object != null && hasOwnProperty.call(object, key);
6981    }
6982
6983    /**
6984     * The base implementation of `_.hasIn` without support for deep paths.
6985     *
6986     * @private
6987     * @param {Object} [object] The object to query.
6988     * @param {Array|string} key The key to check.
6989     * @returns {boolean} Returns `true` if `key` exists, else `false`.
6990     */
6991    function baseHasIn(object, key) {
6992      return object != null && key in Object(object);
6993    }
6994
6995    /**
6996     * The base implementation of `_.inRange` which doesn't coerce arguments.
6997     *
6998     * @private
6999     * @param {number} number The number to check.
7000     * @param {number} start The start of the range.
7001     * @param {number} end The end of the range.
7002     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
7003     */
7004    function baseInRange(number, start, end) {
7005      return number >= nativeMin(start, end) && number < nativeMax(start, end);
7006    }
7007
7008    /**
7009     * The base implementation of methods like `_.intersection`, without support
7010     * for iteratee shorthands, that accepts an array of arrays to inspect.
7011     *
7012     * @private
7013     * @param {Array} arrays The arrays to inspect.
7014     * @param {Function} [iteratee] The iteratee invoked per element.
7015     * @param {Function} [comparator] The comparator invoked per element.
7016     * @returns {Array} Returns the new array of shared values.
7017     */
7018    function baseIntersection(arrays, iteratee, comparator) {
7019      var includes = comparator ? arrayIncludesWith : arrayIncludes,
7020          length = arrays[0].length,
7021          othLength = arrays.length,
7022          othIndex = othLength,
7023          caches = Array(othLength),
7024          maxLength = Infinity,
7025          result = [];
7026
7027      while (othIndex--) {
7028        var array = arrays[othIndex];
7029        if (othIndex && iteratee) {
7030          array = arrayMap(array, baseUnary(iteratee));
7031        }
7032        maxLength = nativeMin(array.length, maxLength);
7033        caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
7034          ? new SetCache(othIndex && array)
7035          : undefined;
7036      }
7037      array = arrays[0];
7038
7039      var index = -1,
7040          seen = caches[0];
7041
7042      outer:
7043      while (++index < length && result.length < maxLength) {
7044        var value = array[index],
7045            computed = iteratee ? iteratee(value) : value;
7046
7047        value = (comparator || value !== 0) ? value : 0;
7048        if (!(seen
7049              ? cacheHas(seen, computed)
7050              : includes(result, computed, comparator)
7051            )) {
7052          othIndex = othLength;
7053          while (--othIndex) {
7054            var cache = caches[othIndex];
7055            if (!(cache
7056                  ? cacheHas(cache, computed)
7057                  : includes(arrays[othIndex], computed, comparator))
7058                ) {
7059              continue outer;
7060            }
7061          }
7062          if (seen) {
7063            seen.push(computed);
7064          }
7065          result.push(value);
7066        }
7067      }
7068      return result;
7069    }
7070
7071    /**
7072     * The base implementation of `_.invert` and `_.invertBy` which inverts
7073     * `object` with values transformed by `iteratee` and set by `setter`.
7074     *
7075     * @private
7076     * @param {Object} object The object to iterate over.
7077     * @param {Function} setter The function to set `accumulator` values.
7078     * @param {Function} iteratee The iteratee to transform values.
7079     * @param {Object} accumulator The initial inverted object.
7080     * @returns {Function} Returns `accumulator`.
7081     */
7082    function baseInverter(object, setter, iteratee, accumulator) {
7083      baseForOwn(object, function(value, key, object) {
7084        setter(accumulator, iteratee(value), key, object);
7085      });
7086      return accumulator;
7087    }
7088
7089    /**
7090     * The base implementation of `_.invoke` without support for individual
7091     * method arguments.
7092     *
7093     * @private
7094     * @param {Object} object The object to query.
7095     * @param {Array|string} path The path of the method to invoke.
7096     * @param {Array} args The arguments to invoke the method with.
7097     * @returns {*} Returns the result of the invoked method.
7098     */
7099    function baseInvoke(object, path, args) {
7100      path = castPath(path, object);
7101      object = parent(object, path);
7102      var func = object == null ? object : object[toKey(last(path))];
7103      return func == null ? undefined : apply(func, object, args);
7104    }
7105
7106    /**
7107     * The base implementation of `_.isArguments`.
7108     *
7109     * @private
7110     * @param {*} value The value to check.
7111     * @returns {boolean} Returns `true` if `value` is an `arguments` object,
7112     */
7113    function baseIsArguments(value) {
7114      return isObjectLike(value) && baseGetTag(value) == argsTag;
7115    }
7116
7117    /**
7118     * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
7119     *
7120     * @private
7121     * @param {*} value The value to check.
7122     * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
7123     */
7124    function baseIsArrayBuffer(value) {
7125      return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
7126    }
7127
7128    /**
7129     * The base implementation of `_.isDate` without Node.js optimizations.
7130     *
7131     * @private
7132     * @param {*} value The value to check.
7133     * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
7134     */
7135    function baseIsDate(value) {
7136      return isObjectLike(value) && baseGetTag(value) == dateTag;
7137    }
7138
7139    /**
7140     * The base implementation of `_.isEqual` which supports partial comparisons
7141     * and tracks traversed objects.
7142     *
7143     * @private
7144     * @param {*} value The value to compare.
7145     * @param {*} other The other value to compare.
7146     * @param {boolean} bitmask The bitmask flags.
7147     *  1 - Unordered comparison
7148     *  2 - Partial comparison
7149     * @param {Function} [customizer] The function to customize comparisons.
7150     * @param {Object} [stack] Tracks traversed `value` and `other` objects.
7151     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
7152     */
7153    function baseIsEqual(value, other, bitmask, customizer, stack) {
7154      if (value === other) {
7155        return true;
7156      }
7157      if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
7158        return value !== value && other !== other;
7159      }
7160      return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
7161    }
7162
7163    /**
7164     * A specialized version of `baseIsEqual` for arrays and objects which performs
7165     * deep comparisons and tracks traversed objects enabling objects with circular
7166     * references to be compared.
7167     *
7168     * @private
7169     * @param {Object} object The object to compare.
7170     * @param {Object} other The other object to compare.
7171     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
7172     * @param {Function} customizer The function to customize comparisons.
7173     * @param {Function} equalFunc The function to determine equivalents of values.
7174     * @param {Object} [stack] Tracks traversed `object` and `other` objects.
7175     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
7176     */
7177    function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
7178      var objIsArr = isArray(object),
7179          othIsArr = isArray(other),
7180          objTag = objIsArr ? arrayTag : getTag(object),
7181          othTag = othIsArr ? arrayTag : getTag(other);
7182
7183      objTag = objTag == argsTag ? objectTag : objTag;
7184      othTag = othTag == argsTag ? objectTag : othTag;
7185
7186      var objIsObj = objTag == objectTag,
7187          othIsObj = othTag == objectTag,
7188          isSameTag = objTag == othTag;
7189
7190      if (isSameTag && isBuffer(object)) {
7191        if (!isBuffer(other)) {
7192          return false;
7193        }
7194        objIsArr = true;
7195        objIsObj = false;
7196      }
7197      if (isSameTag && !objIsObj) {
7198        stack || (stack = new Stack);
7199        return (objIsArr || isTypedArray(object))
7200          ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
7201          : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
7202      }
7203      if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
7204        var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
7205            othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
7206
7207        if (objIsWrapped || othIsWrapped) {
7208          var objUnwrapped = objIsWrapped ? object.value() : object,
7209              othUnwrapped = othIsWrapped ? other.value() : other;
7210
7211          stack || (stack = new Stack);
7212          return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
7213        }
7214      }
7215      if (!isSameTag) {
7216        return false;
7217      }
7218      stack || (stack = new Stack);
7219      return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
7220    }
7221
7222    /**
7223     * The base implementation of `_.isMap` without Node.js optimizations.
7224     *
7225     * @private
7226     * @param {*} value The value to check.
7227     * @returns {boolean} Returns `true` if `value` is a map, else `false`.
7228     */
7229    function baseIsMap(value) {
7230      return isObjectLike(value) && getTag(value) == mapTag;
7231    }
7232
7233    /**
7234     * The base implementation of `_.isMatch` without support for iteratee shorthands.
7235     *
7236     * @private
7237     * @param {Object} object The object to inspect.
7238     * @param {Object} source The object of property values to match.
7239     * @param {Array} matchData The property names, values, and compare flags to match.
7240     * @param {Function} [customizer] The function to customize comparisons.
7241     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
7242     */
7243    function baseIsMatch(object, source, matchData, customizer) {
7244      var index = matchData.length,
7245          length = index,
7246          noCustomizer = !customizer;
7247
7248      if (object == null) {
7249        return !length;
7250      }
7251      object = Object(object);
7252      while (index--) {
7253        var data = matchData[index];
7254        if ((noCustomizer && data[2])
7255              ? data[1] !== object[data[0]]
7256              : !(data[0] in object)
7257            ) {
7258          return false;
7259        }
7260      }
7261      while (++index < length) {
7262        data = matchData[index];
7263        var key = data[0],
7264            objValue = object[key],
7265            srcValue = data[1];
7266
7267        if (noCustomizer && data[2]) {
7268          if (objValue === undefined && !(key in object)) {
7269            return false;
7270          }
7271        } else {
7272          var stack = new Stack;
7273          if (customizer) {
7274            var result = customizer(objValue, srcValue, key, object, source, stack);
7275          }
7276          if (!(result === undefined
7277                ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
7278                : result
7279              )) {
7280            return false;
7281          }
7282        }
7283      }
7284      return true;
7285    }
7286
7287    /**
7288     * The base implementation of `_.isNative` without bad shim checks.
7289     *
7290     * @private
7291     * @param {*} value The value to check.
7292     * @returns {boolean} Returns `true` if `value` is a native function,
7293     *  else `false`.
7294     */
7295    function baseIsNative(value) {
7296      if (!isObject(value) || isMasked(value)) {
7297        return false;
7298      }
7299      var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
7300      return pattern.test(toSource(value));
7301    }
7302
7303    /**
7304     * The base implementation of `_.isRegExp` without Node.js optimizations.
7305     *
7306     * @private
7307     * @param {*} value The value to check.
7308     * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
7309     */
7310    function baseIsRegExp(value) {
7311      return isObjectLike(value) && baseGetTag(value) == regexpTag;
7312    }
7313
7314    /**
7315     * The base implementation of `_.isSet` without Node.js optimizations.
7316     *
7317     * @private
7318     * @param {*} value The value to check.
7319     * @returns {boolean} Returns `true` if `value` is a set, else `false`.
7320     */
7321    function baseIsSet(value) {
7322      return isObjectLike(value) && getTag(value) == setTag;
7323    }
7324
7325    /**
7326     * The base implementation of `_.isTypedArray` without Node.js optimizations.
7327     *
7328     * @private
7329     * @param {*} value The value to check.
7330     * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
7331     */
7332    function baseIsTypedArray(value) {
7333      return isObjectLike(value) &&
7334        isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
7335    }
7336
7337    /**
7338     * The base implementation of `_.iteratee`.
7339     *
7340     * @private
7341     * @param {*} [value=_.identity] The value to convert to an iteratee.
7342     * @returns {Function} Returns the iteratee.
7343     */
7344    function baseIteratee(value) {
7345      // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
7346      // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
7347      if (typeof value == 'function') {
7348        return value;
7349      }
7350      if (value == null) {
7351        return identity;
7352      }
7353      if (typeof value == 'object') {
7354        return isArray(value)
7355          ? baseMatchesProperty(value[0], value[1])
7356          : baseMatches(value);
7357      }
7358      return property(value);
7359    }
7360
7361    /**
7362     * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
7363     *
7364     * @private
7365     * @param {Object} object The object to query.
7366     * @returns {Array} Returns the array of property names.
7367     */
7368    function baseKeys(object) {
7369      if (!isPrototype(object)) {
7370        return nativeKeys(object);
7371      }
7372      var result = [];
7373      for (var key in Object(object)) {
7374        if (hasOwnProperty.call(object, key) && key != 'constructor') {
7375          result.push(key);
7376        }
7377      }
7378      return result;
7379    }
7380
7381    /**
7382     * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
7383     *
7384     * @private
7385     * @param {Object} object The object to query.
7386     * @returns {Array} Returns the array of property names.
7387     */
7388    function baseKeysIn(object) {
7389      if (!isObject(object)) {
7390        return nativeKeysIn(object);
7391      }
7392      var isProto = isPrototype(object),
7393          result = [];
7394
7395      for (var key in object) {
7396        if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
7397          result.push(key);
7398        }
7399      }
7400      return result;
7401    }
7402
7403    /**
7404     * The base implementation of `_.lt` which doesn't coerce arguments.
7405     *
7406     * @private
7407     * @param {*} value The value to compare.
7408     * @param {*} other The other value to compare.
7409     * @returns {boolean} Returns `true` if `value` is less than `other`,
7410     *  else `false`.
7411     */
7412    function baseLt(value, other) {
7413      return value < other;
7414    }
7415
7416    /**
7417     * The base implementation of `_.map` without support for iteratee shorthands.
7418     *
7419     * @private
7420     * @param {Array|Object} collection The collection to iterate over.
7421     * @param {Function} iteratee The function invoked per iteration.
7422     * @returns {Array} Returns the new mapped array.
7423     */
7424    function baseMap(collection, iteratee) {
7425      var index = -1,
7426          result = isArrayLike(collection) ? Array(collection.length) : [];
7427
7428      baseEach(collection, function(value, key, collection) {
7429        result[++index] = iteratee(value, key, collection);
7430      });
7431      return result;
7432    }
7433
7434    /**
7435     * The base implementation of `_.matches` which doesn't clone `source`.
7436     *
7437     * @private
7438     * @param {Object} source The object of property values to match.
7439     * @returns {Function} Returns the new spec function.
7440     */
7441    function baseMatches(source) {
7442      var matchData = getMatchData(source);
7443      if (matchData.length == 1 && matchData[0][2]) {
7444        return matchesStrictComparable(matchData[0][0], matchData[0][1]);
7445      }
7446      return function(object) {
7447        return object === source || baseIsMatch(object, source, matchData);
7448      };
7449    }
7450
7451    /**
7452     * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
7453     *
7454     * @private
7455     * @param {string} path The path of the property to get.
7456     * @param {*} srcValue The value to match.
7457     * @returns {Function} Returns the new spec function.
7458     */
7459    function baseMatchesProperty(path, srcValue) {
7460      if (isKey(path) && isStrictComparable(srcValue)) {
7461        return matchesStrictComparable(toKey(path), srcValue);
7462      }
7463      return function(object) {
7464        var objValue = get(object, path);
7465        return (objValue === undefined && objValue === srcValue)
7466          ? hasIn(object, path)
7467          : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
7468      };
7469    }
7470
7471    /**
7472     * The base implementation of `_.merge` without support for multiple sources.
7473     *
7474     * @private
7475     * @param {Object} object The destination object.
7476     * @param {Object} source The source object.
7477     * @param {number} srcIndex The index of `source`.
7478     * @param {Function} [customizer] The function to customize merged values.
7479     * @param {Object} [stack] Tracks traversed source values and their merged
7480     *  counterparts.
7481     */
7482    function baseMerge(object, source, srcIndex, customizer, stack) {
7483      if (object === source) {
7484        return;
7485      }
7486      baseFor(source, function(srcValue, key) {
7487        stack || (stack = new Stack);
7488        if (isObject(srcValue)) {
7489          baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
7490        }
7491        else {
7492          var newValue = customizer
7493            ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
7494            : undefined;
7495
7496          if (newValue === undefined) {
7497            newValue = srcValue;
7498          }
7499          assignMergeValue(object, key, newValue);
7500        }
7501      }, keysIn);
7502    }
7503
7504    /**
7505     * A specialized version of `baseMerge` for arrays and objects which performs
7506     * deep merges and tracks traversed objects enabling objects with circular
7507     * references to be merged.
7508     *
7509     * @private
7510     * @param {Object} object The destination object.
7511     * @param {Object} source The source object.
7512     * @param {string} key The key of the value to merge.
7513     * @param {number} srcIndex The index of `source`.
7514     * @param {Function} mergeFunc The function to merge values.
7515     * @param {Function} [customizer] The function to customize assigned values.
7516     * @param {Object} [stack] Tracks traversed source values and their merged
7517     *  counterparts.
7518     */
7519    function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
7520      var objValue = safeGet(object, key),
7521          srcValue = safeGet(source, key),
7522          stacked = stack.get(srcValue);
7523
7524      if (stacked) {
7525        assignMergeValue(object, key, stacked);
7526        return;
7527      }
7528      var newValue = customizer
7529        ? customizer(objValue, srcValue, (key + ''), object, source, stack)
7530        : undefined;
7531
7532      var isCommon = newValue === undefined;
7533
7534      if (isCommon) {
7535        var isArr = isArray(srcValue),
7536            isBuff = !isArr && isBuffer(srcValue),
7537            isTyped = !isArr && !isBuff && isTypedArray(srcValue);
7538
7539        newValue = srcValue;
7540        if (isArr || isBuff || isTyped) {
7541          if (isArray(objValue)) {
7542            newValue = objValue;
7543          }
7544          else if (isArrayLikeObject(objValue)) {
7545            newValue = copyArray(objValue);
7546          }
7547          else if (isBuff) {
7548            isCommon = false;
7549            newValue = cloneBuffer(srcValue, true);
7550          }
7551          else if (isTyped) {
7552            isCommon = false;
7553            newValue = cloneTypedArray(srcValue, true);
7554          }
7555          else {
7556            newValue = [];
7557          }
7558        }
7559        else if (isPlainObject(srcValue) || isArguments(srcValue)) {
7560          newValue = objValue;
7561          if (isArguments(objValue)) {
7562            newValue = toPlainObject(objValue);
7563          }
7564          else if (!isObject(objValue) || isFunction(objValue)) {
7565            newValue = initCloneObject(srcValue);
7566          }
7567        }
7568        else {
7569          isCommon = false;
7570        }
7571      }
7572      if (isCommon) {
7573        // Recursively merge objects and arrays (susceptible to call stack limits).
7574        stack.set(srcValue, newValue);
7575        mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
7576        stack['delete'](srcValue);
7577      }
7578      assignMergeValue(object, key, newValue);
7579    }
7580
7581    /**
7582     * The base implementation of `_.nth` which doesn't coerce arguments.
7583     *
7584     * @private
7585     * @param {Array} array The array to query.
7586     * @param {number} n The index of the element to return.
7587     * @returns {*} Returns the nth element of `array`.
7588     */
7589    function baseNth(array, n) {
7590      var length = array.length;
7591      if (!length) {
7592        return;
7593      }
7594      n += n < 0 ? length : 0;
7595      return isIndex(n, length) ? array[n] : undefined;
7596    }
7597
7598    /**
7599     * The base implementation of `_.orderBy` without param guards.
7600     *
7601     * @private
7602     * @param {Array|Object} collection The collection to iterate over.
7603     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
7604     * @param {string[]} orders The sort orders of `iteratees`.
7605     * @returns {Array} Returns the new sorted array.
7606     */
7607    function baseOrderBy(collection, iteratees, orders) {
7608      if (iteratees.length) {
7609        iteratees = arrayMap(iteratees, function(iteratee) {
7610          if (isArray(iteratee)) {
7611            return function(value) {
7612              return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
7613            }
7614          }
7615          return iteratee;
7616        });
7617      } else {
7618        iteratees = [identity];
7619      }
7620
7621      var index = -1;
7622      iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
7623
7624      var result = baseMap(collection, function(value, key, collection) {
7625        var criteria = arrayMap(iteratees, function(iteratee) {
7626          return iteratee(value);
7627        });
7628        return { 'criteria': criteria, 'index': ++index, 'value': value };
7629      });
7630
7631      return baseSortBy(result, function(object, other) {
7632        return compareMultiple(object, other, orders);
7633      });
7634    }
7635
7636    /**
7637     * The base implementation of `_.pick` without support for individual
7638     * property identifiers.
7639     *
7640     * @private
7641     * @param {Object} object The source object.
7642     * @param {string[]} paths The property paths to pick.
7643     * @returns {Object} Returns the new object.
7644     */
7645    function basePick(object, paths) {
7646      return basePickBy(object, paths, function(value, path) {
7647        return hasIn(object, path);
7648      });
7649    }
7650
7651    /**
7652     * The base implementation of  `_.pickBy` without support for iteratee shorthands.
7653     *
7654     * @private
7655     * @param {Object} object The source object.
7656     * @param {string[]} paths The property paths to pick.
7657     * @param {Function} predicate The function invoked per property.
7658     * @returns {Object} Returns the new object.
7659     */
7660    function basePickBy(object, paths, predicate) {
7661      var index = -1,
7662          length = paths.length,
7663          result = {};
7664
7665      while (++index < length) {
7666        var path = paths[index],
7667            value = baseGet(object, path);
7668
7669        if (predicate(value, path)) {
7670          baseSet(result, castPath(path, object), value);
7671        }
7672      }
7673      return result;
7674    }
7675
7676    /**
7677     * A specialized version of `baseProperty` which supports deep paths.
7678     *
7679     * @private
7680     * @param {Array|string} path The path of the property to get.
7681     * @returns {Function} Returns the new accessor function.
7682     */
7683    function basePropertyDeep(path) {
7684      return function(object) {
7685        return baseGet(object, path);
7686      };
7687    }
7688
7689    /**
7690     * The base implementation of `_.pullAllBy` without support for iteratee
7691     * shorthands.
7692     *
7693     * @private
7694     * @param {Array} array The array to modify.
7695     * @param {Array} values The values to remove.
7696     * @param {Function} [iteratee] The iteratee invoked per element.
7697     * @param {Function} [comparator] The comparator invoked per element.
7698     * @returns {Array} Returns `array`.
7699     */
7700    function basePullAll(array, values, iteratee, comparator) {
7701      var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
7702          index = -1,
7703          length = values.length,
7704          seen = array;
7705
7706      if (array === values) {
7707        values = copyArray(values);
7708      }
7709      if (iteratee) {
7710        seen = arrayMap(array, baseUnary(iteratee));
7711      }
7712      while (++index < length) {
7713        var fromIndex = 0,
7714            value = values[index],
7715            computed = iteratee ? iteratee(value) : value;
7716
7717        while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
7718          if (seen !== array) {
7719            splice.call(seen, fromIndex, 1);
7720          }
7721          splice.call(array, fromIndex, 1);
7722        }
7723      }
7724      return array;
7725    }
7726
7727    /**
7728     * The base implementation of `_.pullAt` without support for individual
7729     * indexes or capturing the removed elements.
7730     *
7731     * @private
7732     * @param {Array} array The array to modify.
7733     * @param {number[]} indexes The indexes of elements to remove.
7734     * @returns {Array} Returns `array`.
7735     */
7736    function basePullAt(array, indexes) {
7737      var length = array ? indexes.length : 0,
7738          lastIndex = length - 1;
7739
7740      while (length--) {
7741        var index = indexes[length];
7742        if (length == lastIndex || index !== previous) {
7743          var previous = index;
7744          if (isIndex(index)) {
7745            splice.call(array, index, 1);
7746          } else {
7747            baseUnset(array, index);
7748          }
7749        }
7750      }
7751      return array;
7752    }
7753
7754    /**
7755     * The base implementation of `_.random` without support for returning
7756     * floating-point numbers.
7757     *
7758     * @private
7759     * @param {number} lower The lower bound.
7760     * @param {number} upper The upper bound.
7761     * @returns {number} Returns the random number.
7762     */
7763    function baseRandom(lower, upper) {
7764      return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
7765    }
7766
7767    /**
7768     * The base implementation of `_.range` and `_.rangeRight` which doesn't
7769     * coerce arguments.
7770     *
7771     * @private
7772     * @param {number} start The start of the range.
7773     * @param {number} end The end of the range.
7774     * @param {number} step The value to increment or decrement by.
7775     * @param {boolean} [fromRight] Specify iterating from right to left.
7776     * @returns {Array} Returns the range of numbers.
7777     */
7778    function baseRange(start, end, step, fromRight) {
7779      var index = -1,
7780          length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
7781          result = Array(length);
7782
7783      while (length--) {
7784        result[fromRight ? length : ++index] = start;
7785        start += step;
7786      }
7787      return result;
7788    }
7789
7790    /**
7791     * The base implementation of `_.repeat` which doesn't coerce arguments.
7792     *
7793     * @private
7794     * @param {string} string The string to repeat.
7795     * @param {number} n The number of times to repeat the string.
7796     * @returns {string} Returns the repeated string.
7797     */
7798    function baseRepeat(string, n) {
7799      var result = '';
7800      if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
7801        return result;
7802      }
7803      // Leverage the exponentiation by squaring algorithm for a faster repeat.
7804      // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
7805      do {
7806        if (n % 2) {
7807          result += string;
7808        }
7809        n = nativeFloor(n / 2);
7810        if (n) {
7811          string += string;
7812        }
7813      } while (n);
7814
7815      return result;
7816    }
7817
7818    /**
7819     * The base implementation of `_.rest` which doesn't validate or coerce arguments.
7820     *
7821     * @private
7822     * @param {Function} func The function to apply a rest parameter to.
7823     * @param {number} [start=func.length-1] The start position of the rest parameter.
7824     * @returns {Function} Returns the new function.
7825     */
7826    function baseRest(func, start) {
7827      return setToString(overRest(func, start, identity), func + '');
7828    }
7829
7830    /**
7831     * The base implementation of `_.sample`.
7832     *
7833     * @private
7834     * @param {Array|Object} collection The collection to sample.
7835     * @returns {*} Returns the random element.
7836     */
7837    function baseSample(collection) {
7838      return arraySample(values(collection));
7839    }
7840
7841    /**
7842     * The base implementation of `_.sampleSize` without param guards.
7843     *
7844     * @private
7845     * @param {Array|Object} collection The collection to sample.
7846     * @param {number} n The number of elements to sample.
7847     * @returns {Array} Returns the random elements.
7848     */
7849    function baseSampleSize(collection, n) {
7850      var array = values(collection);
7851      return shuffleSelf(array, baseClamp(n, 0, array.length));
7852    }
7853
7854    /**
7855     * The base implementation of `_.set`.
7856     *
7857     * @private
7858     * @param {Object} object The object to modify.
7859     * @param {Array|string} path The path of the property to set.
7860     * @param {*} value The value to set.
7861     * @param {Function} [customizer] The function to customize path creation.
7862     * @returns {Object} Returns `object`.
7863     */
7864    function baseSet(object, path, value, customizer) {
7865      if (!isObject(object)) {
7866        return object;
7867      }
7868      path = castPath(path, object);
7869
7870      var index = -1,
7871          length = path.length,
7872          lastIndex = length - 1,
7873          nested = object;
7874
7875      while (nested != null && ++index < length) {
7876        var key = toKey(path[index]),
7877            newValue = value;
7878
7879        if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
7880          return object;
7881        }
7882
7883        if (index != lastIndex) {
7884          var objValue = nested[key];
7885          newValue = customizer ? customizer(objValue, key, nested) : undefined;
7886          if (newValue === undefined) {
7887            newValue = isObject(objValue)
7888              ? objValue
7889              : (isIndex(path[index + 1]) ? [] : {});
7890          }
7891        }
7892        assignValue(nested, key, newValue);
7893        nested = nested[key];
7894      }
7895      return object;
7896    }
7897
7898    /**
7899     * The base implementation of `setData` without support for hot loop shorting.
7900     *
7901     * @private
7902     * @param {Function} func The function to associate metadata with.
7903     * @param {*} data The metadata.
7904     * @returns {Function} Returns `func`.
7905     */
7906    var baseSetData = !metaMap ? identity : function(func, data) {
7907      metaMap.set(func, data);
7908      return func;
7909    };
7910
7911    /**
7912     * The base implementation of `setToString` without support for hot loop shorting.
7913     *
7914     * @private
7915     * @param {Function} func The function to modify.
7916     * @param {Function} string The `toString` result.
7917     * @returns {Function} Returns `func`.
7918     */
7919    var baseSetToString = !defineProperty ? identity : function(func, string) {
7920      return defineProperty(func, 'toString', {
7921        'configurable': true,
7922        'enumerable': false,
7923        'value': constant(string),
7924        'writable': true
7925      });
7926    };
7927
7928    /**
7929     * The base implementation of `_.shuffle`.
7930     *
7931     * @private
7932     * @param {Array|Object} collection The collection to shuffle.
7933     * @returns {Array} Returns the new shuffled array.
7934     */
7935    function baseShuffle(collection) {
7936      return shuffleSelf(values(collection));
7937    }
7938
7939    /**
7940     * The base implementation of `_.slice` without an iteratee call guard.
7941     *
7942     * @private
7943     * @param {Array} array The array to slice.
7944     * @param {number} [start=0] The start position.
7945     * @param {number} [end=array.length] The end position.
7946     * @returns {Array} Returns the slice of `array`.
7947     */
7948    function baseSlice(array, start, end) {
7949      var index = -1,
7950          length = array.length;
7951
7952      if (start < 0) {
7953        start = -start > length ? 0 : (length + start);
7954      }
7955      end = end > length ? length : end;
7956      if (end < 0) {
7957        end += length;
7958      }
7959      length = start > end ? 0 : ((end - start) >>> 0);
7960      start >>>= 0;
7961
7962      var result = Array(length);
7963      while (++index < length) {
7964        result[index] = array[index + start];
7965      }
7966      return result;
7967    }
7968
7969    /**
7970     * The base implementation of `_.some` without support for iteratee shorthands.
7971     *
7972     * @private
7973     * @param {Array|Object} collection The collection to iterate over.
7974     * @param {Function} predicate The function invoked per iteration.
7975     * @returns {boolean} Returns `true` if any element passes the predicate check,
7976     *  else `false`.
7977     */
7978    function baseSome(collection, predicate) {
7979      var result;
7980
7981      baseEach(collection, function(value, index, collection) {
7982        result = predicate(value, index, collection);
7983        return !result;
7984      });
7985      return !!result;
7986    }
7987
7988    /**
7989     * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
7990     * performs a binary search of `array` to determine the index at which `value`
7991     * should be inserted into `array` in order to maintain its sort order.
7992     *
7993     * @private
7994     * @param {Array} array The sorted array to inspect.
7995     * @param {*} value The value to evaluate.
7996     * @param {boolean} [retHighest] Specify returning the highest qualified index.
7997     * @returns {number} Returns the index at which `value` should be inserted
7998     *  into `array`.
7999     */
8000    function baseSortedIndex(array, value, retHighest) {
8001      var low = 0,
8002          high = array == null ? low : array.length;
8003
8004      if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8005        while (low < high) {
8006          var mid = (low + high) >>> 1,
8007              computed = array[mid];
8008
8009          if (computed !== null && !isSymbol(computed) &&
8010              (retHighest ? (computed <= value) : (computed < value))) {
8011            low = mid + 1;
8012          } else {
8013            high = mid;
8014          }
8015        }
8016        return high;
8017      }
8018      return baseSortedIndexBy(array, value, identity, retHighest);
8019    }
8020
8021    /**
8022     * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
8023     * which invokes `iteratee` for `value` and each element of `array` to compute
8024     * their sort ranking. The iteratee is invoked with one argument; (value).
8025     *
8026     * @private
8027     * @param {Array} array The sorted array to inspect.
8028     * @param {*} value The value to evaluate.
8029     * @param {Function} iteratee The iteratee invoked per element.
8030     * @param {boolean} [retHighest] Specify returning the highest qualified index.
8031     * @returns {number} Returns the index at which `value` should be inserted
8032     *  into `array`.
8033     */
8034    function baseSortedIndexBy(array, value, iteratee, retHighest) {
8035      var low = 0,
8036          high = array == null ? 0 : array.length;
8037      if (high === 0) {
8038        return 0;
8039      }
8040
8041      value = iteratee(value);
8042      var valIsNaN = value !== value,
8043          valIsNull = value === null,
8044          valIsSymbol = isSymbol(value),
8045          valIsUndefined = value === undefined;
8046
8047      while (low < high) {
8048        var mid = nativeFloor((low + high) / 2),
8049            computed = iteratee(array[mid]),
8050            othIsDefined = computed !== undefined,
8051            othIsNull = computed === null,
8052            othIsReflexive = computed === computed,
8053            othIsSymbol = isSymbol(computed);
8054
8055        if (valIsNaN) {
8056          var setLow = retHighest || othIsReflexive;
8057        } else if (valIsUndefined) {
8058          setLow = othIsReflexive && (retHighest || othIsDefined);
8059        } else if (valIsNull) {
8060          setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8061        } else if (valIsSymbol) {
8062          setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8063        } else if (othIsNull || othIsSymbol) {
8064          setLow = false;
8065        } else {
8066          setLow = retHighest ? (computed <= value) : (computed < value);
8067        }
8068        if (setLow) {
8069          low = mid + 1;
8070        } else {
8071          high = mid;
8072        }
8073      }
8074      return nativeMin(high, MAX_ARRAY_INDEX);
8075    }
8076
8077    /**
8078     * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
8079     * support for iteratee shorthands.
8080     *
8081     * @private
8082     * @param {Array} array The array to inspect.
8083     * @param {Function} [iteratee] The iteratee invoked per element.
8084     * @returns {Array} Returns the new duplicate free array.
8085     */
8086    function baseSortedUniq(array, iteratee) {
8087      var index = -1,
8088          length = array.length,
8089          resIndex = 0,
8090          result = [];
8091
8092      while (++index < length) {
8093        var value = array[index],
8094            computed = iteratee ? iteratee(value) : value;
8095
8096        if (!index || !eq(computed, seen)) {
8097          var seen = computed;
8098          result[resIndex++] = value === 0 ? 0 : value;
8099        }
8100      }
8101      return result;
8102    }
8103
8104    /**
8105     * The base implementation of `_.toNumber` which doesn't ensure correct
8106     * conversions of binary, hexadecimal, or octal string values.
8107     *
8108     * @private
8109     * @param {*} value The value to process.
8110     * @returns {number} Returns the number.
8111     */
8112    function baseToNumber(value) {
8113      if (typeof value == 'number') {
8114        return value;
8115      }
8116      if (isSymbol(value)) {
8117        return NAN;
8118      }
8119      return +value;
8120    }
8121
8122    /**
8123     * The base implementation of `_.toString` which doesn't convert nullish
8124     * values to empty strings.
8125     *
8126     * @private
8127     * @param {*} value The value to process.
8128     * @returns {string} Returns the string.
8129     */
8130    function baseToString(value) {
8131      // Exit early for strings to avoid a performance hit in some environments.
8132      if (typeof value == 'string') {
8133        return value;
8134      }
8135      if (isArray(value)) {
8136        // Recursively convert values (susceptible to call stack limits).
8137        return arrayMap(value, baseToString) + '';
8138      }
8139      if (isSymbol(value)) {
8140        return symbolToString ? symbolToString.call(value) : '';
8141      }
8142      var result = (value + '');
8143      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
8144    }
8145
8146    /**
8147     * The base implementation of `_.uniqBy` without support for iteratee shorthands.
8148     *
8149     * @private
8150     * @param {Array} array The array to inspect.
8151     * @param {Function} [iteratee] The iteratee invoked per element.
8152     * @param {Function} [comparator] The comparator invoked per element.
8153     * @returns {Array} Returns the new duplicate free array.
8154     */
8155    function baseUniq(array, iteratee, comparator) {
8156      var index = -1,
8157          includes = arrayIncludes,
8158          length = array.length,
8159          isCommon = true,
8160          result = [],
8161          seen = result;
8162
8163      if (comparator) {
8164        isCommon = false;
8165        includes = arrayIncludesWith;
8166      }
8167      else if (length >= LARGE_ARRAY_SIZE) {
8168        var set = iteratee ? null : createSet(array);
8169        if (set) {
8170          return setToArray(set);
8171        }
8172        isCommon = false;
8173        includes = cacheHas;
8174        seen = new SetCache;
8175      }
8176      else {
8177        seen = iteratee ? [] : result;
8178      }
8179      outer:
8180      while (++index < length) {
8181        var value = array[index],
8182            computed = iteratee ? iteratee(value) : value;
8183
8184        value = (comparator || value !== 0) ? value : 0;
8185        if (isCommon && computed === computed) {
8186          var seenIndex = seen.length;
8187          while (seenIndex--) {
8188            if (seen[seenIndex] === computed) {
8189              continue outer;
8190            }
8191          }
8192          if (iteratee) {
8193            seen.push(computed);
8194          }
8195          result.push(value);
8196        }
8197        else if (!includes(seen, computed, comparator)) {
8198          if (seen !== result) {
8199            seen.push(computed);
8200          }
8201          result.push(value);
8202        }
8203      }
8204      return result;
8205    }
8206
8207    /**
8208     * The base implementation of `_.unset`.
8209     *
8210     * @private
8211     * @param {Object} object The object to modify.
8212     * @param {Array|string} path The property path to unset.
8213     * @returns {boolean} Returns `true` if the property is deleted, else `false`.
8214     */
8215    function baseUnset(object, path) {
8216      path = castPath(path, object);
8217      object = parent(object, path);
8218      return object == null || delete object[toKey(last(path))];
8219    }
8220
8221    /**
8222     * The base implementation of `_.update`.
8223     *
8224     * @private
8225     * @param {Object} object The object to modify.
8226     * @param {Array|string} path The path of the property to update.
8227     * @param {Function} updater The function to produce the updated value.
8228     * @param {Function} [customizer] The function to customize path creation.
8229     * @returns {Object} Returns `object`.
8230     */
8231    function baseUpdate(object, path, updater, customizer) {
8232      return baseSet(object, path, updater(baseGet(object, path)), customizer);
8233    }
8234
8235    /**
8236     * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
8237     * without support for iteratee shorthands.
8238     *
8239     * @private
8240     * @param {Array} array The array to query.
8241     * @param {Function} predicate The function invoked per iteration.
8242     * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
8243     * @param {boolean} [fromRight] Specify iterating from right to left.
8244     * @returns {Array} Returns the slice of `array`.
8245     */
8246    function baseWhile(array, predicate, isDrop, fromRight) {
8247      var length = array.length,
8248          index = fromRight ? length : -1;
8249
8250      while ((fromRight ? index-- : ++index < length) &&
8251        predicate(array[index], index, array)) {}
8252
8253      return isDrop
8254        ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
8255        : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
8256    }
8257
8258    /**
8259     * The base implementation of `wrapperValue` which returns the result of
8260     * performing a sequence of actions on the unwrapped `value`, where each
8261     * successive action is supplied the return value of the previous.
8262     *
8263     * @private
8264     * @param {*} value The unwrapped value.
8265     * @param {Array} actions Actions to perform to resolve the unwrapped value.
8266     * @returns {*} Returns the resolved value.
8267     */
8268    function baseWrapperValue(value, actions) {
8269      var result = value;
8270      if (result instanceof LazyWrapper) {
8271        result = result.value();
8272      }
8273      return arrayReduce(actions, function(result, action) {
8274        return action.func.apply(action.thisArg, arrayPush([result], action.args));
8275      }, result);
8276    }
8277
8278    /**
8279     * The base implementation of methods like `_.xor`, without support for
8280     * iteratee shorthands, that accepts an array of arrays to inspect.
8281     *
8282     * @private
8283     * @param {Array} arrays The arrays to inspect.
8284     * @param {Function} [iteratee] The iteratee invoked per element.
8285     * @param {Function} [comparator] The comparator invoked per element.
8286     * @returns {Array} Returns the new array of values.
8287     */
8288    function baseXor(arrays, iteratee, comparator) {
8289      var length = arrays.length;
8290      if (length < 2) {
8291        return length ? baseUniq(arrays[0]) : [];
8292      }
8293      var index = -1,
8294          result = Array(length);
8295
8296      while (++index < length) {
8297        var array = arrays[index],
8298            othIndex = -1;
8299
8300        while (++othIndex < length) {
8301          if (othIndex != index) {
8302            result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
8303          }
8304        }
8305      }
8306      return baseUniq(baseFlatten(result, 1), iteratee, comparator);
8307    }
8308
8309    /**
8310     * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
8311     *
8312     * @private
8313     * @param {Array} props The property identifiers.
8314     * @param {Array} values The property values.
8315     * @param {Function} assignFunc The function to assign values.
8316     * @returns {Object} Returns the new object.
8317     */
8318    function baseZipObject(props, values, assignFunc) {
8319      var index = -1,
8320          length = props.length,
8321          valsLength = values.length,
8322          result = {};
8323
8324      while (++index < length) {
8325        var value = index < valsLength ? values[index] : undefined;
8326        assignFunc(result, props[index], value);
8327      }
8328      return result;
8329    }
8330
8331    /**
8332     * Casts `value` to an empty array if it's not an array like object.
8333     *
8334     * @private
8335     * @param {*} value The value to inspect.
8336     * @returns {Array|Object} Returns the cast array-like object.
8337     */
8338    function castArrayLikeObject(value) {
8339      return isArrayLikeObject(value) ? value : [];
8340    }
8341
8342    /**
8343     * Casts `value` to `identity` if it's not a function.
8344     *
8345     * @private
8346     * @param {*} value The value to inspect.
8347     * @returns {Function} Returns cast function.
8348     */
8349    function castFunction(value) {
8350      return typeof value == 'function' ? value : identity;
8351    }
8352
8353    /**
8354     * Casts `value` to a path array if it's not one.
8355     *
8356     * @private
8357     * @param {*} value The value to inspect.
8358     * @param {Object} [object] The object to query keys on.
8359     * @returns {Array} Returns the cast property path array.
8360     */
8361    function castPath(value, object) {
8362      if (isArray(value)) {
8363        return value;
8364      }
8365      return isKey(value, object) ? [value] : stringToPath(toString(value));
8366    }
8367
8368    /**
8369     * A `baseRest` alias which can be replaced with `identity` by module
8370     * replacement plugins.
8371     *
8372     * @private
8373     * @type {Function}
8374     * @param {Function} func The function to apply a rest parameter to.
8375     * @returns {Function} Returns the new function.
8376     */
8377    var castRest = baseRest;
8378
8379    /**
8380     * Casts `array` to a slice if it's needed.
8381     *
8382     * @private
8383     * @param {Array} array The array to inspect.
8384     * @param {number} start The start position.
8385     * @param {number} [end=array.length] The end position.
8386     * @returns {Array} Returns the cast slice.
8387     */
8388    function castSlice(array, start, end) {
8389      var length = array.length;
8390      end = end === undefined ? length : end;
8391      return (!start && end >= length) ? array : baseSlice(array, start, end);
8392    }
8393
8394    /**
8395     * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
8396     *
8397     * @private
8398     * @param {number|Object} id The timer id or timeout object of the timer to clear.
8399     */
8400    var clearTimeout = ctxClearTimeout || function(id) {
8401      return root.clearTimeout(id);
8402    };
8403
8404    /**
8405     * Creates a clone of  `buffer`.
8406     *
8407     * @private
8408     * @param {Buffer} buffer The buffer to clone.
8409     * @param {boolean} [isDeep] Specify a deep clone.
8410     * @returns {Buffer} Returns the cloned buffer.
8411     */
8412    function cloneBuffer(buffer, isDeep) {
8413      if (isDeep) {
8414        return buffer.slice();
8415      }
8416      var length = buffer.length,
8417          result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8418
8419      buffer.copy(result);
8420      return result;
8421    }
8422
8423    /**
8424     * Creates a clone of `arrayBuffer`.
8425     *
8426     * @private
8427     * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
8428     * @returns {ArrayBuffer} Returns the cloned array buffer.
8429     */
8430    function cloneArrayBuffer(arrayBuffer) {
8431      var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
8432      new Uint8Array(result).set(new Uint8Array(arrayBuffer));
8433      return result;
8434    }
8435
8436    /**
8437     * Creates a clone of `dataView`.
8438     *
8439     * @private
8440     * @param {Object} dataView The data view to clone.
8441     * @param {boolean} [isDeep] Specify a deep clone.
8442     * @returns {Object} Returns the cloned data view.
8443     */
8444    function cloneDataView(dataView, isDeep) {
8445      var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8446      return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8447    }
8448
8449    /**
8450     * Creates a clone of `regexp`.
8451     *
8452     * @private
8453     * @param {Object} regexp The regexp to clone.
8454     * @returns {Object} Returns the cloned regexp.
8455     */
8456    function cloneRegExp(regexp) {
8457      var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8458      result.lastIndex = regexp.lastIndex;
8459      return result;
8460    }
8461
8462    /**
8463     * Creates a clone of the `symbol` object.
8464     *
8465     * @private
8466     * @param {Object} symbol The symbol object to clone.
8467     * @returns {Object} Returns the cloned symbol object.
8468     */
8469    function cloneSymbol(symbol) {
8470      return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
8471    }
8472
8473    /**
8474     * Creates a clone of `typedArray`.
8475     *
8476     * @private
8477     * @param {Object} typedArray The typed array to clone.
8478     * @param {boolean} [isDeep] Specify a deep clone.
8479     * @returns {Object} Returns the cloned typed array.
8480     */
8481    function cloneTypedArray(typedArray, isDeep) {
8482      var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8483      return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8484    }
8485
8486    /**
8487     * Compares values to sort them in ascending order.
8488     *
8489     * @private
8490     * @param {*} value The value to compare.
8491     * @param {*} other The other value to compare.
8492     * @returns {number} Returns the sort order indicator for `value`.
8493     */
8494    function compareAscending(value, other) {
8495      if (value !== other) {
8496        var valIsDefined = value !== undefined,
8497            valIsNull = value === null,
8498            valIsReflexive = value === value,
8499            valIsSymbol = isSymbol(value);
8500
8501        var othIsDefined = other !== undefined,
8502            othIsNull = other === null,
8503            othIsReflexive = other === other,
8504            othIsSymbol = isSymbol(other);
8505
8506        if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
8507            (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
8508            (valIsNull && othIsDefined && othIsReflexive) ||
8509            (!valIsDefined && othIsReflexive) ||
8510            !valIsReflexive) {
8511          return 1;
8512        }
8513        if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
8514            (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
8515            (othIsNull && valIsDefined && valIsReflexive) ||
8516            (!othIsDefined && valIsReflexive) ||
8517            !othIsReflexive) {
8518          return -1;
8519        }
8520      }
8521      return 0;
8522    }
8523
8524    /**
8525     * Used by `_.orderBy` to compare multiple properties of a value to another
8526     * and stable sort them.
8527     *
8528     * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
8529     * specify an order of "desc" for descending or "asc" for ascending sort order
8530     * of corresponding values.
8531     *
8532     * @private
8533     * @param {Object} object The object to compare.
8534     * @param {Object} other The other object to compare.
8535     * @param {boolean[]|string[]} orders The order to sort by for each property.
8536     * @returns {number} Returns the sort order indicator for `object`.
8537     */
8538    function compareMultiple(object, other, orders) {
8539      var index = -1,
8540          objCriteria = object.criteria,
8541          othCriteria = other.criteria,
8542          length = objCriteria.length,
8543          ordersLength = orders.length;
8544
8545      while (++index < length) {
8546        var result = compareAscending(objCriteria[index], othCriteria[index]);
8547        if (result) {
8548          if (index >= ordersLength) {
8549            return result;
8550          }
8551          var order = orders[index];
8552          return result * (order == 'desc' ? -1 : 1);
8553        }
8554      }
8555      // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
8556      // that causes it, under certain circumstances, to provide the same value for
8557      // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
8558      // for more details.
8559      //
8560      // This also ensures a stable sort in V8 and other engines.
8561      // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
8562      return object.index - other.index;
8563    }
8564
8565    /**
8566     * Creates an array that is the composition of partially applied arguments,
8567     * placeholders, and provided arguments into a single array of arguments.
8568     *
8569     * @private
8570     * @param {Array} args The provided arguments.
8571     * @param {Array} partials The arguments to prepend to those provided.
8572     * @param {Array} holders The `partials` placeholder indexes.
8573     * @params {boolean} [isCurried] Specify composing for a curried function.
8574     * @returns {Array} Returns the new array of composed arguments.
8575     */
8576    function composeArgs(args, partials, holders, isCurried) {
8577      var argsIndex = -1,
8578          argsLength = args.length,
8579          holdersLength = holders.length,
8580          leftIndex = -1,
8581          leftLength = partials.length,
8582          rangeLength = nativeMax(argsLength - holdersLength, 0),
8583          result = Array(leftLength + rangeLength),
8584          isUncurried = !isCurried;
8585
8586      while (++leftIndex < leftLength) {
8587        result[leftIndex] = partials[leftIndex];
8588      }
8589      while (++argsIndex < holdersLength) {
8590        if (isUncurried || argsIndex < argsLength) {
8591          result[holders[argsIndex]] = args[argsIndex];
8592        }
8593      }
8594      while (rangeLength--) {
8595        result[leftIndex++] = args[argsIndex++];
8596      }
8597      return result;
8598    }
8599
8600    /**
8601     * This function is like `composeArgs` except that the arguments composition
8602     * is tailored for `_.partialRight`.
8603     *
8604     * @private
8605     * @param {Array} args The provided arguments.
8606     * @param {Array} partials The arguments to append to those provided.
8607     * @param {Array} holders The `partials` placeholder indexes.
8608     * @params {boolean} [isCurried] Specify composing for a curried function.
8609     * @returns {Array} Returns the new array of composed arguments.
8610     */
8611    function composeArgsRight(args, partials, holders, isCurried) {
8612      var argsIndex = -1,
8613          argsLength = args.length,
8614          holdersIndex = -1,
8615          holdersLength = holders.length,
8616          rightIndex = -1,
8617          rightLength = partials.length,
8618          rangeLength = nativeMax(argsLength - holdersLength, 0),
8619          result = Array(rangeLength + rightLength),
8620          isUncurried = !isCurried;
8621
8622      while (++argsIndex < rangeLength) {
8623        result[argsIndex] = args[argsIndex];
8624      }
8625      var offset = argsIndex;
8626      while (++rightIndex < rightLength) {
8627        result[offset + rightIndex] = partials[rightIndex];
8628      }
8629      while (++holdersIndex < holdersLength) {
8630        if (isUncurried || argsIndex < argsLength) {
8631          result[offset + holders[holdersIndex]] = args[argsIndex++];
8632        }
8633      }
8634      return result;
8635    }
8636
8637    /**
8638     * Copies the values of `source` to `array`.
8639     *
8640     * @private
8641     * @param {Array} source The array to copy values from.
8642     * @param {Array} [array=[]] The array to copy values to.
8643     * @returns {Array} Returns `array`.
8644     */
8645    function copyArray(source, array) {
8646      var index = -1,
8647          length = source.length;
8648
8649      array || (array = Array(length));
8650      while (++index < length) {
8651        array[index] = source[index];
8652      }
8653      return array;
8654    }
8655
8656    /**
8657     * Copies properties of `source` to `object`.
8658     *
8659     * @private
8660     * @param {Object} source The object to copy properties from.
8661     * @param {Array} props The property identifiers to copy.
8662     * @param {Object} [object={}] The object to copy properties to.
8663     * @param {Function} [customizer] The function to customize copied values.
8664     * @returns {Object} Returns `object`.
8665     */
8666    function copyObject(source, props, object, customizer) {
8667      var isNew = !object;
8668      object || (object = {});
8669
8670      var index = -1,
8671          length = props.length;
8672
8673      while (++index < length) {
8674        var key = props[index];
8675
8676        var newValue = customizer
8677          ? customizer(object[key], source[key], key, object, source)
8678          : undefined;
8679
8680        if (newValue === undefined) {
8681          newValue = source[key];
8682        }
8683        if (isNew) {
8684          baseAssignValue(object, key, newValue);
8685        } else {
8686          assignValue(object, key, newValue);
8687        }
8688      }
8689      return object;
8690    }
8691
8692    /**
8693     * Copies own symbols of `source` to `object`.
8694     *
8695     * @private
8696     * @param {Object} source The object to copy symbols from.
8697     * @param {Object} [object={}] The object to copy symbols to.
8698     * @returns {Object} Returns `object`.
8699     */
8700    function copySymbols(source, object) {
8701      return copyObject(source, getSymbols(source), object);
8702    }
8703
8704    /**
8705     * Copies own and inherited symbols of `source` to `object`.
8706     *
8707     * @private
8708     * @param {Object} source The object to copy symbols from.
8709     * @param {Object} [object={}] The object to copy symbols to.
8710     * @returns {Object} Returns `object`.
8711     */
8712    function copySymbolsIn(source, object) {
8713      return copyObject(source, getSymbolsIn(source), object);
8714    }
8715
8716    /**
8717     * Creates a function like `_.groupBy`.
8718     *
8719     * @private
8720     * @param {Function} setter The function to set accumulator values.
8721     * @param {Function} [initializer] The accumulator object initializer.
8722     * @returns {Function} Returns the new aggregator function.
8723     */
8724    function createAggregator(setter, initializer) {
8725      return function(collection, iteratee) {
8726        var func = isArray(collection) ? arrayAggregator : baseAggregator,
8727            accumulator = initializer ? initializer() : {};
8728
8729        return func(collection, setter, getIteratee(iteratee, 2), accumulator);
8730      };
8731    }
8732
8733    /**
8734     * Creates a function like `_.assign`.
8735     *
8736     * @private
8737     * @param {Function} assigner The function to assign values.
8738     * @returns {Function} Returns the new assigner function.
8739     */
8740    function createAssigner(assigner) {
8741      return baseRest(function(object, sources) {
8742        var index = -1,
8743            length = sources.length,
8744            customizer = length > 1 ? sources[length - 1] : undefined,
8745            guard = length > 2 ? sources[2] : undefined;
8746
8747        customizer = (assigner.length > 3 && typeof customizer == 'function')
8748          ? (length--, customizer)
8749          : undefined;
8750
8751        if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8752          customizer = length < 3 ? undefined : customizer;
8753          length = 1;
8754        }
8755        object = Object(object);
8756        while (++index < length) {
8757          var source = sources[index];
8758          if (source) {
8759            assigner(object, source, index, customizer);
8760          }
8761        }
8762        return object;
8763      });
8764    }
8765
8766    /**
8767     * Creates a `baseEach` or `baseEachRight` function.
8768     *
8769     * @private
8770     * @param {Function} eachFunc The function to iterate over a collection.
8771     * @param {boolean} [fromRight] Specify iterating from right to left.
8772     * @returns {Function} Returns the new base function.
8773     */
8774    function createBaseEach(eachFunc, fromRight) {
8775      return function(collection, iteratee) {
8776        if (collection == null) {
8777          return collection;
8778        }
8779        if (!isArrayLike(collection)) {
8780          return eachFunc(collection, iteratee);
8781        }
8782        var length = collection.length,
8783            index = fromRight ? length : -1,
8784            iterable = Object(collection);
8785
8786        while ((fromRight ? index-- : ++index < length)) {
8787          if (iteratee(iterable[index], index, iterable) === false) {
8788            break;
8789          }
8790        }
8791        return collection;
8792      };
8793    }
8794
8795    /**
8796     * Creates a base function for methods like `_.forIn` and `_.forOwn`.
8797     *
8798     * @private
8799     * @param {boolean} [fromRight] Specify iterating from right to left.
8800     * @returns {Function} Returns the new base function.
8801     */
8802    function createBaseFor(fromRight) {
8803      return function(object, iteratee, keysFunc) {
8804        var index = -1,
8805            iterable = Object(object),
8806            props = keysFunc(object),
8807            length = props.length;
8808
8809        while (length--) {
8810          var key = props[fromRight ? length : ++index];
8811          if (iteratee(iterable[key], key, iterable) === false) {
8812            break;
8813          }
8814        }
8815        return object;
8816      };
8817    }
8818
8819    /**
8820     * Creates a function that wraps `func` to invoke it with the optional `this`
8821     * binding of `thisArg`.
8822     *
8823     * @private
8824     * @param {Function} func The function to wrap.
8825     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
8826     * @param {*} [thisArg] The `this` binding of `func`.
8827     * @returns {Function} Returns the new wrapped function.
8828     */
8829    function createBind(func, bitmask, thisArg) {
8830      var isBind = bitmask & WRAP_BIND_FLAG,
8831          Ctor = createCtor(func);
8832
8833      function wrapper() {
8834        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
8835        return fn.apply(isBind ? thisArg : this, arguments);
8836      }
8837      return wrapper;
8838    }
8839
8840    /**
8841     * Creates a function like `_.lowerFirst`.
8842     *
8843     * @private
8844     * @param {string} methodName The name of the `String` case method to use.
8845     * @returns {Function} Returns the new case function.
8846     */
8847    function createCaseFirst(methodName) {
8848      return function(string) {
8849        string = toString(string);
8850
8851        var strSymbols = hasUnicode(string)
8852          ? stringToArray(string)
8853          : undefined;
8854
8855        var chr = strSymbols
8856          ? strSymbols[0]
8857          : string.charAt(0);
8858
8859        var trailing = strSymbols
8860          ? castSlice(strSymbols, 1).join('')
8861          : string.slice(1);
8862
8863        return chr[methodName]() + trailing;
8864      };
8865    }
8866
8867    /**
8868     * Creates a function like `_.camelCase`.
8869     *
8870     * @private
8871     * @param {Function} callback The function to combine each word.
8872     * @returns {Function} Returns the new compounder function.
8873     */
8874    function createCompounder(callback) {
8875      return function(string) {
8876        return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
8877      };
8878    }
8879
8880    /**
8881     * Creates a function that produces an instance of `Ctor` regardless of
8882     * whether it was invoked as part of a `new` expression or by `call` or `apply`.
8883     *
8884     * @private
8885     * @param {Function} Ctor The constructor to wrap.
8886     * @returns {Function} Returns the new wrapped function.
8887     */
8888    function createCtor(Ctor) {
8889      return function() {
8890        // Use a `switch` statement to work with class constructors. See
8891        // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
8892        // for more details.
8893        var args = arguments;
8894        switch (args.length) {
8895          case 0: return new Ctor;
8896          case 1: return new Ctor(args[0]);
8897          case 2: return new Ctor(args[0], args[1]);
8898          case 3: return new Ctor(args[0], args[1], args[2]);
8899          case 4: return new Ctor(args[0], args[1], args[2], args[3]);
8900          case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
8901          case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
8902          case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
8903        }
8904        var thisBinding = baseCreate(Ctor.prototype),
8905            result = Ctor.apply(thisBinding, args);
8906
8907        // Mimic the constructor's `return` behavior.
8908        // See https://es5.github.io/#x13.2.2 for more details.
8909        return isObject(result) ? result : thisBinding;
8910      };
8911    }
8912
8913    /**
8914     * Creates a function that wraps `func` to enable currying.
8915     *
8916     * @private
8917     * @param {Function} func The function to wrap.
8918     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
8919     * @param {number} arity The arity of `func`.
8920     * @returns {Function} Returns the new wrapped function.
8921     */
8922    function createCurry(func, bitmask, arity) {
8923      var Ctor = createCtor(func);
8924
8925      function wrapper() {
8926        var length = arguments.length,
8927            args = Array(length),
8928            index = length,
8929            placeholder = getHolder(wrapper);
8930
8931        while (index--) {
8932          args[index] = arguments[index];
8933        }
8934        var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
8935          ? []
8936          : replaceHolders(args, placeholder);
8937
8938        length -= holders.length;
8939        if (length < arity) {
8940          return createRecurry(
8941            func, bitmask, createHybrid, wrapper.placeholder, undefined,
8942            args, holders, undefined, undefined, arity - length);
8943        }
8944        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
8945        return apply(fn, this, args);
8946      }
8947      return wrapper;
8948    }
8949
8950    /**
8951     * Creates a `_.find` or `_.findLast` function.
8952     *
8953     * @private
8954     * @param {Function} findIndexFunc The function to find the collection index.
8955     * @returns {Function} Returns the new find function.
8956     */
8957    function createFind(findIndexFunc) {
8958      return function(collection, predicate, fromIndex) {
8959        var iterable = Object(collection);
8960        if (!isArrayLike(collection)) {
8961          var iteratee = getIteratee(predicate, 3);
8962          collection = keys(collection);
8963          predicate = function(key) { return iteratee(iterable[key], key, iterable); };
8964        }
8965        var index = findIndexFunc(collection, predicate, fromIndex);
8966        return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
8967      };
8968    }
8969
8970    /**
8971     * Creates a `_.flow` or `_.flowRight` function.
8972     *
8973     * @private
8974     * @param {boolean} [fromRight] Specify iterating from right to left.
8975     * @returns {Function} Returns the new flow function.
8976     */
8977    function createFlow(fromRight) {
8978      return flatRest(function(funcs) {
8979        var length = funcs.length,
8980            index = length,
8981            prereq = LodashWrapper.prototype.thru;
8982
8983        if (fromRight) {
8984          funcs.reverse();
8985        }
8986        while (index--) {
8987          var func = funcs[index];
8988          if (typeof func != 'function') {
8989            throw new TypeError(FUNC_ERROR_TEXT);
8990          }
8991          if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
8992            var wrapper = new LodashWrapper([], true);
8993          }
8994        }
8995        index = wrapper ? index : length;
8996        while (++index < length) {
8997          func = funcs[index];
8998
8999          var funcName = getFuncName(func),
9000              data = funcName == 'wrapper' ? getData(func) : undefined;
9001
9002          if (data && isLaziable(data[0]) &&
9003                data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
9004                !data[4].length && data[9] == 1
9005              ) {
9006            wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
9007          } else {
9008            wrapper = (func.length == 1 && isLaziable(func))
9009              ? wrapper[funcName]()
9010              : wrapper.thru(func);
9011          }
9012        }
9013        return function() {
9014          var args = arguments,
9015              value = args[0];
9016
9017          if (wrapper && args.length == 1 && isArray(value)) {
9018            return wrapper.plant(value).value();
9019          }
9020          var index = 0,
9021              result = length ? funcs[index].apply(this, args) : value;
9022
9023          while (++index < length) {
9024            result = funcs[index].call(this, result);
9025          }
9026          return result;
9027        };
9028      });
9029    }
9030
9031    /**
9032     * Creates a function that wraps `func` to invoke it with optional `this`
9033     * binding of `thisArg`, partial application, and currying.
9034     *
9035     * @private
9036     * @param {Function|string} func The function or method name to wrap.
9037     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
9038     * @param {*} [thisArg] The `this` binding of `func`.
9039     * @param {Array} [partials] The arguments to prepend to those provided to
9040     *  the new function.
9041     * @param {Array} [holders] The `partials` placeholder indexes.
9042     * @param {Array} [partialsRight] The arguments to append to those provided
9043     *  to the new function.
9044     * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
9045     * @param {Array} [argPos] The argument positions of the new function.
9046     * @param {number} [ary] The arity cap of `func`.
9047     * @param {number} [arity] The arity of `func`.
9048     * @returns {Function} Returns the new wrapped function.
9049     */
9050    function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
9051      var isAry = bitmask & WRAP_ARY_FLAG,
9052          isBind = bitmask & WRAP_BIND_FLAG,
9053          isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
9054          isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
9055          isFlip = bitmask & WRAP_FLIP_FLAG,
9056          Ctor = isBindKey ? undefined : createCtor(func);
9057
9058      function wrapper() {
9059        var length = arguments.length,
9060            args = Array(length),
9061            index = length;
9062
9063        while (index--) {
9064          args[index] = arguments[index];
9065        }
9066        if (isCurried) {
9067          var placeholder = getHolder(wrapper),
9068              holdersCount = countHolders(args, placeholder);
9069        }
9070        if (partials) {
9071          args = composeArgs(args, partials, holders, isCurried);
9072        }
9073        if (partialsRight) {
9074          args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
9075        }
9076        length -= holdersCount;
9077        if (isCurried && length < arity) {
9078          var newHolders = replaceHolders(args, placeholder);
9079          return createRecurry(
9080            func, bitmask, createHybrid, wrapper.placeholder, thisArg,
9081            args, newHolders, argPos, ary, arity - length
9082          );
9083        }
9084        var thisBinding = isBind ? thisArg : this,
9085            fn = isBindKey ? thisBinding[func] : func;
9086
9087        length = args.length;
9088        if (argPos) {
9089          args = reorder(args, argPos);
9090        } else if (isFlip && length > 1) {
9091          args.reverse();
9092        }
9093        if (isAry && ary < length) {
9094          args.length = ary;
9095        }
9096        if (this && this !== root && this instanceof wrapper) {
9097          fn = Ctor || createCtor(fn);
9098        }
9099        return fn.apply(thisBinding, args);
9100      }
9101      return wrapper;
9102    }
9103
9104    /**
9105     * Creates a function like `_.invertBy`.
9106     *
9107     * @private
9108     * @param {Function} setter The function to set accumulator values.
9109     * @param {Function} toIteratee The function to resolve iteratees.
9110     * @returns {Function} Returns the new inverter function.
9111     */
9112    function createInverter(setter, toIteratee) {
9113      return function(object, iteratee) {
9114        return baseInverter(object, setter, toIteratee(iteratee), {});
9115      };
9116    }
9117
9118    /**
9119     * Creates a function that performs a mathematical operation on two values.
9120     *
9121     * @private
9122     * @param {Function} operator The function to perform the operation.
9123     * @param {number} [defaultValue] The value used for `undefined` arguments.
9124     * @returns {Function} Returns the new mathematical operation function.
9125     */
9126    function createMathOperation(operator, defaultValue) {
9127      return function(value, other) {
9128        var result;
9129        if (value === undefined && other === undefined) {
9130          return defaultValue;
9131        }
9132        if (value !== undefined) {
9133          result = value;
9134        }
9135        if (other !== undefined) {
9136          if (result === undefined) {
9137            return other;
9138          }
9139          if (typeof value == 'string' || typeof other == 'string') {
9140            value = baseToString(value);
9141            other = baseToString(other);
9142          } else {
9143            value = baseToNumber(value);
9144            other = baseToNumber(other);
9145          }
9146          result = operator(value, other);
9147        }
9148        return result;
9149      };
9150    }
9151
9152    /**
9153     * Creates a function like `_.over`.
9154     *
9155     * @private
9156     * @param {Function} arrayFunc The function to iterate over iteratees.
9157     * @returns {Function} Returns the new over function.
9158     */
9159    function createOver(arrayFunc) {
9160      return flatRest(function(iteratees) {
9161        iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
9162        return baseRest(function(args) {
9163          var thisArg = this;
9164          return arrayFunc(iteratees, function(iteratee) {
9165            return apply(iteratee, thisArg, args);
9166          });
9167        });
9168      });
9169    }
9170
9171    /**
9172     * Creates the padding for `string` based on `length`. The `chars` string
9173     * is truncated if the number of characters exceeds `length`.
9174     *
9175     * @private
9176     * @param {number} length The padding length.
9177     * @param {string} [chars=' '] The string used as padding.
9178     * @returns {string} Returns the padding for `string`.
9179     */
9180    function createPadding(length, chars) {
9181      chars = chars === undefined ? ' ' : baseToString(chars);
9182
9183      var charsLength = chars.length;
9184      if (charsLength < 2) {
9185        return charsLength ? baseRepeat(chars, length) : chars;
9186      }
9187      var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9188      return hasUnicode(chars)
9189        ? castSlice(stringToArray(result), 0, length).join('')
9190        : result.slice(0, length);
9191    }
9192
9193    /**
9194     * Creates a function that wraps `func` to invoke it with the `this` binding
9195     * of `thisArg` and `partials` prepended to the arguments it receives.
9196     *
9197     * @private
9198     * @param {Function} func The function to wrap.
9199     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
9200     * @param {*} thisArg The `this` binding of `func`.
9201     * @param {Array} partials The arguments to prepend to those provided to
9202     *  the new function.
9203     * @returns {Function} Returns the new wrapped function.
9204     */
9205    function createPartial(func, bitmask, thisArg, partials) {
9206      var isBind = bitmask & WRAP_BIND_FLAG,
9207          Ctor = createCtor(func);
9208
9209      function wrapper() {
9210        var argsIndex = -1,
9211            argsLength = arguments.length,
9212            leftIndex = -1,
9213            leftLength = partials.length,
9214            args = Array(leftLength + argsLength),
9215            fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
9216
9217        while (++leftIndex < leftLength) {
9218          args[leftIndex] = partials[leftIndex];
9219        }
9220        while (argsLength--) {
9221          args[leftIndex++] = arguments[++argsIndex];
9222        }
9223        return apply(fn, isBind ? thisArg : this, args);
9224      }
9225      return wrapper;
9226    }
9227
9228    /**
9229     * Creates a `_.range` or `_.rangeRight` function.
9230     *
9231     * @private
9232     * @param {boolean} [fromRight] Specify iterating from right to left.
9233     * @returns {Function} Returns the new range function.
9234     */
9235    function createRange(fromRight) {
9236      return function(start, end, step) {
9237        if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
9238          end = step = undefined;
9239        }
9240        // Ensure the sign of `-0` is preserved.
9241        start = toFinite(start);
9242        if (end === undefined) {
9243          end = start;
9244          start = 0;
9245        } else {
9246          end = toFinite(end);
9247        }
9248        step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
9249        return baseRange(start, end, step, fromRight);
9250      };
9251    }
9252
9253    /**
9254     * Creates a function that performs a relational operation on two values.
9255     *
9256     * @private
9257     * @param {Function} operator The function to perform the operation.
9258     * @returns {Function} Returns the new relational operation function.
9259     */
9260    function createRelationalOperation(operator) {
9261      return function(value, other) {
9262        if (!(typeof value == 'string' && typeof other == 'string')) {
9263          value = toNumber(value);
9264          other = toNumber(other);
9265        }
9266        return operator(value, other);
9267      };
9268    }
9269
9270    /**
9271     * Creates a function that wraps `func` to continue currying.
9272     *
9273     * @private
9274     * @param {Function} func The function to wrap.
9275     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
9276     * @param {Function} wrapFunc The function to create the `func` wrapper.
9277     * @param {*} placeholder The placeholder value.
9278     * @param {*} [thisArg] The `this` binding of `func`.
9279     * @param {Array} [partials] The arguments to prepend to those provided to
9280     *  the new function.
9281     * @param {Array} [holders] The `partials` placeholder indexes.
9282     * @param {Array} [argPos] The argument positions of the new function.
9283     * @param {number} [ary] The arity cap of `func`.
9284     * @param {number} [arity] The arity of `func`.
9285     * @returns {Function} Returns the new wrapped function.
9286     */
9287    function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
9288      var isCurry = bitmask & WRAP_CURRY_FLAG,
9289          newHolders = isCurry ? holders : undefined,
9290          newHoldersRight = isCurry ? undefined : holders,
9291          newPartials = isCurry ? partials : undefined,
9292          newPartialsRight = isCurry ? undefined : partials;
9293
9294      bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
9295      bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9296
9297      if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9298        bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9299      }
9300      var newData = [
9301        func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
9302        newHoldersRight, argPos, ary, arity
9303      ];
9304
9305      var result = wrapFunc.apply(undefined, newData);
9306      if (isLaziable(func)) {
9307        setData(result, newData);
9308      }
9309      result.placeholder = placeholder;
9310      return setWrapToString(result, func, bitmask);
9311    }
9312
9313    /**
9314     * Creates a function like `_.round`.
9315     *
9316     * @private
9317     * @param {string} methodName The name of the `Math` method to use when rounding.
9318     * @returns {Function} Returns the new round function.
9319     */
9320    function createRound(methodName) {
9321      var func = Math[methodName];
9322      return function(number, precision) {
9323        number = toNumber(number);
9324        precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
9325        if (precision && nativeIsFinite(number)) {
9326          // Shift with exponential notation to avoid floating-point issues.
9327          // See [MDN](https://mdn.io/round#Examples) for more details.
9328          var pair = (toString(number) + 'e').split('e'),
9329              value = func(pair[0] + 'e' + (+pair[1] + precision));
9330
9331          pair = (toString(value) + 'e').split('e');
9332          return +(pair[0] + 'e' + (+pair[1] - precision));
9333        }
9334        return func(number);
9335      };
9336    }
9337
9338    /**
9339     * Creates a set object of `values`.
9340     *
9341     * @private
9342     * @param {Array} values The values to add to the set.
9343     * @returns {Object} Returns the new set.
9344     */
9345    var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
9346      return new Set(values);
9347    };
9348
9349    /**
9350     * Creates a `_.toPairs` or `_.toPairsIn` function.
9351     *
9352     * @private
9353     * @param {Function} keysFunc The function to get the keys of a given object.
9354     * @returns {Function} Returns the new pairs function.
9355     */
9356    function createToPairs(keysFunc) {
9357      return function(object) {
9358        var tag = getTag(object);
9359        if (tag == mapTag) {
9360          return mapToArray(object);
9361        }
9362        if (tag == setTag) {
9363          return setToPairs(object);
9364        }
9365        return baseToPairs(object, keysFunc(object));
9366      };
9367    }
9368
9369    /**
9370     * Creates a function that either curries or invokes `func` with optional
9371     * `this` binding and partially applied arguments.
9372     *
9373     * @private
9374     * @param {Function|string} func The function or method name to wrap.
9375     * @param {number} bitmask The bitmask flags.
9376     *    1 - `_.bind`
9377     *    2 - `_.bindKey`
9378     *    4 - `_.curry` or `_.curryRight` of a bound function
9379     *    8 - `_.curry`
9380     *   16 - `_.curryRight`
9381     *   32 - `_.partial`
9382     *   64 - `_.partialRight`
9383     *  128 - `_.rearg`
9384     *  256 - `_.ary`
9385     *  512 - `_.flip`
9386     * @param {*} [thisArg] The `this` binding of `func`.
9387     * @param {Array} [partials] The arguments to be partially applied.
9388     * @param {Array} [holders] The `partials` placeholder indexes.
9389     * @param {Array} [argPos] The argument positions of the new function.
9390     * @param {number} [ary] The arity cap of `func`.
9391     * @param {number} [arity] The arity of `func`.
9392     * @returns {Function} Returns the new wrapped function.
9393     */
9394    function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
9395      var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9396      if (!isBindKey && typeof func != 'function') {
9397        throw new TypeError(FUNC_ERROR_TEXT);
9398      }
9399      var length = partials ? partials.length : 0;
9400      if (!length) {
9401        bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9402        partials = holders = undefined;
9403      }
9404      ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
9405      arity = arity === undefined ? arity : toInteger(arity);
9406      length -= holders ? holders.length : 0;
9407
9408      if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9409        var partialsRight = partials,
9410            holdersRight = holders;
9411
9412        partials = holders = undefined;
9413      }
9414      var data = isBindKey ? undefined : getData(func);
9415
9416      var newData = [
9417        func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
9418        argPos, ary, arity
9419      ];
9420
9421      if (data) {
9422        mergeData(newData, data);
9423      }
9424      func = newData[0];
9425      bitmask = newData[1];
9426      thisArg = newData[2];
9427      partials = newData[3];
9428      holders = newData[4];
9429      arity = newData[9] = newData[9] === undefined
9430        ? (isBindKey ? 0 : func.length)
9431        : nativeMax(newData[9] - length, 0);
9432
9433      if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9434        bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9435      }
9436      if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9437        var result = createBind(func, bitmask, thisArg);
9438      } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9439        result = createCurry(func, bitmask, arity);
9440      } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9441        result = createPartial(func, bitmask, thisArg, partials);
9442      } else {
9443        result = createHybrid.apply(undefined, newData);
9444      }
9445      var setter = data ? baseSetData : setData;
9446      return setWrapToString(setter(result, newData), func, bitmask);
9447    }
9448
9449    /**
9450     * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
9451     * of source objects to the destination object for all destination properties
9452     * that resolve to `undefined`.
9453     *
9454     * @private
9455     * @param {*} objValue The destination value.
9456     * @param {*} srcValue The source value.
9457     * @param {string} key The key of the property to assign.
9458     * @param {Object} object The parent object of `objValue`.
9459     * @returns {*} Returns the value to assign.
9460     */
9461    function customDefaultsAssignIn(objValue, srcValue, key, object) {
9462      if (objValue === undefined ||
9463          (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
9464        return srcValue;
9465      }
9466      return objValue;
9467    }
9468
9469    /**
9470     * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
9471     * objects into destination objects that are passed thru.
9472     *
9473     * @private
9474     * @param {*} objValue The destination value.
9475     * @param {*} srcValue The source value.
9476     * @param {string} key The key of the property to merge.
9477     * @param {Object} object The parent object of `objValue`.
9478     * @param {Object} source The parent object of `srcValue`.
9479     * @param {Object} [stack] Tracks traversed source values and their merged
9480     *  counterparts.
9481     * @returns {*} Returns the value to assign.
9482     */
9483    function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9484      if (isObject(objValue) && isObject(srcValue)) {
9485        // Recursively merge objects and arrays (susceptible to call stack limits).
9486        stack.set(srcValue, objValue);
9487        baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
9488        stack['delete'](srcValue);
9489      }
9490      return objValue;
9491    }
9492
9493    /**
9494     * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
9495     * objects.
9496     *
9497     * @private
9498     * @param {*} value The value to inspect.
9499     * @param {string} key The key of the property to inspect.
9500     * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
9501     */
9502    function customOmitClone(value) {
9503      return isPlainObject(value) ? undefined : value;
9504    }
9505
9506    /**
9507     * A specialized version of `baseIsEqualDeep` for arrays with support for
9508     * partial deep comparisons.
9509     *
9510     * @private
9511     * @param {Array} array The array to compare.
9512     * @param {Array} other The other array to compare.
9513     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
9514     * @param {Function} customizer The function to customize comparisons.
9515     * @param {Function} equalFunc The function to determine equivalents of values.
9516     * @param {Object} stack Tracks traversed `array` and `other` objects.
9517     * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
9518     */
9519    function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
9520      var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
9521          arrLength = array.length,
9522          othLength = other.length;
9523
9524      if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9525        return false;
9526      }
9527      // Check that cyclic values are equal.
9528      var arrStacked = stack.get(array);
9529      var othStacked = stack.get(other);
9530      if (arrStacked && othStacked) {
9531        return arrStacked == other && othStacked == array;
9532      }
9533      var index = -1,
9534          result = true,
9535          seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
9536
9537      stack.set(array, other);
9538      stack.set(other, array);
9539
9540      // Ignore non-index properties.
9541      while (++index < arrLength) {
9542        var arrValue = array[index],
9543            othValue = other[index];
9544
9545        if (customizer) {
9546          var compared = isPartial
9547            ? customizer(othValue, arrValue, index, other, array, stack)
9548            : customizer(arrValue, othValue, index, array, other, stack);
9549        }
9550        if (compared !== undefined) {
9551          if (compared) {
9552            continue;
9553          }
9554          result = false;
9555          break;
9556        }
9557        // Recursively compare arrays (susceptible to call stack limits).
9558        if (seen) {
9559          if (!arraySome(other, function(othValue, othIndex) {
9560                if (!cacheHas(seen, othIndex) &&
9561                    (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9562                  return seen.push(othIndex);
9563                }
9564              })) {
9565            result = false;
9566            break;
9567          }
9568        } else if (!(
9569              arrValue === othValue ||
9570                equalFunc(arrValue, othValue, bitmask, customizer, stack)
9571            )) {
9572          result = false;
9573          break;
9574        }
9575      }
9576      stack['delete'](array);
9577      stack['delete'](other);
9578      return result;
9579    }
9580
9581    /**
9582     * A specialized version of `baseIsEqualDeep` for comparing objects of
9583     * the same `toStringTag`.
9584     *
9585     * **Note:** This function only supports comparing values with tags of
9586     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
9587     *
9588     * @private
9589     * @param {Object} object The object to compare.
9590     * @param {Object} other The other object to compare.
9591     * @param {string} tag The `toStringTag` of the objects to compare.
9592     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
9593     * @param {Function} customizer The function to customize comparisons.
9594     * @param {Function} equalFunc The function to determine equivalents of values.
9595     * @param {Object} stack Tracks traversed `object` and `other` objects.
9596     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
9597     */
9598    function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
9599      switch (tag) {
9600        case dataViewTag:
9601          if ((object.byteLength != other.byteLength) ||
9602              (object.byteOffset != other.byteOffset)) {
9603            return false;
9604          }
9605          object = object.buffer;
9606          other = other.buffer;
9607
9608        case arrayBufferTag:
9609          if ((object.byteLength != other.byteLength) ||
9610              !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
9611            return false;
9612          }
9613          return true;
9614
9615        case boolTag:
9616        case dateTag:
9617        case numberTag:
9618          // Coerce booleans to `1` or `0` and dates to milliseconds.
9619          // Invalid dates are coerced to `NaN`.
9620          return eq(+object, +other);
9621
9622        case errorTag:
9623          return object.name == other.name && object.message == other.message;
9624
9625        case regexpTag:
9626        case stringTag:
9627          // Coerce regexes to strings and treat strings, primitives and objects,
9628          // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
9629          // for more details.
9630          return object == (other + '');
9631
9632        case mapTag:
9633          var convert = mapToArray;
9634
9635        case setTag:
9636          var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
9637          convert || (convert = setToArray);
9638
9639          if (object.size != other.size && !isPartial) {
9640            return false;
9641          }
9642          // Assume cyclic values are equal.
9643          var stacked = stack.get(object);
9644          if (stacked) {
9645            return stacked == other;
9646          }
9647          bitmask |= COMPARE_UNORDERED_FLAG;
9648
9649          // Recursively compare objects (susceptible to call stack limits).
9650          stack.set(object, other);
9651          var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9652          stack['delete'](object);
9653          return result;
9654
9655        case symbolTag:
9656          if (symbolValueOf) {
9657            return symbolValueOf.call(object) == symbolValueOf.call(other);
9658          }
9659      }
9660      return false;
9661    }
9662
9663    /**
9664     * A specialized version of `baseIsEqualDeep` for objects with support for
9665     * partial deep comparisons.
9666     *
9667     * @private
9668     * @param {Object} object The object to compare.
9669     * @param {Object} other The other object to compare.
9670     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
9671     * @param {Function} customizer The function to customize comparisons.
9672     * @param {Function} equalFunc The function to determine equivalents of values.
9673     * @param {Object} stack Tracks traversed `object` and `other` objects.
9674     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
9675     */
9676    function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
9677      var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
9678          objProps = getAllKeys(object),
9679          objLength = objProps.length,
9680          othProps = getAllKeys(other),
9681          othLength = othProps.length;
9682
9683      if (objLength != othLength && !isPartial) {
9684        return false;
9685      }
9686      var index = objLength;
9687      while (index--) {
9688        var key = objProps[index];
9689        if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
9690          return false;
9691        }
9692      }
9693      // Check that cyclic values are equal.
9694      var objStacked = stack.get(object);
9695      var othStacked = stack.get(other);
9696      if (objStacked && othStacked) {
9697        return objStacked == other && othStacked == object;
9698      }
9699      var result = true;
9700      stack.set(object, other);
9701      stack.set(other, object);
9702
9703      var skipCtor = isPartial;
9704      while (++index < objLength) {
9705        key = objProps[index];
9706        var objValue = object[key],
9707            othValue = other[key];
9708
9709        if (customizer) {
9710          var compared = isPartial
9711            ? customizer(othValue, objValue, key, other, object, stack)
9712            : customizer(objValue, othValue, key, object, other, stack);
9713        }
9714        // Recursively compare objects (susceptible to call stack limits).
9715        if (!(compared === undefined
9716              ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
9717              : compared
9718            )) {
9719          result = false;
9720          break;
9721        }
9722        skipCtor || (skipCtor = key == 'constructor');
9723      }
9724      if (result && !skipCtor) {
9725        var objCtor = object.constructor,
9726            othCtor = other.constructor;
9727
9728        // Non `Object` object instances with different constructors are not equal.
9729        if (objCtor != othCtor &&
9730            ('constructor' in object && 'constructor' in other) &&
9731            !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
9732              typeof othCtor == 'function' && othCtor instanceof othCtor)) {
9733          result = false;
9734        }
9735      }
9736      stack['delete'](object);
9737      stack['delete'](other);
9738      return result;
9739    }
9740
9741    /**
9742     * A specialized version of `baseRest` which flattens the rest array.
9743     *
9744     * @private
9745     * @param {Function} func The function to apply a rest parameter to.
9746     * @returns {Function} Returns the new function.
9747     */
9748    function flatRest(func) {
9749      return setToString(overRest(func, undefined, flatten), func + '');
9750    }
9751
9752    /**
9753     * Creates an array of own enumerable property names and symbols of `object`.
9754     *
9755     * @private
9756     * @param {Object} object The object to query.
9757     * @returns {Array} Returns the array of property names and symbols.
9758     */
9759    function getAllKeys(object) {
9760      return baseGetAllKeys(object, keys, getSymbols);
9761    }
9762
9763    /**
9764     * Creates an array of own and inherited enumerable property names and
9765     * symbols of `object`.
9766     *
9767     * @private
9768     * @param {Object} object The object to query.
9769     * @returns {Array} Returns the array of property names and symbols.
9770     */
9771    function getAllKeysIn(object) {
9772      return baseGetAllKeys(object, keysIn, getSymbolsIn);
9773    }
9774
9775    /**
9776     * Gets metadata for `func`.
9777     *
9778     * @private
9779     * @param {Function} func The function to query.
9780     * @returns {*} Returns the metadata for `func`.
9781     */
9782    var getData = !metaMap ? noop : function(func) {
9783      return metaMap.get(func);
9784    };
9785
9786    /**
9787     * Gets the name of `func`.
9788     *
9789     * @private
9790     * @param {Function} func The function to query.
9791     * @returns {string} Returns the function name.
9792     */
9793    function getFuncName(func) {
9794      var result = (func.name + ''),
9795          array = realNames[result],
9796          length = hasOwnProperty.call(realNames, result) ? array.length : 0;
9797
9798      while (length--) {
9799        var data = array[length],
9800            otherFunc = data.func;
9801        if (otherFunc == null || otherFunc == func) {
9802          return data.name;
9803        }
9804      }
9805      return result;
9806    }
9807
9808    /**
9809     * Gets the argument placeholder value for `func`.
9810     *
9811     * @private
9812     * @param {Function} func The function to inspect.
9813     * @returns {*} Returns the placeholder value.
9814     */
9815    function getHolder(func) {
9816      var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
9817      return object.placeholder;
9818    }
9819
9820    /**
9821     * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
9822     * this function returns the custom method, otherwise it returns `baseIteratee`.
9823     * If arguments are provided, the chosen function is invoked with them and
9824     * its result is returned.
9825     *
9826     * @private
9827     * @param {*} [value] The value to convert to an iteratee.
9828     * @param {number} [arity] The arity of the created iteratee.
9829     * @returns {Function} Returns the chosen function or its result.
9830     */
9831    function getIteratee() {
9832      var result = lodash.iteratee || iteratee;
9833      result = result === iteratee ? baseIteratee : result;
9834      return arguments.length ? result(arguments[0], arguments[1]) : result;
9835    }
9836
9837    /**
9838     * Gets the data for `map`.
9839     *
9840     * @private
9841     * @param {Object} map The map to query.
9842     * @param {string} key The reference key.
9843     * @returns {*} Returns the map data.
9844     */
9845    function getMapData(map, key) {
9846      var data = map.__data__;
9847      return isKeyable(key)
9848        ? data[typeof key == 'string' ? 'string' : 'hash']
9849        : data.map;
9850    }
9851
9852    /**
9853     * Gets the property names, values, and compare flags of `object`.
9854     *
9855     * @private
9856     * @param {Object} object The object to query.
9857     * @returns {Array} Returns the match data of `object`.
9858     */
9859    function getMatchData(object) {
9860      var result = keys(object),
9861          length = result.length;
9862
9863      while (length--) {
9864        var key = result[length],
9865            value = object[key];
9866
9867        result[length] = [key, value, isStrictComparable(value)];
9868      }
9869      return result;
9870    }
9871
9872    /**
9873     * Gets the native function at `key` of `object`.
9874     *
9875     * @private
9876     * @param {Object} object The object to query.
9877     * @param {string} key The key of the method to get.
9878     * @returns {*} Returns the function if it's native, else `undefined`.
9879     */
9880    function getNative(object, key) {
9881      var value = getValue(object, key);
9882      return baseIsNative(value) ? value : undefined;
9883    }
9884
9885    /**
9886     * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
9887     *
9888     * @private
9889     * @param {*} value The value to query.
9890     * @returns {string} Returns the raw `toStringTag`.
9891     */
9892    function getRawTag(value) {
9893      var isOwn = hasOwnProperty.call(value, symToStringTag),
9894          tag = value[symToStringTag];
9895
9896      try {
9897        value[symToStringTag] = undefined;
9898        var unmasked = true;
9899      } catch (e) {}
9900
9901      var result = nativeObjectToString.call(value);
9902      if (unmasked) {
9903        if (isOwn) {
9904          value[symToStringTag] = tag;
9905        } else {
9906          delete value[symToStringTag];
9907        }
9908      }
9909      return result;
9910    }
9911
9912    /**
9913     * Creates an array of the own enumerable symbols of `object`.
9914     *
9915     * @private
9916     * @param {Object} object The object to query.
9917     * @returns {Array} Returns the array of symbols.
9918     */
9919    var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
9920      if (object == null) {
9921        return [];
9922      }
9923      object = Object(object);
9924      return arrayFilter(nativeGetSymbols(object), function(symbol) {
9925        return propertyIsEnumerable.call(object, symbol);
9926      });
9927    };
9928
9929    /**
9930     * Creates an array of the own and inherited enumerable symbols of `object`.
9931     *
9932     * @private
9933     * @param {Object} object The object to query.
9934     * @returns {Array} Returns the array of symbols.
9935     */
9936    var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
9937      var result = [];
9938      while (object) {
9939        arrayPush(result, getSymbols(object));
9940        object = getPrototype(object);
9941      }
9942      return result;
9943    };
9944
9945    /**
9946     * Gets the `toStringTag` of `value`.
9947     *
9948     * @private
9949     * @param {*} value The value to query.
9950     * @returns {string} Returns the `toStringTag`.
9951     */
9952    var getTag = baseGetTag;
9953
9954    // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
9955    if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
9956        (Map && getTag(new Map) != mapTag) ||
9957        (Promise && getTag(Promise.resolve()) != promiseTag) ||
9958        (Set && getTag(new Set) != setTag) ||
9959        (WeakMap && getTag(new WeakMap) != weakMapTag)) {
9960      getTag = function(value) {
9961        var result = baseGetTag(value),
9962            Ctor = result == objectTag ? value.constructor : undefined,
9963            ctorString = Ctor ? toSource(Ctor) : '';
9964
9965        if (ctorString) {
9966          switch (ctorString) {
9967            case dataViewCtorString: return dataViewTag;
9968            case mapCtorString: return mapTag;
9969            case promiseCtorString: return promiseTag;
9970            case setCtorString: return setTag;
9971            case weakMapCtorString: return weakMapTag;
9972          }
9973        }
9974        return result;
9975      };
9976    }
9977
9978    /**
9979     * Gets the view, applying any `transforms` to the `start` and `end` positions.
9980     *
9981     * @private
9982     * @param {number} start The start of the view.
9983     * @param {number} end The end of the view.
9984     * @param {Array} transforms The transformations to apply to the view.
9985     * @returns {Object} Returns an object containing the `start` and `end`
9986     *  positions of the view.
9987     */
9988    function getView(start, end, transforms) {
9989      var index = -1,
9990          length = transforms.length;
9991
9992      while (++index < length) {
9993        var data = transforms[index],
9994            size = data.size;
9995
9996        switch (data.type) {
9997          case 'drop':      start += size; break;
9998          case 'dropRight': end -= size; break;
9999          case 'take':      end = nativeMin(end, start + size); break;
10000          case 'takeRight': start = nativeMax(start, end - size); break;
10001        }
10002      }
10003      return { 'start': start, 'end': end };
10004    }
10005
10006    /**
10007     * Extracts wrapper details from the `source` body comment.
10008     *
10009     * @private
10010     * @param {string} source The source to inspect.
10011     * @returns {Array} Returns the wrapper details.
10012     */
10013    function getWrapDetails(source) {
10014      var match = source.match(reWrapDetails);
10015      return match ? match[1].split(reSplitDetails) : [];
10016    }
10017
10018    /**
10019     * Checks if `path` exists on `object`.
10020     *
10021     * @private
10022     * @param {Object} object The object to query.
10023     * @param {Array|string} path The path to check.
10024     * @param {Function} hasFunc The function to check properties.
10025     * @returns {boolean} Returns `true` if `path` exists, else `false`.
10026     */
10027    function hasPath(object, path, hasFunc) {
10028      path = castPath(path, object);
10029
10030      var index = -1,
10031          length = path.length,
10032          result = false;
10033
10034      while (++index < length) {
10035        var key = toKey(path[index]);
10036        if (!(result = object != null && hasFunc(object, key))) {
10037          break;
10038        }
10039        object = object[key];
10040      }
10041      if (result || ++index != length) {
10042        return result;
10043      }
10044      length = object == null ? 0 : object.length;
10045      return !!length && isLength(length) && isIndex(key, length) &&
10046        (isArray(object) || isArguments(object));
10047    }
10048
10049    /**
10050     * Initializes an array clone.
10051     *
10052     * @private
10053     * @param {Array} array The array to clone.
10054     * @returns {Array} Returns the initialized clone.
10055     */
10056    function initCloneArray(array) {
10057      var length = array.length,
10058          result = new array.constructor(length);
10059
10060      // Add properties assigned by `RegExp#exec`.
10061      if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
10062        result.index = array.index;
10063        result.input = array.input;
10064      }
10065      return result;
10066    }
10067
10068    /**
10069     * Initializes an object clone.
10070     *
10071     * @private
10072     * @param {Object} object The object to clone.
10073     * @returns {Object} Returns the initialized clone.
10074     */
10075    function initCloneObject(object) {
10076      return (typeof object.constructor == 'function' && !isPrototype(object))
10077        ? baseCreate(getPrototype(object))
10078        : {};
10079    }
10080
10081    /**
10082     * Initializes an object clone based on its `toStringTag`.
10083     *
10084     * **Note:** This function only supports cloning values with tags of
10085     * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
10086     *
10087     * @private
10088     * @param {Object} object The object to clone.
10089     * @param {string} tag The `toStringTag` of the object to clone.
10090     * @param {boolean} [isDeep] Specify a deep clone.
10091     * @returns {Object} Returns the initialized clone.
10092     */
10093    function initCloneByTag(object, tag, isDeep) {
10094      var Ctor = object.constructor;
10095      switch (tag) {
10096        case arrayBufferTag:
10097          return cloneArrayBuffer(object);
10098
10099        case boolTag:
10100        case dateTag:
10101          return new Ctor(+object);
10102
10103        case dataViewTag:
10104          return cloneDataView(object, isDeep);
10105
10106        case float32Tag: case float64Tag:
10107        case int8Tag: case int16Tag: case int32Tag:
10108        case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
10109          return cloneTypedArray(object, isDeep);
10110
10111        case mapTag:
10112          return new Ctor;
10113
10114        case numberTag:
10115        case stringTag:
10116          return new Ctor(object);
10117
10118        case regexpTag:
10119          return cloneRegExp(object);
10120
10121        case setTag:
10122          return new Ctor;
10123
10124        case symbolTag:
10125          return cloneSymbol(object);
10126      }
10127    }
10128
10129    /**
10130     * Inserts wrapper `details` in a comment at the top of the `source` body.
10131     *
10132     * @private
10133     * @param {string} source The source to modify.
10134     * @returns {Array} details The details to insert.
10135     * @returns {string} Returns the modified source.
10136     */
10137    function insertWrapDetails(source, details) {
10138      var length = details.length;
10139      if (!length) {
10140        return source;
10141      }
10142      var lastIndex = length - 1;
10143      details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
10144      details = details.join(length > 2 ? ', ' : ' ');
10145      return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
10146    }
10147
10148    /**
10149     * Checks if `value` is a flattenable `arguments` object or array.
10150     *
10151     * @private
10152     * @param {*} value The value to check.
10153     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
10154     */
10155    function isFlattenable(value) {
10156      return isArray(value) || isArguments(value) ||
10157        !!(spreadableSymbol && value && value[spreadableSymbol]);
10158    }
10159
10160    /**
10161     * Checks if `value` is a valid array-like index.
10162     *
10163     * @private
10164     * @param {*} value The value to check.
10165     * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
10166     * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
10167     */
10168    function isIndex(value, length) {
10169      var type = typeof value;
10170      length = length == null ? MAX_SAFE_INTEGER : length;
10171
10172      return !!length &&
10173        (type == 'number' ||
10174          (type != 'symbol' && reIsUint.test(value))) &&
10175            (value > -1 && value % 1 == 0 && value < length);
10176    }
10177
10178    /**
10179     * Checks if the given arguments are from an iteratee call.
10180     *
10181     * @private
10182     * @param {*} value The potential iteratee value argument.
10183     * @param {*} index The potential iteratee index or key argument.
10184     * @param {*} object The potential iteratee object argument.
10185     * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
10186     *  else `false`.
10187     */
10188    function isIterateeCall(value, index, object) {
10189      if (!isObject(object)) {
10190        return false;
10191      }
10192      var type = typeof index;
10193      if (type == 'number'
10194            ? (isArrayLike(object) && isIndex(index, object.length))
10195            : (type == 'string' && index in object)
10196          ) {
10197        return eq(object[index], value);
10198      }
10199      return false;
10200    }
10201
10202    /**
10203     * Checks if `value` is a property name and not a property path.
10204     *
10205     * @private
10206     * @param {*} value The value to check.
10207     * @param {Object} [object] The object to query keys on.
10208     * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
10209     */
10210    function isKey(value, object) {
10211      if (isArray(value)) {
10212        return false;
10213      }
10214      var type = typeof value;
10215      if (type == 'number' || type == 'symbol' || type == 'boolean' ||
10216          value == null || isSymbol(value)) {
10217        return true;
10218      }
10219      return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
10220        (object != null && value in Object(object));
10221    }
10222
10223    /**
10224     * Checks if `value` is suitable for use as unique object key.
10225     *
10226     * @private
10227     * @param {*} value The value to check.
10228     * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
10229     */
10230    function isKeyable(value) {
10231      var type = typeof value;
10232      return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
10233        ? (value !== '__proto__')
10234        : (value === null);
10235    }
10236
10237    /**
10238     * Checks if `func` has a lazy counterpart.
10239     *
10240     * @private
10241     * @param {Function} func The function to check.
10242     * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
10243     *  else `false`.
10244     */
10245    function isLaziable(func) {
10246      var funcName = getFuncName(func),
10247          other = lodash[funcName];
10248
10249      if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
10250        return false;
10251      }
10252      if (func === other) {
10253        return true;
10254      }
10255      var data = getData(other);
10256      return !!data && func === data[0];
10257    }
10258
10259    /**
10260     * Checks if `func` has its source masked.
10261     *
10262     * @private
10263     * @param {Function} func The function to check.
10264     * @returns {boolean} Returns `true` if `func` is masked, else `false`.
10265     */
10266    function isMasked(func) {
10267      return !!maskSrcKey && (maskSrcKey in func);
10268    }
10269
10270    /**
10271     * Checks if `func` is capable of being masked.
10272     *
10273     * @private
10274     * @param {*} value The value to check.
10275     * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
10276     */
10277    var isMaskable = coreJsData ? isFunction : stubFalse;
10278
10279    /**
10280     * Checks if `value` is likely a prototype object.
10281     *
10282     * @private
10283     * @param {*} value The value to check.
10284     * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
10285     */
10286    function isPrototype(value) {
10287      var Ctor = value && value.constructor,
10288          proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
10289
10290      return value === proto;
10291    }
10292
10293    /**
10294     * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
10295     *
10296     * @private
10297     * @param {*} value The value to check.
10298     * @returns {boolean} Returns `true` if `value` if suitable for strict
10299     *  equality comparisons, else `false`.
10300     */
10301    function isStrictComparable(value) {
10302      return value === value && !isObject(value);
10303    }
10304
10305    /**
10306     * A specialized version of `matchesProperty` for source values suitable
10307     * for strict equality comparisons, i.e. `===`.
10308     *
10309     * @private
10310     * @param {string} key The key of the property to get.
10311     * @param {*} srcValue The value to match.
10312     * @returns {Function} Returns the new spec function.
10313     */
10314    function matchesStrictComparable(key, srcValue) {
10315      return function(object) {
10316        if (object == null) {
10317          return false;
10318        }
10319        return object[key] === srcValue &&
10320          (srcValue !== undefined || (key in Object(object)));
10321      };
10322    }
10323
10324    /**
10325     * A specialized version of `_.memoize` which clears the memoized function's
10326     * cache when it exceeds `MAX_MEMOIZE_SIZE`.
10327     *
10328     * @private
10329     * @param {Function} func The function to have its output memoized.
10330     * @returns {Function} Returns the new memoized function.
10331     */
10332    function memoizeCapped(func) {
10333      var result = memoize(func, function(key) {
10334        if (cache.size === MAX_MEMOIZE_SIZE) {
10335          cache.clear();
10336        }
10337        return key;
10338      });
10339
10340      var cache = result.cache;
10341      return result;
10342    }
10343
10344    /**
10345     * Merges the function metadata of `source` into `data`.
10346     *
10347     * Merging metadata reduces the number of wrappers used to invoke a function.
10348     * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
10349     * may be applied regardless of execution order. Methods like `_.ary` and
10350     * `_.rearg` modify function arguments, making the order in which they are
10351     * executed important, preventing the merging of metadata. However, we make
10352     * an exception for a safe combined case where curried functions have `_.ary`
10353     * and or `_.rearg` applied.
10354     *
10355     * @private
10356     * @param {Array} data The destination metadata.
10357     * @param {Array} source The source metadata.
10358     * @returns {Array} Returns `data`.
10359     */
10360    function mergeData(data, source) {
10361      var bitmask = data[1],
10362          srcBitmask = source[1],
10363          newBitmask = bitmask | srcBitmask,
10364          isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
10365
10366      var isCombo =
10367        ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
10368        ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
10369        ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
10370
10371      // Exit early if metadata can't be merged.
10372      if (!(isCommon || isCombo)) {
10373        return data;
10374      }
10375      // Use source `thisArg` if available.
10376      if (srcBitmask & WRAP_BIND_FLAG) {
10377        data[2] = source[2];
10378        // Set when currying a bound function.
10379        newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
10380      }
10381      // Compose partial arguments.
10382      var value = source[3];
10383      if (value) {
10384        var partials = data[3];
10385        data[3] = partials ? composeArgs(partials, value, source[4]) : value;
10386        data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
10387      }
10388      // Compose partial right arguments.
10389      value = source[5];
10390      if (value) {
10391        partials = data[5];
10392        data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
10393        data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
10394      }
10395      // Use source `argPos` if available.
10396      value = source[7];
10397      if (value) {
10398        data[7] = value;
10399      }
10400      // Use source `ary` if it's smaller.
10401      if (srcBitmask & WRAP_ARY_FLAG) {
10402        data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
10403      }
10404      // Use source `arity` if one is not provided.
10405      if (data[9] == null) {
10406        data[9] = source[9];
10407      }
10408      // Use source `func` and merge bitmasks.
10409      data[0] = source[0];
10410      data[1] = newBitmask;
10411
10412      return data;
10413    }
10414
10415    /**
10416     * This function is like
10417     * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
10418     * except that it includes inherited enumerable properties.
10419     *
10420     * @private
10421     * @param {Object} object The object to query.
10422     * @returns {Array} Returns the array of property names.
10423     */
10424    function nativeKeysIn(object) {
10425      var result = [];
10426      if (object != null) {
10427        for (var key in Object(object)) {
10428          result.push(key);
10429        }
10430      }
10431      return result;
10432    }
10433
10434    /**
10435     * Converts `value` to a string using `Object.prototype.toString`.
10436     *
10437     * @private
10438     * @param {*} value The value to convert.
10439     * @returns {string} Returns the converted string.
10440     */
10441    function objectToString(value) {
10442      return nativeObjectToString.call(value);
10443    }
10444
10445    /**
10446     * A specialized version of `baseRest` which transforms the rest array.
10447     *
10448     * @private
10449     * @param {Function} func The function to apply a rest parameter to.
10450     * @param {number} [start=func.length-1] The start position of the rest parameter.
10451     * @param {Function} transform The rest array transform.
10452     * @returns {Function} Returns the new function.
10453     */
10454    function overRest(func, start, transform) {
10455      start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
10456      return function() {
10457        var args = arguments,
10458            index = -1,
10459            length = nativeMax(args.length - start, 0),
10460            array = Array(length);
10461
10462        while (++index < length) {
10463          array[index] = args[start + index];
10464        }
10465        index = -1;
10466        var otherArgs = Array(start + 1);
10467        while (++index < start) {
10468          otherArgs[index] = args[index];
10469        }
10470        otherArgs[start] = transform(array);
10471        return apply(func, this, otherArgs);
10472      };
10473    }
10474
10475    /**
10476     * Gets the parent value at `path` of `object`.
10477     *
10478     * @private
10479     * @param {Object} object The object to query.
10480     * @param {Array} path The path to get the parent value of.
10481     * @returns {*} Returns the parent value.
10482     */
10483    function parent(object, path) {
10484      return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
10485    }
10486
10487    /**
10488     * Reorder `array` according to the specified indexes where the element at
10489     * the first index is assigned as the first element, the element at
10490     * the second index is assigned as the second element, and so on.
10491     *
10492     * @private
10493     * @param {Array} array The array to reorder.
10494     * @param {Array} indexes The arranged array indexes.
10495     * @returns {Array} Returns `array`.
10496     */
10497    function reorder(array, indexes) {
10498      var arrLength = array.length,
10499          length = nativeMin(indexes.length, arrLength),
10500          oldArray = copyArray(array);
10501
10502      while (length--) {
10503        var index = indexes[length];
10504        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
10505      }
10506      return array;
10507    }
10508
10509    /**
10510     * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
10511     *
10512     * @private
10513     * @param {Object} object The object to query.
10514     * @param {string} key The key of the property to get.
10515     * @returns {*} Returns the property value.
10516     */
10517    function safeGet(object, key) {
10518      if (key === 'constructor' && typeof object[key] === 'function') {
10519        return;
10520      }
10521
10522      if (key == '__proto__') {
10523        return;
10524      }
10525
10526      return object[key];
10527    }
10528
10529    /**
10530     * Sets metadata for `func`.
10531     *
10532     * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
10533     * period of time, it will trip its breaker and transition to an identity
10534     * function to avoid garbage collection pauses in V8. See
10535     * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
10536     * for more details.
10537     *
10538     * @private
10539     * @param {Function} func The function to associate metadata with.
10540     * @param {*} data The metadata.
10541     * @returns {Function} Returns `func`.
10542     */
10543    var setData = shortOut(baseSetData);
10544
10545    /**
10546     * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
10547     *
10548     * @private
10549     * @param {Function} func The function to delay.
10550     * @param {number} wait The number of milliseconds to delay invocation.
10551     * @returns {number|Object} Returns the timer id or timeout object.
10552     */
10553    var setTimeout = ctxSetTimeout || function(func, wait) {
10554      return root.setTimeout(func, wait);
10555    };
10556
10557    /**
10558     * Sets the `toString` method of `func` to return `string`.
10559     *
10560     * @private
10561     * @param {Function} func The function to modify.
10562     * @param {Function} string The `toString` result.
10563     * @returns {Function} Returns `func`.
10564     */
10565    var setToString = shortOut(baseSetToString);
10566
10567    /**
10568     * Sets the `toString` method of `wrapper` to mimic the source of `reference`
10569     * with wrapper details in a comment at the top of the source body.
10570     *
10571     * @private
10572     * @param {Function} wrapper The function to modify.
10573     * @param {Function} reference The reference function.
10574     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
10575     * @returns {Function} Returns `wrapper`.
10576     */
10577    function setWrapToString(wrapper, reference, bitmask) {
10578      var source = (reference + '');
10579      return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
10580    }
10581
10582    /**
10583     * Creates a function that'll short out and invoke `identity` instead
10584     * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
10585     * milliseconds.
10586     *
10587     * @private
10588     * @param {Function} func The function to restrict.
10589     * @returns {Function} Returns the new shortable function.
10590     */
10591    function shortOut(func) {
10592      var count = 0,
10593          lastCalled = 0;
10594
10595      return function() {
10596        var stamp = nativeNow(),
10597            remaining = HOT_SPAN - (stamp - lastCalled);
10598
10599        lastCalled = stamp;
10600        if (remaining > 0) {
10601          if (++count >= HOT_COUNT) {
10602            return arguments[0];
10603          }
10604        } else {
10605          count = 0;
10606        }
10607        return func.apply(undefined, arguments);
10608      };
10609    }
10610
10611    /**
10612     * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
10613     *
10614     * @private
10615     * @param {Array} array The array to shuffle.
10616     * @param {number} [size=array.length] The size of `array`.
10617     * @returns {Array} Returns `array`.
10618     */
10619    function shuffleSelf(array, size) {
10620      var index = -1,
10621          length = array.length,
10622          lastIndex = length - 1;
10623
10624      size = size === undefined ? length : size;
10625      while (++index < size) {
10626        var rand = baseRandom(index, lastIndex),
10627            value = array[rand];
10628
10629        array[rand] = array[index];
10630        array[index] = value;
10631      }
10632      array.length = size;
10633      return array;
10634    }
10635
10636    /**
10637     * Converts `string` to a property path array.
10638     *
10639     * @private
10640     * @param {string} string The string to convert.
10641     * @returns {Array} Returns the property path array.
10642     */
10643    var stringToPath = memoizeCapped(function(string) {
10644      var result = [];
10645      if (string.charCodeAt(0) === 46 /* . */) {
10646        result.push('');
10647      }
10648      string.replace(rePropName, function(match, number, quote, subString) {
10649        result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
10650      });
10651      return result;
10652    });
10653
10654    /**
10655     * Converts `value` to a string key if it's not a string or symbol.
10656     *
10657     * @private
10658     * @param {*} value The value to inspect.
10659     * @returns {string|symbol} Returns the key.
10660     */
10661    function toKey(value) {
10662      if (typeof value == 'string' || isSymbol(value)) {
10663        return value;
10664      }
10665      var result = (value + '');
10666      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
10667    }
10668
10669    /**
10670     * Converts `func` to its source code.
10671     *
10672     * @private
10673     * @param {Function} func The function to convert.
10674     * @returns {string} Returns the source code.
10675     */
10676    function toSource(func) {
10677      if (func != null) {
10678        try {
10679          return funcToString.call(func);
10680        } catch (e) {}
10681        try {
10682          return (func + '');
10683        } catch (e) {}
10684      }
10685      return '';
10686    }
10687
10688    /**
10689     * Updates wrapper `details` based on `bitmask` flags.
10690     *
10691     * @private
10692     * @returns {Array} details The details to modify.
10693     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
10694     * @returns {Array} Returns `details`.
10695     */
10696    function updateWrapDetails(details, bitmask) {
10697      arrayEach(wrapFlags, function(pair) {
10698        var value = '_.' + pair[0];
10699        if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
10700          details.push(value);
10701        }
10702      });
10703      return details.sort();
10704    }
10705
10706    /**
10707     * Creates a clone of `wrapper`.
10708     *
10709     * @private
10710     * @param {Object} wrapper The wrapper to clone.
10711     * @returns {Object} Returns the cloned wrapper.
10712     */
10713    function wrapperClone(wrapper) {
10714      if (wrapper instanceof LazyWrapper) {
10715        return wrapper.clone();
10716      }
10717      var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
10718      result.__actions__ = copyArray(wrapper.__actions__);
10719      result.__index__  = wrapper.__index__;
10720      result.__values__ = wrapper.__values__;
10721      return result;
10722    }
10723
10724    /*------------------------------------------------------------------------*/
10725
10726    /**
10727     * Creates an array of elements split into groups the length of `size`.
10728     * If `array` can't be split evenly, the final chunk will be the remaining
10729     * elements.
10730     *
10731     * @static
10732     * @memberOf _
10733     * @since 3.0.0
10734     * @category Array
10735     * @param {Array} array The array to process.
10736     * @param {number} [size=1] The length of each chunk
10737     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10738     * @returns {Array} Returns the new array of chunks.
10739     * @example
10740     *
10741     * _.chunk(['a', 'b', 'c', 'd'], 2);
10742     * // => [['a', 'b'], ['c', 'd']]
10743     *
10744     * _.chunk(['a', 'b', 'c', 'd'], 3);
10745     * // => [['a', 'b', 'c'], ['d']]
10746     */
10747    function chunk(array, size, guard) {
10748      if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
10749        size = 1;
10750      } else {
10751        size = nativeMax(toInteger(size), 0);
10752      }
10753      var length = array == null ? 0 : array.length;
10754      if (!length || size < 1) {
10755        return [];
10756      }
10757      var index = 0,
10758          resIndex = 0,
10759          result = Array(nativeCeil(length / size));
10760
10761      while (index < length) {
10762        result[resIndex++] = baseSlice(array, index, (index += size));
10763      }
10764      return result;
10765    }
10766
10767    /**
10768     * Creates an array with all falsey values removed. The values `false`, `null`,
10769     * `0`, `""`, `undefined`, and `NaN` are falsey.
10770     *
10771     * @static
10772     * @memberOf _
10773     * @since 0.1.0
10774     * @category Array
10775     * @param {Array} array The array to compact.
10776     * @returns {Array} Returns the new array of filtered values.
10777     * @example
10778     *
10779     * _.compact([0, 1, false, 2, '', 3]);
10780     * // => [1, 2, 3]
10781     */
10782    function compact(array) {
10783      var index = -1,
10784          length = array == null ? 0 : array.length,
10785          resIndex = 0,
10786          result = [];
10787
10788      while (++index < length) {
10789        var value = array[index];
10790        if (value) {
10791          result[resIndex++] = value;
10792        }
10793      }
10794      return result;
10795    }
10796
10797    /**
10798     * Creates a new array concatenating `array` with any additional arrays
10799     * and/or values.
10800     *
10801     * @static
10802     * @memberOf _
10803     * @since 4.0.0
10804     * @category Array
10805     * @param {Array} array The array to concatenate.
10806     * @param {...*} [values] The values to concatenate.
10807     * @returns {Array} Returns the new concatenated array.
10808     * @example
10809     *
10810     * var array = [1];
10811     * var other = _.concat(array, 2, [3], [[4]]);
10812     *
10813     * console.log(other);
10814     * // => [1, 2, 3, [4]]
10815     *
10816     * console.log(array);
10817     * // => [1]
10818     */
10819    function concat() {
10820      var length = arguments.length;
10821      if (!length) {
10822        return [];
10823      }
10824      var args = Array(length - 1),
10825          array = arguments[0],
10826          index = length;
10827
10828      while (index--) {
10829        args[index - 1] = arguments[index];
10830      }
10831      return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
10832    }
10833
10834    /**
10835     * Creates an array of `array` values not included in the other given arrays
10836     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
10837     * for equality comparisons. The order and references of result values are
10838     * determined by the first array.
10839     *
10840     * **Note:** Unlike `_.pullAll`, this method returns a new array.
10841     *
10842     * @static
10843     * @memberOf _
10844     * @since 0.1.0
10845     * @category Array
10846     * @param {Array} array The array to inspect.
10847     * @param {...Array} [values] The values to exclude.
10848     * @returns {Array} Returns the new array of filtered values.
10849     * @see _.without, _.xor
10850     * @example
10851     *
10852     * _.difference([2, 1], [2, 3]);
10853     * // => [1]
10854     */
10855    var difference = baseRest(function(array, values) {
10856      return isArrayLikeObject(array)
10857        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
10858        : [];
10859    });
10860
10861    /**
10862     * This method is like `_.difference` except that it accepts `iteratee` which
10863     * is invoked for each element of `array` and `values` to generate the criterion
10864     * by which they're compared. The order and references of result values are
10865     * determined by the first array. The iteratee is invoked with one argument:
10866     * (value).
10867     *
10868     * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
10869     *
10870     * @static
10871     * @memberOf _
10872     * @since 4.0.0
10873     * @category Array
10874     * @param {Array} array The array to inspect.
10875     * @param {...Array} [values] The values to exclude.
10876     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
10877     * @returns {Array} Returns the new array of filtered values.
10878     * @example
10879     *
10880     * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
10881     * // => [1.2]
10882     *
10883     * // The `_.property` iteratee shorthand.
10884     * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
10885     * // => [{ 'x': 2 }]
10886     */
10887    var differenceBy = baseRest(function(array, values) {
10888      var iteratee = last(values);
10889      if (isArrayLikeObject(iteratee)) {
10890        iteratee = undefined;
10891      }
10892      return isArrayLikeObject(array)
10893        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
10894        : [];
10895    });
10896
10897    /**
10898     * This method is like `_.difference` except that it accepts `comparator`
10899     * which is invoked to compare elements of `array` to `values`. The order and
10900     * references of result values are determined by the first array. The comparator
10901     * is invoked with two arguments: (arrVal, othVal).
10902     *
10903     * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
10904     *
10905     * @static
10906     * @memberOf _
10907     * @since 4.0.0
10908     * @category Array
10909     * @param {Array} array The array to inspect.
10910     * @param {...Array} [values] The values to exclude.
10911     * @param {Function} [comparator] The comparator invoked per element.
10912     * @returns {Array} Returns the new array of filtered values.
10913     * @example
10914     *
10915     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
10916     *
10917     * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
10918     * // => [{ 'x': 2, 'y': 1 }]
10919     */
10920    var differenceWith = baseRest(function(array, values) {
10921      var comparator = last(values);
10922      if (isArrayLikeObject(comparator)) {
10923        comparator = undefined;
10924      }
10925      return isArrayLikeObject(array)
10926        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
10927        : [];
10928    });
10929
10930    /**
10931     * Creates a slice of `array` with `n` elements dropped from the beginning.
10932     *
10933     * @static
10934     * @memberOf _
10935     * @since 0.5.0
10936     * @category Array
10937     * @param {Array} array The array to query.
10938     * @param {number} [n=1] The number of elements to drop.
10939     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10940     * @returns {Array} Returns the slice of `array`.
10941     * @example
10942     *
10943     * _.drop([1, 2, 3]);
10944     * // => [2, 3]
10945     *
10946     * _.drop([1, 2, 3], 2);
10947     * // => [3]
10948     *
10949     * _.drop([1, 2, 3], 5);
10950     * // => []
10951     *
10952     * _.drop([1, 2, 3], 0);
10953     * // => [1, 2, 3]
10954     */
10955    function drop(array, n, guard) {
10956      var length = array == null ? 0 : array.length;
10957      if (!length) {
10958        return [];
10959      }
10960      n = (guard || n === undefined) ? 1 : toInteger(n);
10961      return baseSlice(array, n < 0 ? 0 : n, length);
10962    }
10963
10964    /**
10965     * Creates a slice of `array` with `n` elements dropped from the end.
10966     *
10967     * @static
10968     * @memberOf _
10969     * @since 3.0.0
10970     * @category Array
10971     * @param {Array} array The array to query.
10972     * @param {number} [n=1] The number of elements to drop.
10973     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10974     * @returns {Array} Returns the slice of `array`.
10975     * @example
10976     *
10977     * _.dropRight([1, 2, 3]);
10978     * // => [1, 2]
10979     *
10980     * _.dropRight([1, 2, 3], 2);
10981     * // => [1]
10982     *
10983     * _.dropRight([1, 2, 3], 5);
10984     * // => []
10985     *
10986     * _.dropRight([1, 2, 3], 0);
10987     * // => [1, 2, 3]
10988     */
10989    function dropRight(array, n, guard) {
10990      var length = array == null ? 0 : array.length;
10991      if (!length) {
10992        return [];
10993      }
10994      n = (guard || n === undefined) ? 1 : toInteger(n);
10995      n = length - n;
10996      return baseSlice(array, 0, n < 0 ? 0 : n);
10997    }
10998
10999    /**
11000     * Creates a slice of `array` excluding elements dropped from the end.
11001     * Elements are dropped until `predicate` returns falsey. The predicate is
11002     * invoked with three arguments: (value, index, array).
11003     *
11004     * @static
11005     * @memberOf _
11006     * @since 3.0.0
11007     * @category Array
11008     * @param {Array} array The array to query.
11009     * @param {Function} [predicate=_.identity] The function invoked per iteration.
11010     * @returns {Array} Returns the slice of `array`.
11011     * @example
11012     *
11013     * var users = [
11014     *   { 'user': 'barney',  'active': true },
11015     *   { 'user': 'fred',    'active': false },
11016     *   { 'user': 'pebbles', 'active': false }
11017     * ];
11018     *
11019     * _.dropRightWhile(users, function(o) { return !o.active; });
11020     * // => objects for ['barney']
11021     *
11022     * // The `_.matches` iteratee shorthand.
11023     * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
11024     * // => objects for ['barney', 'fred']
11025     *
11026     * // The `_.matchesProperty` iteratee shorthand.
11027     * _.dropRightWhile(users, ['active', false]);
11028     * // => objects for ['barney']
11029     *
11030     * // The `_.property` iteratee shorthand.
11031     * _.dropRightWhile(users, 'active');
11032     * // => objects for ['barney', 'fred', 'pebbles']
11033     */
11034    function dropRightWhile(array, predicate) {
11035      return (array && array.length)
11036        ? baseWhile(array, getIteratee(predicate, 3), true, true)
11037        : [];
11038    }
11039
11040    /**
11041     * Creates a slice of `array` excluding elements dropped from the beginning.
11042     * Elements are dropped until `predicate` returns falsey. The predicate is
11043     * invoked with three arguments: (value, index, array).
11044     *
11045     * @static
11046     * @memberOf _
11047     * @since 3.0.0
11048     * @category Array
11049     * @param {Array} array The array to query.
11050     * @param {Function} [predicate=_.identity] The function invoked per iteration.
11051     * @returns {Array} Returns the slice of `array`.
11052     * @example
11053     *
11054     * var users = [
11055     *   { 'user': 'barney',  'active': false },
11056     *   { 'user': 'fred',    'active': false },
11057     *   { 'user': 'pebbles', 'active': true }
11058     * ];
11059     *
11060     * _.dropWhile(users, function(o) { return !o.active; });
11061     * // => objects for ['pebbles']
11062     *
11063     * // The `_.matches` iteratee shorthand.
11064     * _.dropWhile(users, { 'user': 'barney', 'active': false });
11065     * // => objects for ['fred', 'pebbles']
11066     *
11067     * // The `_.matchesProperty` iteratee shorthand.
11068     * _.dropWhile(users, ['active', false]);
11069     * // => objects for ['pebbles']
11070     *
11071     * // The `_.property` iteratee shorthand.
11072     * _.dropWhile(users, 'active');
11073     * // => objects for ['barney', 'fred', 'pebbles']
11074     */
11075    function dropWhile(array, predicate) {
11076      return (array && array.length)
11077        ? baseWhile(array, getIteratee(predicate, 3), true)
11078        : [];
11079    }
11080
11081    /**
11082     * Fills elements of `array` with `value` from `start` up to, but not
11083     * including, `end`.
11084     *
11085     * **Note:** This method mutates `array`.
11086     *
11087     * @static
11088     * @memberOf _
11089     * @since 3.2.0
11090     * @category Array
11091     * @param {Array} array The array to fill.
11092     * @param {*} value The value to fill `array` with.
11093     * @param {number} [start=0] The start position.
11094     * @param {number} [end=array.length] The end position.
11095     * @returns {Array} Returns `array`.
11096     * @example
11097     *
11098     * var array = [1, 2, 3];
11099     *
11100     * _.fill(array, 'a');
11101     * console.log(array);
11102     * // => ['a', 'a', 'a']
11103     *
11104     * _.fill(Array(3), 2);
11105     * // => [2, 2, 2]
11106     *
11107     * _.fill([4, 6, 8, 10], '*', 1, 3);
11108     * // => [4, '*', '*', 10]
11109     */
11110    function fill(array, value, start, end) {
11111      var length = array == null ? 0 : array.length;
11112      if (!length) {
11113        return [];
11114      }
11115      if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
11116        start = 0;
11117        end = length;
11118      }
11119      return baseFill(array, value, start, end);
11120    }
11121
11122    /**
11123     * This method is like `_.find` except that it returns the index of the first
11124     * element `predicate` returns truthy for instead of the element itself.
11125     *
11126     * @static
11127     * @memberOf _
11128     * @since 1.1.0
11129     * @category Array
11130     * @param {Array} array The array to inspect.
11131     * @param {Function} [predicate=_.identity] The function invoked per iteration.
11132     * @param {number} [fromIndex=0] The index to search from.
11133     * @returns {number} Returns the index of the found element, else `-1`.
11134     * @example
11135     *
11136     * var users = [
11137     *   { 'user': 'barney',  'active': false },
11138     *   { 'user': 'fred',    'active': false },
11139     *   { 'user': 'pebbles', 'active': true }
11140     * ];
11141     *
11142     * _.findIndex(users, function(o) { return o.user == 'barney'; });
11143     * // => 0
11144     *
11145     * // The `_.matches` iteratee shorthand.
11146     * _.findIndex(users, { 'user': 'fred', 'active': false });
11147     * // => 1
11148     *
11149     * // The `_.matchesProperty` iteratee shorthand.
11150     * _.findIndex(users, ['active', false]);
11151     * // => 0
11152     *
11153     * // The `_.property` iteratee shorthand.
11154     * _.findIndex(users, 'active');
11155     * // => 2
11156     */
11157    function findIndex(array, predicate, fromIndex) {
11158      var length = array == null ? 0 : array.length;
11159      if (!length) {
11160        return -1;
11161      }
11162      var index = fromIndex == null ? 0 : toInteger(fromIndex);
11163      if (index < 0) {
11164        index = nativeMax(length + index, 0);
11165      }
11166      return baseFindIndex(array, getIteratee(predicate, 3), index);
11167    }
11168
11169    /**
11170     * This method is like `_.findIndex` except that it iterates over elements
11171     * of `collection` from right to left.
11172     *
11173     * @static
11174     * @memberOf _
11175     * @since 2.0.0
11176     * @category Array
11177     * @param {Array} array The array to inspect.
11178     * @param {Function} [predicate=_.identity] The function invoked per iteration.
11179     * @param {number} [fromIndex=array.length-1] The index to search from.
11180     * @returns {number} Returns the index of the found element, else `-1`.
11181     * @example
11182     *
11183     * var users = [
11184     *   { 'user': 'barney',  'active': true },
11185     *   { 'user': 'fred',    'active': false },
11186     *   { 'user': 'pebbles', 'active': false }
11187     * ];
11188     *
11189     * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
11190     * // => 2
11191     *
11192     * // The `_.matches` iteratee shorthand.
11193     * _.findLastIndex(users, { 'user': 'barney', 'active': true });
11194     * // => 0
11195     *
11196     * // The `_.matchesProperty` iteratee shorthand.
11197     * _.findLastIndex(users, ['active', false]);
11198     * // => 2
11199     *
11200     * // The `_.property` iteratee shorthand.
11201     * _.findLastIndex(users, 'active');
11202     * // => 0
11203     */
11204    function findLastIndex(array, predicate, fromIndex) {
11205      var length = array == null ? 0 : array.length;
11206      if (!length) {
11207        return -1;
11208      }
11209      var index = length - 1;
11210      if (fromIndex !== undefined) {
11211        index = toInteger(fromIndex);
11212        index = fromIndex < 0
11213          ? nativeMax(length + index, 0)
11214          : nativeMin(index, length - 1);
11215      }
11216      return baseFindIndex(array, getIteratee(predicate, 3), index, true);
11217    }
11218
11219    /**
11220     * Flattens `array` a single level deep.
11221     *
11222     * @static
11223     * @memberOf _
11224     * @since 0.1.0
11225     * @category Array
11226     * @param {Array} array The array to flatten.
11227     * @returns {Array} Returns the new flattened array.
11228     * @example
11229     *
11230     * _.flatten([1, [2, [3, [4]], 5]]);
11231     * // => [1, 2, [3, [4]], 5]
11232     */
11233    function flatten(array) {
11234      var length = array == null ? 0 : array.length;
11235      return length ? baseFlatten(array, 1) : [];
11236    }
11237
11238    /**
11239     * Recursively flattens `array`.
11240     *
11241     * @static
11242     * @memberOf _
11243     * @since 3.0.0
11244     * @category Array
11245     * @param {Array} array The array to flatten.
11246     * @returns {Array} Returns the new flattened array.
11247     * @example
11248     *
11249     * _.flattenDeep([1, [2, [3, [4]], 5]]);
11250     * // => [1, 2, 3, 4, 5]
11251     */
11252    function flattenDeep(array) {
11253      var length = array == null ? 0 : array.length;
11254      return length ? baseFlatten(array, INFINITY) : [];
11255    }
11256
11257    /**
11258     * Recursively flatten `array` up to `depth` times.
11259     *
11260     * @static
11261     * @memberOf _
11262     * @since 4.4.0
11263     * @category Array
11264     * @param {Array} array The array to flatten.
11265     * @param {number} [depth=1] The maximum recursion depth.
11266     * @returns {Array} Returns the new flattened array.
11267     * @example
11268     *
11269     * var array = [1, [2, [3, [4]], 5]];
11270     *
11271     * _.flattenDepth(array, 1);
11272     * // => [1, 2, [3, [4]], 5]
11273     *
11274     * _.flattenDepth(array, 2);
11275     * // => [1, 2, 3, [4], 5]
11276     */
11277    function flattenDepth(array, depth) {
11278      var length = array == null ? 0 : array.length;
11279      if (!length) {
11280        return [];
11281      }
11282      depth = depth === undefined ? 1 : toInteger(depth);
11283      return baseFlatten(array, depth);
11284    }
11285
11286    /**
11287     * The inverse of `_.toPairs`; this method returns an object composed
11288     * from key-value `pairs`.
11289     *
11290     * @static
11291     * @memberOf _
11292     * @since 4.0.0
11293     * @category Array
11294     * @param {Array} pairs The key-value pairs.
11295     * @returns {Object} Returns the new object.
11296     * @example
11297     *
11298     * _.fromPairs([['a', 1], ['b', 2]]);
11299     * // => { 'a': 1, 'b': 2 }
11300     */
11301    function fromPairs(pairs) {
11302      var index = -1,
11303          length = pairs == null ? 0 : pairs.length,
11304          result = {};
11305
11306      while (++index < length) {
11307        var pair = pairs[index];
11308        result[pair[0]] = pair[1];
11309      }
11310      return result;
11311    }
11312
11313    /**
11314     * Gets the first element of `array`.
11315     *
11316     * @static
11317     * @memberOf _
11318     * @since 0.1.0
11319     * @alias first
11320     * @category Array
11321     * @param {Array} array The array to query.
11322     * @returns {*} Returns the first element of `array`.
11323     * @example
11324     *
11325     * _.head([1, 2, 3]);
11326     * // => 1
11327     *
11328     * _.head([]);
11329     * // => undefined
11330     */
11331    function head(array) {
11332      return (array && array.length) ? array[0] : undefined;
11333    }
11334
11335    /**
11336     * Gets the index at which the first occurrence of `value` is found in `array`
11337     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11338     * for equality comparisons. If `fromIndex` is negative, it's used as the
11339     * offset from the end of `array`.
11340     *
11341     * @static
11342     * @memberOf _
11343     * @since 0.1.0
11344     * @category Array
11345     * @param {Array} array The array to inspect.
11346     * @param {*} value The value to search for.
11347     * @param {number} [fromIndex=0] The index to search from.
11348     * @returns {number} Returns the index of the matched value, else `-1`.
11349     * @example
11350     *
11351     * _.indexOf([1, 2, 1, 2], 2);
11352     * // => 1
11353     *
11354     * // Search from the `fromIndex`.
11355     * _.indexOf([1, 2, 1, 2], 2, 2);
11356     * // => 3
11357     */
11358    function indexOf(array, value, fromIndex) {
11359      var length = array == null ? 0 : array.length;
11360      if (!length) {
11361        return -1;
11362      }
11363      var index = fromIndex == null ? 0 : toInteger(fromIndex);
11364      if (index < 0) {
11365        index = nativeMax(length + index, 0);
11366      }
11367      return baseIndexOf(array, value, index);
11368    }
11369
11370    /**
11371     * Gets all but the last element of `array`.
11372     *
11373     * @static
11374     * @memberOf _
11375     * @since 0.1.0
11376     * @category Array
11377     * @param {Array} array The array to query.
11378     * @returns {Array} Returns the slice of `array`.
11379     * @example
11380     *
11381     * _.initial([1, 2, 3]);
11382     * // => [1, 2]
11383     */
11384    function initial(array) {
11385      var length = array == null ? 0 : array.length;
11386      return length ? baseSlice(array, 0, -1) : [];
11387    }
11388
11389    /**
11390     * Creates an array of unique values that are included in all given arrays
11391     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11392     * for equality comparisons. The order and references of result values are
11393     * determined by the first array.
11394     *
11395     * @static
11396     * @memberOf _
11397     * @since 0.1.0
11398     * @category Array
11399     * @param {...Array} [arrays] The arrays to inspect.
11400     * @returns {Array} Returns the new array of intersecting values.
11401     * @example
11402     *
11403     * _.intersection([2, 1], [2, 3]);
11404     * // => [2]
11405     */
11406    var intersection = baseRest(function(arrays) {
11407      var mapped = arrayMap(arrays, castArrayLikeObject);
11408      return (mapped.length && mapped[0] === arrays[0])
11409        ? baseIntersection(mapped)
11410        : [];
11411    });
11412
11413    /**
11414     * This method is like `_.intersection` except that it accepts `iteratee`
11415     * which is invoked for each element of each `arrays` to generate the criterion
11416     * by which they're compared. The order and references of result values are
11417     * determined by the first array. The iteratee is invoked with one argument:
11418     * (value).
11419     *
11420     * @static
11421     * @memberOf _
11422     * @since 4.0.0
11423     * @category Array
11424     * @param {...Array} [arrays] The arrays to inspect.
11425     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
11426     * @returns {Array} Returns the new array of intersecting values.
11427     * @example
11428     *
11429     * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
11430     * // => [2.1]
11431     *
11432     * // The `_.property` iteratee shorthand.
11433     * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
11434     * // => [{ 'x': 1 }]
11435     */
11436    var intersectionBy = baseRest(function(arrays) {
11437      var iteratee = last(arrays),
11438          mapped = arrayMap(arrays, castArrayLikeObject);
11439
11440      if (iteratee === last(mapped)) {
11441        iteratee = undefined;
11442      } else {
11443        mapped.pop();
11444      }
11445      return (mapped.length && mapped[0] === arrays[0])
11446        ? baseIntersection(mapped, getIteratee(iteratee, 2))
11447        : [];
11448    });
11449
11450    /**
11451     * This method is like `_.intersection` except that it accepts `comparator`
11452     * which is invoked to compare elements of `arrays`. The order and references
11453     * of result values are determined by the first array. The comparator is
11454     * invoked with two arguments: (arrVal, othVal).
11455     *
11456     * @static
11457     * @memberOf _
11458     * @since 4.0.0
11459     * @category Array
11460     * @param {...Array} [arrays] The arrays to inspect.
11461     * @param {Function} [comparator] The comparator invoked per element.
11462     * @returns {Array} Returns the new array of intersecting values.
11463     * @example
11464     *
11465     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
11466     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
11467     *
11468     * _.intersectionWith(objects, others, _.isEqual);
11469     * // => [{ 'x': 1, 'y': 2 }]
11470     */
11471    var intersectionWith = baseRest(function(arrays) {
11472      var comparator = last(arrays),
11473          mapped = arrayMap(arrays, castArrayLikeObject);
11474
11475      comparator = typeof comparator == 'function' ? comparator : undefined;
11476      if (comparator) {
11477        mapped.pop();
11478      }
11479      return (mapped.length && mapped[0] === arrays[0])
11480        ? baseIntersection(mapped, undefined, comparator)
11481        : [];
11482    });
11483
11484    /**
11485     * Converts all elements in `array` into a string separated by `separator`.
11486     *
11487     * @static
11488     * @memberOf _
11489     * @since 4.0.0
11490     * @category Array
11491     * @param {Array} array The array to convert.
11492     * @param {string} [separator=','] The element separator.
11493     * @returns {string} Returns the joined string.
11494     * @example
11495     *
11496     * _.join(['a', 'b', 'c'], '~');
11497     * // => 'a~b~c'
11498     */
11499    function join(array, separator) {
11500      return array == null ? '' : nativeJoin.call(array, separator);
11501    }
11502
11503    /**
11504     * Gets the last element of `array`.
11505     *
11506     * @static
11507     * @memberOf _
11508     * @since 0.1.0
11509     * @category Array
11510     * @param {Array} array The array to query.
11511     * @returns {*} Returns the last element of `array`.
11512     * @example
11513     *
11514     * _.last([1, 2, 3]);
11515     * // => 3
11516     */
11517    function last(array) {
11518      var length = array == null ? 0 : array.length;
11519      return length ? array[length - 1] : undefined;
11520    }
11521
11522    /**
11523     * This method is like `_.indexOf` except that it iterates over elements of
11524     * `array` from right to left.
11525     *
11526     * @static
11527     * @memberOf _
11528     * @since 0.1.0
11529     * @category Array
11530     * @param {Array} array The array to inspect.
11531     * @param {*} value The value to search for.
11532     * @param {number} [fromIndex=array.length-1] The index to search from.
11533     * @returns {number} Returns the index of the matched value, else `-1`.
11534     * @example
11535     *
11536     * _.lastIndexOf([1, 2, 1, 2], 2);
11537     * // => 3
11538     *
11539     * // Search from the `fromIndex`.
11540     * _.lastIndexOf([1, 2, 1, 2], 2, 2);
11541     * // => 1
11542     */
11543    function lastIndexOf(array, value, fromIndex) {
11544      var length = array == null ? 0 : array.length;
11545      if (!length) {
11546        return -1;
11547      }
11548      var index = length;
11549      if (fromIndex !== undefined) {
11550        index = toInteger(fromIndex);
11551        index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
11552      }
11553      return value === value
11554        ? strictLastIndexOf(array, value, index)
11555        : baseFindIndex(array, baseIsNaN, index, true);
11556    }
11557
11558    /**
11559     * Gets the element at index `n` of `array`. If `n` is negative, the nth
11560     * element from the end is returned.
11561     *
11562     * @static
11563     * @memberOf _
11564     * @since 4.11.0
11565     * @category Array
11566     * @param {Array} array The array to query.
11567     * @param {number} [n=0] The index of the element to return.
11568     * @returns {*} Returns the nth element of `array`.
11569     * @example
11570     *
11571     * var array = ['a', 'b', 'c', 'd'];
11572     *
11573     * _.nth(array, 1);
11574     * // => 'b'
11575     *
11576     * _.nth(array, -2);
11577     * // => 'c';
11578     */
11579    function nth(array, n) {
11580      return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
11581    }
11582
11583    /**
11584     * Removes all given values from `array` using
11585     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11586     * for equality comparisons.
11587     *
11588     * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
11589     * to remove elements from an array by predicate.
11590     *
11591     * @static
11592     * @memberOf _
11593     * @since 2.0.0
11594     * @category Array
11595     * @param {Array} array The array to modify.
11596     * @param {...*} [values] The values to remove.
11597     * @returns {Array} Returns `array`.
11598     * @example
11599     *
11600     * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
11601     *
11602     * _.pull(array, 'a', 'c');
11603     * console.log(array);
11604     * // => ['b', 'b']
11605     */
11606    var pull = baseRest(pullAll);
11607
11608    /**
11609     * This method is like `_.pull` except that it accepts an array of values to remove.
11610     *
11611     * **Note:** Unlike `_.difference`, this method mutates `array`.
11612     *
11613     * @static
11614     * @memberOf _
11615     * @since 4.0.0
11616     * @category Array
11617     * @param {Array} array The array to modify.
11618     * @param {Array} values The values to remove.
11619     * @returns {Array} Returns `array`.
11620     * @example
11621     *
11622     * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
11623     *
11624     * _.pullAll(array, ['a', 'c']);
11625     * console.log(array);
11626     * // => ['b', 'b']
11627     */
11628    function pullAll(array, values) {
11629      return (array && array.length && values && values.length)
11630        ? basePullAll(array, values)
11631        : array;
11632    }
11633
11634    /**
11635     * This method is like `_.pullAll` except that it accepts `iteratee` which is
11636     * invoked for each element of `array` and `values` to generate the criterion
11637     * by which they're compared. The iteratee is invoked with one argument: (value).
11638     *
11639     * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
11640     *
11641     * @static
11642     * @memberOf _
11643     * @since 4.0.0
11644     * @category Array
11645     * @param {Array} array The array to modify.
11646     * @param {Array} values The values to remove.
11647     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
11648     * @returns {Array} Returns `array`.
11649     * @example
11650     *
11651     * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
11652     *
11653     * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
11654     * console.log(array);
11655     * // => [{ 'x': 2 }]
11656     */
11657    function pullAllBy(array, values, iteratee) {
11658      return (array && array.length && values && values.length)
11659        ? basePullAll(array, values, getIteratee(iteratee, 2))
11660        : array;
11661    }
11662
11663    /**
11664     * This method is like `_.pullAll` except that it accepts `comparator` which
11665     * is invoked to compare elements of `array` to `values`. The comparator is
11666     * invoked with two arguments: (arrVal, othVal).
11667     *
11668     * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
11669     *
11670     * @static
11671     * @memberOf _
11672     * @since 4.6.0
11673     * @category Array
11674     * @param {Array} array The array to modify.
11675     * @param {Array} values The values to remove.
11676     * @param {Function} [comparator] The comparator invoked per element.
11677     * @returns {Array} Returns `array`.
11678     * @example
11679     *
11680     * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
11681     *
11682     * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
11683     * console.log(array);
11684     * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
11685     */
11686    function pullAllWith(array, values, comparator) {
11687      return (array && array.length && values && values.length)
11688        ? basePullAll(array, values, undefined, comparator)
11689        : array;
11690    }
11691
11692    /**
11693     * Removes elements from `array` corresponding to `indexes` and returns an
11694     * array of removed elements.
11695     *
11696     * **Note:** Unlike `_.at`, this method mutates `array`.
11697     *
11698     * @static
11699     * @memberOf _
11700     * @since 3.0.0
11701     * @category Array
11702     * @param {Array} array The array to modify.
11703     * @param {...(number|number[])} [indexes] The indexes of elements to remove.
11704     * @returns {Array} Returns the new array of removed elements.
11705     * @example
11706     *
11707     * var array = ['a', 'b', 'c', 'd'];
11708     * var pulled = _.pullAt(array, [1, 3]);
11709     *
11710     * console.log(array);
11711     * // => ['a', 'c']
11712     *
11713     * console.log(pulled);
11714     * // => ['b', 'd']
11715     */
11716    var pullAt = flatRest(function(array, indexes) {
11717      var length = array == null ? 0 : array.length,
11718          result = baseAt(array, indexes);
11719
11720      basePullAt(array, arrayMap(indexes, function(index) {
11721        return isIndex(index, length) ? +index : index;
11722      }).sort(compareAscending));
11723
11724      return result;
11725    });
11726
11727    /**
11728     * Removes all elements from `array` that `predicate` returns truthy for
11729     * and returns an array of the removed elements. The predicate is invoked
11730     * with three arguments: (value, index, array).
11731     *
11732     * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
11733     * to pull elements from an array by value.
11734     *
11735     * @static
11736     * @memberOf _
11737     * @since 2.0.0
11738     * @category Array
11739     * @param {Array} array The array to modify.
11740     * @param {Function} [predicate=_.identity] The function invoked per iteration.
11741     * @returns {Array} Returns the new array of removed elements.
11742     * @example
11743     *
11744     * var array = [1, 2, 3, 4];
11745     * var evens = _.remove(array, function(n) {
11746     *   return n % 2 == 0;
11747     * });
11748     *
11749     * console.log(array);
11750     * // => [1, 3]
11751     *
11752     * console.log(evens);
11753     * // => [2, 4]
11754     */
11755    function remove(array, predicate) {
11756      var result = [];
11757      if (!(array && array.length)) {
11758        return result;
11759      }
11760      var index = -1,
11761          indexes = [],
11762          length = array.length;
11763
11764      predicate = getIteratee(predicate, 3);
11765      while (++index < length) {
11766        var value = array[index];
11767        if (predicate(value, index, array)) {
11768          result.push(value);
11769          indexes.push(index);
11770        }
11771      }
11772      basePullAt(array, indexes);
11773      return result;
11774    }
11775
11776    /**
11777     * Reverses `array` so that the first element becomes the last, the second
11778     * element becomes the second to last, and so on.
11779     *
11780     * **Note:** This method mutates `array` and is based on
11781     * [`Array#reverse`](https://mdn.io/Array/reverse).
11782     *
11783     * @static
11784     * @memberOf _
11785     * @since 4.0.0
11786     * @category Array
11787     * @param {Array} array The array to modify.
11788     * @returns {Array} Returns `array`.
11789     * @example
11790     *
11791     * var array = [1, 2, 3];
11792     *
11793     * _.reverse(array);
11794     * // => [3, 2, 1]
11795     *
11796     * console.log(array);
11797     * // => [3, 2, 1]
11798     */
11799    function reverse(array) {
11800      return array == null ? array : nativeReverse.call(array);
11801    }
11802
11803    /**
11804     * Creates a slice of `array` from `start` up to, but not including, `end`.
11805     *
11806     * **Note:** This method is used instead of
11807     * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
11808     * returned.
11809     *
11810     * @static
11811     * @memberOf _
11812     * @since 3.0.0
11813     * @category Array
11814     * @param {Array} array The array to slice.
11815     * @param {number} [start=0] The start position.
11816     * @param {number} [end=array.length] The end position.
11817     * @returns {Array} Returns the slice of `array`.
11818     */
11819    function slice(array, start, end) {
11820      var length = array == null ? 0 : array.length;
11821      if (!length) {
11822        return [];
11823      }
11824      if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
11825        start = 0;
11826        end = length;
11827      }
11828      else {
11829        start = start == null ? 0 : toInteger(start);
11830        end = end === undefined ? length : toInteger(end);
11831      }
11832      return baseSlice(array, start, end);
11833    }
11834
11835    /**
11836     * Uses a binary search to determine the lowest index at which `value`
11837     * should be inserted into `array` in order to maintain its sort order.
11838     *
11839     * @static
11840     * @memberOf _
11841     * @since 0.1.0
11842     * @category Array
11843     * @param {Array} array The sorted array to inspect.
11844     * @param {*} value The value to evaluate.
11845     * @returns {number} Returns the index at which `value` should be inserted
11846     *  into `array`.
11847     * @example
11848     *
11849     * _.sortedIndex([30, 50], 40);
11850     * // => 1
11851     */
11852    function sortedIndex(array, value) {
11853      return baseSortedIndex(array, value);
11854    }
11855
11856    /**
11857     * This method is like `_.sortedIndex` except that it accepts `iteratee`
11858     * which is invoked for `value` and each element of `array` to compute their
11859     * sort ranking. The iteratee is invoked with one argument: (value).
11860     *
11861     * @static
11862     * @memberOf _
11863     * @since 4.0.0
11864     * @category Array
11865     * @param {Array} array The sorted array to inspect.
11866     * @param {*} value The value to evaluate.
11867     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
11868     * @returns {number} Returns the index at which `value` should be inserted
11869     *  into `array`.
11870     * @example
11871     *
11872     * var objects = [{ 'x': 4 }, { 'x': 5 }];
11873     *
11874     * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
11875     * // => 0
11876     *
11877     * // The `_.property` iteratee shorthand.
11878     * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
11879     * // => 0
11880     */
11881    function sortedIndexBy(array, value, iteratee) {
11882      return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
11883    }
11884
11885    /**
11886     * This method is like `_.indexOf` except that it performs a binary
11887     * search on a sorted `array`.
11888     *
11889     * @static
11890     * @memberOf _
11891     * @since 4.0.0
11892     * @category Array
11893     * @param {Array} array The array to inspect.
11894     * @param {*} value The value to search for.
11895     * @returns {number} Returns the index of the matched value, else `-1`.
11896     * @example
11897     *
11898     * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
11899     * // => 1
11900     */
11901    function sortedIndexOf(array, value) {
11902      var length = array == null ? 0 : array.length;
11903      if (length) {
11904        var index = baseSortedIndex(array, value);
11905        if (index < length && eq(array[index], value)) {
11906          return index;
11907        }
11908      }
11909      return -1;
11910    }
11911
11912    /**
11913     * This method is like `_.sortedIndex` except that it returns the highest
11914     * index at which `value` should be inserted into `array` in order to
11915     * maintain its sort order.
11916     *
11917     * @static
11918     * @memberOf _
11919     * @since 3.0.0
11920     * @category Array
11921     * @param {Array} array The sorted array to inspect.
11922     * @param {*} value The value to evaluate.
11923     * @returns {number} Returns the index at which `value` should be inserted
11924     *  into `array`.
11925     * @example
11926     *
11927     * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
11928     * // => 4
11929     */
11930    function sortedLastIndex(array, value) {
11931      return baseSortedIndex(array, value, true);
11932    }
11933
11934    /**
11935     * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
11936     * which is invoked for `value` and each element of `array` to compute their
11937     * sort ranking. The iteratee is invoked with one argument: (value).
11938     *
11939     * @static
11940     * @memberOf _
11941     * @since 4.0.0
11942     * @category Array
11943     * @param {Array} array The sorted array to inspect.
11944     * @param {*} value The value to evaluate.
11945     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
11946     * @returns {number} Returns the index at which `value` should be inserted
11947     *  into `array`.
11948     * @example
11949     *
11950     * var objects = [{ 'x': 4 }, { 'x': 5 }];
11951     *
11952     * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
11953     * // => 1
11954     *
11955     * // The `_.property` iteratee shorthand.
11956     * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
11957     * // => 1
11958     */
11959    function sortedLastIndexBy(array, value, iteratee) {
11960      return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
11961    }
11962
11963    /**
11964     * This method is like `_.lastIndexOf` except that it performs a binary
11965     * search on a sorted `array`.
11966     *
11967     * @static
11968     * @memberOf _
11969     * @since 4.0.0
11970     * @category Array
11971     * @param {Array} array The array to inspect.
11972     * @param {*} value The value to search for.
11973     * @returns {number} Returns the index of the matched value, else `-1`.
11974     * @example
11975     *
11976     * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
11977     * // => 3
11978     */
11979    function sortedLastIndexOf(array, value) {
11980      var length = array == null ? 0 : array.length;
11981      if (length) {
11982        var index = baseSortedIndex(array, value, true) - 1;
11983        if (eq(array[index], value)) {
11984          return index;
11985        }
11986      }
11987      return -1;
11988    }
11989
11990    /**
11991     * This method is like `_.uniq` except that it's designed and optimized
11992     * for sorted arrays.
11993     *
11994     * @static
11995     * @memberOf _
11996     * @since 4.0.0
11997     * @category Array
11998     * @param {Array} array The array to inspect.
11999     * @returns {Array} Returns the new duplicate free array.
12000     * @example
12001     *
12002     * _.sortedUniq([1, 1, 2]);
12003     * // => [1, 2]
12004     */
12005    function sortedUniq(array) {
12006      return (array && array.length)
12007        ? baseSortedUniq(array)
12008        : [];
12009    }
12010
12011    /**
12012     * This method is like `_.uniqBy` except that it's designed and optimized
12013     * for sorted arrays.
12014     *
12015     * @static
12016     * @memberOf _
12017     * @since 4.0.0
12018     * @category Array
12019     * @param {Array} array The array to inspect.
12020     * @param {Function} [iteratee] The iteratee invoked per element.
12021     * @returns {Array} Returns the new duplicate free array.
12022     * @example
12023     *
12024     * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
12025     * // => [1.1, 2.3]
12026     */
12027    function sortedUniqBy(array, iteratee) {
12028      return (array && array.length)
12029        ? baseSortedUniq(array, getIteratee(iteratee, 2))
12030        : [];
12031    }
12032
12033    /**
12034     * Gets all but the first element of `array`.
12035     *
12036     * @static
12037     * @memberOf _
12038     * @since 4.0.0
12039     * @category Array
12040     * @param {Array} array The array to query.
12041     * @returns {Array} Returns the slice of `array`.
12042     * @example
12043     *
12044     * _.tail([1, 2, 3]);
12045     * // => [2, 3]
12046     */
12047    function tail(array) {
12048      var length = array == null ? 0 : array.length;
12049      return length ? baseSlice(array, 1, length) : [];
12050    }
12051
12052    /**
12053     * Creates a slice of `array` with `n` elements taken from the beginning.
12054     *
12055     * @static
12056     * @memberOf _
12057     * @since 0.1.0
12058     * @category Array
12059     * @param {Array} array The array to query.
12060     * @param {number} [n=1] The number of elements to take.
12061     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
12062     * @returns {Array} Returns the slice of `array`.
12063     * @example
12064     *
12065     * _.take([1, 2, 3]);
12066     * // => [1]
12067     *
12068     * _.take([1, 2, 3], 2);
12069     * // => [1, 2]
12070     *
12071     * _.take([1, 2, 3], 5);
12072     * // => [1, 2, 3]
12073     *
12074     * _.take([1, 2, 3], 0);
12075     * // => []
12076     */
12077    function take(array, n, guard) {
12078      if (!(array && array.length)) {
12079        return [];
12080      }
12081      n = (guard || n === undefined) ? 1 : toInteger(n);
12082      return baseSlice(array, 0, n < 0 ? 0 : n);
12083    }
12084
12085    /**
12086     * Creates a slice of `array` with `n` elements taken from the end.
12087     *
12088     * @static
12089     * @memberOf _
12090     * @since 3.0.0
12091     * @category Array
12092     * @param {Array} array The array to query.
12093     * @param {number} [n=1] The number of elements to take.
12094     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
12095     * @returns {Array} Returns the slice of `array`.
12096     * @example
12097     *
12098     * _.takeRight([1, 2, 3]);
12099     * // => [3]
12100     *
12101     * _.takeRight([1, 2, 3], 2);
12102     * // => [2, 3]
12103     *
12104     * _.takeRight([1, 2, 3], 5);
12105     * // => [1, 2, 3]
12106     *
12107     * _.takeRight([1, 2, 3], 0);
12108     * // => []
12109     */
12110    function takeRight(array, n, guard) {
12111      var length = array == null ? 0 : array.length;
12112      if (!length) {
12113        return [];
12114      }
12115      n = (guard || n === undefined) ? 1 : toInteger(n);
12116      n = length - n;
12117      return baseSlice(array, n < 0 ? 0 : n, length);
12118    }
12119
12120    /**
12121     * Creates a slice of `array` with elements taken from the end. Elements are
12122     * taken until `predicate` returns falsey. The predicate is invoked with
12123     * three arguments: (value, index, array).
12124     *
12125     * @static
12126     * @memberOf _
12127     * @since 3.0.0
12128     * @category Array
12129     * @param {Array} array The array to query.
12130     * @param {Function} [predicate=_.identity] The function invoked per iteration.
12131     * @returns {Array} Returns the slice of `array`.
12132     * @example
12133     *
12134     * var users = [
12135     *   { 'user': 'barney',  'active': true },
12136     *   { 'user': 'fred',    'active': false },
12137     *   { 'user': 'pebbles', 'active': false }
12138     * ];
12139     *
12140     * _.takeRightWhile(users, function(o) { return !o.active; });
12141     * // => objects for ['fred', 'pebbles']
12142     *
12143     * // The `_.matches` iteratee shorthand.
12144     * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
12145     * // => objects for ['pebbles']
12146     *
12147     * // The `_.matchesProperty` iteratee shorthand.
12148     * _.takeRightWhile(users, ['active', false]);
12149     * // => objects for ['fred', 'pebbles']
12150     *
12151     * // The `_.property` iteratee shorthand.
12152     * _.takeRightWhile(users, 'active');
12153     * // => []
12154     */
12155    function takeRightWhile(array, predicate) {
12156      return (array && array.length)
12157        ? baseWhile(array, getIteratee(predicate, 3), false, true)
12158        : [];
12159    }
12160
12161    /**
12162     * Creates a slice of `array` with elements taken from the beginning. Elements
12163     * are taken until `predicate` returns falsey. The predicate is invoked with
12164     * three arguments: (value, index, array).
12165     *
12166     * @static
12167     * @memberOf _
12168     * @since 3.0.0
12169     * @category Array
12170     * @param {Array} array The array to query.
12171     * @param {Function} [predicate=_.identity] The function invoked per iteration.
12172     * @returns {Array} Returns the slice of `array`.
12173     * @example
12174     *
12175     * var users = [
12176     *   { 'user': 'barney',  'active': false },
12177     *   { 'user': 'fred',    'active': false },
12178     *   { 'user': 'pebbles', 'active': true }
12179     * ];
12180     *
12181     * _.takeWhile(users, function(o) { return !o.active; });
12182     * // => objects for ['barney', 'fred']
12183     *
12184     * // The `_.matches` iteratee shorthand.
12185     * _.takeWhile(users, { 'user': 'barney', 'active': false });
12186     * // => objects for ['barney']
12187     *
12188     * // The `_.matchesProperty` iteratee shorthand.
12189     * _.takeWhile(users, ['active', false]);
12190     * // => objects for ['barney', 'fred']
12191     *
12192     * // The `_.property` iteratee shorthand.
12193     * _.takeWhile(users, 'active');
12194     * // => []
12195     */
12196    function takeWhile(array, predicate) {
12197      return (array && array.length)
12198        ? baseWhile(array, getIteratee(predicate, 3))
12199        : [];
12200    }
12201
12202    /**
12203     * Creates an array of unique values, in order, from all given arrays using
12204     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
12205     * for equality comparisons.
12206     *
12207     * @static
12208     * @memberOf _
12209     * @since 0.1.0
12210     * @category Array
12211     * @param {...Array} [arrays] The arrays to inspect.
12212     * @returns {Array} Returns the new array of combined values.
12213     * @example
12214     *
12215     * _.union([2], [1, 2]);
12216     * // => [2, 1]
12217     */
12218    var union = baseRest(function(arrays) {
12219      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
12220    });
12221
12222    /**
12223     * This method is like `_.union` except that it accepts `iteratee` which is
12224     * invoked for each element of each `arrays` to generate the criterion by
12225     * which uniqueness is computed. Result values are chosen from the first
12226     * array in which the value occurs. The iteratee is invoked with one argument:
12227     * (value).
12228     *
12229     * @static
12230     * @memberOf _
12231     * @since 4.0.0
12232     * @category Array
12233     * @param {...Array} [arrays] The arrays to inspect.
12234     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
12235     * @returns {Array} Returns the new array of combined values.
12236     * @example
12237     *
12238     * _.unionBy([2.1], [1.2, 2.3], Math.floor);
12239     * // => [2.1, 1.2]
12240     *
12241     * // The `_.property` iteratee shorthand.
12242     * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
12243     * // => [{ 'x': 1 }, { 'x': 2 }]
12244     */
12245    var unionBy = baseRest(function(arrays) {
12246      var iteratee = last(arrays);
12247      if (isArrayLikeObject(iteratee)) {
12248        iteratee = undefined;
12249      }
12250      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
12251    });
12252
12253    /**
12254     * This method is like `_.union` except that it accepts `comparator` which
12255     * is invoked to compare elements of `arrays`. Result values are chosen from
12256     * the first array in which the value occurs. The comparator is invoked
12257     * with two arguments: (arrVal, othVal).
12258     *
12259     * @static
12260     * @memberOf _
12261     * @since 4.0.0
12262     * @category Array
12263     * @param {...Array} [arrays] The arrays to inspect.
12264     * @param {Function} [comparator] The comparator invoked per element.
12265     * @returns {Array} Returns the new array of combined values.
12266     * @example
12267     *
12268     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
12269     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
12270     *
12271     * _.unionWith(objects, others, _.isEqual);
12272     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
12273     */
12274    var unionWith = baseRest(function(arrays) {
12275      var comparator = last(arrays);
12276      comparator = typeof comparator == 'function' ? comparator : undefined;
12277      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
12278    });
12279
12280    /**
12281     * Creates a duplicate-free version of an array, using
12282     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
12283     * for equality comparisons, in which only the first occurrence of each element
12284     * is kept. The order of result values is determined by the order they occur
12285     * in the array.
12286     *
12287     * @static
12288     * @memberOf _
12289     * @since 0.1.0
12290     * @category Array
12291     * @param {Array} array The array to inspect.
12292     * @returns {Array} Returns the new duplicate free array.
12293     * @example
12294     *
12295     * _.uniq([2, 1, 2]);
12296     * // => [2, 1]
12297     */
12298    function uniq(array) {
12299      return (array && array.length) ? baseUniq(array) : [];
12300    }
12301
12302    /**
12303     * This method is like `_.uniq` except that it accepts `iteratee` which is
12304     * invoked for each element in `array` to generate the criterion by which
12305     * uniqueness is computed. The order of result values is determined by the
12306     * order they occur in the array. The iteratee is invoked with one argument:
12307     * (value).
12308     *
12309     * @static
12310     * @memberOf _
12311     * @since 4.0.0
12312     * @category Array
12313     * @param {Array} array The array to inspect.
12314     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
12315     * @returns {Array} Returns the new duplicate free array.
12316     * @example
12317     *
12318     * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
12319     * // => [2.1, 1.2]
12320     *
12321     * // The `_.property` iteratee shorthand.
12322     * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
12323     * // => [{ 'x': 1 }, { 'x': 2 }]
12324     */
12325    function uniqBy(array, iteratee) {
12326      return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
12327    }
12328
12329    /**
12330     * This method is like `_.uniq` except that it accepts `comparator` which
12331     * is invoked to compare elements of `array`. The order of result values is
12332     * determined by the order they occur in the array.The comparator is invoked
12333     * with two arguments: (arrVal, othVal).
12334     *
12335     * @static
12336     * @memberOf _
12337     * @since 4.0.0
12338     * @category Array
12339     * @param {Array} array The array to inspect.
12340     * @param {Function} [comparator] The comparator invoked per element.
12341     * @returns {Array} Returns the new duplicate free array.
12342     * @example
12343     *
12344     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
12345     *
12346     * _.uniqWith(objects, _.isEqual);
12347     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
12348     */
12349    function uniqWith(array, comparator) {
12350      comparator = typeof comparator == 'function' ? comparator : undefined;
12351      return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
12352    }
12353
12354    /**
12355     * This method is like `_.zip` except that it accepts an array of grouped
12356     * elements and creates an array regrouping the elements to their pre-zip
12357     * configuration.
12358     *
12359     * @static
12360     * @memberOf _
12361     * @since 1.2.0
12362     * @category Array
12363     * @param {Array} array The array of grouped elements to process.
12364     * @returns {Array} Returns the new array of regrouped elements.
12365     * @example
12366     *
12367     * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
12368     * // => [['a', 1, true], ['b', 2, false]]
12369     *
12370     * _.unzip(zipped);
12371     * // => [['a', 'b'], [1, 2], [true, false]]
12372     */
12373    function unzip(array) {
12374      if (!(array && array.length)) {
12375        return [];
12376      }
12377      var length = 0;
12378      array = arrayFilter(array, function(group) {
12379        if (isArrayLikeObject(group)) {
12380          length = nativeMax(group.length, length);
12381          return true;
12382        }
12383      });
12384      return baseTimes(length, function(index) {
12385        return arrayMap(array, baseProperty(index));
12386      });
12387    }
12388
12389    /**
12390     * This method is like `_.unzip` except that it accepts `iteratee` to specify
12391     * how regrouped values should be combined. The iteratee is invoked with the
12392     * elements of each group: (...group).
12393     *
12394     * @static
12395     * @memberOf _
12396     * @since 3.8.0
12397     * @category Array
12398     * @param {Array} array The array of grouped elements to process.
12399     * @param {Function} [iteratee=_.identity] The function to combine
12400     *  regrouped values.
12401     * @returns {Array} Returns the new array of regrouped elements.
12402     * @example
12403     *
12404     * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
12405     * // => [[1, 10, 100], [2, 20, 200]]
12406     *
12407     * _.unzipWith(zipped, _.add);
12408     * // => [3, 30, 300]
12409     */
12410    function unzipWith(array, iteratee) {
12411      if (!(array && array.length)) {
12412        return [];
12413      }
12414      var result = unzip(array);
12415      if (iteratee == null) {
12416        return result;
12417      }
12418      return arrayMap(result, function(group) {
12419        return apply(iteratee, undefined, group);
12420      });
12421    }
12422
12423    /**
12424     * Creates an array excluding all given values using
12425     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
12426     * for equality comparisons.
12427     *
12428     * **Note:** Unlike `_.pull`, this method returns a new array.
12429     *
12430     * @static
12431     * @memberOf _
12432     * @since 0.1.0
12433     * @category Array
12434     * @param {Array} array The array to inspect.
12435     * @param {...*} [values] The values to exclude.
12436     * @returns {Array} Returns the new array of filtered values.
12437     * @see _.difference, _.xor
12438     * @example
12439     *
12440     * _.without([2, 1, 2, 3], 1, 2);
12441     * // => [3]
12442     */
12443    var without = baseRest(function(array, values) {
12444      return isArrayLikeObject(array)
12445        ? baseDifference(array, values)
12446        : [];
12447    });
12448
12449    /**
12450     * Creates an array of unique values that is the
12451     * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
12452     * of the given arrays. The order of result values is determined by the order
12453     * they occur in the arrays.
12454     *
12455     * @static
12456     * @memberOf _
12457     * @since 2.4.0
12458     * @category Array
12459     * @param {...Array} [arrays] The arrays to inspect.
12460     * @returns {Array} Returns the new array of filtered values.
12461     * @see _.difference, _.without
12462     * @example
12463     *
12464     * _.xor([2, 1], [2, 3]);
12465     * // => [1, 3]
12466     */
12467    var xor = baseRest(function(arrays) {
12468      return baseXor(arrayFilter(arrays, isArrayLikeObject));
12469    });
12470
12471    /**
12472     * This method is like `_.xor` except that it accepts `iteratee` which is
12473     * invoked for each element of each `arrays` to generate the criterion by
12474     * which by which they're compared. The order of result values is determined
12475     * by the order they occur in the arrays. The iteratee is invoked with one
12476     * argument: (value).
12477     *
12478     * @static
12479     * @memberOf _
12480     * @since 4.0.0
12481     * @category Array
12482     * @param {...Array} [arrays] The arrays to inspect.
12483     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
12484     * @returns {Array} Returns the new array of filtered values.
12485     * @example
12486     *
12487     * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
12488     * // => [1.2, 3.4]
12489     *
12490     * // The `_.property` iteratee shorthand.
12491     * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
12492     * // => [{ 'x': 2 }]
12493     */
12494    var xorBy = baseRest(function(arrays) {
12495      var iteratee = last(arrays);
12496      if (isArrayLikeObject(iteratee)) {
12497        iteratee = undefined;
12498      }
12499      return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
12500    });
12501
12502    /**
12503     * This method is like `_.xor` except that it accepts `comparator` which is
12504     * invoked to compare elements of `arrays`. The order of result values is
12505     * determined by the order they occur in the arrays. The comparator is invoked
12506     * with two arguments: (arrVal, othVal).
12507     *
12508     * @static
12509     * @memberOf _
12510     * @since 4.0.0
12511     * @category Array
12512     * @param {...Array} [arrays] The arrays to inspect.
12513     * @param {Function} [comparator] The comparator invoked per element.
12514     * @returns {Array} Returns the new array of filtered values.
12515     * @example
12516     *
12517     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
12518     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
12519     *
12520     * _.xorWith(objects, others, _.isEqual);
12521     * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
12522     */
12523    var xorWith = baseRest(function(arrays) {
12524      var comparator = last(arrays);
12525      comparator = typeof comparator == 'function' ? comparator : undefined;
12526      return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
12527    });
12528
12529    /**
12530     * Creates an array of grouped elements, the first of which contains the
12531     * first elements of the given arrays, the second of which contains the
12532     * second elements of the given arrays, and so on.
12533     *
12534     * @static
12535     * @memberOf _
12536     * @since 0.1.0
12537     * @category Array
12538     * @param {...Array} [arrays] The arrays to process.
12539     * @returns {Array} Returns the new array of grouped elements.
12540     * @example
12541     *
12542     * _.zip(['a', 'b'], [1, 2], [true, false]);
12543     * // => [['a', 1, true], ['b', 2, false]]
12544     */
12545    var zip = baseRest(unzip);
12546
12547    /**
12548     * This method is like `_.fromPairs` except that it accepts two arrays,
12549     * one of property identifiers and one of corresponding values.
12550     *
12551     * @static
12552     * @memberOf _
12553     * @since 0.4.0
12554     * @category Array
12555     * @param {Array} [props=[]] The property identifiers.
12556     * @param {Array} [values=[]] The property values.
12557     * @returns {Object} Returns the new object.
12558     * @example
12559     *
12560     * _.zipObject(['a', 'b'], [1, 2]);
12561     * // => { 'a': 1, 'b': 2 }
12562     */
12563    function zipObject(props, values) {
12564      return baseZipObject(props || [], values || [], assignValue);
12565    }
12566
12567    /**
12568     * This method is like `_.zipObject` except that it supports property paths.
12569     *
12570     * @static
12571     * @memberOf _
12572     * @since 4.1.0
12573     * @category Array
12574     * @param {Array} [props=[]] The property identifiers.
12575     * @param {Array} [values=[]] The property values.
12576     * @returns {Object} Returns the new object.
12577     * @example
12578     *
12579     * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
12580     * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
12581     */
12582    function zipObjectDeep(props, values) {
12583      return baseZipObject(props || [], values || [], baseSet);
12584    }
12585
12586    /**
12587     * This method is like `_.zip` except that it accepts `iteratee` to specify
12588     * how grouped values should be combined. The iteratee is invoked with the
12589     * elements of each group: (...group).
12590     *
12591     * @static
12592     * @memberOf _
12593     * @since 3.8.0
12594     * @category Array
12595     * @param {...Array} [arrays] The arrays to process.
12596     * @param {Function} [iteratee=_.identity] The function to combine
12597     *  grouped values.
12598     * @returns {Array} Returns the new array of grouped elements.
12599     * @example
12600     *
12601     * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
12602     *   return a + b + c;
12603     * });
12604     * // => [111, 222]
12605     */
12606    var zipWith = baseRest(function(arrays) {
12607      var length = arrays.length,
12608          iteratee = length > 1 ? arrays[length - 1] : undefined;
12609
12610      iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
12611      return unzipWith(arrays, iteratee);
12612    });
12613
12614    /*------------------------------------------------------------------------*/
12615
12616    /**
12617     * Creates a `lodash` wrapper instance that wraps `value` with explicit method
12618     * chain sequences enabled. The result of such sequences must be unwrapped
12619     * with `_#value`.
12620     *
12621     * @static
12622     * @memberOf _
12623     * @since 1.3.0
12624     * @category Seq
12625     * @param {*} value The value to wrap.
12626     * @returns {Object} Returns the new `lodash` wrapper instance.
12627     * @example
12628     *
12629     * var users = [
12630     *   { 'user': 'barney',  'age': 36 },
12631     *   { 'user': 'fred',    'age': 40 },
12632     *   { 'user': 'pebbles', 'age': 1 }
12633     * ];
12634     *
12635     * var youngest = _
12636     *   .chain(users)
12637     *   .sortBy('age')
12638     *   .map(function(o) {
12639     *     return o.user + ' is ' + o.age;
12640     *   })
12641     *   .head()
12642     *   .value();
12643     * // => 'pebbles is 1'
12644     */
12645    function chain(value) {
12646      var result = lodash(value);
12647      result.__chain__ = true;
12648      return result;
12649    }
12650
12651    /**
12652     * This method invokes `interceptor` and returns `value`. The interceptor
12653     * is invoked with one argument; (value). The purpose of this method is to
12654     * "tap into" a method chain sequence in order to modify intermediate results.
12655     *
12656     * @static
12657     * @memberOf _
12658     * @since 0.1.0
12659     * @category Seq
12660     * @param {*} value The value to provide to `interceptor`.
12661     * @param {Function} interceptor The function to invoke.
12662     * @returns {*} Returns `value`.
12663     * @example
12664     *
12665     * _([1, 2, 3])
12666     *  .tap(function(array) {
12667     *    // Mutate input array.
12668     *    array.pop();
12669     *  })
12670     *  .reverse()
12671     *  .value();
12672     * // => [2, 1]
12673     */
12674    function tap(value, interceptor) {
12675      interceptor(value);
12676      return value;
12677    }
12678
12679    /**
12680     * This method is like `_.tap` except that it returns the result of `interceptor`.
12681     * The purpose of this method is to "pass thru" values replacing intermediate
12682     * results in a method chain sequence.
12683     *
12684     * @static
12685     * @memberOf _
12686     * @since 3.0.0
12687     * @category Seq
12688     * @param {*} value The value to provide to `interceptor`.
12689     * @param {Function} interceptor The function to invoke.
12690     * @returns {*} Returns the result of `interceptor`.
12691     * @example
12692     *
12693     * _('  abc  ')
12694     *  .chain()
12695     *  .trim()
12696     *  .thru(function(value) {
12697     *    return [value];
12698     *  })
12699     *  .value();
12700     * // => ['abc']
12701     */
12702    function thru(value, interceptor) {
12703      return interceptor(value);
12704    }
12705
12706    /**
12707     * This method is the wrapper version of `_.at`.
12708     *
12709     * @name at
12710     * @memberOf _
12711     * @since 1.0.0
12712     * @category Seq
12713     * @param {...(string|string[])} [paths] The property paths to pick.
12714     * @returns {Object} Returns the new `lodash` wrapper instance.
12715     * @example
12716     *
12717     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
12718     *
12719     * _(object).at(['a[0].b.c', 'a[1]']).value();
12720     * // => [3, 4]
12721     */
12722    var wrapperAt = flatRest(function(paths) {
12723      var length = paths.length,
12724          start = length ? paths[0] : 0,
12725          value = this.__wrapped__,
12726          interceptor = function(object) { return baseAt(object, paths); };
12727
12728      if (length > 1 || this.__actions__.length ||
12729          !(value instanceof LazyWrapper) || !isIndex(start)) {
12730        return this.thru(interceptor);
12731      }
12732      value = value.slice(start, +start + (length ? 1 : 0));
12733      value.__actions__.push({
12734        'func': thru,
12735        'args': [interceptor],
12736        'thisArg': undefined
12737      });
12738      return new LodashWrapper(value, this.__chain__).thru(function(array) {
12739        if (length && !array.length) {
12740          array.push(undefined);
12741        }
12742        return array;
12743      });
12744    });
12745
12746    /**
12747     * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
12748     *
12749     * @name chain
12750     * @memberOf _
12751     * @since 0.1.0
12752     * @category Seq
12753     * @returns {Object} Returns the new `lodash` wrapper instance.
12754     * @example
12755     *
12756     * var users = [
12757     *   { 'user': 'barney', 'age': 36 },
12758     *   { 'user': 'fred',   'age': 40 }
12759     * ];
12760     *
12761     * // A sequence without explicit chaining.
12762     * _(users).head();
12763     * // => { 'user': 'barney', 'age': 36 }
12764     *
12765     * // A sequence with explicit chaining.
12766     * _(users)
12767     *   .chain()
12768     *   .head()
12769     *   .pick('user')
12770     *   .value();
12771     * // => { 'user': 'barney' }
12772     */
12773    function wrapperChain() {
12774      return chain(this);
12775    }
12776
12777    /**
12778     * Executes the chain sequence and returns the wrapped result.
12779     *
12780     * @name commit
12781     * @memberOf _
12782     * @since 3.2.0
12783     * @category Seq
12784     * @returns {Object} Returns the new `lodash` wrapper instance.
12785     * @example
12786     *
12787     * var array = [1, 2];
12788     * var wrapped = _(array).push(3);
12789     *
12790     * console.log(array);
12791     * // => [1, 2]
12792     *
12793     * wrapped = wrapped.commit();
12794     * console.log(array);
12795     * // => [1, 2, 3]
12796     *
12797     * wrapped.last();
12798     * // => 3
12799     *
12800     * console.log(array);
12801     * // => [1, 2, 3]
12802     */
12803    function wrapperCommit() {
12804      return new LodashWrapper(this.value(), this.__chain__);
12805    }
12806
12807    /**
12808     * Gets the next value on a wrapped object following the
12809     * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
12810     *
12811     * @name next
12812     * @memberOf _
12813     * @since 4.0.0
12814     * @category Seq
12815     * @returns {Object} Returns the next iterator value.
12816     * @example
12817     *
12818     * var wrapped = _([1, 2]);
12819     *
12820     * wrapped.next();
12821     * // => { 'done': false, 'value': 1 }
12822     *
12823     * wrapped.next();
12824     * // => { 'done': false, 'value': 2 }
12825     *
12826     * wrapped.next();
12827     * // => { 'done': true, 'value': undefined }
12828     */
12829    function wrapperNext() {
12830      if (this.__values__ === undefined) {
12831        this.__values__ = toArray(this.value());
12832      }
12833      var done = this.__index__ >= this.__values__.length,
12834          value = done ? undefined : this.__values__[this.__index__++];
12835
12836      return { 'done': done, 'value': value };
12837    }
12838
12839    /**
12840     * Enables the wrapper to be iterable.
12841     *
12842     * @name Symbol.iterator
12843     * @memberOf _
12844     * @since 4.0.0
12845     * @category Seq
12846     * @returns {Object} Returns the wrapper object.
12847     * @example
12848     *
12849     * var wrapped = _([1, 2]);
12850     *
12851     * wrapped[Symbol.iterator]() === wrapped;
12852     * // => true
12853     *
12854     * Array.from(wrapped);
12855     * // => [1, 2]
12856     */
12857    function wrapperToIterator() {
12858      return this;
12859    }
12860
12861    /**
12862     * Creates a clone of the chain sequence planting `value` as the wrapped value.
12863     *
12864     * @name plant
12865     * @memberOf _
12866     * @since 3.2.0
12867     * @category Seq
12868     * @param {*} value The value to plant.
12869     * @returns {Object} Returns the new `lodash` wrapper instance.
12870     * @example
12871     *
12872     * function square(n) {
12873     *   return n * n;
12874     * }
12875     *
12876     * var wrapped = _([1, 2]).map(square);
12877     * var other = wrapped.plant([3, 4]);
12878     *
12879     * other.value();
12880     * // => [9, 16]
12881     *
12882     * wrapped.value();
12883     * // => [1, 4]
12884     */
12885    function wrapperPlant(value) {
12886      var result,
12887          parent = this;
12888
12889      while (parent instanceof baseLodash) {
12890        var clone = wrapperClone(parent);
12891        clone.__index__ = 0;
12892        clone.__values__ = undefined;
12893        if (result) {
12894          previous.__wrapped__ = clone;
12895        } else {
12896          result = clone;
12897        }
12898        var previous = clone;
12899        parent = parent.__wrapped__;
12900      }
12901      previous.__wrapped__ = value;
12902      return result;
12903    }
12904
12905    /**
12906     * This method is the wrapper version of `_.reverse`.
12907     *
12908     * **Note:** This method mutates the wrapped array.
12909     *
12910     * @name reverse
12911     * @memberOf _
12912     * @since 0.1.0
12913     * @category Seq
12914     * @returns {Object} Returns the new `lodash` wrapper instance.
12915     * @example
12916     *
12917     * var array = [1, 2, 3];
12918     *
12919     * _(array).reverse().value()
12920     * // => [3, 2, 1]
12921     *
12922     * console.log(array);
12923     * // => [3, 2, 1]
12924     */
12925    function wrapperReverse() {
12926      var value = this.__wrapped__;
12927      if (value instanceof LazyWrapper) {
12928        var wrapped = value;
12929        if (this.__actions__.length) {
12930          wrapped = new LazyWrapper(this);
12931        }
12932        wrapped = wrapped.reverse();
12933        wrapped.__actions__.push({
12934          'func': thru,
12935          'args': [reverse],
12936          'thisArg': undefined
12937        });
12938        return new LodashWrapper(wrapped, this.__chain__);
12939      }
12940      return this.thru(reverse);
12941    }
12942
12943    /**
12944     * Executes the chain sequence to resolve the unwrapped value.
12945     *
12946     * @name value
12947     * @memberOf _
12948     * @since 0.1.0
12949     * @alias toJSON, valueOf
12950     * @category Seq
12951     * @returns {*} Returns the resolved unwrapped value.
12952     * @example
12953     *
12954     * _([1, 2, 3]).value();
12955     * // => [1, 2, 3]
12956     */
12957    function wrapperValue() {
12958      return baseWrapperValue(this.__wrapped__, this.__actions__);
12959    }
12960
12961    /*------------------------------------------------------------------------*/
12962
12963    /**
12964     * Creates an object composed of keys generated from the results of running
12965     * each element of `collection` thru `iteratee`. The corresponding value of
12966     * each key is the number of times the key was returned by `iteratee`. The
12967     * iteratee is invoked with one argument: (value).
12968     *
12969     * @static
12970     * @memberOf _
12971     * @since 0.5.0
12972     * @category Collection
12973     * @param {Array|Object} collection The collection to iterate over.
12974     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
12975     * @returns {Object} Returns the composed aggregate object.
12976     * @example
12977     *
12978     * _.countBy([6.1, 4.2, 6.3], Math.floor);
12979     * // => { '4': 1, '6': 2 }
12980     *
12981     * // The `_.property` iteratee shorthand.
12982     * _.countBy(['one', 'two', 'three'], 'length');
12983     * // => { '3': 2, '5': 1 }
12984     */
12985    var countBy = createAggregator(function(result, value, key) {
12986      if (hasOwnProperty.call(result, key)) {
12987        ++result[key];
12988      } else {
12989        baseAssignValue(result, key, 1);
12990      }
12991    });
12992
12993    /**
12994     * Checks if `predicate` returns truthy for **all** elements of `collection`.
12995     * Iteration is stopped once `predicate` returns falsey. The predicate is
12996     * invoked with three arguments: (value, index|key, collection).
12997     *
12998     * **Note:** This method returns `true` for
12999     * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
13000     * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
13001     * elements of empty collections.
13002     *
13003     * @static
13004     * @memberOf _
13005     * @since 0.1.0
13006     * @category Collection
13007     * @param {Array|Object} collection The collection to iterate over.
13008     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13009     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
13010     * @returns {boolean} Returns `true` if all elements pass the predicate check,
13011     *  else `false`.
13012     * @example
13013     *
13014     * _.every([true, 1, null, 'yes'], Boolean);
13015     * // => false
13016     *
13017     * var users = [
13018     *   { 'user': 'barney', 'age': 36, 'active': false },
13019     *   { 'user': 'fred',   'age': 40, 'active': false }
13020     * ];
13021     *
13022     * // The `_.matches` iteratee shorthand.
13023     * _.every(users, { 'user': 'barney', 'active': false });
13024     * // => false
13025     *
13026     * // The `_.matchesProperty` iteratee shorthand.
13027     * _.every(users, ['active', false]);
13028     * // => true
13029     *
13030     * // The `_.property` iteratee shorthand.
13031     * _.every(users, 'active');
13032     * // => false
13033     */
13034    function every(collection, predicate, guard) {
13035      var func = isArray(collection) ? arrayEvery : baseEvery;
13036      if (guard && isIterateeCall(collection, predicate, guard)) {
13037        predicate = undefined;
13038      }
13039      return func(collection, getIteratee(predicate, 3));
13040    }
13041
13042    /**
13043     * Iterates over elements of `collection`, returning an array of all elements
13044     * `predicate` returns truthy for. The predicate is invoked with three
13045     * arguments: (value, index|key, collection).
13046     *
13047     * **Note:** Unlike `_.remove`, this method returns a new array.
13048     *
13049     * @static
13050     * @memberOf _
13051     * @since 0.1.0
13052     * @category Collection
13053     * @param {Array|Object} collection The collection to iterate over.
13054     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13055     * @returns {Array} Returns the new filtered array.
13056     * @see _.reject
13057     * @example
13058     *
13059     * var users = [
13060     *   { 'user': 'barney', 'age': 36, 'active': true },
13061     *   { 'user': 'fred',   'age': 40, 'active': false }
13062     * ];
13063     *
13064     * _.filter(users, function(o) { return !o.active; });
13065     * // => objects for ['fred']
13066     *
13067     * // The `_.matches` iteratee shorthand.
13068     * _.filter(users, { 'age': 36, 'active': true });
13069     * // => objects for ['barney']
13070     *
13071     * // The `_.matchesProperty` iteratee shorthand.
13072     * _.filter(users, ['active', false]);
13073     * // => objects for ['fred']
13074     *
13075     * // The `_.property` iteratee shorthand.
13076     * _.filter(users, 'active');
13077     * // => objects for ['barney']
13078     *
13079     * // Combining several predicates using `_.overEvery` or `_.overSome`.
13080     * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
13081     * // => objects for ['fred', 'barney']
13082     */
13083    function filter(collection, predicate) {
13084      var func = isArray(collection) ? arrayFilter : baseFilter;
13085      return func(collection, getIteratee(predicate, 3));
13086    }
13087
13088    /**
13089     * Iterates over elements of `collection`, returning the first element
13090     * `predicate` returns truthy for. The predicate is invoked with three
13091     * arguments: (value, index|key, collection).
13092     *
13093     * @static
13094     * @memberOf _
13095     * @since 0.1.0
13096     * @category Collection
13097     * @param {Array|Object} collection The collection to inspect.
13098     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13099     * @param {number} [fromIndex=0] The index to search from.
13100     * @returns {*} Returns the matched element, else `undefined`.
13101     * @example
13102     *
13103     * var users = [
13104     *   { 'user': 'barney',  'age': 36, 'active': true },
13105     *   { 'user': 'fred',    'age': 40, 'active': false },
13106     *   { 'user': 'pebbles', 'age': 1,  'active': true }
13107     * ];
13108     *
13109     * _.find(users, function(o) { return o.age < 40; });
13110     * // => object for 'barney'
13111     *
13112     * // The `_.matches` iteratee shorthand.
13113     * _.find(users, { 'age': 1, 'active': true });
13114     * // => object for 'pebbles'
13115     *
13116     * // The `_.matchesProperty` iteratee shorthand.
13117     * _.find(users, ['active', false]);
13118     * // => object for 'fred'
13119     *
13120     * // The `_.property` iteratee shorthand.
13121     * _.find(users, 'active');
13122     * // => object for 'barney'
13123     */
13124    var find = createFind(findIndex);
13125
13126    /**
13127     * This method is like `_.find` except that it iterates over elements of
13128     * `collection` from right to left.
13129     *
13130     * @static
13131     * @memberOf _
13132     * @since 2.0.0
13133     * @category Collection
13134     * @param {Array|Object} collection The collection to inspect.
13135     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13136     * @param {number} [fromIndex=collection.length-1] The index to search from.
13137     * @returns {*} Returns the matched element, else `undefined`.
13138     * @example
13139     *
13140     * _.findLast([1, 2, 3, 4], function(n) {
13141     *   return n % 2 == 1;
13142     * });
13143     * // => 3
13144     */
13145    var findLast = createFind(findLastIndex);
13146
13147    /**
13148     * Creates a flattened array of values by running each element in `collection`
13149     * thru `iteratee` and flattening the mapped results. The iteratee is invoked
13150     * with three arguments: (value, index|key, collection).
13151     *
13152     * @static
13153     * @memberOf _
13154     * @since 4.0.0
13155     * @category Collection
13156     * @param {Array|Object} collection The collection to iterate over.
13157     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13158     * @returns {Array} Returns the new flattened array.
13159     * @example
13160     *
13161     * function duplicate(n) {
13162     *   return [n, n];
13163     * }
13164     *
13165     * _.flatMap([1, 2], duplicate);
13166     * // => [1, 1, 2, 2]
13167     */
13168    function flatMap(collection, iteratee) {
13169      return baseFlatten(map(collection, iteratee), 1);
13170    }
13171
13172    /**
13173     * This method is like `_.flatMap` except that it recursively flattens the
13174     * mapped results.
13175     *
13176     * @static
13177     * @memberOf _
13178     * @since 4.7.0
13179     * @category Collection
13180     * @param {Array|Object} collection The collection to iterate over.
13181     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13182     * @returns {Array} Returns the new flattened array.
13183     * @example
13184     *
13185     * function duplicate(n) {
13186     *   return [[[n, n]]];
13187     * }
13188     *
13189     * _.flatMapDeep([1, 2], duplicate);
13190     * // => [1, 1, 2, 2]
13191     */
13192    function flatMapDeep(collection, iteratee) {
13193      return baseFlatten(map(collection, iteratee), INFINITY);
13194    }
13195
13196    /**
13197     * This method is like `_.flatMap` except that it recursively flattens the
13198     * mapped results up to `depth` times.
13199     *
13200     * @static
13201     * @memberOf _
13202     * @since 4.7.0
13203     * @category Collection
13204     * @param {Array|Object} collection The collection to iterate over.
13205     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13206     * @param {number} [depth=1] The maximum recursion depth.
13207     * @returns {Array} Returns the new flattened array.
13208     * @example
13209     *
13210     * function duplicate(n) {
13211     *   return [[[n, n]]];
13212     * }
13213     *
13214     * _.flatMapDepth([1, 2], duplicate, 2);
13215     * // => [[1, 1], [2, 2]]
13216     */
13217    function flatMapDepth(collection, iteratee, depth) {
13218      depth = depth === undefined ? 1 : toInteger(depth);
13219      return baseFlatten(map(collection, iteratee), depth);
13220    }
13221
13222    /**
13223     * Iterates over elements of `collection` and invokes `iteratee` for each element.
13224     * The iteratee is invoked with three arguments: (value, index|key, collection).
13225     * Iteratee functions may exit iteration early by explicitly returning `false`.
13226     *
13227     * **Note:** As with other "Collections" methods, objects with a "length"
13228     * property are iterated like arrays. To avoid this behavior use `_.forIn`
13229     * or `_.forOwn` for object iteration.
13230     *
13231     * @static
13232     * @memberOf _
13233     * @since 0.1.0
13234     * @alias each
13235     * @category Collection
13236     * @param {Array|Object} collection The collection to iterate over.
13237     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13238     * @returns {Array|Object} Returns `collection`.
13239     * @see _.forEachRight
13240     * @example
13241     *
13242     * _.forEach([1, 2], function(value) {
13243     *   console.log(value);
13244     * });
13245     * // => Logs `1` then `2`.
13246     *
13247     * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
13248     *   console.log(key);
13249     * });
13250     * // => Logs 'a' then 'b' (iteration order is not guaranteed).
13251     */
13252    function forEach(collection, iteratee) {
13253      var func = isArray(collection) ? arrayEach : baseEach;
13254      return func(collection, getIteratee(iteratee, 3));
13255    }
13256
13257    /**
13258     * This method is like `_.forEach` except that it iterates over elements of
13259     * `collection` from right to left.
13260     *
13261     * @static
13262     * @memberOf _
13263     * @since 2.0.0
13264     * @alias eachRight
13265     * @category Collection
13266     * @param {Array|Object} collection The collection to iterate over.
13267     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13268     * @returns {Array|Object} Returns `collection`.
13269     * @see _.forEach
13270     * @example
13271     *
13272     * _.forEachRight([1, 2], function(value) {
13273     *   console.log(value);
13274     * });
13275     * // => Logs `2` then `1`.
13276     */
13277    function forEachRight(collection, iteratee) {
13278      var func = isArray(collection) ? arrayEachRight : baseEachRight;
13279      return func(collection, getIteratee(iteratee, 3));
13280    }
13281
13282    /**
13283     * Creates an object composed of keys generated from the results of running
13284     * each element of `collection` thru `iteratee`. The order of grouped values
13285     * is determined by the order they occur in `collection`. The corresponding
13286     * value of each key is an array of elements responsible for generating the
13287     * key. The iteratee is invoked with one argument: (value).
13288     *
13289     * @static
13290     * @memberOf _
13291     * @since 0.1.0
13292     * @category Collection
13293     * @param {Array|Object} collection The collection to iterate over.
13294     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
13295     * @returns {Object} Returns the composed aggregate object.
13296     * @example
13297     *
13298     * _.groupBy([6.1, 4.2, 6.3], Math.floor);
13299     * // => { '4': [4.2], '6': [6.1, 6.3] }
13300     *
13301     * // The `_.property` iteratee shorthand.
13302     * _.groupBy(['one', 'two', 'three'], 'length');
13303     * // => { '3': ['one', 'two'], '5': ['three'] }
13304     */
13305    var groupBy = createAggregator(function(result, value, key) {
13306      if (hasOwnProperty.call(result, key)) {
13307        result[key].push(value);
13308      } else {
13309        baseAssignValue(result, key, [value]);
13310      }
13311    });
13312
13313    /**
13314     * Checks if `value` is in `collection`. If `collection` is a string, it's
13315     * checked for a substring of `value`, otherwise
13316     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
13317     * is used for equality comparisons. If `fromIndex` is negative, it's used as
13318     * the offset from the end of `collection`.
13319     *
13320     * @static
13321     * @memberOf _
13322     * @since 0.1.0
13323     * @category Collection
13324     * @param {Array|Object|string} collection The collection to inspect.
13325     * @param {*} value The value to search for.
13326     * @param {number} [fromIndex=0] The index to search from.
13327     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
13328     * @returns {boolean} Returns `true` if `value` is found, else `false`.
13329     * @example
13330     *
13331     * _.includes([1, 2, 3], 1);
13332     * // => true
13333     *
13334     * _.includes([1, 2, 3], 1, 2);
13335     * // => false
13336     *
13337     * _.includes({ 'a': 1, 'b': 2 }, 1);
13338     * // => true
13339     *
13340     * _.includes('abcd', 'bc');
13341     * // => true
13342     */
13343    function includes(collection, value, fromIndex, guard) {
13344      collection = isArrayLike(collection) ? collection : values(collection);
13345      fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
13346
13347      var length = collection.length;
13348      if (fromIndex < 0) {
13349        fromIndex = nativeMax(length + fromIndex, 0);
13350      }
13351      return isString(collection)
13352        ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
13353        : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
13354    }
13355
13356    /**
13357     * Invokes the method at `path` of each element in `collection`, returning
13358     * an array of the results of each invoked method. Any additional arguments
13359     * are provided to each invoked method. If `path` is a function, it's invoked
13360     * for, and `this` bound to, each element in `collection`.
13361     *
13362     * @static
13363     * @memberOf _
13364     * @since 4.0.0
13365     * @category Collection
13366     * @param {Array|Object} collection The collection to iterate over.
13367     * @param {Array|Function|string} path The path of the method to invoke or
13368     *  the function invoked per iteration.
13369     * @param {...*} [args] The arguments to invoke each method with.
13370     * @returns {Array} Returns the array of results.
13371     * @example
13372     *
13373     * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
13374     * // => [[1, 5, 7], [1, 2, 3]]
13375     *
13376     * _.invokeMap([123, 456], String.prototype.split, '');
13377     * // => [['1', '2', '3'], ['4', '5', '6']]
13378     */
13379    var invokeMap = baseRest(function(collection, path, args) {
13380      var index = -1,
13381          isFunc = typeof path == 'function',
13382          result = isArrayLike(collection) ? Array(collection.length) : [];
13383
13384      baseEach(collection, function(value) {
13385        result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
13386      });
13387      return result;
13388    });
13389
13390    /**
13391     * Creates an object composed of keys generated from the results of running
13392     * each element of `collection` thru `iteratee`. The corresponding value of
13393     * each key is the last element responsible for generating the key. The
13394     * iteratee is invoked with one argument: (value).
13395     *
13396     * @static
13397     * @memberOf _
13398     * @since 4.0.0
13399     * @category Collection
13400     * @param {Array|Object} collection The collection to iterate over.
13401     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
13402     * @returns {Object} Returns the composed aggregate object.
13403     * @example
13404     *
13405     * var array = [
13406     *   { 'dir': 'left', 'code': 97 },
13407     *   { 'dir': 'right', 'code': 100 }
13408     * ];
13409     *
13410     * _.keyBy(array, function(o) {
13411     *   return String.fromCharCode(o.code);
13412     * });
13413     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
13414     *
13415     * _.keyBy(array, 'dir');
13416     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
13417     */
13418    var keyBy = createAggregator(function(result, value, key) {
13419      baseAssignValue(result, key, value);
13420    });
13421
13422    /**
13423     * Creates an array of values by running each element in `collection` thru
13424     * `iteratee`. The iteratee is invoked with three arguments:
13425     * (value, index|key, collection).
13426     *
13427     * Many lodash methods are guarded to work as iteratees for methods like
13428     * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
13429     *
13430     * The guarded methods are:
13431     * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
13432     * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
13433     * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
13434     * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
13435     *
13436     * @static
13437     * @memberOf _
13438     * @since 0.1.0
13439     * @category Collection
13440     * @param {Array|Object} collection The collection to iterate over.
13441     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13442     * @returns {Array} Returns the new mapped array.
13443     * @example
13444     *
13445     * function square(n) {
13446     *   return n * n;
13447     * }
13448     *
13449     * _.map([4, 8], square);
13450     * // => [16, 64]
13451     *
13452     * _.map({ 'a': 4, 'b': 8 }, square);
13453     * // => [16, 64] (iteration order is not guaranteed)
13454     *
13455     * var users = [
13456     *   { 'user': 'barney' },
13457     *   { 'user': 'fred' }
13458     * ];
13459     *
13460     * // The `_.property` iteratee shorthand.
13461     * _.map(users, 'user');
13462     * // => ['barney', 'fred']
13463     */
13464    function map(collection, iteratee) {
13465      var func = isArray(collection) ? arrayMap : baseMap;
13466      return func(collection, getIteratee(iteratee, 3));
13467    }
13468
13469    /**
13470     * This method is like `_.sortBy` except that it allows specifying the sort
13471     * orders of the iteratees to sort by. If `orders` is unspecified, all values
13472     * are sorted in ascending order. Otherwise, specify an order of "desc" for
13473     * descending or "asc" for ascending sort order of corresponding values.
13474     *
13475     * @static
13476     * @memberOf _
13477     * @since 4.0.0
13478     * @category Collection
13479     * @param {Array|Object} collection The collection to iterate over.
13480     * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
13481     *  The iteratees to sort by.
13482     * @param {string[]} [orders] The sort orders of `iteratees`.
13483     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
13484     * @returns {Array} Returns the new sorted array.
13485     * @example
13486     *
13487     * var users = [
13488     *   { 'user': 'fred',   'age': 48 },
13489     *   { 'user': 'barney', 'age': 34 },
13490     *   { 'user': 'fred',   'age': 40 },
13491     *   { 'user': 'barney', 'age': 36 }
13492     * ];
13493     *
13494     * // Sort by `user` in ascending order and by `age` in descending order.
13495     * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
13496     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
13497     */
13498    function orderBy(collection, iteratees, orders, guard) {
13499      if (collection == null) {
13500        return [];
13501      }
13502      if (!isArray(iteratees)) {
13503        iteratees = iteratees == null ? [] : [iteratees];
13504      }
13505      orders = guard ? undefined : orders;
13506      if (!isArray(orders)) {
13507        orders = orders == null ? [] : [orders];
13508      }
13509      return baseOrderBy(collection, iteratees, orders);
13510    }
13511
13512    /**
13513     * Creates an array of elements split into two groups, the first of which
13514     * contains elements `predicate` returns truthy for, the second of which
13515     * contains elements `predicate` returns falsey for. The predicate is
13516     * invoked with one argument: (value).
13517     *
13518     * @static
13519     * @memberOf _
13520     * @since 3.0.0
13521     * @category Collection
13522     * @param {Array|Object} collection The collection to iterate over.
13523     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13524     * @returns {Array} Returns the array of grouped elements.
13525     * @example
13526     *
13527     * var users = [
13528     *   { 'user': 'barney',  'age': 36, 'active': false },
13529     *   { 'user': 'fred',    'age': 40, 'active': true },
13530     *   { 'user': 'pebbles', 'age': 1,  'active': false }
13531     * ];
13532     *
13533     * _.partition(users, function(o) { return o.active; });
13534     * // => objects for [['fred'], ['barney', 'pebbles']]
13535     *
13536     * // The `_.matches` iteratee shorthand.
13537     * _.partition(users, { 'age': 1, 'active': false });
13538     * // => objects for [['pebbles'], ['barney', 'fred']]
13539     *
13540     * // The `_.matchesProperty` iteratee shorthand.
13541     * _.partition(users, ['active', false]);
13542     * // => objects for [['barney', 'pebbles'], ['fred']]
13543     *
13544     * // The `_.property` iteratee shorthand.
13545     * _.partition(users, 'active');
13546     * // => objects for [['fred'], ['barney', 'pebbles']]
13547     */
13548    var partition = createAggregator(function(result, value, key) {
13549      result[key ? 0 : 1].push(value);
13550    }, function() { return [[], []]; });
13551
13552    /**
13553     * Reduces `collection` to a value which is the accumulated result of running
13554     * each element in `collection` thru `iteratee`, where each successive
13555     * invocation is supplied the return value of the previous. If `accumulator`
13556     * is not given, the first element of `collection` is used as the initial
13557     * value. The iteratee is invoked with four arguments:
13558     * (accumulator, value, index|key, collection).
13559     *
13560     * Many lodash methods are guarded to work as iteratees for methods like
13561     * `_.reduce`, `_.reduceRight`, and `_.transform`.
13562     *
13563     * The guarded methods are:
13564     * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
13565     * and `sortBy`
13566     *
13567     * @static
13568     * @memberOf _
13569     * @since 0.1.0
13570     * @category Collection
13571     * @param {Array|Object} collection The collection to iterate over.
13572     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13573     * @param {*} [accumulator] The initial value.
13574     * @returns {*} Returns the accumulated value.
13575     * @see _.reduceRight
13576     * @example
13577     *
13578     * _.reduce([1, 2], function(sum, n) {
13579     *   return sum + n;
13580     * }, 0);
13581     * // => 3
13582     *
13583     * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
13584     *   (result[value] || (result[value] = [])).push(key);
13585     *   return result;
13586     * }, {});
13587     * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
13588     */
13589    function reduce(collection, iteratee, accumulator) {
13590      var func = isArray(collection) ? arrayReduce : baseReduce,
13591          initAccum = arguments.length < 3;
13592
13593      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
13594    }
13595
13596    /**
13597     * This method is like `_.reduce` except that it iterates over elements of
13598     * `collection` from right to left.
13599     *
13600     * @static
13601     * @memberOf _
13602     * @since 0.1.0
13603     * @category Collection
13604     * @param {Array|Object} collection The collection to iterate over.
13605     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13606     * @param {*} [accumulator] The initial value.
13607     * @returns {*} Returns the accumulated value.
13608     * @see _.reduce
13609     * @example
13610     *
13611     * var array = [[0, 1], [2, 3], [4, 5]];
13612     *
13613     * _.reduceRight(array, function(flattened, other) {
13614     *   return flattened.concat(other);
13615     * }, []);
13616     * // => [4, 5, 2, 3, 0, 1]
13617     */
13618    function reduceRight(collection, iteratee, accumulator) {
13619      var func = isArray(collection) ? arrayReduceRight : baseReduce,
13620          initAccum = arguments.length < 3;
13621
13622      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
13623    }
13624
13625    /**
13626     * The opposite of `_.filter`; this method returns the elements of `collection`
13627     * that `predicate` does **not** return truthy for.
13628     *
13629     * @static
13630     * @memberOf _
13631     * @since 0.1.0
13632     * @category Collection
13633     * @param {Array|Object} collection The collection to iterate over.
13634     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13635     * @returns {Array} Returns the new filtered array.
13636     * @see _.filter
13637     * @example
13638     *
13639     * var users = [
13640     *   { 'user': 'barney', 'age': 36, 'active': false },
13641     *   { 'user': 'fred',   'age': 40, 'active': true }
13642     * ];
13643     *
13644     * _.reject(users, function(o) { return !o.active; });
13645     * // => objects for ['fred']
13646     *
13647     * // The `_.matches` iteratee shorthand.
13648     * _.reject(users, { 'age': 40, 'active': true });
13649     * // => objects for ['barney']
13650     *
13651     * // The `_.matchesProperty` iteratee shorthand.
13652     * _.reject(users, ['active', false]);
13653     * // => objects for ['fred']
13654     *
13655     * // The `_.property` iteratee shorthand.
13656     * _.reject(users, 'active');
13657     * // => objects for ['barney']
13658     */
13659    function reject(collection, predicate) {
13660      var func = isArray(collection) ? arrayFilter : baseFilter;
13661      return func(collection, negate(getIteratee(predicate, 3)));
13662    }
13663
13664    /**
13665     * Gets a random element from `collection`.
13666     *
13667     * @static
13668     * @memberOf _
13669     * @since 2.0.0
13670     * @category Collection
13671     * @param {Array|Object} collection The collection to sample.
13672     * @returns {*} Returns the random element.
13673     * @example
13674     *
13675     * _.sample([1, 2, 3, 4]);
13676     * // => 2
13677     */
13678    function sample(collection) {
13679      var func = isArray(collection) ? arraySample : baseSample;
13680      return func(collection);
13681    }
13682
13683    /**
13684     * Gets `n` random elements at unique keys from `collection` up to the
13685     * size of `collection`.
13686     *
13687     * @static
13688     * @memberOf _
13689     * @since 4.0.0
13690     * @category Collection
13691     * @param {Array|Object} collection The collection to sample.
13692     * @param {number} [n=1] The number of elements to sample.
13693     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
13694     * @returns {Array} Returns the random elements.
13695     * @example
13696     *
13697     * _.sampleSize([1, 2, 3], 2);
13698     * // => [3, 1]
13699     *
13700     * _.sampleSize([1, 2, 3], 4);
13701     * // => [2, 3, 1]
13702     */
13703    function sampleSize(collection, n, guard) {
13704      if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
13705        n = 1;
13706      } else {
13707        n = toInteger(n);
13708      }
13709      var func = isArray(collection) ? arraySampleSize : baseSampleSize;
13710      return func(collection, n);
13711    }
13712
13713    /**
13714     * Creates an array of shuffled values, using a version of the
13715     * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
13716     *
13717     * @static
13718     * @memberOf _
13719     * @since 0.1.0
13720     * @category Collection
13721     * @param {Array|Object} collection The collection to shuffle.
13722     * @returns {Array} Returns the new shuffled array.
13723     * @example
13724     *
13725     * _.shuffle([1, 2, 3, 4]);
13726     * // => [4, 1, 3, 2]
13727     */
13728    function shuffle(collection) {
13729      var func = isArray(collection) ? arrayShuffle : baseShuffle;
13730      return func(collection);
13731    }
13732
13733    /**
13734     * Gets the size of `collection` by returning its length for array-like
13735     * values or the number of own enumerable string keyed properties for objects.
13736     *
13737     * @static
13738     * @memberOf _
13739     * @since 0.1.0
13740     * @category Collection
13741     * @param {Array|Object|string} collection The collection to inspect.
13742     * @returns {number} Returns the collection size.
13743     * @example
13744     *
13745     * _.size([1, 2, 3]);
13746     * // => 3
13747     *
13748     * _.size({ 'a': 1, 'b': 2 });
13749     * // => 2
13750     *
13751     * _.size('pebbles');
13752     * // => 7
13753     */
13754    function size(collection) {
13755      if (collection == null) {
13756        return 0;
13757      }
13758      if (isArrayLike(collection)) {
13759        return isString(collection) ? stringSize(collection) : collection.length;
13760      }
13761      var tag = getTag(collection);
13762      if (tag == mapTag || tag == setTag) {
13763        return collection.size;
13764      }
13765      return baseKeys(collection).length;
13766    }
13767
13768    /**
13769     * Checks if `predicate` returns truthy for **any** element of `collection`.
13770     * Iteration is stopped once `predicate` returns truthy. The predicate is
13771     * invoked with three arguments: (value, index|key, collection).
13772     *
13773     * @static
13774     * @memberOf _
13775     * @since 0.1.0
13776     * @category Collection
13777     * @param {Array|Object} collection The collection to iterate over.
13778     * @param {Function} [predicate=_.identity] The function invoked per iteration.
13779     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
13780     * @returns {boolean} Returns `true` if any element passes the predicate check,
13781     *  else `false`.
13782     * @example
13783     *
13784     * _.some([null, 0, 'yes', false], Boolean);
13785     * // => true
13786     *
13787     * var users = [
13788     *   { 'user': 'barney', 'active': true },
13789     *   { 'user': 'fred',   'active': false }
13790     * ];
13791     *
13792     * // The `_.matches` iteratee shorthand.
13793     * _.some(users, { 'user': 'barney', 'active': false });
13794     * // => false
13795     *
13796     * // The `_.matchesProperty` iteratee shorthand.
13797     * _.some(users, ['active', false]);
13798     * // => true
13799     *
13800     * // The `_.property` iteratee shorthand.
13801     * _.some(users, 'active');
13802     * // => true
13803     */
13804    function some(collection, predicate, guard) {
13805      var func = isArray(collection) ? arraySome : baseSome;
13806      if (guard && isIterateeCall(collection, predicate, guard)) {
13807        predicate = undefined;
13808      }
13809      return func(collection, getIteratee(predicate, 3));
13810    }
13811
13812    /**
13813     * Creates an array of elements, sorted in ascending order by the results of
13814     * running each element in a collection thru each iteratee. This method
13815     * performs a stable sort, that is, it preserves the original sort order of
13816     * equal elements. The iteratees are invoked with one argument: (value).
13817     *
13818     * @static
13819     * @memberOf _
13820     * @since 0.1.0
13821     * @category Collection
13822     * @param {Array|Object} collection The collection to iterate over.
13823     * @param {...(Function|Function[])} [iteratees=[_.identity]]
13824     *  The iteratees to sort by.
13825     * @returns {Array} Returns the new sorted array.
13826     * @example
13827     *
13828     * var users = [
13829     *   { 'user': 'fred',   'age': 48 },
13830     *   { 'user': 'barney', 'age': 36 },
13831     *   { 'user': 'fred',   'age': 30 },
13832     *   { 'user': 'barney', 'age': 34 }
13833     * ];
13834     *
13835     * _.sortBy(users, [function(o) { return o.user; }]);
13836     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
13837     *
13838     * _.sortBy(users, ['user', 'age']);
13839     * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
13840     */
13841    var sortBy = baseRest(function(collection, iteratees) {
13842      if (collection == null) {
13843        return [];
13844      }
13845      var length = iteratees.length;
13846      if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
13847        iteratees = [];
13848      } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
13849        iteratees = [iteratees[0]];
13850      }
13851      return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
13852    });
13853
13854    /*------------------------------------------------------------------------*/
13855
13856    /**
13857     * Gets the timestamp of the number of milliseconds that have elapsed since
13858     * the Unix epoch (1 January 1970 00:00:00 UTC).
13859     *
13860     * @static
13861     * @memberOf _
13862     * @since 2.4.0
13863     * @category Date
13864     * @returns {number} Returns the timestamp.
13865     * @example
13866     *
13867     * _.defer(function(stamp) {
13868     *   console.log(_.now() - stamp);
13869     * }, _.now());
13870     * // => Logs the number of milliseconds it took for the deferred invocation.
13871     */
13872    var now = ctxNow || function() {
13873      return root.Date.now();
13874    };
13875
13876    /*------------------------------------------------------------------------*/
13877
13878    /**
13879     * The opposite of `_.before`; this method creates a function that invokes
13880     * `func` once it's called `n` or more times.
13881     *
13882     * @static
13883     * @memberOf _
13884     * @since 0.1.0
13885     * @category Function
13886     * @param {number} n The number of calls before `func` is invoked.
13887     * @param {Function} func The function to restrict.
13888     * @returns {Function} Returns the new restricted function.
13889     * @example
13890     *
13891     * var saves = ['profile', 'settings'];
13892     *
13893     * var done = _.after(saves.length, function() {
13894     *   console.log('done saving!');
13895     * });
13896     *
13897     * _.forEach(saves, function(type) {
13898     *   asyncSave({ 'type': type, 'complete': done });
13899     * });
13900     * // => Logs 'done saving!' after the two async saves have completed.
13901     */
13902    function after(n, func) {
13903      if (typeof func != 'function') {
13904        throw new TypeError(FUNC_ERROR_TEXT);
13905      }
13906      n = toInteger(n);
13907      return function() {
13908        if (--n < 1) {
13909          return func.apply(this, arguments);
13910        }
13911      };
13912    }
13913
13914    /**
13915     * Creates a function that invokes `func`, with up to `n` arguments,
13916     * ignoring any additional arguments.
13917     *
13918     * @static
13919     * @memberOf _
13920     * @since 3.0.0
13921     * @category Function
13922     * @param {Function} func The function to cap arguments for.
13923     * @param {number} [n=func.length] The arity cap.
13924     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
13925     * @returns {Function} Returns the new capped function.
13926     * @example
13927     *
13928     * _.map(['6', '8', '10'], _.ary(parseInt, 1));
13929     * // => [6, 8, 10]
13930     */
13931    function ary(func, n, guard) {
13932      n = guard ? undefined : n;
13933      n = (func && n == null) ? func.length : n;
13934      return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
13935    }
13936
13937    /**
13938     * Creates a function that invokes `func`, with the `this` binding and arguments
13939     * of the created function, while it's called less than `n` times. Subsequent
13940     * calls to the created function return the result of the last `func` invocation.
13941     *
13942     * @static
13943     * @memberOf _
13944     * @since 3.0.0
13945     * @category Function
13946     * @param {number} n The number of calls at which `func` is no longer invoked.
13947     * @param {Function} func The function to restrict.
13948     * @returns {Function} Returns the new restricted function.
13949     * @example
13950     *
13951     * jQuery(element).on('click', _.before(5, addContactToList));
13952     * // => Allows adding up to 4 contacts to the list.
13953     */
13954    function before(n, func) {
13955      var result;
13956      if (typeof func != 'function') {
13957        throw new TypeError(FUNC_ERROR_TEXT);
13958      }
13959      n = toInteger(n);
13960      return function() {
13961        if (--n > 0) {
13962          result = func.apply(this, arguments);
13963        }
13964        if (n <= 1) {
13965          func = undefined;
13966        }
13967        return result;
13968      };
13969    }
13970
13971    /**
13972     * Creates a function that invokes `func` with the `this` binding of `thisArg`
13973     * and `partials` prepended to the arguments it receives.
13974     *
13975     * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
13976     * may be used as a placeholder for partially applied arguments.
13977     *
13978     * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
13979     * property of bound functions.
13980     *
13981     * @static
13982     * @memberOf _
13983     * @since 0.1.0
13984     * @category Function
13985     * @param {Function} func The function to bind.
13986     * @param {*} thisArg The `this` binding of `func`.
13987     * @param {...*} [partials] The arguments to be partially applied.
13988     * @returns {Function} Returns the new bound function.
13989     * @example
13990     *
13991     * function greet(greeting, punctuation) {
13992     *   return greeting + ' ' + this.user + punctuation;
13993     * }
13994     *
13995     * var object = { 'user': 'fred' };
13996     *
13997     * var bound = _.bind(greet, object, 'hi');
13998     * bound('!');
13999     * // => 'hi fred!'
14000     *
14001     * // Bound with placeholders.
14002     * var bound = _.bind(greet, object, _, '!');
14003     * bound('hi');
14004     * // => 'hi fred!'
14005     */
14006    var bind = baseRest(function(func, thisArg, partials) {
14007      var bitmask = WRAP_BIND_FLAG;
14008      if (partials.length) {
14009        var holders = replaceHolders(partials, getHolder(bind));
14010        bitmask |= WRAP_PARTIAL_FLAG;
14011      }
14012      return createWrap(func, bitmask, thisArg, partials, holders);
14013    });
14014
14015    /**
14016     * Creates a function that invokes the method at `object[key]` with `partials`
14017     * prepended to the arguments it receives.
14018     *
14019     * This method differs from `_.bind` by allowing bound functions to reference
14020     * methods that may be redefined or don't yet exist. See
14021     * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
14022     * for more details.
14023     *
14024     * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
14025     * builds, may be used as a placeholder for partially applied arguments.
14026     *
14027     * @static
14028     * @memberOf _
14029     * @since 0.10.0
14030     * @category Function
14031     * @param {Object} object The object to invoke the method on.
14032     * @param {string} key The key of the method.
14033     * @param {...*} [partials] The arguments to be partially applied.
14034     * @returns {Function} Returns the new bound function.
14035     * @example
14036     *
14037     * var object = {
14038     *   'user': 'fred',
14039     *   'greet': function(greeting, punctuation) {
14040     *     return greeting + ' ' + this.user + punctuation;
14041     *   }
14042     * };
14043     *
14044     * var bound = _.bindKey(object, 'greet', 'hi');
14045     * bound('!');
14046     * // => 'hi fred!'
14047     *
14048     * object.greet = function(greeting, punctuation) {
14049     *   return greeting + 'ya ' + this.user + punctuation;
14050     * };
14051     *
14052     * bound('!');
14053     * // => 'hiya fred!'
14054     *
14055     * // Bound with placeholders.
14056     * var bound = _.bindKey(object, 'greet', _, '!');
14057     * bound('hi');
14058     * // => 'hiya fred!'
14059     */
14060    var bindKey = baseRest(function(object, key, partials) {
14061      var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
14062      if (partials.length) {
14063        var holders = replaceHolders(partials, getHolder(bindKey));
14064        bitmask |= WRAP_PARTIAL_FLAG;
14065      }
14066      return createWrap(key, bitmask, object, partials, holders);
14067    });
14068
14069    /**
14070     * Creates a function that accepts arguments of `func` and either invokes
14071     * `func` returning its result, if at least `arity` number of arguments have
14072     * been provided, or returns a function that accepts the remaining `func`
14073     * arguments, and so on. The arity of `func` may be specified if `func.length`
14074     * is not sufficient.
14075     *
14076     * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
14077     * may be used as a placeholder for provided arguments.
14078     *
14079     * **Note:** This method doesn't set the "length" property of curried functions.
14080     *
14081     * @static
14082     * @memberOf _
14083     * @since 2.0.0
14084     * @category Function
14085     * @param {Function} func The function to curry.
14086     * @param {number} [arity=func.length] The arity of `func`.
14087     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14088     * @returns {Function} Returns the new curried function.
14089     * @example
14090     *
14091     * var abc = function(a, b, c) {
14092     *   return [a, b, c];
14093     * };
14094     *
14095     * var curried = _.curry(abc);
14096     *
14097     * curried(1)(2)(3);
14098     * // => [1, 2, 3]
14099     *
14100     * curried(1, 2)(3);
14101     * // => [1, 2, 3]
14102     *
14103     * curried(1, 2, 3);
14104     * // => [1, 2, 3]
14105     *
14106     * // Curried with placeholders.
14107     * curried(1)(_, 3)(2);
14108     * // => [1, 2, 3]
14109     */
14110    function curry(func, arity, guard) {
14111      arity = guard ? undefined : arity;
14112      var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
14113      result.placeholder = curry.placeholder;
14114      return result;
14115    }
14116
14117    /**
14118     * This method is like `_.curry` except that arguments are applied to `func`
14119     * in the manner of `_.partialRight` instead of `_.partial`.
14120     *
14121     * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
14122     * builds, may be used as a placeholder for provided arguments.
14123     *
14124     * **Note:** This method doesn't set the "length" property of curried functions.
14125     *
14126     * @static
14127     * @memberOf _
14128     * @since 3.0.0
14129     * @category Function
14130     * @param {Function} func The function to curry.
14131     * @param {number} [arity=func.length] The arity of `func`.
14132     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14133     * @returns {Function} Returns the new curried function.
14134     * @example
14135     *
14136     * var abc = function(a, b, c) {
14137     *   return [a, b, c];
14138     * };
14139     *
14140     * var curried = _.curryRight(abc);
14141     *
14142     * curried(3)(2)(1);
14143     * // => [1, 2, 3]
14144     *
14145     * curried(2, 3)(1);
14146     * // => [1, 2, 3]
14147     *
14148     * curried(1, 2, 3);
14149     * // => [1, 2, 3]
14150     *
14151     * // Curried with placeholders.
14152     * curried(3)(1, _)(2);
14153     * // => [1, 2, 3]
14154     */
14155    function curryRight(func, arity, guard) {
14156      arity = guard ? undefined : arity;
14157      var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
14158      result.placeholder = curryRight.placeholder;
14159      return result;
14160    }
14161
14162    /**
14163     * Creates a debounced function that delays invoking `func` until after `wait`
14164     * milliseconds have elapsed since the last time the debounced function was
14165     * invoked. The debounced function comes with a `cancel` method to cancel
14166     * delayed `func` invocations and a `flush` method to immediately invoke them.
14167     * Provide `options` to indicate whether `func` should be invoked on the
14168     * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
14169     * with the last arguments provided to the debounced function. Subsequent
14170     * calls to the debounced function return the result of the last `func`
14171     * invocation.
14172     *
14173     * **Note:** If `leading` and `trailing` options are `true`, `func` is
14174     * invoked on the trailing edge of the timeout only if the debounced function
14175     * is invoked more than once during the `wait` timeout.
14176     *
14177     * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
14178     * until to the next tick, similar to `setTimeout` with a timeout of `0`.
14179     *
14180     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
14181     * for details over the differences between `_.debounce` and `_.throttle`.
14182     *
14183     * @static
14184     * @memberOf _
14185     * @since 0.1.0
14186     * @category Function
14187     * @param {Function} func The function to debounce.
14188     * @param {number} [wait=0] The number of milliseconds to delay.
14189     * @param {Object} [options={}] The options object.
14190     * @param {boolean} [options.leading=false]
14191     *  Specify invoking on the leading edge of the timeout.
14192     * @param {number} [options.maxWait]
14193     *  The maximum time `func` is allowed to be delayed before it's invoked.
14194     * @param {boolean} [options.trailing=true]
14195     *  Specify invoking on the trailing edge of the timeout.
14196     * @returns {Function} Returns the new debounced function.
14197     * @example
14198     *
14199     * // Avoid costly calculations while the window size is in flux.
14200     * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
14201     *
14202     * // Invoke `sendMail` when clicked, debouncing subsequent calls.
14203     * jQuery(element).on('click', _.debounce(sendMail, 300, {
14204     *   'leading': true,
14205     *   'trailing': false
14206     * }));
14207     *
14208     * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
14209     * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
14210     * var source = new EventSource('/stream');
14211     * jQuery(source).on('message', debounced);
14212     *
14213     * // Cancel the trailing debounced invocation.
14214     * jQuery(window).on('popstate', debounced.cancel);
14215     */
14216    function debounce(func, wait, options) {
14217      var lastArgs,
14218          lastThis,
14219          maxWait,
14220          result,
14221          timerId,
14222          lastCallTime,
14223          lastInvokeTime = 0,
14224          leading = false,
14225          maxing = false,
14226          trailing = true;
14227
14228      if (typeof func != 'function') {
14229        throw new TypeError(FUNC_ERROR_TEXT);
14230      }
14231      wait = toNumber(wait) || 0;
14232      if (isObject(options)) {
14233        leading = !!options.leading;
14234        maxing = 'maxWait' in options;
14235        maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
14236        trailing = 'trailing' in options ? !!options.trailing : trailing;
14237      }
14238
14239      function invokeFunc(time) {
14240        var args = lastArgs,
14241            thisArg = lastThis;
14242
14243        lastArgs = lastThis = undefined;
14244        lastInvokeTime = time;
14245        result = func.apply(thisArg, args);
14246        return result;
14247      }
14248
14249      function leadingEdge(time) {
14250        // Reset any `maxWait` timer.
14251        lastInvokeTime = time;
14252        // Start the timer for the trailing edge.
14253        timerId = setTimeout(timerExpired, wait);
14254        // Invoke the leading edge.
14255        return leading ? invokeFunc(time) : result;
14256      }
14257
14258      function remainingWait(time) {
14259        var timeSinceLastCall = time - lastCallTime,
14260            timeSinceLastInvoke = time - lastInvokeTime,
14261            timeWaiting = wait - timeSinceLastCall;
14262
14263        return maxing
14264          ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
14265          : timeWaiting;
14266      }
14267
14268      function shouldInvoke(time) {
14269        var timeSinceLastCall = time - lastCallTime,
14270            timeSinceLastInvoke = time - lastInvokeTime;
14271
14272        // Either this is the first call, activity has stopped and we're at the
14273        // trailing edge, the system time has gone backwards and we're treating
14274        // it as the trailing edge, or we've hit the `maxWait` limit.
14275        return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
14276          (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
14277      }
14278
14279      function timerExpired() {
14280        var time = now();
14281        if (shouldInvoke(time)) {
14282          return trailingEdge(time);
14283        }
14284        // Restart the timer.
14285        timerId = setTimeout(timerExpired, remainingWait(time));
14286      }
14287
14288      function trailingEdge(time) {
14289        timerId = undefined;
14290
14291        // Only invoke if we have `lastArgs` which means `func` has been
14292        // debounced at least once.
14293        if (trailing && lastArgs) {
14294          return invokeFunc(time);
14295        }
14296        lastArgs = lastThis = undefined;
14297        return result;
14298      }
14299
14300      function cancel() {
14301        if (timerId !== undefined) {
14302          clearTimeout(timerId);
14303        }
14304        lastInvokeTime = 0;
14305        lastArgs = lastCallTime = lastThis = timerId = undefined;
14306      }
14307
14308      function flush() {
14309        return timerId === undefined ? result : trailingEdge(now());
14310      }
14311
14312      function debounced() {
14313        var time = now(),
14314            isInvoking = shouldInvoke(time);
14315
14316        lastArgs = arguments;
14317        lastThis = this;
14318        lastCallTime = time;
14319
14320        if (isInvoking) {
14321          if (timerId === undefined) {
14322            return leadingEdge(lastCallTime);
14323          }
14324          if (maxing) {
14325            // Handle invocations in a tight loop.
14326            clearTimeout(timerId);
14327            timerId = setTimeout(timerExpired, wait);
14328            return invokeFunc(lastCallTime);
14329          }
14330        }
14331        if (timerId === undefined) {
14332          timerId = setTimeout(timerExpired, wait);
14333        }
14334        return result;
14335      }
14336      debounced.cancel = cancel;
14337      debounced.flush = flush;
14338      return debounced;
14339    }
14340
14341    /**
14342     * Defers invoking the `func` until the current call stack has cleared. Any
14343     * additional arguments are provided to `func` when it's invoked.
14344     *
14345     * @static
14346     * @memberOf _
14347     * @since 0.1.0
14348     * @category Function
14349     * @param {Function} func The function to defer.
14350     * @param {...*} [args] The arguments to invoke `func` with.
14351     * @returns {number} Returns the timer id.
14352     * @example
14353     *
14354     * _.defer(function(text) {
14355     *   console.log(text);
14356     * }, 'deferred');
14357     * // => Logs 'deferred' after one millisecond.
14358     */
14359    var defer = baseRest(function(func, args) {
14360      return baseDelay(func, 1, args);
14361    });
14362
14363    /**
14364     * Invokes `func` after `wait` milliseconds. Any additional arguments are
14365     * provided to `func` when it's invoked.
14366     *
14367     * @static
14368     * @memberOf _
14369     * @since 0.1.0
14370     * @category Function
14371     * @param {Function} func The function to delay.
14372     * @param {number} wait The number of milliseconds to delay invocation.
14373     * @param {...*} [args] The arguments to invoke `func` with.
14374     * @returns {number} Returns the timer id.
14375     * @example
14376     *
14377     * _.delay(function(text) {
14378     *   console.log(text);
14379     * }, 1000, 'later');
14380     * // => Logs 'later' after one second.
14381     */
14382    var delay = baseRest(function(func, wait, args) {
14383      return baseDelay(func, toNumber(wait) || 0, args);
14384    });
14385
14386    /**
14387     * Creates a function that invokes `func` with arguments reversed.
14388     *
14389     * @static
14390     * @memberOf _
14391     * @since 4.0.0
14392     * @category Function
14393     * @param {Function} func The function to flip arguments for.
14394     * @returns {Function} Returns the new flipped function.
14395     * @example
14396     *
14397     * var flipped = _.flip(function() {
14398     *   return _.toArray(arguments);
14399     * });
14400     *
14401     * flipped('a', 'b', 'c', 'd');
14402     * // => ['d', 'c', 'b', 'a']
14403     */
14404    function flip(func) {
14405      return createWrap(func, WRAP_FLIP_FLAG);
14406    }
14407
14408    /**
14409     * Creates a function that memoizes the result of `func`. If `resolver` is
14410     * provided, it determines the cache key for storing the result based on the
14411     * arguments provided to the memoized function. By default, the first argument
14412     * provided to the memoized function is used as the map cache key. The `func`
14413     * is invoked with the `this` binding of the memoized function.
14414     *
14415     * **Note:** The cache is exposed as the `cache` property on the memoized
14416     * function. Its creation may be customized by replacing the `_.memoize.Cache`
14417     * constructor with one whose instances implement the
14418     * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
14419     * method interface of `clear`, `delete`, `get`, `has`, and `set`.
14420     *
14421     * @static
14422     * @memberOf _
14423     * @since 0.1.0
14424     * @category Function
14425     * @param {Function} func The function to have its output memoized.
14426     * @param {Function} [resolver] The function to resolve the cache key.
14427     * @returns {Function} Returns the new memoized function.
14428     * @example
14429     *
14430     * var object = { 'a': 1, 'b': 2 };
14431     * var other = { 'c': 3, 'd': 4 };
14432     *
14433     * var values = _.memoize(_.values);
14434     * values(object);
14435     * // => [1, 2]
14436     *
14437     * values(other);
14438     * // => [3, 4]
14439     *
14440     * object.a = 2;
14441     * values(object);
14442     * // => [1, 2]
14443     *
14444     * // Modify the result cache.
14445     * values.cache.set(object, ['a', 'b']);
14446     * values(object);
14447     * // => ['a', 'b']
14448     *
14449     * // Replace `_.memoize.Cache`.
14450     * _.memoize.Cache = WeakMap;
14451     */
14452    function memoize(func, resolver) {
14453      if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
14454        throw new TypeError(FUNC_ERROR_TEXT);
14455      }
14456      var memoized = function() {
14457        var args = arguments,
14458            key = resolver ? resolver.apply(this, args) : args[0],
14459            cache = memoized.cache;
14460
14461        if (cache.has(key)) {
14462          return cache.get(key);
14463        }
14464        var result = func.apply(this, args);
14465        memoized.cache = cache.set(key, result) || cache;
14466        return result;
14467      };
14468      memoized.cache = new (memoize.Cache || MapCache);
14469      return memoized;
14470    }
14471
14472    // Expose `MapCache`.
14473    memoize.Cache = MapCache;
14474
14475    /**
14476     * Creates a function that negates the result of the predicate `func`. The
14477     * `func` predicate is invoked with the `this` binding and arguments of the
14478     * created function.
14479     *
14480     * @static
14481     * @memberOf _
14482     * @since 3.0.0
14483     * @category Function
14484     * @param {Function} predicate The predicate to negate.
14485     * @returns {Function} Returns the new negated function.
14486     * @example
14487     *
14488     * function isEven(n) {
14489     *   return n % 2 == 0;
14490     * }
14491     *
14492     * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
14493     * // => [1, 3, 5]
14494     */
14495    function negate(predicate) {
14496      if (typeof predicate != 'function') {
14497        throw new TypeError(FUNC_ERROR_TEXT);
14498      }
14499      return function() {
14500        var args = arguments;
14501        switch (args.length) {
14502          case 0: return !predicate.call(this);
14503          case 1: return !predicate.call(this, args[0]);
14504          case 2: return !predicate.call(this, args[0], args[1]);
14505          case 3: return !predicate.call(this, args[0], args[1], args[2]);
14506        }
14507        return !predicate.apply(this, args);
14508      };
14509    }
14510
14511    /**
14512     * Creates a function that is restricted to invoking `func` once. Repeat calls
14513     * to the function return the value of the first invocation. The `func` is
14514     * invoked with the `this` binding and arguments of the created function.
14515     *
14516     * @static
14517     * @memberOf _
14518     * @since 0.1.0
14519     * @category Function
14520     * @param {Function} func The function to restrict.
14521     * @returns {Function} Returns the new restricted function.
14522     * @example
14523     *
14524     * var initialize = _.once(createApplication);
14525     * initialize();
14526     * initialize();
14527     * // => `createApplication` is invoked once
14528     */
14529    function once(func) {
14530      return before(2, func);
14531    }
14532
14533    /**
14534     * Creates a function that invokes `func` with its arguments transformed.
14535     *
14536     * @static
14537     * @since 4.0.0
14538     * @memberOf _
14539     * @category Function
14540     * @param {Function} func The function to wrap.
14541     * @param {...(Function|Function[])} [transforms=[_.identity]]
14542     *  The argument transforms.
14543     * @returns {Function} Returns the new function.
14544     * @example
14545     *
14546     * function doubled(n) {
14547     *   return n * 2;
14548     * }
14549     *
14550     * function square(n) {
14551     *   return n * n;
14552     * }
14553     *
14554     * var func = _.overArgs(function(x, y) {
14555     *   return [x, y];
14556     * }, [square, doubled]);
14557     *
14558     * func(9, 3);
14559     * // => [81, 6]
14560     *
14561     * func(10, 5);
14562     * // => [100, 10]
14563     */
14564    var overArgs = castRest(function(func, transforms) {
14565      transforms = (transforms.length == 1 && isArray(transforms[0]))
14566        ? arrayMap(transforms[0], baseUnary(getIteratee()))
14567        : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
14568
14569      var funcsLength = transforms.length;
14570      return baseRest(function(args) {
14571        var index = -1,
14572            length = nativeMin(args.length, funcsLength);
14573
14574        while (++index < length) {
14575          args[index] = transforms[index].call(this, args[index]);
14576        }
14577        return apply(func, this, args);
14578      });
14579    });
14580
14581    /**
14582     * Creates a function that invokes `func` with `partials` prepended to the
14583     * arguments it receives. This method is like `_.bind` except it does **not**
14584     * alter the `this` binding.
14585     *
14586     * The `_.partial.placeholder` value, which defaults to `_` in monolithic
14587     * builds, may be used as a placeholder for partially applied arguments.
14588     *
14589     * **Note:** This method doesn't set the "length" property of partially
14590     * applied functions.
14591     *
14592     * @static
14593     * @memberOf _
14594     * @since 0.2.0
14595     * @category Function
14596     * @param {Function} func The function to partially apply arguments to.
14597     * @param {...*} [partials] The arguments to be partially applied.
14598     * @returns {Function} Returns the new partially applied function.
14599     * @example
14600     *
14601     * function greet(greeting, name) {
14602     *   return greeting + ' ' + name;
14603     * }
14604     *
14605     * var sayHelloTo = _.partial(greet, 'hello');
14606     * sayHelloTo('fred');
14607     * // => 'hello fred'
14608     *
14609     * // Partially applied with placeholders.
14610     * var greetFred = _.partial(greet, _, 'fred');
14611     * greetFred('hi');
14612     * // => 'hi fred'
14613     */
14614    var partial = baseRest(function(func, partials) {
14615      var holders = replaceHolders(partials, getHolder(partial));
14616      return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
14617    });
14618
14619    /**
14620     * This method is like `_.partial` except that partially applied arguments
14621     * are appended to the arguments it receives.
14622     *
14623     * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
14624     * builds, may be used as a placeholder for partially applied arguments.
14625     *
14626     * **Note:** This method doesn't set the "length" property of partially
14627     * applied functions.
14628     *
14629     * @static
14630     * @memberOf _
14631     * @since 1.0.0
14632     * @category Function
14633     * @param {Function} func The function to partially apply arguments to.
14634     * @param {...*} [partials] The arguments to be partially applied.
14635     * @returns {Function} Returns the new partially applied function.
14636     * @example
14637     *
14638     * function greet(greeting, name) {
14639     *   return greeting + ' ' + name;
14640     * }
14641     *
14642     * var greetFred = _.partialRight(greet, 'fred');
14643     * greetFred('hi');
14644     * // => 'hi fred'
14645     *
14646     * // Partially applied with placeholders.
14647     * var sayHelloTo = _.partialRight(greet, 'hello', _);
14648     * sayHelloTo('fred');
14649     * // => 'hello fred'
14650     */
14651    var partialRight = baseRest(function(func, partials) {
14652      var holders = replaceHolders(partials, getHolder(partialRight));
14653      return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
14654    });
14655
14656    /**
14657     * Creates a function that invokes `func` with arguments arranged according
14658     * to the specified `indexes` where the argument value at the first index is
14659     * provided as the first argument, the argument value at the second index is
14660     * provided as the second argument, and so on.
14661     *
14662     * @static
14663     * @memberOf _
14664     * @since 3.0.0
14665     * @category Function
14666     * @param {Function} func The function to rearrange arguments for.
14667     * @param {...(number|number[])} indexes The arranged argument indexes.
14668     * @returns {Function} Returns the new function.
14669     * @example
14670     *
14671     * var rearged = _.rearg(function(a, b, c) {
14672     *   return [a, b, c];
14673     * }, [2, 0, 1]);
14674     *
14675     * rearged('b', 'c', 'a')
14676     * // => ['a', 'b', 'c']
14677     */
14678    var rearg = flatRest(function(func, indexes) {
14679      return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
14680    });
14681
14682    /**
14683     * Creates a function that invokes `func` with the `this` binding of the
14684     * created function and arguments from `start` and beyond provided as
14685     * an array.
14686     *
14687     * **Note:** This method is based on the
14688     * [rest parameter](https://mdn.io/rest_parameters).
14689     *
14690     * @static
14691     * @memberOf _
14692     * @since 4.0.0
14693     * @category Function
14694     * @param {Function} func The function to apply a rest parameter to.
14695     * @param {number} [start=func.length-1] The start position of the rest parameter.
14696     * @returns {Function} Returns the new function.
14697     * @example
14698     *
14699     * var say = _.rest(function(what, names) {
14700     *   return what + ' ' + _.initial(names).join(', ') +
14701     *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
14702     * });
14703     *
14704     * say('hello', 'fred', 'barney', 'pebbles');
14705     * // => 'hello fred, barney, & pebbles'
14706     */
14707    function rest(func, start) {
14708      if (typeof func != 'function') {
14709        throw new TypeError(FUNC_ERROR_TEXT);
14710      }
14711      start = start === undefined ? start : toInteger(start);
14712      return baseRest(func, start);
14713    }
14714
14715    /**
14716     * Creates a function that invokes `func` with the `this` binding of the
14717     * create function and an array of arguments much like
14718     * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
14719     *
14720     * **Note:** This method is based on the
14721     * [spread operator](https://mdn.io/spread_operator).
14722     *
14723     * @static
14724     * @memberOf _
14725     * @since 3.2.0
14726     * @category Function
14727     * @param {Function} func The function to spread arguments over.
14728     * @param {number} [start=0] The start position of the spread.
14729     * @returns {Function} Returns the new function.
14730     * @example
14731     *
14732     * var say = _.spread(function(who, what) {
14733     *   return who + ' says ' + what;
14734     * });
14735     *
14736     * say(['fred', 'hello']);
14737     * // => 'fred says hello'
14738     *
14739     * var numbers = Promise.all([
14740     *   Promise.resolve(40),
14741     *   Promise.resolve(36)
14742     * ]);
14743     *
14744     * numbers.then(_.spread(function(x, y) {
14745     *   return x + y;
14746     * }));
14747     * // => a Promise of 76
14748     */
14749    function spread(func, start) {
14750      if (typeof func != 'function') {
14751        throw new TypeError(FUNC_ERROR_TEXT);
14752      }
14753      start = start == null ? 0 : nativeMax(toInteger(start), 0);
14754      return baseRest(function(args) {
14755        var array = args[start],
14756            otherArgs = castSlice(args, 0, start);
14757
14758        if (array) {
14759          arrayPush(otherArgs, array);
14760        }
14761        return apply(func, this, otherArgs);
14762      });
14763    }
14764
14765    /**
14766     * Creates a throttled function that only invokes `func` at most once per
14767     * every `wait` milliseconds. The throttled function comes with a `cancel`
14768     * method to cancel delayed `func` invocations and a `flush` method to
14769     * immediately invoke them. Provide `options` to indicate whether `func`
14770     * should be invoked on the leading and/or trailing edge of the `wait`
14771     * timeout. The `func` is invoked with the last arguments provided to the
14772     * throttled function. Subsequent calls to the throttled function return the
14773     * result of the last `func` invocation.
14774     *
14775     * **Note:** If `leading` and `trailing` options are `true`, `func` is
14776     * invoked on the trailing edge of the timeout only if the throttled function
14777     * is invoked more than once during the `wait` timeout.
14778     *
14779     * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
14780     * until to the next tick, similar to `setTimeout` with a timeout of `0`.
14781     *
14782     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
14783     * for details over the differences between `_.throttle` and `_.debounce`.
14784     *
14785     * @static
14786     * @memberOf _
14787     * @since 0.1.0
14788     * @category Function
14789     * @param {Function} func The function to throttle.
14790     * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
14791     * @param {Object} [options={}] The options object.
14792     * @param {boolean} [options.leading=true]
14793     *  Specify invoking on the leading edge of the timeout.
14794     * @param {boolean} [options.trailing=true]
14795     *  Specify invoking on the trailing edge of the timeout.
14796     * @returns {Function} Returns the new throttled function.
14797     * @example
14798     *
14799     * // Avoid excessively updating the position while scrolling.
14800     * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
14801     *
14802     * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
14803     * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
14804     * jQuery(element).on('click', throttled);
14805     *
14806     * // Cancel the trailing throttled invocation.
14807     * jQuery(window).on('popstate', throttled.cancel);
14808     */
14809    function throttle(func, wait, options) {
14810      var leading = true,
14811          trailing = true;
14812
14813      if (typeof func != 'function') {
14814        throw new TypeError(FUNC_ERROR_TEXT);
14815      }
14816      if (isObject(options)) {
14817        leading = 'leading' in options ? !!options.leading : leading;
14818        trailing = 'trailing' in options ? !!options.trailing : trailing;
14819      }
14820      return debounce(func, wait, {
14821        'leading': leading,
14822        'maxWait': wait,
14823        'trailing': trailing
14824      });
14825    }
14826
14827    /**
14828     * Creates a function that accepts up to one argument, ignoring any
14829     * additional arguments.
14830     *
14831     * @static
14832     * @memberOf _
14833     * @since 4.0.0
14834     * @category Function
14835     * @param {Function} func The function to cap arguments for.
14836     * @returns {Function} Returns the new capped function.
14837     * @example
14838     *
14839     * _.map(['6', '8', '10'], _.unary(parseInt));
14840     * // => [6, 8, 10]
14841     */
14842    function unary(func) {
14843      return ary(func, 1);
14844    }
14845
14846    /**
14847     * Creates a function that provides `value` to `wrapper` as its first
14848     * argument. Any additional arguments provided to the function are appended
14849     * to those provided to the `wrapper`. The wrapper is invoked with the `this`
14850     * binding of the created function.
14851     *
14852     * @static
14853     * @memberOf _
14854     * @since 0.1.0
14855     * @category Function
14856     * @param {*} value The value to wrap.
14857     * @param {Function} [wrapper=identity] The wrapper function.
14858     * @returns {Function} Returns the new function.
14859     * @example
14860     *
14861     * var p = _.wrap(_.escape, function(func, text) {
14862     *   return '<p>' + func(text) + '</p>';
14863     * });
14864     *
14865     * p('fred, barney, & pebbles');
14866     * // => '<p>fred, barney, &amp; pebbles</p>'
14867     */
14868    function wrap(value, wrapper) {
14869      return partial(castFunction(wrapper), value);
14870    }
14871
14872    /*------------------------------------------------------------------------*/
14873
14874    /**
14875     * Casts `value` as an array if it's not one.
14876     *
14877     * @static
14878     * @memberOf _
14879     * @since 4.4.0
14880     * @category Lang
14881     * @param {*} value The value to inspect.
14882     * @returns {Array} Returns the cast array.
14883     * @example
14884     *
14885     * _.castArray(1);
14886     * // => [1]
14887     *
14888     * _.castArray({ 'a': 1 });
14889     * // => [{ 'a': 1 }]
14890     *
14891     * _.castArray('abc');
14892     * // => ['abc']
14893     *
14894     * _.castArray(null);
14895     * // => [null]
14896     *
14897     * _.castArray(undefined);
14898     * // => [undefined]
14899     *
14900     * _.castArray();
14901     * // => []
14902     *
14903     * var array = [1, 2, 3];
14904     * console.log(_.castArray(array) === array);
14905     * // => true
14906     */
14907    function castArray() {
14908      if (!arguments.length) {
14909        return [];
14910      }
14911      var value = arguments[0];
14912      return isArray(value) ? value : [value];
14913    }
14914
14915    /**
14916     * Creates a shallow clone of `value`.
14917     *
14918     * **Note:** This method is loosely based on the
14919     * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
14920     * and supports cloning arrays, array buffers, booleans, date objects, maps,
14921     * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
14922     * arrays. The own enumerable properties of `arguments` objects are cloned
14923     * as plain objects. An empty object is returned for uncloneable values such
14924     * as error objects, functions, DOM nodes, and WeakMaps.
14925     *
14926     * @static
14927     * @memberOf _
14928     * @since 0.1.0
14929     * @category Lang
14930     * @param {*} value The value to clone.
14931     * @returns {*} Returns the cloned value.
14932     * @see _.cloneDeep
14933     * @example
14934     *
14935     * var objects = [{ 'a': 1 }, { 'b': 2 }];
14936     *
14937     * var shallow = _.clone(objects);
14938     * console.log(shallow[0] === objects[0]);
14939     * // => true
14940     */
14941    function clone(value) {
14942      return baseClone(value, CLONE_SYMBOLS_FLAG);
14943    }
14944
14945    /**
14946     * This method is like `_.clone` except that it accepts `customizer` which
14947     * is invoked to produce the cloned value. If `customizer` returns `undefined`,
14948     * cloning is handled by the method instead. The `customizer` is invoked with
14949     * up to four arguments; (value [, index|key, object, stack]).
14950     *
14951     * @static
14952     * @memberOf _
14953     * @since 4.0.0
14954     * @category Lang
14955     * @param {*} value The value to clone.
14956     * @param {Function} [customizer] The function to customize cloning.
14957     * @returns {*} Returns the cloned value.
14958     * @see _.cloneDeepWith
14959     * @example
14960     *
14961     * function customizer(value) {
14962     *   if (_.isElement(value)) {
14963     *     return value.cloneNode(false);
14964     *   }
14965     * }
14966     *
14967     * var el = _.cloneWith(document.body, customizer);
14968     *
14969     * console.log(el === document.body);
14970     * // => false
14971     * console.log(el.nodeName);
14972     * // => 'BODY'
14973     * console.log(el.childNodes.length);
14974     * // => 0
14975     */
14976    function cloneWith(value, customizer) {
14977      customizer = typeof customizer == 'function' ? customizer : undefined;
14978      return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
14979    }
14980
14981    /**
14982     * This method is like `_.clone` except that it recursively clones `value`.
14983     *
14984     * @static
14985     * @memberOf _
14986     * @since 1.0.0
14987     * @category Lang
14988     * @param {*} value The value to recursively clone.
14989     * @returns {*} Returns the deep cloned value.
14990     * @see _.clone
14991     * @example
14992     *
14993     * var objects = [{ 'a': 1 }, { 'b': 2 }];
14994     *
14995     * var deep = _.cloneDeep(objects);
14996     * console.log(deep[0] === objects[0]);
14997     * // => false
14998     */
14999    function cloneDeep(value) {
15000      return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
15001    }
15002
15003    /**
15004     * This method is like `_.cloneWith` except that it recursively clones `value`.
15005     *
15006     * @static
15007     * @memberOf _
15008     * @since 4.0.0
15009     * @category Lang
15010     * @param {*} value The value to recursively clone.
15011     * @param {Function} [customizer] The function to customize cloning.
15012     * @returns {*} Returns the deep cloned value.
15013     * @see _.cloneWith
15014     * @example
15015     *
15016     * function customizer(value) {
15017     *   if (_.isElement(value)) {
15018     *     return value.cloneNode(true);
15019     *   }
15020     * }
15021     *
15022     * var el = _.cloneDeepWith(document.body, customizer);
15023     *
15024     * console.log(el === document.body);
15025     * // => false
15026     * console.log(el.nodeName);
15027     * // => 'BODY'
15028     * console.log(el.childNodes.length);
15029     * // => 20
15030     */
15031    function cloneDeepWith(value, customizer) {
15032      customizer = typeof customizer == 'function' ? customizer : undefined;
15033      return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
15034    }
15035
15036    /**
15037     * Checks if `object` conforms to `source` by invoking the predicate
15038     * properties of `source` with the corresponding property values of `object`.
15039     *
15040     * **Note:** This method is equivalent to `_.conforms` when `source` is
15041     * partially applied.
15042     *
15043     * @static
15044     * @memberOf _
15045     * @since 4.14.0
15046     * @category Lang
15047     * @param {Object} object The object to inspect.
15048     * @param {Object} source The object of property predicates to conform to.
15049     * @returns {boolean} Returns `true` if `object` conforms, else `false`.
15050     * @example
15051     *
15052     * var object = { 'a': 1, 'b': 2 };
15053     *
15054     * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
15055     * // => true
15056     *
15057     * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
15058     * // => false
15059     */
15060    function conformsTo(object, source) {
15061      return source == null || baseConformsTo(object, source, keys(source));
15062    }
15063
15064    /**
15065     * Performs a
15066     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
15067     * comparison between two values to determine if they are equivalent.
15068     *
15069     * @static
15070     * @memberOf _
15071     * @since 4.0.0
15072     * @category Lang
15073     * @param {*} value The value to compare.
15074     * @param {*} other The other value to compare.
15075     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
15076     * @example
15077     *
15078     * var object = { 'a': 1 };
15079     * var other = { 'a': 1 };
15080     *
15081     * _.eq(object, object);
15082     * // => true
15083     *
15084     * _.eq(object, other);
15085     * // => false
15086     *
15087     * _.eq('a', 'a');
15088     * // => true
15089     *
15090     * _.eq('a', Object('a'));
15091     * // => false
15092     *
15093     * _.eq(NaN, NaN);
15094     * // => true
15095     */
15096    function eq(value, other) {
15097      return value === other || (value !== value && other !== other);
15098    }
15099
15100    /**
15101     * Checks if `value` is greater than `other`.
15102     *
15103     * @static
15104     * @memberOf _
15105     * @since 3.9.0
15106     * @category Lang
15107     * @param {*} value The value to compare.
15108     * @param {*} other The other value to compare.
15109     * @returns {boolean} Returns `true` if `value` is greater than `other`,
15110     *  else `false`.
15111     * @see _.lt
15112     * @example
15113     *
15114     * _.gt(3, 1);
15115     * // => true
15116     *
15117     * _.gt(3, 3);
15118     * // => false
15119     *
15120     * _.gt(1, 3);
15121     * // => false
15122     */
15123    var gt = createRelationalOperation(baseGt);
15124
15125    /**
15126     * Checks if `value` is greater than or equal to `other`.
15127     *
15128     * @static
15129     * @memberOf _
15130     * @since 3.9.0
15131     * @category Lang
15132     * @param {*} value The value to compare.
15133     * @param {*} other The other value to compare.
15134     * @returns {boolean} Returns `true` if `value` is greater than or equal to
15135     *  `other`, else `false`.
15136     * @see _.lte
15137     * @example
15138     *
15139     * _.gte(3, 1);
15140     * // => true
15141     *
15142     * _.gte(3, 3);
15143     * // => true
15144     *
15145     * _.gte(1, 3);
15146     * // => false
15147     */
15148    var gte = createRelationalOperation(function(value, other) {
15149      return value >= other;
15150    });
15151
15152    /**
15153     * Checks if `value` is likely an `arguments` object.
15154     *
15155     * @static
15156     * @memberOf _
15157     * @since 0.1.0
15158     * @category Lang
15159     * @param {*} value The value to check.
15160     * @returns {boolean} Returns `true` if `value` is an `arguments` object,
15161     *  else `false`.
15162     * @example
15163     *
15164     * _.isArguments(function() { return arguments; }());
15165     * // => true
15166     *
15167     * _.isArguments([1, 2, 3]);
15168     * // => false
15169     */
15170    var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
15171      return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
15172        !propertyIsEnumerable.call(value, 'callee');
15173    };
15174
15175    /**
15176     * Checks if `value` is classified as an `Array` object.
15177     *
15178     * @static
15179     * @memberOf _
15180     * @since 0.1.0
15181     * @category Lang
15182     * @param {*} value The value to check.
15183     * @returns {boolean} Returns `true` if `value` is an array, else `false`.
15184     * @example
15185     *
15186     * _.isArray([1, 2, 3]);
15187     * // => true
15188     *
15189     * _.isArray(document.body.children);
15190     * // => false
15191     *
15192     * _.isArray('abc');
15193     * // => false
15194     *
15195     * _.isArray(_.noop);
15196     * // => false
15197     */
15198    var isArray = Array.isArray;
15199
15200    /**
15201     * Checks if `value` is classified as an `ArrayBuffer` object.
15202     *
15203     * @static
15204     * @memberOf _
15205     * @since 4.3.0
15206     * @category Lang
15207     * @param {*} value The value to check.
15208     * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
15209     * @example
15210     *
15211     * _.isArrayBuffer(new ArrayBuffer(2));
15212     * // => true
15213     *
15214     * _.isArrayBuffer(new Array(2));
15215     * // => false
15216     */
15217    var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
15218
15219    /**
15220     * Checks if `value` is array-like. A value is considered array-like if it's
15221     * not a function and has a `value.length` that's an integer greater than or
15222     * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
15223     *
15224     * @static
15225     * @memberOf _
15226     * @since 4.0.0
15227     * @category Lang
15228     * @param {*} value The value to check.
15229     * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
15230     * @example
15231     *
15232     * _.isArrayLike([1, 2, 3]);
15233     * // => true
15234     *
15235     * _.isArrayLike(document.body.children);
15236     * // => true
15237     *
15238     * _.isArrayLike('abc');
15239     * // => true
15240     *
15241     * _.isArrayLike(_.noop);
15242     * // => false
15243     */
15244    function isArrayLike(value) {
15245      return value != null && isLength(value.length) && !isFunction(value);
15246    }
15247
15248    /**
15249     * This method is like `_.isArrayLike` except that it also checks if `value`
15250     * is an object.
15251     *
15252     * @static
15253     * @memberOf _
15254     * @since 4.0.0
15255     * @category Lang
15256     * @param {*} value The value to check.
15257     * @returns {boolean} Returns `true` if `value` is an array-like object,
15258     *  else `false`.
15259     * @example
15260     *
15261     * _.isArrayLikeObject([1, 2, 3]);
15262     * // => true
15263     *
15264     * _.isArrayLikeObject(document.body.children);
15265     * // => true
15266     *
15267     * _.isArrayLikeObject('abc');
15268     * // => false
15269     *
15270     * _.isArrayLikeObject(_.noop);
15271     * // => false
15272     */
15273    function isArrayLikeObject(value) {
15274      return isObjectLike(value) && isArrayLike(value);
15275    }
15276
15277    /**
15278     * Checks if `value` is classified as a boolean primitive or object.
15279     *
15280     * @static
15281     * @memberOf _
15282     * @since 0.1.0
15283     * @category Lang
15284     * @param {*} value The value to check.
15285     * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
15286     * @example
15287     *
15288     * _.isBoolean(false);
15289     * // => true
15290     *
15291     * _.isBoolean(null);
15292     * // => false
15293     */
15294    function isBoolean(value) {
15295      return value === true || value === false ||
15296        (isObjectLike(value) && baseGetTag(value) == boolTag);
15297    }
15298
15299    /**
15300     * Checks if `value` is a buffer.
15301     *
15302     * @static
15303     * @memberOf _
15304     * @since 4.3.0
15305     * @category Lang
15306     * @param {*} value The value to check.
15307     * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
15308     * @example
15309     *
15310     * _.isBuffer(new Buffer(2));
15311     * // => true
15312     *
15313     * _.isBuffer(new Uint8Array(2));
15314     * // => false
15315     */
15316    var isBuffer = nativeIsBuffer || stubFalse;
15317
15318    /**
15319     * Checks if `value` is classified as a `Date` object.
15320     *
15321     * @static
15322     * @memberOf _
15323     * @since 0.1.0
15324     * @category Lang
15325     * @param {*} value The value to check.
15326     * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
15327     * @example
15328     *
15329     * _.isDate(new Date);
15330     * // => true
15331     *
15332     * _.isDate('Mon April 23 2012');
15333     * // => false
15334     */
15335    var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
15336
15337    /**
15338     * Checks if `value` is likely a DOM element.
15339     *
15340     * @static
15341     * @memberOf _
15342     * @since 0.1.0
15343     * @category Lang
15344     * @param {*} value The value to check.
15345     * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
15346     * @example
15347     *
15348     * _.isElement(document.body);
15349     * // => true
15350     *
15351     * _.isElement('<body>');
15352     * // => false
15353     */
15354    function isElement(value) {
15355      return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
15356    }
15357
15358    /**
15359     * Checks if `value` is an empty object, collection, map, or set.
15360     *
15361     * Objects are considered empty if they have no own enumerable string keyed
15362     * properties.
15363     *
15364     * Array-like values such as `arguments` objects, arrays, buffers, strings, or
15365     * jQuery-like collections are considered empty if they have a `length` of `0`.
15366     * Similarly, maps and sets are considered empty if they have a `size` of `0`.
15367     *
15368     * @static
15369     * @memberOf _
15370     * @since 0.1.0
15371     * @category Lang
15372     * @param {*} value The value to check.
15373     * @returns {boolean} Returns `true` if `value` is empty, else `false`.
15374     * @example
15375     *
15376     * _.isEmpty(null);
15377     * // => true
15378     *
15379     * _.isEmpty(true);
15380     * // => true
15381     *
15382     * _.isEmpty(1);
15383     * // => true
15384     *
15385     * _.isEmpty([1, 2, 3]);
15386     * // => false
15387     *
15388     * _.isEmpty({ 'a': 1 });
15389     * // => false
15390     */
15391    function isEmpty(value) {
15392      if (value == null) {
15393        return true;
15394      }
15395      if (isArrayLike(value) &&
15396          (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
15397            isBuffer(value) || isTypedArray(value) || isArguments(value))) {
15398        return !value.length;
15399      }
15400      var tag = getTag(value);
15401      if (tag == mapTag || tag == setTag) {
15402        return !value.size;
15403      }
15404      if (isPrototype(value)) {
15405        return !baseKeys(value).length;
15406      }
15407      for (var key in value) {
15408        if (hasOwnProperty.call(value, key)) {
15409          return false;
15410        }
15411      }
15412      return true;
15413    }
15414
15415    /**
15416     * Performs a deep comparison between two values to determine if they are
15417     * equivalent.
15418     *
15419     * **Note:** This method supports comparing arrays, array buffers, booleans,
15420     * date objects, error objects, maps, numbers, `Object` objects, regexes,
15421     * sets, strings, symbols, and typed arrays. `Object` objects are compared
15422     * by their own, not inherited, enumerable properties. Functions and DOM
15423     * nodes are compared by strict equality, i.e. `===`.
15424     *
15425     * @static
15426     * @memberOf _
15427     * @since 0.1.0
15428     * @category Lang
15429     * @param {*} value The value to compare.
15430     * @param {*} other The other value to compare.
15431     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
15432     * @example
15433     *
15434     * var object = { 'a': 1 };
15435     * var other = { 'a': 1 };
15436     *
15437     * _.isEqual(object, other);
15438     * // => true
15439     *
15440     * object === other;
15441     * // => false
15442     */
15443    function isEqual(value, other) {
15444      return baseIsEqual(value, other);
15445    }
15446
15447    /**
15448     * This method is like `_.isEqual` except that it accepts `customizer` which
15449     * is invoked to compare values. If `customizer` returns `undefined`, comparisons
15450     * are handled by the method instead. The `customizer` is invoked with up to
15451     * six arguments: (objValue, othValue [, index|key, object, other, stack]).
15452     *
15453     * @static
15454     * @memberOf _
15455     * @since 4.0.0
15456     * @category Lang
15457     * @param {*} value The value to compare.
15458     * @param {*} other The other value to compare.
15459     * @param {Function} [customizer] The function to customize comparisons.
15460     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
15461     * @example
15462     *
15463     * function isGreeting(value) {
15464     *   return /^h(?:i|ello)$/.test(value);
15465     * }
15466     *
15467     * function customizer(objValue, othValue) {
15468     *   if (isGreeting(objValue) && isGreeting(othValue)) {
15469     *     return true;
15470     *   }
15471     * }
15472     *
15473     * var array = ['hello', 'goodbye'];
15474     * var other = ['hi', 'goodbye'];
15475     *
15476     * _.isEqualWith(array, other, customizer);
15477     * // => true
15478     */
15479    function isEqualWith(value, other, customizer) {
15480      customizer = typeof customizer == 'function' ? customizer : undefined;
15481      var result = customizer ? customizer(value, other) : undefined;
15482      return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
15483    }
15484
15485    /**
15486     * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
15487     * `SyntaxError`, `TypeError`, or `URIError` object.
15488     *
15489     * @static
15490     * @memberOf _
15491     * @since 3.0.0
15492     * @category Lang
15493     * @param {*} value The value to check.
15494     * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
15495     * @example
15496     *
15497     * _.isError(new Error);
15498     * // => true
15499     *
15500     * _.isError(Error);
15501     * // => false
15502     */
15503    function isError(value) {
15504      if (!isObjectLike(value)) {
15505        return false;
15506      }
15507      var tag = baseGetTag(value);
15508      return tag == errorTag || tag == domExcTag ||
15509        (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
15510    }
15511
15512    /**
15513     * Checks if `value` is a finite primitive number.
15514     *
15515     * **Note:** This method is based on
15516     * [`Number.isFinite`](https://mdn.io/Number/isFinite).
15517     *
15518     * @static
15519     * @memberOf _
15520     * @since 0.1.0
15521     * @category Lang
15522     * @param {*} value The value to check.
15523     * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
15524     * @example
15525     *
15526     * _.isFinite(3);
15527     * // => true
15528     *
15529     * _.isFinite(Number.MIN_VALUE);
15530     * // => true
15531     *
15532     * _.isFinite(Infinity);
15533     * // => false
15534     *
15535     * _.isFinite('3');
15536     * // => false
15537     */
15538    function isFinite(value) {
15539      return typeof value == 'number' && nativeIsFinite(value);
15540    }
15541
15542    /**
15543     * Checks if `value` is classified as a `Function` object.
15544     *
15545     * @static
15546     * @memberOf _
15547     * @since 0.1.0
15548     * @category Lang
15549     * @param {*} value The value to check.
15550     * @returns {boolean} Returns `true` if `value` is a function, else `false`.
15551     * @example
15552     *
15553     * _.isFunction(_);
15554     * // => true
15555     *
15556     * _.isFunction(/abc/);
15557     * // => false
15558     */
15559    function isFunction(value) {
15560      if (!isObject(value)) {
15561        return false;
15562      }
15563      // The use of `Object#toString` avoids issues with the `typeof` operator
15564      // in Safari 9 which returns 'object' for typed arrays and other constructors.
15565      var tag = baseGetTag(value);
15566      return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
15567    }
15568
15569    /**
15570     * Checks if `value` is an integer.
15571     *
15572     * **Note:** This method is based on
15573     * [`Number.isInteger`](https://mdn.io/Number/isInteger).
15574     *
15575     * @static
15576     * @memberOf _
15577     * @since 4.0.0
15578     * @category Lang
15579     * @param {*} value The value to check.
15580     * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
15581     * @example
15582     *
15583     * _.isInteger(3);
15584     * // => true
15585     *
15586     * _.isInteger(Number.MIN_VALUE);
15587     * // => false
15588     *
15589     * _.isInteger(Infinity);
15590     * // => false
15591     *
15592     * _.isInteger('3');
15593     * // => false
15594     */
15595    function isInteger(value) {
15596      return typeof value == 'number' && value == toInteger(value);
15597    }
15598
15599    /**
15600     * Checks if `value` is a valid array-like length.
15601     *
15602     * **Note:** This method is loosely based on
15603     * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
15604     *
15605     * @static
15606     * @memberOf _
15607     * @since 4.0.0
15608     * @category Lang
15609     * @param {*} value The value to check.
15610     * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
15611     * @example
15612     *
15613     * _.isLength(3);
15614     * // => true
15615     *
15616     * _.isLength(Number.MIN_VALUE);
15617     * // => false
15618     *
15619     * _.isLength(Infinity);
15620     * // => false
15621     *
15622     * _.isLength('3');
15623     * // => false
15624     */
15625    function isLength(value) {
15626      return typeof value == 'number' &&
15627        value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
15628    }
15629
15630    /**
15631     * Checks if `value` is the
15632     * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
15633     * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
15634     *
15635     * @static
15636     * @memberOf _
15637     * @since 0.1.0
15638     * @category Lang
15639     * @param {*} value The value to check.
15640     * @returns {boolean} Returns `true` if `value` is an object, else `false`.
15641     * @example
15642     *
15643     * _.isObject({});
15644     * // => true
15645     *
15646     * _.isObject([1, 2, 3]);
15647     * // => true
15648     *
15649     * _.isObject(_.noop);
15650     * // => true
15651     *
15652     * _.isObject(null);
15653     * // => false
15654     */
15655    function isObject(value) {
15656      var type = typeof value;
15657      return value != null && (type == 'object' || type == 'function');
15658    }
15659
15660    /**
15661     * Checks if `value` is object-like. A value is object-like if it's not `null`
15662     * and has a `typeof` result of "object".
15663     *
15664     * @static
15665     * @memberOf _
15666     * @since 4.0.0
15667     * @category Lang
15668     * @param {*} value The value to check.
15669     * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
15670     * @example
15671     *
15672     * _.isObjectLike({});
15673     * // => true
15674     *
15675     * _.isObjectLike([1, 2, 3]);
15676     * // => true
15677     *
15678     * _.isObjectLike(_.noop);
15679     * // => false
15680     *
15681     * _.isObjectLike(null);
15682     * // => false
15683     */
15684    function isObjectLike(value) {
15685      return value != null && typeof value == 'object';
15686    }
15687
15688    /**
15689     * Checks if `value` is classified as a `Map` object.
15690     *
15691     * @static
15692     * @memberOf _
15693     * @since 4.3.0
15694     * @category Lang
15695     * @param {*} value The value to check.
15696     * @returns {boolean} Returns `true` if `value` is a map, else `false`.
15697     * @example
15698     *
15699     * _.isMap(new Map);
15700     * // => true
15701     *
15702     * _.isMap(new WeakMap);
15703     * // => false
15704     */
15705    var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
15706
15707    /**
15708     * Performs a partial deep comparison between `object` and `source` to
15709     * determine if `object` contains equivalent property values.
15710     *
15711     * **Note:** This method is equivalent to `_.matches` when `source` is
15712     * partially applied.
15713     *
15714     * Partial comparisons will match empty array and empty object `source`
15715     * values against any array or object value, respectively. See `_.isEqual`
15716     * for a list of supported value comparisons.
15717     *
15718     * @static
15719     * @memberOf _
15720     * @since 3.0.0
15721     * @category Lang
15722     * @param {Object} object The object to inspect.
15723     * @param {Object} source The object of property values to match.
15724     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
15725     * @example
15726     *
15727     * var object = { 'a': 1, 'b': 2 };
15728     *
15729     * _.isMatch(object, { 'b': 2 });
15730     * // => true
15731     *
15732     * _.isMatch(object, { 'b': 1 });
15733     * // => false
15734     */
15735    function isMatch(object, source) {
15736      return object === source || baseIsMatch(object, source, getMatchData(source));
15737    }
15738
15739    /**
15740     * This method is like `_.isMatch` except that it accepts `customizer` which
15741     * is invoked to compare values. If `customizer` returns `undefined`, comparisons
15742     * are handled by the method instead. The `customizer` is invoked with five
15743     * arguments: (objValue, srcValue, index|key, object, source).
15744     *
15745     * @static
15746     * @memberOf _
15747     * @since 4.0.0
15748     * @category Lang
15749     * @param {Object} object The object to inspect.
15750     * @param {Object} source The object of property values to match.
15751     * @param {Function} [customizer] The function to customize comparisons.
15752     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
15753     * @example
15754     *
15755     * function isGreeting(value) {
15756     *   return /^h(?:i|ello)$/.test(value);
15757     * }
15758     *
15759     * function customizer(objValue, srcValue) {
15760     *   if (isGreeting(objValue) && isGreeting(srcValue)) {
15761     *     return true;
15762     *   }
15763     * }
15764     *
15765     * var object = { 'greeting': 'hello' };
15766     * var source = { 'greeting': 'hi' };
15767     *
15768     * _.isMatchWith(object, source, customizer);
15769     * // => true
15770     */
15771    function isMatchWith(object, source, customizer) {
15772      customizer = typeof customizer == 'function' ? customizer : undefined;
15773      return baseIsMatch(object, source, getMatchData(source), customizer);
15774    }
15775
15776    /**
15777     * Checks if `value` is `NaN`.
15778     *
15779     * **Note:** This method is based on
15780     * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
15781     * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
15782     * `undefined` and other non-number values.
15783     *
15784     * @static
15785     * @memberOf _
15786     * @since 0.1.0
15787     * @category Lang
15788     * @param {*} value The value to check.
15789     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
15790     * @example
15791     *
15792     * _.isNaN(NaN);
15793     * // => true
15794     *
15795     * _.isNaN(new Number(NaN));
15796     * // => true
15797     *
15798     * isNaN(undefined);
15799     * // => true
15800     *
15801     * _.isNaN(undefined);
15802     * // => false
15803     */
15804    function isNaN(value) {
15805      // An `NaN` primitive is the only value that is not equal to itself.
15806      // Perform the `toStringTag` check first to avoid errors with some
15807      // ActiveX objects in IE.
15808      return isNumber(value) && value != +value;
15809    }
15810
15811    /**
15812     * Checks if `value` is a pristine native function.
15813     *
15814     * **Note:** This method can't reliably detect native functions in the presence
15815     * of the core-js package because core-js circumvents this kind of detection.
15816     * Despite multiple requests, the core-js maintainer has made it clear: any
15817     * attempt to fix the detection will be obstructed. As a result, we're left
15818     * with little choice but to throw an error. Unfortunately, this also affects
15819     * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
15820     * which rely on core-js.
15821     *
15822     * @static
15823     * @memberOf _
15824     * @since 3.0.0
15825     * @category Lang
15826     * @param {*} value The value to check.
15827     * @returns {boolean} Returns `true` if `value` is a native function,
15828     *  else `false`.
15829     * @example
15830     *
15831     * _.isNative(Array.prototype.push);
15832     * // => true
15833     *
15834     * _.isNative(_);
15835     * // => false
15836     */
15837    function isNative(value) {
15838      if (isMaskable(value)) {
15839        throw new Error(CORE_ERROR_TEXT);
15840      }
15841      return baseIsNative(value);
15842    }
15843
15844    /**
15845     * Checks if `value` is `null`.
15846     *
15847     * @static
15848     * @memberOf _
15849     * @since 0.1.0
15850     * @category Lang
15851     * @param {*} value The value to check.
15852     * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
15853     * @example
15854     *
15855     * _.isNull(null);
15856     * // => true
15857     *
15858     * _.isNull(void 0);
15859     * // => false
15860     */
15861    function isNull(value) {
15862      return value === null;
15863    }
15864
15865    /**
15866     * Checks if `value` is `null` or `undefined`.
15867     *
15868     * @static
15869     * @memberOf _
15870     * @since 4.0.0
15871     * @category Lang
15872     * @param {*} value The value to check.
15873     * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
15874     * @example
15875     *
15876     * _.isNil(null);
15877     * // => true
15878     *
15879     * _.isNil(void 0);
15880     * // => true
15881     *
15882     * _.isNil(NaN);
15883     * // => false
15884     */
15885    function isNil(value) {
15886      return value == null;
15887    }
15888
15889    /**
15890     * Checks if `value` is classified as a `Number` primitive or object.
15891     *
15892     * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
15893     * classified as numbers, use the `_.isFinite` method.
15894     *
15895     * @static
15896     * @memberOf _
15897     * @since 0.1.0
15898     * @category Lang
15899     * @param {*} value The value to check.
15900     * @returns {boolean} Returns `true` if `value` is a number, else `false`.
15901     * @example
15902     *
15903     * _.isNumber(3);
15904     * // => true
15905     *
15906     * _.isNumber(Number.MIN_VALUE);
15907     * // => true
15908     *
15909     * _.isNumber(Infinity);
15910     * // => true
15911     *
15912     * _.isNumber('3');
15913     * // => false
15914     */
15915    function isNumber(value) {
15916      return typeof value == 'number' ||
15917        (isObjectLike(value) && baseGetTag(value) == numberTag);
15918    }
15919
15920    /**
15921     * Checks if `value` is a plain object, that is, an object created by the
15922     * `Object` constructor or one with a `[[Prototype]]` of `null`.
15923     *
15924     * @static
15925     * @memberOf _
15926     * @since 0.8.0
15927     * @category Lang
15928     * @param {*} value The value to check.
15929     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
15930     * @example
15931     *
15932     * function Foo() {
15933     *   this.a = 1;
15934     * }
15935     *
15936     * _.isPlainObject(new Foo);
15937     * // => false
15938     *
15939     * _.isPlainObject([1, 2, 3]);
15940     * // => false
15941     *
15942     * _.isPlainObject({ 'x': 0, 'y': 0 });
15943     * // => true
15944     *
15945     * _.isPlainObject(Object.create(null));
15946     * // => true
15947     */
15948    function isPlainObject(value) {
15949      if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
15950        return false;
15951      }
15952      var proto = getPrototype(value);
15953      if (proto === null) {
15954        return true;
15955      }
15956      var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
15957      return typeof Ctor == 'function' && Ctor instanceof Ctor &&
15958        funcToString.call(Ctor) == objectCtorString;
15959    }
15960
15961    /**
15962     * Checks if `value` is classified as a `RegExp` object.
15963     *
15964     * @static
15965     * @memberOf _
15966     * @since 0.1.0
15967     * @category Lang
15968     * @param {*} value The value to check.
15969     * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
15970     * @example
15971     *
15972     * _.isRegExp(/abc/);
15973     * // => true
15974     *
15975     * _.isRegExp('/abc/');
15976     * // => false
15977     */
15978    var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
15979
15980    /**
15981     * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
15982     * double precision number which isn't the result of a rounded unsafe integer.
15983     *
15984     * **Note:** This method is based on
15985     * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
15986     *
15987     * @static
15988     * @memberOf _
15989     * @since 4.0.0
15990     * @category Lang
15991     * @param {*} value The value to check.
15992     * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
15993     * @example
15994     *
15995     * _.isSafeInteger(3);
15996     * // => true
15997     *
15998     * _.isSafeInteger(Number.MIN_VALUE);
15999     * // => false
16000     *
16001     * _.isSafeInteger(Infinity);
16002     * // => false
16003     *
16004     * _.isSafeInteger('3');
16005     * // => false
16006     */
16007    function isSafeInteger(value) {
16008      return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
16009    }
16010
16011    /**
16012     * Checks if `value` is classified as a `Set` object.
16013     *
16014     * @static
16015     * @memberOf _
16016     * @since 4.3.0
16017     * @category Lang
16018     * @param {*} value The value to check.
16019     * @returns {boolean} Returns `true` if `value` is a set, else `false`.
16020     * @example
16021     *
16022     * _.isSet(new Set);
16023     * // => true
16024     *
16025     * _.isSet(new WeakSet);
16026     * // => false
16027     */
16028    var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
16029
16030    /**
16031     * Checks if `value` is classified as a `String` primitive or object.
16032     *
16033     * @static
16034     * @since 0.1.0
16035     * @memberOf _
16036     * @category Lang
16037     * @param {*} value The value to check.
16038     * @returns {boolean} Returns `true` if `value` is a string, else `false`.
16039     * @example
16040     *
16041     * _.isString('abc');
16042     * // => true
16043     *
16044     * _.isString(1);
16045     * // => false
16046     */
16047    function isString(value) {
16048      return typeof value == 'string' ||
16049        (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
16050    }
16051
16052    /**
16053     * Checks if `value` is classified as a `Symbol` primitive or object.
16054     *
16055     * @static
16056     * @memberOf _
16057     * @since 4.0.0
16058     * @category Lang
16059     * @param {*} value The value to check.
16060     * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
16061     * @example
16062     *
16063     * _.isSymbol(Symbol.iterator);
16064     * // => true
16065     *
16066     * _.isSymbol('abc');
16067     * // => false
16068     */
16069    function isSymbol(value) {
16070      return typeof value == 'symbol' ||
16071        (isObjectLike(value) && baseGetTag(value) == symbolTag);
16072    }
16073
16074    /**
16075     * Checks if `value` is classified as a typed array.
16076     *
16077     * @static
16078     * @memberOf _
16079     * @since 3.0.0
16080     * @category Lang
16081     * @param {*} value The value to check.
16082     * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
16083     * @example
16084     *
16085     * _.isTypedArray(new Uint8Array);
16086     * // => true
16087     *
16088     * _.isTypedArray([]);
16089     * // => false
16090     */
16091    var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
16092
16093    /**
16094     * Checks if `value` is `undefined`.
16095     *
16096     * @static
16097     * @since 0.1.0
16098     * @memberOf _
16099     * @category Lang
16100     * @param {*} value The value to check.
16101     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
16102     * @example
16103     *
16104     * _.isUndefined(void 0);
16105     * // => true
16106     *
16107     * _.isUndefined(null);
16108     * // => false
16109     */
16110    function isUndefined(value) {
16111      return value === undefined;
16112    }
16113
16114    /**
16115     * Checks if `value` is classified as a `WeakMap` object.
16116     *
16117     * @static
16118     * @memberOf _
16119     * @since 4.3.0
16120     * @category Lang
16121     * @param {*} value The value to check.
16122     * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
16123     * @example
16124     *
16125     * _.isWeakMap(new WeakMap);
16126     * // => true
16127     *
16128     * _.isWeakMap(new Map);
16129     * // => false
16130     */
16131    function isWeakMap(value) {
16132      return isObjectLike(value) && getTag(value) == weakMapTag;
16133    }
16134
16135    /**
16136     * Checks if `value` is classified as a `WeakSet` object.
16137     *
16138     * @static
16139     * @memberOf _
16140     * @since 4.3.0
16141     * @category Lang
16142     * @param {*} value The value to check.
16143     * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
16144     * @example
16145     *
16146     * _.isWeakSet(new WeakSet);
16147     * // => true
16148     *
16149     * _.isWeakSet(new Set);
16150     * // => false
16151     */
16152    function isWeakSet(value) {
16153      return isObjectLike(value) && baseGetTag(value) == weakSetTag;
16154    }
16155
16156    /**
16157     * Checks if `value` is less than `other`.
16158     *
16159     * @static
16160     * @memberOf _
16161     * @since 3.9.0
16162     * @category Lang
16163     * @param {*} value The value to compare.
16164     * @param {*} other The other value to compare.
16165     * @returns {boolean} Returns `true` if `value` is less than `other`,
16166     *  else `false`.
16167     * @see _.gt
16168     * @example
16169     *
16170     * _.lt(1, 3);
16171     * // => true
16172     *
16173     * _.lt(3, 3);
16174     * // => false
16175     *
16176     * _.lt(3, 1);
16177     * // => false
16178     */
16179    var lt = createRelationalOperation(baseLt);
16180
16181    /**
16182     * Checks if `value` is less than or equal to `other`.
16183     *
16184     * @static
16185     * @memberOf _
16186     * @since 3.9.0
16187     * @category Lang
16188     * @param {*} value The value to compare.
16189     * @param {*} other The other value to compare.
16190     * @returns {boolean} Returns `true` if `value` is less than or equal to
16191     *  `other`, else `false`.
16192     * @see _.gte
16193     * @example
16194     *
16195     * _.lte(1, 3);
16196     * // => true
16197     *
16198     * _.lte(3, 3);
16199     * // => true
16200     *
16201     * _.lte(3, 1);
16202     * // => false
16203     */
16204    var lte = createRelationalOperation(function(value, other) {
16205      return value <= other;
16206    });
16207
16208    /**
16209     * Converts `value` to an array.
16210     *
16211     * @static
16212     * @since 0.1.0
16213     * @memberOf _
16214     * @category Lang
16215     * @param {*} value The value to convert.
16216     * @returns {Array} Returns the converted array.
16217     * @example
16218     *
16219     * _.toArray({ 'a': 1, 'b': 2 });
16220     * // => [1, 2]
16221     *
16222     * _.toArray('abc');
16223     * // => ['a', 'b', 'c']
16224     *
16225     * _.toArray(1);
16226     * // => []
16227     *
16228     * _.toArray(null);
16229     * // => []
16230     */
16231    function toArray(value) {
16232      if (!value) {
16233        return [];
16234      }
16235      if (isArrayLike(value)) {
16236        return isString(value) ? stringToArray(value) : copyArray(value);
16237      }
16238      if (symIterator && value[symIterator]) {
16239        return iteratorToArray(value[symIterator]());
16240      }
16241      var tag = getTag(value),
16242          func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
16243
16244      return func(value);
16245    }
16246
16247    /**
16248     * Converts `value` to a finite number.
16249     *
16250     * @static
16251     * @memberOf _
16252     * @since 4.12.0
16253     * @category Lang
16254     * @param {*} value The value to convert.
16255     * @returns {number} Returns the converted number.
16256     * @example
16257     *
16258     * _.toFinite(3.2);
16259     * // => 3.2
16260     *
16261     * _.toFinite(Number.MIN_VALUE);
16262     * // => 5e-324
16263     *
16264     * _.toFinite(Infinity);
16265     * // => 1.7976931348623157e+308
16266     *
16267     * _.toFinite('3.2');
16268     * // => 3.2
16269     */
16270    function toFinite(value) {
16271      if (!value) {
16272        return value === 0 ? value : 0;
16273      }
16274      value = toNumber(value);
16275      if (value === INFINITY || value === -INFINITY) {
16276        var sign = (value < 0 ? -1 : 1);
16277        return sign * MAX_INTEGER;
16278      }
16279      return value === value ? value : 0;
16280    }
16281
16282    /**
16283     * Converts `value` to an integer.
16284     *
16285     * **Note:** This method is loosely based on
16286     * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
16287     *
16288     * @static
16289     * @memberOf _
16290     * @since 4.0.0
16291     * @category Lang
16292     * @param {*} value The value to convert.
16293     * @returns {number} Returns the converted integer.
16294     * @example
16295     *
16296     * _.toInteger(3.2);
16297     * // => 3
16298     *
16299     * _.toInteger(Number.MIN_VALUE);
16300     * // => 0
16301     *
16302     * _.toInteger(Infinity);
16303     * // => 1.7976931348623157e+308
16304     *
16305     * _.toInteger('3.2');
16306     * // => 3
16307     */
16308    function toInteger(value) {
16309      var result = toFinite(value),
16310          remainder = result % 1;
16311
16312      return result === result ? (remainder ? result - remainder : result) : 0;
16313    }
16314
16315    /**
16316     * Converts `value` to an integer suitable for use as the length of an
16317     * array-like object.
16318     *
16319     * **Note:** This method is based on
16320     * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
16321     *
16322     * @static
16323     * @memberOf _
16324     * @since 4.0.0
16325     * @category Lang
16326     * @param {*} value The value to convert.
16327     * @returns {number} Returns the converted integer.
16328     * @example
16329     *
16330     * _.toLength(3.2);
16331     * // => 3
16332     *
16333     * _.toLength(Number.MIN_VALUE);
16334     * // => 0
16335     *
16336     * _.toLength(Infinity);
16337     * // => 4294967295
16338     *
16339     * _.toLength('3.2');
16340     * // => 3
16341     */
16342    function toLength(value) {
16343      return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
16344    }
16345
16346    /**
16347     * Converts `value` to a number.
16348     *
16349     * @static
16350     * @memberOf _
16351     * @since 4.0.0
16352     * @category Lang
16353     * @param {*} value The value to process.
16354     * @returns {number} Returns the number.
16355     * @example
16356     *
16357     * _.toNumber(3.2);
16358     * // => 3.2
16359     *
16360     * _.toNumber(Number.MIN_VALUE);
16361     * // => 5e-324
16362     *
16363     * _.toNumber(Infinity);
16364     * // => Infinity
16365     *
16366     * _.toNumber('3.2');
16367     * // => 3.2
16368     */
16369    function toNumber(value) {
16370      if (typeof value == 'number') {
16371        return value;
16372      }
16373      if (isSymbol(value)) {
16374        return NAN;
16375      }
16376      if (isObject(value)) {
16377        var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
16378        value = isObject(other) ? (other + '') : other;
16379      }
16380      if (typeof value != 'string') {
16381        return value === 0 ? value : +value;
16382      }
16383      value = baseTrim(value);
16384      var isBinary = reIsBinary.test(value);
16385      return (isBinary || reIsOctal.test(value))
16386        ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
16387        : (reIsBadHex.test(value) ? NAN : +value);
16388    }
16389
16390    /**
16391     * Converts `value` to a plain object flattening inherited enumerable string
16392     * keyed properties of `value` to own properties of the plain object.
16393     *
16394     * @static
16395     * @memberOf _
16396     * @since 3.0.0
16397     * @category Lang
16398     * @param {*} value The value to convert.
16399     * @returns {Object} Returns the converted plain object.
16400     * @example
16401     *
16402     * function Foo() {
16403     *   this.b = 2;
16404     * }
16405     *
16406     * Foo.prototype.c = 3;
16407     *
16408     * _.assign({ 'a': 1 }, new Foo);
16409     * // => { 'a': 1, 'b': 2 }
16410     *
16411     * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
16412     * // => { 'a': 1, 'b': 2, 'c': 3 }
16413     */
16414    function toPlainObject(value) {
16415      return copyObject(value, keysIn(value));
16416    }
16417
16418    /**
16419     * Converts `value` to a safe integer. A safe integer can be compared and
16420     * represented correctly.
16421     *
16422     * @static
16423     * @memberOf _
16424     * @since 4.0.0
16425     * @category Lang
16426     * @param {*} value The value to convert.
16427     * @returns {number} Returns the converted integer.
16428     * @example
16429     *
16430     * _.toSafeInteger(3.2);
16431     * // => 3
16432     *
16433     * _.toSafeInteger(Number.MIN_VALUE);
16434     * // => 0
16435     *
16436     * _.toSafeInteger(Infinity);
16437     * // => 9007199254740991
16438     *
16439     * _.toSafeInteger('3.2');
16440     * // => 3
16441     */
16442    function toSafeInteger(value) {
16443      return value
16444        ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
16445        : (value === 0 ? value : 0);
16446    }
16447
16448    /**
16449     * Converts `value` to a string. An empty string is returned for `null`
16450     * and `undefined` values. The sign of `-0` is preserved.
16451     *
16452     * @static
16453     * @memberOf _
16454     * @since 4.0.0
16455     * @category Lang
16456     * @param {*} value The value to convert.
16457     * @returns {string} Returns the converted string.
16458     * @example
16459     *
16460     * _.toString(null);
16461     * // => ''
16462     *
16463     * _.toString(-0);
16464     * // => '-0'
16465     *
16466     * _.toString([1, 2, 3]);
16467     * // => '1,2,3'
16468     */
16469    function toString(value) {
16470      return value == null ? '' : baseToString(value);
16471    }
16472
16473    /*------------------------------------------------------------------------*/
16474
16475    /**
16476     * Assigns own enumerable string keyed properties of source objects to the
16477     * destination object. Source objects are applied from left to right.
16478     * Subsequent sources overwrite property assignments of previous sources.
16479     *
16480     * **Note:** This method mutates `object` and is loosely based on
16481     * [`Object.assign`](https://mdn.io/Object/assign).
16482     *
16483     * @static
16484     * @memberOf _
16485     * @since 0.10.0
16486     * @category Object
16487     * @param {Object} object The destination object.
16488     * @param {...Object} [sources] The source objects.
16489     * @returns {Object} Returns `object`.
16490     * @see _.assignIn
16491     * @example
16492     *
16493     * function Foo() {
16494     *   this.a = 1;
16495     * }
16496     *
16497     * function Bar() {
16498     *   this.c = 3;
16499     * }
16500     *
16501     * Foo.prototype.b = 2;
16502     * Bar.prototype.d = 4;
16503     *
16504     * _.assign({ 'a': 0 }, new Foo, new Bar);
16505     * // => { 'a': 1, 'c': 3 }
16506     */
16507    var assign = createAssigner(function(object, source) {
16508      if (isPrototype(source) || isArrayLike(source)) {
16509        copyObject(source, keys(source), object);
16510        return;
16511      }
16512      for (var key in source) {
16513        if (hasOwnProperty.call(source, key)) {
16514          assignValue(object, key, source[key]);
16515        }
16516      }
16517    });
16518
16519    /**
16520     * This method is like `_.assign` except that it iterates over own and
16521     * inherited source properties.
16522     *
16523     * **Note:** This method mutates `object`.
16524     *
16525     * @static
16526     * @memberOf _
16527     * @since 4.0.0
16528     * @alias extend
16529     * @category Object
16530     * @param {Object} object The destination object.
16531     * @param {...Object} [sources] The source objects.
16532     * @returns {Object} Returns `object`.
16533     * @see _.assign
16534     * @example
16535     *
16536     * function Foo() {
16537     *   this.a = 1;
16538     * }
16539     *
16540     * function Bar() {
16541     *   this.c = 3;
16542     * }
16543     *
16544     * Foo.prototype.b = 2;
16545     * Bar.prototype.d = 4;
16546     *
16547     * _.assignIn({ 'a': 0 }, new Foo, new Bar);
16548     * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
16549     */
16550    var assignIn = createAssigner(function(object, source) {
16551      copyObject(source, keysIn(source), object);
16552    });
16553
16554    /**
16555     * This method is like `_.assignIn` except that it accepts `customizer`
16556     * which is invoked to produce the assigned values. If `customizer` returns
16557     * `undefined`, assignment is handled by the method instead. The `customizer`
16558     * is invoked with five arguments: (objValue, srcValue, key, object, source).
16559     *
16560     * **Note:** This method mutates `object`.
16561     *
16562     * @static
16563     * @memberOf _
16564     * @since 4.0.0
16565     * @alias extendWith
16566     * @category Object
16567     * @param {Object} object The destination object.
16568     * @param {...Object} sources The source objects.
16569     * @param {Function} [customizer] The function to customize assigned values.
16570     * @returns {Object} Returns `object`.
16571     * @see _.assignWith
16572     * @example
16573     *
16574     * function customizer(objValue, srcValue) {
16575     *   return _.isUndefined(objValue) ? srcValue : objValue;
16576     * }
16577     *
16578     * var defaults = _.partialRight(_.assignInWith, customizer);
16579     *
16580     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
16581     * // => { 'a': 1, 'b': 2 }
16582     */
16583    var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
16584      copyObject(source, keysIn(source), object, customizer);
16585    });
16586
16587    /**
16588     * This method is like `_.assign` except that it accepts `customizer`
16589     * which is invoked to produce the assigned values. If `customizer` returns
16590     * `undefined`, assignment is handled by the method instead. The `customizer`
16591     * is invoked with five arguments: (objValue, srcValue, key, object, source).
16592     *
16593     * **Note:** This method mutates `object`.
16594     *
16595     * @static
16596     * @memberOf _
16597     * @since 4.0.0
16598     * @category Object
16599     * @param {Object} object The destination object.
16600     * @param {...Object} sources The source objects.
16601     * @param {Function} [customizer] The function to customize assigned values.
16602     * @returns {Object} Returns `object`.
16603     * @see _.assignInWith
16604     * @example
16605     *
16606     * function customizer(objValue, srcValue) {
16607     *   return _.isUndefined(objValue) ? srcValue : objValue;
16608     * }
16609     *
16610     * var defaults = _.partialRight(_.assignWith, customizer);
16611     *
16612     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
16613     * // => { 'a': 1, 'b': 2 }
16614     */
16615    var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
16616      copyObject(source, keys(source), object, customizer);
16617    });
16618
16619    /**
16620     * Creates an array of values corresponding to `paths` of `object`.
16621     *
16622     * @static
16623     * @memberOf _
16624     * @since 1.0.0
16625     * @category Object
16626     * @param {Object} object The object to iterate over.
16627     * @param {...(string|string[])} [paths] The property paths to pick.
16628     * @returns {Array} Returns the picked values.
16629     * @example
16630     *
16631     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
16632     *
16633     * _.at(object, ['a[0].b.c', 'a[1]']);
16634     * // => [3, 4]
16635     */
16636    var at = flatRest(baseAt);
16637
16638    /**
16639     * Creates an object that inherits from the `prototype` object. If a
16640     * `properties` object is given, its own enumerable string keyed properties
16641     * are assigned to the created object.
16642     *
16643     * @static
16644     * @memberOf _
16645     * @since 2.3.0
16646     * @category Object
16647     * @param {Object} prototype The object to inherit from.
16648     * @param {Object} [properties] The properties to assign to the object.
16649     * @returns {Object} Returns the new object.
16650     * @example
16651     *
16652     * function Shape() {
16653     *   this.x = 0;
16654     *   this.y = 0;
16655     * }
16656     *
16657     * function Circle() {
16658     *   Shape.call(this);
16659     * }
16660     *
16661     * Circle.prototype = _.create(Shape.prototype, {
16662     *   'constructor': Circle
16663     * });
16664     *
16665     * var circle = new Circle;
16666     * circle instanceof Circle;
16667     * // => true
16668     *
16669     * circle instanceof Shape;
16670     * // => true
16671     */
16672    function create(prototype, properties) {
16673      var result = baseCreate(prototype);
16674      return properties == null ? result : baseAssign(result, properties);
16675    }
16676
16677    /**
16678     * Assigns own and inherited enumerable string keyed properties of source
16679     * objects to the destination object for all destination properties that
16680     * resolve to `undefined`. Source objects are applied from left to right.
16681     * Once a property is set, additional values of the same property are ignored.
16682     *
16683     * **Note:** This method mutates `object`.
16684     *
16685     * @static
16686     * @since 0.1.0
16687     * @memberOf _
16688     * @category Object
16689     * @param {Object} object The destination object.
16690     * @param {...Object} [sources] The source objects.
16691     * @returns {Object} Returns `object`.
16692     * @see _.defaultsDeep
16693     * @example
16694     *
16695     * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
16696     * // => { 'a': 1, 'b': 2 }
16697     */
16698    var defaults = baseRest(function(object, sources) {
16699      object = Object(object);
16700
16701      var index = -1;
16702      var length = sources.length;
16703      var guard = length > 2 ? sources[2] : undefined;
16704
16705      if (guard && isIterateeCall(sources[0], sources[1], guard)) {
16706        length = 1;
16707      }
16708
16709      while (++index < length) {
16710        var source = sources[index];
16711        var props = keysIn(source);
16712        var propsIndex = -1;
16713        var propsLength = props.length;
16714
16715        while (++propsIndex < propsLength) {
16716          var key = props[propsIndex];
16717          var value = object[key];
16718
16719          if (value === undefined ||
16720              (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
16721            object[key] = source[key];
16722          }
16723        }
16724      }
16725
16726      return object;
16727    });
16728
16729    /**
16730     * This method is like `_.defaults` except that it recursively assigns
16731     * default properties.
16732     *
16733     * **Note:** This method mutates `object`.
16734     *
16735     * @static
16736     * @memberOf _
16737     * @since 3.10.0
16738     * @category Object
16739     * @param {Object} object The destination object.
16740     * @param {...Object} [sources] The source objects.
16741     * @returns {Object} Returns `object`.
16742     * @see _.defaults
16743     * @example
16744     *
16745     * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
16746     * // => { 'a': { 'b': 2, 'c': 3 } }
16747     */
16748    var defaultsDeep = baseRest(function(args) {
16749      args.push(undefined, customDefaultsMerge);
16750      return apply(mergeWith, undefined, args);
16751    });
16752
16753    /**
16754     * This method is like `_.find` except that it returns the key of the first
16755     * element `predicate` returns truthy for instead of the element itself.
16756     *
16757     * @static
16758     * @memberOf _
16759     * @since 1.1.0
16760     * @category Object
16761     * @param {Object} object The object to inspect.
16762     * @param {Function} [predicate=_.identity] The function invoked per iteration.
16763     * @returns {string|undefined} Returns the key of the matched element,
16764     *  else `undefined`.
16765     * @example
16766     *
16767     * var users = {
16768     *   'barney':  { 'age': 36, 'active': true },
16769     *   'fred':    { 'age': 40, 'active': false },
16770     *   'pebbles': { 'age': 1,  'active': true }
16771     * };
16772     *
16773     * _.findKey(users, function(o) { return o.age < 40; });
16774     * // => 'barney' (iteration order is not guaranteed)
16775     *
16776     * // The `_.matches` iteratee shorthand.
16777     * _.findKey(users, { 'age': 1, 'active': true });
16778     * // => 'pebbles'
16779     *
16780     * // The `_.matchesProperty` iteratee shorthand.
16781     * _.findKey(users, ['active', false]);
16782     * // => 'fred'
16783     *
16784     * // The `_.property` iteratee shorthand.
16785     * _.findKey(users, 'active');
16786     * // => 'barney'
16787     */
16788    function findKey(object, predicate) {
16789      return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
16790    }
16791
16792    /**
16793     * This method is like `_.findKey` except that it iterates over elements of
16794     * a collection in the opposite order.
16795     *
16796     * @static
16797     * @memberOf _
16798     * @since 2.0.0
16799     * @category Object
16800     * @param {Object} object The object to inspect.
16801     * @param {Function} [predicate=_.identity] The function invoked per iteration.
16802     * @returns {string|undefined} Returns the key of the matched element,
16803     *  else `undefined`.
16804     * @example
16805     *
16806     * var users = {
16807     *   'barney':  { 'age': 36, 'active': true },
16808     *   'fred':    { 'age': 40, 'active': false },
16809     *   'pebbles': { 'age': 1,  'active': true }
16810     * };
16811     *
16812     * _.findLastKey(users, function(o) { return o.age < 40; });
16813     * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
16814     *
16815     * // The `_.matches` iteratee shorthand.
16816     * _.findLastKey(users, { 'age': 36, 'active': true });
16817     * // => 'barney'
16818     *
16819     * // The `_.matchesProperty` iteratee shorthand.
16820     * _.findLastKey(users, ['active', false]);
16821     * // => 'fred'
16822     *
16823     * // The `_.property` iteratee shorthand.
16824     * _.findLastKey(users, 'active');
16825     * // => 'pebbles'
16826     */
16827    function findLastKey(object, predicate) {
16828      return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
16829    }
16830
16831    /**
16832     * Iterates over own and inherited enumerable string keyed properties of an
16833     * object and invokes `iteratee` for each property. The iteratee is invoked
16834     * with three arguments: (value, key, object). Iteratee functions may exit
16835     * iteration early by explicitly returning `false`.
16836     *
16837     * @static
16838     * @memberOf _
16839     * @since 0.3.0
16840     * @category Object
16841     * @param {Object} object The object to iterate over.
16842     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16843     * @returns {Object} Returns `object`.
16844     * @see _.forInRight
16845     * @example
16846     *
16847     * function Foo() {
16848     *   this.a = 1;
16849     *   this.b = 2;
16850     * }
16851     *
16852     * Foo.prototype.c = 3;
16853     *
16854     * _.forIn(new Foo, function(value, key) {
16855     *   console.log(key);
16856     * });
16857     * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
16858     */
16859    function forIn(object, iteratee) {
16860      return object == null
16861        ? object
16862        : baseFor(object, getIteratee(iteratee, 3), keysIn);
16863    }
16864
16865    /**
16866     * This method is like `_.forIn` except that it iterates over properties of
16867     * `object` in the opposite order.
16868     *
16869     * @static
16870     * @memberOf _
16871     * @since 2.0.0
16872     * @category Object
16873     * @param {Object} object The object to iterate over.
16874     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16875     * @returns {Object} Returns `object`.
16876     * @see _.forIn
16877     * @example
16878     *
16879     * function Foo() {
16880     *   this.a = 1;
16881     *   this.b = 2;
16882     * }
16883     *
16884     * Foo.prototype.c = 3;
16885     *
16886     * _.forInRight(new Foo, function(value, key) {
16887     *   console.log(key);
16888     * });
16889     * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
16890     */
16891    function forInRight(object, iteratee) {
16892      return object == null
16893        ? object
16894        : baseForRight(object, getIteratee(iteratee, 3), keysIn);
16895    }
16896
16897    /**
16898     * Iterates over own enumerable string keyed properties of an object and
16899     * invokes `iteratee` for each property. The iteratee is invoked with three
16900     * arguments: (value, key, object). Iteratee functions may exit iteration
16901     * early by explicitly returning `false`.
16902     *
16903     * @static
16904     * @memberOf _
16905     * @since 0.3.0
16906     * @category Object
16907     * @param {Object} object The object to iterate over.
16908     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16909     * @returns {Object} Returns `object`.
16910     * @see _.forOwnRight
16911     * @example
16912     *
16913     * function Foo() {
16914     *   this.a = 1;
16915     *   this.b = 2;
16916     * }
16917     *
16918     * Foo.prototype.c = 3;
16919     *
16920     * _.forOwn(new Foo, function(value, key) {
16921     *   console.log(key);
16922     * });
16923     * // => Logs 'a' then 'b' (iteration order is not guaranteed).
16924     */
16925    function forOwn(object, iteratee) {
16926      return object && baseForOwn(object, getIteratee(iteratee, 3));
16927    }
16928
16929    /**
16930     * This method is like `_.forOwn` except that it iterates over properties of
16931     * `object` in the opposite order.
16932     *
16933     * @static
16934     * @memberOf _
16935     * @since 2.0.0
16936     * @category Object
16937     * @param {Object} object The object to iterate over.
16938     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16939     * @returns {Object} Returns `object`.
16940     * @see _.forOwn
16941     * @example
16942     *
16943     * function Foo() {
16944     *   this.a = 1;
16945     *   this.b = 2;
16946     * }
16947     *
16948     * Foo.prototype.c = 3;
16949     *
16950     * _.forOwnRight(new Foo, function(value, key) {
16951     *   console.log(key);
16952     * });
16953     * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
16954     */
16955    function forOwnRight(object, iteratee) {
16956      return object && baseForOwnRight(object, getIteratee(iteratee, 3));
16957    }
16958
16959    /**
16960     * Creates an array of function property names from own enumerable properties
16961     * of `object`.
16962     *
16963     * @static
16964     * @since 0.1.0
16965     * @memberOf _
16966     * @category Object
16967     * @param {Object} object The object to inspect.
16968     * @returns {Array} Returns the function names.
16969     * @see _.functionsIn
16970     * @example
16971     *
16972     * function Foo() {
16973     *   this.a = _.constant('a');
16974     *   this.b = _.constant('b');
16975     * }
16976     *
16977     * Foo.prototype.c = _.constant('c');
16978     *
16979     * _.functions(new Foo);
16980     * // => ['a', 'b']
16981     */
16982    function functions(object) {
16983      return object == null ? [] : baseFunctions(object, keys(object));
16984    }
16985
16986    /**
16987     * Creates an array of function property names from own and inherited
16988     * enumerable properties of `object`.
16989     *
16990     * @static
16991     * @memberOf _
16992     * @since 4.0.0
16993     * @category Object
16994     * @param {Object} object The object to inspect.
16995     * @returns {Array} Returns the function names.
16996     * @see _.functions
16997     * @example
16998     *
16999     * function Foo() {
17000     *   this.a = _.constant('a');
17001     *   this.b = _.constant('b');
17002     * }
17003     *
17004     * Foo.prototype.c = _.constant('c');
17005     *
17006     * _.functionsIn(new Foo);
17007     * // => ['a', 'b', 'c']
17008     */
17009    function functionsIn(object) {
17010      return object == null ? [] : baseFunctions(object, keysIn(object));
17011    }
17012
17013    /**
17014     * Gets the value at `path` of `object`. If the resolved value is
17015     * `undefined`, the `defaultValue` is returned in its place.
17016     *
17017     * @static
17018     * @memberOf _
17019     * @since 3.7.0
17020     * @category Object
17021     * @param {Object} object The object to query.
17022     * @param {Array|string} path The path of the property to get.
17023     * @param {*} [defaultValue] The value returned for `undefined` resolved values.
17024     * @returns {*} Returns the resolved value.
17025     * @example
17026     *
17027     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
17028     *
17029     * _.get(object, 'a[0].b.c');
17030     * // => 3
17031     *
17032     * _.get(object, ['a', '0', 'b', 'c']);
17033     * // => 3
17034     *
17035     * _.get(object, 'a.b.c', 'default');
17036     * // => 'default'
17037     */
17038    function get(object, path, defaultValue) {
17039      var result = object == null ? undefined : baseGet(object, path);
17040      return result === undefined ? defaultValue : result;
17041    }
17042
17043    /**
17044     * Checks if `path` is a direct property of `object`.
17045     *
17046     * @static
17047     * @since 0.1.0
17048     * @memberOf _
17049     * @category Object
17050     * @param {Object} object The object to query.
17051     * @param {Array|string} path The path to check.
17052     * @returns {boolean} Returns `true` if `path` exists, else `false`.
17053     * @example
17054     *
17055     * var object = { 'a': { 'b': 2 } };
17056     * var other = _.create({ 'a': _.create({ 'b': 2 }) });
17057     *
17058     * _.has(object, 'a');
17059     * // => true
17060     *
17061     * _.has(object, 'a.b');
17062     * // => true
17063     *
17064     * _.has(object, ['a', 'b']);
17065     * // => true
17066     *
17067     * _.has(other, 'a');
17068     * // => false
17069     */
17070    function has(object, path) {
17071      return object != null && hasPath(object, path, baseHas);
17072    }
17073
17074    /**
17075     * Checks if `path` is a direct or inherited property of `object`.
17076     *
17077     * @static
17078     * @memberOf _
17079     * @since 4.0.0
17080     * @category Object
17081     * @param {Object} object The object to query.
17082     * @param {Array|string} path The path to check.
17083     * @returns {boolean} Returns `true` if `path` exists, else `false`.
17084     * @example
17085     *
17086     * var object = _.create({ 'a': _.create({ 'b': 2 }) });
17087     *
17088     * _.hasIn(object, 'a');
17089     * // => true
17090     *
17091     * _.hasIn(object, 'a.b');
17092     * // => true
17093     *
17094     * _.hasIn(object, ['a', 'b']);
17095     * // => true
17096     *
17097     * _.hasIn(object, 'b');
17098     * // => false
17099     */
17100    function hasIn(object, path) {
17101      return object != null && hasPath(object, path, baseHasIn);
17102    }
17103
17104    /**
17105     * Creates an object composed of the inverted keys and values of `object`.
17106     * If `object` contains duplicate values, subsequent values overwrite
17107     * property assignments of previous values.
17108     *
17109     * @static
17110     * @memberOf _
17111     * @since 0.7.0
17112     * @category Object
17113     * @param {Object} object The object to invert.
17114     * @returns {Object} Returns the new inverted object.
17115     * @example
17116     *
17117     * var object = { 'a': 1, 'b': 2, 'c': 1 };
17118     *
17119     * _.invert(object);
17120     * // => { '1': 'c', '2': 'b' }
17121     */
17122    var invert = createInverter(function(result, value, key) {
17123      if (value != null &&
17124          typeof value.toString != 'function') {
17125        value = nativeObjectToString.call(value);
17126      }
17127
17128      result[value] = key;
17129    }, constant(identity));
17130
17131    /**
17132     * This method is like `_.invert` except that the inverted object is generated
17133     * from the results of running each element of `object` thru `iteratee`. The
17134     * corresponding inverted value of each inverted key is an array of keys
17135     * responsible for generating the inverted value. The iteratee is invoked
17136     * with one argument: (value).
17137     *
17138     * @static
17139     * @memberOf _
17140     * @since 4.1.0
17141     * @category Object
17142     * @param {Object} object The object to invert.
17143     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
17144     * @returns {Object} Returns the new inverted object.
17145     * @example
17146     *
17147     * var object = { 'a': 1, 'b': 2, 'c': 1 };
17148     *
17149     * _.invertBy(object);
17150     * // => { '1': ['a', 'c'], '2': ['b'] }
17151     *
17152     * _.invertBy(object, function(value) {
17153     *   return 'group' + value;
17154     * });
17155     * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
17156     */
17157    var invertBy = createInverter(function(result, value, key) {
17158      if (value != null &&
17159          typeof value.toString != 'function') {
17160        value = nativeObjectToString.call(value);
17161      }
17162
17163      if (hasOwnProperty.call(result, value)) {
17164        result[value].push(key);
17165      } else {
17166        result[value] = [key];
17167      }
17168    }, getIteratee);
17169
17170    /**
17171     * Invokes the method at `path` of `object`.
17172     *
17173     * @static
17174     * @memberOf _
17175     * @since 4.0.0
17176     * @category Object
17177     * @param {Object} object The object to query.
17178     * @param {Array|string} path The path of the method to invoke.
17179     * @param {...*} [args] The arguments to invoke the method with.
17180     * @returns {*} Returns the result of the invoked method.
17181     * @example
17182     *
17183     * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
17184     *
17185     * _.invoke(object, 'a[0].b.c.slice', 1, 3);
17186     * // => [2, 3]
17187     */
17188    var invoke = baseRest(baseInvoke);
17189
17190    /**
17191     * Creates an array of the own enumerable property names of `object`.
17192     *
17193     * **Note:** Non-object values are coerced to objects. See the
17194     * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
17195     * for more details.
17196     *
17197     * @static
17198     * @since 0.1.0
17199     * @memberOf _
17200     * @category Object
17201     * @param {Object} object The object to query.
17202     * @returns {Array} Returns the array of property names.
17203     * @example
17204     *
17205     * function Foo() {
17206     *   this.a = 1;
17207     *   this.b = 2;
17208     * }
17209     *
17210     * Foo.prototype.c = 3;
17211     *
17212     * _.keys(new Foo);
17213     * // => ['a', 'b'] (iteration order is not guaranteed)
17214     *
17215     * _.keys('hi');
17216     * // => ['0', '1']
17217     */
17218    function keys(object) {
17219      return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
17220    }
17221
17222    /**
17223     * Creates an array of the own and inherited enumerable property names of `object`.
17224     *
17225     * **Note:** Non-object values are coerced to objects.
17226     *
17227     * @static
17228     * @memberOf _
17229     * @since 3.0.0
17230     * @category Object
17231     * @param {Object} object The object to query.
17232     * @returns {Array} Returns the array of property names.
17233     * @example
17234     *
17235     * function Foo() {
17236     *   this.a = 1;
17237     *   this.b = 2;
17238     * }
17239     *
17240     * Foo.prototype.c = 3;
17241     *
17242     * _.keysIn(new Foo);
17243     * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
17244     */
17245    function keysIn(object) {
17246      return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
17247    }
17248
17249    /**
17250     * The opposite of `_.mapValues`; this method creates an object with the
17251     * same values as `object` and keys generated by running each own enumerable
17252     * string keyed property of `object` thru `iteratee`. The iteratee is invoked
17253     * with three arguments: (value, key, object).
17254     *
17255     * @static
17256     * @memberOf _
17257     * @since 3.8.0
17258     * @category Object
17259     * @param {Object} object The object to iterate over.
17260     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
17261     * @returns {Object} Returns the new mapped object.
17262     * @see _.mapValues
17263     * @example
17264     *
17265     * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
17266     *   return key + value;
17267     * });
17268     * // => { 'a1': 1, 'b2': 2 }
17269     */
17270    function mapKeys(object, iteratee) {
17271      var result = {};
17272      iteratee = getIteratee(iteratee, 3);
17273
17274      baseForOwn(object, function(value, key, object) {
17275        baseAssignValue(result, iteratee(value, key, object), value);
17276      });
17277      return result;
17278    }
17279
17280    /**
17281     * Creates an object with the same keys as `object` and values generated
17282     * by running each own enumerable string keyed property of `object` thru
17283     * `iteratee`. The iteratee is invoked with three arguments:
17284     * (value, key, object).
17285     *
17286     * @static
17287     * @memberOf _
17288     * @since 2.4.0
17289     * @category Object
17290     * @param {Object} object The object to iterate over.
17291     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
17292     * @returns {Object} Returns the new mapped object.
17293     * @see _.mapKeys
17294     * @example
17295     *
17296     * var users = {
17297     *   'fred':    { 'user': 'fred',    'age': 40 },
17298     *   'pebbles': { 'user': 'pebbles', 'age': 1 }
17299     * };
17300     *
17301     * _.mapValues(users, function(o) { return o.age; });
17302     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
17303     *
17304     * // The `_.property` iteratee shorthand.
17305     * _.mapValues(users, 'age');
17306     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
17307     */
17308    function mapValues(object, iteratee) {
17309      var result = {};
17310      iteratee = getIteratee(iteratee, 3);
17311
17312      baseForOwn(object, function(value, key, object) {
17313        baseAssignValue(result, key, iteratee(value, key, object));
17314      });
17315      return result;
17316    }
17317
17318    /**
17319     * This method is like `_.assign` except that it recursively merges own and
17320     * inherited enumerable string keyed properties of source objects into the
17321     * destination object. Source properties that resolve to `undefined` are
17322     * skipped if a destination value exists. Array and plain object properties
17323     * are merged recursively. Other objects and value types are overridden by
17324     * assignment. Source objects are applied from left to right. Subsequent
17325     * sources overwrite property assignments of previous sources.
17326     *
17327     * **Note:** This method mutates `object`.
17328     *
17329     * @static
17330     * @memberOf _
17331     * @since 0.5.0
17332     * @category Object
17333     * @param {Object} object The destination object.
17334     * @param {...Object} [sources] The source objects.
17335     * @returns {Object} Returns `object`.
17336     * @example
17337     *
17338     * var object = {
17339     *   'a': [{ 'b': 2 }, { 'd': 4 }]
17340     * };
17341     *
17342     * var other = {
17343     *   'a': [{ 'c': 3 }, { 'e': 5 }]
17344     * };
17345     *
17346     * _.merge(object, other);
17347     * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
17348     */
17349    var merge = createAssigner(function(object, source, srcIndex) {
17350      baseMerge(object, source, srcIndex);
17351    });
17352
17353    /**
17354     * This method is like `_.merge` except that it accepts `customizer` which
17355     * is invoked to produce the merged values of the destination and source
17356     * properties. If `customizer` returns `undefined`, merging is handled by the
17357     * method instead. The `customizer` is invoked with six arguments:
17358     * (objValue, srcValue, key, object, source, stack).
17359     *
17360     * **Note:** This method mutates `object`.
17361     *
17362     * @static
17363     * @memberOf _
17364     * @since 4.0.0
17365     * @category Object
17366     * @param {Object} object The destination object.
17367     * @param {...Object} sources The source objects.
17368     * @param {Function} customizer The function to customize assigned values.
17369     * @returns {Object} Returns `object`.
17370     * @example
17371     *
17372     * function customizer(objValue, srcValue) {
17373     *   if (_.isArray(objValue)) {
17374     *     return objValue.concat(srcValue);
17375     *   }
17376     * }
17377     *
17378     * var object = { 'a': [1], 'b': [2] };
17379     * var other = { 'a': [3], 'b': [4] };
17380     *
17381     * _.mergeWith(object, other, customizer);
17382     * // => { 'a': [1, 3], 'b': [2, 4] }
17383     */
17384    var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
17385      baseMerge(object, source, srcIndex, customizer);
17386    });
17387
17388    /**
17389     * The opposite of `_.pick`; this method creates an object composed of the
17390     * own and inherited enumerable property paths of `object` that are not omitted.
17391     *
17392     * **Note:** This method is considerably slower than `_.pick`.
17393     *
17394     * @static
17395     * @since 0.1.0
17396     * @memberOf _
17397     * @category Object
17398     * @param {Object} object The source object.
17399     * @param {...(string|string[])} [paths] The property paths to omit.
17400     * @returns {Object} Returns the new object.
17401     * @example
17402     *
17403     * var object = { 'a': 1, 'b': '2', 'c': 3 };
17404     *
17405     * _.omit(object, ['a', 'c']);
17406     * // => { 'b': '2' }
17407     */
17408    var omit = flatRest(function(object, paths) {
17409      var result = {};
17410      if (object == null) {
17411        return result;
17412      }
17413      var isDeep = false;
17414      paths = arrayMap(paths, function(path) {
17415        path = castPath(path, object);
17416        isDeep || (isDeep = path.length > 1);
17417        return path;
17418      });
17419      copyObject(object, getAllKeysIn(object), result);
17420      if (isDeep) {
17421        result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
17422      }
17423      var length = paths.length;
17424      while (length--) {
17425        baseUnset(result, paths[length]);
17426      }
17427      return result;
17428    });
17429
17430    /**
17431     * The opposite of `_.pickBy`; this method creates an object composed of
17432     * the own and inherited enumerable string keyed properties of `object` that
17433     * `predicate` doesn't return truthy for. The predicate is invoked with two
17434     * arguments: (value, key).
17435     *
17436     * @static
17437     * @memberOf _
17438     * @since 4.0.0
17439     * @category Object
17440     * @param {Object} object The source object.
17441     * @param {Function} [predicate=_.identity] The function invoked per property.
17442     * @returns {Object} Returns the new object.
17443     * @example
17444     *
17445     * var object = { 'a': 1, 'b': '2', 'c': 3 };
17446     *
17447     * _.omitBy(object, _.isNumber);
17448     * // => { 'b': '2' }
17449     */
17450    function omitBy(object, predicate) {
17451      return pickBy(object, negate(getIteratee(predicate)));
17452    }
17453
17454    /**
17455     * Creates an object composed of the picked `object` properties.
17456     *
17457     * @static
17458     * @since 0.1.0
17459     * @memberOf _
17460     * @category Object
17461     * @param {Object} object The source object.
17462     * @param {...(string|string[])} [paths] The property paths to pick.
17463     * @returns {Object} Returns the new object.
17464     * @example
17465     *
17466     * var object = { 'a': 1, 'b': '2', 'c': 3 };
17467     *
17468     * _.pick(object, ['a', 'c']);
17469     * // => { 'a': 1, 'c': 3 }
17470     */
17471    var pick = flatRest(function(object, paths) {
17472      return object == null ? {} : basePick(object, paths);
17473    });
17474
17475    /**
17476     * Creates an object composed of the `object` properties `predicate` returns
17477     * truthy for. The predicate is invoked with two arguments: (value, key).
17478     *
17479     * @static
17480     * @memberOf _
17481     * @since 4.0.0
17482     * @category Object
17483     * @param {Object} object The source object.
17484     * @param {Function} [predicate=_.identity] The function invoked per property.
17485     * @returns {Object} Returns the new object.
17486     * @example
17487     *
17488     * var object = { 'a': 1, 'b': '2', 'c': 3 };
17489     *
17490     * _.pickBy(object, _.isNumber);
17491     * // => { 'a': 1, 'c': 3 }
17492     */
17493    function pickBy(object, predicate) {
17494      if (object == null) {
17495        return {};
17496      }
17497      var props = arrayMap(getAllKeysIn(object), function(prop) {
17498        return [prop];
17499      });
17500      predicate = getIteratee(predicate);
17501      return basePickBy(object, props, function(value, path) {
17502        return predicate(value, path[0]);
17503      });
17504    }
17505
17506    /**
17507     * This method is like `_.get` except that if the resolved value is a
17508     * function it's invoked with the `this` binding of its parent object and
17509     * its result is returned.
17510     *
17511     * @static
17512     * @since 0.1.0
17513     * @memberOf _
17514     * @category Object
17515     * @param {Object} object The object to query.
17516     * @param {Array|string} path The path of the property to resolve.
17517     * @param {*} [defaultValue] The value returned for `undefined` resolved values.
17518     * @returns {*} Returns the resolved value.
17519     * @example
17520     *
17521     * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
17522     *
17523     * _.result(object, 'a[0].b.c1');
17524     * // => 3
17525     *
17526     * _.result(object, 'a[0].b.c2');
17527     * // => 4
17528     *
17529     * _.result(object, 'a[0].b.c3', 'default');
17530     * // => 'default'
17531     *
17532     * _.result(object, 'a[0].b.c3', _.constant('default'));
17533     * // => 'default'
17534     */
17535    function result(object, path, defaultValue) {
17536      path = castPath(path, object);
17537
17538      var index = -1,
17539          length = path.length;
17540
17541      // Ensure the loop is entered when path is empty.
17542      if (!length) {
17543        length = 1;
17544        object = undefined;
17545      }
17546      while (++index < length) {
17547        var value = object == null ? undefined : object[toKey(path[index])];
17548        if (value === undefined) {
17549          index = length;
17550          value = defaultValue;
17551        }
17552        object = isFunction(value) ? value.call(object) : value;
17553      }
17554      return object;
17555    }
17556
17557    /**
17558     * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
17559     * it's created. Arrays are created for missing index properties while objects
17560     * are created for all other missing properties. Use `_.setWith` to customize
17561     * `path` creation.
17562     *
17563     * **Note:** This method mutates `object`.
17564     *
17565     * @static
17566     * @memberOf _
17567     * @since 3.7.0
17568     * @category Object
17569     * @param {Object} object The object to modify.
17570     * @param {Array|string} path The path of the property to set.
17571     * @param {*} value The value to set.
17572     * @returns {Object} Returns `object`.
17573     * @example
17574     *
17575     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
17576     *
17577     * _.set(object, 'a[0].b.c', 4);
17578     * console.log(object.a[0].b.c);
17579     * // => 4
17580     *
17581     * _.set(object, ['x', '0', 'y', 'z'], 5);
17582     * console.log(object.x[0].y.z);
17583     * // => 5
17584     */
17585    function set(object, path, value) {
17586      return object == null ? object : baseSet(object, path, value);
17587    }
17588
17589    /**
17590     * This method is like `_.set` except that it accepts `customizer` which is
17591     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
17592     * path creation is handled by the method instead. The `customizer` is invoked
17593     * with three arguments: (nsValue, key, nsObject).
17594     *
17595     * **Note:** This method mutates `object`.
17596     *
17597     * @static
17598     * @memberOf _
17599     * @since 4.0.0
17600     * @category Object
17601     * @param {Object} object The object to modify.
17602     * @param {Array|string} path The path of the property to set.
17603     * @param {*} value The value to set.
17604     * @param {Function} [customizer] The function to customize assigned values.
17605     * @returns {Object} Returns `object`.
17606     * @example
17607     *
17608     * var object = {};
17609     *
17610     * _.setWith(object, '[0][1]', 'a', Object);
17611     * // => { '0': { '1': 'a' } }
17612     */
17613    function setWith(object, path, value, customizer) {
17614      customizer = typeof customizer == 'function' ? customizer : undefined;
17615      return object == null ? object : baseSet(object, path, value, customizer);
17616    }
17617
17618    /**
17619     * Creates an array of own enumerable string keyed-value pairs for `object`
17620     * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
17621     * entries are returned.
17622     *
17623     * @static
17624     * @memberOf _
17625     * @since 4.0.0
17626     * @alias entries
17627     * @category Object
17628     * @param {Object} object The object to query.
17629     * @returns {Array} Returns the key-value pairs.
17630     * @example
17631     *
17632     * function Foo() {
17633     *   this.a = 1;
17634     *   this.b = 2;
17635     * }
17636     *
17637     * Foo.prototype.c = 3;
17638     *
17639     * _.toPairs(new Foo);
17640     * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
17641     */
17642    var toPairs = createToPairs(keys);
17643
17644    /**
17645     * Creates an array of own and inherited enumerable string keyed-value pairs
17646     * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
17647     * or set, its entries are returned.
17648     *
17649     * @static
17650     * @memberOf _
17651     * @since 4.0.0
17652     * @alias entriesIn
17653     * @category Object
17654     * @param {Object} object The object to query.
17655     * @returns {Array} Returns the key-value pairs.
17656     * @example
17657     *
17658     * function Foo() {
17659     *   this.a = 1;
17660     *   this.b = 2;
17661     * }
17662     *
17663     * Foo.prototype.c = 3;
17664     *
17665     * _.toPairsIn(new Foo);
17666     * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
17667     */
17668    var toPairsIn = createToPairs(keysIn);
17669
17670    /**
17671     * An alternative to `_.reduce`; this method transforms `object` to a new
17672     * `accumulator` object which is the result of running each of its own
17673     * enumerable string keyed properties thru `iteratee`, with each invocation
17674     * potentially mutating the `accumulator` object. If `accumulator` is not
17675     * provided, a new object with the same `[[Prototype]]` will be used. The
17676     * iteratee is invoked with four arguments: (accumulator, value, key, object).
17677     * Iteratee functions may exit iteration early by explicitly returning `false`.
17678     *
17679     * @static
17680     * @memberOf _
17681     * @since 1.3.0
17682     * @category Object
17683     * @param {Object} object The object to iterate over.
17684     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
17685     * @param {*} [accumulator] The custom accumulator value.
17686     * @returns {*} Returns the accumulated value.
17687     * @example
17688     *
17689     * _.transform([2, 3, 4], function(result, n) {
17690     *   result.push(n *= n);
17691     *   return n % 2 == 0;
17692     * }, []);
17693     * // => [4, 9]
17694     *
17695     * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
17696     *   (result[value] || (result[value] = [])).push(key);
17697     * }, {});
17698     * // => { '1': ['a', 'c'], '2': ['b'] }
17699     */
17700    function transform(object, iteratee, accumulator) {
17701      var isArr = isArray(object),
17702          isArrLike = isArr || isBuffer(object) || isTypedArray(object);
17703
17704      iteratee = getIteratee(iteratee, 4);
17705      if (accumulator == null) {
17706        var Ctor = object && object.constructor;
17707        if (isArrLike) {
17708          accumulator = isArr ? new Ctor : [];
17709        }
17710        else if (isObject(object)) {
17711          accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
17712        }
17713        else {
17714          accumulator = {};
17715        }
17716      }
17717      (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
17718        return iteratee(accumulator, value, index, object);
17719      });
17720      return accumulator;
17721    }
17722
17723    /**
17724     * Removes the property at `path` of `object`.
17725     *
17726     * **Note:** This method mutates `object`.
17727     *
17728     * @static
17729     * @memberOf _
17730     * @since 4.0.0
17731     * @category Object
17732     * @param {Object} object The object to modify.
17733     * @param {Array|string} path The path of the property to unset.
17734     * @returns {boolean} Returns `true` if the property is deleted, else `false`.
17735     * @example
17736     *
17737     * var object = { 'a': [{ 'b': { 'c': 7 } }] };
17738     * _.unset(object, 'a[0].b.c');
17739     * // => true
17740     *
17741     * console.log(object);
17742     * // => { 'a': [{ 'b': {} }] };
17743     *
17744     * _.unset(object, ['a', '0', 'b', 'c']);
17745     * // => true
17746     *
17747     * console.log(object);
17748     * // => { 'a': [{ 'b': {} }] };
17749     */
17750    function unset(object, path) {
17751      return object == null ? true : baseUnset(object, path);
17752    }
17753
17754    /**
17755     * This method is like `_.set` except that accepts `updater` to produce the
17756     * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
17757     * is invoked with one argument: (value).
17758     *
17759     * **Note:** This method mutates `object`.
17760     *
17761     * @static
17762     * @memberOf _
17763     * @since 4.6.0
17764     * @category Object
17765     * @param {Object} object The object to modify.
17766     * @param {Array|string} path The path of the property to set.
17767     * @param {Function} updater The function to produce the updated value.
17768     * @returns {Object} Returns `object`.
17769     * @example
17770     *
17771     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
17772     *
17773     * _.update(object, 'a[0].b.c', function(n) { return n * n; });
17774     * console.log(object.a[0].b.c);
17775     * // => 9
17776     *
17777     * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
17778     * console.log(object.x[0].y.z);
17779     * // => 0
17780     */
17781    function update(object, path, updater) {
17782      return object == null ? object : baseUpdate(object, path, castFunction(updater));
17783    }
17784
17785    /**
17786     * This method is like `_.update` except that it accepts `customizer` which is
17787     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
17788     * path creation is handled by the method instead. The `customizer` is invoked
17789     * with three arguments: (nsValue, key, nsObject).
17790     *
17791     * **Note:** This method mutates `object`.
17792     *
17793     * @static
17794     * @memberOf _
17795     * @since 4.6.0
17796     * @category Object
17797     * @param {Object} object The object to modify.
17798     * @param {Array|string} path The path of the property to set.
17799     * @param {Function} updater The function to produce the updated value.
17800     * @param {Function} [customizer] The function to customize assigned values.
17801     * @returns {Object} Returns `object`.
17802     * @example
17803     *
17804     * var object = {};
17805     *
17806     * _.updateWith(object, '[0][1]', _.constant('a'), Object);
17807     * // => { '0': { '1': 'a' } }
17808     */
17809    function updateWith(object, path, updater, customizer) {
17810      customizer = typeof customizer == 'function' ? customizer : undefined;
17811      return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
17812    }
17813
17814    /**
17815     * Creates an array of the own enumerable string keyed property values of `object`.
17816     *
17817     * **Note:** Non-object values are coerced to objects.
17818     *
17819     * @static
17820     * @since 0.1.0
17821     * @memberOf _
17822     * @category Object
17823     * @param {Object} object The object to query.
17824     * @returns {Array} Returns the array of property values.
17825     * @example
17826     *
17827     * function Foo() {
17828     *   this.a = 1;
17829     *   this.b = 2;
17830     * }
17831     *
17832     * Foo.prototype.c = 3;
17833     *
17834     * _.values(new Foo);
17835     * // => [1, 2] (iteration order is not guaranteed)
17836     *
17837     * _.values('hi');
17838     * // => ['h', 'i']
17839     */
17840    function values(object) {
17841      return object == null ? [] : baseValues(object, keys(object));
17842    }
17843
17844    /**
17845     * Creates an array of the own and inherited enumerable string keyed property
17846     * values of `object`.
17847     *
17848     * **Note:** Non-object values are coerced to objects.
17849     *
17850     * @static
17851     * @memberOf _
17852     * @since 3.0.0
17853     * @category Object
17854     * @param {Object} object The object to query.
17855     * @returns {Array} Returns the array of property values.
17856     * @example
17857     *
17858     * function Foo() {
17859     *   this.a = 1;
17860     *   this.b = 2;
17861     * }
17862     *
17863     * Foo.prototype.c = 3;
17864     *
17865     * _.valuesIn(new Foo);
17866     * // => [1, 2, 3] (iteration order is not guaranteed)
17867     */
17868    function valuesIn(object) {
17869      return object == null ? [] : baseValues(object, keysIn(object));
17870    }
17871
17872    /*------------------------------------------------------------------------*/
17873
17874    /**
17875     * Clamps `number` within the inclusive `lower` and `upper` bounds.
17876     *
17877     * @static
17878     * @memberOf _
17879     * @since 4.0.0
17880     * @category Number
17881     * @param {number} number The number to clamp.
17882     * @param {number} [lower] The lower bound.
17883     * @param {number} upper The upper bound.
17884     * @returns {number} Returns the clamped number.
17885     * @example
17886     *
17887     * _.clamp(-10, -5, 5);
17888     * // => -5
17889     *
17890     * _.clamp(10, -5, 5);
17891     * // => 5
17892     */
17893    function clamp(number, lower, upper) {
17894      if (upper === undefined) {
17895        upper = lower;
17896        lower = undefined;
17897      }
17898      if (upper !== undefined) {
17899        upper = toNumber(upper);
17900        upper = upper === upper ? upper : 0;
17901      }
17902      if (lower !== undefined) {
17903        lower = toNumber(lower);
17904        lower = lower === lower ? lower : 0;
17905      }
17906      return baseClamp(toNumber(number), lower, upper);
17907    }
17908
17909    /**
17910     * Checks if `n` is between `start` and up to, but not including, `end`. If
17911     * `end` is not specified, it's set to `start` with `start` then set to `0`.
17912     * If `start` is greater than `end` the params are swapped to support
17913     * negative ranges.
17914     *
17915     * @static
17916     * @memberOf _
17917     * @since 3.3.0
17918     * @category Number
17919     * @param {number} number The number to check.
17920     * @param {number} [start=0] The start of the range.
17921     * @param {number} end The end of the range.
17922     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
17923     * @see _.range, _.rangeRight
17924     * @example
17925     *
17926     * _.inRange(3, 2, 4);
17927     * // => true
17928     *
17929     * _.inRange(4, 8);
17930     * // => true
17931     *
17932     * _.inRange(4, 2);
17933     * // => false
17934     *
17935     * _.inRange(2, 2);
17936     * // => false
17937     *
17938     * _.inRange(1.2, 2);
17939     * // => true
17940     *
17941     * _.inRange(5.2, 4);
17942     * // => false
17943     *
17944     * _.inRange(-3, -2, -6);
17945     * // => true
17946     */
17947    function inRange(number, start, end) {
17948      start = toFinite(start);
17949      if (end === undefined) {
17950        end = start;
17951        start = 0;
17952      } else {
17953        end = toFinite(end);
17954      }
17955      number = toNumber(number);
17956      return baseInRange(number, start, end);
17957    }
17958
17959    /**
17960     * Produces a random number between the inclusive `lower` and `upper` bounds.
17961     * If only one argument is provided a number between `0` and the given number
17962     * is returned. If `floating` is `true`, or either `lower` or `upper` are
17963     * floats, a floating-point number is returned instead of an integer.
17964     *
17965     * **Note:** JavaScript follows the IEEE-754 standard for resolving
17966     * floating-point values which can produce unexpected results.
17967     *
17968     * @static
17969     * @memberOf _
17970     * @since 0.7.0
17971     * @category Number
17972     * @param {number} [lower=0] The lower bound.
17973     * @param {number} [upper=1] The upper bound.
17974     * @param {boolean} [floating] Specify returning a floating-point number.
17975     * @returns {number} Returns the random number.
17976     * @example
17977     *
17978     * _.random(0, 5);
17979     * // => an integer between 0 and 5
17980     *
17981     * _.random(5);
17982     * // => also an integer between 0 and 5
17983     *
17984     * _.random(5, true);
17985     * // => a floating-point number between 0 and 5
17986     *
17987     * _.random(1.2, 5.2);
17988     * // => a floating-point number between 1.2 and 5.2
17989     */
17990    function random(lower, upper, floating) {
17991      if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
17992        upper = floating = undefined;
17993      }
17994      if (floating === undefined) {
17995        if (typeof upper == 'boolean') {
17996          floating = upper;
17997          upper = undefined;
17998        }
17999        else if (typeof lower == 'boolean') {
18000          floating = lower;
18001          lower = undefined;
18002        }
18003      }
18004      if (lower === undefined && upper === undefined) {
18005        lower = 0;
18006        upper = 1;
18007      }
18008      else {
18009        lower = toFinite(lower);
18010        if (upper === undefined) {
18011          upper = lower;
18012          lower = 0;
18013        } else {
18014          upper = toFinite(upper);
18015        }
18016      }
18017      if (lower > upper) {
18018        var temp = lower;
18019        lower = upper;
18020        upper = temp;
18021      }
18022      if (floating || lower % 1 || upper % 1) {
18023        var rand = nativeRandom();
18024        return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
18025      }
18026      return baseRandom(lower, upper);
18027    }
18028
18029    /*------------------------------------------------------------------------*/
18030
18031    /**
18032     * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
18033     *
18034     * @static
18035     * @memberOf _
18036     * @since 3.0.0
18037     * @category String
18038     * @param {string} [string=''] The string to convert.
18039     * @returns {string} Returns the camel cased string.
18040     * @example
18041     *
18042     * _.camelCase('Foo Bar');
18043     * // => 'fooBar'
18044     *
18045     * _.camelCase('--foo-bar--');
18046     * // => 'fooBar'
18047     *
18048     * _.camelCase('__FOO_BAR__');
18049     * // => 'fooBar'
18050     */
18051    var camelCase = createCompounder(function(result, word, index) {
18052      word = word.toLowerCase();
18053      return result + (index ? capitalize(word) : word);
18054    });
18055
18056    /**
18057     * Converts the first character of `string` to upper case and the remaining
18058     * to lower case.
18059     *
18060     * @static
18061     * @memberOf _
18062     * @since 3.0.0
18063     * @category String
18064     * @param {string} [string=''] The string to capitalize.
18065     * @returns {string} Returns the capitalized string.
18066     * @example
18067     *
18068     * _.capitalize('FRED');
18069     * // => 'Fred'
18070     */
18071    function capitalize(string) {
18072      return upperFirst(toString(string).toLowerCase());
18073    }
18074
18075    /**
18076     * Deburrs `string` by converting
18077     * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
18078     * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
18079     * letters to basic Latin letters and removing
18080     * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
18081     *
18082     * @static
18083     * @memberOf _
18084     * @since 3.0.0
18085     * @category String
18086     * @param {string} [string=''] The string to deburr.
18087     * @returns {string} Returns the deburred string.
18088     * @example
18089     *
18090     * _.deburr('déjà vu');
18091     * // => 'deja vu'
18092     */
18093    function deburr(string) {
18094      string = toString(string);
18095      return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
18096    }
18097
18098    /**
18099     * Checks if `string` ends with the given target string.
18100     *
18101     * @static
18102     * @memberOf _
18103     * @since 3.0.0
18104     * @category String
18105     * @param {string} [string=''] The string to inspect.
18106     * @param {string} [target] The string to search for.
18107     * @param {number} [position=string.length] The position to search up to.
18108     * @returns {boolean} Returns `true` if `string` ends with `target`,
18109     *  else `false`.
18110     * @example
18111     *
18112     * _.endsWith('abc', 'c');
18113     * // => true
18114     *
18115     * _.endsWith('abc', 'b');
18116     * // => false
18117     *
18118     * _.endsWith('abc', 'b', 2);
18119     * // => true
18120     */
18121    function endsWith(string, target, position) {
18122      string = toString(string);
18123      target = baseToString(target);
18124
18125      var length = string.length;
18126      position = position === undefined
18127        ? length
18128        : baseClamp(toInteger(position), 0, length);
18129
18130      var end = position;
18131      position -= target.length;
18132      return position >= 0 && string.slice(position, end) == target;
18133    }
18134
18135    /**
18136     * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
18137     * corresponding HTML entities.
18138     *
18139     * **Note:** No other characters are escaped. To escape additional
18140     * characters use a third-party library like [_he_](https://mths.be/he).
18141     *
18142     * Though the ">" character is escaped for symmetry, characters like
18143     * ">" and "/" don't need escaping in HTML and have no special meaning
18144     * unless they're part of a tag or unquoted attribute value. See
18145     * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
18146     * (under "semi-related fun fact") for more details.
18147     *
18148     * When working with HTML you should always
18149     * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
18150     * XSS vectors.
18151     *
18152     * @static
18153     * @since 0.1.0
18154     * @memberOf _
18155     * @category String
18156     * @param {string} [string=''] The string to escape.
18157     * @returns {string} Returns the escaped string.
18158     * @example
18159     *
18160     * _.escape('fred, barney, & pebbles');
18161     * // => 'fred, barney, &amp; pebbles'
18162     */
18163    function escape(string) {
18164      string = toString(string);
18165      return (string && reHasUnescapedHtml.test(string))
18166        ? string.replace(reUnescapedHtml, escapeHtmlChar)
18167        : string;
18168    }
18169
18170    /**
18171     * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
18172     * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
18173     *
18174     * @static
18175     * @memberOf _
18176     * @since 3.0.0
18177     * @category String
18178     * @param {string} [string=''] The string to escape.
18179     * @returns {string} Returns the escaped string.
18180     * @example
18181     *
18182     * _.escapeRegExp('[lodash](https://lodash.com/)');
18183     * // => '\[lodash\]\(https://lodash\.com/\)'
18184     */
18185    function escapeRegExp(string) {
18186      string = toString(string);
18187      return (string && reHasRegExpChar.test(string))
18188        ? string.replace(reRegExpChar, '\\$&')
18189        : string;
18190    }
18191
18192    /**
18193     * Converts `string` to
18194     * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
18195     *
18196     * @static
18197     * @memberOf _
18198     * @since 3.0.0
18199     * @category String
18200     * @param {string} [string=''] The string to convert.
18201     * @returns {string} Returns the kebab cased string.
18202     * @example
18203     *
18204     * _.kebabCase('Foo Bar');
18205     * // => 'foo-bar'
18206     *
18207     * _.kebabCase('fooBar');
18208     * // => 'foo-bar'
18209     *
18210     * _.kebabCase('__FOO_BAR__');
18211     * // => 'foo-bar'
18212     */
18213    var kebabCase = createCompounder(function(result, word, index) {
18214      return result + (index ? '-' : '') + word.toLowerCase();
18215    });
18216
18217    /**
18218     * Converts `string`, as space separated words, to lower case.
18219     *
18220     * @static
18221     * @memberOf _
18222     * @since 4.0.0
18223     * @category String
18224     * @param {string} [string=''] The string to convert.
18225     * @returns {string} Returns the lower cased string.
18226     * @example
18227     *
18228     * _.lowerCase('--Foo-Bar--');
18229     * // => 'foo bar'
18230     *
18231     * _.lowerCase('fooBar');
18232     * // => 'foo bar'
18233     *
18234     * _.lowerCase('__FOO_BAR__');
18235     * // => 'foo bar'
18236     */
18237    var lowerCase = createCompounder(function(result, word, index) {
18238      return result + (index ? ' ' : '') + word.toLowerCase();
18239    });
18240
18241    /**
18242     * Converts the first character of `string` to lower case.
18243     *
18244     * @static
18245     * @memberOf _
18246     * @since 4.0.0
18247     * @category String
18248     * @param {string} [string=''] The string to convert.
18249     * @returns {string} Returns the converted string.
18250     * @example
18251     *
18252     * _.lowerFirst('Fred');
18253     * // => 'fred'
18254     *
18255     * _.lowerFirst('FRED');
18256     * // => 'fRED'
18257     */
18258    var lowerFirst = createCaseFirst('toLowerCase');
18259
18260    /**
18261     * Pads `string` on the left and right sides if it's shorter than `length`.
18262     * Padding characters are truncated if they can't be evenly divided by `length`.
18263     *
18264     * @static
18265     * @memberOf _
18266     * @since 3.0.0
18267     * @category String
18268     * @param {string} [string=''] The string to pad.
18269     * @param {number} [length=0] The padding length.
18270     * @param {string} [chars=' '] The string used as padding.
18271     * @returns {string} Returns the padded string.
18272     * @example
18273     *
18274     * _.pad('abc', 8);
18275     * // => '  abc   '
18276     *
18277     * _.pad('abc', 8, '_-');
18278     * // => '_-abc_-_'
18279     *
18280     * _.pad('abc', 3);
18281     * // => 'abc'
18282     */
18283    function pad(string, length, chars) {
18284      string = toString(string);
18285      length = toInteger(length);
18286
18287      var strLength = length ? stringSize(string) : 0;
18288      if (!length || strLength >= length) {
18289        return string;
18290      }
18291      var mid = (length - strLength) / 2;
18292      return (
18293        createPadding(nativeFloor(mid), chars) +
18294        string +
18295        createPadding(nativeCeil(mid), chars)
18296      );
18297    }
18298
18299    /**
18300     * Pads `string` on the right side if it's shorter than `length`. Padding
18301     * characters are truncated if they exceed `length`.
18302     *
18303     * @static
18304     * @memberOf _
18305     * @since 4.0.0
18306     * @category String
18307     * @param {string} [string=''] The string to pad.
18308     * @param {number} [length=0] The padding length.
18309     * @param {string} [chars=' '] The string used as padding.
18310     * @returns {string} Returns the padded string.
18311     * @example
18312     *
18313     * _.padEnd('abc', 6);
18314     * // => 'abc   '
18315     *
18316     * _.padEnd('abc', 6, '_-');
18317     * // => 'abc_-_'
18318     *
18319     * _.padEnd('abc', 3);
18320     * // => 'abc'
18321     */
18322    function padEnd(string, length, chars) {
18323      string = toString(string);
18324      length = toInteger(length);
18325
18326      var strLength = length ? stringSize(string) : 0;
18327      return (length && strLength < length)
18328        ? (string + createPadding(length - strLength, chars))
18329        : string;
18330    }
18331
18332    /**
18333     * Pads `string` on the left side if it's shorter than `length`. Padding
18334     * characters are truncated if they exceed `length`.
18335     *
18336     * @static
18337     * @memberOf _
18338     * @since 4.0.0
18339     * @category String
18340     * @param {string} [string=''] The string to pad.
18341     * @param {number} [length=0] The padding length.
18342     * @param {string} [chars=' '] The string used as padding.
18343     * @returns {string} Returns the padded string.
18344     * @example
18345     *
18346     * _.padStart('abc', 6);
18347     * // => '   abc'
18348     *
18349     * _.padStart('abc', 6, '_-');
18350     * // => '_-_abc'
18351     *
18352     * _.padStart('abc', 3);
18353     * // => 'abc'
18354     */
18355    function padStart(string, length, chars) {
18356      string = toString(string);
18357      length = toInteger(length);
18358
18359      var strLength = length ? stringSize(string) : 0;
18360      return (length && strLength < length)
18361        ? (createPadding(length - strLength, chars) + string)
18362        : string;
18363    }
18364
18365    /**
18366     * Converts `string` to an integer of the specified radix. If `radix` is
18367     * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
18368     * hexadecimal, in which case a `radix` of `16` is used.
18369     *
18370     * **Note:** This method aligns with the
18371     * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
18372     *
18373     * @static
18374     * @memberOf _
18375     * @since 1.1.0
18376     * @category String
18377     * @param {string} string The string to convert.
18378     * @param {number} [radix=10] The radix to interpret `value` by.
18379     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
18380     * @returns {number} Returns the converted integer.
18381     * @example
18382     *
18383     * _.parseInt('08');
18384     * // => 8
18385     *
18386     * _.map(['6', '08', '10'], _.parseInt);
18387     * // => [6, 8, 10]
18388     */
18389    function parseInt(string, radix, guard) {
18390      if (guard || radix == null) {
18391        radix = 0;
18392      } else if (radix) {
18393        radix = +radix;
18394      }
18395      return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
18396    }
18397
18398    /**
18399     * Repeats the given string `n` times.
18400     *
18401     * @static
18402     * @memberOf _
18403     * @since 3.0.0
18404     * @category String
18405     * @param {string} [string=''] The string to repeat.
18406     * @param {number} [n=1] The number of times to repeat the string.
18407     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
18408     * @returns {string} Returns the repeated string.
18409     * @example
18410     *
18411     * _.repeat('*', 3);
18412     * // => '***'
18413     *
18414     * _.repeat('abc', 2);
18415     * // => 'abcabc'
18416     *
18417     * _.repeat('abc', 0);
18418     * // => ''
18419     */
18420    function repeat(string, n, guard) {
18421      if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
18422        n = 1;
18423      } else {
18424        n = toInteger(n);
18425      }
18426      return baseRepeat(toString(string), n);
18427    }
18428
18429    /**
18430     * Replaces matches for `pattern` in `string` with `replacement`.
18431     *
18432     * **Note:** This method is based on
18433     * [`String#replace`](https://mdn.io/String/replace).
18434     *
18435     * @static
18436     * @memberOf _
18437     * @since 4.0.0
18438     * @category String
18439     * @param {string} [string=''] The string to modify.
18440     * @param {RegExp|string} pattern The pattern to replace.
18441     * @param {Function|string} replacement The match replacement.
18442     * @returns {string} Returns the modified string.
18443     * @example
18444     *
18445     * _.replace('Hi Fred', 'Fred', 'Barney');
18446     * // => 'Hi Barney'
18447     */
18448    function replace() {
18449      var args = arguments,
18450          string = toString(args[0]);
18451
18452      return args.length < 3 ? string : string.replace(args[1], args[2]);
18453    }
18454
18455    /**
18456     * Converts `string` to
18457     * [snake case](https://en.wikipedia.org/wiki/Snake_case).
18458     *
18459     * @static
18460     * @memberOf _
18461     * @since 3.0.0
18462     * @category String
18463     * @param {string} [string=''] The string to convert.
18464     * @returns {string} Returns the snake cased string.
18465     * @example
18466     *
18467     * _.snakeCase('Foo Bar');
18468     * // => 'foo_bar'
18469     *
18470     * _.snakeCase('fooBar');
18471     * // => 'foo_bar'
18472     *
18473     * _.snakeCase('--FOO-BAR--');
18474     * // => 'foo_bar'
18475     */
18476    var snakeCase = createCompounder(function(result, word, index) {
18477      return result + (index ? '_' : '') + word.toLowerCase();
18478    });
18479
18480    /**
18481     * Splits `string` by `separator`.
18482     *
18483     * **Note:** This method is based on
18484     * [`String#split`](https://mdn.io/String/split).
18485     *
18486     * @static
18487     * @memberOf _
18488     * @since 4.0.0
18489     * @category String
18490     * @param {string} [string=''] The string to split.
18491     * @param {RegExp|string} separator The separator pattern to split by.
18492     * @param {number} [limit] The length to truncate results to.
18493     * @returns {Array} Returns the string segments.
18494     * @example
18495     *
18496     * _.split('a-b-c', '-', 2);
18497     * // => ['a', 'b']
18498     */
18499    function split(string, separator, limit) {
18500      if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
18501        separator = limit = undefined;
18502      }
18503      limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
18504      if (!limit) {
18505        return [];
18506      }
18507      string = toString(string);
18508      if (string && (
18509            typeof separator == 'string' ||
18510            (separator != null && !isRegExp(separator))
18511          )) {
18512        separator = baseToString(separator);
18513        if (!separator && hasUnicode(string)) {
18514          return castSlice(stringToArray(string), 0, limit);
18515        }
18516      }
18517      return string.split(separator, limit);
18518    }
18519
18520    /**
18521     * Converts `string` to
18522     * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
18523     *
18524     * @static
18525     * @memberOf _
18526     * @since 3.1.0
18527     * @category String
18528     * @param {string} [string=''] The string to convert.
18529     * @returns {string} Returns the start cased string.
18530     * @example
18531     *
18532     * _.startCase('--foo-bar--');
18533     * // => 'Foo Bar'
18534     *
18535     * _.startCase('fooBar');
18536     * // => 'Foo Bar'
18537     *
18538     * _.startCase('__FOO_BAR__');
18539     * // => 'FOO BAR'
18540     */
18541    var startCase = createCompounder(function(result, word, index) {
18542      return result + (index ? ' ' : '') + upperFirst(word);
18543    });
18544
18545    /**
18546     * Checks if `string` starts with the given target string.
18547     *
18548     * @static
18549     * @memberOf _
18550     * @since 3.0.0
18551     * @category String
18552     * @param {string} [string=''] The string to inspect.
18553     * @param {string} [target] The string to search for.
18554     * @param {number} [position=0] The position to search from.
18555     * @returns {boolean} Returns `true` if `string` starts with `target`,
18556     *  else `false`.
18557     * @example
18558     *
18559     * _.startsWith('abc', 'a');
18560     * // => true
18561     *
18562     * _.startsWith('abc', 'b');
18563     * // => false
18564     *
18565     * _.startsWith('abc', 'b', 1);
18566     * // => true
18567     */
18568    function startsWith(string, target, position) {
18569      string = toString(string);
18570      position = position == null
18571        ? 0
18572        : baseClamp(toInteger(position), 0, string.length);
18573
18574      target = baseToString(target);
18575      return string.slice(position, position + target.length) == target;
18576    }
18577
18578    /**
18579     * Creates a compiled template function that can interpolate data properties
18580     * in "interpolate" delimiters, HTML-escape interpolated data properties in
18581     * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
18582     * properties may be accessed as free variables in the template. If a setting
18583     * object is given, it takes precedence over `_.templateSettings` values.
18584     *
18585     * **Note:** In the development build `_.template` utilizes
18586     * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
18587     * for easier debugging.
18588     *
18589     * For more information on precompiling templates see
18590     * [lodash's custom builds documentation](https://lodash.com/custom-builds).
18591     *
18592     * For more information on Chrome extension sandboxes see
18593     * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
18594     *
18595     * @static
18596     * @since 0.1.0
18597     * @memberOf _
18598     * @category String
18599     * @param {string} [string=''] The template string.
18600     * @param {Object} [options={}] The options object.
18601     * @param {RegExp} [options.escape=_.templateSettings.escape]
18602     *  The HTML "escape" delimiter.
18603     * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
18604     *  The "evaluate" delimiter.
18605     * @param {Object} [options.imports=_.templateSettings.imports]
18606     *  An object to import into the template as free variables.
18607     * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
18608     *  The "interpolate" delimiter.
18609     * @param {string} [options.sourceURL='lodash.templateSources[n]']
18610     *  The sourceURL of the compiled template.
18611     * @param {string} [options.variable='obj']
18612     *  The data object variable name.
18613     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
18614     * @returns {Function} Returns the compiled template function.
18615     * @example
18616     *
18617     * // Use the "interpolate" delimiter to create a compiled template.
18618     * var compiled = _.template('hello <%= user %>!');
18619     * compiled({ 'user': 'fred' });
18620     * // => 'hello fred!'
18621     *
18622     * // Use the HTML "escape" delimiter to escape data property values.
18623     * var compiled = _.template('<b><%- value %></b>');
18624     * compiled({ 'value': '<script>' });
18625     * // => '<b>&lt;script&gt;</b>'
18626     *
18627     * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
18628     * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
18629     * compiled({ 'users': ['fred', 'barney'] });
18630     * // => '<li>fred</li><li>barney</li>'
18631     *
18632     * // Use the internal `print` function in "evaluate" delimiters.
18633     * var compiled = _.template('<% print("hello " + user); %>!');
18634     * compiled({ 'user': 'barney' });
18635     * // => 'hello barney!'
18636     *
18637     * // Use the ES template literal delimiter as an "interpolate" delimiter.
18638     * // Disable support by replacing the "interpolate" delimiter.
18639     * var compiled = _.template('hello ${ user }!');
18640     * compiled({ 'user': 'pebbles' });
18641     * // => 'hello pebbles!'
18642     *
18643     * // Use backslashes to treat delimiters as plain text.
18644     * var compiled = _.template('<%= "\\<%- value %\\>" %>');
18645     * compiled({ 'value': 'ignored' });
18646     * // => '<%- value %>'
18647     *
18648     * // Use the `imports` option to import `jQuery` as `jq`.
18649     * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
18650     * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
18651     * compiled({ 'users': ['fred', 'barney'] });
18652     * // => '<li>fred</li><li>barney</li>'
18653     *
18654     * // Use the `sourceURL` option to specify a custom sourceURL for the template.
18655     * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
18656     * compiled(data);
18657     * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
18658     *
18659     * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
18660     * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
18661     * compiled.source;
18662     * // => function(data) {
18663     * //   var __t, __p = '';
18664     * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
18665     * //   return __p;
18666     * // }
18667     *
18668     * // Use custom template delimiters.
18669     * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
18670     * var compiled = _.template('hello {{ user }}!');
18671     * compiled({ 'user': 'mustache' });
18672     * // => 'hello mustache!'
18673     *
18674     * // Use the `source` property to inline compiled templates for meaningful
18675     * // line numbers in error messages and stack traces.
18676     * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
18677     *   var JST = {\
18678     *     "main": ' + _.template(mainText).source + '\
18679     *   };\
18680     * ');
18681     */
18682    function template(string, options, guard) {
18683      // Based on John Resig's `tmpl` implementation
18684      // (http://ejohn.org/blog/javascript-micro-templating/)
18685      // and Laura Doktorova's doT.js (https://github.com/olado/doT).
18686      var settings = lodash.templateSettings;
18687
18688      if (guard && isIterateeCall(string, options, guard)) {
18689        options = undefined;
18690      }
18691      string = toString(string);
18692      options = assignInWith({}, options, settings, customDefaultsAssignIn);
18693
18694      var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
18695          importsKeys = keys(imports),
18696          importsValues = baseValues(imports, importsKeys);
18697
18698      var isEscaping,
18699          isEvaluating,
18700          index = 0,
18701          interpolate = options.interpolate || reNoMatch,
18702          source = "__p += '";
18703
18704      // Compile the regexp to match each delimiter.
18705      var reDelimiters = RegExp(
18706        (options.escape || reNoMatch).source + '|' +
18707        interpolate.source + '|' +
18708        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
18709        (options.evaluate || reNoMatch).source + '|$'
18710      , 'g');
18711
18712      // Use a sourceURL for easier debugging.
18713      // The sourceURL gets injected into the source that's eval-ed, so be careful
18714      // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
18715      // and escape the comment, thus injecting code that gets evaled.
18716      var sourceURL = '//# sourceURL=' +
18717        (hasOwnProperty.call(options, 'sourceURL')
18718          ? (options.sourceURL + '').replace(/\s/g, ' ')
18719          : ('lodash.templateSources[' + (++templateCounter) + ']')
18720        ) + '\n';
18721
18722      string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
18723        interpolateValue || (interpolateValue = esTemplateValue);
18724
18725        // Escape characters that can't be included in string literals.
18726        source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
18727
18728        // Replace delimiters with snippets.
18729        if (escapeValue) {
18730          isEscaping = true;
18731          source += "' +\n__e(" + escapeValue + ") +\n'";
18732        }
18733        if (evaluateValue) {
18734          isEvaluating = true;
18735          source += "';\n" + evaluateValue + ";\n__p += '";
18736        }
18737        if (interpolateValue) {
18738          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
18739        }
18740        index = offset + match.length;
18741
18742        // The JS engine embedded in Adobe products needs `match` returned in
18743        // order to produce the correct `offset` value.
18744        return match;
18745      });
18746
18747      source += "';\n";
18748
18749      // If `variable` is not specified wrap a with-statement around the generated
18750      // code to add the data object to the top of the scope chain.
18751      var variable = hasOwnProperty.call(options, 'variable') && options.variable;
18752      if (!variable) {
18753        source = 'with (obj) {\n' + source + '\n}\n';
18754      }
18755      // Throw an error if a forbidden character was found in `variable`, to prevent
18756      // potential command injection attacks.
18757      else if (reForbiddenIdentifierChars.test(variable)) {
18758        throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
18759      }
18760
18761      // Cleanup code by stripping empty strings.
18762      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
18763        .replace(reEmptyStringMiddle, '$1')
18764        .replace(reEmptyStringTrailing, '$1;');
18765
18766      // Frame code as the function body.
18767      source = 'function(' + (variable || 'obj') + ') {\n' +
18768        (variable
18769          ? ''
18770          : 'obj || (obj = {});\n'
18771        ) +
18772        "var __t, __p = ''" +
18773        (isEscaping
18774           ? ', __e = _.escape'
18775           : ''
18776        ) +
18777        (isEvaluating
18778          ? ', __j = Array.prototype.join;\n' +
18779            "function print() { __p += __j.call(arguments, '') }\n"
18780          : ';\n'
18781        ) +
18782        source +
18783        'return __p\n}';
18784
18785      var result = attempt(function() {
18786        return Function(importsKeys, sourceURL + 'return ' + source)
18787          .apply(undefined, importsValues);
18788      });
18789
18790      // Provide the compiled function's source by its `toString` method or
18791      // the `source` property as a convenience for inlining compiled templates.
18792      result.source = source;
18793      if (isError(result)) {
18794        throw result;
18795      }
18796      return result;
18797    }
18798
18799    /**
18800     * Converts `string`, as a whole, to lower case just like
18801     * [String#toLowerCase](https://mdn.io/toLowerCase).
18802     *
18803     * @static
18804     * @memberOf _
18805     * @since 4.0.0
18806     * @category String
18807     * @param {string} [string=''] The string to convert.
18808     * @returns {string} Returns the lower cased string.
18809     * @example
18810     *
18811     * _.toLower('--Foo-Bar--');
18812     * // => '--foo-bar--'
18813     *
18814     * _.toLower('fooBar');
18815     * // => 'foobar'
18816     *
18817     * _.toLower('__FOO_BAR__');
18818     * // => '__foo_bar__'
18819     */
18820    function toLower(value) {
18821      return toString(value).toLowerCase();
18822    }
18823
18824    /**
18825     * Converts `string`, as a whole, to upper case just like
18826     * [String#toUpperCase](https://mdn.io/toUpperCase).
18827     *
18828     * @static
18829     * @memberOf _
18830     * @since 4.0.0
18831     * @category String
18832     * @param {string} [string=''] The string to convert.
18833     * @returns {string} Returns the upper cased string.
18834     * @example
18835     *
18836     * _.toUpper('--foo-bar--');
18837     * // => '--FOO-BAR--'
18838     *
18839     * _.toUpper('fooBar');
18840     * // => 'FOOBAR'
18841     *
18842     * _.toUpper('__foo_bar__');
18843     * // => '__FOO_BAR__'
18844     */
18845    function toUpper(value) {
18846      return toString(value).toUpperCase();
18847    }
18848
18849    /**
18850     * Removes leading and trailing whitespace or specified characters from `string`.
18851     *
18852     * @static
18853     * @memberOf _
18854     * @since 3.0.0
18855     * @category String
18856     * @param {string} [string=''] The string to trim.
18857     * @param {string} [chars=whitespace] The characters to trim.
18858     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
18859     * @returns {string} Returns the trimmed string.
18860     * @example
18861     *
18862     * _.trim('  abc  ');
18863     * // => 'abc'
18864     *
18865     * _.trim('-_-abc-_-', '_-');
18866     * // => 'abc'
18867     *
18868     * _.map(['  foo  ', '  bar  '], _.trim);
18869     * // => ['foo', 'bar']
18870     */
18871    function trim(string, chars, guard) {
18872      string = toString(string);
18873      if (string && (guard || chars === undefined)) {
18874        return baseTrim(string);
18875      }
18876      if (!string || !(chars = baseToString(chars))) {
18877        return string;
18878      }
18879      var strSymbols = stringToArray(string),
18880          chrSymbols = stringToArray(chars),
18881          start = charsStartIndex(strSymbols, chrSymbols),
18882          end = charsEndIndex(strSymbols, chrSymbols) + 1;
18883
18884      return castSlice(strSymbols, start, end).join('');
18885    }
18886
18887    /**
18888     * Removes trailing whitespace or specified characters from `string`.
18889     *
18890     * @static
18891     * @memberOf _
18892     * @since 4.0.0
18893     * @category String
18894     * @param {string} [string=''] The string to trim.
18895     * @param {string} [chars=whitespace] The characters to trim.
18896     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
18897     * @returns {string} Returns the trimmed string.
18898     * @example
18899     *
18900     * _.trimEnd('  abc  ');
18901     * // => '  abc'
18902     *
18903     * _.trimEnd('-_-abc-_-', '_-');
18904     * // => '-_-abc'
18905     */
18906    function trimEnd(string, chars, guard) {
18907      string = toString(string);
18908      if (string && (guard || chars === undefined)) {
18909        return string.slice(0, trimmedEndIndex(string) + 1);
18910      }
18911      if (!string || !(chars = baseToString(chars))) {
18912        return string;
18913      }
18914      var strSymbols = stringToArray(string),
18915          end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
18916
18917      return castSlice(strSymbols, 0, end).join('');
18918    }
18919
18920    /**
18921     * Removes leading whitespace or specified characters from `string`.
18922     *
18923     * @static
18924     * @memberOf _
18925     * @since 4.0.0
18926     * @category String
18927     * @param {string} [string=''] The string to trim.
18928     * @param {string} [chars=whitespace] The characters to trim.
18929     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
18930     * @returns {string} Returns the trimmed string.
18931     * @example
18932     *
18933     * _.trimStart('  abc  ');
18934     * // => 'abc  '
18935     *
18936     * _.trimStart('-_-abc-_-', '_-');
18937     * // => 'abc-_-'
18938     */
18939    function trimStart(string, chars, guard) {
18940      string = toString(string);
18941      if (string && (guard || chars === undefined)) {
18942        return string.replace(reTrimStart, '');
18943      }
18944      if (!string || !(chars = baseToString(chars))) {
18945        return string;
18946      }
18947      var strSymbols = stringToArray(string),
18948          start = charsStartIndex(strSymbols, stringToArray(chars));
18949
18950      return castSlice(strSymbols, start).join('');
18951    }
18952
18953    /**
18954     * Truncates `string` if it's longer than the given maximum string length.
18955     * The last characters of the truncated string are replaced with the omission
18956     * string which defaults to "...".
18957     *
18958     * @static
18959     * @memberOf _
18960     * @since 4.0.0
18961     * @category String
18962     * @param {string} [string=''] The string to truncate.
18963     * @param {Object} [options={}] The options object.
18964     * @param {number} [options.length=30] The maximum string length.
18965     * @param {string} [options.omission='...'] The string to indicate text is omitted.
18966     * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
18967     * @returns {string} Returns the truncated string.
18968     * @example
18969     *
18970     * _.truncate('hi-diddly-ho there, neighborino');
18971     * // => 'hi-diddly-ho there, neighbo...'
18972     *
18973     * _.truncate('hi-diddly-ho there, neighborino', {
18974     *   'length': 24,
18975     *   'separator': ' '
18976     * });
18977     * // => 'hi-diddly-ho there,...'
18978     *
18979     * _.truncate('hi-diddly-ho there, neighborino', {
18980     *   'length': 24,
18981     *   'separator': /,? +/
18982     * });
18983     * // => 'hi-diddly-ho there...'
18984     *
18985     * _.truncate('hi-diddly-ho there, neighborino', {
18986     *   'omission': ' [...]'
18987     * });
18988     * // => 'hi-diddly-ho there, neig [...]'
18989     */
18990    function truncate(string, options) {
18991      var length = DEFAULT_TRUNC_LENGTH,
18992          omission = DEFAULT_TRUNC_OMISSION;
18993
18994      if (isObject(options)) {
18995        var separator = 'separator' in options ? options.separator : separator;
18996        length = 'length' in options ? toInteger(options.length) : length;
18997        omission = 'omission' in options ? baseToString(options.omission) : omission;
18998      }
18999      string = toString(string);
19000
19001      var strLength = string.length;
19002      if (hasUnicode(string)) {
19003        var strSymbols = stringToArray(string);
19004        strLength = strSymbols.length;
19005      }
19006      if (length >= strLength) {
19007        return string;
19008      }
19009      var end = length - stringSize(omission);
19010      if (end < 1) {
19011        return omission;
19012      }
19013      var result = strSymbols
19014        ? castSlice(strSymbols, 0, end).join('')
19015        : string.slice(0, end);
19016
19017      if (separator === undefined) {
19018        return result + omission;
19019      }
19020      if (strSymbols) {
19021        end += (result.length - end);
19022      }
19023      if (isRegExp(separator)) {
19024        if (string.slice(end).search(separator)) {
19025          var match,
19026              substring = result;
19027
19028          if (!separator.global) {
19029            separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
19030          }
19031          separator.lastIndex = 0;
19032          while ((match = separator.exec(substring))) {
19033            var newEnd = match.index;
19034          }
19035          result = result.slice(0, newEnd === undefined ? end : newEnd);
19036        }
19037      } else if (string.indexOf(baseToString(separator), end) != end) {
19038        var index = result.lastIndexOf(separator);
19039        if (index > -1) {
19040          result = result.slice(0, index);
19041        }
19042      }
19043      return result + omission;
19044    }
19045
19046    /**
19047     * The inverse of `_.escape`; this method converts the HTML entities
19048     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
19049     * their corresponding characters.
19050     *
19051     * **Note:** No other HTML entities are unescaped. To unescape additional
19052     * HTML entities use a third-party library like [_he_](https://mths.be/he).
19053     *
19054     * @static
19055     * @memberOf _
19056     * @since 0.6.0
19057     * @category String
19058     * @param {string} [string=''] The string to unescape.
19059     * @returns {string} Returns the unescaped string.
19060     * @example
19061     *
19062     * _.unescape('fred, barney, &amp; pebbles');
19063     * // => 'fred, barney, & pebbles'
19064     */
19065    function unescape(string) {
19066      string = toString(string);
19067      return (string && reHasEscapedHtml.test(string))
19068        ? string.replace(reEscapedHtml, unescapeHtmlChar)
19069        : string;
19070    }
19071
19072    /**
19073     * Converts `string`, as space separated words, to upper case.
19074     *
19075     * @static
19076     * @memberOf _
19077     * @since 4.0.0
19078     * @category String
19079     * @param {string} [string=''] The string to convert.
19080     * @returns {string} Returns the upper cased string.
19081     * @example
19082     *
19083     * _.upperCase('--foo-bar');
19084     * // => 'FOO BAR'
19085     *
19086     * _.upperCase('fooBar');
19087     * // => 'FOO BAR'
19088     *
19089     * _.upperCase('__foo_bar__');
19090     * // => 'FOO BAR'
19091     */
19092    var upperCase = createCompounder(function(result, word, index) {
19093      return result + (index ? ' ' : '') + word.toUpperCase();
19094    });
19095
19096    /**
19097     * Converts the first character of `string` to upper case.
19098     *
19099     * @static
19100     * @memberOf _
19101     * @since 4.0.0
19102     * @category String
19103     * @param {string} [string=''] The string to convert.
19104     * @returns {string} Returns the converted string.
19105     * @example
19106     *
19107     * _.upperFirst('fred');
19108     * // => 'Fred'
19109     *
19110     * _.upperFirst('FRED');
19111     * // => 'FRED'
19112     */
19113    var upperFirst = createCaseFirst('toUpperCase');
19114
19115    /**
19116     * Splits `string` into an array of its words.
19117     *
19118     * @static
19119     * @memberOf _
19120     * @since 3.0.0
19121     * @category String
19122     * @param {string} [string=''] The string to inspect.
19123     * @param {RegExp|string} [pattern] The pattern to match words.
19124     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
19125     * @returns {Array} Returns the words of `string`.
19126     * @example
19127     *
19128     * _.words('fred, barney, & pebbles');
19129     * // => ['fred', 'barney', 'pebbles']
19130     *
19131     * _.words('fred, barney, & pebbles', /[^, ]+/g);
19132     * // => ['fred', 'barney', '&', 'pebbles']
19133     */
19134    function words(string, pattern, guard) {
19135      string = toString(string);
19136      pattern = guard ? undefined : pattern;
19137
19138      if (pattern === undefined) {
19139        return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
19140      }
19141      return string.match(pattern) || [];
19142    }
19143
19144    /*------------------------------------------------------------------------*/
19145
19146    /**
19147     * Attempts to invoke `func`, returning either the result or the caught error
19148     * object. Any additional arguments are provided to `func` when it's invoked.
19149     *
19150     * @static
19151     * @memberOf _
19152     * @since 3.0.0
19153     * @category Util
19154     * @param {Function} func The function to attempt.
19155     * @param {...*} [args] The arguments to invoke `func` with.
19156     * @returns {*} Returns the `func` result or error object.
19157     * @example
19158     *
19159     * // Avoid throwing errors for invalid selectors.
19160     * var elements = _.attempt(function(selector) {
19161     *   return document.querySelectorAll(selector);
19162     * }, '>_>');
19163     *
19164     * if (_.isError(elements)) {
19165     *   elements = [];
19166     * }
19167     */
19168    var attempt = baseRest(function(func, args) {
19169      try {
19170        return apply(func, undefined, args);
19171      } catch (e) {
19172        return isError(e) ? e : new Error(e);
19173      }
19174    });
19175
19176    /**
19177     * Binds methods of an object to the object itself, overwriting the existing
19178     * method.
19179     *
19180     * **Note:** This method doesn't set the "length" property of bound functions.
19181     *
19182     * @static
19183     * @since 0.1.0
19184     * @memberOf _
19185     * @category Util
19186     * @param {Object} object The object to bind and assign the bound methods to.
19187     * @param {...(string|string[])} methodNames The object method names to bind.
19188     * @returns {Object} Returns `object`.
19189     * @example
19190     *
19191     * var view = {
19192     *   'label': 'docs',
19193     *   'click': function() {
19194     *     console.log('clicked ' + this.label);
19195     *   }
19196     * };
19197     *
19198     * _.bindAll(view, ['click']);
19199     * jQuery(element).on('click', view.click);
19200     * // => Logs 'clicked docs' when clicked.
19201     */
19202    var bindAll = flatRest(function(object, methodNames) {
19203      arrayEach(methodNames, function(key) {
19204        key = toKey(key);
19205        baseAssignValue(object, key, bind(object[key], object));
19206      });
19207      return object;
19208    });
19209
19210    /**
19211     * Creates a function that iterates over `pairs` and invokes the corresponding
19212     * function of the first predicate to return truthy. The predicate-function
19213     * pairs are invoked with the `this` binding and arguments of the created
19214     * function.
19215     *
19216     * @static
19217     * @memberOf _
19218     * @since 4.0.0
19219     * @category Util
19220     * @param {Array} pairs The predicate-function pairs.
19221     * @returns {Function} Returns the new composite function.
19222     * @example
19223     *
19224     * var func = _.cond([
19225     *   [_.matches({ 'a': 1 }),           _.constant('matches A')],
19226     *   [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
19227     *   [_.stubTrue,                      _.constant('no match')]
19228     * ]);
19229     *
19230     * func({ 'a': 1, 'b': 2 });
19231     * // => 'matches A'
19232     *
19233     * func({ 'a': 0, 'b': 1 });
19234     * // => 'matches B'
19235     *
19236     * func({ 'a': '1', 'b': '2' });
19237     * // => 'no match'
19238     */
19239    function cond(pairs) {
19240      var length = pairs == null ? 0 : pairs.length,
19241          toIteratee = getIteratee();
19242
19243      pairs = !length ? [] : arrayMap(pairs, function(pair) {
19244        if (typeof pair[1] != 'function') {
19245          throw new TypeError(FUNC_ERROR_TEXT);
19246        }
19247        return [toIteratee(pair[0]), pair[1]];
19248      });
19249
19250      return baseRest(function(args) {
19251        var index = -1;
19252        while (++index < length) {
19253          var pair = pairs[index];
19254          if (apply(pair[0], this, args)) {
19255            return apply(pair[1], this, args);
19256          }
19257        }
19258      });
19259    }
19260
19261    /**
19262     * Creates a function that invokes the predicate properties of `source` with
19263     * the corresponding property values of a given object, returning `true` if
19264     * all predicates return truthy, else `false`.
19265     *
19266     * **Note:** The created function is equivalent to `_.conformsTo` with
19267     * `source` partially applied.
19268     *
19269     * @static
19270     * @memberOf _
19271     * @since 4.0.0
19272     * @category Util
19273     * @param {Object} source The object of property predicates to conform to.
19274     * @returns {Function} Returns the new spec function.
19275     * @example
19276     *
19277     * var objects = [
19278     *   { 'a': 2, 'b': 1 },
19279     *   { 'a': 1, 'b': 2 }
19280     * ];
19281     *
19282     * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
19283     * // => [{ 'a': 1, 'b': 2 }]
19284     */
19285    function conforms(source) {
19286      return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
19287    }
19288
19289    /**
19290     * Creates a function that returns `value`.
19291     *
19292     * @static
19293     * @memberOf _
19294     * @since 2.4.0
19295     * @category Util
19296     * @param {*} value The value to return from the new function.
19297     * @returns {Function} Returns the new constant function.
19298     * @example
19299     *
19300     * var objects = _.times(2, _.constant({ 'a': 1 }));
19301     *
19302     * console.log(objects);
19303     * // => [{ 'a': 1 }, { 'a': 1 }]
19304     *
19305     * console.log(objects[0] === objects[1]);
19306     * // => true
19307     */
19308    function constant(value) {
19309      return function() {
19310        return value;
19311      };
19312    }
19313
19314    /**
19315     * Checks `value` to determine whether a default value should be returned in
19316     * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
19317     * or `undefined`.
19318     *
19319     * @static
19320     * @memberOf _
19321     * @since 4.14.0
19322     * @category Util
19323     * @param {*} value The value to check.
19324     * @param {*} defaultValue The default value.
19325     * @returns {*} Returns the resolved value.
19326     * @example
19327     *
19328     * _.defaultTo(1, 10);
19329     * // => 1
19330     *
19331     * _.defaultTo(undefined, 10);
19332     * // => 10
19333     */
19334    function defaultTo(value, defaultValue) {
19335      return (value == null || value !== value) ? defaultValue : value;
19336    }
19337
19338    /**
19339     * Creates a function that returns the result of invoking the given functions
19340     * with the `this` binding of the created function, where each successive
19341     * invocation is supplied the return value of the previous.
19342     *
19343     * @static
19344     * @memberOf _
19345     * @since 3.0.0
19346     * @category Util
19347     * @param {...(Function|Function[])} [funcs] The functions to invoke.
19348     * @returns {Function} Returns the new composite function.
19349     * @see _.flowRight
19350     * @example
19351     *
19352     * function square(n) {
19353     *   return n * n;
19354     * }
19355     *
19356     * var addSquare = _.flow([_.add, square]);
19357     * addSquare(1, 2);
19358     * // => 9
19359     */
19360    var flow = createFlow();
19361
19362    /**
19363     * This method is like `_.flow` except that it creates a function that
19364     * invokes the given functions from right to left.
19365     *
19366     * @static
19367     * @since 3.0.0
19368     * @memberOf _
19369     * @category Util
19370     * @param {...(Function|Function[])} [funcs] The functions to invoke.
19371     * @returns {Function} Returns the new composite function.
19372     * @see _.flow
19373     * @example
19374     *
19375     * function square(n) {
19376     *   return n * n;
19377     * }
19378     *
19379     * var addSquare = _.flowRight([square, _.add]);
19380     * addSquare(1, 2);
19381     * // => 9
19382     */
19383    var flowRight = createFlow(true);
19384
19385    /**
19386     * This method returns the first argument it receives.
19387     *
19388     * @static
19389     * @since 0.1.0
19390     * @memberOf _
19391     * @category Util
19392     * @param {*} value Any value.
19393     * @returns {*} Returns `value`.
19394     * @example
19395     *
19396     * var object = { 'a': 1 };
19397     *
19398     * console.log(_.identity(object) === object);
19399     * // => true
19400     */
19401    function identity(value) {
19402      return value;
19403    }
19404
19405    /**
19406     * Creates a function that invokes `func` with the arguments of the created
19407     * function. If `func` is a property name, the created function returns the
19408     * property value for a given element. If `func` is an array or object, the
19409     * created function returns `true` for elements that contain the equivalent
19410     * source properties, otherwise it returns `false`.
19411     *
19412     * @static
19413     * @since 4.0.0
19414     * @memberOf _
19415     * @category Util
19416     * @param {*} [func=_.identity] The value to convert to a callback.
19417     * @returns {Function} Returns the callback.
19418     * @example
19419     *
19420     * var users = [
19421     *   { 'user': 'barney', 'age': 36, 'active': true },
19422     *   { 'user': 'fred',   'age': 40, 'active': false }
19423     * ];
19424     *
19425     * // The `_.matches` iteratee shorthand.
19426     * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
19427     * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
19428     *
19429     * // The `_.matchesProperty` iteratee shorthand.
19430     * _.filter(users, _.iteratee(['user', 'fred']));
19431     * // => [{ 'user': 'fred', 'age': 40 }]
19432     *
19433     * // The `_.property` iteratee shorthand.
19434     * _.map(users, _.iteratee('user'));
19435     * // => ['barney', 'fred']
19436     *
19437     * // Create custom iteratee shorthands.
19438     * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
19439     *   return !_.isRegExp(func) ? iteratee(func) : function(string) {
19440     *     return func.test(string);
19441     *   };
19442     * });
19443     *
19444     * _.filter(['abc', 'def'], /ef/);
19445     * // => ['def']
19446     */
19447    function iteratee(func) {
19448      return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
19449    }
19450
19451    /**
19452     * Creates a function that performs a partial deep comparison between a given
19453     * object and `source`, returning `true` if the given object has equivalent
19454     * property values, else `false`.
19455     *
19456     * **Note:** The created function is equivalent to `_.isMatch` with `source`
19457     * partially applied.
19458     *
19459     * Partial comparisons will match empty array and empty object `source`
19460     * values against any array or object value, respectively. See `_.isEqual`
19461     * for a list of supported value comparisons.
19462     *
19463     * **Note:** Multiple values can be checked by combining several matchers
19464     * using `_.overSome`
19465     *
19466     * @static
19467     * @memberOf _
19468     * @since 3.0.0
19469     * @category Util
19470     * @param {Object} source The object of property values to match.
19471     * @returns {Function} Returns the new spec function.
19472     * @example
19473     *
19474     * var objects = [
19475     *   { 'a': 1, 'b': 2, 'c': 3 },
19476     *   { 'a': 4, 'b': 5, 'c': 6 }
19477     * ];
19478     *
19479     * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
19480     * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
19481     *
19482     * // Checking for several possible values
19483     * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
19484     * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
19485     */
19486    function matches(source) {
19487      return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
19488    }
19489
19490    /**
19491     * Creates a function that performs a partial deep comparison between the
19492     * value at `path` of a given object to `srcValue`, returning `true` if the
19493     * object value is equivalent, else `false`.
19494     *
19495     * **Note:** Partial comparisons will match empty array and empty object
19496     * `srcValue` values against any array or object value, respectively. See
19497     * `_.isEqual` for a list of supported value comparisons.
19498     *
19499     * **Note:** Multiple values can be checked by combining several matchers
19500     * using `_.overSome`
19501     *
19502     * @static
19503     * @memberOf _
19504     * @since 3.2.0
19505     * @category Util
19506     * @param {Array|string} path The path of the property to get.
19507     * @param {*} srcValue The value to match.
19508     * @returns {Function} Returns the new spec function.
19509     * @example
19510     *
19511     * var objects = [
19512     *   { 'a': 1, 'b': 2, 'c': 3 },
19513     *   { 'a': 4, 'b': 5, 'c': 6 }
19514     * ];
19515     *
19516     * _.find(objects, _.matchesProperty('a', 4));
19517     * // => { 'a': 4, 'b': 5, 'c': 6 }
19518     *
19519     * // Checking for several possible values
19520     * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
19521     * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
19522     */
19523    function matchesProperty(path, srcValue) {
19524      return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
19525    }
19526
19527    /**
19528     * Creates a function that invokes the method at `path` of a given object.
19529     * Any additional arguments are provided to the invoked method.
19530     *
19531     * @static
19532     * @memberOf _
19533     * @since 3.7.0
19534     * @category Util
19535     * @param {Array|string} path The path of the method to invoke.
19536     * @param {...*} [args] The arguments to invoke the method with.
19537     * @returns {Function} Returns the new invoker function.
19538     * @example
19539     *
19540     * var objects = [
19541     *   { 'a': { 'b': _.constant(2) } },
19542     *   { 'a': { 'b': _.constant(1) } }
19543     * ];
19544     *
19545     * _.map(objects, _.method('a.b'));
19546     * // => [2, 1]
19547     *
19548     * _.map(objects, _.method(['a', 'b']));
19549     * // => [2, 1]
19550     */
19551    var method = baseRest(function(path, args) {
19552      return function(object) {
19553        return baseInvoke(object, path, args);
19554      };
19555    });
19556
19557    /**
19558     * The opposite of `_.method`; this method creates a function that invokes
19559     * the method at a given path of `object`. Any additional arguments are
19560     * provided to the invoked method.
19561     *
19562     * @static
19563     * @memberOf _
19564     * @since 3.7.0
19565     * @category Util
19566     * @param {Object} object The object to query.
19567     * @param {...*} [args] The arguments to invoke the method with.
19568     * @returns {Function} Returns the new invoker function.
19569     * @example
19570     *
19571     * var array = _.times(3, _.constant),
19572     *     object = { 'a': array, 'b': array, 'c': array };
19573     *
19574     * _.map(['a[2]', 'c[0]'], _.methodOf(object));
19575     * // => [2, 0]
19576     *
19577     * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
19578     * // => [2, 0]
19579     */
19580    var methodOf = baseRest(function(object, args) {
19581      return function(path) {
19582        return baseInvoke(object, path, args);
19583      };
19584    });
19585
19586    /**
19587     * Adds all own enumerable string keyed function properties of a source
19588     * object to the destination object. If `object` is a function, then methods
19589     * are added to its prototype as well.
19590     *
19591     * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
19592     * avoid conflicts caused by modifying the original.
19593     *
19594     * @static
19595     * @since 0.1.0
19596     * @memberOf _
19597     * @category Util
19598     * @param {Function|Object} [object=lodash] The destination object.
19599     * @param {Object} source The object of functions to add.
19600     * @param {Object} [options={}] The options object.
19601     * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
19602     * @returns {Function|Object} Returns `object`.
19603     * @example
19604     *
19605     * function vowels(string) {
19606     *   return _.filter(string, function(v) {
19607     *     return /[aeiou]/i.test(v);
19608     *   });
19609     * }
19610     *
19611     * _.mixin({ 'vowels': vowels });
19612     * _.vowels('fred');
19613     * // => ['e']
19614     *
19615     * _('fred').vowels().value();
19616     * // => ['e']
19617     *
19618     * _.mixin({ 'vowels': vowels }, { 'chain': false });
19619     * _('fred').vowels();
19620     * // => ['e']
19621     */
19622    function mixin(object, source, options) {
19623      var props = keys(source),
19624          methodNames = baseFunctions(source, props);
19625
19626      if (options == null &&
19627          !(isObject(source) && (methodNames.length || !props.length))) {
19628        options = source;
19629        source = object;
19630        object = this;
19631        methodNames = baseFunctions(source, keys(source));
19632      }
19633      var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
19634          isFunc = isFunction(object);
19635
19636      arrayEach(methodNames, function(methodName) {
19637        var func = source[methodName];
19638        object[methodName] = func;
19639        if (isFunc) {
19640          object.prototype[methodName] = function() {
19641            var chainAll = this.__chain__;
19642            if (chain || chainAll) {
19643              var result = object(this.__wrapped__),
19644                  actions = result.__actions__ = copyArray(this.__actions__);
19645
19646              actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
19647              result.__chain__ = chainAll;
19648              return result;
19649            }
19650            return func.apply(object, arrayPush([this.value()], arguments));
19651          };
19652        }
19653      });
19654
19655      return object;
19656    }
19657
19658    /**
19659     * Reverts the `_` variable to its previous value and returns a reference to
19660     * the `lodash` function.
19661     *
19662     * @static
19663     * @since 0.1.0
19664     * @memberOf _
19665     * @category Util
19666     * @returns {Function} Returns the `lodash` function.
19667     * @example
19668     *
19669     * var lodash = _.noConflict();
19670     */
19671    function noConflict() {
19672      if (root._ === this) {
19673        root._ = oldDash;
19674      }
19675      return this;
19676    }
19677
19678    /**
19679     * This method returns `undefined`.
19680     *
19681     * @static
19682     * @memberOf _
19683     * @since 2.3.0
19684     * @category Util
19685     * @example
19686     *
19687     * _.times(2, _.noop);
19688     * // => [undefined, undefined]
19689     */
19690    function noop() {
19691      // No operation performed.
19692    }
19693
19694    /**
19695     * Creates a function that gets the argument at index `n`. If `n` is negative,
19696     * the nth argument from the end is returned.
19697     *
19698     * @static
19699     * @memberOf _
19700     * @since 4.0.0
19701     * @category Util
19702     * @param {number} [n=0] The index of the argument to return.
19703     * @returns {Function} Returns the new pass-thru function.
19704     * @example
19705     *
19706     * var func = _.nthArg(1);
19707     * func('a', 'b', 'c', 'd');
19708     * // => 'b'
19709     *
19710     * var func = _.nthArg(-2);
19711     * func('a', 'b', 'c', 'd');
19712     * // => 'c'
19713     */
19714    function nthArg(n) {
19715      n = toInteger(n);
19716      return baseRest(function(args) {
19717        return baseNth(args, n);
19718      });
19719    }
19720
19721    /**
19722     * Creates a function that invokes `iteratees` with the arguments it receives
19723     * and returns their results.
19724     *
19725     * @static
19726     * @memberOf _
19727     * @since 4.0.0
19728     * @category Util
19729     * @param {...(Function|Function[])} [iteratees=[_.identity]]
19730     *  The iteratees to invoke.
19731     * @returns {Function} Returns the new function.
19732     * @example
19733     *
19734     * var func = _.over([Math.max, Math.min]);
19735     *
19736     * func(1, 2, 3, 4);
19737     * // => [4, 1]
19738     */
19739    var over = createOver(arrayMap);
19740
19741    /**
19742     * Creates a function that checks if **all** of the `predicates` return
19743     * truthy when invoked with the arguments it receives.
19744     *
19745     * Following shorthands are possible for providing predicates.
19746     * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
19747     * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
19748     *
19749     * @static
19750     * @memberOf _
19751     * @since 4.0.0
19752     * @category Util
19753     * @param {...(Function|Function[])} [predicates=[_.identity]]
19754     *  The predicates to check.
19755     * @returns {Function} Returns the new function.
19756     * @example
19757     *
19758     * var func = _.overEvery([Boolean, isFinite]);
19759     *
19760     * func('1');
19761     * // => true
19762     *
19763     * func(null);
19764     * // => false
19765     *
19766     * func(NaN);
19767     * // => false
19768     */
19769    var overEvery = createOver(arrayEvery);
19770
19771    /**
19772     * Creates a function that checks if **any** of the `predicates` return
19773     * truthy when invoked with the arguments it receives.
19774     *
19775     * Following shorthands are possible for providing predicates.
19776     * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
19777     * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
19778     *
19779     * @static
19780     * @memberOf _
19781     * @since 4.0.0
19782     * @category Util
19783     * @param {...(Function|Function[])} [predicates=[_.identity]]
19784     *  The predicates to check.
19785     * @returns {Function} Returns the new function.
19786     * @example
19787     *
19788     * var func = _.overSome([Boolean, isFinite]);
19789     *
19790     * func('1');
19791     * // => true
19792     *
19793     * func(null);
19794     * // => true
19795     *
19796     * func(NaN);
19797     * // => false
19798     *
19799     * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
19800     * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
19801     */
19802    var overSome = createOver(arraySome);
19803
19804    /**
19805     * Creates a function that returns the value at `path` of a given object.
19806     *
19807     * @static
19808     * @memberOf _
19809     * @since 2.4.0
19810     * @category Util
19811     * @param {Array|string} path The path of the property to get.
19812     * @returns {Function} Returns the new accessor function.
19813     * @example
19814     *
19815     * var objects = [
19816     *   { 'a': { 'b': 2 } },
19817     *   { 'a': { 'b': 1 } }
19818     * ];
19819     *
19820     * _.map(objects, _.property('a.b'));
19821     * // => [2, 1]
19822     *
19823     * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
19824     * // => [1, 2]
19825     */
19826    function property(path) {
19827      return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
19828    }
19829
19830    /**
19831     * The opposite of `_.property`; this method creates a function that returns
19832     * the value at a given path of `object`.
19833     *
19834     * @static
19835     * @memberOf _
19836     * @since 3.0.0
19837     * @category Util
19838     * @param {Object} object The object to query.
19839     * @returns {Function} Returns the new accessor function.
19840     * @example
19841     *
19842     * var array = [0, 1, 2],
19843     *     object = { 'a': array, 'b': array, 'c': array };
19844     *
19845     * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
19846     * // => [2, 0]
19847     *
19848     * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
19849     * // => [2, 0]
19850     */
19851    function propertyOf(object) {
19852      return function(path) {
19853        return object == null ? undefined : baseGet(object, path);
19854      };
19855    }
19856
19857    /**
19858     * Creates an array of numbers (positive and/or negative) progressing from
19859     * `start` up to, but not including, `end`. A step of `-1` is used if a negative
19860     * `start` is specified without an `end` or `step`. If `end` is not specified,
19861     * it's set to `start` with `start` then set to `0`.
19862     *
19863     * **Note:** JavaScript follows the IEEE-754 standard for resolving
19864     * floating-point values which can produce unexpected results.
19865     *
19866     * @static
19867     * @since 0.1.0
19868     * @memberOf _
19869     * @category Util
19870     * @param {number} [start=0] The start of the range.
19871     * @param {number} end The end of the range.
19872     * @param {number} [step=1] The value to increment or decrement by.
19873     * @returns {Array} Returns the range of numbers.
19874     * @see _.inRange, _.rangeRight
19875     * @example
19876     *
19877     * _.range(4);
19878     * // => [0, 1, 2, 3]
19879     *
19880     * _.range(-4);
19881     * // => [0, -1, -2, -3]
19882     *
19883     * _.range(1, 5);
19884     * // => [1, 2, 3, 4]
19885     *
19886     * _.range(0, 20, 5);
19887     * // => [0, 5, 10, 15]
19888     *
19889     * _.range(0, -4, -1);
19890     * // => [0, -1, -2, -3]
19891     *
19892     * _.range(1, 4, 0);
19893     * // => [1, 1, 1]
19894     *
19895     * _.range(0);
19896     * // => []
19897     */
19898    var range = createRange();
19899
19900    /**
19901     * This method is like `_.range` except that it populates values in
19902     * descending order.
19903     *
19904     * @static
19905     * @memberOf _
19906     * @since 4.0.0
19907     * @category Util
19908     * @param {number} [start=0] The start of the range.
19909     * @param {number} end The end of the range.
19910     * @param {number} [step=1] The value to increment or decrement by.
19911     * @returns {Array} Returns the range of numbers.
19912     * @see _.inRange, _.range
19913     * @example
19914     *
19915     * _.rangeRight(4);
19916     * // => [3, 2, 1, 0]
19917     *
19918     * _.rangeRight(-4);
19919     * // => [-3, -2, -1, 0]
19920     *
19921     * _.rangeRight(1, 5);
19922     * // => [4, 3, 2, 1]
19923     *
19924     * _.rangeRight(0, 20, 5);
19925     * // => [15, 10, 5, 0]
19926     *
19927     * _.rangeRight(0, -4, -1);
19928     * // => [-3, -2, -1, 0]
19929     *
19930     * _.rangeRight(1, 4, 0);
19931     * // => [1, 1, 1]
19932     *
19933     * _.rangeRight(0);
19934     * // => []
19935     */
19936    var rangeRight = createRange(true);
19937
19938    /**
19939     * This method returns a new empty array.
19940     *
19941     * @static
19942     * @memberOf _
19943     * @since 4.13.0
19944     * @category Util
19945     * @returns {Array} Returns the new empty array.
19946     * @example
19947     *
19948     * var arrays = _.times(2, _.stubArray);
19949     *
19950     * console.log(arrays);
19951     * // => [[], []]
19952     *
19953     * console.log(arrays[0] === arrays[1]);
19954     * // => false
19955     */
19956    function stubArray() {
19957      return [];
19958    }
19959
19960    /**
19961     * This method returns `false`.
19962     *
19963     * @static
19964     * @memberOf _
19965     * @since 4.13.0
19966     * @category Util
19967     * @returns {boolean} Returns `false`.
19968     * @example
19969     *
19970     * _.times(2, _.stubFalse);
19971     * // => [false, false]
19972     */
19973    function stubFalse() {
19974      return false;
19975    }
19976
19977    /**
19978     * This method returns a new empty object.
19979     *
19980     * @static
19981     * @memberOf _
19982     * @since 4.13.0
19983     * @category Util
19984     * @returns {Object} Returns the new empty object.
19985     * @example
19986     *
19987     * var objects = _.times(2, _.stubObject);
19988     *
19989     * console.log(objects);
19990     * // => [{}, {}]
19991     *
19992     * console.log(objects[0] === objects[1]);
19993     * // => false
19994     */
19995    function stubObject() {
19996      return {};
19997    }
19998
19999    /**
20000     * This method returns an empty string.
20001     *
20002     * @static
20003     * @memberOf _
20004     * @since 4.13.0
20005     * @category Util
20006     * @returns {string} Returns the empty string.
20007     * @example
20008     *
20009     * _.times(2, _.stubString);
20010     * // => ['', '']
20011     */
20012    function stubString() {
20013      return '';
20014    }
20015
20016    /**
20017     * This method returns `true`.
20018     *
20019     * @static
20020     * @memberOf _
20021     * @since 4.13.0
20022     * @category Util
20023     * @returns {boolean} Returns `true`.
20024     * @example
20025     *
20026     * _.times(2, _.stubTrue);
20027     * // => [true, true]
20028     */
20029    function stubTrue() {
20030      return true;
20031    }
20032
20033    /**
20034     * Invokes the iteratee `n` times, returning an array of the results of
20035     * each invocation. The iteratee is invoked with one argument; (index).
20036     *
20037     * @static
20038     * @since 0.1.0
20039     * @memberOf _
20040     * @category Util
20041     * @param {number} n The number of times to invoke `iteratee`.
20042     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
20043     * @returns {Array} Returns the array of results.
20044     * @example
20045     *
20046     * _.times(3, String);
20047     * // => ['0', '1', '2']
20048     *
20049     *  _.times(4, _.constant(0));
20050     * // => [0, 0, 0, 0]
20051     */
20052    function times(n, iteratee) {
20053      n = toInteger(n);
20054      if (n < 1 || n > MAX_SAFE_INTEGER) {
20055        return [];
20056      }
20057      var index = MAX_ARRAY_LENGTH,
20058          length = nativeMin(n, MAX_ARRAY_LENGTH);
20059
20060      iteratee = getIteratee(iteratee);
20061      n -= MAX_ARRAY_LENGTH;
20062
20063      var result = baseTimes(length, iteratee);
20064      while (++index < n) {
20065        iteratee(index);
20066      }
20067      return result;
20068    }
20069
20070    /**
20071     * Converts `value` to a property path array.
20072     *
20073     * @static
20074     * @memberOf _
20075     * @since 4.0.0
20076     * @category Util
20077     * @param {*} value The value to convert.
20078     * @returns {Array} Returns the new property path array.
20079     * @example
20080     *
20081     * _.toPath('a.b.c');
20082     * // => ['a', 'b', 'c']
20083     *
20084     * _.toPath('a[0].b.c');
20085     * // => ['a', '0', 'b', 'c']
20086     */
20087    function toPath(value) {
20088      if (isArray(value)) {
20089        return arrayMap(value, toKey);
20090      }
20091      return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
20092    }
20093
20094    /**
20095     * Generates a unique ID. If `prefix` is given, the ID is appended to it.
20096     *
20097     * @static
20098     * @since 0.1.0
20099     * @memberOf _
20100     * @category Util
20101     * @param {string} [prefix=''] The value to prefix the ID with.
20102     * @returns {string} Returns the unique ID.
20103     * @example
20104     *
20105     * _.uniqueId('contact_');
20106     * // => 'contact_104'
20107     *
20108     * _.uniqueId();
20109     * // => '105'
20110     */
20111    function uniqueId(prefix) {
20112      var id = ++idCounter;
20113      return toString(prefix) + id;
20114    }
20115
20116    /*------------------------------------------------------------------------*/
20117
20118    /**
20119     * Adds two numbers.
20120     *
20121     * @static
20122     * @memberOf _
20123     * @since 3.4.0
20124     * @category Math
20125     * @param {number} augend The first number in an addition.
20126     * @param {number} addend The second number in an addition.
20127     * @returns {number} Returns the total.
20128     * @example
20129     *
20130     * _.add(6, 4);
20131     * // => 10
20132     */
20133    var add = createMathOperation(function(augend, addend) {
20134      return augend + addend;
20135    }, 0);
20136
20137    /**
20138     * Computes `number` rounded up to `precision`.
20139     *
20140     * @static
20141     * @memberOf _
20142     * @since 3.10.0
20143     * @category Math
20144     * @param {number} number The number to round up.
20145     * @param {number} [precision=0] The precision to round up to.
20146     * @returns {number} Returns the rounded up number.
20147     * @example
20148     *
20149     * _.ceil(4.006);
20150     * // => 5
20151     *
20152     * _.ceil(6.004, 2);
20153     * // => 6.01
20154     *
20155     * _.ceil(6040, -2);
20156     * // => 6100
20157     */
20158    var ceil = createRound('ceil');
20159
20160    /**
20161     * Divide two numbers.
20162     *
20163     * @static
20164     * @memberOf _
20165     * @since 4.7.0
20166     * @category Math
20167     * @param {number} dividend The first number in a division.
20168     * @param {number} divisor The second number in a division.
20169     * @returns {number} Returns the quotient.
20170     * @example
20171     *
20172     * _.divide(6, 4);
20173     * // => 1.5
20174     */
20175    var divide = createMathOperation(function(dividend, divisor) {
20176      return dividend / divisor;
20177    }, 1);
20178
20179    /**
20180     * Computes `number` rounded down to `precision`.
20181     *
20182     * @static
20183     * @memberOf _
20184     * @since 3.10.0
20185     * @category Math
20186     * @param {number} number The number to round down.
20187     * @param {number} [precision=0] The precision to round down to.
20188     * @returns {number} Returns the rounded down number.
20189     * @example
20190     *
20191     * _.floor(4.006);
20192     * // => 4
20193     *
20194     * _.floor(0.046, 2);
20195     * // => 0.04
20196     *
20197     * _.floor(4060, -2);
20198     * // => 4000
20199     */
20200    var floor = createRound('floor');
20201
20202    /**
20203     * Computes the maximum value of `array`. If `array` is empty or falsey,
20204     * `undefined` is returned.
20205     *
20206     * @static
20207     * @since 0.1.0
20208     * @memberOf _
20209     * @category Math
20210     * @param {Array} array The array to iterate over.
20211     * @returns {*} Returns the maximum value.
20212     * @example
20213     *
20214     * _.max([4, 2, 8, 6]);
20215     * // => 8
20216     *
20217     * _.max([]);
20218     * // => undefined
20219     */
20220    function max(array) {
20221      return (array && array.length)
20222        ? baseExtremum(array, identity, baseGt)
20223        : undefined;
20224    }
20225
20226    /**
20227     * This method is like `_.max` except that it accepts `iteratee` which is
20228     * invoked for each element in `array` to generate the criterion by which
20229     * the value is ranked. The iteratee is invoked with one argument: (value).
20230     *
20231     * @static
20232     * @memberOf _
20233     * @since 4.0.0
20234     * @category Math
20235     * @param {Array} array The array to iterate over.
20236     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
20237     * @returns {*} Returns the maximum value.
20238     * @example
20239     *
20240     * var objects = [{ 'n': 1 }, { 'n': 2 }];
20241     *
20242     * _.maxBy(objects, function(o) { return o.n; });
20243     * // => { 'n': 2 }
20244     *
20245     * // The `_.property` iteratee shorthand.
20246     * _.maxBy(objects, 'n');
20247     * // => { 'n': 2 }
20248     */
20249    function maxBy(array, iteratee) {
20250      return (array && array.length)
20251        ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
20252        : undefined;
20253    }
20254
20255    /**
20256     * Computes the mean of the values in `array`.
20257     *
20258     * @static
20259     * @memberOf _
20260     * @since 4.0.0
20261     * @category Math
20262     * @param {Array} array The array to iterate over.
20263     * @returns {number} Returns the mean.
20264     * @example
20265     *
20266     * _.mean([4, 2, 8, 6]);
20267     * // => 5
20268     */
20269    function mean(array) {
20270      return baseMean(array, identity);
20271    }
20272
20273    /**
20274     * This method is like `_.mean` except that it accepts `iteratee` which is
20275     * invoked for each element in `array` to generate the value to be averaged.
20276     * The iteratee is invoked with one argument: (value).
20277     *
20278     * @static
20279     * @memberOf _
20280     * @since 4.7.0
20281     * @category Math
20282     * @param {Array} array The array to iterate over.
20283     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
20284     * @returns {number} Returns the mean.
20285     * @example
20286     *
20287     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
20288     *
20289     * _.meanBy(objects, function(o) { return o.n; });
20290     * // => 5
20291     *
20292     * // The `_.property` iteratee shorthand.
20293     * _.meanBy(objects, 'n');
20294     * // => 5
20295     */
20296    function meanBy(array, iteratee) {
20297      return baseMean(array, getIteratee(iteratee, 2));
20298    }
20299
20300    /**
20301     * Computes the minimum value of `array`. If `array` is empty or falsey,
20302     * `undefined` is returned.
20303     *
20304     * @static
20305     * @since 0.1.0
20306     * @memberOf _
20307     * @category Math
20308     * @param {Array} array The array to iterate over.
20309     * @returns {*} Returns the minimum value.
20310     * @example
20311     *
20312     * _.min([4, 2, 8, 6]);
20313     * // => 2
20314     *
20315     * _.min([]);
20316     * // => undefined
20317     */
20318    function min(array) {
20319      return (array && array.length)
20320        ? baseExtremum(array, identity, baseLt)
20321        : undefined;
20322    }
20323
20324    /**
20325     * This method is like `_.min` except that it accepts `iteratee` which is
20326     * invoked for each element in `array` to generate the criterion by which
20327     * the value is ranked. The iteratee is invoked with one argument: (value).
20328     *
20329     * @static
20330     * @memberOf _
20331     * @since 4.0.0
20332     * @category Math
20333     * @param {Array} array The array to iterate over.
20334     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
20335     * @returns {*} Returns the minimum value.
20336     * @example
20337     *
20338     * var objects = [{ 'n': 1 }, { 'n': 2 }];
20339     *
20340     * _.minBy(objects, function(o) { return o.n; });
20341     * // => { 'n': 1 }
20342     *
20343     * // The `_.property` iteratee shorthand.
20344     * _.minBy(objects, 'n');
20345     * // => { 'n': 1 }
20346     */
20347    function minBy(array, iteratee) {
20348      return (array && array.length)
20349        ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
20350        : undefined;
20351    }
20352
20353    /**
20354     * Multiply two numbers.
20355     *
20356     * @static
20357     * @memberOf _
20358     * @since 4.7.0
20359     * @category Math
20360     * @param {number} multiplier The first number in a multiplication.
20361     * @param {number} multiplicand The second number in a multiplication.
20362     * @returns {number} Returns the product.
20363     * @example
20364     *
20365     * _.multiply(6, 4);
20366     * // => 24
20367     */
20368    var multiply = createMathOperation(function(multiplier, multiplicand) {
20369      return multiplier * multiplicand;
20370    }, 1);
20371
20372    /**
20373     * Computes `number` rounded to `precision`.
20374     *
20375     * @static
20376     * @memberOf _
20377     * @since 3.10.0
20378     * @category Math
20379     * @param {number} number The number to round.
20380     * @param {number} [precision=0] The precision to round to.
20381     * @returns {number} Returns the rounded number.
20382     * @example
20383     *
20384     * _.round(4.006);
20385     * // => 4
20386     *
20387     * _.round(4.006, 2);
20388     * // => 4.01
20389     *
20390     * _.round(4060, -2);
20391     * // => 4100
20392     */
20393    var round = createRound('round');
20394
20395    /**
20396     * Subtract two numbers.
20397     *
20398     * @static
20399     * @memberOf _
20400     * @since 4.0.0
20401     * @category Math
20402     * @param {number} minuend The first number in a subtraction.
20403     * @param {number} subtrahend The second number in a subtraction.
20404     * @returns {number} Returns the difference.
20405     * @example
20406     *
20407     * _.subtract(6, 4);
20408     * // => 2
20409     */
20410    var subtract = createMathOperation(function(minuend, subtrahend) {
20411      return minuend - subtrahend;
20412    }, 0);
20413
20414    /**
20415     * Computes the sum of the values in `array`.
20416     *
20417     * @static
20418     * @memberOf _
20419     * @since 3.4.0
20420     * @category Math
20421     * @param {Array} array The array to iterate over.
20422     * @returns {number} Returns the sum.
20423     * @example
20424     *
20425     * _.sum([4, 2, 8, 6]);
20426     * // => 20
20427     */
20428    function sum(array) {
20429      return (array && array.length)
20430        ? baseSum(array, identity)
20431        : 0;
20432    }
20433
20434    /**
20435     * This method is like `_.sum` except that it accepts `iteratee` which is
20436     * invoked for each element in `array` to generate the value to be summed.
20437     * The iteratee is invoked with one argument: (value).
20438     *
20439     * @static
20440     * @memberOf _
20441     * @since 4.0.0
20442     * @category Math
20443     * @param {Array} array The array to iterate over.
20444     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
20445     * @returns {number} Returns the sum.
20446     * @example
20447     *
20448     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
20449     *
20450     * _.sumBy(objects, function(o) { return o.n; });
20451     * // => 20
20452     *
20453     * // The `_.property` iteratee shorthand.
20454     * _.sumBy(objects, 'n');
20455     * // => 20
20456     */
20457    function sumBy(array, iteratee) {
20458      return (array && array.length)
20459        ? baseSum(array, getIteratee(iteratee, 2))
20460        : 0;
20461    }
20462
20463    /*------------------------------------------------------------------------*/
20464
20465    // Add methods that return wrapped values in chain sequences.
20466    lodash.after = after;
20467    lodash.ary = ary;
20468    lodash.assign = assign;
20469    lodash.assignIn = assignIn;
20470    lodash.assignInWith = assignInWith;
20471    lodash.assignWith = assignWith;
20472    lodash.at = at;
20473    lodash.before = before;
20474    lodash.bind = bind;
20475    lodash.bindAll = bindAll;
20476    lodash.bindKey = bindKey;
20477    lodash.castArray = castArray;
20478    lodash.chain = chain;
20479    lodash.chunk = chunk;
20480    lodash.compact = compact;
20481    lodash.concat = concat;
20482    lodash.cond = cond;
20483    lodash.conforms = conforms;
20484    lodash.constant = constant;
20485    lodash.countBy = countBy;
20486    lodash.create = create;
20487    lodash.curry = curry;
20488    lodash.curryRight = curryRight;
20489    lodash.debounce = debounce;
20490    lodash.defaults = defaults;
20491    lodash.defaultsDeep = defaultsDeep;
20492    lodash.defer = defer;
20493    lodash.delay = delay;
20494    lodash.difference = difference;
20495    lodash.differenceBy = differenceBy;
20496    lodash.differenceWith = differenceWith;
20497    lodash.drop = drop;
20498    lodash.dropRight = dropRight;
20499    lodash.dropRightWhile = dropRightWhile;
20500    lodash.dropWhile = dropWhile;
20501    lodash.fill = fill;
20502    lodash.filter = filter;
20503    lodash.flatMap = flatMap;
20504    lodash.flatMapDeep = flatMapDeep;
20505    lodash.flatMapDepth = flatMapDepth;
20506    lodash.flatten = flatten;
20507    lodash.flattenDeep = flattenDeep;
20508    lodash.flattenDepth = flattenDepth;
20509    lodash.flip = flip;
20510    lodash.flow = flow;
20511    lodash.flowRight = flowRight;
20512    lodash.fromPairs = fromPairs;
20513    lodash.functions = functions;
20514    lodash.functionsIn = functionsIn;
20515    lodash.groupBy = groupBy;
20516    lodash.initial = initial;
20517    lodash.intersection = intersection;
20518    lodash.intersectionBy = intersectionBy;
20519    lodash.intersectionWith = intersectionWith;
20520    lodash.invert = invert;
20521    lodash.invertBy = invertBy;
20522    lodash.invokeMap = invokeMap;
20523    lodash.iteratee = iteratee;
20524    lodash.keyBy = keyBy;
20525    lodash.keys = keys;
20526    lodash.keysIn = keysIn;
20527    lodash.map = map;
20528    lodash.mapKeys = mapKeys;
20529    lodash.mapValues = mapValues;
20530    lodash.matches = matches;
20531    lodash.matchesProperty = matchesProperty;
20532    lodash.memoize = memoize;
20533    lodash.merge = merge;
20534    lodash.mergeWith = mergeWith;
20535    lodash.method = method;
20536    lodash.methodOf = methodOf;
20537    lodash.mixin = mixin;
20538    lodash.negate = negate;
20539    lodash.nthArg = nthArg;
20540    lodash.omit = omit;
20541    lodash.omitBy = omitBy;
20542    lodash.once = once;
20543    lodash.orderBy = orderBy;
20544    lodash.over = over;
20545    lodash.overArgs = overArgs;
20546    lodash.overEvery = overEvery;
20547    lodash.overSome = overSome;
20548    lodash.partial = partial;
20549    lodash.partialRight = partialRight;
20550    lodash.partition = partition;
20551    lodash.pick = pick;
20552    lodash.pickBy = pickBy;
20553    lodash.property = property;
20554    lodash.propertyOf = propertyOf;
20555    lodash.pull = pull;
20556    lodash.pullAll = pullAll;
20557    lodash.pullAllBy = pullAllBy;
20558    lodash.pullAllWith = pullAllWith;
20559    lodash.pullAt = pullAt;
20560    lodash.range = range;
20561    lodash.rangeRight = rangeRight;
20562    lodash.rearg = rearg;
20563    lodash.reject = reject;
20564    lodash.remove = remove;
20565    lodash.rest = rest;
20566    lodash.reverse = reverse;
20567    lodash.sampleSize = sampleSize;
20568    lodash.set = set;
20569    lodash.setWith = setWith;
20570    lodash.shuffle = shuffle;
20571    lodash.slice = slice;
20572    lodash.sortBy = sortBy;
20573    lodash.sortedUniq = sortedUniq;
20574    lodash.sortedUniqBy = sortedUniqBy;
20575    lodash.split = split;
20576    lodash.spread = spread;
20577    lodash.tail = tail;
20578    lodash.take = take;
20579    lodash.takeRight = takeRight;
20580    lodash.takeRightWhile = takeRightWhile;
20581    lodash.takeWhile = takeWhile;
20582    lodash.tap = tap;
20583    lodash.throttle = throttle;
20584    lodash.thru = thru;
20585    lodash.toArray = toArray;
20586    lodash.toPairs = toPairs;
20587    lodash.toPairsIn = toPairsIn;
20588    lodash.toPath = toPath;
20589    lodash.toPlainObject = toPlainObject;
20590    lodash.transform = transform;
20591    lodash.unary = unary;
20592    lodash.union = union;
20593    lodash.unionBy = unionBy;
20594    lodash.unionWith = unionWith;
20595    lodash.uniq = uniq;
20596    lodash.uniqBy = uniqBy;
20597    lodash.uniqWith = uniqWith;
20598    lodash.unset = unset;
20599    lodash.unzip = unzip;
20600    lodash.unzipWith = unzipWith;
20601    lodash.update = update;
20602    lodash.updateWith = updateWith;
20603    lodash.values = values;
20604    lodash.valuesIn = valuesIn;
20605    lodash.without = without;
20606    lodash.words = words;
20607    lodash.wrap = wrap;
20608    lodash.xor = xor;
20609    lodash.xorBy = xorBy;
20610    lodash.xorWith = xorWith;
20611    lodash.zip = zip;
20612    lodash.zipObject = zipObject;
20613    lodash.zipObjectDeep = zipObjectDeep;
20614    lodash.zipWith = zipWith;
20615
20616    // Add aliases.
20617    lodash.entries = toPairs;
20618    lodash.entriesIn = toPairsIn;
20619    lodash.extend = assignIn;
20620    lodash.extendWith = assignInWith;
20621
20622    // Add methods to `lodash.prototype`.
20623    mixin(lodash, lodash);
20624
20625    /*------------------------------------------------------------------------*/
20626
20627    // Add methods that return unwrapped values in chain sequences.
20628    lodash.add = add;
20629    lodash.attempt = attempt;
20630    lodash.camelCase = camelCase;
20631    lodash.capitalize = capitalize;
20632    lodash.ceil = ceil;
20633    lodash.clamp = clamp;
20634    lodash.clone = clone;
20635    lodash.cloneDeep = cloneDeep;
20636    lodash.cloneDeepWith = cloneDeepWith;
20637    lodash.cloneWith = cloneWith;
20638    lodash.conformsTo = conformsTo;
20639    lodash.deburr = deburr;
20640    lodash.defaultTo = defaultTo;
20641    lodash.divide = divide;
20642    lodash.endsWith = endsWith;
20643    lodash.eq = eq;
20644    lodash.escape = escape;
20645    lodash.escapeRegExp = escapeRegExp;
20646    lodash.every = every;
20647    lodash.find = find;
20648    lodash.findIndex = findIndex;
20649    lodash.findKey = findKey;
20650    lodash.findLast = findLast;
20651    lodash.findLastIndex = findLastIndex;
20652    lodash.findLastKey = findLastKey;
20653    lodash.floor = floor;
20654    lodash.forEach = forEach;
20655    lodash.forEachRight = forEachRight;
20656    lodash.forIn = forIn;
20657    lodash.forInRight = forInRight;
20658    lodash.forOwn = forOwn;
20659    lodash.forOwnRight = forOwnRight;
20660    lodash.get = get;
20661    lodash.gt = gt;
20662    lodash.gte = gte;
20663    lodash.has = has;
20664    lodash.hasIn = hasIn;
20665    lodash.head = head;
20666    lodash.identity = identity;
20667    lodash.includes = includes;
20668    lodash.indexOf = indexOf;
20669    lodash.inRange = inRange;
20670    lodash.invoke = invoke;
20671    lodash.isArguments = isArguments;
20672    lodash.isArray = isArray;
20673    lodash.isArrayBuffer = isArrayBuffer;
20674    lodash.isArrayLike = isArrayLike;
20675    lodash.isArrayLikeObject = isArrayLikeObject;
20676    lodash.isBoolean = isBoolean;
20677    lodash.isBuffer = isBuffer;
20678    lodash.isDate = isDate;
20679    lodash.isElement = isElement;
20680    lodash.isEmpty = isEmpty;
20681    lodash.isEqual = isEqual;
20682    lodash.isEqualWith = isEqualWith;
20683    lodash.isError = isError;
20684    lodash.isFinite = isFinite;
20685    lodash.isFunction = isFunction;
20686    lodash.isInteger = isInteger;
20687    lodash.isLength = isLength;
20688    lodash.isMap = isMap;
20689    lodash.isMatch = isMatch;
20690    lodash.isMatchWith = isMatchWith;
20691    lodash.isNaN = isNaN;
20692    lodash.isNative = isNative;
20693    lodash.isNil = isNil;
20694    lodash.isNull = isNull;
20695    lodash.isNumber = isNumber;
20696    lodash.isObject = isObject;
20697    lodash.isObjectLike = isObjectLike;
20698    lodash.isPlainObject = isPlainObject;
20699    lodash.isRegExp = isRegExp;
20700    lodash.isSafeInteger = isSafeInteger;
20701    lodash.isSet = isSet;
20702    lodash.isString = isString;
20703    lodash.isSymbol = isSymbol;
20704    lodash.isTypedArray = isTypedArray;
20705    lodash.isUndefined = isUndefined;
20706    lodash.isWeakMap = isWeakMap;
20707    lodash.isWeakSet = isWeakSet;
20708    lodash.join = join;
20709    lodash.kebabCase = kebabCase;
20710    lodash.last = last;
20711    lodash.lastIndexOf = lastIndexOf;
20712    lodash.lowerCase = lowerCase;
20713    lodash.lowerFirst = lowerFirst;
20714    lodash.lt = lt;
20715    lodash.lte = lte;
20716    lodash.max = max;
20717    lodash.maxBy = maxBy;
20718    lodash.mean = mean;
20719    lodash.meanBy = meanBy;
20720    lodash.min = min;
20721    lodash.minBy = minBy;
20722    lodash.stubArray = stubArray;
20723    lodash.stubFalse = stubFalse;
20724    lodash.stubObject = stubObject;
20725    lodash.stubString = stubString;
20726    lodash.stubTrue = stubTrue;
20727    lodash.multiply = multiply;
20728    lodash.nth = nth;
20729    lodash.noConflict = noConflict;
20730    lodash.noop = noop;
20731    lodash.now = now;
20732    lodash.pad = pad;
20733    lodash.padEnd = padEnd;
20734    lodash.padStart = padStart;
20735    lodash.parseInt = parseInt;
20736    lodash.random = random;
20737    lodash.reduce = reduce;
20738    lodash.reduceRight = reduceRight;
20739    lodash.repeat = repeat;
20740    lodash.replace = replace;
20741    lodash.result = result;
20742    lodash.round = round;
20743    lodash.runInContext = runInContext;
20744    lodash.sample = sample;
20745    lodash.size = size;
20746    lodash.snakeCase = snakeCase;
20747    lodash.some = some;
20748    lodash.sortedIndex = sortedIndex;
20749    lodash.sortedIndexBy = sortedIndexBy;
20750    lodash.sortedIndexOf = sortedIndexOf;
20751    lodash.sortedLastIndex = sortedLastIndex;
20752    lodash.sortedLastIndexBy = sortedLastIndexBy;
20753    lodash.sortedLastIndexOf = sortedLastIndexOf;
20754    lodash.startCase = startCase;
20755    lodash.startsWith = startsWith;
20756    lodash.subtract = subtract;
20757    lodash.sum = sum;
20758    lodash.sumBy = sumBy;
20759    lodash.template = template;
20760    lodash.times = times;
20761    lodash.toFinite = toFinite;
20762    lodash.toInteger = toInteger;
20763    lodash.toLength = toLength;
20764    lodash.toLower = toLower;
20765    lodash.toNumber = toNumber;
20766    lodash.toSafeInteger = toSafeInteger;
20767    lodash.toString = toString;
20768    lodash.toUpper = toUpper;
20769    lodash.trim = trim;
20770    lodash.trimEnd = trimEnd;
20771    lodash.trimStart = trimStart;
20772    lodash.truncate = truncate;
20773    lodash.unescape = unescape;
20774    lodash.uniqueId = uniqueId;
20775    lodash.upperCase = upperCase;
20776    lodash.upperFirst = upperFirst;
20777
20778    // Add aliases.
20779    lodash.each = forEach;
20780    lodash.eachRight = forEachRight;
20781    lodash.first = head;
20782
20783    mixin(lodash, (function() {
20784      var source = {};
20785      baseForOwn(lodash, function(func, methodName) {
20786        if (!hasOwnProperty.call(lodash.prototype, methodName)) {
20787          source[methodName] = func;
20788        }
20789      });
20790      return source;
20791    }()), { 'chain': false });
20792
20793    /*------------------------------------------------------------------------*/
20794
20795    /**
20796     * The semantic version number.
20797     *
20798     * @static
20799     * @memberOf _
20800     * @type {string}
20801     */
20802    lodash.VERSION = VERSION;
20803
20804    // Assign default placeholders.
20805    arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
20806      lodash[methodName].placeholder = lodash;
20807    });
20808
20809    // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
20810    arrayEach(['drop', 'take'], function(methodName, index) {
20811      LazyWrapper.prototype[methodName] = function(n) {
20812        n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
20813
20814        var result = (this.__filtered__ && !index)
20815          ? new LazyWrapper(this)
20816          : this.clone();
20817
20818        if (result.__filtered__) {
20819          result.__takeCount__ = nativeMin(n, result.__takeCount__);
20820        } else {
20821          result.__views__.push({
20822            'size': nativeMin(n, MAX_ARRAY_LENGTH),
20823            'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
20824          });
20825        }
20826        return result;
20827      };
20828
20829      LazyWrapper.prototype[methodName + 'Right'] = function(n) {
20830        return this.reverse()[methodName](n).reverse();
20831      };
20832    });
20833
20834    // Add `LazyWrapper` methods that accept an `iteratee` value.
20835    arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
20836      var type = index + 1,
20837          isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
20838
20839      LazyWrapper.prototype[methodName] = function(iteratee) {
20840        var result = this.clone();
20841        result.__iteratees__.push({
20842          'iteratee': getIteratee(iteratee, 3),
20843          'type': type
20844        });
20845        result.__filtered__ = result.__filtered__ || isFilter;
20846        return result;
20847      };
20848    });
20849
20850    // Add `LazyWrapper` methods for `_.head` and `_.last`.
20851    arrayEach(['head', 'last'], function(methodName, index) {
20852      var takeName = 'take' + (index ? 'Right' : '');
20853
20854      LazyWrapper.prototype[methodName] = function() {
20855        return this[takeName](1).value()[0];
20856      };
20857    });
20858
20859    // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
20860    arrayEach(['initial', 'tail'], function(methodName, index) {
20861      var dropName = 'drop' + (index ? '' : 'Right');
20862
20863      LazyWrapper.prototype[methodName] = function() {
20864        return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
20865      };
20866    });
20867
20868    LazyWrapper.prototype.compact = function() {
20869      return this.filter(identity);
20870    };
20871
20872    LazyWrapper.prototype.find = function(predicate) {
20873      return this.filter(predicate).head();
20874    };
20875
20876    LazyWrapper.prototype.findLast = function(predicate) {
20877      return this.reverse().find(predicate);
20878    };
20879
20880    LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
20881      if (typeof path == 'function') {
20882        return new LazyWrapper(this);
20883      }
20884      return this.map(function(value) {
20885        return baseInvoke(value, path, args);
20886      });
20887    });
20888
20889    LazyWrapper.prototype.reject = function(predicate) {
20890      return this.filter(negate(getIteratee(predicate)));
20891    };
20892
20893    LazyWrapper.prototype.slice = function(start, end) {
20894      start = toInteger(start);
20895
20896      var result = this;
20897      if (result.__filtered__ && (start > 0 || end < 0)) {
20898        return new LazyWrapper(result);
20899      }
20900      if (start < 0) {
20901        result = result.takeRight(-start);
20902      } else if (start) {
20903        result = result.drop(start);
20904      }
20905      if (end !== undefined) {
20906        end = toInteger(end);
20907        result = end < 0 ? result.dropRight(-end) : result.take(end - start);
20908      }
20909      return result;
20910    };
20911
20912    LazyWrapper.prototype.takeRightWhile = function(predicate) {
20913      return this.reverse().takeWhile(predicate).reverse();
20914    };
20915
20916    LazyWrapper.prototype.toArray = function() {
20917      return this.take(MAX_ARRAY_LENGTH);
20918    };
20919
20920    // Add `LazyWrapper` methods to `lodash.prototype`.
20921    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
20922      var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
20923          isTaker = /^(?:head|last)$/.test(methodName),
20924          lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
20925          retUnwrapped = isTaker || /^find/.test(methodName);
20926
20927      if (!lodashFunc) {
20928        return;
20929      }
20930      lodash.prototype[methodName] = function() {
20931        var value = this.__wrapped__,
20932            args = isTaker ? [1] : arguments,
20933            isLazy = value instanceof LazyWrapper,
20934            iteratee = args[0],
20935            useLazy = isLazy || isArray(value);
20936
20937        var interceptor = function(value) {
20938          var result = lodashFunc.apply(lodash, arrayPush([value], args));
20939          return (isTaker && chainAll) ? result[0] : result;
20940        };
20941
20942        if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
20943          // Avoid lazy use if the iteratee has a "length" value other than `1`.
20944          isLazy = useLazy = false;
20945        }
20946        var chainAll = this.__chain__,
20947            isHybrid = !!this.__actions__.length,
20948            isUnwrapped = retUnwrapped && !chainAll,
20949            onlyLazy = isLazy && !isHybrid;
20950
20951        if (!retUnwrapped && useLazy) {
20952          value = onlyLazy ? value : new LazyWrapper(this);
20953          var result = func.apply(value, args);
20954          result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
20955          return new LodashWrapper(result, chainAll);
20956        }
20957        if (isUnwrapped && onlyLazy) {
20958          return func.apply(this, args);
20959        }
20960        result = this.thru(interceptor);
20961        return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
20962      };
20963    });
20964
20965    // Add `Array` methods to `lodash.prototype`.
20966    arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
20967      var func = arrayProto[methodName],
20968          chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
20969          retUnwrapped = /^(?:pop|shift)$/.test(methodName);
20970
20971      lodash.prototype[methodName] = function() {
20972        var args = arguments;
20973        if (retUnwrapped && !this.__chain__) {
20974          var value = this.value();
20975          return func.apply(isArray(value) ? value : [], args);
20976        }
20977        return this[chainName](function(value) {
20978          return func.apply(isArray(value) ? value : [], args);
20979        });
20980      };
20981    });
20982
20983    // Map minified method names to their real names.
20984    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
20985      var lodashFunc = lodash[methodName];
20986      if (lodashFunc) {
20987        var key = lodashFunc.name + '';
20988        if (!hasOwnProperty.call(realNames, key)) {
20989          realNames[key] = [];
20990        }
20991        realNames[key].push({ 'name': methodName, 'func': lodashFunc });
20992      }
20993    });
20994
20995    realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
20996      'name': 'wrapper',
20997      'func': undefined
20998    }];
20999
21000    // Add methods to `LazyWrapper`.
21001    LazyWrapper.prototype.clone = lazyClone;
21002    LazyWrapper.prototype.reverse = lazyReverse;
21003    LazyWrapper.prototype.value = lazyValue;
21004
21005    // Add chain sequence methods to the `lodash` wrapper.
21006    lodash.prototype.at = wrapperAt;
21007    lodash.prototype.chain = wrapperChain;
21008    lodash.prototype.commit = wrapperCommit;
21009    lodash.prototype.next = wrapperNext;
21010    lodash.prototype.plant = wrapperPlant;
21011    lodash.prototype.reverse = wrapperReverse;
21012    lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
21013
21014    // Add lazy aliases.
21015    lodash.prototype.first = lodash.prototype.head;
21016
21017    if (symIterator) {
21018      lodash.prototype[symIterator] = wrapperToIterator;
21019    }
21020    return lodash;
21021  });
21022
21023  /*--------------------------------------------------------------------------*/
21024
21025  // Export lodash.
21026  var _ = runInContext();
21027
21028  // Some AMD build optimizers, like r.js, check for condition patterns like:
21029  if (true) {
21030    // Expose Lodash on the global object to prevent errors when Lodash is
21031    // loaded by a script tag in the presence of an AMD loader.
21032    // See http://requirejs.org/docs/errors.html#mismatch for more details.
21033    // Use `_.noConflict` to remove Lodash from the global object.
21034    root._ = _;
21035
21036    // Define as an anonymous module so, through path mapping, it can be
21037    // referenced as the "underscore" module.
21038    !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
21039      return _;
21040    }).call(exports, __webpack_require__, exports, module),
21041		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
21042  }
21043  // Check for `exports` after `define` in case a build optimizer adds it.
21044  else {}
21045}.call(this));
21046
21047
21048/***/ }),
21049
21050/***/ "./resources/css/app.css":
21051/*!*******************************!*\
21052  !*** ./resources/css/app.css ***!
21053  \*******************************/
21054/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21055
21056"use strict";
21057__webpack_require__.r(__webpack_exports__);
21058// extracted by mini-css-extract-plugin
21059
21060
21061/***/ }),
21062
vendor: 5,633 bytes, lines 21063-21255
21063/***/ "./node_modules/process/browser.js":
21064/*!*****************************************!*\
21065  !*** ./node_modules/process/browser.js ***!
21066  \*****************************************/
21067/***/ ((module) => {
21068
21069// shim for using process in browser
21070var process = module.exports = {};
21071
21072// cached from whatever global is present so that test runners that stub it
21073// don't break things.  But we need to wrap it in a try catch in case it is
21074// wrapped in strict mode code which doesn't define any globals.  It's inside a
21075// function because try/catches deoptimize in certain engines.
21076
21077var cachedSetTimeout;
21078var cachedClearTimeout;
21079
21080function defaultSetTimout() {
21081    throw new Error('setTimeout has not been defined');
21082}
21083function defaultClearTimeout () {
21084    throw new Error('clearTimeout has not been defined');
21085}
21086(function () {
21087    try {
21088        if (typeof setTimeout === 'function') {
21089            cachedSetTimeout = setTimeout;
21090        } else {
21091            cachedSetTimeout = defaultSetTimout;
21092        }
21093    } catch (e) {
21094        cachedSetTimeout = defaultSetTimout;
21095    }
21096    try {
21097        if (typeof clearTimeout === 'function') {
21098            cachedClearTimeout = clearTimeout;
21099        } else {
21100            cachedClearTimeout = defaultClearTimeout;
21101        }
21102    } catch (e) {
21103        cachedClearTimeout = defaultClearTimeout;
21104    }
21105} ())
21106function runTimeout(fun) {
21107    if (cachedSetTimeout === setTimeout) {
21108        //normal enviroments in sane situations
21109        return setTimeout(fun, 0);
21110    }
21111    // if setTimeout wasn't available but was latter defined
21112    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
21113        cachedSetTimeout = setTimeout;
21114        return setTimeout(fun, 0);
21115    }
21116    try {
21117        // when when somebody has screwed with setTimeout but no I.E. maddness
21118        return cachedSetTimeout(fun, 0);
21119    } catch(e){
21120        try {
21121            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
21122            return cachedSetTimeout.call(null, fun, 0);
21123        } catch(e){
21124            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
21125            return cachedSetTimeout.call(this, fun, 0);
21126        }
21127    }
21128
21129
21130}
21131function runClearTimeout(marker) {
21132    if (cachedClearTimeout === clearTimeout) {
21133        //normal enviroments in sane situations
21134        return clearTimeout(marker);
21135    }
21136    // if clearTimeout wasn't available but was latter defined
21137    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
21138        cachedClearTimeout = clearTimeout;
21139        return clearTimeout(marker);
21140    }
21141    try {
21142        // when when somebody has screwed with setTimeout but no I.E. maddness
21143        return cachedClearTimeout(marker);
21144    } catch (e){
21145        try {
21146            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
21147            return cachedClearTimeout.call(null, marker);
21148        } catch (e){
21149            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
21150            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
21151            return cachedClearTimeout.call(this, marker);
21152        }
21153    }
21154
21155
21156
21157}
21158var queue = [];
21159var draining = false;
21160var currentQueue;
21161var queueIndex = -1;
21162
21163function cleanUpNextTick() {
21164    if (!draining || !currentQueue) {
21165        return;
21166    }
21167    draining = false;
21168    if (currentQueue.length) {
21169        queue = currentQueue.concat(queue);
21170    } else {
21171        queueIndex = -1;
21172    }
21173    if (queue.length) {
21174        drainQueue();
21175    }
21176}
21177
21178function drainQueue() {
21179    if (draining) {
21180        return;
21181    }
21182    var timeout = runTimeout(cleanUpNextTick);
21183    draining = true;
21184
21185    var len = queue.length;
21186    while(len) {
21187        currentQueue = queue;
21188        queue = [];
21189        while (++queueIndex < len) {
21190            if (currentQueue) {
21191                currentQueue[queueIndex].run();
21192            }
21193        }
21194        queueIndex = -1;
21195        len = queue.length;
21196    }
21197    currentQueue = null;
21198    draining = false;
21199    runClearTimeout(timeout);
21200}
21201
21202process.nextTick = function (fun) {
21203    var args = new Array(arguments.length - 1);
21204    if (arguments.length > 1) {
21205        for (var i = 1; i < arguments.length; i++) {
21206            args[i - 1] = arguments[i];
21207        }
21208    }
21209    queue.push(new Item(fun, args));
21210    if (queue.length === 1 && !draining) {
21211        runTimeout(drainQueue);
21212    }
21213};
21214
21215// v8 likes predictible objects
21216function Item(fun, array) {
21217    this.fun = fun;
21218    this.array = array;
21219}
21220Item.prototype.run = function () {
21221    this.fun.apply(null, this.array);
21222};
21223process.title = 'browser';
21224process.browser = true;
21225process.env = {};
21226process.argv = [];
21227process.version = ''; // empty string to avoid regexp issues
21228process.versions = {};
21229
21230function noop() {}
21231
21232process.on = noop;
21233process.addListener = noop;
21234process.once = noop;
21235process.off = noop;
21236process.removeListener = noop;
21237process.removeAllListeners = noop;
21238process.emit = noop;
21239process.prependListener = noop;
21240process.prependOnceListener = noop;
21241
21242process.listeners = function (name) { return [] }
21243
21244process.binding = function (name) {
21245    throw new Error('process.binding is not supported');
21246};
21247
21248process.cwd = function () { return '/' };
21249process.chdir = function (dir) {
21250    throw new Error('process.chdir is not supported');
21251};
21252process.umask = function() { return 0; };
21253
21254
21255/***/ })
vendor: 4,133 bytes, lines 21255-21364
21255
21256
21257/******/ 	});
21258/************************************************************************/
21259/******/ 	// The module cache
21260/******/ 	var __webpack_module_cache__ = {};
21261/******/ 	
21262/******/ 	// The require function
21263/******/ 	function __webpack_require__(moduleId) {
21264/******/ 		// Check if module is in cache
21265/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
21266/******/ 		if (cachedModule !== undefined) {
21267/******/ 			return cachedModule.exports;
21268/******/ 		}
21269/******/ 		// Create a new module (and put it into the cache)
21270/******/ 		var module = __webpack_module_cache__[moduleId] = {
21271/******/ 			id: moduleId,
21272/******/ 			loaded: false,
21273/******/ 			exports: {}
21274/******/ 		};
21275/******/ 	
21276/******/ 		// Execute the module function
21277/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21278/******/ 	
21279/******/ 		// Flag the module as loaded
21280/******/ 		module.loaded = true;
21281/******/ 	
21282/******/ 		// Return the exports of the module
21283/******/ 		return module.exports;
21284/******/ 	}
21285/******/ 	
21286/******/ 	// expose the modules object (__webpack_modules__)
21287/******/ 	__webpack_require__.m = __webpack_modules__;
21288/******/ 	
21289/************************************************************************/
21290/******/ 	/* webpack/runtime/chunk loaded */
21291/******/ 	(() => {
21292/******/ 		var deferred = [];
21293/******/ 		__webpack_require__.O = (result, chunkIds, fn, priority) => {
21294/******/ 			if(chunkIds) {
21295/******/ 				priority = priority || 0;
21296/******/ 				for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
21297/******/ 				deferred[i] = [chunkIds, fn, priority];
21298/******/ 				return;
21299/******/ 			}
21300/******/ 			var notFulfilled = Infinity;
21301/******/ 			for (var i = 0; i < deferred.length; i++) {
21302/******/ 				var [chunkIds, fn, priority] = deferred[i];
21303/******/ 				var fulfilled = true;
21304/******/ 				for (var j = 0; j < chunkIds.length; j++) {
21305/******/ 					if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
21306/******/ 						chunkIds.splice(j--, 1);
21307/******/ 					} else {
21308/******/ 						fulfilled = false;
21309/******/ 						if(priority < notFulfilled) notFulfilled = priority;
21310/******/ 					}
21311/******/ 				}
21312/******/ 				if(fulfilled) {
21313/******/ 					deferred.splice(i--, 1)
21314/******/ 					result = fn();
21315/******/ 				}
21316/******/ 			}
21317/******/ 			return result;
21318/******/ 		};
21319/******/ 	})();
21320/******/ 	
21321/******/ 	/* webpack/runtime/global */
21322/******/ 	(() => {
21323/******/ 		__webpack_require__.g = (function() {
21324/******/ 			if (typeof globalThis === 'object') return globalThis;
21325/******/ 			try {
21326/******/ 				return this || new Function('return this')();
21327/******/ 			} catch (e) {
21328/******/ 				if (typeof window === 'object') return window;
21329/******/ 			}
21330/******/ 		})();
21331/******/ 	})();
21332/******/ 	
21333/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
21334/******/ 	(() => {
21335/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
21336/******/ 	})();
21337/******/ 	
21338/******/ 	/* webpack/runtime/make namespace object */
21339/******/ 	(() => {
21340/******/ 		// define __esModule on exports
21341/******/ 		__webpack_require__.r = (exports) => {
21342/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
21343/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
21344/******/ 			}
21345/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
21346/******/ 		};
21347/******/ 	})();
21348/******/ 	
21349/******/ 	/* webpack/runtime/node module decorator */
21350/******/ 	(() => {
21351/******/ 		__webpack_require__.nmd = (module) => {
21352/******/ 			module.paths = [];
21353/******/ 			if (!module.children) module.children = [];
21354/******/ 			return module;
21355/******/ 		};
21356/******/ 	})();
21357/******/ 	
21358/******/ 	/* webpack/runtime/jsonp chunk loading */
21359/******/ 	(() => {
21360/******/ 		// no baseURI
21361/******/ 		
21362/******/ 		// object to store loaded and loading chunks
21363/******/ 		// undefined = chunk not loaded, null = chunk preloaded/prefetched
21364/******/ 		// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
21365/******/ 		var installedChunks = {
21366/******/ 			"/js/app": 0
21367/******/ 		};
21368/******/ 		
21369/******/ 		// no chunk on demand loading
21370/******/ 		
21371/******/ 		// no prefetching
21372/******/ 		
21373/******/ 		// no preloaded
21374/******/ 		
21375/******/ 		// no HMR
21376/******/ 		
21377/******/ 		// no HMR manifest
21378/******/ 		
21379/******/ 		__webpack_require__.O.j = (chunkId) => (true);
21380/******/ 		
21381/******/ 		// install a JSONP callback for chunk loading
21382/******/ 		var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
21383/******/ 			var [chunkIds, moreModules, runtime] = data;
21384/******/ 			// add "moreModules" to the modules object,
21385/******/ 			// then flag all "chunkIds" as loaded and fire callback
21386/******/ 			var moduleId, chunkId, i = 0;
21387/******/ 			for(moduleId in moreModules) {
21388/******/ 				if(__webpack_require__.o(moreModules, moduleId)) {
21389/******/ 					__webpack_require__.m[moduleId] = moreModules[moduleId];
21390/******/ 				}
21391/******/ 			}
21392/******/ 			if(runtime) runtime(__webpack_require__);
21393/******/ 			if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
21394/******/ 			for(;i < chunkIds.length; i++) {
21395/******/ 				chunkId = chunkIds[i];
21396/******/ 				if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
21397/******/ 					installedChunks[chunkId][0]();
21398/******/ 				}
21399/******/ 				installedChunks[chunkIds[i]] = 0;
21400/******/ 			}
21401/******/ 			__webpack_require__.O();
21402/******/ 		}
21403/******/ 		
21404/******/ 		var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
21405/******/ 		chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
21406/******/ 		chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
21407/******/ 	})();
21408/******/ 	
21409/************************************************************************/
21410/******/ 	
21411/******/ 	// startup
21412/******/ 	// Load entry module and return exports
21413/******/ 	// This entry module depends on other loaded chunks and execution need to be delayed
21414/******/ 	__webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/js/app.js")))
21415/******/ 	var __webpack_exports__ = __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/css/app.css")))
21416/******/ 	__webpack_exports__ = __webpack_require__.O(__webpack_exports__);
21417/******/ 	
21418/******/ })()
21419;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.