vendor: 3,595 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = "/"; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 0); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
vendor: 361 bytes, lines 89-99
89/***/ "./node_modules/axios/index.js": 90/*!*************************************!*\ 91 !*** ./node_modules/axios/index.js ***! 92 \*************************************/ 93/*! no static exports found */ 94/***/ (function(module, exports, __webpack_require__) { 95 96module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); 97 98/***/ }), 99
vendor: 6,658 bytes, lines 100-291
100/***/ "./node_modules/axios/lib/adapters/xhr.js": 101/*!************************************************!*\ 102 !*** ./node_modules/axios/lib/adapters/xhr.js ***! 103 \************************************************/ 104/*! no static exports found */ 105/***/ (function(module, exports, __webpack_require__) { 106 107"use strict"; 108 109 110var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 111var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); 112var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 113var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); 114var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); 115var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); 116var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); 117 118module.exports = function xhrAdapter(config) { 119 return new Promise(function dispatchXhrRequest(resolve, reject) { 120 var requestData = config.data; 121 var requestHeaders = config.headers; 122 123 if (utils.isFormData(requestData)) { 124 delete requestHeaders['Content-Type']; // Let the browser set it 125 } 126 127 var request = new XMLHttpRequest(); 128 129 // HTTP basic authentication 130 if (config.auth) { 131 var username = config.auth.username || ''; 132 var password = config.auth.password || ''; 133 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 134 } 135 136 var fullPath = buildFullPath(config.baseURL, config.url); 137 request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); 138 139 // Set the request timeout in MS 140 request.timeout = config.timeout; 141 142 // Listen for ready state 143 request.onreadystatechange = function handleLoad() { 144 if (!request || request.readyState !== 4) { 145 return; 146 } 147 148 // The request errored out and we didn't get a response, this will be 149 // handled by onerror instead 150 // With one exception: request that using file: protocol, most browsers 151 // will return status as 0 even though it's a successful request 152 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 153 return; 154 } 155 156 // Prepare the response 157 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 158 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 159 var response = { 160 data: responseData, 161 status: request.status, 162 statusText: request.statusText, 163 headers: responseHeaders, 164 config: config, 165 request: request 166 }; 167 168 settle(resolve, reject, response); 169 170 // Clean up request 171 request = null; 172 }; 173 174 // Handle browser request cancellation (as opposed to a manual cancellation) 175 request.onabort = function handleAbort() { 176 if (!request) { 177 return; 178 } 179 180 reject(createError('Request aborted', config, 'ECONNABORTED', request)); 181 182 // Clean up request 183 request = null; 184 }; 185 186 // Handle low level network errors 187 request.onerror = function handleError() { 188 // Real errors are hidden from us by the browser 189 // onerror should only fire if it's a network error 190 reject(createError('Network Error', config, null, request)); 191 192 // Clean up request 193 request = null; 194 }; 195 196 // Handle timeout 197 request.ontimeout = function handleTimeout() { 198 var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; 199 if (config.timeoutErrorMessage) { 200 timeoutErrorMessage = config.timeoutErrorMessage; 201 } 202 reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', 203 request)); 204 205 // Clean up request 206 request = null; 207 }; 208 209 // Add xsrf header 210 // This is only done if running in a standard browser environment. 211 // Specifically not if we're in a web worker, or react-native. 212 if (utils.isStandardBrowserEnv()) { 213 var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); 214 215 // Add xsrf header 216 var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? 217 cookies.read(config.xsrfCookieName) : 218 undefined; 219 220 if (xsrfValue) { 221 requestHeaders[config.xsrfHeaderName] = xsrfValue; 222 } 223 } 224 225 // Add headers to the request 226 if ('setRequestHeader' in request) { 227 utils.forEach(requestHeaders, function setRequestHeader(val, key) { 228 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 229 // Remove Content-Type if data is undefined 230 delete requestHeaders[key]; 231 } else { 232 // Otherwise add header to the request 233 request.setRequestHeader(key, val); 234 } 235 }); 236 } 237 238 // Add withCredentials to request if needed 239 if (!utils.isUndefined(config.withCredentials)) { 240 request.withCredentials = !!config.withCredentials; 241 } 242 243 // Add responseType to request if needed 244 if (config.responseType) { 245 try { 246 request.responseType = config.responseType; 247 } catch (e) { 248 // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. 249 // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. 250 if (config.responseType !== 'json') { 251 throw e; 252 } 253 } 254 } 255 256 // Handle progress if needed 257 if (typeof config.onDownloadProgress === 'function') { 258 request.addEventListener('progress', config.onDownloadProgress); 259 } 260 261 // Not all browsers support upload events 262 if (typeof config.onUploadProgress === 'function' && request.upload) { 263 request.upload.addEventListener('progress', config.onUploadProgress); 264 } 265 266 if (config.cancelToken) { 267 // Handle cancellation 268 config.cancelToken.promise.then(function onCanceled(cancel) { 269 if (!request) { 270 return; 271 } 272 273 request.abort(); 274 reject(cancel); 275 // Clean up request 276 request = null; 277 }); 278 } 279 280 if (requestData === undefined) { 281 requestData = null; 282 } 283 284 // Send the request 285 request.send(requestData); 286 }); 287}; 288 289 290/***/ }), 291
vendor: 2,251 bytes, lines 292-356
292/***/ "./node_modules/axios/lib/axios.js": 293/*!*****************************************!*\ 294 !*** ./node_modules/axios/lib/axios.js ***! 295 \*****************************************/ 296/*! no static exports found */ 297/***/ (function(module, exports, __webpack_require__) { 298 299"use strict"; 300 301 302var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 303var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 304var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); 305var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 306var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); 307 308/** 309 * Create an instance of Axios 310 * 311 * @param {Object} defaultConfig The default config for the instance 312 * @return {Axios} A new instance of Axios 313 */ 314function createInstance(defaultConfig) { 315 var context = new Axios(defaultConfig); 316 var instance = bind(Axios.prototype.request, context); 317 318 // Copy axios.prototype to instance 319 utils.extend(instance, Axios.prototype, context); 320 321 // Copy context to instance 322 utils.extend(instance, context); 323 324 return instance; 325} 326 327// Create the default instance to be exported 328var axios = createInstance(defaults); 329 330// Expose Axios class to allow class inheritance 331axios.Axios = Axios; 332 333// Factory for creating new instances 334axios.create = function create(instanceConfig) { 335 return createInstance(mergeConfig(axios.defaults, instanceConfig)); 336}; 337 338// Expose Cancel & CancelToken 339axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 340axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); 341axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 342 343// Expose all/spread 344axios.all = function all(promises) { 345 return Promise.all(promises); 346}; 347axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); 348 349module.exports = axios; 350 351// Allow use of default import syntax in TypeScript 352module.exports.default = axios; 353 354 355/***/ }), 356
vendor: 702 bytes, lines 357-387
357/***/ "./node_modules/axios/lib/cancel/Cancel.js": 358/*!*************************************************!*\ 359 !*** ./node_modules/axios/lib/cancel/Cancel.js ***! 360 \*************************************************/ 361/*! no static exports found */ 362/***/ (function(module, exports, __webpack_require__) { 363 364"use strict"; 365 366 367/** 368 * A `Cancel` is an object that is thrown when an operation is canceled. 369 * 370 * @class 371 * @param {string=} message The message. 372 */ 373function Cancel(message) { 374 this.message = message; 375} 376 377Cancel.prototype.toString = function toString() { 378 return 'Cancel' + (this.message ? ': ' + this.message : ''); 379}; 380 381Cancel.prototype.__CANCEL__ = true; 382 383module.exports = Cancel; 384 385 386/***/ }), 387
vendor: 1,638 bytes, lines 388-456
388/***/ "./node_modules/axios/lib/cancel/CancelToken.js": 389/*!******************************************************!*\ 390 !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! 391 \******************************************************/ 392/*! no static exports found */ 393/***/ (function(module, exports, __webpack_require__) { 394 395"use strict"; 396 397 398var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 399 400/** 401 * A `CancelToken` is an object that can be used to request cancellation of an operation. 402 * 403 * @class 404 * @param {Function} executor The executor function. 405 */ 406function CancelToken(executor) { 407 if (typeof executor !== 'function') { 408 throw new TypeError('executor must be a function.'); 409 } 410 411 var resolvePromise; 412 this.promise = new Promise(function promiseExecutor(resolve) { 413 resolvePromise = resolve; 414 }); 415 416 var token = this; 417 executor(function cancel(message) { 418 if (token.reason) { 419 // Cancellation has already been requested 420 return; 421 } 422 423 token.reason = new Cancel(message); 424 resolvePromise(token.reason); 425 }); 426} 427 428/** 429 * Throws a `Cancel` if cancellation has been requested. 430 */ 431CancelToken.prototype.throwIfRequested = function throwIfRequested() { 432 if (this.reason) { 433 throw this.reason; 434 } 435}; 436 437/** 438 * Returns an object that contains a new `CancelToken` and a function that, when called, 439 * cancels the `CancelToken`. 440 */ 441CancelToken.source = function source() { 442 var cancel; 443 var token = new CancelToken(function executor(c) { 444 cancel = c; 445 }); 446 return { 447 token: token, 448 cancel: cancel 449 }; 450}; 451 452module.exports = CancelToken; 453 454 455/***/ }), 456
vendor: 427 bytes, lines 457-473
457/***/ "./node_modules/axios/lib/cancel/isCancel.js": 458/*!***************************************************!*\ 459 !*** ./node_modules/axios/lib/cancel/isCancel.js ***! 460 \***************************************************/ 461/*! no static exports found */ 462/***/ (function(module, exports, __webpack_require__) { 463 464"use strict"; 465 466 467module.exports = function isCancel(value) { 468 return !!(value && value.__CANCEL__); 469}; 470 471 472/***/ }), 473
vendor: 3,240 bytes, lines 474-579
474/***/ "./node_modules/axios/lib/core/Axios.js": 475/*!**********************************************!*\ 476 !*** ./node_modules/axios/lib/core/Axios.js ***! 477 \**********************************************/ 478/*! no static exports found */ 479/***/ (function(module, exports, __webpack_require__) { 480 481"use strict"; 482 483 484var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 485var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 486var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); 487var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); 488var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 489 490/** 491 * Create a new instance of Axios 492 * 493 * @param {Object} instanceConfig The default config for the instance 494 */ 495function Axios(instanceConfig) { 496 this.defaults = instanceConfig; 497 this.interceptors = { 498 request: new InterceptorManager(), 499 response: new InterceptorManager() 500 }; 501} 502 503/** 504 * Dispatch a request 505 * 506 * @param {Object} config The config specific for this request (merged with this.defaults) 507 */ 508Axios.prototype.request = function request(config) { 509 /*eslint no-param-reassign:0*/ 510 // Allow for axios('example/url'[, config]) a la fetch API 511 if (typeof config === 'string') { 512 config = arguments[1] || {}; 513 config.url = arguments[0]; 514 } else { 515 config = config || {}; 516 } 517 518 config = mergeConfig(this.defaults, config); 519 520 // Set config.method 521 if (config.method) { 522 config.method = config.method.toLowerCase(); 523 } else if (this.defaults.method) { 524 config.method = this.defaults.method.toLowerCase(); 525 } else { 526 config.method = 'get'; 527 } 528 529 // Hook up interceptors middleware 530 var chain = [dispatchRequest, undefined]; 531 var promise = Promise.resolve(config); 532 533 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 534 chain.unshift(interceptor.fulfilled, interceptor.rejected); 535 }); 536 537 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 538 chain.push(interceptor.fulfilled, interceptor.rejected); 539 }); 540 541 while (chain.length) { 542 promise = promise.then(chain.shift(), chain.shift()); 543 } 544 545 return promise; 546}; 547 548Axios.prototype.getUri = function getUri(config) { 549 config = mergeConfig(this.defaults, config); 550 return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); 551}; 552 553// Provide aliases for supported request methods 554utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 555 /*eslint func-names:0*/ 556 Axios.prototype[method] = function(url, config) { 557 return this.request(utils.merge(config || {}, { 558 method: method, 559 url: url 560 })); 561 }; 562}); 563 564utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 565 /*eslint func-names:0*/ 566 Axios.prototype[method] = function(url, data, config) { 567 return this.request(utils.merge(config || {}, { 568 method: method, 569 url: url, 570 data: data 571 })); 572 }; 573}); 574 575module.exports = Axios; 576 577 578/***/ }), 579
vendor: 1,661 bytes, lines 580-643
580/***/ "./node_modules/axios/lib/core/InterceptorManager.js": 581/*!***********************************************************!*\ 582 !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! 583 \***********************************************************/ 584/*! no static exports found */ 585/***/ (function(module, exports, __webpack_require__) { 586 587"use strict"; 588 589 590var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 591 592function InterceptorManager() { 593 this.handlers = []; 594} 595 596/** 597 * Add a new interceptor to the stack 598 * 599 * @param {Function} fulfilled The function to handle `then` for a `Promise` 600 * @param {Function} rejected The function to handle `reject` for a `Promise` 601 * 602 * @return {Number} An ID used to remove interceptor later 603 */ 604InterceptorManager.prototype.use = function use(fulfilled, rejected) { 605 this.handlers.push({ 606 fulfilled: fulfilled, 607 rejected: rejected 608 }); 609 return this.handlers.length - 1; 610}; 611 612/** 613 * Remove an interceptor from the stack 614 * 615 * @param {Number} id The ID that was returned by `use` 616 */ 617InterceptorManager.prototype.eject = function eject(id) { 618 if (this.handlers[id]) { 619 this.handlers[id] = null; 620 } 621}; 622 623/** 624 * Iterate over all the registered interceptors 625 * 626 * This method is particularly useful for skipping over any 627 * interceptors that may have become `null` calling `eject`. 628 * 629 * @param {Function} fn The function to call for each interceptor 630 */ 631InterceptorManager.prototype.forEach = function forEach(fn) { 632 utils.forEach(this.handlers, function forEachHandler(h) { 633 if (h !== null) { 634 fn(h); 635 } 636 }); 637}; 638 639module.exports = InterceptorManager; 640 641 642/***/ }), 643
vendor: 1,168 bytes, lines 644-675
644/***/ "./node_modules/axios/lib/core/buildFullPath.js": 645/*!******************************************************!*\ 646 !*** ./node_modules/axios/lib/core/buildFullPath.js ***! 647 \******************************************************/ 648/*! no static exports found */ 649/***/ (function(module, exports, __webpack_require__) { 650 651"use strict"; 652 653 654var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); 655var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); 656 657/** 658 * Creates a new URL by combining the baseURL with the requestedURL, 659 * only when the requestedURL is not already an absolute URL. 660 * If the requestURL is absolute, this function returns the requestedURL untouched. 661 * 662 * @param {string} baseURL The base URL 663 * @param {string} requestedURL Absolute or relative URL to combine 664 * @returns {string} The combined full path 665 */ 666module.exports = function buildFullPath(baseURL, requestedURL) { 667 if (baseURL && !isAbsoluteURL(requestedURL)) { 668 return combineURLs(baseURL, requestedURL); 669 } 670 return requestedURL; 671}; 672 673 674/***/ }), 675
vendor: 1,019 bytes, lines 676-705
676/***/ "./node_modules/axios/lib/core/createError.js": 677/*!****************************************************!*\ 678 !*** ./node_modules/axios/lib/core/createError.js ***! 679 \****************************************************/ 680/*! no static exports found */ 681/***/ (function(module, exports, __webpack_require__) { 682 683"use strict"; 684 685 686var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); 687 688/** 689 * Create an Error with the specified message, config, error code, request and response. 690 * 691 * @param {string} message The error message. 692 * @param {Object} config The config. 693 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 694 * @param {Object} [request] The request. 695 * @param {Object} [response] The response. 696 * @returns {Error} The created error. 697 */ 698module.exports = function createError(message, config, code, request, response) { 699 var error = new Error(message); 700 return enhanceError(error, config, code, request, response); 701}; 702 703 704/***/ }), 705
vendor: 2,517 bytes, lines 706-796
706/***/ "./node_modules/axios/lib/core/dispatchRequest.js": 707/*!********************************************************!*\ 708 !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! 709 \********************************************************/ 710/*! no static exports found */ 711/***/ (function(module, exports, __webpack_require__) { 712 713"use strict"; 714 715 716var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 717var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); 718var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 719var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); 720 721/** 722 * Throws a `Cancel` if cancellation has been requested. 723 */ 724function throwIfCancellationRequested(config) { 725 if (config.cancelToken) { 726 config.cancelToken.throwIfRequested(); 727 } 728} 729 730/** 731 * Dispatch a request to the server using the configured adapter. 732 * 733 * @param {object} config The config that is to be used for the request 734 * @returns {Promise} The Promise to be fulfilled 735 */ 736module.exports = function dispatchRequest(config) { 737 throwIfCancellationRequested(config); 738 739 // Ensure headers exist 740 config.headers = config.headers || {}; 741 742 // Transform request data 743 config.data = transformData( 744 config.data, 745 config.headers, 746 config.transformRequest 747 ); 748 749 // Flatten headers 750 config.headers = utils.merge( 751 config.headers.common || {}, 752 config.headers[config.method] || {}, 753 config.headers 754 ); 755 756 utils.forEach( 757 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 758 function cleanHeaderConfig(method) { 759 delete config.headers[method]; 760 } 761 ); 762 763 var adapter = config.adapter || defaults.adapter; 764 765 return adapter(config).then(function onAdapterResolution(response) { 766 throwIfCancellationRequested(config); 767 768 // Transform response data 769 response.data = transformData( 770 response.data, 771 response.headers, 772 config.transformResponse 773 ); 774 775 return response; 776 }, function onAdapterRejection(reason) { 777 if (!isCancel(reason)) { 778 throwIfCancellationRequested(config); 779 780 // Transform response data 781 if (reason && reason.response) { 782 reason.response.data = transformData( 783 reason.response.data, 784 reason.response.headers, 785 config.transformResponse 786 ); 787 } 788 } 789 790 return Promise.reject(reason); 791 }); 792}; 793 794 795/***/ }), 796
vendor: 1,375 bytes, lines 797-850
797/***/ "./node_modules/axios/lib/core/enhanceError.js": 798/*!*****************************************************!*\ 799 !*** ./node_modules/axios/lib/core/enhanceError.js ***! 800 \*****************************************************/ 801/*! no static exports found */ 802/***/ (function(module, exports, __webpack_require__) { 803 804"use strict"; 805 806 807/** 808 * Update an Error with the specified config, error code, and response. 809 * 810 * @param {Error} error The error to update. 811 * @param {Object} config The config. 812 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 813 * @param {Object} [request] The request. 814 * @param {Object} [response] The response. 815 * @returns {Error} The error. 816 */ 817module.exports = function enhanceError(error, config, code, request, response) { 818 error.config = config; 819 if (code) { 820 error.code = code; 821 } 822 823 error.request = request; 824 error.response = response; 825 error.isAxiosError = true; 826 827 error.toJSON = function() { 828 return { 829 // Standard 830 message: this.message, 831 name: this.name, 832 // Microsoft 833 description: this.description, 834 number: this.number, 835 // Mozilla 836 fileName: this.fileName, 837 lineNumber: this.lineNumber, 838 columnNumber: this.columnNumber, 839 stack: this.stack, 840 // Axios 841 config: this.config, 842 code: this.code 843 }; 844 }; 845 return error; 846}; 847 848 849/***/ }), 850
vendor: 2,792 bytes, lines 851-935
851/***/ "./node_modules/axios/lib/core/mergeConfig.js": 852/*!****************************************************!*\ 853 !*** ./node_modules/axios/lib/core/mergeConfig.js ***! 854 \****************************************************/ 855/*! no static exports found */ 856/***/ (function(module, exports, __webpack_require__) { 857 858"use strict"; 859 860 861var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 862 863/** 864 * Config-specific merge-function which creates a new config-object 865 * by merging two configuration objects together. 866 * 867 * @param {Object} config1 868 * @param {Object} config2 869 * @returns {Object} New object resulting from merging config2 to config1 870 */ 871module.exports = function mergeConfig(config1, config2) { 872 // eslint-disable-next-line no-param-reassign 873 config2 = config2 || {}; 874 var config = {}; 875 876 var valueFromConfig2Keys = ['url', 'method', 'params', 'data']; 877 var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy']; 878 var defaultToConfig2Keys = [ 879 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', 880 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 881 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 882 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', 883 'httpsAgent', 'cancelToken', 'socketPath' 884 ]; 885 886 utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { 887 if (typeof config2[prop] !== 'undefined') { 888 config[prop] = config2[prop]; 889 } 890 }); 891 892 utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) { 893 if (utils.isObject(config2[prop])) { 894 config[prop] = utils.deepMerge(config1[prop], config2[prop]); 895 } else if (typeof config2[prop] !== 'undefined') { 896 config[prop] = config2[prop]; 897 } else if (utils.isObject(config1[prop])) { 898 config[prop] = utils.deepMerge(config1[prop]); 899 } else if (typeof config1[prop] !== 'undefined') { 900 config[prop] = config1[prop]; 901 } 902 }); 903 904 utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { 905 if (typeof config2[prop] !== 'undefined') { 906 config[prop] = config2[prop]; 907 } else if (typeof config1[prop] !== 'undefined') { 908 config[prop] = config1[prop]; 909 } 910 }); 911 912 var axiosKeys = valueFromConfig2Keys 913 .concat(mergeDeepPropertiesKeys) 914 .concat(defaultToConfig2Keys); 915 916 var otherKeys = Object 917 .keys(config2) 918 .filter(function filterAxiosKeys(key) { 919 return axiosKeys.indexOf(key) === -1; 920 }); 921 922 utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) { 923 if (typeof config2[prop] !== 'undefined') { 924 config[prop] = config2[prop]; 925 } else if (typeof config1[prop] !== 'undefined') { 926 config[prop] = config1[prop]; 927 } 928 }); 929 930 return config; 931}; 932 933 934/***/ }), 935
vendor: 1,059 bytes, lines 936-972
936/***/ "./node_modules/axios/lib/core/settle.js": 937/*!***********************************************!*\ 938 !*** ./node_modules/axios/lib/core/settle.js ***! 939 \***********************************************/ 940/*! no static exports found */ 941/***/ (function(module, exports, __webpack_require__) { 942 943"use strict"; 944 945 946var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); 947 948/** 949 * Resolve or reject a Promise based on response status. 950 * 951 * @param {Function} resolve A function that resolves the promise. 952 * @param {Function} reject A function that rejects the promise. 953 * @param {object} response The response. 954 */ 955module.exports = function settle(resolve, reject, response) { 956 var validateStatus = response.config.validateStatus; 957 if (!validateStatus || validateStatus(response.status)) { 958 resolve(response); 959 } else { 960 reject(createError( 961 'Request failed with status code ' + response.status, 962 response.config, 963 null, 964 response.request, 965 response 966 )); 967 } 968}; 969 970 971/***/ }), 972
vendor: 940 bytes, lines 973-1004
973/***/ "./node_modules/axios/lib/core/transformData.js": 974/*!******************************************************!*\ 975 !*** ./node_modules/axios/lib/core/transformData.js ***! 976 \******************************************************/ 977/*! no static exports found */ 978/***/ (function(module, exports, __webpack_require__) { 979 980"use strict"; 981 982 983var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 984 985/** 986 * Transform the data for a request or a response 987 * 988 * @param {Object|String} data The data to be transformed 989 * @param {Array} headers The headers for the request or response 990 * @param {Array|Function} fns A single function or Array of functions 991 * @returns {*} The resulting transformed data 992 */ 993module.exports = function transformData(data, headers, fns) { 994 /*eslint no-param-reassign:0*/ 995 utils.forEach(fns, function transform(fn) { 996 data = fn(data, headers); 997 }); 998 999 return data; 1000}; 1001 1002 1003/***/ }), 1004
vendor: 3,267 bytes, lines 1005-1114
1005/***/ "./node_modules/axios/lib/defaults.js": 1006/*!********************************************!*\ 1007 !*** ./node_modules/axios/lib/defaults.js ***! 1008 \********************************************/ 1009/*! no static exports found */ 1010/***/ (function(module, exports, __webpack_require__) { 1011 1012"use strict"; 1013/* WEBPACK VAR INJECTION */(function(process) { 1014 1015var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 1016var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); 1017 1018var DEFAULT_CONTENT_TYPE = { 1019 'Content-Type': 'application/x-www-form-urlencoded' 1020}; 1021 1022function setContentTypeIfUnset(headers, value) { 1023 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 1024 headers['Content-Type'] = value; 1025 } 1026} 1027 1028function getDefaultAdapter() { 1029 var adapter; 1030 if (typeof XMLHttpRequest !== 'undefined') { 1031 // For browsers use XHR adapter 1032 adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); 1033 } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { 1034 // For node use HTTP adapter 1035 adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); 1036 } 1037 return adapter; 1038} 1039 1040var defaults = { 1041 adapter: getDefaultAdapter(), 1042 1043 transformRequest: [function transformRequest(data, headers) { 1044 normalizeHeaderName(headers, 'Accept'); 1045 normalizeHeaderName(headers, 'Content-Type'); 1046 if (utils.isFormData(data) || 1047 utils.isArrayBuffer(data) || 1048 utils.isBuffer(data) || 1049 utils.isStream(data) || 1050 utils.isFile(data) || 1051 utils.isBlob(data) 1052 ) { 1053 return data; 1054 } 1055 if (utils.isArrayBufferView(data)) { 1056 return data.buffer; 1057 } 1058 if (utils.isURLSearchParams(data)) { 1059 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 1060 return data.toString(); 1061 } 1062 if (utils.isObject(data)) { 1063 setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 1064 return JSON.stringify(data); 1065 } 1066 return data; 1067 }], 1068 1069 transformResponse: [function transformResponse(data) { 1070 /*eslint no-param-reassign:0*/ 1071 if (typeof data === 'string') { 1072 try { 1073 data = JSON.parse(data); 1074 } catch (e) { /* Ignore */ } 1075 } 1076 return data; 1077 }], 1078 1079 /** 1080 * A timeout in milliseconds to abort a request. If set to 0 (default) a 1081 * timeout is not created. 1082 */ 1083 timeout: 0, 1084 1085 xsrfCookieName: 'XSRF-TOKEN', 1086 xsrfHeaderName: 'X-XSRF-TOKEN', 1087 1088 maxContentLength: -1, 1089 1090 validateStatus: function validateStatus(status) { 1091 return status >= 200 && status < 300; 1092 } 1093}; 1094 1095defaults.headers = { 1096 common: { 1097 'Accept': 'application/json, text/plain, */*' 1098 } 1099}; 1100 1101utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 1102 defaults.headers[method] = {}; 1103}); 1104 1105utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 1106 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 1107}); 1108 1109module.exports = defaults; 1110 1111/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) 1112 1113/***/ }), 1114
vendor: 569 bytes, lines 1115-1137
1115/***/ "./node_modules/axios/lib/helpers/bind.js": 1116/*!************************************************!*\ 1117 !*** ./node_modules/axios/lib/helpers/bind.js ***! 1118 \************************************************/ 1119/*! no static exports found */ 1120/***/ (function(module, exports, __webpack_require__) { 1121 1122"use strict"; 1123 1124 1125module.exports = function bind(fn, thisArg) { 1126 return function wrap() { 1127 var args = new Array(arguments.length); 1128 for (var i = 0; i < args.length; i++) { 1129 args[i] = arguments[i]; 1130 } 1131 return fn.apply(thisArg, args); 1132 }; 1133}; 1134 1135 1136/***/ }), 1137
vendor: 2,053 bytes, lines 1138-1220
1138/***/ "./node_modules/axios/lib/helpers/buildURL.js": 1139/*!****************************************************!*\ 1140 !*** ./node_modules/axios/lib/helpers/buildURL.js ***! 1141 \****************************************************/ 1142/*! no static exports found */ 1143/***/ (function(module, exports, __webpack_require__) { 1144 1145"use strict"; 1146 1147 1148var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1149 1150function encode(val) { 1151 return encodeURIComponent(val). 1152 replace(/%40/gi, '@'). 1153 replace(/%3A/gi, ':'). 1154 replace(/%24/g, '$'). 1155 replace(/%2C/gi, ','). 1156 replace(/%20/g, '+'). 1157 replace(/%5B/gi, '['). 1158 replace(/%5D/gi, ']'); 1159} 1160 1161/** 1162 * Build a URL by appending params to the end 1163 * 1164 * @param {string} url The base of the url (e.g., http://www.google.com) 1165 * @param {object} [params] The params to be appended 1166 * @returns {string} The formatted url 1167 */ 1168module.exports = function buildURL(url, params, paramsSerializer) { 1169 /*eslint no-param-reassign:0*/ 1170 if (!params) { 1171 return url; 1172 } 1173 1174 var serializedParams; 1175 if (paramsSerializer) { 1176 serializedParams = paramsSerializer(params); 1177 } else if (utils.isURLSearchParams(params)) { 1178 serializedParams = params.toString(); 1179 } else { 1180 var parts = []; 1181 1182 utils.forEach(params, function serialize(val, key) { 1183 if (val === null || typeof val === 'undefined') { 1184 return; 1185 } 1186 1187 if (utils.isArray(val)) { 1188 key = key + '[]'; 1189 } else { 1190 val = [val]; 1191 } 1192 1193 utils.forEach(val, function parseValue(v) { 1194 if (utils.isDate(v)) { 1195 v = v.toISOString(); 1196 } else if (utils.isObject(v)) { 1197 v = JSON.stringify(v); 1198 } 1199 parts.push(encode(key) + '=' + encode(v)); 1200 }); 1201 }); 1202 1203 serializedParams = parts.join('&'); 1204 } 1205 1206 if (serializedParams) { 1207 var hashmarkIndex = url.indexOf('#'); 1208 if (hashmarkIndex !== -1) { 1209 url = url.slice(0, hashmarkIndex); 1210 } 1211 1212 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 1213 } 1214 1215 return url; 1216}; 1217 1218 1219/***/ }), 1220
vendor: 721 bytes, lines 1221-1246
1221/***/ "./node_modules/axios/lib/helpers/combineURLs.js": 1222/*!*******************************************************!*\ 1223 !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! 1224 \*******************************************************/ 1225/*! no static exports found */ 1226/***/ (function(module, exports, __webpack_require__) { 1227 1228"use strict"; 1229 1230 1231/** 1232 * Creates a new URL by combining the specified URLs 1233 * 1234 * @param {string} baseURL The base URL 1235 * @param {string} relativeURL The relative URL 1236 * @returns {string} The combined URL 1237 */ 1238module.exports = function combineURLs(baseURL, relativeURL) { 1239 return relativeURL 1240 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 1241 : baseURL; 1242}; 1243 1244 1245/***/ }), 1246
vendor: 1,813 bytes, lines 1247-1311
1247/***/ "./node_modules/axios/lib/helpers/cookies.js": 1248/*!***************************************************!*\ 1249 !*** ./node_modules/axios/lib/helpers/cookies.js ***! 1250 \***************************************************/ 1251/*! no static exports found */ 1252/***/ (function(module, exports, __webpack_require__) { 1253 1254"use strict"; 1255 1256 1257var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1258 1259module.exports = ( 1260 utils.isStandardBrowserEnv() ? 1261 1262 // Standard browser envs support document.cookie 1263 (function standardBrowserEnv() { 1264 return { 1265 write: function write(name, value, expires, path, domain, secure) { 1266 var cookie = []; 1267 cookie.push(name + '=' + encodeURIComponent(value)); 1268 1269 if (utils.isNumber(expires)) { 1270 cookie.push('expires=' + new Date(expires).toGMTString()); 1271 } 1272 1273 if (utils.isString(path)) { 1274 cookie.push('path=' + path); 1275 } 1276 1277 if (utils.isString(domain)) { 1278 cookie.push('domain=' + domain); 1279 } 1280 1281 if (secure === true) { 1282 cookie.push('secure'); 1283 } 1284 1285 document.cookie = cookie.join('; '); 1286 }, 1287 1288 read: function read(name) { 1289 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 1290 return (match ? decodeURIComponent(match[3]) : null); 1291 }, 1292 1293 remove: function remove(name) { 1294 this.write(name, '', Date.now() - 86400000); 1295 } 1296 }; 1297 })() : 1298 1299 // Non standard browser env (web workers, react-native) lack needed support. 1300 (function nonStandardBrowserEnv() { 1301 return { 1302 write: function write() {}, 1303 read: function read() { return null; }, 1304 remove: function remove() {} 1305 }; 1306 })() 1307); 1308 1309 1310/***/ }), 1311
vendor: 912 bytes, lines 1312-1337
1312/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": 1313/*!*********************************************************!*\ 1314 !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! 1315 \*********************************************************/ 1316/*! no static exports found */ 1317/***/ (function(module, exports, __webpack_require__) { 1318 1319"use strict"; 1320 1321 1322/** 1323 * Determines whether the specified URL is absolute 1324 * 1325 * @param {string} url The URL to test 1326 * @returns {boolean} True if the specified URL is absolute, otherwise false 1327 */ 1328module.exports = function isAbsoluteURL(url) { 1329 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 1330 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 1331 // by any combination of letters, digits, plus, period, or hyphen. 1332 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 1333}; 1334 1335 1336/***/ }), 1337
vendor: 2,715 bytes, lines 1338-1417
1338/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": 1339/*!***********************************************************!*\ 1340 !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! 1341 \***********************************************************/ 1342/*! no static exports found */ 1343/***/ (function(module, exports, __webpack_require__) { 1344 1345"use strict"; 1346 1347 1348var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1349 1350module.exports = ( 1351 utils.isStandardBrowserEnv() ? 1352 1353 // Standard browser envs have full support of the APIs needed to test 1354 // whether the request URL is of the same origin as current location. 1355 (function standardBrowserEnv() { 1356 var msie = /(msie|trident)/i.test(navigator.userAgent); 1357 var urlParsingNode = document.createElement('a'); 1358 var originURL; 1359 1360 /** 1361 * Parse a URL to discover it's components 1362 * 1363 * @param {String} url The URL to be parsed 1364 * @returns {Object} 1365 */ 1366 function resolveURL(url) { 1367 var href = url; 1368 1369 if (msie) { 1370 // IE needs attribute set twice to normalize properties 1371 urlParsingNode.setAttribute('href', href); 1372 href = urlParsingNode.href; 1373 } 1374 1375 urlParsingNode.setAttribute('href', href); 1376 1377 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 1378 return { 1379 href: urlParsingNode.href, 1380 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 1381 host: urlParsingNode.host, 1382 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 1383 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 1384 hostname: urlParsingNode.hostname, 1385 port: urlParsingNode.port, 1386 pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 1387 urlParsingNode.pathname : 1388 '/' + urlParsingNode.pathname 1389 }; 1390 } 1391 1392 originURL = resolveURL(window.location.href); 1393 1394 /** 1395 * Determine if a URL shares the same origin as the current location 1396 * 1397 * @param {String} requestURL The URL to test 1398 * @returns {boolean} True if URL shares the same origin, otherwise false 1399 */ 1400 return function isURLSameOrigin(requestURL) { 1401 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 1402 return (parsed.protocol === originURL.protocol && 1403 parsed.host === originURL.host); 1404 }; 1405 })() : 1406 1407 // Non standard browser envs (web workers, react-native) lack needed support. 1408 (function nonStandardBrowserEnv() { 1409 return function isURLSameOrigin() { 1410 return true; 1411 }; 1412 })() 1413); 1414 1415 1416/***/ }), 1417
vendor: 783 bytes, lines 1418-1441
1418/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": 1419/*!***************************************************************!*\ 1420 !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! 1421 \***************************************************************/ 1422/*! no static exports found */ 1423/***/ (function(module, exports, __webpack_require__) { 1424 1425"use strict"; 1426 1427 1428var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 1429 1430module.exports = function normalizeHeaderName(headers, normalizedName) { 1431 utils.forEach(headers, function processHeader(value, name) { 1432 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 1433 headers[normalizedName] = value; 1434 delete headers[name]; 1435 } 1436 }); 1437}; 1438 1439 1440/***/ }), 1441
vendor: 1,791 bytes, lines 1442-1506
1442/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": 1443/*!********************************************************!*\ 1444 !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! 1445 \********************************************************/ 1446/*! no static exports found */ 1447/***/ (function(module, exports, __webpack_require__) { 1448 1449"use strict"; 1450 1451 1452var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1453 1454// Headers whose duplicates are ignored by node 1455// c.f. https://nodejs.org/api/http.html#http_message_headers 1456var ignoreDuplicateOf = [ 1457 'age', 'authorization', 'content-length', 'content-type', 'etag', 1458 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 1459 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 1460 'referer', 'retry-after', 'user-agent' 1461]; 1462 1463/** 1464 * Parse headers into an object 1465 * 1466 * ``` 1467 * Date: Wed, 27 Aug 2014 08:58:49 GMT 1468 * Content-Type: application/json 1469 * Connection: keep-alive 1470 * Transfer-Encoding: chunked 1471 * ``` 1472 * 1473 * @param {String} headers Headers needing to be parsed 1474 * @returns {Object} Headers parsed into an object 1475 */ 1476module.exports = function parseHeaders(headers) { 1477 var parsed = {}; 1478 var key; 1479 var val; 1480 var i; 1481 1482 if (!headers) { return parsed; } 1483 1484 utils.forEach(headers.split('\n'), function parser(line) { 1485 i = line.indexOf(':'); 1486 key = utils.trim(line.substr(0, i)).toLowerCase(); 1487 val = utils.trim(line.substr(i + 1)); 1488 1489 if (key) { 1490 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 1491 return; 1492 } 1493 if (key === 'set-cookie') { 1494 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 1495 } else { 1496 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 1497 } 1498 } 1499 }); 1500 1501 return parsed; 1502}; 1503 1504 1505/***/ }), 1506
vendor: 885 bytes, lines 1507-1545
1507/***/ "./node_modules/axios/lib/helpers/spread.js": 1508/*!**************************************************!*\ 1509 !*** ./node_modules/axios/lib/helpers/spread.js ***! 1510 \**************************************************/ 1511/*! no static exports found */ 1512/***/ (function(module, exports, __webpack_require__) { 1513 1514"use strict"; 1515 1516 1517/** 1518 * Syntactic sugar for invoking a function and expanding an array for arguments. 1519 * 1520 * Common use case would be to use `Function.prototype.apply`. 1521 * 1522 * ```js 1523 * function f(x, y, z) {} 1524 * var args = [1, 2, 3]; 1525 * f.apply(null, args); 1526 * ``` 1527 * 1528 * With `spread` this example can be re-written. 1529 * 1530 * ```js 1531 * spread(function(x, y, z) {})([1, 2, 3]); 1532 * ``` 1533 * 1534 * @param {Function} callback 1535 * @returns {Function} 1536 */ 1537module.exports = function spread(callback) { 1538 return function wrap(arr) { 1539 return callback.apply(null, arr); 1540 }; 1541}; 1542 1543 1544/***/ }), 1545
vendor: 9,160 bytes, lines 1546-1901
1546/***/ "./node_modules/axios/lib/utils.js": 1547/*!*****************************************!*\ 1548 !*** ./node_modules/axios/lib/utils.js ***! 1549 \*****************************************/ 1550/*! no static exports found */ 1551/***/ (function(module, exports, __webpack_require__) { 1552 1553"use strict"; 1554 1555 1556var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 1557 1558/*global toString:true*/ 1559 1560// utils is a library of generic helper functions non-specific to axios 1561 1562var toString = Object.prototype.toString; 1563 1564/** 1565 * Determine if a value is an Array 1566 * 1567 * @param {Object} val The value to test 1568 * @returns {boolean} True if value is an Array, otherwise false 1569 */ 1570function isArray(val) { 1571 return toString.call(val) === '[object Array]'; 1572} 1573 1574/** 1575 * Determine if a value is undefined 1576 * 1577 * @param {Object} val The value to test 1578 * @returns {boolean} True if the value is undefined, otherwise false 1579 */ 1580function isUndefined(val) { 1581 return typeof val === 'undefined'; 1582} 1583 1584/** 1585 * Determine if a value is a Buffer 1586 * 1587 * @param {Object} val The value to test 1588 * @returns {boolean} True if value is a Buffer, otherwise false 1589 */ 1590function isBuffer(val) { 1591 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) 1592 && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); 1593} 1594 1595/** 1596 * Determine if a value is an ArrayBuffer 1597 * 1598 * @param {Object} val The value to test 1599 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 1600 */ 1601function isArrayBuffer(val) { 1602 return toString.call(val) === '[object ArrayBuffer]'; 1603} 1604 1605/** 1606 * Determine if a value is a FormData 1607 * 1608 * @param {Object} val The value to test 1609 * @returns {boolean} True if value is an FormData, otherwise false 1610 */ 1611function isFormData(val) { 1612 return (typeof FormData !== 'undefined') && (val instanceof FormData); 1613} 1614 1615/** 1616 * Determine if a value is a view on an ArrayBuffer 1617 * 1618 * @param {Object} val The value to test 1619 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 1620 */ 1621function isArrayBufferView(val) { 1622 var result; 1623 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 1624 result = ArrayBuffer.isView(val); 1625 } else { 1626 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 1627 } 1628 return result; 1629} 1630 1631/** 1632 * Determine if a value is a String 1633 * 1634 * @param {Object} val The value to test 1635 * @returns {boolean} True if value is a String, otherwise false 1636 */ 1637function isString(val) { 1638 return typeof val === 'string'; 1639} 1640 1641/** 1642 * Determine if a value is a Number 1643 * 1644 * @param {Object} val The value to test 1645 * @returns {boolean} True if value is a Number, otherwise false 1646 */ 1647function isNumber(val) { 1648 return typeof val === 'number'; 1649} 1650 1651/** 1652 * Determine if a value is an Object 1653 * 1654 * @param {Object} val The value to test 1655 * @returns {boolean} True if value is an Object, otherwise false 1656 */ 1657function isObject(val) { 1658 return val !== null && typeof val === 'object'; 1659} 1660 1661/** 1662 * Determine if a value is a Date 1663 * 1664 * @param {Object} val The value to test 1665 * @returns {boolean} True if value is a Date, otherwise false 1666 */ 1667function isDate(val) { 1668 return toString.call(val) === '[object Date]'; 1669} 1670 1671/** 1672 * Determine if a value is a File 1673 * 1674 * @param {Object} val The value to test 1675 * @returns {boolean} True if value is a File, otherwise false 1676 */ 1677function isFile(val) { 1678 return toString.call(val) === '[object File]'; 1679} 1680 1681/** 1682 * Determine if a value is a Blob 1683 * 1684 * @param {Object} val The value to test 1685 * @returns {boolean} True if value is a Blob, otherwise false 1686 */ 1687function isBlob(val) { 1688 return toString.call(val) === '[object Blob]'; 1689} 1690 1691/** 1692 * Determine if a value is a Function 1693 * 1694 * @param {Object} val The value to test 1695 * @returns {boolean} True if value is a Function, otherwise false 1696 */ 1697function isFunction(val) { 1698 return toString.call(val) === '[object Function]'; 1699} 1700 1701/** 1702 * Determine if a value is a Stream 1703 * 1704 * @param {Object} val The value to test 1705 * @returns {boolean} True if value is a Stream, otherwise false 1706 */ 1707function isStream(val) { 1708 return isObject(val) && isFunction(val.pipe); 1709} 1710 1711/** 1712 * Determine if a value is a URLSearchParams object 1713 * 1714 * @param {Object} val The value to test 1715 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 1716 */ 1717function isURLSearchParams(val) { 1718 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 1719} 1720 1721/** 1722 * Trim excess whitespace off the beginning and end of a string 1723 * 1724 * @param {String} str The String to trim 1725 * @returns {String} The String freed of excess whitespace 1726 */ 1727function trim(str) { 1728 return str.replace(/^\s*/, '').replace(/\s*$/, ''); 1729} 1730 1731/** 1732 * Determine if we're running in a standard browser environment 1733 * 1734 * This allows axios to run in a web worker, and react-native. 1735 * Both environments support XMLHttpRequest, but not fully standard globals. 1736 * 1737 * web workers: 1738 * typeof window -> undefined 1739 * typeof document -> undefined 1740 * 1741 * react-native: 1742 * navigator.product -> 'ReactNative' 1743 * nativescript 1744 * navigator.product -> 'NativeScript' or 'NS' 1745 */ 1746function isStandardBrowserEnv() { 1747 if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || 1748 navigator.product === 'NativeScript' || 1749 navigator.product === 'NS')) { 1750 return false; 1751 } 1752 return ( 1753 typeof window !== 'undefined' && 1754 typeof document !== 'undefined' 1755 ); 1756} 1757 1758/** 1759 * Iterate over an Array or an Object invoking a function for each item. 1760 * 1761 * If `obj` is an Array callback will be called passing 1762 * the value, index, and complete array for each item. 1763 * 1764 * If 'obj' is an Object callback will be called passing 1765 * the value, key, and complete object for each property. 1766 * 1767 * @param {Object|Array} obj The object to iterate 1768 * @param {Function} fn The callback to invoke for each item 1769 */ 1770function forEach(obj, fn) { 1771 // Don't bother if no value provided 1772 if (obj === null || typeof obj === 'undefined') { 1773 return; 1774 } 1775 1776 // Force an array if not already something iterable 1777 if (typeof obj !== 'object') { 1778 /*eslint no-param-reassign:0*/ 1779 obj = [obj]; 1780 } 1781 1782 if (isArray(obj)) { 1783 // Iterate over array values 1784 for (var i = 0, l = obj.length; i < l; i++) { 1785 fn.call(null, obj[i], i, obj); 1786 } 1787 } else { 1788 // Iterate over object keys 1789 for (var key in obj) { 1790 if (Object.prototype.hasOwnProperty.call(obj, key)) { 1791 fn.call(null, obj[key], key, obj); 1792 } 1793 } 1794 } 1795} 1796 1797/** 1798 * Accepts varargs expecting each argument to be an object, then 1799 * immutably merges the properties of each object and returns result. 1800 * 1801 * When multiple objects contain the same key the later object in 1802 * the arguments list will take precedence. 1803 * 1804 * Example: 1805 * 1806 * ```js 1807 * var result = merge({foo: 123}, {foo: 456}); 1808 * console.log(result.foo); // outputs 456 1809 * ``` 1810 * 1811 * @param {Object} obj1 Object to merge 1812 * @returns {Object} Result of all merge properties 1813 */ 1814function merge(/* obj1, obj2, obj3, ... */) { 1815 var result = {}; 1816 function assignValue(val, key) { 1817 if (typeof result[key] === 'object' && typeof val === 'object') { 1818 result[key] = merge(result[key], val); 1819 } else { 1820 result[key] = val; 1821 } 1822 } 1823 1824 for (var i = 0, l = arguments.length; i < l; i++) { 1825 forEach(arguments[i], assignValue); 1826 } 1827 return result; 1828} 1829 1830/** 1831 * Function equal to merge with the difference being that no reference 1832 * to original objects is kept. 1833 * 1834 * @see merge 1835 * @param {Object} obj1 Object to merge 1836 * @returns {Object} Result of all merge properties 1837 */ 1838function deepMerge(/* obj1, obj2, obj3, ... */) { 1839 var result = {}; 1840 function assignValue(val, key) { 1841 if (typeof result[key] === 'object' && typeof val === 'object') { 1842 result[key] = deepMerge(result[key], val); 1843 } else if (typeof val === 'object') { 1844 result[key] = deepMerge({}, val); 1845 } else { 1846 result[key] = val; 1847 } 1848 } 1849 1850 for (var i = 0, l = arguments.length; i < l; i++) { 1851 forEach(arguments[i], assignValue); 1852 } 1853 return result; 1854} 1855 1856/** 1857 * Extends object a by mutably adding to it the properties of object b. 1858 * 1859 * @param {Object} a The object to be extended 1860 * @param {Object} b The object to copy properties from 1861 * @param {Object} thisArg The object to bind function to 1862 * @return {Object} The resulting value of object a 1863 */ 1864function extend(a, b, thisArg) { 1865 forEach(b, function assignValue(val, key) { 1866 if (thisArg && typeof val === 'function') { 1867 a[key] = bind(val, thisArg); 1868 } else { 1869 a[key] = val; 1870 } 1871 }); 1872 return a; 1873} 1874 1875module.exports = { 1876 isArray: isArray, 1877 isArrayBuffer: isArrayBuffer, 1878 isBuffer: isBuffer, 1879 isFormData: isFormData, 1880 isArrayBufferView: isArrayBufferView, 1881 isString: isString, 1882 isNumber: isNumber, 1883 isObject: isObject, 1884 isUndefined: isUndefined, 1885 isDate: isDate, 1886 isFile: isFile, 1887 isBlob: isBlob, 1888 isFunction: isFunction, 1889 isStream: isStream, 1890 isURLSearchParams: isURLSearchParams, 1891 isStandardBrowserEnv: isStandardBrowserEnv, 1892 forEach: forEach, 1893 merge: merge, 1894 deepMerge: deepMerge, 1895 extend: extend, 1896 trim: trim 1897}; 1898 1899 1900/***/ }), 1901
vendor: 135,733 bytes, lines 1902-6321
1902/***/ "./node_modules/bootstrap/dist/js/bootstrap.js": 1903/*!*****************************************************!*\ 1904 !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***! 1905 \*****************************************************/ 1906/*! no static exports found */ 1907/***/ (function(module, exports, __webpack_require__) { 1908 1909/*! 1910 * Bootstrap v4.5.1 (https://getbootstrap.com/) 1911 * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 1912 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1913 */ 1914(function (global, factory) { 1915 true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) : 1916 undefined; 1917}(this, (function (exports, $, Popper) { 'use strict'; 1918 1919 $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; 1920 Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper; 1921 1922 function _defineProperties(target, props) { 1923 for (var i = 0; i < props.length; i++) { 1924 var descriptor = props[i]; 1925 descriptor.enumerable = descriptor.enumerable || false; 1926 descriptor.configurable = true; 1927 if ("value" in descriptor) descriptor.writable = true; 1928 Object.defineProperty(target, descriptor.key, descriptor); 1929 } 1930 } 1931 1932 function _createClass(Constructor, protoProps, staticProps) { 1933 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 1934 if (staticProps) _defineProperties(Constructor, staticProps); 1935 return Constructor; 1936 } 1937 1938 function _extends() { 1939 _extends = Object.assign || function (target) { 1940 for (var i = 1; i < arguments.length; i++) { 1941 var source = arguments[i]; 1942 1943 for (var key in source) { 1944 if (Object.prototype.hasOwnProperty.call(source, key)) { 1945 target[key] = source[key]; 1946 } 1947 } 1948 } 1949 1950 return target; 1951 }; 1952 1953 return _extends.apply(this, arguments); 1954 } 1955 1956 function _inheritsLoose(subClass, superClass) { 1957 subClass.prototype = Object.create(superClass.prototype); 1958 subClass.prototype.constructor = subClass; 1959 subClass.__proto__ = superClass; 1960 } 1961 1962 /** 1963 * -------------------------------------------------------------------------- 1964 * Bootstrap (v4.5.1): util.js 1965 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1966 * -------------------------------------------------------------------------- 1967 */ 1968 /** 1969 * ------------------------------------------------------------------------ 1970 * Private TransitionEnd Helpers 1971 * ------------------------------------------------------------------------ 1972 */ 1973 1974 var TRANSITION_END = 'transitionend'; 1975 var MAX_UID = 1000000; 1976 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 1977 1978 function toType(obj) { 1979 if (obj === null || typeof obj === 'undefined') { 1980 return "" + obj; 1981 } 1982 1983 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 1984 } 1985 1986 function getSpecialTransitionEndEvent() { 1987 return { 1988 bindType: TRANSITION_END, 1989 delegateType: TRANSITION_END, 1990 handle: function handle(event) { 1991 if ($(event.target).is(this)) { 1992 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 1993 } 1994 1995 return undefined; 1996 } 1997 }; 1998 } 1999 2000 function transitionEndEmulator(duration) { 2001 var _this = this; 2002 2003 var called = false; 2004 $(this).one(Util.TRANSITION_END, function () { 2005 called = true; 2006 }); 2007 setTimeout(function () { 2008 if (!called) { 2009 Util.triggerTransitionEnd(_this); 2010 } 2011 }, duration); 2012 return this; 2013 } 2014 2015 function setTransitionEndSupport() { 2016 $.fn.emulateTransitionEnd = transitionEndEmulator; 2017 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 2018 } 2019 /** 2020 * -------------------------------------------------------------------------- 2021 * Public Util Api 2022 * -------------------------------------------------------------------------- 2023 */ 2024 2025 2026 var Util = { 2027 TRANSITION_END: 'bsTransitionEnd', 2028 getUID: function getUID(prefix) { 2029 do { 2030 // eslint-disable-next-line no-bitwise 2031 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 2032 } while (document.getElementById(prefix)); 2033 2034 return prefix; 2035 }, 2036 getSelectorFromElement: function getSelectorFromElement(element) { 2037 var selector = element.getAttribute('data-target'); 2038 2039 if (!selector || selector === '#') { 2040 var hrefAttr = element.getAttribute('href'); 2041 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 2042 } 2043 2044 try { 2045 return document.querySelector(selector) ? selector : null; 2046 } catch (err) { 2047 return null; 2048 } 2049 }, 2050 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 2051 if (!element) { 2052 return 0; 2053 } // Get transition-duration of the element 2054 2055 2056 var transitionDuration = $(element).css('transition-duration'); 2057 var transitionDelay = $(element).css('transition-delay'); 2058 var floatTransitionDuration = parseFloat(transitionDuration); 2059 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 2060 2061 if (!floatTransitionDuration && !floatTransitionDelay) { 2062 return 0; 2063 } // If multiple durations are defined, take the first 2064 2065 2066 transitionDuration = transitionDuration.split(',')[0]; 2067 transitionDelay = transitionDelay.split(',')[0]; 2068 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 2069 }, 2070 reflow: function reflow(element) { 2071 return element.offsetHeight; 2072 }, 2073 triggerTransitionEnd: function triggerTransitionEnd(element) { 2074 $(element).trigger(TRANSITION_END); 2075 }, 2076 // TODO: Remove in v5 2077 supportsTransitionEnd: function supportsTransitionEnd() { 2078 return Boolean(TRANSITION_END); 2079 }, 2080 isElement: function isElement(obj) { 2081 return (obj[0] || obj).nodeType; 2082 }, 2083 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 2084 for (var property in configTypes) { 2085 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 2086 var expectedTypes = configTypes[property]; 2087 var value = config[property]; 2088 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 2089 2090 if (!new RegExp(expectedTypes).test(valueType)) { 2091 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 2092 } 2093 } 2094 } 2095 }, 2096 findShadowRoot: function findShadowRoot(element) { 2097 if (!document.documentElement.attachShadow) { 2098 return null; 2099 } // Can find the shadow root otherwise it'll return the document 2100 2101 2102 if (typeof element.getRootNode === 'function') { 2103 var root = element.getRootNode(); 2104 return root instanceof ShadowRoot ? root : null; 2105 } 2106 2107 if (element instanceof ShadowRoot) { 2108 return element; 2109 } // when we don't find a shadow root 2110 2111 2112 if (!element.parentNode) { 2113 return null; 2114 } 2115 2116 return Util.findShadowRoot(element.parentNode); 2117 }, 2118 jQueryDetection: function jQueryDetection() { 2119 if (typeof $ === 'undefined') { 2120 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 2121 } 2122 2123 var version = $.fn.jquery.split(' ')[0].split('.'); 2124 var minMajor = 1; 2125 var ltMajor = 2; 2126 var minMinor = 9; 2127 var minPatch = 1; 2128 var maxMajor = 4; 2129 2130 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 2131 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 2132 } 2133 } 2134 }; 2135 Util.jQueryDetection(); 2136 setTransitionEndSupport(); 2137 2138 /** 2139 * ------------------------------------------------------------------------ 2140 * Constants 2141 * ------------------------------------------------------------------------ 2142 */ 2143 2144 var NAME = 'alert'; 2145 var VERSION = '4.5.1'; 2146 var DATA_KEY = 'bs.alert'; 2147 var EVENT_KEY = "." + DATA_KEY; 2148 var DATA_API_KEY = '.data-api'; 2149 var JQUERY_NO_CONFLICT = $.fn[NAME]; 2150 var SELECTOR_DISMISS = '[data-dismiss="alert"]'; 2151 var EVENT_CLOSE = "close" + EVENT_KEY; 2152 var EVENT_CLOSED = "closed" + EVENT_KEY; 2153 var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY; 2154 var CLASS_NAME_ALERT = 'alert'; 2155 var CLASS_NAME_FADE = 'fade'; 2156 var CLASS_NAME_SHOW = 'show'; 2157 /** 2158 * ------------------------------------------------------------------------ 2159 * Class Definition 2160 * ------------------------------------------------------------------------ 2161 */ 2162 2163 var Alert = /*#__PURE__*/function () { 2164 function Alert(element) { 2165 this._element = element; 2166 } // Getters 2167 2168 2169 var _proto = Alert.prototype; 2170 2171 // Public 2172 _proto.close = function close(element) { 2173 var rootElement = this._element; 2174 2175 if (element) { 2176 rootElement = this._getRootElement(element); 2177 } 2178 2179 var customEvent = this._triggerCloseEvent(rootElement); 2180 2181 if (customEvent.isDefaultPrevented()) { 2182 return; 2183 } 2184 2185 this._removeElement(rootElement); 2186 }; 2187 2188 _proto.dispose = function dispose() { 2189 $.removeData(this._element, DATA_KEY); 2190 this._element = null; 2191 } // Private 2192 ; 2193 2194 _proto._getRootElement = function _getRootElement(element) { 2195 var selector = Util.getSelectorFromElement(element); 2196 var parent = false; 2197 2198 if (selector) { 2199 parent = document.querySelector(selector); 2200 } 2201 2202 if (!parent) { 2203 parent = $(element).closest("." + CLASS_NAME_ALERT)[0]; 2204 } 2205 2206 return parent; 2207 }; 2208 2209 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 2210 var closeEvent = $.Event(EVENT_CLOSE); 2211 $(element).trigger(closeEvent); 2212 return closeEvent; 2213 }; 2214 2215 _proto._removeElement = function _removeElement(element) { 2216 var _this = this; 2217 2218 $(element).removeClass(CLASS_NAME_SHOW); 2219 2220 if (!$(element).hasClass(CLASS_NAME_FADE)) { 2221 this._destroyElement(element); 2222 2223 return; 2224 } 2225 2226 var transitionDuration = Util.getTransitionDurationFromElement(element); 2227 $(element).one(Util.TRANSITION_END, function (event) { 2228 return _this._destroyElement(element, event); 2229 }).emulateTransitionEnd(transitionDuration); 2230 }; 2231 2232 _proto._destroyElement = function _destroyElement(element) { 2233 $(element).detach().trigger(EVENT_CLOSED).remove(); 2234 } // Static 2235 ; 2236 2237 Alert._jQueryInterface = function _jQueryInterface(config) { 2238 return this.each(function () { 2239 var $element = $(this); 2240 var data = $element.data(DATA_KEY); 2241 2242 if (!data) { 2243 data = new Alert(this); 2244 $element.data(DATA_KEY, data); 2245 } 2246 2247 if (config === 'close') { 2248 data[config](this); 2249 } 2250 }); 2251 }; 2252 2253 Alert._handleDismiss = function _handleDismiss(alertInstance) { 2254 return function (event) { 2255 if (event) { 2256 event.preventDefault(); 2257 } 2258 2259 alertInstance.close(this); 2260 }; 2261 }; 2262 2263 _createClass(Alert, null, [{ 2264 key: "VERSION", 2265 get: function get() { 2266 return VERSION; 2267 } 2268 }]); 2269 2270 return Alert; 2271 }(); 2272 /** 2273 * ------------------------------------------------------------------------ 2274 * Data Api implementation 2275 * ------------------------------------------------------------------------ 2276 */ 2277 2278 2279 $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert())); 2280 /** 2281 * ------------------------------------------------------------------------ 2282 * jQuery 2283 * ------------------------------------------------------------------------ 2284 */ 2285 2286 $.fn[NAME] = Alert._jQueryInterface; 2287 $.fn[NAME].Constructor = Alert; 2288 2289 $.fn[NAME].noConflict = function () { 2290 $.fn[NAME] = JQUERY_NO_CONFLICT; 2291 return Alert._jQueryInterface; 2292 }; 2293 2294 /** 2295 * ------------------------------------------------------------------------ 2296 * Constants 2297 * ------------------------------------------------------------------------ 2298 */ 2299 2300 var NAME$1 = 'button'; 2301 var VERSION$1 = '4.5.1'; 2302 var DATA_KEY$1 = 'bs.button'; 2303 var EVENT_KEY$1 = "." + DATA_KEY$1; 2304 var DATA_API_KEY$1 = '.data-api'; 2305 var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; 2306 var CLASS_NAME_ACTIVE = 'active'; 2307 var CLASS_NAME_BUTTON = 'btn'; 2308 var CLASS_NAME_FOCUS = 'focus'; 2309 var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; 2310 var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'; 2311 var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]'; 2312 var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'; 2313 var SELECTOR_INPUT = 'input:not([type="hidden"])'; 2314 var SELECTOR_ACTIVE = '.active'; 2315 var SELECTOR_BUTTON = '.btn'; 2316 var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1; 2317 var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1); 2318 var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1; 2319 /** 2320 * ------------------------------------------------------------------------ 2321 * Class Definition 2322 * ------------------------------------------------------------------------ 2323 */ 2324 2325 var Button = /*#__PURE__*/function () { 2326 function Button(element) { 2327 this._element = element; 2328 } // Getters 2329 2330 2331 var _proto = Button.prototype; 2332 2333 // Public 2334 _proto.toggle = function toggle() { 2335 var triggerChangeEvent = true; 2336 var addAriaPressed = true; 2337 var rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0]; 2338 2339 if (rootElement) { 2340 var input = this._element.querySelector(SELECTOR_INPUT); 2341 2342 if (input) { 2343 if (input.type === 'radio') { 2344 if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) { 2345 triggerChangeEvent = false; 2346 } else { 2347 var activeElement = rootElement.querySelector(SELECTOR_ACTIVE); 2348 2349 if (activeElement) { 2350 $(activeElement).removeClass(CLASS_NAME_ACTIVE); 2351 } 2352 } 2353 } 2354 2355 if (triggerChangeEvent) { 2356 // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input 2357 if (input.type === 'checkbox' || input.type === 'radio') { 2358 input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE); 2359 } 2360 2361 $(input).trigger('change'); 2362 } 2363 2364 input.focus(); 2365 addAriaPressed = false; 2366 } 2367 } 2368 2369 if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { 2370 if (addAriaPressed) { 2371 this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE)); 2372 } 2373 2374 if (triggerChangeEvent) { 2375 $(this._element).toggleClass(CLASS_NAME_ACTIVE); 2376 } 2377 } 2378 }; 2379 2380 _proto.dispose = function dispose() { 2381 $.removeData(this._element, DATA_KEY$1); 2382 this._element = null; 2383 } // Static 2384 ; 2385 2386 Button._jQueryInterface = function _jQueryInterface(config) { 2387 return this.each(function () { 2388 var data = $(this).data(DATA_KEY$1); 2389 2390 if (!data) { 2391 data = new Button(this); 2392 $(this).data(DATA_KEY$1, data); 2393 } 2394 2395 if (config === 'toggle') { 2396 data[config](); 2397 } 2398 }); 2399 }; 2400 2401 _createClass(Button, null, [{ 2402 key: "VERSION", 2403 get: function get() { 2404 return VERSION$1; 2405 } 2406 }]); 2407 2408 return Button; 2409 }(); 2410 /** 2411 * ------------------------------------------------------------------------ 2412 * Data Api implementation 2413 * ------------------------------------------------------------------------ 2414 */ 2415 2416 2417 $(document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 2418 var button = event.target; 2419 var initialButton = button; 2420 2421 if (!$(button).hasClass(CLASS_NAME_BUTTON)) { 2422 button = $(button).closest(SELECTOR_BUTTON)[0]; 2423 } 2424 2425 if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { 2426 event.preventDefault(); // work around Firefox bug #1540995 2427 } else { 2428 var inputBtn = button.querySelector(SELECTOR_INPUT); 2429 2430 if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { 2431 event.preventDefault(); // work around Firefox bug #1540995 2432 2433 return; 2434 } 2435 2436 if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') { 2437 Button._jQueryInterface.call($(button), 'toggle'); 2438 } 2439 } 2440 }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 2441 var button = $(event.target).closest(SELECTOR_BUTTON)[0]; 2442 $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); 2443 }); 2444 $(window).on(EVENT_LOAD_DATA_API, function () { 2445 // ensure correct active class is set to match the controls' actual values/states 2446 // find all checkboxes/readio buttons inside data-toggle groups 2447 var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); 2448 2449 for (var i = 0, len = buttons.length; i < len; i++) { 2450 var button = buttons[i]; 2451 var input = button.querySelector(SELECTOR_INPUT); 2452 2453 if (input.checked || input.hasAttribute('checked')) { 2454 button.classList.add(CLASS_NAME_ACTIVE); 2455 } else { 2456 button.classList.remove(CLASS_NAME_ACTIVE); 2457 } 2458 } // find all button toggles 2459 2460 2461 buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE)); 2462 2463 for (var _i = 0, _len = buttons.length; _i < _len; _i++) { 2464 var _button = buttons[_i]; 2465 2466 if (_button.getAttribute('aria-pressed') === 'true') { 2467 _button.classList.add(CLASS_NAME_ACTIVE); 2468 } else { 2469 _button.classList.remove(CLASS_NAME_ACTIVE); 2470 } 2471 } 2472 }); 2473 /** 2474 * ------------------------------------------------------------------------ 2475 * jQuery 2476 * ------------------------------------------------------------------------ 2477 */ 2478 2479 $.fn[NAME$1] = Button._jQueryInterface; 2480 $.fn[NAME$1].Constructor = Button; 2481 2482 $.fn[NAME$1].noConflict = function () { 2483 $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 2484 return Button._jQueryInterface; 2485 }; 2486 2487 /** 2488 * ------------------------------------------------------------------------ 2489 * Constants 2490 * ------------------------------------------------------------------------ 2491 */ 2492 2493 var NAME$2 = 'carousel'; 2494 var VERSION$2 = '4.5.1'; 2495 var DATA_KEY$2 = 'bs.carousel'; 2496 var EVENT_KEY$2 = "." + DATA_KEY$2; 2497 var DATA_API_KEY$2 = '.data-api'; 2498 var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; 2499 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 2500 2501 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 2502 2503 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 2504 2505 var SWIPE_THRESHOLD = 40; 2506 var Default = { 2507 interval: 5000, 2508 keyboard: true, 2509 slide: false, 2510 pause: 'hover', 2511 wrap: true, 2512 touch: true 2513 }; 2514 var DefaultType = { 2515 interval: '(number|boolean)', 2516 keyboard: 'boolean', 2517 slide: '(boolean|string)', 2518 pause: '(string|boolean)', 2519 wrap: 'boolean', 2520 touch: 'boolean' 2521 }; 2522 var DIRECTION_NEXT = 'next'; 2523 var DIRECTION_PREV = 'prev'; 2524 var DIRECTION_LEFT = 'left'; 2525 var DIRECTION_RIGHT = 'right'; 2526 var EVENT_SLIDE = "slide" + EVENT_KEY$2; 2527 var EVENT_SLID = "slid" + EVENT_KEY$2; 2528 var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2; 2529 var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2; 2530 var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2; 2531 var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2; 2532 var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2; 2533 var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2; 2534 var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2; 2535 var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2; 2536 var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2; 2537 var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2; 2538 var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2; 2539 var CLASS_NAME_CAROUSEL = 'carousel'; 2540 var CLASS_NAME_ACTIVE$1 = 'active'; 2541 var CLASS_NAME_SLIDE = 'slide'; 2542 var CLASS_NAME_RIGHT = 'carousel-item-right'; 2543 var CLASS_NAME_LEFT = 'carousel-item-left'; 2544 var CLASS_NAME_NEXT = 'carousel-item-next'; 2545 var CLASS_NAME_PREV = 'carousel-item-prev'; 2546 var CLASS_NAME_POINTER_EVENT = 'pointer-event'; 2547 var SELECTOR_ACTIVE$1 = '.active'; 2548 var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; 2549 var SELECTOR_ITEM = '.carousel-item'; 2550 var SELECTOR_ITEM_IMG = '.carousel-item img'; 2551 var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; 2552 var SELECTOR_INDICATORS = '.carousel-indicators'; 2553 var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; 2554 var SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; 2555 var PointerType = { 2556 TOUCH: 'touch', 2557 PEN: 'pen' 2558 }; 2559 /** 2560 * ------------------------------------------------------------------------ 2561 * Class Definition 2562 * ------------------------------------------------------------------------ 2563 */ 2564 2565 var Carousel = /*#__PURE__*/function () { 2566 function Carousel(element, config) { 2567 this._items = null; 2568 this._interval = null; 2569 this._activeElement = null; 2570 this._isPaused = false; 2571 this._isSliding = false; 2572 this.touchTimeout = null; 2573 this.touchStartX = 0; 2574 this.touchDeltaX = 0; 2575 this._config = this._getConfig(config); 2576 this._element = element; 2577 this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); 2578 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 2579 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 2580 2581 this._addEventListeners(); 2582 } // Getters 2583 2584 2585 var _proto = Carousel.prototype; 2586 2587 // Public 2588 _proto.next = function next() { 2589 if (!this._isSliding) { 2590 this._slide(DIRECTION_NEXT); 2591 } 2592 }; 2593 2594 _proto.nextWhenVisible = function nextWhenVisible() { 2595 // Don't call next when the page isn't visible 2596 // or the carousel or its parent isn't visible 2597 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 2598 this.next(); 2599 } 2600 }; 2601 2602 _proto.prev = function prev() { 2603 if (!this._isSliding) { 2604 this._slide(DIRECTION_PREV); 2605 } 2606 }; 2607 2608 _proto.pause = function pause(event) { 2609 if (!event) { 2610 this._isPaused = true; 2611 } 2612 2613 if (this._element.querySelector(SELECTOR_NEXT_PREV)) { 2614 Util.triggerTransitionEnd(this._element); 2615 this.cycle(true); 2616 } 2617 2618 clearInterval(this._interval); 2619 this._interval = null; 2620 }; 2621 2622 _proto.cycle = function cycle(event) { 2623 if (!event) { 2624 this._isPaused = false; 2625 } 2626 2627 if (this._interval) { 2628 clearInterval(this._interval); 2629 this._interval = null; 2630 } 2631 2632 if (this._config.interval && !this._isPaused) { 2633 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 2634 } 2635 }; 2636 2637 _proto.to = function to(index) { 2638 var _this = this; 2639 2640 this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 2641 2642 var activeIndex = this._getItemIndex(this._activeElement); 2643 2644 if (index > this._items.length - 1 || index < 0) { 2645 return; 2646 } 2647 2648 if (this._isSliding) { 2649 $(this._element).one(EVENT_SLID, function () { 2650 return _this.to(index); 2651 }); 2652 return; 2653 } 2654 2655 if (activeIndex === index) { 2656 this.pause(); 2657 this.cycle(); 2658 return; 2659 } 2660 2661 var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; 2662 2663 this._slide(direction, this._items[index]); 2664 }; 2665 2666 _proto.dispose = function dispose() { 2667 $(this._element).off(EVENT_KEY$2); 2668 $.removeData(this._element, DATA_KEY$2); 2669 this._items = null; 2670 this._config = null; 2671 this._element = null; 2672 this._interval = null; 2673 this._isPaused = null; 2674 this._isSliding = null; 2675 this._activeElement = null; 2676 this._indicatorsElement = null; 2677 } // Private 2678 ; 2679 2680 _proto._getConfig = function _getConfig(config) { 2681 config = _extends({}, Default, config); 2682 Util.typeCheckConfig(NAME$2, config, DefaultType); 2683 return config; 2684 }; 2685 2686 _proto._handleSwipe = function _handleSwipe() { 2687 var absDeltax = Math.abs(this.touchDeltaX); 2688 2689 if (absDeltax <= SWIPE_THRESHOLD) { 2690 return; 2691 } 2692 2693 var direction = absDeltax / this.touchDeltaX; 2694 this.touchDeltaX = 0; // swipe left 2695 2696 if (direction > 0) { 2697 this.prev(); 2698 } // swipe right 2699 2700 2701 if (direction < 0) { 2702 this.next(); 2703 } 2704 }; 2705 2706 _proto._addEventListeners = function _addEventListeners() { 2707 var _this2 = this; 2708 2709 if (this._config.keyboard) { 2710 $(this._element).on(EVENT_KEYDOWN, function (event) { 2711 return _this2._keydown(event); 2712 }); 2713 } 2714 2715 if (this._config.pause === 'hover') { 2716 $(this._element).on(EVENT_MOUSEENTER, function (event) { 2717 return _this2.pause(event); 2718 }).on(EVENT_MOUSELEAVE, function (event) { 2719 return _this2.cycle(event); 2720 }); 2721 } 2722 2723 if (this._config.touch) { 2724 this._addTouchEventListeners(); 2725 } 2726 }; 2727 2728 _proto._addTouchEventListeners = function _addTouchEventListeners() { 2729 var _this3 = this; 2730 2731 if (!this._touchSupported) { 2732 return; 2733 } 2734 2735 var start = function start(event) { 2736 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 2737 _this3.touchStartX = event.originalEvent.clientX; 2738 } else if (!_this3._pointerEvent) { 2739 _this3.touchStartX = event.originalEvent.touches[0].clientX; 2740 } 2741 }; 2742 2743 var move = function move(event) { 2744 // ensure swiping with one touch and not pinching 2745 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 2746 _this3.touchDeltaX = 0; 2747 } else { 2748 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 2749 } 2750 }; 2751 2752 var end = function end(event) { 2753 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 2754 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 2755 } 2756 2757 _this3._handleSwipe(); 2758 2759 if (_this3._config.pause === 'hover') { 2760 // If it's a touch-enabled device, mouseenter/leave are fired as 2761 // part of the mouse compatibility events on first tap - the carousel 2762 // would stop cycling until user tapped out of it; 2763 // here, we listen for touchend, explicitly pause the carousel 2764 // (as if it's the second time we tap on it, mouseenter compat event 2765 // is NOT fired) and after a timeout (to allow for mouse compatibility 2766 // events to fire) we explicitly restart cycling 2767 _this3.pause(); 2768 2769 if (_this3.touchTimeout) { 2770 clearTimeout(_this3.touchTimeout); 2771 } 2772 2773 _this3.touchTimeout = setTimeout(function (event) { 2774 return _this3.cycle(event); 2775 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 2776 } 2777 }; 2778 2779 $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { 2780 return e.preventDefault(); 2781 }); 2782 2783 if (this._pointerEvent) { 2784 $(this._element).on(EVENT_POINTERDOWN, function (event) { 2785 return start(event); 2786 }); 2787 $(this._element).on(EVENT_POINTERUP, function (event) { 2788 return end(event); 2789 }); 2790 2791 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 2792 } else { 2793 $(this._element).on(EVENT_TOUCHSTART, function (event) { 2794 return start(event); 2795 }); 2796 $(this._element).on(EVENT_TOUCHMOVE, function (event) { 2797 return move(event); 2798 }); 2799 $(this._element).on(EVENT_TOUCHEND, function (event) { 2800 return end(event); 2801 }); 2802 } 2803 }; 2804 2805 _proto._keydown = function _keydown(event) { 2806 if (/input|textarea/i.test(event.target.tagName)) { 2807 return; 2808 } 2809 2810 switch (event.which) { 2811 case ARROW_LEFT_KEYCODE: 2812 event.preventDefault(); 2813 this.prev(); 2814 break; 2815 2816 case ARROW_RIGHT_KEYCODE: 2817 event.preventDefault(); 2818 this.next(); 2819 break; 2820 } 2821 }; 2822 2823 _proto._getItemIndex = function _getItemIndex(element) { 2824 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : []; 2825 return this._items.indexOf(element); 2826 }; 2827 2828 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 2829 var isNextDirection = direction === DIRECTION_NEXT; 2830 var isPrevDirection = direction === DIRECTION_PREV; 2831 2832 var activeIndex = this._getItemIndex(activeElement); 2833 2834 var lastItemIndex = this._items.length - 1; 2835 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 2836 2837 if (isGoingToWrap && !this._config.wrap) { 2838 return activeElement; 2839 } 2840 2841 var delta = direction === DIRECTION_PREV ? -1 : 1; 2842 var itemIndex = (activeIndex + delta) % this._items.length; 2843 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 2844 }; 2845 2846 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 2847 var targetIndex = this._getItemIndex(relatedTarget); 2848 2849 var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); 2850 2851 var slideEvent = $.Event(EVENT_SLIDE, { 2852 relatedTarget: relatedTarget, 2853 direction: eventDirectionName, 2854 from: fromIndex, 2855 to: targetIndex 2856 }); 2857 $(this._element).trigger(slideEvent); 2858 return slideEvent; 2859 }; 2860 2861 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 2862 if (this._indicatorsElement) { 2863 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1)); 2864 $(indicators).removeClass(CLASS_NAME_ACTIVE$1); 2865 2866 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 2867 2868 if (nextIndicator) { 2869 $(nextIndicator).addClass(CLASS_NAME_ACTIVE$1); 2870 } 2871 } 2872 }; 2873 2874 _proto._slide = function _slide(direction, element) { 2875 var _this4 = this; 2876 2877 var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 2878 2879 var activeElementIndex = this._getItemIndex(activeElement); 2880 2881 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 2882 2883 var nextElementIndex = this._getItemIndex(nextElement); 2884 2885 var isCycling = Boolean(this._interval); 2886 var directionalClassName; 2887 var orderClassName; 2888 var eventDirectionName; 2889 2890 if (direction === DIRECTION_NEXT) { 2891 directionalClassName = CLASS_NAME_LEFT; 2892 orderClassName = CLASS_NAME_NEXT; 2893 eventDirectionName = DIRECTION_LEFT; 2894 } else { 2895 directionalClassName = CLASS_NAME_RIGHT; 2896 orderClassName = CLASS_NAME_PREV; 2897 eventDirectionName = DIRECTION_RIGHT; 2898 } 2899 2900 if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE$1)) { 2901 this._isSliding = false; 2902 return; 2903 } 2904 2905 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 2906 2907 if (slideEvent.isDefaultPrevented()) { 2908 return; 2909 } 2910 2911 if (!activeElement || !nextElement) { 2912 // Some weirdness is happening, so we bail 2913 return; 2914 } 2915 2916 this._isSliding = true; 2917 2918 if (isCycling) { 2919 this.pause(); 2920 } 2921 2922 this._setActiveIndicatorElement(nextElement); 2923 2924 var slidEvent = $.Event(EVENT_SLID, { 2925 relatedTarget: nextElement, 2926 direction: eventDirectionName, 2927 from: activeElementIndex, 2928 to: nextElementIndex 2929 }); 2930 2931 if ($(this._element).hasClass(CLASS_NAME_SLIDE)) { 2932 $(nextElement).addClass(orderClassName); 2933 Util.reflow(nextElement); 2934 $(activeElement).addClass(directionalClassName); 2935 $(nextElement).addClass(directionalClassName); 2936 var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); 2937 2938 if (nextElementInterval) { 2939 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 2940 this._config.interval = nextElementInterval; 2941 } else { 2942 this._config.interval = this._config.defaultInterval || this._config.interval; 2943 } 2944 2945 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 2946 $(activeElement).one(Util.TRANSITION_END, function () { 2947 $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1); 2948 $(activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName); 2949 _this4._isSliding = false; 2950 setTimeout(function () { 2951 return $(_this4._element).trigger(slidEvent); 2952 }, 0); 2953 }).emulateTransitionEnd(transitionDuration); 2954 } else { 2955 $(activeElement).removeClass(CLASS_NAME_ACTIVE$1); 2956 $(nextElement).addClass(CLASS_NAME_ACTIVE$1); 2957 this._isSliding = false; 2958 $(this._element).trigger(slidEvent); 2959 } 2960 2961 if (isCycling) { 2962 this.cycle(); 2963 } 2964 } // Static 2965 ; 2966 2967 Carousel._jQueryInterface = function _jQueryInterface(config) { 2968 return this.each(function () { 2969 var data = $(this).data(DATA_KEY$2); 2970 2971 var _config = _extends({}, Default, $(this).data()); 2972 2973 if (typeof config === 'object') { 2974 _config = _extends({}, _config, config); 2975 } 2976 2977 var action = typeof config === 'string' ? config : _config.slide; 2978 2979 if (!data) { 2980 data = new Carousel(this, _config); 2981 $(this).data(DATA_KEY$2, data); 2982 } 2983 2984 if (typeof config === 'number') { 2985 data.to(config); 2986 } else if (typeof action === 'string') { 2987 if (typeof data[action] === 'undefined') { 2988 throw new TypeError("No method named \"" + action + "\""); 2989 } 2990 2991 data[action](); 2992 } else if (_config.interval && _config.ride) { 2993 data.pause(); 2994 data.cycle(); 2995 } 2996 }); 2997 }; 2998 2999 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 3000 var selector = Util.getSelectorFromElement(this); 3001 3002 if (!selector) { 3003 return; 3004 } 3005 3006 var target = $(selector)[0]; 3007 3008 if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) { 3009 return; 3010 } 3011 3012 var config = _extends({}, $(target).data(), $(this).data()); 3013 3014 var slideIndex = this.getAttribute('data-slide-to'); 3015 3016 if (slideIndex) { 3017 config.interval = false; 3018 } 3019 3020 Carousel._jQueryInterface.call($(target), config); 3021 3022 if (slideIndex) { 3023 $(target).data(DATA_KEY$2).to(slideIndex); 3024 } 3025 3026 event.preventDefault(); 3027 }; 3028 3029 _createClass(Carousel, null, [{ 3030 key: "VERSION", 3031 get: function get() { 3032 return VERSION$2; 3033 } 3034 }, { 3035 key: "Default", 3036 get: function get() { 3037 return Default; 3038 } 3039 }]); 3040 3041 return Carousel; 3042 }(); 3043 /** 3044 * ------------------------------------------------------------------------ 3045 * Data Api implementation 3046 * ------------------------------------------------------------------------ 3047 */ 3048 3049 3050 $(document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); 3051 $(window).on(EVENT_LOAD_DATA_API$1, function () { 3052 var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); 3053 3054 for (var i = 0, len = carousels.length; i < len; i++) { 3055 var $carousel = $(carousels[i]); 3056 3057 Carousel._jQueryInterface.call($carousel, $carousel.data()); 3058 } 3059 }); 3060 /** 3061 * ------------------------------------------------------------------------ 3062 * jQuery 3063 * ------------------------------------------------------------------------ 3064 */ 3065 3066 $.fn[NAME$2] = Carousel._jQueryInterface; 3067 $.fn[NAME$2].Constructor = Carousel; 3068 3069 $.fn[NAME$2].noConflict = function () { 3070 $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 3071 return Carousel._jQueryInterface; 3072 }; 3073 3074 /** 3075 * ------------------------------------------------------------------------ 3076 * Constants 3077 * ------------------------------------------------------------------------ 3078 */ 3079 3080 var NAME$3 = 'collapse'; 3081 var VERSION$3 = '4.5.1'; 3082 var DATA_KEY$3 = 'bs.collapse'; 3083 var EVENT_KEY$3 = "." + DATA_KEY$3; 3084 var DATA_API_KEY$3 = '.data-api'; 3085 var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; 3086 var Default$1 = { 3087 toggle: true, 3088 parent: '' 3089 }; 3090 var DefaultType$1 = { 3091 toggle: 'boolean', 3092 parent: '(string|element)' 3093 }; 3094 var EVENT_SHOW = "show" + EVENT_KEY$3; 3095 var EVENT_SHOWN = "shown" + EVENT_KEY$3; 3096 var EVENT_HIDE = "hide" + EVENT_KEY$3; 3097 var EVENT_HIDDEN = "hidden" + EVENT_KEY$3; 3098 var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3; 3099 var CLASS_NAME_SHOW$1 = 'show'; 3100 var CLASS_NAME_COLLAPSE = 'collapse'; 3101 var CLASS_NAME_COLLAPSING = 'collapsing'; 3102 var CLASS_NAME_COLLAPSED = 'collapsed'; 3103 var DIMENSION_WIDTH = 'width'; 3104 var DIMENSION_HEIGHT = 'height'; 3105 var SELECTOR_ACTIVES = '.show, .collapsing'; 3106 var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]'; 3107 /** 3108 * ------------------------------------------------------------------------ 3109 * Class Definition 3110 * ------------------------------------------------------------------------ 3111 */ 3112 3113 var Collapse = /*#__PURE__*/function () { 3114 function Collapse(element, config) { 3115 this._isTransitioning = false; 3116 this._element = element; 3117 this._config = this._getConfig(config); 3118 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 3119 var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1)); 3120 3121 for (var i = 0, len = toggleList.length; i < len; i++) { 3122 var elem = toggleList[i]; 3123 var selector = Util.getSelectorFromElement(elem); 3124 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 3125 return foundElem === element; 3126 }); 3127 3128 if (selector !== null && filterElement.length > 0) { 3129 this._selector = selector; 3130 3131 this._triggerArray.push(elem); 3132 } 3133 } 3134 3135 this._parent = this._config.parent ? this._getParent() : null; 3136 3137 if (!this._config.parent) { 3138 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 3139 } 3140 3141 if (this._config.toggle) { 3142 this.toggle(); 3143 } 3144 } // Getters 3145 3146 3147 var _proto = Collapse.prototype; 3148 3149 // Public 3150 _proto.toggle = function toggle() { 3151 if ($(this._element).hasClass(CLASS_NAME_SHOW$1)) { 3152 this.hide(); 3153 } else { 3154 this.show(); 3155 } 3156 }; 3157 3158 _proto.show = function show() { 3159 var _this = this; 3160 3161 if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW$1)) { 3162 return; 3163 } 3164 3165 var actives; 3166 var activesData; 3167 3168 if (this._parent) { 3169 actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) { 3170 if (typeof _this._config.parent === 'string') { 3171 return elem.getAttribute('data-parent') === _this._config.parent; 3172 } 3173 3174 return elem.classList.contains(CLASS_NAME_COLLAPSE); 3175 }); 3176 3177 if (actives.length === 0) { 3178 actives = null; 3179 } 3180 } 3181 3182 if (actives) { 3183 activesData = $(actives).not(this._selector).data(DATA_KEY$3); 3184 3185 if (activesData && activesData._isTransitioning) { 3186 return; 3187 } 3188 } 3189 3190 var startEvent = $.Event(EVENT_SHOW); 3191 $(this._element).trigger(startEvent); 3192 3193 if (startEvent.isDefaultPrevented()) { 3194 return; 3195 } 3196 3197 if (actives) { 3198 Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); 3199 3200 if (!activesData) { 3201 $(actives).data(DATA_KEY$3, null); 3202 } 3203 } 3204 3205 var dimension = this._getDimension(); 3206 3207 $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); 3208 this._element.style[dimension] = 0; 3209 3210 if (this._triggerArray.length) { 3211 $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); 3212 } 3213 3214 this.setTransitioning(true); 3215 3216 var complete = function complete() { 3217 $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1); 3218 _this._element.style[dimension] = ''; 3219 3220 _this.setTransitioning(false); 3221 3222 $(_this._element).trigger(EVENT_SHOWN); 3223 }; 3224 3225 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 3226 var scrollSize = "scroll" + capitalizedDimension; 3227 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 3228 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3229 this._element.style[dimension] = this._element[scrollSize] + "px"; 3230 }; 3231 3232 _proto.hide = function hide() { 3233 var _this2 = this; 3234 3235 if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW$1)) { 3236 return; 3237 } 3238 3239 var startEvent = $.Event(EVENT_HIDE); 3240 $(this._element).trigger(startEvent); 3241 3242 if (startEvent.isDefaultPrevented()) { 3243 return; 3244 } 3245 3246 var dimension = this._getDimension(); 3247 3248 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 3249 Util.reflow(this._element); 3250 $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1); 3251 var triggerArrayLength = this._triggerArray.length; 3252 3253 if (triggerArrayLength > 0) { 3254 for (var i = 0; i < triggerArrayLength; i++) { 3255 var trigger = this._triggerArray[i]; 3256 var selector = Util.getSelectorFromElement(trigger); 3257 3258 if (selector !== null) { 3259 var $elem = $([].slice.call(document.querySelectorAll(selector))); 3260 3261 if (!$elem.hasClass(CLASS_NAME_SHOW$1)) { 3262 $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); 3263 } 3264 } 3265 } 3266 } 3267 3268 this.setTransitioning(true); 3269 3270 var complete = function complete() { 3271 _this2.setTransitioning(false); 3272 3273 $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN); 3274 }; 3275 3276 this._element.style[dimension] = ''; 3277 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 3278 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3279 }; 3280 3281 _proto.setTransitioning = function setTransitioning(isTransitioning) { 3282 this._isTransitioning = isTransitioning; 3283 }; 3284 3285 _proto.dispose = function dispose() { 3286 $.removeData(this._element, DATA_KEY$3); 3287 this._config = null; 3288 this._parent = null; 3289 this._element = null; 3290 this._triggerArray = null; 3291 this._isTransitioning = null; 3292 } // Private 3293 ; 3294 3295 _proto._getConfig = function _getConfig(config) { 3296 config = _extends({}, Default$1, config); 3297 config.toggle = Boolean(config.toggle); // Coerce string values 3298 3299 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 3300 return config; 3301 }; 3302 3303 _proto._getDimension = function _getDimension() { 3304 var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH); 3305 return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT; 3306 }; 3307 3308 _proto._getParent = function _getParent() { 3309 var _this3 = this; 3310 3311 var parent; 3312 3313 if (Util.isElement(this._config.parent)) { 3314 parent = this._config.parent; // It's a jQuery object 3315 3316 if (typeof this._config.parent.jquery !== 'undefined') { 3317 parent = this._config.parent[0]; 3318 } 3319 } else { 3320 parent = document.querySelector(this._config.parent); 3321 } 3322 3323 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 3324 var children = [].slice.call(parent.querySelectorAll(selector)); 3325 $(children).each(function (i, element) { 3326 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 3327 }); 3328 return parent; 3329 }; 3330 3331 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 3332 var isOpen = $(element).hasClass(CLASS_NAME_SHOW$1); 3333 3334 if (triggerArray.length) { 3335 $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 3336 } 3337 } // Static 3338 ; 3339 3340 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 3341 var selector = Util.getSelectorFromElement(element); 3342 return selector ? document.querySelector(selector) : null; 3343 }; 3344 3345 Collapse._jQueryInterface = function _jQueryInterface(config) { 3346 return this.each(function () { 3347 var $this = $(this); 3348 var data = $this.data(DATA_KEY$3); 3349 3350 var _config = _extends({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); 3351 3352 if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { 3353 _config.toggle = false; 3354 } 3355 3356 if (!data) { 3357 data = new Collapse(this, _config); 3358 $this.data(DATA_KEY$3, data); 3359 } 3360 3361 if (typeof config === 'string') { 3362 if (typeof data[config] === 'undefined') { 3363 throw new TypeError("No method named \"" + config + "\""); 3364 } 3365 3366 data[config](); 3367 } 3368 }); 3369 }; 3370 3371 _createClass(Collapse, null, [{ 3372 key: "VERSION", 3373 get: function get() { 3374 return VERSION$3; 3375 } 3376 }, { 3377 key: "Default", 3378 get: function get() { 3379 return Default$1; 3380 } 3381 }]); 3382 3383 return Collapse; 3384 }(); 3385 /** 3386 * ------------------------------------------------------------------------ 3387 * Data Api implementation 3388 * ------------------------------------------------------------------------ 3389 */ 3390 3391 3392 $(document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) { 3393 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 3394 if (event.currentTarget.tagName === 'A') { 3395 event.preventDefault(); 3396 } 3397 3398 var $trigger = $(this); 3399 var selector = Util.getSelectorFromElement(this); 3400 var selectors = [].slice.call(document.querySelectorAll(selector)); 3401 $(selectors).each(function () { 3402 var $target = $(this); 3403 var data = $target.data(DATA_KEY$3); 3404 var config = data ? 'toggle' : $trigger.data(); 3405 3406 Collapse._jQueryInterface.call($target, config); 3407 }); 3408 }); 3409 /** 3410 * ------------------------------------------------------------------------ 3411 * jQuery 3412 * ------------------------------------------------------------------------ 3413 */ 3414 3415 $.fn[NAME$3] = Collapse._jQueryInterface; 3416 $.fn[NAME$3].Constructor = Collapse; 3417 3418 $.fn[NAME$3].noConflict = function () { 3419 $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 3420 return Collapse._jQueryInterface; 3421 }; 3422 3423 /** 3424 * ------------------------------------------------------------------------ 3425 * Constants 3426 * ------------------------------------------------------------------------ 3427 */ 3428 3429 var NAME$4 = 'dropdown'; 3430 var VERSION$4 = '4.5.1'; 3431 var DATA_KEY$4 = 'bs.dropdown'; 3432 var EVENT_KEY$4 = "." + DATA_KEY$4; 3433 var DATA_API_KEY$4 = '.data-api'; 3434 var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; 3435 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 3436 3437 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 3438 3439 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 3440 3441 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 3442 3443 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 3444 3445 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 3446 3447 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 3448 var EVENT_HIDE$1 = "hide" + EVENT_KEY$4; 3449 var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4; 3450 var EVENT_SHOW$1 = "show" + EVENT_KEY$4; 3451 var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4; 3452 var EVENT_CLICK = "click" + EVENT_KEY$4; 3453 var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4; 3454 var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4; 3455 var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4; 3456 var CLASS_NAME_DISABLED = 'disabled'; 3457 var CLASS_NAME_SHOW$2 = 'show'; 3458 var CLASS_NAME_DROPUP = 'dropup'; 3459 var CLASS_NAME_DROPRIGHT = 'dropright'; 3460 var CLASS_NAME_DROPLEFT = 'dropleft'; 3461 var CLASS_NAME_MENURIGHT = 'dropdown-menu-right'; 3462 var CLASS_NAME_POSITION_STATIC = 'position-static'; 3463 var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]'; 3464 var SELECTOR_FORM_CHILD = '.dropdown form'; 3465 var SELECTOR_MENU = '.dropdown-menu'; 3466 var SELECTOR_NAVBAR_NAV = '.navbar-nav'; 3467 var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 3468 var PLACEMENT_TOP = 'top-start'; 3469 var PLACEMENT_TOPEND = 'top-end'; 3470 var PLACEMENT_BOTTOM = 'bottom-start'; 3471 var PLACEMENT_BOTTOMEND = 'bottom-end'; 3472 var PLACEMENT_RIGHT = 'right-start'; 3473 var PLACEMENT_LEFT = 'left-start'; 3474 var Default$2 = { 3475 offset: 0, 3476 flip: true, 3477 boundary: 'scrollParent', 3478 reference: 'toggle', 3479 display: 'dynamic', 3480 popperConfig: null 3481 }; 3482 var DefaultType$2 = { 3483 offset: '(number|string|function)', 3484 flip: 'boolean', 3485 boundary: '(string|element)', 3486 reference: '(string|element)', 3487 display: 'string', 3488 popperConfig: '(null|object)' 3489 }; 3490 /** 3491 * ------------------------------------------------------------------------ 3492 * Class Definition 3493 * ------------------------------------------------------------------------ 3494 */ 3495 3496 var Dropdown = /*#__PURE__*/function () { 3497 function Dropdown(element, config) { 3498 this._element = element; 3499 this._popper = null; 3500 this._config = this._getConfig(config); 3501 this._menu = this._getMenuElement(); 3502 this._inNavbar = this._detectNavbar(); 3503 3504 this._addEventListeners(); 3505 } // Getters 3506 3507 3508 var _proto = Dropdown.prototype; 3509 3510 // Public 3511 _proto.toggle = function toggle() { 3512 if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED)) { 3513 return; 3514 } 3515 3516 var isActive = $(this._menu).hasClass(CLASS_NAME_SHOW$2); 3517 3518 Dropdown._clearMenus(); 3519 3520 if (isActive) { 3521 return; 3522 } 3523 3524 this.show(true); 3525 }; 3526 3527 _proto.show = function show(usePopper) { 3528 if (usePopper === void 0) { 3529 usePopper = false; 3530 } 3531 3532 if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || $(this._menu).hasClass(CLASS_NAME_SHOW$2)) { 3533 return; 3534 } 3535 3536 var relatedTarget = { 3537 relatedTarget: this._element 3538 }; 3539 var showEvent = $.Event(EVENT_SHOW$1, relatedTarget); 3540 3541 var parent = Dropdown._getParentFromElement(this._element); 3542 3543 $(parent).trigger(showEvent); 3544 3545 if (showEvent.isDefaultPrevented()) { 3546 return; 3547 } // Disable totally Popper.js for Dropdown in Navbar 3548 3549 3550 if (!this._inNavbar && usePopper) { 3551 /** 3552 * Check for Popper dependency 3553 * Popper - https://popper.js.org 3554 */ 3555 if (typeof Popper === 'undefined') { 3556 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 3557 } 3558 3559 var referenceElement = this._element; 3560 3561 if (this._config.reference === 'parent') { 3562 referenceElement = parent; 3563 } else if (Util.isElement(this._config.reference)) { 3564 referenceElement = this._config.reference; // Check if it's jQuery element 3565 3566 if (typeof this._config.reference.jquery !== 'undefined') { 3567 referenceElement = this._config.reference[0]; 3568 } 3569 } // If boundary is not `scrollParent`, then set position to `static` 3570 // to allow the menu to "escape" the scroll parent's boundaries 3571 // https://github.com/twbs/bootstrap/issues/24251 3572 3573 3574 if (this._config.boundary !== 'scrollParent') { 3575 $(parent).addClass(CLASS_NAME_POSITION_STATIC); 3576 } 3577 3578 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 3579 } // If this is a touch-enabled device we add extra 3580 // empty mouseover listeners to the body's immediate children; 3581 // only needed because of broken event delegation on iOS 3582 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3583 3584 3585 if ('ontouchstart' in document.documentElement && $(parent).closest(SELECTOR_NAVBAR_NAV).length === 0) { 3586 $(document.body).children().on('mouseover', null, $.noop); 3587 } 3588 3589 this._element.focus(); 3590 3591 this._element.setAttribute('aria-expanded', true); 3592 3593 $(this._menu).toggleClass(CLASS_NAME_SHOW$2); 3594 $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_SHOWN$1, relatedTarget)); 3595 }; 3596 3597 _proto.hide = function hide() { 3598 if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || !$(this._menu).hasClass(CLASS_NAME_SHOW$2)) { 3599 return; 3600 } 3601 3602 var relatedTarget = { 3603 relatedTarget: this._element 3604 }; 3605 var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget); 3606 3607 var parent = Dropdown._getParentFromElement(this._element); 3608 3609 $(parent).trigger(hideEvent); 3610 3611 if (hideEvent.isDefaultPrevented()) { 3612 return; 3613 } 3614 3615 if (this._popper) { 3616 this._popper.destroy(); 3617 } 3618 3619 $(this._menu).toggleClass(CLASS_NAME_SHOW$2); 3620 $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget)); 3621 }; 3622 3623 _proto.dispose = function dispose() { 3624 $.removeData(this._element, DATA_KEY$4); 3625 $(this._element).off(EVENT_KEY$4); 3626 this._element = null; 3627 this._menu = null; 3628 3629 if (this._popper !== null) { 3630 this._popper.destroy(); 3631 3632 this._popper = null; 3633 } 3634 }; 3635 3636 _proto.update = function update() { 3637 this._inNavbar = this._detectNavbar(); 3638 3639 if (this._popper !== null) { 3640 this._popper.scheduleUpdate(); 3641 } 3642 } // Private 3643 ; 3644 3645 _proto._addEventListeners = function _addEventListeners() { 3646 var _this = this; 3647 3648 $(this._element).on(EVENT_CLICK, function (event) { 3649 event.preventDefault(); 3650 event.stopPropagation(); 3651 3652 _this.toggle(); 3653 }); 3654 }; 3655 3656 _proto._getConfig = function _getConfig(config) { 3657 config = _extends({}, this.constructor.Default, $(this._element).data(), config); 3658 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 3659 return config; 3660 }; 3661 3662 _proto._getMenuElement = function _getMenuElement() { 3663 if (!this._menu) { 3664 var parent = Dropdown._getParentFromElement(this._element); 3665 3666 if (parent) { 3667 this._menu = parent.querySelector(SELECTOR_MENU); 3668 } 3669 } 3670 3671 return this._menu; 3672 }; 3673 3674 _proto._getPlacement = function _getPlacement() { 3675 var $parentDropdown = $(this._element.parentNode); 3676 var placement = PLACEMENT_BOTTOM; // Handle dropup 3677 3678 if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) { 3679 placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP; 3680 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) { 3681 placement = PLACEMENT_RIGHT; 3682 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) { 3683 placement = PLACEMENT_LEFT; 3684 } else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) { 3685 placement = PLACEMENT_BOTTOMEND; 3686 } 3687 3688 return placement; 3689 }; 3690 3691 _proto._detectNavbar = function _detectNavbar() { 3692 return $(this._element).closest('.navbar').length > 0; 3693 }; 3694 3695 _proto._getOffset = function _getOffset() { 3696 var _this2 = this; 3697 3698 var offset = {}; 3699 3700 if (typeof this._config.offset === 'function') { 3701 offset.fn = function (data) { 3702 data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 3703 return data; 3704 }; 3705 } else { 3706 offset.offset = this._config.offset; 3707 } 3708 3709 return offset; 3710 }; 3711 3712 _proto._getPopperConfig = function _getPopperConfig() { 3713 var popperConfig = { 3714 placement: this._getPlacement(), 3715 modifiers: { 3716 offset: this._getOffset(), 3717 flip: { 3718 enabled: this._config.flip 3719 }, 3720 preventOverflow: { 3721 boundariesElement: this._config.boundary 3722 } 3723 } 3724 }; // Disable Popper.js if we have a static display 3725 3726 if (this._config.display === 'static') { 3727 popperConfig.modifiers.applyStyle = { 3728 enabled: false 3729 }; 3730 } 3731 3732 return _extends({}, popperConfig, this._config.popperConfig); 3733 } // Static 3734 ; 3735 3736 Dropdown._jQueryInterface = function _jQueryInterface(config) { 3737 return this.each(function () { 3738 var data = $(this).data(DATA_KEY$4); 3739 3740 var _config = typeof config === 'object' ? config : null; 3741 3742 if (!data) { 3743 data = new Dropdown(this, _config); 3744 $(this).data(DATA_KEY$4, data); 3745 } 3746 3747 if (typeof config === 'string') { 3748 if (typeof data[config] === 'undefined') { 3749 throw new TypeError("No method named \"" + config + "\""); 3750 } 3751 3752 data[config](); 3753 } 3754 }); 3755 }; 3756 3757 Dropdown._clearMenus = function _clearMenus(event) { 3758 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 3759 return; 3760 } 3761 3762 var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2)); 3763 3764 for (var i = 0, len = toggles.length; i < len; i++) { 3765 var parent = Dropdown._getParentFromElement(toggles[i]); 3766 3767 var context = $(toggles[i]).data(DATA_KEY$4); 3768 var relatedTarget = { 3769 relatedTarget: toggles[i] 3770 }; 3771 3772 if (event && event.type === 'click') { 3773 relatedTarget.clickEvent = event; 3774 } 3775 3776 if (!context) { 3777 continue; 3778 } 3779 3780 var dropdownMenu = context._menu; 3781 3782 if (!$(parent).hasClass(CLASS_NAME_SHOW$2)) { 3783 continue; 3784 } 3785 3786 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 3787 continue; 3788 } 3789 3790 var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget); 3791 $(parent).trigger(hideEvent); 3792 3793 if (hideEvent.isDefaultPrevented()) { 3794 continue; 3795 } // If this is a touch-enabled device we remove the extra 3796 // empty mouseover listeners we added for iOS support 3797 3798 3799 if ('ontouchstart' in document.documentElement) { 3800 $(document.body).children().off('mouseover', null, $.noop); 3801 } 3802 3803 toggles[i].setAttribute('aria-expanded', 'false'); 3804 3805 if (context._popper) { 3806 context._popper.destroy(); 3807 } 3808 3809 $(dropdownMenu).removeClass(CLASS_NAME_SHOW$2); 3810 $(parent).removeClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget)); 3811 } 3812 }; 3813 3814 Dropdown._getParentFromElement = function _getParentFromElement(element) { 3815 var parent; 3816 var selector = Util.getSelectorFromElement(element); 3817 3818 if (selector) { 3819 parent = document.querySelector(selector); 3820 } 3821 3822 return parent || element.parentNode; 3823 } // eslint-disable-next-line complexity 3824 ; 3825 3826 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 3827 // If not input/textarea: 3828 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 3829 // If input/textarea: 3830 // - If space key => not a dropdown command 3831 // - If key is other than escape 3832 // - If key is not up or down => not a dropdown command 3833 // - If trigger inside the menu => not a dropdown command 3834 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 3835 return; 3836 } 3837 3838 if (this.disabled || $(this).hasClass(CLASS_NAME_DISABLED)) { 3839 return; 3840 } 3841 3842 var parent = Dropdown._getParentFromElement(this); 3843 3844 var isActive = $(parent).hasClass(CLASS_NAME_SHOW$2); 3845 3846 if (!isActive && event.which === ESCAPE_KEYCODE) { 3847 return; 3848 } 3849 3850 event.preventDefault(); 3851 event.stopPropagation(); 3852 3853 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 3854 if (event.which === ESCAPE_KEYCODE) { 3855 $(parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus'); 3856 } 3857 3858 $(this).trigger('click'); 3859 return; 3860 } 3861 3862 var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) { 3863 return $(item).is(':visible'); 3864 }); 3865 3866 if (items.length === 0) { 3867 return; 3868 } 3869 3870 var index = items.indexOf(event.target); 3871 3872 if (event.which === ARROW_UP_KEYCODE && index > 0) { 3873 // Up 3874 index--; 3875 } 3876 3877 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 3878 // Down 3879 index++; 3880 } 3881 3882 if (index < 0) { 3883 index = 0; 3884 } 3885 3886 items[index].focus(); 3887 }; 3888 3889 _createClass(Dropdown, null, [{ 3890 key: "VERSION", 3891 get: function get() { 3892 return VERSION$4; 3893 } 3894 }, { 3895 key: "Default", 3896 get: function get() { 3897 return Default$2; 3898 } 3899 }, { 3900 key: "DefaultType", 3901 get: function get() { 3902 return DefaultType$2; 3903 } 3904 }]); 3905 3906 return Dropdown; 3907 }(); 3908 /** 3909 * ------------------------------------------------------------------------ 3910 * Data Api implementation 3911 * ------------------------------------------------------------------------ 3912 */ 3913 3914 3915 $(document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) { 3916 event.preventDefault(); 3917 event.stopPropagation(); 3918 3919 Dropdown._jQueryInterface.call($(this), 'toggle'); 3920 }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) { 3921 e.stopPropagation(); 3922 }); 3923 /** 3924 * ------------------------------------------------------------------------ 3925 * jQuery 3926 * ------------------------------------------------------------------------ 3927 */ 3928 3929 $.fn[NAME$4] = Dropdown._jQueryInterface; 3930 $.fn[NAME$4].Constructor = Dropdown; 3931 3932 $.fn[NAME$4].noConflict = function () { 3933 $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 3934 return Dropdown._jQueryInterface; 3935 }; 3936 3937 /** 3938 * ------------------------------------------------------------------------ 3939 * Constants 3940 * ------------------------------------------------------------------------ 3941 */ 3942 3943 var NAME$5 = 'modal'; 3944 var VERSION$5 = '4.5.1'; 3945 var DATA_KEY$5 = 'bs.modal'; 3946 var EVENT_KEY$5 = "." + DATA_KEY$5; 3947 var DATA_API_KEY$5 = '.data-api'; 3948 var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; 3949 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 3950 3951 var Default$3 = { 3952 backdrop: true, 3953 keyboard: true, 3954 focus: true, 3955 show: true 3956 }; 3957 var DefaultType$3 = { 3958 backdrop: '(boolean|string)', 3959 keyboard: 'boolean', 3960 focus: 'boolean', 3961 show: 'boolean' 3962 }; 3963 var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; 3964 var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; 3965 var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; 3966 var EVENT_SHOW$2 = "show" + EVENT_KEY$5; 3967 var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; 3968 var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; 3969 var EVENT_RESIZE = "resize" + EVENT_KEY$5; 3970 var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5; 3971 var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5; 3972 var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5; 3973 var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5; 3974 var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5; 3975 var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; 3976 var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; 3977 var CLASS_NAME_BACKDROP = 'modal-backdrop'; 3978 var CLASS_NAME_OPEN = 'modal-open'; 3979 var CLASS_NAME_FADE$1 = 'fade'; 3980 var CLASS_NAME_SHOW$3 = 'show'; 3981 var CLASS_NAME_STATIC = 'modal-static'; 3982 var SELECTOR_DIALOG = '.modal-dialog'; 3983 var SELECTOR_MODAL_BODY = '.modal-body'; 3984 var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]'; 3985 var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]'; 3986 var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 3987 var SELECTOR_STICKY_CONTENT = '.sticky-top'; 3988 /** 3989 * ------------------------------------------------------------------------ 3990 * Class Definition 3991 * ------------------------------------------------------------------------ 3992 */ 3993 3994 var Modal = /*#__PURE__*/function () { 3995 function Modal(element, config) { 3996 this._config = this._getConfig(config); 3997 this._element = element; 3998 this._dialog = element.querySelector(SELECTOR_DIALOG); 3999 this._backdrop = null; 4000 this._isShown = false; 4001 this._isBodyOverflowing = false; 4002 this._ignoreBackdropClick = false; 4003 this._isTransitioning = false; 4004 this._scrollbarWidth = 0; 4005 } // Getters 4006 4007 4008 var _proto = Modal.prototype; 4009 4010 // Public 4011 _proto.toggle = function toggle(relatedTarget) { 4012 return this._isShown ? this.hide() : this.show(relatedTarget); 4013 }; 4014 4015 _proto.show = function show(relatedTarget) { 4016 var _this = this; 4017 4018 if (this._isShown || this._isTransitioning) { 4019 return; 4020 } 4021 4022 if ($(this._element).hasClass(CLASS_NAME_FADE$1)) { 4023 this._isTransitioning = true; 4024 } 4025 4026 var showEvent = $.Event(EVENT_SHOW$2, { 4027 relatedTarget: relatedTarget 4028 }); 4029 $(this._element).trigger(showEvent); 4030 4031 if (this._isShown || showEvent.isDefaultPrevented()) { 4032 return; 4033 } 4034 4035 this._isShown = true; 4036 4037 this._checkScrollbar(); 4038 4039 this._setScrollbar(); 4040 4041 this._adjustDialog(); 4042 4043 this._setEscapeEvent(); 4044 4045 this._setResizeEvent(); 4046 4047 $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) { 4048 return _this.hide(event); 4049 }); 4050 $(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () { 4051 $(_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) { 4052 if ($(event.target).is(_this._element)) { 4053 _this._ignoreBackdropClick = true; 4054 } 4055 }); 4056 }); 4057 4058 this._showBackdrop(function () { 4059 return _this._showElement(relatedTarget); 4060 }); 4061 }; 4062 4063 _proto.hide = function hide(event) { 4064 var _this2 = this; 4065 4066 if (event) { 4067 event.preventDefault(); 4068 } 4069 4070 if (!this._isShown || this._isTransitioning) { 4071 return; 4072 } 4073 4074 var hideEvent = $.Event(EVENT_HIDE$2); 4075 $(this._element).trigger(hideEvent); 4076 4077 if (!this._isShown || hideEvent.isDefaultPrevented()) { 4078 return; 4079 } 4080 4081 this._isShown = false; 4082 var transition = $(this._element).hasClass(CLASS_NAME_FADE$1); 4083 4084 if (transition) { 4085 this._isTransitioning = true; 4086 } 4087 4088 this._setEscapeEvent(); 4089 4090 this._setResizeEvent(); 4091 4092 $(document).off(EVENT_FOCUSIN); 4093 $(this._element).removeClass(CLASS_NAME_SHOW$3); 4094 $(this._element).off(EVENT_CLICK_DISMISS); 4095 $(this._dialog).off(EVENT_MOUSEDOWN_DISMISS); 4096 4097 if (transition) { 4098 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4099 $(this._element).one(Util.TRANSITION_END, function (event) { 4100 return _this2._hideModal(event); 4101 }).emulateTransitionEnd(transitionDuration); 4102 } else { 4103 this._hideModal(); 4104 } 4105 }; 4106 4107 _proto.dispose = function dispose() { 4108 [window, this._element, this._dialog].forEach(function (htmlElement) { 4109 return $(htmlElement).off(EVENT_KEY$5); 4110 }); 4111 /** 4112 * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` 4113 * Do not move `document` in `htmlElements` array 4114 * It will remove `EVENT_CLICK_DATA_API` event that should remain 4115 */ 4116 4117 $(document).off(EVENT_FOCUSIN); 4118 $.removeData(this._element, DATA_KEY$5); 4119 this._config = null; 4120 this._element = null; 4121 this._dialog = null; 4122 this._backdrop = null; 4123 this._isShown = null; 4124 this._isBodyOverflowing = null; 4125 this._ignoreBackdropClick = null; 4126 this._isTransitioning = null; 4127 this._scrollbarWidth = null; 4128 }; 4129 4130 _proto.handleUpdate = function handleUpdate() { 4131 this._adjustDialog(); 4132 } // Private 4133 ; 4134 4135 _proto._getConfig = function _getConfig(config) { 4136 config = _extends({}, Default$3, config); 4137 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 4138 return config; 4139 }; 4140 4141 _proto._triggerBackdropTransition = function _triggerBackdropTransition() { 4142 var _this3 = this; 4143 4144 if (this._config.backdrop === 'static') { 4145 var hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED); 4146 $(this._element).trigger(hideEventPrevented); 4147 4148 if (hideEventPrevented.defaultPrevented) { 4149 return; 4150 } 4151 4152 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4153 4154 if (!isModalOverflowing) { 4155 this._element.style.overflowY = 'hidden'; 4156 } 4157 4158 this._element.classList.add(CLASS_NAME_STATIC); 4159 4160 var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4161 $(this._element).off(Util.TRANSITION_END); 4162 $(this._element).one(Util.TRANSITION_END, function () { 4163 _this3._element.classList.remove(CLASS_NAME_STATIC); 4164 4165 if (!isModalOverflowing) { 4166 $(_this3._element).one(Util.TRANSITION_END, function () { 4167 _this3._element.style.overflowY = ''; 4168 }).emulateTransitionEnd(_this3._element, modalTransitionDuration); 4169 } 4170 }).emulateTransitionEnd(modalTransitionDuration); 4171 4172 this._element.focus(); 4173 } else { 4174 this.hide(); 4175 } 4176 }; 4177 4178 _proto._showElement = function _showElement(relatedTarget) { 4179 var _this4 = this; 4180 4181 var transition = $(this._element).hasClass(CLASS_NAME_FADE$1); 4182 var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null; 4183 4184 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 4185 // Don't move modal's DOM position 4186 document.body.appendChild(this._element); 4187 } 4188 4189 this._element.style.display = 'block'; 4190 4191 this._element.removeAttribute('aria-hidden'); 4192 4193 this._element.setAttribute('aria-modal', true); 4194 4195 this._element.setAttribute('role', 'dialog'); 4196 4197 if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { 4198 modalBody.scrollTop = 0; 4199 } else { 4200 this._element.scrollTop = 0; 4201 } 4202 4203 if (transition) { 4204 Util.reflow(this._element); 4205 } 4206 4207 $(this._element).addClass(CLASS_NAME_SHOW$3); 4208 4209 if (this._config.focus) { 4210 this._enforceFocus(); 4211 } 4212 4213 var shownEvent = $.Event(EVENT_SHOWN$2, { 4214 relatedTarget: relatedTarget 4215 }); 4216 4217 var transitionComplete = function transitionComplete() { 4218 if (_this4._config.focus) { 4219 _this4._element.focus(); 4220 } 4221 4222 _this4._isTransitioning = false; 4223 $(_this4._element).trigger(shownEvent); 4224 }; 4225 4226 if (transition) { 4227 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4228 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 4229 } else { 4230 transitionComplete(); 4231 } 4232 }; 4233 4234 _proto._enforceFocus = function _enforceFocus() { 4235 var _this5 = this; 4236 4237 $(document).off(EVENT_FOCUSIN) // Guard against infinite focus loop 4238 .on(EVENT_FOCUSIN, function (event) { 4239 if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) { 4240 _this5._element.focus(); 4241 } 4242 }); 4243 }; 4244 4245 _proto._setEscapeEvent = function _setEscapeEvent() { 4246 var _this6 = this; 4247 4248 if (this._isShown) { 4249 $(this._element).on(EVENT_KEYDOWN_DISMISS, function (event) { 4250 if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) { 4251 event.preventDefault(); 4252 4253 _this6.hide(); 4254 } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) { 4255 _this6._triggerBackdropTransition(); 4256 } 4257 }); 4258 } else if (!this._isShown) { 4259 $(this._element).off(EVENT_KEYDOWN_DISMISS); 4260 } 4261 }; 4262 4263 _proto._setResizeEvent = function _setResizeEvent() { 4264 var _this7 = this; 4265 4266 if (this._isShown) { 4267 $(window).on(EVENT_RESIZE, function (event) { 4268 return _this7.handleUpdate(event); 4269 }); 4270 } else { 4271 $(window).off(EVENT_RESIZE); 4272 } 4273 }; 4274 4275 _proto._hideModal = function _hideModal() { 4276 var _this8 = this; 4277 4278 this._element.style.display = 'none'; 4279 4280 this._element.setAttribute('aria-hidden', true); 4281 4282 this._element.removeAttribute('aria-modal'); 4283 4284 this._element.removeAttribute('role'); 4285 4286 this._isTransitioning = false; 4287 4288 this._showBackdrop(function () { 4289 $(document.body).removeClass(CLASS_NAME_OPEN); 4290 4291 _this8._resetAdjustments(); 4292 4293 _this8._resetScrollbar(); 4294 4295 $(_this8._element).trigger(EVENT_HIDDEN$2); 4296 }); 4297 }; 4298 4299 _proto._removeBackdrop = function _removeBackdrop() { 4300 if (this._backdrop) { 4301 $(this._backdrop).remove(); 4302 this._backdrop = null; 4303 } 4304 }; 4305 4306 _proto._showBackdrop = function _showBackdrop(callback) { 4307 var _this9 = this; 4308 4309 var animate = $(this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : ''; 4310 4311 if (this._isShown && this._config.backdrop) { 4312 this._backdrop = document.createElement('div'); 4313 this._backdrop.className = CLASS_NAME_BACKDROP; 4314 4315 if (animate) { 4316 this._backdrop.classList.add(animate); 4317 } 4318 4319 $(this._backdrop).appendTo(document.body); 4320 $(this._element).on(EVENT_CLICK_DISMISS, function (event) { 4321 if (_this9._ignoreBackdropClick) { 4322 _this9._ignoreBackdropClick = false; 4323 return; 4324 } 4325 4326 if (event.target !== event.currentTarget) { 4327 return; 4328 } 4329 4330 _this9._triggerBackdropTransition(); 4331 }); 4332 4333 if (animate) { 4334 Util.reflow(this._backdrop); 4335 } 4336 4337 $(this._backdrop).addClass(CLASS_NAME_SHOW$3); 4338 4339 if (!callback) { 4340 return; 4341 } 4342 4343 if (!animate) { 4344 callback(); 4345 return; 4346 } 4347 4348 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4349 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 4350 } else if (!this._isShown && this._backdrop) { 4351 $(this._backdrop).removeClass(CLASS_NAME_SHOW$3); 4352 4353 var callbackRemove = function callbackRemove() { 4354 _this9._removeBackdrop(); 4355 4356 if (callback) { 4357 callback(); 4358 } 4359 }; 4360 4361 if ($(this._element).hasClass(CLASS_NAME_FADE$1)) { 4362 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4363 4364 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 4365 } else { 4366 callbackRemove(); 4367 } 4368 } else if (callback) { 4369 callback(); 4370 } 4371 } // ---------------------------------------------------------------------- 4372 // the following methods are used to handle overflowing modals 4373 // todo (fat): these should probably be refactored out of modal.js 4374 // ---------------------------------------------------------------------- 4375 ; 4376 4377 _proto._adjustDialog = function _adjustDialog() { 4378 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4379 4380 if (!this._isBodyOverflowing && isModalOverflowing) { 4381 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 4382 } 4383 4384 if (this._isBodyOverflowing && !isModalOverflowing) { 4385 this._element.style.paddingRight = this._scrollbarWidth + "px"; 4386 } 4387 }; 4388 4389 _proto._resetAdjustments = function _resetAdjustments() { 4390 this._element.style.paddingLeft = ''; 4391 this._element.style.paddingRight = ''; 4392 }; 4393 4394 _proto._checkScrollbar = function _checkScrollbar() { 4395 var rect = document.body.getBoundingClientRect(); 4396 this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; 4397 this._scrollbarWidth = this._getScrollbarWidth(); 4398 }; 4399 4400 _proto._setScrollbar = function _setScrollbar() { 4401 var _this10 = this; 4402 4403 if (this._isBodyOverflowing) { 4404 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 4405 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 4406 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4407 var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding 4408 4409 $(fixedContent).each(function (index, element) { 4410 var actualPadding = element.style.paddingRight; 4411 var calculatedPadding = $(element).css('padding-right'); 4412 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); 4413 }); // Adjust sticky content margin 4414 4415 $(stickyContent).each(function (index, element) { 4416 var actualMargin = element.style.marginRight; 4417 var calculatedMargin = $(element).css('margin-right'); 4418 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); 4419 }); // Adjust body padding 4420 4421 var actualPadding = document.body.style.paddingRight; 4422 var calculatedPadding = $(document.body).css('padding-right'); 4423 $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 4424 } 4425 4426 $(document.body).addClass(CLASS_NAME_OPEN); 4427 }; 4428 4429 _proto._resetScrollbar = function _resetScrollbar() { 4430 // Restore fixed content padding 4431 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4432 $(fixedContent).each(function (index, element) { 4433 var padding = $(element).data('padding-right'); 4434 $(element).removeData('padding-right'); 4435 element.style.paddingRight = padding ? padding : ''; 4436 }); // Restore sticky content 4437 4438 var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT)); 4439 $(elements).each(function (index, element) { 4440 var margin = $(element).data('margin-right'); 4441 4442 if (typeof margin !== 'undefined') { 4443 $(element).css('margin-right', margin).removeData('margin-right'); 4444 } 4445 }); // Restore body padding 4446 4447 var padding = $(document.body).data('padding-right'); 4448 $(document.body).removeData('padding-right'); 4449 document.body.style.paddingRight = padding ? padding : ''; 4450 }; 4451 4452 _proto._getScrollbarWidth = function _getScrollbarWidth() { 4453 // thx d.walsh 4454 var scrollDiv = document.createElement('div'); 4455 scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; 4456 document.body.appendChild(scrollDiv); 4457 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 4458 document.body.removeChild(scrollDiv); 4459 return scrollbarWidth; 4460 } // Static 4461 ; 4462 4463 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 4464 return this.each(function () { 4465 var data = $(this).data(DATA_KEY$5); 4466 4467 var _config = _extends({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); 4468 4469 if (!data) { 4470 data = new Modal(this, _config); 4471 $(this).data(DATA_KEY$5, data); 4472 } 4473 4474 if (typeof config === 'string') { 4475 if (typeof data[config] === 'undefined') { 4476 throw new TypeError("No method named \"" + config + "\""); 4477 } 4478 4479 data[config](relatedTarget); 4480 } else if (_config.show) { 4481 data.show(relatedTarget); 4482 } 4483 }); 4484 }; 4485 4486 _createClass(Modal, null, [{ 4487 key: "VERSION", 4488 get: function get() { 4489 return VERSION$5; 4490 } 4491 }, { 4492 key: "Default", 4493 get: function get() { 4494 return Default$3; 4495 } 4496 }]); 4497 4498 return Modal; 4499 }(); 4500 /** 4501 * ------------------------------------------------------------------------ 4502 * Data Api implementation 4503 * ------------------------------------------------------------------------ 4504 */ 4505 4506 4507 $(document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) { 4508 var _this11 = this; 4509 4510 var target; 4511 var selector = Util.getSelectorFromElement(this); 4512 4513 if (selector) { 4514 target = document.querySelector(selector); 4515 } 4516 4517 var config = $(target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $(target).data(), $(this).data()); 4518 4519 if (this.tagName === 'A' || this.tagName === 'AREA') { 4520 event.preventDefault(); 4521 } 4522 4523 var $target = $(target).one(EVENT_SHOW$2, function (showEvent) { 4524 if (showEvent.isDefaultPrevented()) { 4525 // Only register focus restorer if modal will actually get shown 4526 return; 4527 } 4528 4529 $target.one(EVENT_HIDDEN$2, function () { 4530 if ($(_this11).is(':visible')) { 4531 _this11.focus(); 4532 } 4533 }); 4534 }); 4535 4536 Modal._jQueryInterface.call($(target), config, this); 4537 }); 4538 /** 4539 * ------------------------------------------------------------------------ 4540 * jQuery 4541 * ------------------------------------------------------------------------ 4542 */ 4543 4544 $.fn[NAME$5] = Modal._jQueryInterface; 4545 $.fn[NAME$5].Constructor = Modal; 4546 4547 $.fn[NAME$5].noConflict = function () { 4548 $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 4549 return Modal._jQueryInterface; 4550 }; 4551 4552 /** 4553 * -------------------------------------------------------------------------- 4554 * Bootstrap (v4.5.1): tools/sanitizer.js 4555 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4556 * -------------------------------------------------------------------------- 4557 */ 4558 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 4559 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 4560 var DefaultWhitelist = { 4561 // Global attributes allowed on any supplied element below. 4562 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 4563 a: ['target', 'href', 'title', 'rel'], 4564 area: [], 4565 b: [], 4566 br: [], 4567 col: [], 4568 code: [], 4569 div: [], 4570 em: [], 4571 hr: [], 4572 h1: [], 4573 h2: [], 4574 h3: [], 4575 h4: [], 4576 h5: [], 4577 h6: [], 4578 i: [], 4579 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 4580 li: [], 4581 ol: [], 4582 p: [], 4583 pre: [], 4584 s: [], 4585 small: [], 4586 span: [], 4587 sub: [], 4588 sup: [], 4589 strong: [], 4590 u: [], 4591 ul: [] 4592 }; 4593 /** 4594 * A pattern that recognizes a commonly useful subset of URLs that are safe. 4595 * 4596 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4597 */ 4598 4599 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi; 4600 /** 4601 * A pattern that matches safe data URLs. Only matches image, video and audio types. 4602 * 4603 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4604 */ 4605 4606 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 4607 4608 function allowedAttribute(attr, allowedAttributeList) { 4609 var attrName = attr.nodeName.toLowerCase(); 4610 4611 if (allowedAttributeList.indexOf(attrName) !== -1) { 4612 if (uriAttrs.indexOf(attrName) !== -1) { 4613 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 4614 } 4615 4616 return true; 4617 } 4618 4619 var regExp = allowedAttributeList.filter(function (attrRegex) { 4620 return attrRegex instanceof RegExp; 4621 }); // Check if a regular expression validates the attribute. 4622 4623 for (var i = 0, len = regExp.length; i < len; i++) { 4624 if (attrName.match(regExp[i])) { 4625 return true; 4626 } 4627 } 4628 4629 return false; 4630 } 4631 4632 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 4633 if (unsafeHtml.length === 0) { 4634 return unsafeHtml; 4635 } 4636 4637 if (sanitizeFn && typeof sanitizeFn === 'function') { 4638 return sanitizeFn(unsafeHtml); 4639 } 4640 4641 var domParser = new window.DOMParser(); 4642 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 4643 var whitelistKeys = Object.keys(whiteList); 4644 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 4645 4646 var _loop = function _loop(i, len) { 4647 var el = elements[i]; 4648 var elName = el.nodeName.toLowerCase(); 4649 4650 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 4651 el.parentNode.removeChild(el); 4652 return "continue"; 4653 } 4654 4655 var attributeList = [].slice.call(el.attributes); 4656 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 4657 attributeList.forEach(function (attr) { 4658 if (!allowedAttribute(attr, whitelistedAttributes)) { 4659 el.removeAttribute(attr.nodeName); 4660 } 4661 }); 4662 }; 4663 4664 for (var i = 0, len = elements.length; i < len; i++) { 4665 var _ret = _loop(i); 4666 4667 if (_ret === "continue") continue; 4668 } 4669 4670 return createdDocument.body.innerHTML; 4671 } 4672 4673 /** 4674 * ------------------------------------------------------------------------ 4675 * Constants 4676 * ------------------------------------------------------------------------ 4677 */ 4678 4679 var NAME$6 = 'tooltip'; 4680 var VERSION$6 = '4.5.1'; 4681 var DATA_KEY$6 = 'bs.tooltip'; 4682 var EVENT_KEY$6 = "." + DATA_KEY$6; 4683 var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; 4684 var CLASS_PREFIX = 'bs-tooltip'; 4685 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 4686 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 4687 var DefaultType$4 = { 4688 animation: 'boolean', 4689 template: 'string', 4690 title: '(string|element|function)', 4691 trigger: 'string', 4692 delay: '(number|object)', 4693 html: 'boolean', 4694 selector: '(string|boolean)', 4695 placement: '(string|function)', 4696 offset: '(number|string|function)', 4697 container: '(string|element|boolean)', 4698 fallbackPlacement: '(string|array)', 4699 boundary: '(string|element)', 4700 sanitize: 'boolean', 4701 sanitizeFn: '(null|function)', 4702 whiteList: 'object', 4703 popperConfig: '(null|object)' 4704 }; 4705 var AttachmentMap = { 4706 AUTO: 'auto', 4707 TOP: 'top', 4708 RIGHT: 'right', 4709 BOTTOM: 'bottom', 4710 LEFT: 'left' 4711 }; 4712 var Default$4 = { 4713 animation: true, 4714 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 4715 trigger: 'hover focus', 4716 title: '', 4717 delay: 0, 4718 html: false, 4719 selector: false, 4720 placement: 'top', 4721 offset: 0, 4722 container: false, 4723 fallbackPlacement: 'flip', 4724 boundary: 'scrollParent', 4725 sanitize: true, 4726 sanitizeFn: null, 4727 whiteList: DefaultWhitelist, 4728 popperConfig: null 4729 }; 4730 var HOVER_STATE_SHOW = 'show'; 4731 var HOVER_STATE_OUT = 'out'; 4732 var Event = { 4733 HIDE: "hide" + EVENT_KEY$6, 4734 HIDDEN: "hidden" + EVENT_KEY$6, 4735 SHOW: "show" + EVENT_KEY$6, 4736 SHOWN: "shown" + EVENT_KEY$6, 4737 INSERTED: "inserted" + EVENT_KEY$6, 4738 CLICK: "click" + EVENT_KEY$6, 4739 FOCUSIN: "focusin" + EVENT_KEY$6, 4740 FOCUSOUT: "focusout" + EVENT_KEY$6, 4741 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 4742 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 4743 }; 4744 var CLASS_NAME_FADE$2 = 'fade'; 4745 var CLASS_NAME_SHOW$4 = 'show'; 4746 var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 4747 var SELECTOR_ARROW = '.arrow'; 4748 var TRIGGER_HOVER = 'hover'; 4749 var TRIGGER_FOCUS = 'focus'; 4750 var TRIGGER_CLICK = 'click'; 4751 var TRIGGER_MANUAL = 'manual'; 4752 /** 4753 * ------------------------------------------------------------------------ 4754 * Class Definition 4755 * ------------------------------------------------------------------------ 4756 */ 4757 4758 var Tooltip = /*#__PURE__*/function () { 4759 function Tooltip(element, config) { 4760 if (typeof Popper === 'undefined') { 4761 throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); 4762 } // private 4763 4764 4765 this._isEnabled = true; 4766 this._timeout = 0; 4767 this._hoverState = ''; 4768 this._activeTrigger = {}; 4769 this._popper = null; // Protected 4770 4771 this.element = element; 4772 this.config = this._getConfig(config); 4773 this.tip = null; 4774 4775 this._setListeners(); 4776 } // Getters 4777 4778 4779 var _proto = Tooltip.prototype; 4780 4781 // Public 4782 _proto.enable = function enable() { 4783 this._isEnabled = true; 4784 }; 4785 4786 _proto.disable = function disable() { 4787 this._isEnabled = false; 4788 }; 4789 4790 _proto.toggleEnabled = function toggleEnabled() { 4791 this._isEnabled = !this._isEnabled; 4792 }; 4793 4794 _proto.toggle = function toggle(event) { 4795 if (!this._isEnabled) { 4796 return; 4797 } 4798 4799 if (event) { 4800 var dataKey = this.constructor.DATA_KEY; 4801 var context = $(event.currentTarget).data(dataKey); 4802 4803 if (!context) { 4804 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 4805 $(event.currentTarget).data(dataKey, context); 4806 } 4807 4808 context._activeTrigger.click = !context._activeTrigger.click; 4809 4810 if (context._isWithActiveTrigger()) { 4811 context._enter(null, context); 4812 } else { 4813 context._leave(null, context); 4814 } 4815 } else { 4816 if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) { 4817 this._leave(null, this); 4818 4819 return; 4820 } 4821 4822 this._enter(null, this); 4823 } 4824 }; 4825 4826 _proto.dispose = function dispose() { 4827 clearTimeout(this._timeout); 4828 $.removeData(this.element, this.constructor.DATA_KEY); 4829 $(this.element).off(this.constructor.EVENT_KEY); 4830 $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); 4831 4832 if (this.tip) { 4833 $(this.tip).remove(); 4834 } 4835 4836 this._isEnabled = null; 4837 this._timeout = null; 4838 this._hoverState = null; 4839 this._activeTrigger = null; 4840 4841 if (this._popper) { 4842 this._popper.destroy(); 4843 } 4844 4845 this._popper = null; 4846 this.element = null; 4847 this.config = null; 4848 this.tip = null; 4849 }; 4850 4851 _proto.show = function show() { 4852 var _this = this; 4853 4854 if ($(this.element).css('display') === 'none') { 4855 throw new Error('Please use show on visible elements'); 4856 } 4857 4858 var showEvent = $.Event(this.constructor.Event.SHOW); 4859 4860 if (this.isWithContent() && this._isEnabled) { 4861 $(this.element).trigger(showEvent); 4862 var shadowRoot = Util.findShadowRoot(this.element); 4863 var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 4864 4865 if (showEvent.isDefaultPrevented() || !isInTheDom) { 4866 return; 4867 } 4868 4869 var tip = this.getTipElement(); 4870 var tipId = Util.getUID(this.constructor.NAME); 4871 tip.setAttribute('id', tipId); 4872 this.element.setAttribute('aria-describedby', tipId); 4873 this.setContent(); 4874 4875 if (this.config.animation) { 4876 $(tip).addClass(CLASS_NAME_FADE$2); 4877 } 4878 4879 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 4880 4881 var attachment = this._getAttachment(placement); 4882 4883 this.addAttachmentClass(attachment); 4884 4885 var container = this._getContainer(); 4886 4887 $(tip).data(this.constructor.DATA_KEY, this); 4888 4889 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 4890 $(tip).appendTo(container); 4891 } 4892 4893 $(this.element).trigger(this.constructor.Event.INSERTED); 4894 this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); 4895 $(tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra 4896 // empty mouseover listeners to the body's immediate children; 4897 // only needed because of broken event delegation on iOS 4898 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 4899 4900 if ('ontouchstart' in document.documentElement) { 4901 $(document.body).children().on('mouseover', null, $.noop); 4902 } 4903 4904 var complete = function complete() { 4905 if (_this.config.animation) { 4906 _this._fixTransition(); 4907 } 4908 4909 var prevHoverState = _this._hoverState; 4910 _this._hoverState = null; 4911 $(_this.element).trigger(_this.constructor.Event.SHOWN); 4912 4913 if (prevHoverState === HOVER_STATE_OUT) { 4914 _this._leave(null, _this); 4915 } 4916 }; 4917 4918 if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) { 4919 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 4920 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4921 } else { 4922 complete(); 4923 } 4924 } 4925 }; 4926 4927 _proto.hide = function hide(callback) { 4928 var _this2 = this; 4929 4930 var tip = this.getTipElement(); 4931 var hideEvent = $.Event(this.constructor.Event.HIDE); 4932 4933 var complete = function complete() { 4934 if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { 4935 tip.parentNode.removeChild(tip); 4936 } 4937 4938 _this2._cleanTipClass(); 4939 4940 _this2.element.removeAttribute('aria-describedby'); 4941 4942 $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 4943 4944 if (_this2._popper !== null) { 4945 _this2._popper.destroy(); 4946 } 4947 4948 if (callback) { 4949 callback(); 4950 } 4951 }; 4952 4953 $(this.element).trigger(hideEvent); 4954 4955 if (hideEvent.isDefaultPrevented()) { 4956 return; 4957 } 4958 4959 $(tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra 4960 // empty mouseover listeners we added for iOS support 4961 4962 if ('ontouchstart' in document.documentElement) { 4963 $(document.body).children().off('mouseover', null, $.noop); 4964 } 4965 4966 this._activeTrigger[TRIGGER_CLICK] = false; 4967 this._activeTrigger[TRIGGER_FOCUS] = false; 4968 this._activeTrigger[TRIGGER_HOVER] = false; 4969 4970 if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) { 4971 var transitionDuration = Util.getTransitionDurationFromElement(tip); 4972 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4973 } else { 4974 complete(); 4975 } 4976 4977 this._hoverState = ''; 4978 }; 4979 4980 _proto.update = function update() { 4981 if (this._popper !== null) { 4982 this._popper.scheduleUpdate(); 4983 } 4984 } // Protected 4985 ; 4986 4987 _proto.isWithContent = function isWithContent() { 4988 return Boolean(this.getTitle()); 4989 }; 4990 4991 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 4992 $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 4993 }; 4994 4995 _proto.getTipElement = function getTipElement() { 4996 this.tip = this.tip || $(this.config.template)[0]; 4997 return this.tip; 4998 }; 4999 5000 _proto.setContent = function setContent() { 5001 var tip = this.getTipElement(); 5002 this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); 5003 $(tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4); 5004 }; 5005 5006 _proto.setElementContent = function setElementContent($element, content) { 5007 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 5008 // Content is a DOM node or a jQuery 5009 if (this.config.html) { 5010 if (!$(content).parent().is($element)) { 5011 $element.empty().append(content); 5012 } 5013 } else { 5014 $element.text($(content).text()); 5015 } 5016 5017 return; 5018 } 5019 5020 if (this.config.html) { 5021 if (this.config.sanitize) { 5022 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 5023 } 5024 5025 $element.html(content); 5026 } else { 5027 $element.text(content); 5028 } 5029 }; 5030 5031 _proto.getTitle = function getTitle() { 5032 var title = this.element.getAttribute('data-original-title'); 5033 5034 if (!title) { 5035 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 5036 } 5037 5038 return title; 5039 } // Private 5040 ; 5041 5042 _proto._getPopperConfig = function _getPopperConfig(attachment) { 5043 var _this3 = this; 5044 5045 var defaultBsConfig = { 5046 placement: attachment, 5047 modifiers: { 5048 offset: this._getOffset(), 5049 flip: { 5050 behavior: this.config.fallbackPlacement 5051 }, 5052 arrow: { 5053 element: SELECTOR_ARROW 5054 }, 5055 preventOverflow: { 5056 boundariesElement: this.config.boundary 5057 } 5058 }, 5059 onCreate: function onCreate(data) { 5060 if (data.originalPlacement !== data.placement) { 5061 _this3._handlePopperPlacementChange(data); 5062 } 5063 }, 5064 onUpdate: function onUpdate(data) { 5065 return _this3._handlePopperPlacementChange(data); 5066 } 5067 }; 5068 return _extends({}, defaultBsConfig, this.config.popperConfig); 5069 }; 5070 5071 _proto._getOffset = function _getOffset() { 5072 var _this4 = this; 5073 5074 var offset = {}; 5075 5076 if (typeof this.config.offset === 'function') { 5077 offset.fn = function (data) { 5078 data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {}); 5079 return data; 5080 }; 5081 } else { 5082 offset.offset = this.config.offset; 5083 } 5084 5085 return offset; 5086 }; 5087 5088 _proto._getContainer = function _getContainer() { 5089 if (this.config.container === false) { 5090 return document.body; 5091 } 5092 5093 if (Util.isElement(this.config.container)) { 5094 return $(this.config.container); 5095 } 5096 5097 return $(document).find(this.config.container); 5098 }; 5099 5100 _proto._getAttachment = function _getAttachment(placement) { 5101 return AttachmentMap[placement.toUpperCase()]; 5102 }; 5103 5104 _proto._setListeners = function _setListeners() { 5105 var _this5 = this; 5106 5107 var triggers = this.config.trigger.split(' '); 5108 triggers.forEach(function (trigger) { 5109 if (trigger === 'click') { 5110 $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { 5111 return _this5.toggle(event); 5112 }); 5113 } else if (trigger !== TRIGGER_MANUAL) { 5114 var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; 5115 var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; 5116 $(_this5.element).on(eventIn, _this5.config.selector, function (event) { 5117 return _this5._enter(event); 5118 }).on(eventOut, _this5.config.selector, function (event) { 5119 return _this5._leave(event); 5120 }); 5121 } 5122 }); 5123 5124 this._hideModalHandler = function () { 5125 if (_this5.element) { 5126 _this5.hide(); 5127 } 5128 }; 5129 5130 $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); 5131 5132 if (this.config.selector) { 5133 this.config = _extends({}, this.config, { 5134 trigger: 'manual', 5135 selector: '' 5136 }); 5137 } else { 5138 this._fixTitle(); 5139 } 5140 }; 5141 5142 _proto._fixTitle = function _fixTitle() { 5143 var titleType = typeof this.element.getAttribute('data-original-title'); 5144 5145 if (this.element.getAttribute('title') || titleType !== 'string') { 5146 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 5147 this.element.setAttribute('title', ''); 5148 } 5149 }; 5150 5151 _proto._enter = function _enter(event, context) { 5152 var dataKey = this.constructor.DATA_KEY; 5153 context = context || $(event.currentTarget).data(dataKey); 5154 5155 if (!context) { 5156 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5157 $(event.currentTarget).data(dataKey, context); 5158 } 5159 5160 if (event) { 5161 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 5162 } 5163 5164 if ($(context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) { 5165 context._hoverState = HOVER_STATE_SHOW; 5166 return; 5167 } 5168 5169 clearTimeout(context._timeout); 5170 context._hoverState = HOVER_STATE_SHOW; 5171 5172 if (!context.config.delay || !context.config.delay.show) { 5173 context.show(); 5174 return; 5175 } 5176 5177 context._timeout = setTimeout(function () { 5178 if (context._hoverState === HOVER_STATE_SHOW) { 5179 context.show(); 5180 } 5181 }, context.config.delay.show); 5182 }; 5183 5184 _proto._leave = function _leave(event, context) { 5185 var dataKey = this.constructor.DATA_KEY; 5186 context = context || $(event.currentTarget).data(dataKey); 5187 5188 if (!context) { 5189 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5190 $(event.currentTarget).data(dataKey, context); 5191 } 5192 5193 if (event) { 5194 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; 5195 } 5196 5197 if (context._isWithActiveTrigger()) { 5198 return; 5199 } 5200 5201 clearTimeout(context._timeout); 5202 context._hoverState = HOVER_STATE_OUT; 5203 5204 if (!context.config.delay || !context.config.delay.hide) { 5205 context.hide(); 5206 return; 5207 } 5208 5209 context._timeout = setTimeout(function () { 5210 if (context._hoverState === HOVER_STATE_OUT) { 5211 context.hide(); 5212 } 5213 }, context.config.delay.hide); 5214 }; 5215 5216 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 5217 for (var trigger in this._activeTrigger) { 5218 if (this._activeTrigger[trigger]) { 5219 return true; 5220 } 5221 } 5222 5223 return false; 5224 }; 5225 5226 _proto._getConfig = function _getConfig(config) { 5227 var dataAttributes = $(this.element).data(); 5228 Object.keys(dataAttributes).forEach(function (dataAttr) { 5229 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 5230 delete dataAttributes[dataAttr]; 5231 } 5232 }); 5233 config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 5234 5235 if (typeof config.delay === 'number') { 5236 config.delay = { 5237 show: config.delay, 5238 hide: config.delay 5239 }; 5240 } 5241 5242 if (typeof config.title === 'number') { 5243 config.title = config.title.toString(); 5244 } 5245 5246 if (typeof config.content === 'number') { 5247 config.content = config.content.toString(); 5248 } 5249 5250 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 5251 5252 if (config.sanitize) { 5253 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 5254 } 5255 5256 return config; 5257 }; 5258 5259 _proto._getDelegateConfig = function _getDelegateConfig() { 5260 var config = {}; 5261 5262 if (this.config) { 5263 for (var key in this.config) { 5264 if (this.constructor.Default[key] !== this.config[key]) { 5265 config[key] = this.config[key]; 5266 } 5267 } 5268 } 5269 5270 return config; 5271 }; 5272 5273 _proto._cleanTipClass = function _cleanTipClass() { 5274 var $tip = $(this.getTipElement()); 5275 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 5276 5277 if (tabClass !== null && tabClass.length) { 5278 $tip.removeClass(tabClass.join('')); 5279 } 5280 }; 5281 5282 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 5283 this.tip = popperData.instance.popper; 5284 5285 this._cleanTipClass(); 5286 5287 this.addAttachmentClass(this._getAttachment(popperData.placement)); 5288 }; 5289 5290 _proto._fixTransition = function _fixTransition() { 5291 var tip = this.getTipElement(); 5292 var initConfigAnimation = this.config.animation; 5293 5294 if (tip.getAttribute('x-placement') !== null) { 5295 return; 5296 } 5297 5298 $(tip).removeClass(CLASS_NAME_FADE$2); 5299 this.config.animation = false; 5300 this.hide(); 5301 this.show(); 5302 this.config.animation = initConfigAnimation; 5303 } // Static 5304 ; 5305 5306 Tooltip._jQueryInterface = function _jQueryInterface(config) { 5307 return this.each(function () { 5308 var data = $(this).data(DATA_KEY$6); 5309 5310 var _config = typeof config === 'object' && config; 5311 5312 if (!data && /dispose|hide/.test(config)) { 5313 return; 5314 } 5315 5316 if (!data) { 5317 data = new Tooltip(this, _config); 5318 $(this).data(DATA_KEY$6, data); 5319 } 5320 5321 if (typeof config === 'string') { 5322 if (typeof data[config] === 'undefined') { 5323 throw new TypeError("No method named \"" + config + "\""); 5324 } 5325 5326 data[config](); 5327 } 5328 }); 5329 }; 5330 5331 _createClass(Tooltip, null, [{ 5332 key: "VERSION", 5333 get: function get() { 5334 return VERSION$6; 5335 } 5336 }, { 5337 key: "Default", 5338 get: function get() { 5339 return Default$4; 5340 } 5341 }, { 5342 key: "NAME", 5343 get: function get() { 5344 return NAME$6; 5345 } 5346 }, { 5347 key: "DATA_KEY", 5348 get: function get() { 5349 return DATA_KEY$6; 5350 } 5351 }, { 5352 key: "Event", 5353 get: function get() { 5354 return Event; 5355 } 5356 }, { 5357 key: "EVENT_KEY", 5358 get: function get() { 5359 return EVENT_KEY$6; 5360 } 5361 }, { 5362 key: "DefaultType", 5363 get: function get() { 5364 return DefaultType$4; 5365 } 5366 }]); 5367 5368 return Tooltip; 5369 }(); 5370 /** 5371 * ------------------------------------------------------------------------ 5372 * jQuery 5373 * ------------------------------------------------------------------------ 5374 */ 5375 5376 5377 $.fn[NAME$6] = Tooltip._jQueryInterface; 5378 $.fn[NAME$6].Constructor = Tooltip; 5379 5380 $.fn[NAME$6].noConflict = function () { 5381 $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 5382 return Tooltip._jQueryInterface; 5383 }; 5384 5385 /** 5386 * ------------------------------------------------------------------------ 5387 * Constants 5388 * ------------------------------------------------------------------------ 5389 */ 5390 5391 var NAME$7 = 'popover'; 5392 var VERSION$7 = '4.5.1'; 5393 var DATA_KEY$7 = 'bs.popover'; 5394 var EVENT_KEY$7 = "." + DATA_KEY$7; 5395 var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; 5396 var CLASS_PREFIX$1 = 'bs-popover'; 5397 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 5398 5399 var Default$5 = _extends({}, Tooltip.Default, { 5400 placement: 'right', 5401 trigger: 'click', 5402 content: '', 5403 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 5404 }); 5405 5406 var DefaultType$5 = _extends({}, Tooltip.DefaultType, { 5407 content: '(string|element|function)' 5408 }); 5409 5410 var CLASS_NAME_FADE$3 = 'fade'; 5411 var CLASS_NAME_SHOW$5 = 'show'; 5412 var SELECTOR_TITLE = '.popover-header'; 5413 var SELECTOR_CONTENT = '.popover-body'; 5414 var Event$1 = { 5415 HIDE: "hide" + EVENT_KEY$7, 5416 HIDDEN: "hidden" + EVENT_KEY$7, 5417 SHOW: "show" + EVENT_KEY$7, 5418 SHOWN: "shown" + EVENT_KEY$7, 5419 INSERTED: "inserted" + EVENT_KEY$7, 5420 CLICK: "click" + EVENT_KEY$7, 5421 FOCUSIN: "focusin" + EVENT_KEY$7, 5422 FOCUSOUT: "focusout" + EVENT_KEY$7, 5423 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 5424 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 5425 }; 5426 /** 5427 * ------------------------------------------------------------------------ 5428 * Class Definition 5429 * ------------------------------------------------------------------------ 5430 */ 5431 5432 var Popover = /*#__PURE__*/function (_Tooltip) { 5433 _inheritsLoose(Popover, _Tooltip); 5434 5435 function Popover() { 5436 return _Tooltip.apply(this, arguments) || this; 5437 } 5438 5439 var _proto = Popover.prototype; 5440 5441 // Overrides 5442 _proto.isWithContent = function isWithContent() { 5443 return this.getTitle() || this._getContent(); 5444 }; 5445 5446 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 5447 $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 5448 }; 5449 5450 _proto.getTipElement = function getTipElement() { 5451 this.tip = this.tip || $(this.config.template)[0]; 5452 return this.tip; 5453 }; 5454 5455 _proto.setContent = function setContent() { 5456 var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events 5457 5458 this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); 5459 5460 var content = this._getContent(); 5461 5462 if (typeof content === 'function') { 5463 content = content.call(this.element); 5464 } 5465 5466 this.setElementContent($tip.find(SELECTOR_CONTENT), content); 5467 $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5); 5468 } // Private 5469 ; 5470 5471 _proto._getContent = function _getContent() { 5472 return this.element.getAttribute('data-content') || this.config.content; 5473 }; 5474 5475 _proto._cleanTipClass = function _cleanTipClass() { 5476 var $tip = $(this.getTipElement()); 5477 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 5478 5479 if (tabClass !== null && tabClass.length > 0) { 5480 $tip.removeClass(tabClass.join('')); 5481 } 5482 } // Static 5483 ; 5484 5485 Popover._jQueryInterface = function _jQueryInterface(config) { 5486 return this.each(function () { 5487 var data = $(this).data(DATA_KEY$7); 5488 5489 var _config = typeof config === 'object' ? config : null; 5490 5491 if (!data && /dispose|hide/.test(config)) { 5492 return; 5493 } 5494 5495 if (!data) { 5496 data = new Popover(this, _config); 5497 $(this).data(DATA_KEY$7, data); 5498 } 5499 5500 if (typeof config === 'string') { 5501 if (typeof data[config] === 'undefined') { 5502 throw new TypeError("No method named \"" + config + "\""); 5503 } 5504 5505 data[config](); 5506 } 5507 }); 5508 }; 5509 5510 _createClass(Popover, null, [{ 5511 key: "VERSION", 5512 // Getters 5513 get: function get() { 5514 return VERSION$7; 5515 } 5516 }, { 5517 key: "Default", 5518 get: function get() { 5519 return Default$5; 5520 } 5521 }, { 5522 key: "NAME", 5523 get: function get() { 5524 return NAME$7; 5525 } 5526 }, { 5527 key: "DATA_KEY", 5528 get: function get() { 5529 return DATA_KEY$7; 5530 } 5531 }, { 5532 key: "Event", 5533 get: function get() { 5534 return Event$1; 5535 } 5536 }, { 5537 key: "EVENT_KEY", 5538 get: function get() { 5539 return EVENT_KEY$7; 5540 } 5541 }, { 5542 key: "DefaultType", 5543 get: function get() { 5544 return DefaultType$5; 5545 } 5546 }]); 5547 5548 return Popover; 5549 }(Tooltip); 5550 /** 5551 * ------------------------------------------------------------------------ 5552 * jQuery 5553 * ------------------------------------------------------------------------ 5554 */ 5555 5556 5557 $.fn[NAME$7] = Popover._jQueryInterface; 5558 $.fn[NAME$7].Constructor = Popover; 5559 5560 $.fn[NAME$7].noConflict = function () { 5561 $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 5562 return Popover._jQueryInterface; 5563 }; 5564 5565 /** 5566 * ------------------------------------------------------------------------ 5567 * Constants 5568 * ------------------------------------------------------------------------ 5569 */ 5570 5571 var NAME$8 = 'scrollspy'; 5572 var VERSION$8 = '4.5.1'; 5573 var DATA_KEY$8 = 'bs.scrollspy'; 5574 var EVENT_KEY$8 = "." + DATA_KEY$8; 5575 var DATA_API_KEY$6 = '.data-api'; 5576 var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; 5577 var Default$6 = { 5578 offset: 10, 5579 method: 'auto', 5580 target: '' 5581 }; 5582 var DefaultType$6 = { 5583 offset: 'number', 5584 method: 'string', 5585 target: '(string|element)' 5586 }; 5587 var EVENT_ACTIVATE = "activate" + EVENT_KEY$8; 5588 var EVENT_SCROLL = "scroll" + EVENT_KEY$8; 5589 var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6; 5590 var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 5591 var CLASS_NAME_ACTIVE$2 = 'active'; 5592 var SELECTOR_DATA_SPY = '[data-spy="scroll"]'; 5593 var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 5594 var SELECTOR_NAV_LINKS = '.nav-link'; 5595 var SELECTOR_NAV_ITEMS = '.nav-item'; 5596 var SELECTOR_LIST_ITEMS = '.list-group-item'; 5597 var SELECTOR_DROPDOWN = '.dropdown'; 5598 var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item'; 5599 var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 5600 var METHOD_OFFSET = 'offset'; 5601 var METHOD_POSITION = 'position'; 5602 /** 5603 * ------------------------------------------------------------------------ 5604 * Class Definition 5605 * ------------------------------------------------------------------------ 5606 */ 5607 5608 var ScrollSpy = /*#__PURE__*/function () { 5609 function ScrollSpy(element, config) { 5610 var _this = this; 5611 5612 this._element = element; 5613 this._scrollElement = element.tagName === 'BODY' ? window : element; 5614 this._config = this._getConfig(config); 5615 this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS); 5616 this._offsets = []; 5617 this._targets = []; 5618 this._activeTarget = null; 5619 this._scrollHeight = 0; 5620 $(this._scrollElement).on(EVENT_SCROLL, function (event) { 5621 return _this._process(event); 5622 }); 5623 this.refresh(); 5624 5625 this._process(); 5626 } // Getters 5627 5628 5629 var _proto = ScrollSpy.prototype; 5630 5631 // Public 5632 _proto.refresh = function refresh() { 5633 var _this2 = this; 5634 5635 var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 5636 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 5637 var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 5638 this._offsets = []; 5639 this._targets = []; 5640 this._scrollHeight = this._getScrollHeight(); 5641 var targets = [].slice.call(document.querySelectorAll(this._selector)); 5642 targets.map(function (element) { 5643 var target; 5644 var targetSelector = Util.getSelectorFromElement(element); 5645 5646 if (targetSelector) { 5647 target = document.querySelector(targetSelector); 5648 } 5649 5650 if (target) { 5651 var targetBCR = target.getBoundingClientRect(); 5652 5653 if (targetBCR.width || targetBCR.height) { 5654 // TODO (fat): remove sketch reliance on jQuery position/offset 5655 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 5656 } 5657 } 5658 5659 return null; 5660 }).filter(function (item) { 5661 return item; 5662 }).sort(function (a, b) { 5663 return a[0] - b[0]; 5664 }).forEach(function (item) { 5665 _this2._offsets.push(item[0]); 5666 5667 _this2._targets.push(item[1]); 5668 }); 5669 }; 5670 5671 _proto.dispose = function dispose() { 5672 $.removeData(this._element, DATA_KEY$8); 5673 $(this._scrollElement).off(EVENT_KEY$8); 5674 this._element = null; 5675 this._scrollElement = null; 5676 this._config = null; 5677 this._selector = null; 5678 this._offsets = null; 5679 this._targets = null; 5680 this._activeTarget = null; 5681 this._scrollHeight = null; 5682 } // Private 5683 ; 5684 5685 _proto._getConfig = function _getConfig(config) { 5686 config = _extends({}, Default$6, typeof config === 'object' && config ? config : {}); 5687 5688 if (typeof config.target !== 'string' && Util.isElement(config.target)) { 5689 var id = $(config.target).attr('id'); 5690 5691 if (!id) { 5692 id = Util.getUID(NAME$8); 5693 $(config.target).attr('id', id); 5694 } 5695 5696 config.target = "#" + id; 5697 } 5698 5699 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 5700 return config; 5701 }; 5702 5703 _proto._getScrollTop = function _getScrollTop() { 5704 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 5705 }; 5706 5707 _proto._getScrollHeight = function _getScrollHeight() { 5708 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 5709 }; 5710 5711 _proto._getOffsetHeight = function _getOffsetHeight() { 5712 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 5713 }; 5714 5715 _proto._process = function _process() { 5716 var scrollTop = this._getScrollTop() + this._config.offset; 5717 5718 var scrollHeight = this._getScrollHeight(); 5719 5720 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 5721 5722 if (this._scrollHeight !== scrollHeight) { 5723 this.refresh(); 5724 } 5725 5726 if (scrollTop >= maxScroll) { 5727 var target = this._targets[this._targets.length - 1]; 5728 5729 if (this._activeTarget !== target) { 5730 this._activate(target); 5731 } 5732 5733 return; 5734 } 5735 5736 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 5737 this._activeTarget = null; 5738 5739 this._clear(); 5740 5741 return; 5742 } 5743 5744 for (var i = this._offsets.length; i--;) { 5745 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 5746 5747 if (isActiveTarget) { 5748 this._activate(this._targets[i]); 5749 } 5750 } 5751 }; 5752 5753 _proto._activate = function _activate(target) { 5754 this._activeTarget = target; 5755 5756 this._clear(); 5757 5758 var queries = this._selector.split(',').map(function (selector) { 5759 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 5760 }); 5761 5762 var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); 5763 5764 if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { 5765 $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2); 5766 $link.addClass(CLASS_NAME_ACTIVE$2); 5767 } else { 5768 // Set triggered link as active 5769 $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active 5770 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 5771 5772 $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item 5773 5774 $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2); 5775 } 5776 5777 $(this._scrollElement).trigger(EVENT_ACTIVATE, { 5778 relatedTarget: target 5779 }); 5780 }; 5781 5782 _proto._clear = function _clear() { 5783 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 5784 return node.classList.contains(CLASS_NAME_ACTIVE$2); 5785 }).forEach(function (node) { 5786 return node.classList.remove(CLASS_NAME_ACTIVE$2); 5787 }); 5788 } // Static 5789 ; 5790 5791 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 5792 return this.each(function () { 5793 var data = $(this).data(DATA_KEY$8); 5794 5795 var _config = typeof config === 'object' && config; 5796 5797 if (!data) { 5798 data = new ScrollSpy(this, _config); 5799 $(this).data(DATA_KEY$8, data); 5800 } 5801 5802 if (typeof config === 'string') { 5803 if (typeof data[config] === 'undefined') { 5804 throw new TypeError("No method named \"" + config + "\""); 5805 } 5806 5807 data[config](); 5808 } 5809 }); 5810 }; 5811 5812 _createClass(ScrollSpy, null, [{ 5813 key: "VERSION", 5814 get: function get() { 5815 return VERSION$8; 5816 } 5817 }, { 5818 key: "Default", 5819 get: function get() { 5820 return Default$6; 5821 } 5822 }]); 5823 5824 return ScrollSpy; 5825 }(); 5826 /** 5827 * ------------------------------------------------------------------------ 5828 * Data Api implementation 5829 * ------------------------------------------------------------------------ 5830 */ 5831 5832 5833 $(window).on(EVENT_LOAD_DATA_API$2, function () { 5834 var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY)); 5835 var scrollSpysLength = scrollSpys.length; 5836 5837 for (var i = scrollSpysLength; i--;) { 5838 var $spy = $(scrollSpys[i]); 5839 5840 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 5841 } 5842 }); 5843 /** 5844 * ------------------------------------------------------------------------ 5845 * jQuery 5846 * ------------------------------------------------------------------------ 5847 */ 5848 5849 $.fn[NAME$8] = ScrollSpy._jQueryInterface; 5850 $.fn[NAME$8].Constructor = ScrollSpy; 5851 5852 $.fn[NAME$8].noConflict = function () { 5853 $.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 5854 return ScrollSpy._jQueryInterface; 5855 }; 5856 5857 /** 5858 * ------------------------------------------------------------------------ 5859 * Constants 5860 * ------------------------------------------------------------------------ 5861 */ 5862 5863 var NAME$9 = 'tab'; 5864 var VERSION$9 = '4.5.1'; 5865 var DATA_KEY$9 = 'bs.tab'; 5866 var EVENT_KEY$9 = "." + DATA_KEY$9; 5867 var DATA_API_KEY$7 = '.data-api'; 5868 var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; 5869 var EVENT_HIDE$3 = "hide" + EVENT_KEY$9; 5870 var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9; 5871 var EVENT_SHOW$3 = "show" + EVENT_KEY$9; 5872 var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9; 5873 var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7; 5874 var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 5875 var CLASS_NAME_ACTIVE$3 = 'active'; 5876 var CLASS_NAME_DISABLED$1 = 'disabled'; 5877 var CLASS_NAME_FADE$4 = 'fade'; 5878 var CLASS_NAME_SHOW$6 = 'show'; 5879 var SELECTOR_DROPDOWN$1 = '.dropdown'; 5880 var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 5881 var SELECTOR_ACTIVE$2 = '.active'; 5882 var SELECTOR_ACTIVE_UL = '> li > .active'; 5883 var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; 5884 var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 5885 var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'; 5886 /** 5887 * ------------------------------------------------------------------------ 5888 * Class Definition 5889 * ------------------------------------------------------------------------ 5890 */ 5891 5892 var Tab = /*#__PURE__*/function () { 5893 function Tab(element) { 5894 this._element = element; 5895 } // Getters 5896 5897 5898 var _proto = Tab.prototype; 5899 5900 // Public 5901 _proto.show = function show() { 5902 var _this = this; 5903 5904 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(CLASS_NAME_ACTIVE$3) || $(this._element).hasClass(CLASS_NAME_DISABLED$1)) { 5905 return; 5906 } 5907 5908 var target; 5909 var previous; 5910 var listElement = $(this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0]; 5911 var selector = Util.getSelectorFromElement(this._element); 5912 5913 if (listElement) { 5914 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2; 5915 previous = $.makeArray($(listElement).find(itemSelector)); 5916 previous = previous[previous.length - 1]; 5917 } 5918 5919 var hideEvent = $.Event(EVENT_HIDE$3, { 5920 relatedTarget: this._element 5921 }); 5922 var showEvent = $.Event(EVENT_SHOW$3, { 5923 relatedTarget: previous 5924 }); 5925 5926 if (previous) { 5927 $(previous).trigger(hideEvent); 5928 } 5929 5930 $(this._element).trigger(showEvent); 5931 5932 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 5933 return; 5934 } 5935 5936 if (selector) { 5937 target = document.querySelector(selector); 5938 } 5939 5940 this._activate(this._element, listElement); 5941 5942 var complete = function complete() { 5943 var hiddenEvent = $.Event(EVENT_HIDDEN$3, { 5944 relatedTarget: _this._element 5945 }); 5946 var shownEvent = $.Event(EVENT_SHOWN$3, { 5947 relatedTarget: previous 5948 }); 5949 $(previous).trigger(hiddenEvent); 5950 $(_this._element).trigger(shownEvent); 5951 }; 5952 5953 if (target) { 5954 this._activate(target, target.parentNode, complete); 5955 } else { 5956 complete(); 5957 } 5958 }; 5959 5960 _proto.dispose = function dispose() { 5961 $.removeData(this._element, DATA_KEY$9); 5962 this._element = null; 5963 } // Private 5964 ; 5965 5966 _proto._activate = function _activate(element, container, callback) { 5967 var _this2 = this; 5968 5969 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(SELECTOR_ACTIVE_UL) : $(container).children(SELECTOR_ACTIVE$2); 5970 var active = activeElements[0]; 5971 var isTransitioning = callback && active && $(active).hasClass(CLASS_NAME_FADE$4); 5972 5973 var complete = function complete() { 5974 return _this2._transitionComplete(element, active, callback); 5975 }; 5976 5977 if (active && isTransitioning) { 5978 var transitionDuration = Util.getTransitionDurationFromElement(active); 5979 $(active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5980 } else { 5981 complete(); 5982 } 5983 }; 5984 5985 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 5986 if (active) { 5987 $(active).removeClass(CLASS_NAME_ACTIVE$3); 5988 var dropdownChild = $(active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0]; 5989 5990 if (dropdownChild) { 5991 $(dropdownChild).removeClass(CLASS_NAME_ACTIVE$3); 5992 } 5993 5994 if (active.getAttribute('role') === 'tab') { 5995 active.setAttribute('aria-selected', false); 5996 } 5997 } 5998 5999 $(element).addClass(CLASS_NAME_ACTIVE$3); 6000 6001 if (element.getAttribute('role') === 'tab') { 6002 element.setAttribute('aria-selected', true); 6003 } 6004 6005 Util.reflow(element); 6006 6007 if (element.classList.contains(CLASS_NAME_FADE$4)) { 6008 element.classList.add(CLASS_NAME_SHOW$6); 6009 } 6010 6011 if (element.parentNode && $(element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) { 6012 var dropdownElement = $(element).closest(SELECTOR_DROPDOWN$1)[0]; 6013 6014 if (dropdownElement) { 6015 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1)); 6016 $(dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3); 6017 } 6018 6019 element.setAttribute('aria-expanded', true); 6020 } 6021 6022 if (callback) { 6023 callback(); 6024 } 6025 } // Static 6026 ; 6027 6028 Tab._jQueryInterface = function _jQueryInterface(config) { 6029 return this.each(function () { 6030 var $this = $(this); 6031 var data = $this.data(DATA_KEY$9); 6032 6033 if (!data) { 6034 data = new Tab(this); 6035 $this.data(DATA_KEY$9, data); 6036 } 6037 6038 if (typeof config === 'string') { 6039 if (typeof data[config] === 'undefined') { 6040 throw new TypeError("No method named \"" + config + "\""); 6041 } 6042 6043 data[config](); 6044 } 6045 }); 6046 }; 6047 6048 _createClass(Tab, null, [{ 6049 key: "VERSION", 6050 get: function get() { 6051 return VERSION$9; 6052 } 6053 }]); 6054 6055 return Tab; 6056 }(); 6057 /** 6058 * ------------------------------------------------------------------------ 6059 * Data Api implementation 6060 * ------------------------------------------------------------------------ 6061 */ 6062 6063 6064 $(document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) { 6065 event.preventDefault(); 6066 6067 Tab._jQueryInterface.call($(this), 'show'); 6068 }); 6069 /** 6070 * ------------------------------------------------------------------------ 6071 * jQuery 6072 * ------------------------------------------------------------------------ 6073 */ 6074 6075 $.fn[NAME$9] = Tab._jQueryInterface; 6076 $.fn[NAME$9].Constructor = Tab; 6077 6078 $.fn[NAME$9].noConflict = function () { 6079 $.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 6080 return Tab._jQueryInterface; 6081 }; 6082 6083 /** 6084 * ------------------------------------------------------------------------ 6085 * Constants 6086 * ------------------------------------------------------------------------ 6087 */ 6088 6089 var NAME$a = 'toast'; 6090 var VERSION$a = '4.5.1'; 6091 var DATA_KEY$a = 'bs.toast'; 6092 var EVENT_KEY$a = "." + DATA_KEY$a; 6093 var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; 6094 var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a; 6095 var EVENT_HIDE$4 = "hide" + EVENT_KEY$a; 6096 var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a; 6097 var EVENT_SHOW$4 = "show" + EVENT_KEY$a; 6098 var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a; 6099 var CLASS_NAME_FADE$5 = 'fade'; 6100 var CLASS_NAME_HIDE = 'hide'; 6101 var CLASS_NAME_SHOW$7 = 'show'; 6102 var CLASS_NAME_SHOWING = 'showing'; 6103 var DefaultType$7 = { 6104 animation: 'boolean', 6105 autohide: 'boolean', 6106 delay: 'number' 6107 }; 6108 var Default$7 = { 6109 animation: true, 6110 autohide: true, 6111 delay: 500 6112 }; 6113 var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]'; 6114 /** 6115 * ------------------------------------------------------------------------ 6116 * Class Definition 6117 * ------------------------------------------------------------------------ 6118 */ 6119 6120 var Toast = /*#__PURE__*/function () { 6121 function Toast(element, config) { 6122 this._element = element; 6123 this._config = this._getConfig(config); 6124 this._timeout = null; 6125 6126 this._setListeners(); 6127 } // Getters 6128 6129 6130 var _proto = Toast.prototype; 6131 6132 // Public 6133 _proto.show = function show() { 6134 var _this = this; 6135 6136 var showEvent = $.Event(EVENT_SHOW$4); 6137 $(this._element).trigger(showEvent); 6138 6139 if (showEvent.isDefaultPrevented()) { 6140 return; 6141 } 6142 6143 this._clearTimeout(); 6144 6145 if (this._config.animation) { 6146 this._element.classList.add(CLASS_NAME_FADE$5); 6147 } 6148 6149 var complete = function complete() { 6150 _this._element.classList.remove(CLASS_NAME_SHOWING); 6151 6152 _this._element.classList.add(CLASS_NAME_SHOW$7); 6153 6154 $(_this._element).trigger(EVENT_SHOWN$4); 6155 6156 if (_this._config.autohide) { 6157 _this._timeout = setTimeout(function () { 6158 _this.hide(); 6159 }, _this._config.delay); 6160 } 6161 }; 6162 6163 this._element.classList.remove(CLASS_NAME_HIDE); 6164 6165 Util.reflow(this._element); 6166 6167 this._element.classList.add(CLASS_NAME_SHOWING); 6168 6169 if (this._config.animation) { 6170 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6171 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6172 } else { 6173 complete(); 6174 } 6175 }; 6176 6177 _proto.hide = function hide() { 6178 if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) { 6179 return; 6180 } 6181 6182 var hideEvent = $.Event(EVENT_HIDE$4); 6183 $(this._element).trigger(hideEvent); 6184 6185 if (hideEvent.isDefaultPrevented()) { 6186 return; 6187 } 6188 6189 this._close(); 6190 }; 6191 6192 _proto.dispose = function dispose() { 6193 this._clearTimeout(); 6194 6195 if (this._element.classList.contains(CLASS_NAME_SHOW$7)) { 6196 this._element.classList.remove(CLASS_NAME_SHOW$7); 6197 } 6198 6199 $(this._element).off(EVENT_CLICK_DISMISS$1); 6200 $.removeData(this._element, DATA_KEY$a); 6201 this._element = null; 6202 this._config = null; 6203 } // Private 6204 ; 6205 6206 _proto._getConfig = function _getConfig(config) { 6207 config = _extends({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {}); 6208 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 6209 return config; 6210 }; 6211 6212 _proto._setListeners = function _setListeners() { 6213 var _this2 = this; 6214 6215 $(this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () { 6216 return _this2.hide(); 6217 }); 6218 }; 6219 6220 _proto._close = function _close() { 6221 var _this3 = this; 6222 6223 var complete = function complete() { 6224 _this3._element.classList.add(CLASS_NAME_HIDE); 6225 6226 $(_this3._element).trigger(EVENT_HIDDEN$4); 6227 }; 6228 6229 this._element.classList.remove(CLASS_NAME_SHOW$7); 6230 6231 if (this._config.animation) { 6232 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6233 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6234 } else { 6235 complete(); 6236 } 6237 }; 6238 6239 _proto._clearTimeout = function _clearTimeout() { 6240 clearTimeout(this._timeout); 6241 this._timeout = null; 6242 } // Static 6243 ; 6244 6245 Toast._jQueryInterface = function _jQueryInterface(config) { 6246 return this.each(function () { 6247 var $element = $(this); 6248 var data = $element.data(DATA_KEY$a); 6249 6250 var _config = typeof config === 'object' && config; 6251 6252 if (!data) { 6253 data = new Toast(this, _config); 6254 $element.data(DATA_KEY$a, data); 6255 } 6256 6257 if (typeof config === 'string') { 6258 if (typeof data[config] === 'undefined') { 6259 throw new TypeError("No method named \"" + config + "\""); 6260 } 6261 6262 data[config](this); 6263 } 6264 }); 6265 }; 6266 6267 _createClass(Toast, null, [{ 6268 key: "VERSION", 6269 get: function get() { 6270 return VERSION$a; 6271 } 6272 }, { 6273 key: "DefaultType", 6274 get: function get() { 6275 return DefaultType$7; 6276 } 6277 }, { 6278 key: "Default", 6279 get: function get() { 6280 return Default$7; 6281 } 6282 }]); 6283 6284 return Toast; 6285 }(); 6286 /** 6287 * ------------------------------------------------------------------------ 6288 * jQuery 6289 * ------------------------------------------------------------------------ 6290 */ 6291 6292 6293 $.fn[NAME$a] = Toast._jQueryInterface; 6294 $.fn[NAME$a].Constructor = Toast; 6295 6296 $.fn[NAME$a].noConflict = function () { 6297 $.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 6298 return Toast._jQueryInterface; 6299 }; 6300 6301 exports.Alert = Alert; 6302 exports.Button = Button; 6303 exports.Carousel = Carousel; 6304 exports.Collapse = Collapse; 6305 exports.Dropdown = Dropdown; 6306 exports.Modal = Modal; 6307 exports.Popover = Popover; 6308 exports.Scrollspy = ScrollSpy; 6309 exports.Tab = Tab; 6310 exports.Toast = Toast; 6311 exports.Tooltip = Tooltip; 6312 exports.Util = Util; 6313 6314 Object.defineProperty(exports, '__esModule', { value: true }); 6315 6316}))); 6317//# sourceMappingURL=bootstrap.js.map 6318 6319 6320/***/ }), 6321
vendor: 288,125 bytes, lines 6322-17205
6322/***/ "./node_modules/jquery/dist/jquery.js": 6323/*!********************************************!*\ 6324 !*** ./node_modules/jquery/dist/jquery.js ***! 6325 \********************************************/ 6326/*! no static exports found */ 6327/***/ (function(module, exports, __webpack_require__) { 6328 6329var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 6330 * jQuery JavaScript Library v3.5.1 6331 * https://jquery.com/ 6332 * 6333 * Includes Sizzle.js 6334 * https://sizzlejs.com/ 6335 * 6336 * Copyright JS Foundation and other contributors 6337 * Released under the MIT license 6338 * https://jquery.org/license 6339 * 6340 * Date: 2020-05-04T22:49Z 6341 */ 6342( function( global, factory ) { 6343 6344 "use strict"; 6345 6346 if ( true && typeof module.exports === "object" ) { 6347 6348 // For CommonJS and CommonJS-like environments where a proper `window` 6349 // is present, execute the factory and get jQuery. 6350 // For environments that do not have a `window` with a `document` 6351 // (such as Node.js), expose a factory as module.exports. 6352 // This accentuates the need for the creation of a real `window`. 6353 // e.g. var jQuery = require("jquery")(window); 6354 // See ticket #14549 for more info. 6355 module.exports = global.document ? 6356 factory( global, true ) : 6357 function( w ) { 6358 if ( !w.document ) { 6359 throw new Error( "jQuery requires a window with a document" ); 6360 } 6361 return factory( w ); 6362 }; 6363 } else { 6364 factory( global ); 6365 } 6366 6367// Pass this if window is not defined yet 6368} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 6369 6370// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 6371// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 6372// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 6373// enough that all such attempts are guarded in a try block. 6374"use strict"; 6375 6376var arr = []; 6377 6378var getProto = Object.getPrototypeOf; 6379 6380var slice = arr.slice; 6381 6382var flat = arr.flat ? function( array ) { 6383 return arr.flat.call( array ); 6384} : function( array ) { 6385 return arr.concat.apply( [], array ); 6386}; 6387 6388 6389var push = arr.push; 6390 6391var indexOf = arr.indexOf; 6392 6393var class2type = {}; 6394 6395var toString = class2type.toString; 6396 6397var hasOwn = class2type.hasOwnProperty; 6398 6399var fnToString = hasOwn.toString; 6400 6401var ObjectFunctionString = fnToString.call( Object ); 6402 6403var support = {}; 6404 6405var isFunction = function isFunction( obj ) { 6406 6407 // Support: Chrome <=57, Firefox <=52 6408 // In some browsers, typeof returns "function" for HTML <object> elements 6409 // (i.e., `typeof document.createElement( "object" ) === "function"`). 6410 // We don't want to classify *any* DOM node as a function. 6411 return typeof obj === "function" && typeof obj.nodeType !== "number"; 6412 }; 6413 6414 6415var isWindow = function isWindow( obj ) { 6416 return obj != null && obj === obj.window; 6417 }; 6418 6419 6420var document = window.document; 6421 6422 6423 6424 var preservedScriptAttributes = { 6425 type: true, 6426 src: true, 6427 nonce: true, 6428 noModule: true 6429 }; 6430 6431 function DOMEval( code, node, doc ) { 6432 doc = doc || document; 6433 6434 var i, val, 6435 script = doc.createElement( "script" ); 6436 6437 script.text = code; 6438 if ( node ) { 6439 for ( i in preservedScriptAttributes ) { 6440 6441 // Support: Firefox 64+, Edge 18+ 6442 // Some browsers don't support the "nonce" property on scripts. 6443 // On the other hand, just using `getAttribute` is not enough as 6444 // the `nonce` attribute is reset to an empty string whenever it 6445 // becomes browsing-context connected. 6446 // See https://github.com/whatwg/html/issues/2369 6447 // See https://html.spec.whatwg.org/#nonce-attributes 6448 // The `node.getAttribute` check was added for the sake of 6449 // `jQuery.globalEval` so that it can fake a nonce-containing node 6450 // via an object. 6451 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 6452 if ( val ) { 6453 script.setAttribute( i, val ); 6454 } 6455 } 6456 } 6457 doc.head.appendChild( script ).parentNode.removeChild( script ); 6458 } 6459 6460 6461function toType( obj ) { 6462 if ( obj == null ) { 6463 return obj + ""; 6464 } 6465 6466 // Support: Android <=2.3 only (functionish RegExp) 6467 return typeof obj === "object" || typeof obj === "function" ? 6468 class2type[ toString.call( obj ) ] || "object" : 6469 typeof obj; 6470} 6471/* global Symbol */ 6472// Defining this global in .eslintrc.json would create a danger of using the global 6473// unguarded in another place, it seems safer to define global only for this module 6474 6475 6476 6477var 6478 version = "3.5.1", 6479 6480 // Define a local copy of jQuery 6481 jQuery = function( selector, context ) { 6482 6483 // The jQuery object is actually just the init constructor 'enhanced' 6484 // Need init if jQuery is called (just allow error to be thrown if not included) 6485 return new jQuery.fn.init( selector, context ); 6486 }; 6487 6488jQuery.fn = jQuery.prototype = { 6489 6490 // The current version of jQuery being used 6491 jquery: version, 6492 6493 constructor: jQuery, 6494 6495 // The default length of a jQuery object is 0 6496 length: 0, 6497 6498 toArray: function() { 6499 return slice.call( this ); 6500 }, 6501 6502 // Get the Nth element in the matched element set OR 6503 // Get the whole matched element set as a clean array 6504 get: function( num ) { 6505 6506 // Return all the elements in a clean array 6507 if ( num == null ) { 6508 return slice.call( this ); 6509 } 6510 6511 // Return just the one element from the set 6512 return num < 0 ? this[ num + this.length ] : this[ num ]; 6513 }, 6514 6515 // Take an array of elements and push it onto the stack 6516 // (returning the new matched element set) 6517 pushStack: function( elems ) { 6518 6519 // Build a new jQuery matched element set 6520 var ret = jQuery.merge( this.constructor(), elems ); 6521 6522 // Add the old object onto the stack (as a reference) 6523 ret.prevObject = this; 6524 6525 // Return the newly-formed element set 6526 return ret; 6527 }, 6528 6529 // Execute a callback for every element in the matched set. 6530 each: function( callback ) { 6531 return jQuery.each( this, callback ); 6532 }, 6533 6534 map: function( callback ) { 6535 return this.pushStack( jQuery.map( this, function( elem, i ) { 6536 return callback.call( elem, i, elem ); 6537 } ) ); 6538 }, 6539 6540 slice: function() { 6541 return this.pushStack( slice.apply( this, arguments ) ); 6542 }, 6543 6544 first: function() { 6545 return this.eq( 0 ); 6546 }, 6547 6548 last: function() { 6549 return this.eq( -1 ); 6550 }, 6551 6552 even: function() { 6553 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 6554 return ( i + 1 ) % 2; 6555 } ) ); 6556 }, 6557 6558 odd: function() { 6559 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 6560 return i % 2; 6561 } ) ); 6562 }, 6563 6564 eq: function( i ) { 6565 var len = this.length, 6566 j = +i + ( i < 0 ? len : 0 ); 6567 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 6568 }, 6569 6570 end: function() { 6571 return this.prevObject || this.constructor(); 6572 }, 6573 6574 // For internal use only. 6575 // Behaves like an Array's method, not like a jQuery method. 6576 push: push, 6577 sort: arr.sort, 6578 splice: arr.splice 6579}; 6580 6581jQuery.extend = jQuery.fn.extend = function() { 6582 var options, name, src, copy, copyIsArray, clone, 6583 target = arguments[ 0 ] || {}, 6584 i = 1, 6585 length = arguments.length, 6586 deep = false; 6587 6588 // Handle a deep copy situation 6589 if ( typeof target === "boolean" ) { 6590 deep = target; 6591 6592 // Skip the boolean and the target 6593 target = arguments[ i ] || {}; 6594 i++; 6595 } 6596 6597 // Handle case when target is a string or something (possible in deep copy) 6598 if ( typeof target !== "object" && !isFunction( target ) ) { 6599 target = {}; 6600 } 6601 6602 // Extend jQuery itself if only one argument is passed 6603 if ( i === length ) { 6604 target = this; 6605 i--; 6606 } 6607 6608 for ( ; i < length; i++ ) { 6609 6610 // Only deal with non-null/undefined values 6611 if ( ( options = arguments[ i ] ) != null ) { 6612 6613 // Extend the base object 6614 for ( name in options ) { 6615 copy = options[ name ]; 6616 6617 // Prevent Object.prototype pollution 6618 // Prevent never-ending loop 6619 if ( name === "__proto__" || target === copy ) { 6620 continue; 6621 } 6622 6623 // Recurse if we're merging plain objects or arrays 6624 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 6625 ( copyIsArray = Array.isArray( copy ) ) ) ) { 6626 src = target[ name ]; 6627 6628 // Ensure proper type for the source value 6629 if ( copyIsArray && !Array.isArray( src ) ) { 6630 clone = []; 6631 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 6632 clone = {}; 6633 } else { 6634 clone = src; 6635 } 6636 copyIsArray = false; 6637 6638 // Never move original objects, clone them 6639 target[ name ] = jQuery.extend( deep, clone, copy ); 6640 6641 // Don't bring in undefined values 6642 } else if ( copy !== undefined ) { 6643 target[ name ] = copy; 6644 } 6645 } 6646 } 6647 } 6648 6649 // Return the modified object 6650 return target; 6651}; 6652 6653jQuery.extend( { 6654 6655 // Unique for each copy of jQuery on the page 6656 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 6657 6658 // Assume jQuery is ready without the ready module 6659 isReady: true, 6660 6661 error: function( msg ) { 6662 throw new Error( msg ); 6663 }, 6664 6665 noop: function() {}, 6666 6667 isPlainObject: function( obj ) { 6668 var proto, Ctor; 6669 6670 // Detect obvious negatives 6671 // Use toString instead of jQuery.type to catch host objects 6672 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 6673 return false; 6674 } 6675 6676 proto = getProto( obj ); 6677 6678 // Objects with no prototype (e.g., `Object.create( null )`) are plain 6679 if ( !proto ) { 6680 return true; 6681 } 6682 6683 // Objects with prototype are plain iff they were constructed by a global Object function 6684 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 6685 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 6686 }, 6687 6688 isEmptyObject: function( obj ) { 6689 var name; 6690 6691 for ( name in obj ) { 6692 return false; 6693 } 6694 return true; 6695 }, 6696 6697 // Evaluates a script in a provided context; falls back to the global one 6698 // if not specified. 6699 globalEval: function( code, options, doc ) { 6700 DOMEval( code, { nonce: options && options.nonce }, doc ); 6701 }, 6702 6703 each: function( obj, callback ) { 6704 var length, i = 0; 6705 6706 if ( isArrayLike( obj ) ) { 6707 length = obj.length; 6708 for ( ; i < length; i++ ) { 6709 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 6710 break; 6711 } 6712 } 6713 } else { 6714 for ( i in obj ) { 6715 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 6716 break; 6717 } 6718 } 6719 } 6720 6721 return obj; 6722 }, 6723 6724 // results is for internal usage only 6725 makeArray: function( arr, results ) { 6726 var ret = results || []; 6727 6728 if ( arr != null ) { 6729 if ( isArrayLike( Object( arr ) ) ) { 6730 jQuery.merge( ret, 6731 typeof arr === "string" ? 6732 [ arr ] : arr 6733 ); 6734 } else { 6735 push.call( ret, arr ); 6736 } 6737 } 6738 6739 return ret; 6740 }, 6741 6742 inArray: function( elem, arr, i ) { 6743 return arr == null ? -1 : indexOf.call( arr, elem, i ); 6744 }, 6745 6746 // Support: Android <=4.0 only, PhantomJS 1 only 6747 // push.apply(_, arraylike) throws on ancient WebKit 6748 merge: function( first, second ) { 6749 var len = +second.length, 6750 j = 0, 6751 i = first.length; 6752 6753 for ( ; j < len; j++ ) { 6754 first[ i++ ] = second[ j ]; 6755 } 6756 6757 first.length = i; 6758 6759 return first; 6760 }, 6761 6762 grep: function( elems, callback, invert ) { 6763 var callbackInverse, 6764 matches = [], 6765 i = 0, 6766 length = elems.length, 6767 callbackExpect = !invert; 6768 6769 // Go through the array, only saving the items 6770 // that pass the validator function 6771 for ( ; i < length; i++ ) { 6772 callbackInverse = !callback( elems[ i ], i ); 6773 if ( callbackInverse !== callbackExpect ) { 6774 matches.push( elems[ i ] ); 6775 } 6776 } 6777 6778 return matches; 6779 }, 6780 6781 // arg is for internal usage only 6782 map: function( elems, callback, arg ) { 6783 var length, value, 6784 i = 0, 6785 ret = []; 6786 6787 // Go through the array, translating each of the items to their new values 6788 if ( isArrayLike( elems ) ) { 6789 length = elems.length; 6790 for ( ; i < length; i++ ) { 6791 value = callback( elems[ i ], i, arg ); 6792 6793 if ( value != null ) { 6794 ret.push( value ); 6795 } 6796 } 6797 6798 // Go through every key on the object, 6799 } else { 6800 for ( i in elems ) { 6801 value = callback( elems[ i ], i, arg ); 6802 6803 if ( value != null ) { 6804 ret.push( value ); 6805 } 6806 } 6807 } 6808 6809 // Flatten any nested arrays 6810 return flat( ret ); 6811 }, 6812 6813 // A global GUID counter for objects 6814 guid: 1, 6815 6816 // jQuery.support is not used in Core but other projects attach their 6817 // properties to it so it needs to exist. 6818 support: support 6819} ); 6820 6821if ( typeof Symbol === "function" ) { 6822 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 6823} 6824 6825// Populate the class2type map 6826jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 6827function( _i, name ) { 6828 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 6829} ); 6830 6831function isArrayLike( obj ) { 6832 6833 // Support: real iOS 8.2 only (not reproducible in simulator) 6834 // `in` check used to prevent JIT error (gh-2145) 6835 // hasOwn isn't used here due to false negatives 6836 // regarding Nodelist length in IE 6837 var length = !!obj && "length" in obj && obj.length, 6838 type = toType( obj ); 6839 6840 if ( isFunction( obj ) || isWindow( obj ) ) { 6841 return false; 6842 } 6843 6844 return type === "array" || length === 0 || 6845 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 6846} 6847var Sizzle = 6848/*! 6849 * Sizzle CSS Selector Engine v2.3.5 6850 * https://sizzlejs.com/ 6851 * 6852 * Copyright JS Foundation and other contributors 6853 * Released under the MIT license 6854 * https://js.foundation/ 6855 * 6856 * Date: 2020-03-14 6857 */ 6858( function( window ) { 6859var i, 6860 support, 6861 Expr, 6862 getText, 6863 isXML, 6864 tokenize, 6865 compile, 6866 select, 6867 outermostContext, 6868 sortInput, 6869 hasDuplicate, 6870 6871 // Local document vars 6872 setDocument, 6873 document, 6874 docElem, 6875 documentIsHTML, 6876 rbuggyQSA, 6877 rbuggyMatches, 6878 matches, 6879 contains, 6880 6881 // Instance-specific data 6882 expando = "sizzle" + 1 * new Date(), 6883 preferredDoc = window.document, 6884 dirruns = 0, 6885 done = 0, 6886 classCache = createCache(), 6887 tokenCache = createCache(), 6888 compilerCache = createCache(), 6889 nonnativeSelectorCache = createCache(), 6890 sortOrder = function( a, b ) { 6891 if ( a === b ) { 6892 hasDuplicate = true; 6893 } 6894 return 0; 6895 }, 6896 6897 // Instance methods 6898 hasOwn = ( {} ).hasOwnProperty, 6899 arr = [], 6900 pop = arr.pop, 6901 pushNative = arr.push, 6902 push = arr.push, 6903 slice = arr.slice, 6904 6905 // Use a stripped-down indexOf as it's faster than native 6906 // https://jsperf.com/thor-indexof-vs-for/5 6907 indexOf = function( list, elem ) { 6908 var i = 0, 6909 len = list.length; 6910 for ( ; i < len; i++ ) { 6911 if ( list[ i ] === elem ) { 6912 return i; 6913 } 6914 } 6915 return -1; 6916 }, 6917 6918 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 6919 "ismap|loop|multiple|open|readonly|required|scoped", 6920 6921 // Regular expressions 6922 6923 // http://www.w3.org/TR/css3-selectors/#whitespace 6924 whitespace = "[\\x20\\t\\r\\n\\f]", 6925 6926 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 6927 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 6928 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 6929 6930 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 6931 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 6932 6933 // Operator (capture 2) 6934 "*([*^$|!~]?=)" + whitespace + 6935 6936 // "Attribute values must be CSS identifiers [capture 5] 6937 // or strings [capture 3 or capture 4]" 6938 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 6939 whitespace + "*\\]", 6940 6941 pseudos = ":(" + identifier + ")(?:\\((" + 6942 6943 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 6944 // 1. quoted (capture 3; capture 4 or capture 5) 6945 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 6946 6947 // 2. simple (capture 6) 6948 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 6949 6950 // 3. anything else (capture 2) 6951 ".*" + 6952 ")\\)|)", 6953 6954 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 6955 rwhitespace = new RegExp( whitespace + "+", "g" ), 6956 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 6957 whitespace + "+$", "g" ), 6958 6959 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 6960 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 6961 "*" ), 6962 rdescend = new RegExp( whitespace + "|>" ), 6963 6964 rpseudo = new RegExp( pseudos ), 6965 ridentifier = new RegExp( "^" + identifier + "$" ), 6966 6967 matchExpr = { 6968 "ID": new RegExp( "^#(" + identifier + ")" ), 6969 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 6970 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 6971 "ATTR": new RegExp( "^" + attributes ), 6972 "PSEUDO": new RegExp( "^" + pseudos ), 6973 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 6974 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 6975 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 6976 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 6977 6978 // For use in libraries implementing .is() 6979 // We use this for POS matching in `select` 6980 "needsContext": new RegExp( "^" + whitespace + 6981 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 6982 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 6983 }, 6984 6985 rhtml = /HTML$/i, 6986 rinputs = /^(?:input|select|textarea|button)$/i, 6987 rheader = /^h\d$/i, 6988 6989 rnative = /^[^{]+\{\s*\[native \w/, 6990 6991 // Easily-parseable/retrievable ID or TAG or CLASS selectors 6992 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 6993 6994 rsibling = /[+~]/, 6995 6996 // CSS escapes 6997 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 6998 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), 6999 funescape = function( escape, nonHex ) { 7000 var high = "0x" + escape.slice( 1 ) - 0x10000; 7001 7002 return nonHex ? 7003 7004 // Strip the backslash prefix from a non-hex escape sequence 7005 nonHex : 7006 7007 // Replace a hexadecimal escape sequence with the encoded Unicode code point 7008 // Support: IE <=11+ 7009 // For values outside the Basic Multilingual Plane (BMP), manually construct a 7010 // surrogate pair 7011 high < 0 ? 7012 String.fromCharCode( high + 0x10000 ) : 7013 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 7014 }, 7015 7016 // CSS string/identifier serialization 7017 // https://drafts.csswg.org/cssom/#common-serializing-idioms 7018 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 7019 fcssescape = function( ch, asCodePoint ) { 7020 if ( asCodePoint ) { 7021 7022 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 7023 if ( ch === "\0" ) { 7024 return "\uFFFD"; 7025 } 7026 7027 // Control characters and (dependent upon position) numbers get escaped as code points 7028 return ch.slice( 0, -1 ) + "\\" + 7029 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 7030 } 7031 7032 // Other potentially-special ASCII characters get backslash-escaped 7033 return "\\" + ch; 7034 }, 7035 7036 // Used for iframes 7037 // See setDocument() 7038 // Removing the function wrapper causes a "Permission Denied" 7039 // error in IE 7040 unloadHandler = function() { 7041 setDocument(); 7042 }, 7043 7044 inDisabledFieldset = addCombinator( 7045 function( elem ) { 7046 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 7047 }, 7048 { dir: "parentNode", next: "legend" } 7049 ); 7050 7051// Optimize for push.apply( _, NodeList ) 7052try { 7053 push.apply( 7054 ( arr = slice.call( preferredDoc.childNodes ) ), 7055 preferredDoc.childNodes 7056 ); 7057 7058 // Support: Android<4.0 7059 // Detect silently failing push.apply 7060 // eslint-disable-next-line no-unused-expressions 7061 arr[ preferredDoc.childNodes.length ].nodeType; 7062} catch ( e ) { 7063 push = { apply: arr.length ? 7064 7065 // Leverage slice if possible 7066 function( target, els ) { 7067 pushNative.apply( target, slice.call( els ) ); 7068 } : 7069 7070 // Support: IE<9 7071 // Otherwise append directly 7072 function( target, els ) { 7073 var j = target.length, 7074 i = 0; 7075 7076 // Can't trust NodeList.length 7077 while ( ( target[ j++ ] = els[ i++ ] ) ) {} 7078 target.length = j - 1; 7079 } 7080 }; 7081} 7082 7083function Sizzle( selector, context, results, seed ) { 7084 var m, i, elem, nid, match, groups, newSelector, 7085 newContext = context && context.ownerDocument, 7086 7087 // nodeType defaults to 9, since context defaults to document 7088 nodeType = context ? context.nodeType : 9; 7089 7090 results = results || []; 7091 7092 // Return early from calls with invalid selector or context 7093 if ( typeof selector !== "string" || !selector || 7094 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 7095 7096 return results; 7097 } 7098 7099 // Try to shortcut find operations (as opposed to filters) in HTML documents 7100 if ( !seed ) { 7101 setDocument( context ); 7102 context = context || document; 7103 7104 if ( documentIsHTML ) { 7105 7106 // If the selector is sufficiently simple, try using a "get*By*" DOM method 7107 // (excepting DocumentFragment context, where the methods don't exist) 7108 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 7109 7110 // ID selector 7111 if ( ( m = match[ 1 ] ) ) { 7112 7113 // Document context 7114 if ( nodeType === 9 ) { 7115 if ( ( elem = context.getElementById( m ) ) ) { 7116 7117 // Support: IE, Opera, Webkit 7118 // TODO: identify versions 7119 // getElementById can match elements by name instead of ID 7120 if ( elem.id === m ) { 7121 results.push( elem ); 7122 return results; 7123 } 7124 } else { 7125 return results; 7126 } 7127 7128 // Element context 7129 } else { 7130 7131 // Support: IE, Opera, Webkit 7132 // TODO: identify versions 7133 // getElementById can match elements by name instead of ID 7134 if ( newContext && ( elem = newContext.getElementById( m ) ) && 7135 contains( context, elem ) && 7136 elem.id === m ) { 7137 7138 results.push( elem ); 7139 return results; 7140 } 7141 } 7142 7143 // Type selector 7144 } else if ( match[ 2 ] ) { 7145 push.apply( results, context.getElementsByTagName( selector ) ); 7146 return results; 7147 7148 // Class selector 7149 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && 7150 context.getElementsByClassName ) { 7151 7152 push.apply( results, context.getElementsByClassName( m ) ); 7153 return results; 7154 } 7155 } 7156 7157 // Take advantage of querySelectorAll 7158 if ( support.qsa && 7159 !nonnativeSelectorCache[ selector + " " ] && 7160 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && 7161 7162 // Support: IE 8 only 7163 // Exclude object elements 7164 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { 7165 7166 newSelector = selector; 7167 newContext = context; 7168 7169 // qSA considers elements outside a scoping root when evaluating child or 7170 // descendant combinators, which is not what we want. 7171 // In such cases, we work around the behavior by prefixing every selector in the 7172 // list with an ID selector referencing the scope context. 7173 // The technique has to be used as well when a leading combinator is used 7174 // as such selectors are not recognized by querySelectorAll. 7175 // Thanks to Andrew Dupont for this technique. 7176 if ( nodeType === 1 && 7177 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { 7178 7179 // Expand context for sibling selectors 7180 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 7181 context; 7182 7183 // We can use :scope instead of the ID hack if the browser 7184 // supports it & if we're not changing the context. 7185 if ( newContext !== context || !support.scope ) { 7186 7187 // Capture the context ID, setting it first if necessary 7188 if ( ( nid = context.getAttribute( "id" ) ) ) { 7189 nid = nid.replace( rcssescape, fcssescape ); 7190 } else { 7191 context.setAttribute( "id", ( nid = expando ) ); 7192 } 7193 } 7194 7195 // Prefix every selector in the list 7196 groups = tokenize( selector ); 7197 i = groups.length; 7198 while ( i-- ) { 7199 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 7200 toSelector( groups[ i ] ); 7201 } 7202 newSelector = groups.join( "," ); 7203 } 7204 7205 try { 7206 push.apply( results, 7207 newContext.querySelectorAll( newSelector ) 7208 ); 7209 return results; 7210 } catch ( qsaError ) { 7211 nonnativeSelectorCache( selector, true ); 7212 } finally { 7213 if ( nid === expando ) { 7214 context.removeAttribute( "id" ); 7215 } 7216 } 7217 } 7218 } 7219 } 7220 7221 // All others 7222 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 7223} 7224 7225/** 7226 * Create key-value caches of limited size 7227 * @returns {function(string, object)} Returns the Object data after storing it on itself with 7228 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 7229 * deleting the oldest entry 7230 */ 7231function createCache() { 7232 var keys = []; 7233 7234 function cache( key, value ) { 7235 7236 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 7237 if ( keys.push( key + " " ) > Expr.cacheLength ) { 7238 7239 // Only keep the most recent entries 7240 delete cache[ keys.shift() ]; 7241 } 7242 return ( cache[ key + " " ] = value ); 7243 } 7244 return cache; 7245} 7246 7247/** 7248 * Mark a function for special use by Sizzle 7249 * @param {Function} fn The function to mark 7250 */ 7251function markFunction( fn ) { 7252 fn[ expando ] = true; 7253 return fn; 7254} 7255 7256/** 7257 * Support testing using an element 7258 * @param {Function} fn Passed the created element and returns a boolean result 7259 */ 7260function assert( fn ) { 7261 var el = document.createElement( "fieldset" ); 7262 7263 try { 7264 return !!fn( el ); 7265 } catch ( e ) { 7266 return false; 7267 } finally { 7268 7269 // Remove from its parent by default 7270 if ( el.parentNode ) { 7271 el.parentNode.removeChild( el ); 7272 } 7273 7274 // release memory in IE 7275 el = null; 7276 } 7277} 7278 7279/** 7280 * Adds the same handler for all of the specified attrs 7281 * @param {String} attrs Pipe-separated list of attributes 7282 * @param {Function} handler The method that will be applied 7283 */ 7284function addHandle( attrs, handler ) { 7285 var arr = attrs.split( "|" ), 7286 i = arr.length; 7287 7288 while ( i-- ) { 7289 Expr.attrHandle[ arr[ i ] ] = handler; 7290 } 7291} 7292 7293/** 7294 * Checks document order of two siblings 7295 * @param {Element} a 7296 * @param {Element} b 7297 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 7298 */ 7299function siblingCheck( a, b ) { 7300 var cur = b && a, 7301 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 7302 a.sourceIndex - b.sourceIndex; 7303 7304 // Use IE sourceIndex if available on both nodes 7305 if ( diff ) { 7306 return diff; 7307 } 7308 7309 // Check if b follows a 7310 if ( cur ) { 7311 while ( ( cur = cur.nextSibling ) ) { 7312 if ( cur === b ) { 7313 return -1; 7314 } 7315 } 7316 } 7317 7318 return a ? 1 : -1; 7319} 7320 7321/** 7322 * Returns a function to use in pseudos for input types 7323 * @param {String} type 7324 */ 7325function createInputPseudo( type ) { 7326 return function( elem ) { 7327 var name = elem.nodeName.toLowerCase(); 7328 return name === "input" && elem.type === type; 7329 }; 7330} 7331 7332/** 7333 * Returns a function to use in pseudos for buttons 7334 * @param {String} type 7335 */ 7336function createButtonPseudo( type ) { 7337 return function( elem ) { 7338 var name = elem.nodeName.toLowerCase(); 7339 return ( name === "input" || name === "button" ) && elem.type === type; 7340 }; 7341} 7342 7343/** 7344 * Returns a function to use in pseudos for :enabled/:disabled 7345 * @param {Boolean} disabled true for :disabled; false for :enabled 7346 */ 7347function createDisabledPseudo( disabled ) { 7348 7349 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 7350 return function( elem ) { 7351 7352 // Only certain elements can match :enabled or :disabled 7353 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 7354 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 7355 if ( "form" in elem ) { 7356 7357 // Check for inherited disabledness on relevant non-disabled elements: 7358 // * listed form-associated elements in a disabled fieldset 7359 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 7360 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 7361 // * option elements in a disabled optgroup 7362 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 7363 // All such elements have a "form" property. 7364 if ( elem.parentNode && elem.disabled === false ) { 7365 7366 // Option elements defer to a parent optgroup if present 7367 if ( "label" in elem ) { 7368 if ( "label" in elem.parentNode ) { 7369 return elem.parentNode.disabled === disabled; 7370 } else { 7371 return elem.disabled === disabled; 7372 } 7373 } 7374 7375 // Support: IE 6 - 11 7376 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 7377 return elem.isDisabled === disabled || 7378 7379 // Where there is no isDisabled, check manually 7380 /* jshint -W018 */ 7381 elem.isDisabled !== !disabled && 7382 inDisabledFieldset( elem ) === disabled; 7383 } 7384 7385 return elem.disabled === disabled; 7386 7387 // Try to winnow out elements that can't be disabled before trusting the disabled property. 7388 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 7389 // even exist on them, let alone have a boolean value. 7390 } else if ( "label" in elem ) { 7391 return elem.disabled === disabled; 7392 } 7393 7394 // Remaining elements are neither :enabled nor :disabled 7395 return false; 7396 }; 7397} 7398 7399/** 7400 * Returns a function to use in pseudos for positionals 7401 * @param {Function} fn 7402 */ 7403function createPositionalPseudo( fn ) { 7404 return markFunction( function( argument ) { 7405 argument = +argument; 7406 return markFunction( function( seed, matches ) { 7407 var j, 7408 matchIndexes = fn( [], seed.length, argument ), 7409 i = matchIndexes.length; 7410 7411 // Match elements found at the specified indexes 7412 while ( i-- ) { 7413 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 7414 seed[ j ] = !( matches[ j ] = seed[ j ] ); 7415 } 7416 } 7417 } ); 7418 } ); 7419} 7420 7421/** 7422 * Checks a node for validity as a Sizzle context 7423 * @param {Element|Object=} context 7424 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 7425 */ 7426function testContext( context ) { 7427 return context && typeof context.getElementsByTagName !== "undefined" && context; 7428} 7429 7430// Expose support vars for convenience 7431support = Sizzle.support = {}; 7432 7433/** 7434 * Detects XML nodes 7435 * @param {Element|Object} elem An element or a document 7436 * @returns {Boolean} True iff elem is a non-HTML XML node 7437 */ 7438isXML = Sizzle.isXML = function( elem ) { 7439 var namespace = elem.namespaceURI, 7440 docElem = ( elem.ownerDocument || elem ).documentElement; 7441 7442 // Support: IE <=8 7443 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 7444 // https://bugs.jquery.com/ticket/4833 7445 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 7446}; 7447 7448/** 7449 * Sets document-related variables once based on the current document 7450 * @param {Element|Object} [doc] An element or document object to use to set the document 7451 * @returns {Object} Returns the current document 7452 */ 7453setDocument = Sizzle.setDocument = function( node ) { 7454 var hasCompare, subWindow, 7455 doc = node ? node.ownerDocument || node : preferredDoc; 7456 7457 // Return early if doc is invalid or already selected 7458 // Support: IE 11+, Edge 17 - 18+ 7459 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7460 // two documents; shallow comparisons work. 7461 // eslint-disable-next-line eqeqeq 7462 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 7463 return document; 7464 } 7465 7466 // Update global variables 7467 document = doc; 7468 docElem = document.documentElement; 7469 documentIsHTML = !isXML( document ); 7470 7471 // Support: IE 9 - 11+, Edge 12 - 18+ 7472 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 7473 // Support: IE 11+, Edge 17 - 18+ 7474 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7475 // two documents; shallow comparisons work. 7476 // eslint-disable-next-line eqeqeq 7477 if ( preferredDoc != document && 7478 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 7479 7480 // Support: IE 11, Edge 7481 if ( subWindow.addEventListener ) { 7482 subWindow.addEventListener( "unload", unloadHandler, false ); 7483 7484 // Support: IE 9 - 10 only 7485 } else if ( subWindow.attachEvent ) { 7486 subWindow.attachEvent( "onunload", unloadHandler ); 7487 } 7488 } 7489 7490 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 7491 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 7492 // IE/Edge & older browsers don't support the :scope pseudo-class. 7493 // Support: Safari 6.0 only 7494 // Safari 6.0 supports :scope but it's an alias of :root there. 7495 support.scope = assert( function( el ) { 7496 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); 7497 return typeof el.querySelectorAll !== "undefined" && 7498 !el.querySelectorAll( ":scope fieldset div" ).length; 7499 } ); 7500 7501 /* Attributes 7502 ---------------------------------------------------------------------- */ 7503 7504 // Support: IE<8 7505 // Verify that getAttribute really returns attributes and not properties 7506 // (excepting IE8 booleans) 7507 support.attributes = assert( function( el ) { 7508 el.className = "i"; 7509 return !el.getAttribute( "className" ); 7510 } ); 7511 7512 /* getElement(s)By* 7513 ---------------------------------------------------------------------- */ 7514 7515 // Check if getElementsByTagName("*") returns only elements 7516 support.getElementsByTagName = assert( function( el ) { 7517 el.appendChild( document.createComment( "" ) ); 7518 return !el.getElementsByTagName( "*" ).length; 7519 } ); 7520 7521 // Support: IE<9 7522 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 7523 7524 // Support: IE<10 7525 // Check if getElementById returns elements by name 7526 // The broken getElementById methods don't pick up programmatically-set names, 7527 // so use a roundabout getElementsByName test 7528 support.getById = assert( function( el ) { 7529 docElem.appendChild( el ).id = expando; 7530 return !document.getElementsByName || !document.getElementsByName( expando ).length; 7531 } ); 7532 7533 // ID filter and find 7534 if ( support.getById ) { 7535 Expr.filter[ "ID" ] = function( id ) { 7536 var attrId = id.replace( runescape, funescape ); 7537 return function( elem ) { 7538 return elem.getAttribute( "id" ) === attrId; 7539 }; 7540 }; 7541 Expr.find[ "ID" ] = function( id, context ) { 7542 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 7543 var elem = context.getElementById( id ); 7544 return elem ? [ elem ] : []; 7545 } 7546 }; 7547 } else { 7548 Expr.filter[ "ID" ] = function( id ) { 7549 var attrId = id.replace( runescape, funescape ); 7550 return function( elem ) { 7551 var node = typeof elem.getAttributeNode !== "undefined" && 7552 elem.getAttributeNode( "id" ); 7553 return node && node.value === attrId; 7554 }; 7555 }; 7556 7557 // Support: IE 6 - 7 only 7558 // getElementById is not reliable as a find shortcut 7559 Expr.find[ "ID" ] = function( id, context ) { 7560 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 7561 var node, i, elems, 7562 elem = context.getElementById( id ); 7563 7564 if ( elem ) { 7565 7566 // Verify the id attribute 7567 node = elem.getAttributeNode( "id" ); 7568 if ( node && node.value === id ) { 7569 return [ elem ]; 7570 } 7571 7572 // Fall back on getElementsByName 7573 elems = context.getElementsByName( id ); 7574 i = 0; 7575 while ( ( elem = elems[ i++ ] ) ) { 7576 node = elem.getAttributeNode( "id" ); 7577 if ( node && node.value === id ) { 7578 return [ elem ]; 7579 } 7580 } 7581 } 7582 7583 return []; 7584 } 7585 }; 7586 } 7587 7588 // Tag 7589 Expr.find[ "TAG" ] = support.getElementsByTagName ? 7590 function( tag, context ) { 7591 if ( typeof context.getElementsByTagName !== "undefined" ) { 7592 return context.getElementsByTagName( tag ); 7593 7594 // DocumentFragment nodes don't have gEBTN 7595 } else if ( support.qsa ) { 7596 return context.querySelectorAll( tag ); 7597 } 7598 } : 7599 7600 function( tag, context ) { 7601 var elem, 7602 tmp = [], 7603 i = 0, 7604 7605 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 7606 results = context.getElementsByTagName( tag ); 7607 7608 // Filter out possible comments 7609 if ( tag === "*" ) { 7610 while ( ( elem = results[ i++ ] ) ) { 7611 if ( elem.nodeType === 1 ) { 7612 tmp.push( elem ); 7613 } 7614 } 7615 7616 return tmp; 7617 } 7618 return results; 7619 }; 7620 7621 // Class 7622 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 7623 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 7624 return context.getElementsByClassName( className ); 7625 } 7626 }; 7627 7628 /* QSA/matchesSelector 7629 ---------------------------------------------------------------------- */ 7630 7631 // QSA and matchesSelector support 7632 7633 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 7634 rbuggyMatches = []; 7635 7636 // qSa(:focus) reports false when true (Chrome 21) 7637 // We allow this because of a bug in IE8/9 that throws an error 7638 // whenever `document.activeElement` is accessed on an iframe 7639 // So, we allow :focus to pass through QSA all the time to avoid the IE error 7640 // See https://bugs.jquery.com/ticket/13378 7641 rbuggyQSA = []; 7642 7643 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 7644 7645 // Build QSA regex 7646 // Regex strategy adopted from Diego Perini 7647 assert( function( el ) { 7648 7649 var input; 7650 7651 // Select is set to empty string on purpose 7652 // This is to test IE's treatment of not explicitly 7653 // setting a boolean content attribute, 7654 // since its presence should be enough 7655 // https://bugs.jquery.com/ticket/12359 7656 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 7657 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 7658 "<option selected=''></option></select>"; 7659 7660 // Support: IE8, Opera 11-12.16 7661 // Nothing should be selected when empty strings follow ^= or $= or *= 7662 // The test attribute must be unknown in Opera but "safe" for WinRT 7663 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 7664 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 7665 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 7666 } 7667 7668 // Support: IE8 7669 // Boolean attributes and "value" are not treated correctly 7670 if ( !el.querySelectorAll( "[selected]" ).length ) { 7671 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 7672 } 7673 7674 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 7675 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 7676 rbuggyQSA.push( "~=" ); 7677 } 7678 7679 // Support: IE 11+, Edge 15 - 18+ 7680 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 7681 // Adding a temporary attribute to the document before the selection works 7682 // around the issue. 7683 // Interestingly, IE 10 & older don't seem to have the issue. 7684 input = document.createElement( "input" ); 7685 input.setAttribute( "name", "" ); 7686 el.appendChild( input ); 7687 if ( !el.querySelectorAll( "[name='']" ).length ) { 7688 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 7689 whitespace + "*(?:''|\"\")" ); 7690 } 7691 7692 // Webkit/Opera - :checked should return selected option elements 7693 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 7694 // IE8 throws error here and will not see later tests 7695 if ( !el.querySelectorAll( ":checked" ).length ) { 7696 rbuggyQSA.push( ":checked" ); 7697 } 7698 7699 // Support: Safari 8+, iOS 8+ 7700 // https://bugs.webkit.org/show_bug.cgi?id=136851 7701 // In-page `selector#id sibling-combinator selector` fails 7702 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 7703 rbuggyQSA.push( ".#.+[+~]" ); 7704 } 7705 7706 // Support: Firefox <=3.6 - 5 only 7707 // Old Firefox doesn't throw on a badly-escaped identifier. 7708 el.querySelectorAll( "\\\f" ); 7709 rbuggyQSA.push( "[\\r\\n\\f]" ); 7710 } ); 7711 7712 assert( function( el ) { 7713 el.innerHTML = "<a href='' disabled='disabled'></a>" + 7714 "<select disabled='disabled'><option/></select>"; 7715 7716 // Support: Windows 8 Native Apps 7717 // The type and name attributes are restricted during .innerHTML assignment 7718 var input = document.createElement( "input" ); 7719 input.setAttribute( "type", "hidden" ); 7720 el.appendChild( input ).setAttribute( "name", "D" ); 7721 7722 // Support: IE8 7723 // Enforce case-sensitivity of name attribute 7724 if ( el.querySelectorAll( "[name=d]" ).length ) { 7725 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 7726 } 7727 7728 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 7729 // IE8 throws error here and will not see later tests 7730 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { 7731 rbuggyQSA.push( ":enabled", ":disabled" ); 7732 } 7733 7734 // Support: IE9-11+ 7735 // IE's :disabled selector does not pick up the children of disabled fieldsets 7736 docElem.appendChild( el ).disabled = true; 7737 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 7738 rbuggyQSA.push( ":enabled", ":disabled" ); 7739 } 7740 7741 // Support: Opera 10 - 11 only 7742 // Opera 10-11 does not throw on post-comma invalid pseudos 7743 el.querySelectorAll( "*,:x" ); 7744 rbuggyQSA.push( ",.*:" ); 7745 } ); 7746 } 7747 7748 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || 7749 docElem.webkitMatchesSelector || 7750 docElem.mozMatchesSelector || 7751 docElem.oMatchesSelector || 7752 docElem.msMatchesSelector ) ) ) ) { 7753 7754 assert( function( el ) { 7755 7756 // Check to see if it's possible to do matchesSelector 7757 // on a disconnected node (IE 9) 7758 support.disconnectedMatch = matches.call( el, "*" ); 7759 7760 // This should fail with an exception 7761 // Gecko does not error, returns false instead 7762 matches.call( el, "[s!='']:x" ); 7763 rbuggyMatches.push( "!=", pseudos ); 7764 } ); 7765 } 7766 7767 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 7768 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); 7769 7770 /* Contains 7771 ---------------------------------------------------------------------- */ 7772 hasCompare = rnative.test( docElem.compareDocumentPosition ); 7773 7774 // Element contains another 7775 // Purposefully self-exclusive 7776 // As in, an element does not contain itself 7777 contains = hasCompare || rnative.test( docElem.contains ) ? 7778 function( a, b ) { 7779 var adown = a.nodeType === 9 ? a.documentElement : a, 7780 bup = b && b.parentNode; 7781 return a === bup || !!( bup && bup.nodeType === 1 && ( 7782 adown.contains ? 7783 adown.contains( bup ) : 7784 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 7785 ) ); 7786 } : 7787 function( a, b ) { 7788 if ( b ) { 7789 while ( ( b = b.parentNode ) ) { 7790 if ( b === a ) { 7791 return true; 7792 } 7793 } 7794 } 7795 return false; 7796 }; 7797 7798 /* Sorting 7799 ---------------------------------------------------------------------- */ 7800 7801 // Document order sorting 7802 sortOrder = hasCompare ? 7803 function( a, b ) { 7804 7805 // Flag for duplicate removal 7806 if ( a === b ) { 7807 hasDuplicate = true; 7808 return 0; 7809 } 7810 7811 // Sort on method existence if only one input has compareDocumentPosition 7812 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 7813 if ( compare ) { 7814 return compare; 7815 } 7816 7817 // Calculate position if both inputs belong to the same document 7818 // Support: IE 11+, Edge 17 - 18+ 7819 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7820 // two documents; shallow comparisons work. 7821 // eslint-disable-next-line eqeqeq 7822 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 7823 a.compareDocumentPosition( b ) : 7824 7825 // Otherwise we know they are disconnected 7826 1; 7827 7828 // Disconnected nodes 7829 if ( compare & 1 || 7830 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 7831 7832 // Choose the first element that is related to our preferred document 7833 // Support: IE 11+, Edge 17 - 18+ 7834 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7835 // two documents; shallow comparisons work. 7836 // eslint-disable-next-line eqeqeq 7837 if ( a == document || a.ownerDocument == preferredDoc && 7838 contains( preferredDoc, a ) ) { 7839 return -1; 7840 } 7841 7842 // Support: IE 11+, Edge 17 - 18+ 7843 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7844 // two documents; shallow comparisons work. 7845 // eslint-disable-next-line eqeqeq 7846 if ( b == document || b.ownerDocument == preferredDoc && 7847 contains( preferredDoc, b ) ) { 7848 return 1; 7849 } 7850 7851 // Maintain original order 7852 return sortInput ? 7853 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 7854 0; 7855 } 7856 7857 return compare & 4 ? -1 : 1; 7858 } : 7859 function( a, b ) { 7860 7861 // Exit early if the nodes are identical 7862 if ( a === b ) { 7863 hasDuplicate = true; 7864 return 0; 7865 } 7866 7867 var cur, 7868 i = 0, 7869 aup = a.parentNode, 7870 bup = b.parentNode, 7871 ap = [ a ], 7872 bp = [ b ]; 7873 7874 // Parentless nodes are either documents or disconnected 7875 if ( !aup || !bup ) { 7876 7877 // Support: IE 11+, Edge 17 - 18+ 7878 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7879 // two documents; shallow comparisons work. 7880 /* eslint-disable eqeqeq */ 7881 return a == document ? -1 : 7882 b == document ? 1 : 7883 /* eslint-enable eqeqeq */ 7884 aup ? -1 : 7885 bup ? 1 : 7886 sortInput ? 7887 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 7888 0; 7889 7890 // If the nodes are siblings, we can do a quick check 7891 } else if ( aup === bup ) { 7892 return siblingCheck( a, b ); 7893 } 7894 7895 // Otherwise we need full lists of their ancestors for comparison 7896 cur = a; 7897 while ( ( cur = cur.parentNode ) ) { 7898 ap.unshift( cur ); 7899 } 7900 cur = b; 7901 while ( ( cur = cur.parentNode ) ) { 7902 bp.unshift( cur ); 7903 } 7904 7905 // Walk down the tree looking for a discrepancy 7906 while ( ap[ i ] === bp[ i ] ) { 7907 i++; 7908 } 7909 7910 return i ? 7911 7912 // Do a sibling check if the nodes have a common ancestor 7913 siblingCheck( ap[ i ], bp[ i ] ) : 7914 7915 // Otherwise nodes in our document sort first 7916 // Support: IE 11+, Edge 17 - 18+ 7917 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7918 // two documents; shallow comparisons work. 7919 /* eslint-disable eqeqeq */ 7920 ap[ i ] == preferredDoc ? -1 : 7921 bp[ i ] == preferredDoc ? 1 : 7922 /* eslint-enable eqeqeq */ 7923 0; 7924 }; 7925 7926 return document; 7927}; 7928 7929Sizzle.matches = function( expr, elements ) { 7930 return Sizzle( expr, null, null, elements ); 7931}; 7932 7933Sizzle.matchesSelector = function( elem, expr ) { 7934 setDocument( elem ); 7935 7936 if ( support.matchesSelector && documentIsHTML && 7937 !nonnativeSelectorCache[ expr + " " ] && 7938 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 7939 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 7940 7941 try { 7942 var ret = matches.call( elem, expr ); 7943 7944 // IE 9's matchesSelector returns false on disconnected nodes 7945 if ( ret || support.disconnectedMatch || 7946 7947 // As well, disconnected nodes are said to be in a document 7948 // fragment in IE 9 7949 elem.document && elem.document.nodeType !== 11 ) { 7950 return ret; 7951 } 7952 } catch ( e ) { 7953 nonnativeSelectorCache( expr, true ); 7954 } 7955 } 7956 7957 return Sizzle( expr, document, null, [ elem ] ).length > 0; 7958}; 7959 7960Sizzle.contains = function( context, elem ) { 7961 7962 // Set document vars if needed 7963 // Support: IE 11+, Edge 17 - 18+ 7964 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7965 // two documents; shallow comparisons work. 7966 // eslint-disable-next-line eqeqeq 7967 if ( ( context.ownerDocument || context ) != document ) { 7968 setDocument( context ); 7969 } 7970 return contains( context, elem ); 7971}; 7972 7973Sizzle.attr = function( elem, name ) { 7974 7975 // Set document vars if needed 7976 // Support: IE 11+, Edge 17 - 18+ 7977 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 7978 // two documents; shallow comparisons work. 7979 // eslint-disable-next-line eqeqeq 7980 if ( ( elem.ownerDocument || elem ) != document ) { 7981 setDocument( elem ); 7982 } 7983 7984 var fn = Expr.attrHandle[ name.toLowerCase() ], 7985 7986 // Don't get fooled by Object.prototype properties (jQuery #13807) 7987 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 7988 fn( elem, name, !documentIsHTML ) : 7989 undefined; 7990 7991 return val !== undefined ? 7992 val : 7993 support.attributes || !documentIsHTML ? 7994 elem.getAttribute( name ) : 7995 ( val = elem.getAttributeNode( name ) ) && val.specified ? 7996 val.value : 7997 null; 7998}; 7999 8000Sizzle.escape = function( sel ) { 8001 return ( sel + "" ).replace( rcssescape, fcssescape ); 8002}; 8003 8004Sizzle.error = function( msg ) { 8005 throw new Error( "Syntax error, unrecognized expression: " + msg ); 8006}; 8007 8008/** 8009 * Document sorting and removing duplicates 8010 * @param {ArrayLike} results 8011 */ 8012Sizzle.uniqueSort = function( results ) { 8013 var elem, 8014 duplicates = [], 8015 j = 0, 8016 i = 0; 8017 8018 // Unless we *know* we can detect duplicates, assume their presence 8019 hasDuplicate = !support.detectDuplicates; 8020 sortInput = !support.sortStable && results.slice( 0 ); 8021 results.sort( sortOrder ); 8022 8023 if ( hasDuplicate ) { 8024 while ( ( elem = results[ i++ ] ) ) { 8025 if ( elem === results[ i ] ) { 8026 j = duplicates.push( i ); 8027 } 8028 } 8029 while ( j-- ) { 8030 results.splice( duplicates[ j ], 1 ); 8031 } 8032 } 8033 8034 // Clear input after sorting to release objects 8035 // See https://github.com/jquery/sizzle/pull/225 8036 sortInput = null; 8037 8038 return results; 8039}; 8040 8041/** 8042 * Utility function for retrieving the text value of an array of DOM nodes 8043 * @param {Array|Element} elem 8044 */ 8045getText = Sizzle.getText = function( elem ) { 8046 var node, 8047 ret = "", 8048 i = 0, 8049 nodeType = elem.nodeType; 8050 8051 if ( !nodeType ) { 8052 8053 // If no nodeType, this is expected to be an array 8054 while ( ( node = elem[ i++ ] ) ) { 8055 8056 // Do not traverse comment nodes 8057 ret += getText( node ); 8058 } 8059 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 8060 8061 // Use textContent for elements 8062 // innerText usage removed for consistency of new lines (jQuery #11153) 8063 if ( typeof elem.textContent === "string" ) { 8064 return elem.textContent; 8065 } else { 8066 8067 // Traverse its children 8068 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 8069 ret += getText( elem ); 8070 } 8071 } 8072 } else if ( nodeType === 3 || nodeType === 4 ) { 8073 return elem.nodeValue; 8074 } 8075 8076 // Do not include comment or processing instruction nodes 8077 8078 return ret; 8079}; 8080 8081Expr = Sizzle.selectors = { 8082 8083 // Can be adjusted by the user 8084 cacheLength: 50, 8085 8086 createPseudo: markFunction, 8087 8088 match: matchExpr, 8089 8090 attrHandle: {}, 8091 8092 find: {}, 8093 8094 relative: { 8095 ">": { dir: "parentNode", first: true }, 8096 " ": { dir: "parentNode" }, 8097 "+": { dir: "previousSibling", first: true }, 8098 "~": { dir: "previousSibling" } 8099 }, 8100 8101 preFilter: { 8102 "ATTR": function( match ) { 8103 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 8104 8105 // Move the given value to match[3] whether quoted or unquoted 8106 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 8107 match[ 5 ] || "" ).replace( runescape, funescape ); 8108 8109 if ( match[ 2 ] === "~=" ) { 8110 match[ 3 ] = " " + match[ 3 ] + " "; 8111 } 8112 8113 return match.slice( 0, 4 ); 8114 }, 8115 8116 "CHILD": function( match ) { 8117 8118 /* matches from matchExpr["CHILD"] 8119 1 type (only|nth|...) 8120 2 what (child|of-type) 8121 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 8122 4 xn-component of xn+y argument ([+-]?\d*n|) 8123 5 sign of xn-component 8124 6 x of xn-component 8125 7 sign of y-component 8126 8 y of y-component 8127 */ 8128 match[ 1 ] = match[ 1 ].toLowerCase(); 8129 8130 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 8131 8132 // nth-* requires argument 8133 if ( !match[ 3 ] ) { 8134 Sizzle.error( match[ 0 ] ); 8135 } 8136 8137 // numeric x and y parameters for Expr.filter.CHILD 8138 // remember that false/true cast respectively to 0/1 8139 match[ 4 ] = +( match[ 4 ] ? 8140 match[ 5 ] + ( match[ 6 ] || 1 ) : 8141 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 8142 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 8143 8144 // other types prohibit arguments 8145 } else if ( match[ 3 ] ) { 8146 Sizzle.error( match[ 0 ] ); 8147 } 8148 8149 return match; 8150 }, 8151 8152 "PSEUDO": function( match ) { 8153 var excess, 8154 unquoted = !match[ 6 ] && match[ 2 ]; 8155 8156 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 8157 return null; 8158 } 8159 8160 // Accept quoted arguments as-is 8161 if ( match[ 3 ] ) { 8162 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 8163 8164 // Strip excess characters from unquoted arguments 8165 } else if ( unquoted && rpseudo.test( unquoted ) && 8166 8167 // Get excess from tokenize (recursively) 8168 ( excess = tokenize( unquoted, true ) ) && 8169 8170 // advance to the next closing parenthesis 8171 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 8172 8173 // excess is a negative index 8174 match[ 0 ] = match[ 0 ].slice( 0, excess ); 8175 match[ 2 ] = unquoted.slice( 0, excess ); 8176 } 8177 8178 // Return only captures needed by the pseudo filter method (type and argument) 8179 return match.slice( 0, 3 ); 8180 } 8181 }, 8182 8183 filter: { 8184 8185 "TAG": function( nodeNameSelector ) { 8186 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 8187 return nodeNameSelector === "*" ? 8188 function() { 8189 return true; 8190 } : 8191 function( elem ) { 8192 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 8193 }; 8194 }, 8195 8196 "CLASS": function( className ) { 8197 var pattern = classCache[ className + " " ]; 8198 8199 return pattern || 8200 ( pattern = new RegExp( "(^|" + whitespace + 8201 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 8202 className, function( elem ) { 8203 return pattern.test( 8204 typeof elem.className === "string" && elem.className || 8205 typeof elem.getAttribute !== "undefined" && 8206 elem.getAttribute( "class" ) || 8207 "" 8208 ); 8209 } ); 8210 }, 8211 8212 "ATTR": function( name, operator, check ) { 8213 return function( elem ) { 8214 var result = Sizzle.attr( elem, name ); 8215 8216 if ( result == null ) { 8217 return operator === "!="; 8218 } 8219 if ( !operator ) { 8220 return true; 8221 } 8222 8223 result += ""; 8224 8225 /* eslint-disable max-len */ 8226 8227 return operator === "=" ? result === check : 8228 operator === "!=" ? result !== check : 8229 operator === "^=" ? check && result.indexOf( check ) === 0 : 8230 operator === "*=" ? check && result.indexOf( check ) > -1 : 8231 operator === "$=" ? check && result.slice( -check.length ) === check : 8232 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 8233 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 8234 false; 8235 /* eslint-enable max-len */ 8236 8237 }; 8238 }, 8239 8240 "CHILD": function( type, what, _argument, first, last ) { 8241 var simple = type.slice( 0, 3 ) !== "nth", 8242 forward = type.slice( -4 ) !== "last", 8243 ofType = what === "of-type"; 8244 8245 return first === 1 && last === 0 ? 8246 8247 // Shortcut for :nth-*(n) 8248 function( elem ) { 8249 return !!elem.parentNode; 8250 } : 8251 8252 function( elem, _context, xml ) { 8253 var cache, uniqueCache, outerCache, node, nodeIndex, start, 8254 dir = simple !== forward ? "nextSibling" : "previousSibling", 8255 parent = elem.parentNode, 8256 name = ofType && elem.nodeName.toLowerCase(), 8257 useCache = !xml && !ofType, 8258 diff = false; 8259 8260 if ( parent ) { 8261 8262 // :(first|last|only)-(child|of-type) 8263 if ( simple ) { 8264 while ( dir ) { 8265 node = elem; 8266 while ( ( node = node[ dir ] ) ) { 8267 if ( ofType ? 8268 node.nodeName.toLowerCase() === name : 8269 node.nodeType === 1 ) { 8270 8271 return false; 8272 } 8273 } 8274 8275 // Reverse direction for :only-* (if we haven't yet done so) 8276 start = dir = type === "only" && !start && "nextSibling"; 8277 } 8278 return true; 8279 } 8280 8281 start = [ forward ? parent.firstChild : parent.lastChild ]; 8282 8283 // non-xml :nth-child(...) stores cache data on `parent` 8284 if ( forward && useCache ) { 8285 8286 // Seek `elem` from a previously-cached index 8287 8288 // ...in a gzip-friendly way 8289 node = parent; 8290 outerCache = node[ expando ] || ( node[ expando ] = {} ); 8291 8292 // Support: IE <9 only 8293 // Defend against cloned attroperties (jQuery gh-1709) 8294 uniqueCache = outerCache[ node.uniqueID ] || 8295 ( outerCache[ node.uniqueID ] = {} ); 8296 8297 cache = uniqueCache[ type ] || []; 8298 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 8299 diff = nodeIndex && cache[ 2 ]; 8300 node = nodeIndex && parent.childNodes[ nodeIndex ]; 8301 8302 while ( ( node = ++nodeIndex && node && node[ dir ] || 8303 8304 // Fallback to seeking `elem` from the start 8305 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 8306 8307 // When found, cache indexes on `parent` and break 8308 if ( node.nodeType === 1 && ++diff && node === elem ) { 8309 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 8310 break; 8311 } 8312 } 8313 8314 } else { 8315 8316 // Use previously-cached element index if available 8317 if ( useCache ) { 8318 8319 // ...in a gzip-friendly way 8320 node = elem; 8321 outerCache = node[ expando ] || ( node[ expando ] = {} ); 8322 8323 // Support: IE <9 only 8324 // Defend against cloned attroperties (jQuery gh-1709) 8325 uniqueCache = outerCache[ node.uniqueID ] || 8326 ( outerCache[ node.uniqueID ] = {} ); 8327 8328 cache = uniqueCache[ type ] || []; 8329 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 8330 diff = nodeIndex; 8331 } 8332 8333 // xml :nth-child(...) 8334 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 8335 if ( diff === false ) { 8336 8337 // Use the same loop as above to seek `elem` from the start 8338 while ( ( node = ++nodeIndex && node && node[ dir ] || 8339 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 8340 8341 if ( ( ofType ? 8342 node.nodeName.toLowerCase() === name : 8343 node.nodeType === 1 ) && 8344 ++diff ) { 8345 8346 // Cache the index of each encountered element 8347 if ( useCache ) { 8348 outerCache = node[ expando ] || 8349 ( node[ expando ] = {} ); 8350 8351 // Support: IE <9 only 8352 // Defend against cloned attroperties (jQuery gh-1709) 8353 uniqueCache = outerCache[ node.uniqueID ] || 8354 ( outerCache[ node.uniqueID ] = {} ); 8355 8356 uniqueCache[ type ] = [ dirruns, diff ]; 8357 } 8358 8359 if ( node === elem ) { 8360 break; 8361 } 8362 } 8363 } 8364 } 8365 } 8366 8367 // Incorporate the offset, then check against cycle size 8368 diff -= last; 8369 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 8370 } 8371 }; 8372 }, 8373 8374 "PSEUDO": function( pseudo, argument ) { 8375 8376 // pseudo-class names are case-insensitive 8377 // http://www.w3.org/TR/selectors/#pseudo-classes 8378 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 8379 // Remember that setFilters inherits from pseudos 8380 var args, 8381 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 8382 Sizzle.error( "unsupported pseudo: " + pseudo ); 8383 8384 // The user may use createPseudo to indicate that 8385 // arguments are needed to create the filter function 8386 // just as Sizzle does 8387 if ( fn[ expando ] ) { 8388 return fn( argument ); 8389 } 8390 8391 // But maintain support for old signatures 8392 if ( fn.length > 1 ) { 8393 args = [ pseudo, pseudo, "", argument ]; 8394 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 8395 markFunction( function( seed, matches ) { 8396 var idx, 8397 matched = fn( seed, argument ), 8398 i = matched.length; 8399 while ( i-- ) { 8400 idx = indexOf( seed, matched[ i ] ); 8401 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 8402 } 8403 } ) : 8404 function( elem ) { 8405 return fn( elem, 0, args ); 8406 }; 8407 } 8408 8409 return fn; 8410 } 8411 }, 8412 8413 pseudos: { 8414 8415 // Potentially complex pseudos 8416 "not": markFunction( function( selector ) { 8417 8418 // Trim the selector passed to compile 8419 // to avoid treating leading and trailing 8420 // spaces as combinators 8421 var input = [], 8422 results = [], 8423 matcher = compile( selector.replace( rtrim, "$1" ) ); 8424 8425 return matcher[ expando ] ? 8426 markFunction( function( seed, matches, _context, xml ) { 8427 var elem, 8428 unmatched = matcher( seed, null, xml, [] ), 8429 i = seed.length; 8430 8431 // Match elements unmatched by `matcher` 8432 while ( i-- ) { 8433 if ( ( elem = unmatched[ i ] ) ) { 8434 seed[ i ] = !( matches[ i ] = elem ); 8435 } 8436 } 8437 } ) : 8438 function( elem, _context, xml ) { 8439 input[ 0 ] = elem; 8440 matcher( input, null, xml, results ); 8441 8442 // Don't keep the element (issue #299) 8443 input[ 0 ] = null; 8444 return !results.pop(); 8445 }; 8446 } ), 8447 8448 "has": markFunction( function( selector ) { 8449 return function( elem ) { 8450 return Sizzle( selector, elem ).length > 0; 8451 }; 8452 } ), 8453 8454 "contains": markFunction( function( text ) { 8455 text = text.replace( runescape, funescape ); 8456 return function( elem ) { 8457 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 8458 }; 8459 } ), 8460 8461 // "Whether an element is represented by a :lang() selector 8462 // is based solely on the element's language value 8463 // being equal to the identifier C, 8464 // or beginning with the identifier C immediately followed by "-". 8465 // The matching of C against the element's language value is performed case-insensitively. 8466 // The identifier C does not have to be a valid language name." 8467 // http://www.w3.org/TR/selectors/#lang-pseudo 8468 "lang": markFunction( function( lang ) { 8469 8470 // lang value must be a valid identifier 8471 if ( !ridentifier.test( lang || "" ) ) { 8472 Sizzle.error( "unsupported lang: " + lang ); 8473 } 8474 lang = lang.replace( runescape, funescape ).toLowerCase(); 8475 return function( elem ) { 8476 var elemLang; 8477 do { 8478 if ( ( elemLang = documentIsHTML ? 8479 elem.lang : 8480 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 8481 8482 elemLang = elemLang.toLowerCase(); 8483 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 8484 } 8485 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 8486 return false; 8487 }; 8488 } ), 8489 8490 // Miscellaneous 8491 "target": function( elem ) { 8492 var hash = window.location && window.location.hash; 8493 return hash && hash.slice( 1 ) === elem.id; 8494 }, 8495 8496 "root": function( elem ) { 8497 return elem === docElem; 8498 }, 8499 8500 "focus": function( elem ) { 8501 return elem === document.activeElement && 8502 ( !document.hasFocus || document.hasFocus() ) && 8503 !!( elem.type || elem.href || ~elem.tabIndex ); 8504 }, 8505 8506 // Boolean properties 8507 "enabled": createDisabledPseudo( false ), 8508 "disabled": createDisabledPseudo( true ), 8509 8510 "checked": function( elem ) { 8511 8512 // In CSS3, :checked should return both checked and selected elements 8513 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 8514 var nodeName = elem.nodeName.toLowerCase(); 8515 return ( nodeName === "input" && !!elem.checked ) || 8516 ( nodeName === "option" && !!elem.selected ); 8517 }, 8518 8519 "selected": function( elem ) { 8520 8521 // Accessing this property makes selected-by-default 8522 // options in Safari work properly 8523 if ( elem.parentNode ) { 8524 // eslint-disable-next-line no-unused-expressions 8525 elem.parentNode.selectedIndex; 8526 } 8527 8528 return elem.selected === true; 8529 }, 8530 8531 // Contents 8532 "empty": function( elem ) { 8533 8534 // http://www.w3.org/TR/selectors/#empty-pseudo 8535 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 8536 // but not by others (comment: 8; processing instruction: 7; etc.) 8537 // nodeType < 6 works because attributes (2) do not appear as children 8538 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 8539 if ( elem.nodeType < 6 ) { 8540 return false; 8541 } 8542 } 8543 return true; 8544 }, 8545 8546 "parent": function( elem ) { 8547 return !Expr.pseudos[ "empty" ]( elem ); 8548 }, 8549 8550 // Element/input types 8551 "header": function( elem ) { 8552 return rheader.test( elem.nodeName ); 8553 }, 8554 8555 "input": function( elem ) { 8556 return rinputs.test( elem.nodeName ); 8557 }, 8558 8559 "button": function( elem ) { 8560 var name = elem.nodeName.toLowerCase(); 8561 return name === "input" && elem.type === "button" || name === "button"; 8562 }, 8563 8564 "text": function( elem ) { 8565 var attr; 8566 return elem.nodeName.toLowerCase() === "input" && 8567 elem.type === "text" && 8568 8569 // Support: IE<8 8570 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 8571 ( ( attr = elem.getAttribute( "type" ) ) == null || 8572 attr.toLowerCase() === "text" ); 8573 }, 8574 8575 // Position-in-collection 8576 "first": createPositionalPseudo( function() { 8577 return [ 0 ]; 8578 } ), 8579 8580 "last": createPositionalPseudo( function( _matchIndexes, length ) { 8581 return [ length - 1 ]; 8582 } ), 8583 8584 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 8585 return [ argument < 0 ? argument + length : argument ]; 8586 } ), 8587 8588 "even": createPositionalPseudo( function( matchIndexes, length ) { 8589 var i = 0; 8590 for ( ; i < length; i += 2 ) { 8591 matchIndexes.push( i ); 8592 } 8593 return matchIndexes; 8594 } ), 8595 8596 "odd": createPositionalPseudo( function( matchIndexes, length ) { 8597 var i = 1; 8598 for ( ; i < length; i += 2 ) { 8599 matchIndexes.push( i ); 8600 } 8601 return matchIndexes; 8602 } ), 8603 8604 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 8605 var i = argument < 0 ? 8606 argument + length : 8607 argument > length ? 8608 length : 8609 argument; 8610 for ( ; --i >= 0; ) { 8611 matchIndexes.push( i ); 8612 } 8613 return matchIndexes; 8614 } ), 8615 8616 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 8617 var i = argument < 0 ? argument + length : argument; 8618 for ( ; ++i < length; ) { 8619 matchIndexes.push( i ); 8620 } 8621 return matchIndexes; 8622 } ) 8623 } 8624}; 8625 8626Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 8627 8628// Add button/input type pseudos 8629for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 8630 Expr.pseudos[ i ] = createInputPseudo( i ); 8631} 8632for ( i in { submit: true, reset: true } ) { 8633 Expr.pseudos[ i ] = createButtonPseudo( i ); 8634} 8635 8636// Easy API for creating new setFilters 8637function setFilters() {} 8638setFilters.prototype = Expr.filters = Expr.pseudos; 8639Expr.setFilters = new setFilters(); 8640 8641tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 8642 var matched, match, tokens, type, 8643 soFar, groups, preFilters, 8644 cached = tokenCache[ selector + " " ]; 8645 8646 if ( cached ) { 8647 return parseOnly ? 0 : cached.slice( 0 ); 8648 } 8649 8650 soFar = selector; 8651 groups = []; 8652 preFilters = Expr.preFilter; 8653 8654 while ( soFar ) { 8655 8656 // Comma and first run 8657 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 8658 if ( match ) { 8659 8660 // Don't consume trailing commas as valid 8661 soFar = soFar.slice( match[ 0 ].length ) || soFar; 8662 } 8663 groups.push( ( tokens = [] ) ); 8664 } 8665 8666 matched = false; 8667 8668 // Combinators 8669 if ( ( match = rcombinators.exec( soFar ) ) ) { 8670 matched = match.shift(); 8671 tokens.push( { 8672 value: matched, 8673 8674 // Cast descendant combinators to space 8675 type: match[ 0 ].replace( rtrim, " " ) 8676 } ); 8677 soFar = soFar.slice( matched.length ); 8678 } 8679 8680 // Filters 8681 for ( type in Expr.filter ) { 8682 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 8683 ( match = preFilters[ type ]( match ) ) ) ) { 8684 matched = match.shift(); 8685 tokens.push( { 8686 value: matched, 8687 type: type, 8688 matches: match 8689 } ); 8690 soFar = soFar.slice( matched.length ); 8691 } 8692 } 8693 8694 if ( !matched ) { 8695 break; 8696 } 8697 } 8698 8699 // Return the length of the invalid excess 8700 // if we're just parsing 8701 // Otherwise, throw an error or return tokens 8702 return parseOnly ? 8703 soFar.length : 8704 soFar ? 8705 Sizzle.error( selector ) : 8706 8707 // Cache the tokens 8708 tokenCache( selector, groups ).slice( 0 ); 8709}; 8710 8711function toSelector( tokens ) { 8712 var i = 0, 8713 len = tokens.length, 8714 selector = ""; 8715 for ( ; i < len; i++ ) { 8716 selector += tokens[ i ].value; 8717 } 8718 return selector; 8719} 8720 8721function addCombinator( matcher, combinator, base ) { 8722 var dir = combinator.dir, 8723 skip = combinator.next, 8724 key = skip || dir, 8725 checkNonElements = base && key === "parentNode", 8726 doneName = done++; 8727 8728 return combinator.first ? 8729 8730 // Check against closest ancestor/preceding element 8731 function( elem, context, xml ) { 8732 while ( ( elem = elem[ dir ] ) ) { 8733 if ( elem.nodeType === 1 || checkNonElements ) { 8734 return matcher( elem, context, xml ); 8735 } 8736 } 8737 return false; 8738 } : 8739 8740 // Check against all ancestor/preceding elements 8741 function( elem, context, xml ) { 8742 var oldCache, uniqueCache, outerCache, 8743 newCache = [ dirruns, doneName ]; 8744 8745 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 8746 if ( xml ) { 8747 while ( ( elem = elem[ dir ] ) ) { 8748 if ( elem.nodeType === 1 || checkNonElements ) { 8749 if ( matcher( elem, context, xml ) ) { 8750 return true; 8751 } 8752 } 8753 } 8754 } else { 8755 while ( ( elem = elem[ dir ] ) ) { 8756 if ( elem.nodeType === 1 || checkNonElements ) { 8757 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 8758 8759 // Support: IE <9 only 8760 // Defend against cloned attroperties (jQuery gh-1709) 8761 uniqueCache = outerCache[ elem.uniqueID ] || 8762 ( outerCache[ elem.uniqueID ] = {} ); 8763 8764 if ( skip && skip === elem.nodeName.toLowerCase() ) { 8765 elem = elem[ dir ] || elem; 8766 } else if ( ( oldCache = uniqueCache[ key ] ) && 8767 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 8768 8769 // Assign to newCache so results back-propagate to previous elements 8770 return ( newCache[ 2 ] = oldCache[ 2 ] ); 8771 } else { 8772 8773 // Reuse newcache so results back-propagate to previous elements 8774 uniqueCache[ key ] = newCache; 8775 8776 // A match means we're done; a fail means we have to keep checking 8777 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 8778 return true; 8779 } 8780 } 8781 } 8782 } 8783 } 8784 return false; 8785 }; 8786} 8787 8788function elementMatcher( matchers ) { 8789 return matchers.length > 1 ? 8790 function( elem, context, xml ) { 8791 var i = matchers.length; 8792 while ( i-- ) { 8793 if ( !matchers[ i ]( elem, context, xml ) ) { 8794 return false; 8795 } 8796 } 8797 return true; 8798 } : 8799 matchers[ 0 ]; 8800} 8801 8802function multipleContexts( selector, contexts, results ) { 8803 var i = 0, 8804 len = contexts.length; 8805 for ( ; i < len; i++ ) { 8806 Sizzle( selector, contexts[ i ], results ); 8807 } 8808 return results; 8809} 8810 8811function condense( unmatched, map, filter, context, xml ) { 8812 var elem, 8813 newUnmatched = [], 8814 i = 0, 8815 len = unmatched.length, 8816 mapped = map != null; 8817 8818 for ( ; i < len; i++ ) { 8819 if ( ( elem = unmatched[ i ] ) ) { 8820 if ( !filter || filter( elem, context, xml ) ) { 8821 newUnmatched.push( elem ); 8822 if ( mapped ) { 8823 map.push( i ); 8824 } 8825 } 8826 } 8827 } 8828 8829 return newUnmatched; 8830} 8831 8832function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 8833 if ( postFilter && !postFilter[ expando ] ) { 8834 postFilter = setMatcher( postFilter ); 8835 } 8836 if ( postFinder && !postFinder[ expando ] ) { 8837 postFinder = setMatcher( postFinder, postSelector ); 8838 } 8839 return markFunction( function( seed, results, context, xml ) { 8840 var temp, i, elem, 8841 preMap = [], 8842 postMap = [], 8843 preexisting = results.length, 8844 8845 // Get initial elements from seed or context 8846 elems = seed || multipleContexts( 8847 selector || "*", 8848 context.nodeType ? [ context ] : context, 8849 [] 8850 ), 8851 8852 // Prefilter to get matcher input, preserving a map for seed-results synchronization 8853 matcherIn = preFilter && ( seed || !selector ) ? 8854 condense( elems, preMap, preFilter, context, xml ) : 8855 elems, 8856 8857 matcherOut = matcher ? 8858 8859 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 8860 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 8861 8862 // ...intermediate processing is necessary 8863 [] : 8864 8865 // ...otherwise use results directly 8866 results : 8867 matcherIn; 8868 8869 // Find primary matches 8870 if ( matcher ) { 8871 matcher( matcherIn, matcherOut, context, xml ); 8872 } 8873 8874 // Apply postFilter 8875 if ( postFilter ) { 8876 temp = condense( matcherOut, postMap ); 8877 postFilter( temp, [], context, xml ); 8878 8879 // Un-match failing elements by moving them back to matcherIn 8880 i = temp.length; 8881 while ( i-- ) { 8882 if ( ( elem = temp[ i ] ) ) { 8883 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 8884 } 8885 } 8886 } 8887 8888 if ( seed ) { 8889 if ( postFinder || preFilter ) { 8890 if ( postFinder ) { 8891 8892 // Get the final matcherOut by condensing this intermediate into postFinder contexts 8893 temp = []; 8894 i = matcherOut.length; 8895 while ( i-- ) { 8896 if ( ( elem = matcherOut[ i ] ) ) { 8897 8898 // Restore matcherIn since elem is not yet a final match 8899 temp.push( ( matcherIn[ i ] = elem ) ); 8900 } 8901 } 8902 postFinder( null, ( matcherOut = [] ), temp, xml ); 8903 } 8904 8905 // Move matched elements from seed to results to keep them synchronized 8906 i = matcherOut.length; 8907 while ( i-- ) { 8908 if ( ( elem = matcherOut[ i ] ) && 8909 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 8910 8911 seed[ temp ] = !( results[ temp ] = elem ); 8912 } 8913 } 8914 } 8915 8916 // Add elements to results, through postFinder if defined 8917 } else { 8918 matcherOut = condense( 8919 matcherOut === results ? 8920 matcherOut.splice( preexisting, matcherOut.length ) : 8921 matcherOut 8922 ); 8923 if ( postFinder ) { 8924 postFinder( null, results, matcherOut, xml ); 8925 } else { 8926 push.apply( results, matcherOut ); 8927 } 8928 } 8929 } ); 8930} 8931 8932function matcherFromTokens( tokens ) { 8933 var checkContext, matcher, j, 8934 len = tokens.length, 8935 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 8936 implicitRelative = leadingRelative || Expr.relative[ " " ], 8937 i = leadingRelative ? 1 : 0, 8938 8939 // The foundational matcher ensures that elements are reachable from top-level context(s) 8940 matchContext = addCombinator( function( elem ) { 8941 return elem === checkContext; 8942 }, implicitRelative, true ), 8943 matchAnyContext = addCombinator( function( elem ) { 8944 return indexOf( checkContext, elem ) > -1; 8945 }, implicitRelative, true ), 8946 matchers = [ function( elem, context, xml ) { 8947 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 8948 ( checkContext = context ).nodeType ? 8949 matchContext( elem, context, xml ) : 8950 matchAnyContext( elem, context, xml ) ); 8951 8952 // Avoid hanging onto element (issue #299) 8953 checkContext = null; 8954 return ret; 8955 } ]; 8956 8957 for ( ; i < len; i++ ) { 8958 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 8959 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 8960 } else { 8961 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 8962 8963 // Return special upon seeing a positional matcher 8964 if ( matcher[ expando ] ) { 8965 8966 // Find the next relative operator (if any) for proper handling 8967 j = ++i; 8968 for ( ; j < len; j++ ) { 8969 if ( Expr.relative[ tokens[ j ].type ] ) { 8970 break; 8971 } 8972 } 8973 return setMatcher( 8974 i > 1 && elementMatcher( matchers ), 8975 i > 1 && toSelector( 8976 8977 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 8978 tokens 8979 .slice( 0, i - 1 ) 8980 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 8981 ).replace( rtrim, "$1" ), 8982 matcher, 8983 i < j && matcherFromTokens( tokens.slice( i, j ) ), 8984 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 8985 j < len && toSelector( tokens ) 8986 ); 8987 } 8988 matchers.push( matcher ); 8989 } 8990 } 8991 8992 return elementMatcher( matchers ); 8993} 8994 8995function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 8996 var bySet = setMatchers.length > 0, 8997 byElement = elementMatchers.length > 0, 8998 superMatcher = function( seed, context, xml, results, outermost ) { 8999 var elem, j, matcher, 9000 matchedCount = 0, 9001 i = "0", 9002 unmatched = seed && [], 9003 setMatched = [], 9004 contextBackup = outermostContext, 9005 9006 // We must always have either seed elements or outermost context 9007 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 9008 9009 // Use integer dirruns iff this is the outermost matcher 9010 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 9011 len = elems.length; 9012 9013 if ( outermost ) { 9014 9015 // Support: IE 11+, Edge 17 - 18+ 9016 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 9017 // two documents; shallow comparisons work. 9018 // eslint-disable-next-line eqeqeq 9019 outermostContext = context == document || context || outermost; 9020 } 9021 9022 // Add elements passing elementMatchers directly to results 9023 // Support: IE<9, Safari 9024 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 9025 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 9026 if ( byElement && elem ) { 9027 j = 0; 9028 9029 // Support: IE 11+, Edge 17 - 18+ 9030 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 9031 // two documents; shallow comparisons work. 9032 // eslint-disable-next-line eqeqeq 9033 if ( !context && elem.ownerDocument != document ) { 9034 setDocument( elem ); 9035 xml = !documentIsHTML; 9036 } 9037 while ( ( matcher = elementMatchers[ j++ ] ) ) { 9038 if ( matcher( elem, context || document, xml ) ) { 9039 results.push( elem ); 9040 break; 9041 } 9042 } 9043 if ( outermost ) { 9044 dirruns = dirrunsUnique; 9045 } 9046 } 9047 9048 // Track unmatched elements for set filters 9049 if ( bySet ) { 9050 9051 // They will have gone through all possible matchers 9052 if ( ( elem = !matcher && elem ) ) { 9053 matchedCount--; 9054 } 9055 9056 // Lengthen the array for every element, matched or not 9057 if ( seed ) { 9058 unmatched.push( elem ); 9059 } 9060 } 9061 } 9062 9063 // `i` is now the count of elements visited above, and adding it to `matchedCount` 9064 // makes the latter nonnegative. 9065 matchedCount += i; 9066 9067 // Apply set filters to unmatched elements 9068 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 9069 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 9070 // no element matchers and no seed. 9071 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 9072 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 9073 // numerically zero. 9074 if ( bySet && i !== matchedCount ) { 9075 j = 0; 9076 while ( ( matcher = setMatchers[ j++ ] ) ) { 9077 matcher( unmatched, setMatched, context, xml ); 9078 } 9079 9080 if ( seed ) { 9081 9082 // Reintegrate element matches to eliminate the need for sorting 9083 if ( matchedCount > 0 ) { 9084 while ( i-- ) { 9085 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 9086 setMatched[ i ] = pop.call( results ); 9087 } 9088 } 9089 } 9090 9091 // Discard index placeholder values to get only actual matches 9092 setMatched = condense( setMatched ); 9093 } 9094 9095 // Add matches to results 9096 push.apply( results, setMatched ); 9097 9098 // Seedless set matches succeeding multiple successful matchers stipulate sorting 9099 if ( outermost && !seed && setMatched.length > 0 && 9100 ( matchedCount + setMatchers.length ) > 1 ) { 9101 9102 Sizzle.uniqueSort( results ); 9103 } 9104 } 9105 9106 // Override manipulation of globals by nested matchers 9107 if ( outermost ) { 9108 dirruns = dirrunsUnique; 9109 outermostContext = contextBackup; 9110 } 9111 9112 return unmatched; 9113 }; 9114 9115 return bySet ? 9116 markFunction( superMatcher ) : 9117 superMatcher; 9118} 9119 9120compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 9121 var i, 9122 setMatchers = [], 9123 elementMatchers = [], 9124 cached = compilerCache[ selector + " " ]; 9125 9126 if ( !cached ) { 9127 9128 // Generate a function of recursive functions that can be used to check each element 9129 if ( !match ) { 9130 match = tokenize( selector ); 9131 } 9132 i = match.length; 9133 while ( i-- ) { 9134 cached = matcherFromTokens( match[ i ] ); 9135 if ( cached[ expando ] ) { 9136 setMatchers.push( cached ); 9137 } else { 9138 elementMatchers.push( cached ); 9139 } 9140 } 9141 9142 // Cache the compiled function 9143 cached = compilerCache( 9144 selector, 9145 matcherFromGroupMatchers( elementMatchers, setMatchers ) 9146 ); 9147 9148 // Save selector and tokenization 9149 cached.selector = selector; 9150 } 9151 return cached; 9152}; 9153 9154/** 9155 * A low-level selection function that works with Sizzle's compiled 9156 * selector functions 9157 * @param {String|Function} selector A selector or a pre-compiled 9158 * selector function built with Sizzle.compile 9159 * @param {Element} context 9160 * @param {Array} [results] 9161 * @param {Array} [seed] A set of elements to match against 9162 */ 9163select = Sizzle.select = function( selector, context, results, seed ) { 9164 var i, tokens, token, type, find, 9165 compiled = typeof selector === "function" && selector, 9166 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 9167 9168 results = results || []; 9169 9170 // Try to minimize operations if there is only one selector in the list and no seed 9171 // (the latter of which guarantees us context) 9172 if ( match.length === 1 ) { 9173 9174 // Reduce context if the leading compound selector is an ID 9175 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 9176 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 9177 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 9178 9179 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 9180 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 9181 if ( !context ) { 9182 return results; 9183 9184 // Precompiled matchers will still verify ancestry, so step up a level 9185 } else if ( compiled ) { 9186 context = context.parentNode; 9187 } 9188 9189 selector = selector.slice( tokens.shift().value.length ); 9190 } 9191 9192 // Fetch a seed set for right-to-left matching 9193 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 9194 while ( i-- ) { 9195 token = tokens[ i ]; 9196 9197 // Abort if we hit a combinator 9198 if ( Expr.relative[ ( type = token.type ) ] ) { 9199 break; 9200 } 9201 if ( ( find = Expr.find[ type ] ) ) { 9202 9203 // Search, expanding context for leading sibling combinators 9204 if ( ( seed = find( 9205 token.matches[ 0 ].replace( runescape, funescape ), 9206 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 9207 context 9208 ) ) ) { 9209 9210 // If seed is empty or no tokens remain, we can return early 9211 tokens.splice( i, 1 ); 9212 selector = seed.length && toSelector( tokens ); 9213 if ( !selector ) { 9214 push.apply( results, seed ); 9215 return results; 9216 } 9217 9218 break; 9219 } 9220 } 9221 } 9222 } 9223 9224 // Compile and execute a filtering function if one is not provided 9225 // Provide `match` to avoid retokenization if we modified the selector above 9226 ( compiled || compile( selector, match ) )( 9227 seed, 9228 context, 9229 !documentIsHTML, 9230 results, 9231 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 9232 ); 9233 return results; 9234}; 9235 9236// One-time assignments 9237 9238// Sort stability 9239support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 9240 9241// Support: Chrome 14-35+ 9242// Always assume duplicates if they aren't passed to the comparison function 9243support.detectDuplicates = !!hasDuplicate; 9244 9245// Initialize against the default document 9246setDocument(); 9247 9248// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 9249// Detached nodes confoundingly follow *each other* 9250support.sortDetached = assert( function( el ) { 9251 9252 // Should return 1, but returns 4 (following) 9253 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 9254} ); 9255 9256// Support: IE<8 9257// Prevent attribute/property "interpolation" 9258// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 9259if ( !assert( function( el ) { 9260 el.innerHTML = "<a href='#'></a>"; 9261 return el.firstChild.getAttribute( "href" ) === "#"; 9262} ) ) { 9263 addHandle( "type|href|height|width", function( elem, name, isXML ) { 9264 if ( !isXML ) { 9265 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 9266 } 9267 } ); 9268} 9269 9270// Support: IE<9 9271// Use defaultValue in place of getAttribute("value") 9272if ( !support.attributes || !assert( function( el ) { 9273 el.innerHTML = "<input/>"; 9274 el.firstChild.setAttribute( "value", "" ); 9275 return el.firstChild.getAttribute( "value" ) === ""; 9276} ) ) { 9277 addHandle( "value", function( elem, _name, isXML ) { 9278 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 9279 return elem.defaultValue; 9280 } 9281 } ); 9282} 9283 9284// Support: IE<9 9285// Use getAttributeNode to fetch booleans when getAttribute lies 9286if ( !assert( function( el ) { 9287 return el.getAttribute( "disabled" ) == null; 9288} ) ) { 9289 addHandle( booleans, function( elem, name, isXML ) { 9290 var val; 9291 if ( !isXML ) { 9292 return elem[ name ] === true ? name.toLowerCase() : 9293 ( val = elem.getAttributeNode( name ) ) && val.specified ? 9294 val.value : 9295 null; 9296 } 9297 } ); 9298} 9299 9300return Sizzle; 9301 9302} )( window ); 9303 9304 9305 9306jQuery.find = Sizzle; 9307jQuery.expr = Sizzle.selectors; 9308 9309// Deprecated 9310jQuery.expr[ ":" ] = jQuery.expr.pseudos; 9311jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 9312jQuery.text = Sizzle.getText; 9313jQuery.isXMLDoc = Sizzle.isXML; 9314jQuery.contains = Sizzle.contains; 9315jQuery.escapeSelector = Sizzle.escape; 9316 9317 9318 9319 9320var dir = function( elem, dir, until ) { 9321 var matched = [], 9322 truncate = until !== undefined; 9323 9324 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 9325 if ( elem.nodeType === 1 ) { 9326 if ( truncate && jQuery( elem ).is( until ) ) { 9327 break; 9328 } 9329 matched.push( elem ); 9330 } 9331 } 9332 return matched; 9333}; 9334 9335 9336var siblings = function( n, elem ) { 9337 var matched = []; 9338 9339 for ( ; n; n = n.nextSibling ) { 9340 if ( n.nodeType === 1 && n !== elem ) { 9341 matched.push( n ); 9342 } 9343 } 9344 9345 return matched; 9346}; 9347 9348 9349var rneedsContext = jQuery.expr.match.needsContext; 9350 9351 9352 9353function nodeName( elem, name ) { 9354 9355 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 9356 9357}; 9358var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 9359 9360 9361 9362// Implement the identical functionality for filter and not 9363function winnow( elements, qualifier, not ) { 9364 if ( isFunction( qualifier ) ) { 9365 return jQuery.grep( elements, function( elem, i ) { 9366 return !!qualifier.call( elem, i, elem ) !== not; 9367 } ); 9368 } 9369 9370 // Single element 9371 if ( qualifier.nodeType ) { 9372 return jQuery.grep( elements, function( elem ) { 9373 return ( elem === qualifier ) !== not; 9374 } ); 9375 } 9376 9377 // Arraylike of elements (jQuery, arguments, Array) 9378 if ( typeof qualifier !== "string" ) { 9379 return jQuery.grep( elements, function( elem ) { 9380 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 9381 } ); 9382 } 9383 9384 // Filtered directly for both simple and complex selectors 9385 return jQuery.filter( qualifier, elements, not ); 9386} 9387 9388jQuery.filter = function( expr, elems, not ) { 9389 var elem = elems[ 0 ]; 9390 9391 if ( not ) { 9392 expr = ":not(" + expr + ")"; 9393 } 9394 9395 if ( elems.length === 1 && elem.nodeType === 1 ) { 9396 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 9397 } 9398 9399 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 9400 return elem.nodeType === 1; 9401 } ) ); 9402}; 9403 9404jQuery.fn.extend( { 9405 find: function( selector ) { 9406 var i, ret, 9407 len = this.length, 9408 self = this; 9409 9410 if ( typeof selector !== "string" ) { 9411 return this.pushStack( jQuery( selector ).filter( function() { 9412 for ( i = 0; i < len; i++ ) { 9413 if ( jQuery.contains( self[ i ], this ) ) { 9414 return true; 9415 } 9416 } 9417 } ) ); 9418 } 9419 9420 ret = this.pushStack( [] ); 9421 9422 for ( i = 0; i < len; i++ ) { 9423 jQuery.find( selector, self[ i ], ret ); 9424 } 9425 9426 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 9427 }, 9428 filter: function( selector ) { 9429 return this.pushStack( winnow( this, selector || [], false ) ); 9430 }, 9431 not: function( selector ) { 9432 return this.pushStack( winnow( this, selector || [], true ) ); 9433 }, 9434 is: function( selector ) { 9435 return !!winnow( 9436 this, 9437 9438 // If this is a positional/relative selector, check membership in the returned set 9439 // so $("p:first").is("p:last") won't return true for a doc with two "p". 9440 typeof selector === "string" && rneedsContext.test( selector ) ? 9441 jQuery( selector ) : 9442 selector || [], 9443 false 9444 ).length; 9445 } 9446} ); 9447 9448 9449// Initialize a jQuery object 9450 9451 9452// A central reference to the root jQuery(document) 9453var rootjQuery, 9454 9455 // A simple way to check for HTML strings 9456 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 9457 // Strict HTML recognition (#11290: must start with <) 9458 // Shortcut simple #id case for speed 9459 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 9460 9461 init = jQuery.fn.init = function( selector, context, root ) { 9462 var match, elem; 9463 9464 // HANDLE: $(""), $(null), $(undefined), $(false) 9465 if ( !selector ) { 9466 return this; 9467 } 9468 9469 // Method init() accepts an alternate rootjQuery 9470 // so migrate can support jQuery.sub (gh-2101) 9471 root = root || rootjQuery; 9472 9473 // Handle HTML strings 9474 if ( typeof selector === "string" ) { 9475 if ( selector[ 0 ] === "<" && 9476 selector[ selector.length - 1 ] === ">" && 9477 selector.length >= 3 ) { 9478 9479 // Assume that strings that start and end with <> are HTML and skip the regex check 9480 match = [ null, selector, null ]; 9481 9482 } else { 9483 match = rquickExpr.exec( selector ); 9484 } 9485 9486 // Match html or make sure no context is specified for #id 9487 if ( match && ( match[ 1 ] || !context ) ) { 9488 9489 // HANDLE: $(html) -> $(array) 9490 if ( match[ 1 ] ) { 9491 context = context instanceof jQuery ? context[ 0 ] : context; 9492 9493 // Option to run scripts is true for back-compat 9494 // Intentionally let the error be thrown if parseHTML is not present 9495 jQuery.merge( this, jQuery.parseHTML( 9496 match[ 1 ], 9497 context && context.nodeType ? context.ownerDocument || context : document, 9498 true 9499 ) ); 9500 9501 // HANDLE: $(html, props) 9502 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 9503 for ( match in context ) { 9504 9505 // Properties of context are called as methods if possible 9506 if ( isFunction( this[ match ] ) ) { 9507 this[ match ]( context[ match ] ); 9508 9509 // ...and otherwise set as attributes 9510 } else { 9511 this.attr( match, context[ match ] ); 9512 } 9513 } 9514 } 9515 9516 return this; 9517 9518 // HANDLE: $(#id) 9519 } else { 9520 elem = document.getElementById( match[ 2 ] ); 9521 9522 if ( elem ) { 9523 9524 // Inject the element directly into the jQuery object 9525 this[ 0 ] = elem; 9526 this.length = 1; 9527 } 9528 return this; 9529 } 9530 9531 // HANDLE: $(expr, $(...)) 9532 } else if ( !context || context.jquery ) { 9533 return ( context || root ).find( selector ); 9534 9535 // HANDLE: $(expr, context) 9536 // (which is just equivalent to: $(context).find(expr) 9537 } else { 9538 return this.constructor( context ).find( selector ); 9539 } 9540 9541 // HANDLE: $(DOMElement) 9542 } else if ( selector.nodeType ) { 9543 this[ 0 ] = selector; 9544 this.length = 1; 9545 return this; 9546 9547 // HANDLE: $(function) 9548 // Shortcut for document ready 9549 } else if ( isFunction( selector ) ) { 9550 return root.ready !== undefined ? 9551 root.ready( selector ) : 9552 9553 // Execute immediately if ready is not present 9554 selector( jQuery ); 9555 } 9556 9557 return jQuery.makeArray( selector, this ); 9558 }; 9559 9560// Give the init function the jQuery prototype for later instantiation 9561init.prototype = jQuery.fn; 9562 9563// Initialize central reference 9564rootjQuery = jQuery( document ); 9565 9566 9567var rparentsprev = /^(?:parents|prev(?:Until|All))/, 9568 9569 // Methods guaranteed to produce a unique set when starting from a unique set 9570 guaranteedUnique = { 9571 children: true, 9572 contents: true, 9573 next: true, 9574 prev: true 9575 }; 9576 9577jQuery.fn.extend( { 9578 has: function( target ) { 9579 var targets = jQuery( target, this ), 9580 l = targets.length; 9581 9582 return this.filter( function() { 9583 var i = 0; 9584 for ( ; i < l; i++ ) { 9585 if ( jQuery.contains( this, targets[ i ] ) ) { 9586 return true; 9587 } 9588 } 9589 } ); 9590 }, 9591 9592 closest: function( selectors, context ) { 9593 var cur, 9594 i = 0, 9595 l = this.length, 9596 matched = [], 9597 targets = typeof selectors !== "string" && jQuery( selectors ); 9598 9599 // Positional selectors never match, since there's no _selection_ context 9600 if ( !rneedsContext.test( selectors ) ) { 9601 for ( ; i < l; i++ ) { 9602 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 9603 9604 // Always skip document fragments 9605 if ( cur.nodeType < 11 && ( targets ? 9606 targets.index( cur ) > -1 : 9607 9608 // Don't pass non-elements to Sizzle 9609 cur.nodeType === 1 && 9610 jQuery.find.matchesSelector( cur, selectors ) ) ) { 9611 9612 matched.push( cur ); 9613 break; 9614 } 9615 } 9616 } 9617 } 9618 9619 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 9620 }, 9621 9622 // Determine the position of an element within the set 9623 index: function( elem ) { 9624 9625 // No argument, return index in parent 9626 if ( !elem ) { 9627 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 9628 } 9629 9630 // Index in selector 9631 if ( typeof elem === "string" ) { 9632 return indexOf.call( jQuery( elem ), this[ 0 ] ); 9633 } 9634 9635 // Locate the position of the desired element 9636 return indexOf.call( this, 9637 9638 // If it receives a jQuery object, the first element is used 9639 elem.jquery ? elem[ 0 ] : elem 9640 ); 9641 }, 9642 9643 add: function( selector, context ) { 9644 return this.pushStack( 9645 jQuery.uniqueSort( 9646 jQuery.merge( this.get(), jQuery( selector, context ) ) 9647 ) 9648 ); 9649 }, 9650 9651 addBack: function( selector ) { 9652 return this.add( selector == null ? 9653 this.prevObject : this.prevObject.filter( selector ) 9654 ); 9655 } 9656} ); 9657 9658function sibling( cur, dir ) { 9659 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 9660 return cur; 9661} 9662 9663jQuery.each( { 9664 parent: function( elem ) { 9665 var parent = elem.parentNode; 9666 return parent && parent.nodeType !== 11 ? parent : null; 9667 }, 9668 parents: function( elem ) { 9669 return dir( elem, "parentNode" ); 9670 }, 9671 parentsUntil: function( elem, _i, until ) { 9672 return dir( elem, "parentNode", until ); 9673 }, 9674 next: function( elem ) { 9675 return sibling( elem, "nextSibling" ); 9676 }, 9677 prev: function( elem ) { 9678 return sibling( elem, "previousSibling" ); 9679 }, 9680 nextAll: function( elem ) { 9681 return dir( elem, "nextSibling" ); 9682 }, 9683 prevAll: function( elem ) { 9684 return dir( elem, "previousSibling" ); 9685 }, 9686 nextUntil: function( elem, _i, until ) { 9687 return dir( elem, "nextSibling", until ); 9688 }, 9689 prevUntil: function( elem, _i, until ) { 9690 return dir( elem, "previousSibling", until ); 9691 }, 9692 siblings: function( elem ) { 9693 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 9694 }, 9695 children: function( elem ) { 9696 return siblings( elem.firstChild ); 9697 }, 9698 contents: function( elem ) { 9699 if ( elem.contentDocument != null && 9700 9701 // Support: IE 11+ 9702 // <object> elements with no `data` attribute has an object 9703 // `contentDocument` with a `null` prototype. 9704 getProto( elem.contentDocument ) ) { 9705 9706 return elem.contentDocument; 9707 } 9708 9709 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 9710 // Treat the template element as a regular one in browsers that 9711 // don't support it. 9712 if ( nodeName( elem, "template" ) ) { 9713 elem = elem.content || elem; 9714 } 9715 9716 return jQuery.merge( [], elem.childNodes ); 9717 } 9718}, function( name, fn ) { 9719 jQuery.fn[ name ] = function( until, selector ) { 9720 var matched = jQuery.map( this, fn, until ); 9721 9722 if ( name.slice( -5 ) !== "Until" ) { 9723 selector = until; 9724 } 9725 9726 if ( selector && typeof selector === "string" ) { 9727 matched = jQuery.filter( selector, matched ); 9728 } 9729 9730 if ( this.length > 1 ) { 9731 9732 // Remove duplicates 9733 if ( !guaranteedUnique[ name ] ) { 9734 jQuery.uniqueSort( matched ); 9735 } 9736 9737 // Reverse order for parents* and prev-derivatives 9738 if ( rparentsprev.test( name ) ) { 9739 matched.reverse(); 9740 } 9741 } 9742 9743 return this.pushStack( matched ); 9744 }; 9745} ); 9746var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 9747 9748 9749 9750// Convert String-formatted options into Object-formatted ones 9751function createOptions( options ) { 9752 var object = {}; 9753 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 9754 object[ flag ] = true; 9755 } ); 9756 return object; 9757} 9758 9759/* 9760 * Create a callback list using the following parameters: 9761 * 9762 * options: an optional list of space-separated options that will change how 9763 * the callback list behaves or a more traditional option object 9764 * 9765 * By default a callback list will act like an event callback list and can be 9766 * "fired" multiple times. 9767 * 9768 * Possible options: 9769 * 9770 * once: will ensure the callback list can only be fired once (like a Deferred) 9771 * 9772 * memory: will keep track of previous values and will call any callback added 9773 * after the list has been fired right away with the latest "memorized" 9774 * values (like a Deferred) 9775 * 9776 * unique: will ensure a callback can only be added once (no duplicate in the list) 9777 * 9778 * stopOnFalse: interrupt callings when a callback returns false 9779 * 9780 */ 9781jQuery.Callbacks = function( options ) { 9782 9783 // Convert options from String-formatted to Object-formatted if needed 9784 // (we check in cache first) 9785 options = typeof options === "string" ? 9786 createOptions( options ) : 9787 jQuery.extend( {}, options ); 9788 9789 var // Flag to know if list is currently firing 9790 firing, 9791 9792 // Last fire value for non-forgettable lists 9793 memory, 9794 9795 // Flag to know if list was already fired 9796 fired, 9797 9798 // Flag to prevent firing 9799 locked, 9800 9801 // Actual callback list 9802 list = [], 9803 9804 // Queue of execution data for repeatable lists 9805 queue = [], 9806 9807 // Index of currently firing callback (modified by add/remove as needed) 9808 firingIndex = -1, 9809 9810 // Fire callbacks 9811 fire = function() { 9812 9813 // Enforce single-firing 9814 locked = locked || options.once; 9815 9816 // Execute callbacks for all pending executions, 9817 // respecting firingIndex overrides and runtime changes 9818 fired = firing = true; 9819 for ( ; queue.length; firingIndex = -1 ) { 9820 memory = queue.shift(); 9821 while ( ++firingIndex < list.length ) { 9822 9823 // Run callback and check for early termination 9824 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 9825 options.stopOnFalse ) { 9826 9827 // Jump to end and forget the data so .add doesn't re-fire 9828 firingIndex = list.length; 9829 memory = false; 9830 } 9831 } 9832 } 9833 9834 // Forget the data if we're done with it 9835 if ( !options.memory ) { 9836 memory = false; 9837 } 9838 9839 firing = false; 9840 9841 // Clean up if we're done firing for good 9842 if ( locked ) { 9843 9844 // Keep an empty list if we have data for future add calls 9845 if ( memory ) { 9846 list = []; 9847 9848 // Otherwise, this object is spent 9849 } else { 9850 list = ""; 9851 } 9852 } 9853 }, 9854 9855 // Actual Callbacks object 9856 self = { 9857 9858 // Add a callback or a collection of callbacks to the list 9859 add: function() { 9860 if ( list ) { 9861 9862 // If we have memory from a past run, we should fire after adding 9863 if ( memory && !firing ) { 9864 firingIndex = list.length - 1; 9865 queue.push( memory ); 9866 } 9867 9868 ( function add( args ) { 9869 jQuery.each( args, function( _, arg ) { 9870 if ( isFunction( arg ) ) { 9871 if ( !options.unique || !self.has( arg ) ) { 9872 list.push( arg ); 9873 } 9874 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 9875 9876 // Inspect recursively 9877 add( arg ); 9878 } 9879 } ); 9880 } )( arguments ); 9881 9882 if ( memory && !firing ) { 9883 fire(); 9884 } 9885 } 9886 return this; 9887 }, 9888 9889 // Remove a callback from the list 9890 remove: function() { 9891 jQuery.each( arguments, function( _, arg ) { 9892 var index; 9893 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 9894 list.splice( index, 1 ); 9895 9896 // Handle firing indexes 9897 if ( index <= firingIndex ) { 9898 firingIndex--; 9899 } 9900 } 9901 } ); 9902 return this; 9903 }, 9904 9905 // Check if a given callback is in the list. 9906 // If no argument is given, return whether or not list has callbacks attached. 9907 has: function( fn ) { 9908 return fn ? 9909 jQuery.inArray( fn, list ) > -1 : 9910 list.length > 0; 9911 }, 9912 9913 // Remove all callbacks from the list 9914 empty: function() { 9915 if ( list ) { 9916 list = []; 9917 } 9918 return this; 9919 }, 9920 9921 // Disable .fire and .add 9922 // Abort any current/pending executions 9923 // Clear all callbacks and values 9924 disable: function() { 9925 locked = queue = []; 9926 list = memory = ""; 9927 return this; 9928 }, 9929 disabled: function() { 9930 return !list; 9931 }, 9932 9933 // Disable .fire 9934 // Also disable .add unless we have memory (since it would have no effect) 9935 // Abort any pending executions 9936 lock: function() { 9937 locked = queue = []; 9938 if ( !memory && !firing ) { 9939 list = memory = ""; 9940 } 9941 return this; 9942 }, 9943 locked: function() { 9944 return !!locked; 9945 }, 9946 9947 // Call all callbacks with the given context and arguments 9948 fireWith: function( context, args ) { 9949 if ( !locked ) { 9950 args = args || []; 9951 args = [ context, args.slice ? args.slice() : args ]; 9952 queue.push( args ); 9953 if ( !firing ) { 9954 fire(); 9955 } 9956 } 9957 return this; 9958 }, 9959 9960 // Call all the callbacks with the given arguments 9961 fire: function() { 9962 self.fireWith( this, arguments ); 9963 return this; 9964 }, 9965 9966 // To know if the callbacks have already been called at least once 9967 fired: function() { 9968 return !!fired; 9969 } 9970 }; 9971 9972 return self; 9973}; 9974 9975 9976function Identity( v ) { 9977 return v; 9978} 9979function Thrower( ex ) { 9980 throw ex; 9981} 9982 9983function adoptValue( value, resolve, reject, noValue ) { 9984 var method; 9985 9986 try { 9987 9988 // Check for promise aspect first to privilege synchronous behavior 9989 if ( value && isFunction( ( method = value.promise ) ) ) { 9990 method.call( value ).done( resolve ).fail( reject ); 9991 9992 // Other thenables 9993 } else if ( value && isFunction( ( method = value.then ) ) ) { 9994 method.call( value, resolve, reject ); 9995 9996 // Other non-thenables 9997 } else { 9998 9999 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 10000 // * false: [ value ].slice( 0 ) => resolve( value ) 10001 // * true: [ value ].slice( 1 ) => resolve() 10002 resolve.apply( undefined, [ value ].slice( noValue ) ); 10003 } 10004 10005 // For Promises/A+, convert exceptions into rejections 10006 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 10007 // Deferred#then to conditionally suppress rejection. 10008 } catch ( value ) { 10009 10010 // Support: Android 4.0 only 10011 // Strict mode functions invoked without .call/.apply get global-object context 10012 reject.apply( undefined, [ value ] ); 10013 } 10014} 10015 10016jQuery.extend( { 10017 10018 Deferred: function( func ) { 10019 var tuples = [ 10020 10021 // action, add listener, callbacks, 10022 // ... .then handlers, argument index, [final state] 10023 [ "notify", "progress", jQuery.Callbacks( "memory" ), 10024 jQuery.Callbacks( "memory" ), 2 ], 10025 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 10026 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 10027 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 10028 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 10029 ], 10030 state = "pending", 10031 promise = { 10032 state: function() { 10033 return state; 10034 }, 10035 always: function() { 10036 deferred.done( arguments ).fail( arguments ); 10037 return this; 10038 }, 10039 "catch": function( fn ) { 10040 return promise.then( null, fn ); 10041 }, 10042 10043 // Keep pipe for back-compat 10044 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 10045 var fns = arguments; 10046 10047 return jQuery.Deferred( function( newDefer ) { 10048 jQuery.each( tuples, function( _i, tuple ) { 10049 10050 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 10051 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 10052 10053 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 10054 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 10055 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 10056 deferred[ tuple[ 1 ] ]( function() { 10057 var returned = fn && fn.apply( this, arguments ); 10058 if ( returned && isFunction( returned.promise ) ) { 10059 returned.promise() 10060 .progress( newDefer.notify ) 10061 .done( newDefer.resolve ) 10062 .fail( newDefer.reject ); 10063 } else { 10064 newDefer[ tuple[ 0 ] + "With" ]( 10065 this, 10066 fn ? [ returned ] : arguments 10067 ); 10068 } 10069 } ); 10070 } ); 10071 fns = null; 10072 } ).promise(); 10073 }, 10074 then: function( onFulfilled, onRejected, onProgress ) { 10075 var maxDepth = 0; 10076 function resolve( depth, deferred, handler, special ) { 10077 return function() { 10078 var that = this, 10079 args = arguments, 10080 mightThrow = function() { 10081 var returned, then; 10082 10083 // Support: Promises/A+ section 2.3.3.3.3 10084 // https://promisesaplus.com/#point-59 10085 // Ignore double-resolution attempts 10086 if ( depth < maxDepth ) { 10087 return; 10088 } 10089 10090 returned = handler.apply( that, args ); 10091 10092 // Support: Promises/A+ section 2.3.1 10093 // https://promisesaplus.com/#point-48 10094 if ( returned === deferred.promise() ) { 10095 throw new TypeError( "Thenable self-resolution" ); 10096 } 10097 10098 // Support: Promises/A+ sections 2.3.3.1, 3.5 10099 // https://promisesaplus.com/#point-54 10100 // https://promisesaplus.com/#point-75 10101 // Retrieve `then` only once 10102 then = returned && 10103 10104 // Support: Promises/A+ section 2.3.4 10105 // https://promisesaplus.com/#point-64 10106 // Only check objects and functions for thenability 10107 ( typeof returned === "object" || 10108 typeof returned === "function" ) && 10109 returned.then; 10110 10111 // Handle a returned thenable 10112 if ( isFunction( then ) ) { 10113 10114 // Special processors (notify) just wait for resolution 10115 if ( special ) { 10116 then.call( 10117 returned, 10118 resolve( maxDepth, deferred, Identity, special ), 10119 resolve( maxDepth, deferred, Thrower, special ) 10120 ); 10121 10122 // Normal processors (resolve) also hook into progress 10123 } else { 10124 10125 // ...and disregard older resolution values 10126 maxDepth++; 10127 10128 then.call( 10129 returned, 10130 resolve( maxDepth, deferred, Identity, special ), 10131 resolve( maxDepth, deferred, Thrower, special ), 10132 resolve( maxDepth, deferred, Identity, 10133 deferred.notifyWith ) 10134 ); 10135 } 10136 10137 // Handle all other returned values 10138 } else { 10139 10140 // Only substitute handlers pass on context 10141 // and multiple values (non-spec behavior) 10142 if ( handler !== Identity ) { 10143 that = undefined; 10144 args = [ returned ]; 10145 } 10146 10147 // Process the value(s) 10148 // Default process is resolve 10149 ( special || deferred.resolveWith )( that, args ); 10150 } 10151 }, 10152 10153 // Only normal processors (resolve) catch and reject exceptions 10154 process = special ? 10155 mightThrow : 10156 function() { 10157 try { 10158 mightThrow(); 10159 } catch ( e ) { 10160 10161 if ( jQuery.Deferred.exceptionHook ) { 10162 jQuery.Deferred.exceptionHook( e, 10163 process.stackTrace ); 10164 } 10165 10166 // Support: Promises/A+ section 2.3.3.3.4.1 10167 // https://promisesaplus.com/#point-61 10168 // Ignore post-resolution exceptions 10169 if ( depth + 1 >= maxDepth ) { 10170 10171 // Only substitute handlers pass on context 10172 // and multiple values (non-spec behavior) 10173 if ( handler !== Thrower ) { 10174 that = undefined; 10175 args = [ e ]; 10176 } 10177 10178 deferred.rejectWith( that, args ); 10179 } 10180 } 10181 }; 10182 10183 // Support: Promises/A+ section 2.3.3.3.1 10184 // https://promisesaplus.com/#point-57 10185 // Re-resolve promises immediately to dodge false rejection from 10186 // subsequent errors 10187 if ( depth ) { 10188 process(); 10189 } else { 10190 10191 // Call an optional hook to record the stack, in case of exception 10192 // since it's otherwise lost when execution goes async 10193 if ( jQuery.Deferred.getStackHook ) { 10194 process.stackTrace = jQuery.Deferred.getStackHook(); 10195 } 10196 window.setTimeout( process ); 10197 } 10198 }; 10199 } 10200 10201 return jQuery.Deferred( function( newDefer ) { 10202 10203 // progress_handlers.add( ... ) 10204 tuples[ 0 ][ 3 ].add( 10205 resolve( 10206 0, 10207 newDefer, 10208 isFunction( onProgress ) ? 10209 onProgress : 10210 Identity, 10211 newDefer.notifyWith 10212 ) 10213 ); 10214 10215 // fulfilled_handlers.add( ... ) 10216 tuples[ 1 ][ 3 ].add( 10217 resolve( 10218 0, 10219 newDefer, 10220 isFunction( onFulfilled ) ? 10221 onFulfilled : 10222 Identity 10223 ) 10224 ); 10225 10226 // rejected_handlers.add( ... ) 10227 tuples[ 2 ][ 3 ].add( 10228 resolve( 10229 0, 10230 newDefer, 10231 isFunction( onRejected ) ? 10232 onRejected : 10233 Thrower 10234 ) 10235 ); 10236 } ).promise(); 10237 }, 10238 10239 // Get a promise for this deferred 10240 // If obj is provided, the promise aspect is added to the object 10241 promise: function( obj ) { 10242 return obj != null ? jQuery.extend( obj, promise ) : promise; 10243 } 10244 }, 10245 deferred = {}; 10246 10247 // Add list-specific methods 10248 jQuery.each( tuples, function( i, tuple ) { 10249 var list = tuple[ 2 ], 10250 stateString = tuple[ 5 ]; 10251 10252 // promise.progress = list.add 10253 // promise.done = list.add 10254 // promise.fail = list.add 10255 promise[ tuple[ 1 ] ] = list.add; 10256 10257 // Handle state 10258 if ( stateString ) { 10259 list.add( 10260 function() { 10261 10262 // state = "resolved" (i.e., fulfilled) 10263 // state = "rejected" 10264 state = stateString; 10265 }, 10266 10267 // rejected_callbacks.disable 10268 // fulfilled_callbacks.disable 10269 tuples[ 3 - i ][ 2 ].disable, 10270 10271 // rejected_handlers.disable 10272 // fulfilled_handlers.disable 10273 tuples[ 3 - i ][ 3 ].disable, 10274 10275 // progress_callbacks.lock 10276 tuples[ 0 ][ 2 ].lock, 10277 10278 // progress_handlers.lock 10279 tuples[ 0 ][ 3 ].lock 10280 ); 10281 } 10282 10283 // progress_handlers.fire 10284 // fulfilled_handlers.fire 10285 // rejected_handlers.fire 10286 list.add( tuple[ 3 ].fire ); 10287 10288 // deferred.notify = function() { deferred.notifyWith(...) } 10289 // deferred.resolve = function() { deferred.resolveWith(...) } 10290 // deferred.reject = function() { deferred.rejectWith(...) } 10291 deferred[ tuple[ 0 ] ] = function() { 10292 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 10293 return this; 10294 }; 10295 10296 // deferred.notifyWith = list.fireWith 10297 // deferred.resolveWith = list.fireWith 10298 // deferred.rejectWith = list.fireWith 10299 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 10300 } ); 10301 10302 // Make the deferred a promise 10303 promise.promise( deferred ); 10304 10305 // Call given func if any 10306 if ( func ) { 10307 func.call( deferred, deferred ); 10308 } 10309 10310 // All done! 10311 return deferred; 10312 }, 10313 10314 // Deferred helper 10315 when: function( singleValue ) { 10316 var 10317 10318 // count of uncompleted subordinates 10319 remaining = arguments.length, 10320 10321 // count of unprocessed arguments 10322 i = remaining, 10323 10324 // subordinate fulfillment data 10325 resolveContexts = Array( i ), 10326 resolveValues = slice.call( arguments ), 10327 10328 // the master Deferred 10329 master = jQuery.Deferred(), 10330 10331 // subordinate callback factory 10332 updateFunc = function( i ) { 10333 return function( value ) { 10334 resolveContexts[ i ] = this; 10335 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 10336 if ( !( --remaining ) ) { 10337 master.resolveWith( resolveContexts, resolveValues ); 10338 } 10339 }; 10340 }; 10341 10342 // Single- and empty arguments are adopted like Promise.resolve 10343 if ( remaining <= 1 ) { 10344 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 10345 !remaining ); 10346 10347 // Use .then() to unwrap secondary thenables (cf. gh-3000) 10348 if ( master.state() === "pending" || 10349 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 10350 10351 return master.then(); 10352 } 10353 } 10354 10355 // Multiple arguments are aggregated like Promise.all array elements 10356 while ( i-- ) { 10357 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 10358 } 10359 10360 return master.promise(); 10361 } 10362} ); 10363 10364 10365// These usually indicate a programmer mistake during development, 10366// warn about them ASAP rather than swallowing them by default. 10367var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 10368 10369jQuery.Deferred.exceptionHook = function( error, stack ) { 10370 10371 // Support: IE 8 - 9 only 10372 // Console exists when dev tools are open, which can happen at any time 10373 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 10374 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 10375 } 10376}; 10377 10378 10379 10380 10381jQuery.readyException = function( error ) { 10382 window.setTimeout( function() { 10383 throw error; 10384 } ); 10385}; 10386 10387 10388 10389 10390// The deferred used on DOM ready 10391var readyList = jQuery.Deferred(); 10392 10393jQuery.fn.ready = function( fn ) { 10394 10395 readyList 10396 .then( fn ) 10397 10398 // Wrap jQuery.readyException in a function so that the lookup 10399 // happens at the time of error handling instead of callback 10400 // registration. 10401 .catch( function( error ) { 10402 jQuery.readyException( error ); 10403 } ); 10404 10405 return this; 10406}; 10407 10408jQuery.extend( { 10409 10410 // Is the DOM ready to be used? Set to true once it occurs. 10411 isReady: false, 10412 10413 // A counter to track how many items to wait for before 10414 // the ready event fires. See #6781 10415 readyWait: 1, 10416 10417 // Handle when the DOM is ready 10418 ready: function( wait ) { 10419 10420 // Abort if there are pending holds or we're already ready 10421 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 10422 return; 10423 } 10424 10425 // Remember that the DOM is ready 10426 jQuery.isReady = true; 10427 10428 // If a normal DOM Ready event fired, decrement, and wait if need be 10429 if ( wait !== true && --jQuery.readyWait > 0 ) { 10430 return; 10431 } 10432 10433 // If there are functions bound, to execute 10434 readyList.resolveWith( document, [ jQuery ] ); 10435 } 10436} ); 10437 10438jQuery.ready.then = readyList.then; 10439 10440// The ready event handler and self cleanup method 10441function completed() { 10442 document.removeEventListener( "DOMContentLoaded", completed ); 10443 window.removeEventListener( "load", completed ); 10444 jQuery.ready(); 10445} 10446 10447// Catch cases where $(document).ready() is called 10448// after the browser event has already occurred. 10449// Support: IE <=9 - 10 only 10450// Older IE sometimes signals "interactive" too soon 10451if ( document.readyState === "complete" || 10452 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 10453 10454 // Handle it asynchronously to allow scripts the opportunity to delay ready 10455 window.setTimeout( jQuery.ready ); 10456 10457} else { 10458 10459 // Use the handy event callback 10460 document.addEventListener( "DOMContentLoaded", completed ); 10461 10462 // A fallback to window.onload, that will always work 10463 window.addEventListener( "load", completed ); 10464} 10465 10466 10467 10468 10469// Multifunctional method to get and set values of a collection 10470// The value/s can optionally be executed if it's a function 10471var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 10472 var i = 0, 10473 len = elems.length, 10474 bulk = key == null; 10475 10476 // Sets many values 10477 if ( toType( key ) === "object" ) { 10478 chainable = true; 10479 for ( i in key ) { 10480 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 10481 } 10482 10483 // Sets one value 10484 } else if ( value !== undefined ) { 10485 chainable = true; 10486 10487 if ( !isFunction( value ) ) { 10488 raw = true; 10489 } 10490 10491 if ( bulk ) { 10492 10493 // Bulk operations run against the entire set 10494 if ( raw ) { 10495 fn.call( elems, value ); 10496 fn = null; 10497 10498 // ...except when executing function values 10499 } else { 10500 bulk = fn; 10501 fn = function( elem, _key, value ) { 10502 return bulk.call( jQuery( elem ), value ); 10503 }; 10504 } 10505 } 10506 10507 if ( fn ) { 10508 for ( ; i < len; i++ ) { 10509 fn( 10510 elems[ i ], key, raw ? 10511 value : 10512 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 10513 ); 10514 } 10515 } 10516 } 10517 10518 if ( chainable ) { 10519 return elems; 10520 } 10521 10522 // Gets 10523 if ( bulk ) { 10524 return fn.call( elems ); 10525 } 10526 10527 return len ? fn( elems[ 0 ], key ) : emptyGet; 10528}; 10529 10530 10531// Matches dashed string for camelizing 10532var rmsPrefix = /^-ms-/, 10533 rdashAlpha = /-([a-z])/g; 10534 10535// Used by camelCase as callback to replace() 10536function fcamelCase( _all, letter ) { 10537 return letter.toUpperCase(); 10538} 10539 10540// Convert dashed to camelCase; used by the css and data modules 10541// Support: IE <=9 - 11, Edge 12 - 15 10542// Microsoft forgot to hump their vendor prefix (#9572) 10543function camelCase( string ) { 10544 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 10545} 10546var acceptData = function( owner ) { 10547 10548 // Accepts only: 10549 // - Node 10550 // - Node.ELEMENT_NODE 10551 // - Node.DOCUMENT_NODE 10552 // - Object 10553 // - Any 10554 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 10555}; 10556 10557 10558 10559 10560function Data() { 10561 this.expando = jQuery.expando + Data.uid++; 10562} 10563 10564Data.uid = 1; 10565 10566Data.prototype = { 10567 10568 cache: function( owner ) { 10569 10570 // Check if the owner object already has a cache 10571 var value = owner[ this.expando ]; 10572 10573 // If not, create one 10574 if ( !value ) { 10575 value = {}; 10576 10577 // We can accept data for non-element nodes in modern browsers, 10578 // but we should not, see #8335. 10579 // Always return an empty object. 10580 if ( acceptData( owner ) ) { 10581 10582 // If it is a node unlikely to be stringify-ed or looped over 10583 // use plain assignment 10584 if ( owner.nodeType ) { 10585 owner[ this.expando ] = value; 10586 10587 // Otherwise secure it in a non-enumerable property 10588 // configurable must be true to allow the property to be 10589 // deleted when data is removed 10590 } else { 10591 Object.defineProperty( owner, this.expando, { 10592 value: value, 10593 configurable: true 10594 } ); 10595 } 10596 } 10597 } 10598 10599 return value; 10600 }, 10601 set: function( owner, data, value ) { 10602 var prop, 10603 cache = this.cache( owner ); 10604 10605 // Handle: [ owner, key, value ] args 10606 // Always use camelCase key (gh-2257) 10607 if ( typeof data === "string" ) { 10608 cache[ camelCase( data ) ] = value; 10609 10610 // Handle: [ owner, { properties } ] args 10611 } else { 10612 10613 // Copy the properties one-by-one to the cache object 10614 for ( prop in data ) { 10615 cache[ camelCase( prop ) ] = data[ prop ]; 10616 } 10617 } 10618 return cache; 10619 }, 10620 get: function( owner, key ) { 10621 return key === undefined ? 10622 this.cache( owner ) : 10623 10624 // Always use camelCase key (gh-2257) 10625 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 10626 }, 10627 access: function( owner, key, value ) { 10628 10629 // In cases where either: 10630 // 10631 // 1. No key was specified 10632 // 2. A string key was specified, but no value provided 10633 // 10634 // Take the "read" path and allow the get method to determine 10635 // which value to return, respectively either: 10636 // 10637 // 1. The entire cache object 10638 // 2. The data stored at the key 10639 // 10640 if ( key === undefined || 10641 ( ( key && typeof key === "string" ) && value === undefined ) ) { 10642 10643 return this.get( owner, key ); 10644 } 10645 10646 // When the key is not a string, or both a key and value 10647 // are specified, set or extend (existing objects) with either: 10648 // 10649 // 1. An object of properties 10650 // 2. A key and value 10651 // 10652 this.set( owner, key, value ); 10653 10654 // Since the "set" path can have two possible entry points 10655 // return the expected data based on which path was taken[*] 10656 return value !== undefined ? value : key; 10657 }, 10658 remove: function( owner, key ) { 10659 var i, 10660 cache = owner[ this.expando ]; 10661 10662 if ( cache === undefined ) { 10663 return; 10664 } 10665 10666 if ( key !== undefined ) { 10667 10668 // Support array or space separated string of keys 10669 if ( Array.isArray( key ) ) { 10670 10671 // If key is an array of keys... 10672 // We always set camelCase keys, so remove that. 10673 key = key.map( camelCase ); 10674 } else { 10675 key = camelCase( key ); 10676 10677 // If a key with the spaces exists, use it. 10678 // Otherwise, create an array by matching non-whitespace 10679 key = key in cache ? 10680 [ key ] : 10681 ( key.match( rnothtmlwhite ) || [] ); 10682 } 10683 10684 i = key.length; 10685 10686 while ( i-- ) { 10687 delete cache[ key[ i ] ]; 10688 } 10689 } 10690 10691 // Remove the expando if there's no more data 10692 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 10693 10694 // Support: Chrome <=35 - 45 10695 // Webkit & Blink performance suffers when deleting properties 10696 // from DOM nodes, so set to undefined instead 10697 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 10698 if ( owner.nodeType ) { 10699 owner[ this.expando ] = undefined; 10700 } else { 10701 delete owner[ this.expando ]; 10702 } 10703 } 10704 }, 10705 hasData: function( owner ) { 10706 var cache = owner[ this.expando ]; 10707 return cache !== undefined && !jQuery.isEmptyObject( cache ); 10708 } 10709}; 10710var dataPriv = new Data(); 10711 10712var dataUser = new Data(); 10713 10714 10715 10716// Implementation Summary 10717// 10718// 1. Enforce API surface and semantic compatibility with 1.9.x branch 10719// 2. Improve the module's maintainability by reducing the storage 10720// paths to a single mechanism. 10721// 3. Use the same single mechanism to support "private" and "user" data. 10722// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 10723// 5. Avoid exposing implementation details on user objects (eg. expando properties) 10724// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 10725 10726var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 10727 rmultiDash = /[A-Z]/g; 10728 10729function getData( data ) { 10730 if ( data === "true" ) { 10731 return true; 10732 } 10733 10734 if ( data === "false" ) { 10735 return false; 10736 } 10737 10738 if ( data === "null" ) { 10739 return null; 10740 } 10741 10742 // Only convert to a number if it doesn't change the string 10743 if ( data === +data + "" ) { 10744 return +data; 10745 } 10746 10747 if ( rbrace.test( data ) ) { 10748 return JSON.parse( data ); 10749 } 10750 10751 return data; 10752} 10753 10754function dataAttr( elem, key, data ) { 10755 var name; 10756 10757 // If nothing was found internally, try to fetch any 10758 // data from the HTML5 data-* attribute 10759 if ( data === undefined && elem.nodeType === 1 ) { 10760 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 10761 data = elem.getAttribute( name ); 10762 10763 if ( typeof data === "string" ) { 10764 try { 10765 data = getData( data ); 10766 } catch ( e ) {} 10767 10768 // Make sure we set the data so it isn't changed later 10769 dataUser.set( elem, key, data ); 10770 } else { 10771 data = undefined; 10772 } 10773 } 10774 return data; 10775} 10776 10777jQuery.extend( { 10778 hasData: function( elem ) { 10779 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 10780 }, 10781 10782 data: function( elem, name, data ) { 10783 return dataUser.access( elem, name, data ); 10784 }, 10785 10786 removeData: function( elem, name ) { 10787 dataUser.remove( elem, name ); 10788 }, 10789 10790 // TODO: Now that all calls to _data and _removeData have been replaced 10791 // with direct calls to dataPriv methods, these can be deprecated. 10792 _data: function( elem, name, data ) { 10793 return dataPriv.access( elem, name, data ); 10794 }, 10795 10796 _removeData: function( elem, name ) { 10797 dataPriv.remove( elem, name ); 10798 } 10799} ); 10800 10801jQuery.fn.extend( { 10802 data: function( key, value ) { 10803 var i, name, data, 10804 elem = this[ 0 ], 10805 attrs = elem && elem.attributes; 10806 10807 // Gets all values 10808 if ( key === undefined ) { 10809 if ( this.length ) { 10810 data = dataUser.get( elem ); 10811 10812 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 10813 i = attrs.length; 10814 while ( i-- ) { 10815 10816 // Support: IE 11 only 10817 // The attrs elements can be null (#14894) 10818 if ( attrs[ i ] ) { 10819 name = attrs[ i ].name; 10820 if ( name.indexOf( "data-" ) === 0 ) { 10821 name = camelCase( name.slice( 5 ) ); 10822 dataAttr( elem, name, data[ name ] ); 10823 } 10824 } 10825 } 10826 dataPriv.set( elem, "hasDataAttrs", true ); 10827 } 10828 } 10829 10830 return data; 10831 } 10832 10833 // Sets multiple values 10834 if ( typeof key === "object" ) { 10835 return this.each( function() { 10836 dataUser.set( this, key ); 10837 } ); 10838 } 10839 10840 return access( this, function( value ) { 10841 var data; 10842 10843 // The calling jQuery object (element matches) is not empty 10844 // (and therefore has an element appears at this[ 0 ]) and the 10845 // `value` parameter was not undefined. An empty jQuery object 10846 // will result in `undefined` for elem = this[ 0 ] which will 10847 // throw an exception if an attempt to read a data cache is made. 10848 if ( elem && value === undefined ) { 10849 10850 // Attempt to get data from the cache 10851 // The key will always be camelCased in Data 10852 data = dataUser.get( elem, key ); 10853 if ( data !== undefined ) { 10854 return data; 10855 } 10856 10857 // Attempt to "discover" the data in 10858 // HTML5 custom data-* attrs 10859 data = dataAttr( elem, key ); 10860 if ( data !== undefined ) { 10861 return data; 10862 } 10863 10864 // We tried really hard, but the data doesn't exist. 10865 return; 10866 } 10867 10868 // Set the data... 10869 this.each( function() { 10870 10871 // We always store the camelCased key 10872 dataUser.set( this, key, value ); 10873 } ); 10874 }, null, value, arguments.length > 1, null, true ); 10875 }, 10876 10877 removeData: function( key ) { 10878 return this.each( function() { 10879 dataUser.remove( this, key ); 10880 } ); 10881 } 10882} ); 10883 10884 10885jQuery.extend( { 10886 queue: function( elem, type, data ) { 10887 var queue; 10888 10889 if ( elem ) { 10890 type = ( type || "fx" ) + "queue"; 10891 queue = dataPriv.get( elem, type ); 10892 10893 // Speed up dequeue by getting out quickly if this is just a lookup 10894 if ( data ) { 10895 if ( !queue || Array.isArray( data ) ) { 10896 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 10897 } else { 10898 queue.push( data ); 10899 } 10900 } 10901 return queue || []; 10902 } 10903 }, 10904 10905 dequeue: function( elem, type ) { 10906 type = type || "fx"; 10907 10908 var queue = jQuery.queue( elem, type ), 10909 startLength = queue.length, 10910 fn = queue.shift(), 10911 hooks = jQuery._queueHooks( elem, type ), 10912 next = function() { 10913 jQuery.dequeue( elem, type ); 10914 }; 10915 10916 // If the fx queue is dequeued, always remove the progress sentinel 10917 if ( fn === "inprogress" ) { 10918 fn = queue.shift(); 10919 startLength--; 10920 } 10921 10922 if ( fn ) { 10923 10924 // Add a progress sentinel to prevent the fx queue from being 10925 // automatically dequeued 10926 if ( type === "fx" ) { 10927 queue.unshift( "inprogress" ); 10928 } 10929 10930 // Clear up the last queue stop function 10931 delete hooks.stop; 10932 fn.call( elem, next, hooks ); 10933 } 10934 10935 if ( !startLength && hooks ) { 10936 hooks.empty.fire(); 10937 } 10938 }, 10939 10940 // Not public - generate a queueHooks object, or return the current one 10941 _queueHooks: function( elem, type ) { 10942 var key = type + "queueHooks"; 10943 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 10944 empty: jQuery.Callbacks( "once memory" ).add( function() { 10945 dataPriv.remove( elem, [ type + "queue", key ] ); 10946 } ) 10947 } ); 10948 } 10949} ); 10950 10951jQuery.fn.extend( { 10952 queue: function( type, data ) { 10953 var setter = 2; 10954 10955 if ( typeof type !== "string" ) { 10956 data = type; 10957 type = "fx"; 10958 setter--; 10959 } 10960 10961 if ( arguments.length < setter ) { 10962 return jQuery.queue( this[ 0 ], type ); 10963 } 10964 10965 return data === undefined ? 10966 this : 10967 this.each( function() { 10968 var queue = jQuery.queue( this, type, data ); 10969 10970 // Ensure a hooks for this queue 10971 jQuery._queueHooks( this, type ); 10972 10973 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 10974 jQuery.dequeue( this, type ); 10975 } 10976 } ); 10977 }, 10978 dequeue: function( type ) { 10979 return this.each( function() { 10980 jQuery.dequeue( this, type ); 10981 } ); 10982 }, 10983 clearQueue: function( type ) { 10984 return this.queue( type || "fx", [] ); 10985 }, 10986 10987 // Get a promise resolved when queues of a certain type 10988 // are emptied (fx is the type by default) 10989 promise: function( type, obj ) { 10990 var tmp, 10991 count = 1, 10992 defer = jQuery.Deferred(), 10993 elements = this, 10994 i = this.length, 10995 resolve = function() { 10996 if ( !( --count ) ) { 10997 defer.resolveWith( elements, [ elements ] ); 10998 } 10999 }; 11000 11001 if ( typeof type !== "string" ) { 11002 obj = type; 11003 type = undefined; 11004 } 11005 type = type || "fx"; 11006 11007 while ( i-- ) { 11008 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 11009 if ( tmp && tmp.empty ) { 11010 count++; 11011 tmp.empty.add( resolve ); 11012 } 11013 } 11014 resolve(); 11015 return defer.promise( obj ); 11016 } 11017} ); 11018var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 11019 11020var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 11021 11022 11023var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 11024 11025var documentElement = document.documentElement; 11026 11027 11028 11029 var isAttached = function( elem ) { 11030 return jQuery.contains( elem.ownerDocument, elem ); 11031 }, 11032 composed = { composed: true }; 11033 11034 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 11035 // Check attachment across shadow DOM boundaries when possible (gh-3504) 11036 // Support: iOS 10.0-10.2 only 11037 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 11038 // leading to errors. We need to check for `getRootNode`. 11039 if ( documentElement.getRootNode ) { 11040 isAttached = function( elem ) { 11041 return jQuery.contains( elem.ownerDocument, elem ) || 11042 elem.getRootNode( composed ) === elem.ownerDocument; 11043 }; 11044 } 11045var isHiddenWithinTree = function( elem, el ) { 11046 11047 // isHiddenWithinTree might be called from jQuery#filter function; 11048 // in that case, element will be second argument 11049 elem = el || elem; 11050 11051 // Inline style trumps all 11052 return elem.style.display === "none" || 11053 elem.style.display === "" && 11054 11055 // Otherwise, check computed style 11056 // Support: Firefox <=43 - 45 11057 // Disconnected elements can have computed display: none, so first confirm that elem is 11058 // in the document. 11059 isAttached( elem ) && 11060 11061 jQuery.css( elem, "display" ) === "none"; 11062 }; 11063 11064 11065 11066function adjustCSS( elem, prop, valueParts, tween ) { 11067 var adjusted, scale, 11068 maxIterations = 20, 11069 currentValue = tween ? 11070 function() { 11071 return tween.cur(); 11072 } : 11073 function() { 11074 return jQuery.css( elem, prop, "" ); 11075 }, 11076 initial = currentValue(), 11077 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 11078 11079 // Starting value computation is required for potential unit mismatches 11080 initialInUnit = elem.nodeType && 11081 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 11082 rcssNum.exec( jQuery.css( elem, prop ) ); 11083 11084 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 11085 11086 // Support: Firefox <=54 11087 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 11088 initial = initial / 2; 11089 11090 // Trust units reported by jQuery.css 11091 unit = unit || initialInUnit[ 3 ]; 11092 11093 // Iteratively approximate from a nonzero starting point 11094 initialInUnit = +initial || 1; 11095 11096 while ( maxIterations-- ) { 11097 11098 // Evaluate and update our best guess (doubling guesses that zero out). 11099 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 11100 jQuery.style( elem, prop, initialInUnit + unit ); 11101 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 11102 maxIterations = 0; 11103 } 11104 initialInUnit = initialInUnit / scale; 11105 11106 } 11107 11108 initialInUnit = initialInUnit * 2; 11109 jQuery.style( elem, prop, initialInUnit + unit ); 11110 11111 // Make sure we update the tween properties later on 11112 valueParts = valueParts || []; 11113 } 11114 11115 if ( valueParts ) { 11116 initialInUnit = +initialInUnit || +initial || 0; 11117 11118 // Apply relative offset (+=/-=) if specified 11119 adjusted = valueParts[ 1 ] ? 11120 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 11121 +valueParts[ 2 ]; 11122 if ( tween ) { 11123 tween.unit = unit; 11124 tween.start = initialInUnit; 11125 tween.end = adjusted; 11126 } 11127 } 11128 return adjusted; 11129} 11130 11131 11132var defaultDisplayMap = {}; 11133 11134function getDefaultDisplay( elem ) { 11135 var temp, 11136 doc = elem.ownerDocument, 11137 nodeName = elem.nodeName, 11138 display = defaultDisplayMap[ nodeName ]; 11139 11140 if ( display ) { 11141 return display; 11142 } 11143 11144 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 11145 display = jQuery.css( temp, "display" ); 11146 11147 temp.parentNode.removeChild( temp ); 11148 11149 if ( display === "none" ) { 11150 display = "block"; 11151 } 11152 defaultDisplayMap[ nodeName ] = display; 11153 11154 return display; 11155} 11156 11157function showHide( elements, show ) { 11158 var display, elem, 11159 values = [], 11160 index = 0, 11161 length = elements.length; 11162 11163 // Determine new display value for elements that need to change 11164 for ( ; index < length; index++ ) { 11165 elem = elements[ index ]; 11166 if ( !elem.style ) { 11167 continue; 11168 } 11169 11170 display = elem.style.display; 11171 if ( show ) { 11172 11173 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 11174 // check is required in this first loop unless we have a nonempty display value (either 11175 // inline or about-to-be-restored) 11176 if ( display === "none" ) { 11177 values[ index ] = dataPriv.get( elem, "display" ) || null; 11178 if ( !values[ index ] ) { 11179 elem.style.display = ""; 11180 } 11181 } 11182 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 11183 values[ index ] = getDefaultDisplay( elem ); 11184 } 11185 } else { 11186 if ( display !== "none" ) { 11187 values[ index ] = "none"; 11188 11189 // Remember what we're overwriting 11190 dataPriv.set( elem, "display", display ); 11191 } 11192 } 11193 } 11194 11195 // Set the display of the elements in a second loop to avoid constant reflow 11196 for ( index = 0; index < length; index++ ) { 11197 if ( values[ index ] != null ) { 11198 elements[ index ].style.display = values[ index ]; 11199 } 11200 } 11201 11202 return elements; 11203} 11204 11205jQuery.fn.extend( { 11206 show: function() { 11207 return showHide( this, true ); 11208 }, 11209 hide: function() { 11210 return showHide( this ); 11211 }, 11212 toggle: function( state ) { 11213 if ( typeof state === "boolean" ) { 11214 return state ? this.show() : this.hide(); 11215 } 11216 11217 return this.each( function() { 11218 if ( isHiddenWithinTree( this ) ) { 11219 jQuery( this ).show(); 11220 } else { 11221 jQuery( this ).hide(); 11222 } 11223 } ); 11224 } 11225} ); 11226var rcheckableType = ( /^(?:checkbox|radio)$/i ); 11227 11228var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 11229 11230var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 11231 11232 11233 11234( function() { 11235 var fragment = document.createDocumentFragment(), 11236 div = fragment.appendChild( document.createElement( "div" ) ), 11237 input = document.createElement( "input" ); 11238 11239 // Support: Android 4.0 - 4.3 only 11240 // Check state lost if the name is set (#11217) 11241 // Support: Windows Web Apps (WWA) 11242 // `name` and `type` must use .setAttribute for WWA (#14901) 11243 input.setAttribute( "type", "radio" ); 11244 input.setAttribute( "checked", "checked" ); 11245 input.setAttribute( "name", "t" ); 11246 11247 div.appendChild( input ); 11248 11249 // Support: Android <=4.1 only 11250 // Older WebKit doesn't clone checked state correctly in fragments 11251 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 11252 11253 // Support: IE <=11 only 11254 // Make sure textarea (and checkbox) defaultValue is properly cloned 11255 div.innerHTML = "<textarea>x</textarea>"; 11256 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 11257 11258 // Support: IE <=9 only 11259 // IE <=9 replaces <option> tags with their contents when inserted outside of 11260 // the select element. 11261 div.innerHTML = "<option></option>"; 11262 support.option = !!div.lastChild; 11263} )(); 11264 11265 11266// We have to close these tags to support XHTML (#13200) 11267var wrapMap = { 11268 11269 // XHTML parsers do not magically insert elements in the 11270 // same way that tag soup parsers do. So we cannot shorten 11271 // this by omitting <tbody> or other required elements. 11272 thead: [ 1, "<table>", "</table>" ], 11273 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 11274 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 11275 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 11276 11277 _default: [ 0, "", "" ] 11278}; 11279 11280wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 11281wrapMap.th = wrapMap.td; 11282 11283// Support: IE <=9 only 11284if ( !support.option ) { 11285 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 11286} 11287 11288 11289function getAll( context, tag ) { 11290 11291 // Support: IE <=9 - 11 only 11292 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 11293 var ret; 11294 11295 if ( typeof context.getElementsByTagName !== "undefined" ) { 11296 ret = context.getElementsByTagName( tag || "*" ); 11297 11298 } else if ( typeof context.querySelectorAll !== "undefined" ) { 11299 ret = context.querySelectorAll( tag || "*" ); 11300 11301 } else { 11302 ret = []; 11303 } 11304 11305 if ( tag === undefined || tag && nodeName( context, tag ) ) { 11306 return jQuery.merge( [ context ], ret ); 11307 } 11308 11309 return ret; 11310} 11311 11312 11313// Mark scripts as having already been evaluated 11314function setGlobalEval( elems, refElements ) { 11315 var i = 0, 11316 l = elems.length; 11317 11318 for ( ; i < l; i++ ) { 11319 dataPriv.set( 11320 elems[ i ], 11321 "globalEval", 11322 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 11323 ); 11324 } 11325} 11326 11327 11328var rhtml = /<|&#?\w+;/; 11329 11330function buildFragment( elems, context, scripts, selection, ignored ) { 11331 var elem, tmp, tag, wrap, attached, j, 11332 fragment = context.createDocumentFragment(), 11333 nodes = [], 11334 i = 0, 11335 l = elems.length; 11336 11337 for ( ; i < l; i++ ) { 11338 elem = elems[ i ]; 11339 11340 if ( elem || elem === 0 ) { 11341 11342 // Add nodes directly 11343 if ( toType( elem ) === "object" ) { 11344 11345 // Support: Android <=4.0 only, PhantomJS 1 only 11346 // push.apply(_, arraylike) throws on ancient WebKit 11347 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 11348 11349 // Convert non-html into a text node 11350 } else if ( !rhtml.test( elem ) ) { 11351 nodes.push( context.createTextNode( elem ) ); 11352 11353 // Convert html into DOM nodes 11354 } else { 11355 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 11356 11357 // Deserialize a standard representation 11358 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 11359 wrap = wrapMap[ tag ] || wrapMap._default; 11360 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 11361 11362 // Descend through wrappers to the right content 11363 j = wrap[ 0 ]; 11364 while ( j-- ) { 11365 tmp = tmp.lastChild; 11366 } 11367 11368 // Support: Android <=4.0 only, PhantomJS 1 only 11369 // push.apply(_, arraylike) throws on ancient WebKit 11370 jQuery.merge( nodes, tmp.childNodes ); 11371 11372 // Remember the top-level container 11373 tmp = fragment.firstChild; 11374 11375 // Ensure the created nodes are orphaned (#12392) 11376 tmp.textContent = ""; 11377 } 11378 } 11379 } 11380 11381 // Remove wrapper from fragment 11382 fragment.textContent = ""; 11383 11384 i = 0; 11385 while ( ( elem = nodes[ i++ ] ) ) { 11386 11387 // Skip elements already in the context collection (trac-4087) 11388 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 11389 if ( ignored ) { 11390 ignored.push( elem ); 11391 } 11392 continue; 11393 } 11394 11395 attached = isAttached( elem ); 11396 11397 // Append to fragment 11398 tmp = getAll( fragment.appendChild( elem ), "script" ); 11399 11400 // Preserve script evaluation history 11401 if ( attached ) { 11402 setGlobalEval( tmp ); 11403 } 11404 11405 // Capture executables 11406 if ( scripts ) { 11407 j = 0; 11408 while ( ( elem = tmp[ j++ ] ) ) { 11409 if ( rscriptType.test( elem.type || "" ) ) { 11410 scripts.push( elem ); 11411 } 11412 } 11413 } 11414 } 11415 11416 return fragment; 11417} 11418 11419 11420var 11421 rkeyEvent = /^key/, 11422 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 11423 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 11424 11425function returnTrue() { 11426 return true; 11427} 11428 11429function returnFalse() { 11430 return false; 11431} 11432 11433// Support: IE <=9 - 11+ 11434// focus() and blur() are asynchronous, except when they are no-op. 11435// So expect focus to be synchronous when the element is already active, 11436// and blur to be synchronous when the element is not already active. 11437// (focus and blur are always synchronous in other supported browsers, 11438// this just defines when we can count on it). 11439function expectSync( elem, type ) { 11440 return ( elem === safeActiveElement() ) === ( type === "focus" ); 11441} 11442 11443// Support: IE <=9 only 11444// Accessing document.activeElement can throw unexpectedly 11445// https://bugs.jquery.com/ticket/13393 11446function safeActiveElement() { 11447 try { 11448 return document.activeElement; 11449 } catch ( err ) { } 11450} 11451 11452function on( elem, types, selector, data, fn, one ) { 11453 var origFn, type; 11454 11455 // Types can be a map of types/handlers 11456 if ( typeof types === "object" ) { 11457 11458 // ( types-Object, selector, data ) 11459 if ( typeof selector !== "string" ) { 11460 11461 // ( types-Object, data ) 11462 data = data || selector; 11463 selector = undefined; 11464 } 11465 for ( type in types ) { 11466 on( elem, type, selector, data, types[ type ], one ); 11467 } 11468 return elem; 11469 } 11470 11471 if ( data == null && fn == null ) { 11472 11473 // ( types, fn ) 11474 fn = selector; 11475 data = selector = undefined; 11476 } else if ( fn == null ) { 11477 if ( typeof selector === "string" ) { 11478 11479 // ( types, selector, fn ) 11480 fn = data; 11481 data = undefined; 11482 } else { 11483 11484 // ( types, data, fn ) 11485 fn = data; 11486 data = selector; 11487 selector = undefined; 11488 } 11489 } 11490 if ( fn === false ) { 11491 fn = returnFalse; 11492 } else if ( !fn ) { 11493 return elem; 11494 } 11495 11496 if ( one === 1 ) { 11497 origFn = fn; 11498 fn = function( event ) { 11499 11500 // Can use an empty set, since event contains the info 11501 jQuery().off( event ); 11502 return origFn.apply( this, arguments ); 11503 }; 11504 11505 // Use same guid so caller can remove using origFn 11506 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 11507 } 11508 return elem.each( function() { 11509 jQuery.event.add( this, types, fn, data, selector ); 11510 } ); 11511} 11512 11513/* 11514 * Helper functions for managing events -- not part of the public interface. 11515 * Props to Dean Edwards' addEvent library for many of the ideas. 11516 */ 11517jQuery.event = { 11518 11519 global: {}, 11520 11521 add: function( elem, types, handler, data, selector ) { 11522 11523 var handleObjIn, eventHandle, tmp, 11524 events, t, handleObj, 11525 special, handlers, type, namespaces, origType, 11526 elemData = dataPriv.get( elem ); 11527 11528 // Only attach events to objects that accept data 11529 if ( !acceptData( elem ) ) { 11530 return; 11531 } 11532 11533 // Caller can pass in an object of custom data in lieu of the handler 11534 if ( handler.handler ) { 11535 handleObjIn = handler; 11536 handler = handleObjIn.handler; 11537 selector = handleObjIn.selector; 11538 } 11539 11540 // Ensure that invalid selectors throw exceptions at attach time 11541 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 11542 if ( selector ) { 11543 jQuery.find.matchesSelector( documentElement, selector ); 11544 } 11545 11546 // Make sure that the handler has a unique ID, used to find/remove it later 11547 if ( !handler.guid ) { 11548 handler.guid = jQuery.guid++; 11549 } 11550 11551 // Init the element's event structure and main handler, if this is the first 11552 if ( !( events = elemData.events ) ) { 11553 events = elemData.events = Object.create( null ); 11554 } 11555 if ( !( eventHandle = elemData.handle ) ) { 11556 eventHandle = elemData.handle = function( e ) { 11557 11558 // Discard the second event of a jQuery.event.trigger() and 11559 // when an event is called after a page has unloaded 11560 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 11561 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 11562 }; 11563 } 11564 11565 // Handle multiple events separated by a space 11566 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 11567 t = types.length; 11568 while ( t-- ) { 11569 tmp = rtypenamespace.exec( types[ t ] ) || []; 11570 type = origType = tmp[ 1 ]; 11571 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 11572 11573 // There *must* be a type, no attaching namespace-only handlers 11574 if ( !type ) { 11575 continue; 11576 } 11577 11578 // If event changes its type, use the special event handlers for the changed type 11579 special = jQuery.event.special[ type ] || {}; 11580 11581 // If selector defined, determine special event api type, otherwise given type 11582 type = ( selector ? special.delegateType : special.bindType ) || type; 11583 11584 // Update special based on newly reset type 11585 special = jQuery.event.special[ type ] || {}; 11586 11587 // handleObj is passed to all event handlers 11588 handleObj = jQuery.extend( { 11589 type: type, 11590 origType: origType, 11591 data: data, 11592 handler: handler, 11593 guid: handler.guid, 11594 selector: selector, 11595 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 11596 namespace: namespaces.join( "." ) 11597 }, handleObjIn ); 11598 11599 // Init the event handler queue if we're the first 11600 if ( !( handlers = events[ type ] ) ) { 11601 handlers = events[ type ] = []; 11602 handlers.delegateCount = 0; 11603 11604 // Only use addEventListener if the special events handler returns false 11605 if ( !special.setup || 11606 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 11607 11608 if ( elem.addEventListener ) { 11609 elem.addEventListener( type, eventHandle ); 11610 } 11611 } 11612 } 11613 11614 if ( special.add ) { 11615 special.add.call( elem, handleObj ); 11616 11617 if ( !handleObj.handler.guid ) { 11618 handleObj.handler.guid = handler.guid; 11619 } 11620 } 11621 11622 // Add to the element's handler list, delegates in front 11623 if ( selector ) { 11624 handlers.splice( handlers.delegateCount++, 0, handleObj ); 11625 } else { 11626 handlers.push( handleObj ); 11627 } 11628 11629 // Keep track of which events have ever been used, for event optimization 11630 jQuery.event.global[ type ] = true; 11631 } 11632 11633 }, 11634 11635 // Detach an event or set of events from an element 11636 remove: function( elem, types, handler, selector, mappedTypes ) { 11637 11638 var j, origCount, tmp, 11639 events, t, handleObj, 11640 special, handlers, type, namespaces, origType, 11641 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 11642 11643 if ( !elemData || !( events = elemData.events ) ) { 11644 return; 11645 } 11646 11647 // Once for each type.namespace in types; type may be omitted 11648 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 11649 t = types.length; 11650 while ( t-- ) { 11651 tmp = rtypenamespace.exec( types[ t ] ) || []; 11652 type = origType = tmp[ 1 ]; 11653 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 11654 11655 // Unbind all events (on this namespace, if provided) for the element 11656 if ( !type ) { 11657 for ( type in events ) { 11658 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 11659 } 11660 continue; 11661 } 11662 11663 special = jQuery.event.special[ type ] || {}; 11664 type = ( selector ? special.delegateType : special.bindType ) || type; 11665 handlers = events[ type ] || []; 11666 tmp = tmp[ 2 ] && 11667 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 11668 11669 // Remove matching events 11670 origCount = j = handlers.length; 11671 while ( j-- ) { 11672 handleObj = handlers[ j ]; 11673 11674 if ( ( mappedTypes || origType === handleObj.origType ) && 11675 ( !handler || handler.guid === handleObj.guid ) && 11676 ( !tmp || tmp.test( handleObj.namespace ) ) && 11677 ( !selector || selector === handleObj.selector || 11678 selector === "**" && handleObj.selector ) ) { 11679 handlers.splice( j, 1 ); 11680 11681 if ( handleObj.selector ) { 11682 handlers.delegateCount--; 11683 } 11684 if ( special.remove ) { 11685 special.remove.call( elem, handleObj ); 11686 } 11687 } 11688 } 11689 11690 // Remove generic event handler if we removed something and no more handlers exist 11691 // (avoids potential for endless recursion during removal of special event handlers) 11692 if ( origCount && !handlers.length ) { 11693 if ( !special.teardown || 11694 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 11695 11696 jQuery.removeEvent( elem, type, elemData.handle ); 11697 } 11698 11699 delete events[ type ]; 11700 } 11701 } 11702 11703 // Remove data and the expando if it's no longer used 11704 if ( jQuery.isEmptyObject( events ) ) { 11705 dataPriv.remove( elem, "handle events" ); 11706 } 11707 }, 11708 11709 dispatch: function( nativeEvent ) { 11710 11711 var i, j, ret, matched, handleObj, handlerQueue, 11712 args = new Array( arguments.length ), 11713 11714 // Make a writable jQuery.Event from the native event object 11715 event = jQuery.event.fix( nativeEvent ), 11716 11717 handlers = ( 11718 dataPriv.get( this, "events" ) || Object.create( null ) 11719 )[ event.type ] || [], 11720 special = jQuery.event.special[ event.type ] || {}; 11721 11722 // Use the fix-ed jQuery.Event rather than the (read-only) native event 11723 args[ 0 ] = event; 11724 11725 for ( i = 1; i < arguments.length; i++ ) { 11726 args[ i ] = arguments[ i ]; 11727 } 11728 11729 event.delegateTarget = this; 11730 11731 // Call the preDispatch hook for the mapped type, and let it bail if desired 11732 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 11733 return; 11734 } 11735 11736 // Determine handlers 11737 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 11738 11739 // Run delegates first; they may want to stop propagation beneath us 11740 i = 0; 11741 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 11742 event.currentTarget = matched.elem; 11743 11744 j = 0; 11745 while ( ( handleObj = matched.handlers[ j++ ] ) && 11746 !event.isImmediatePropagationStopped() ) { 11747 11748 // If the event is namespaced, then each handler is only invoked if it is 11749 // specially universal or its namespaces are a superset of the event's. 11750 if ( !event.rnamespace || handleObj.namespace === false || 11751 event.rnamespace.test( handleObj.namespace ) ) { 11752 11753 event.handleObj = handleObj; 11754 event.data = handleObj.data; 11755 11756 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 11757 handleObj.handler ).apply( matched.elem, args ); 11758 11759 if ( ret !== undefined ) { 11760 if ( ( event.result = ret ) === false ) { 11761 event.preventDefault(); 11762 event.stopPropagation(); 11763 } 11764 } 11765 } 11766 } 11767 } 11768 11769 // Call the postDispatch hook for the mapped type 11770 if ( special.postDispatch ) { 11771 special.postDispatch.call( this, event ); 11772 } 11773 11774 return event.result; 11775 }, 11776 11777 handlers: function( event, handlers ) { 11778 var i, handleObj, sel, matchedHandlers, matchedSelectors, 11779 handlerQueue = [], 11780 delegateCount = handlers.delegateCount, 11781 cur = event.target; 11782 11783 // Find delegate handlers 11784 if ( delegateCount && 11785 11786 // Support: IE <=9 11787 // Black-hole SVG <use> instance trees (trac-13180) 11788 cur.nodeType && 11789 11790 // Support: Firefox <=42 11791 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 11792 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 11793 // Support: IE 11 only 11794 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 11795 !( event.type === "click" && event.button >= 1 ) ) { 11796 11797 for ( ; cur !== this; cur = cur.parentNode || this ) { 11798 11799 // Don't check non-elements (#13208) 11800 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 11801 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 11802 matchedHandlers = []; 11803 matchedSelectors = {}; 11804 for ( i = 0; i < delegateCount; i++ ) { 11805 handleObj = handlers[ i ]; 11806 11807 // Don't conflict with Object.prototype properties (#13203) 11808 sel = handleObj.selector + " "; 11809 11810 if ( matchedSelectors[ sel ] === undefined ) { 11811 matchedSelectors[ sel ] = handleObj.needsContext ? 11812 jQuery( sel, this ).index( cur ) > -1 : 11813 jQuery.find( sel, this, null, [ cur ] ).length; 11814 } 11815 if ( matchedSelectors[ sel ] ) { 11816 matchedHandlers.push( handleObj ); 11817 } 11818 } 11819 if ( matchedHandlers.length ) { 11820 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 11821 } 11822 } 11823 } 11824 } 11825 11826 // Add the remaining (directly-bound) handlers 11827 cur = this; 11828 if ( delegateCount < handlers.length ) { 11829 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 11830 } 11831 11832 return handlerQueue; 11833 }, 11834 11835 addProp: function( name, hook ) { 11836 Object.defineProperty( jQuery.Event.prototype, name, { 11837 enumerable: true, 11838 configurable: true, 11839 11840 get: isFunction( hook ) ? 11841 function() { 11842 if ( this.originalEvent ) { 11843 return hook( this.originalEvent ); 11844 } 11845 } : 11846 function() { 11847 if ( this.originalEvent ) { 11848 return this.originalEvent[ name ]; 11849 } 11850 }, 11851 11852 set: function( value ) { 11853 Object.defineProperty( this, name, { 11854 enumerable: true, 11855 configurable: true, 11856 writable: true, 11857 value: value 11858 } ); 11859 } 11860 } ); 11861 }, 11862 11863 fix: function( originalEvent ) { 11864 return originalEvent[ jQuery.expando ] ? 11865 originalEvent : 11866 new jQuery.Event( originalEvent ); 11867 }, 11868 11869 special: { 11870 load: { 11871 11872 // Prevent triggered image.load events from bubbling to window.load 11873 noBubble: true 11874 }, 11875 click: { 11876 11877 // Utilize native event to ensure correct state for checkable inputs 11878 setup: function( data ) { 11879 11880 // For mutual compressibility with _default, replace `this` access with a local var. 11881 // `|| data` is dead code meant only to preserve the variable through minification. 11882 var el = this || data; 11883 11884 // Claim the first handler 11885 if ( rcheckableType.test( el.type ) && 11886 el.click && nodeName( el, "input" ) ) { 11887 11888 // dataPriv.set( el, "click", ... ) 11889 leverageNative( el, "click", returnTrue ); 11890 } 11891 11892 // Return false to allow normal processing in the caller 11893 return false; 11894 }, 11895 trigger: function( data ) { 11896 11897 // For mutual compressibility with _default, replace `this` access with a local var. 11898 // `|| data` is dead code meant only to preserve the variable through minification. 11899 var el = this || data; 11900 11901 // Force setup before triggering a click 11902 if ( rcheckableType.test( el.type ) && 11903 el.click && nodeName( el, "input" ) ) { 11904 11905 leverageNative( el, "click" ); 11906 } 11907 11908 // Return non-false to allow normal event-path propagation 11909 return true; 11910 }, 11911 11912 // For cross-browser consistency, suppress native .click() on links 11913 // Also prevent it if we're currently inside a leveraged native-event stack 11914 _default: function( event ) { 11915 var target = event.target; 11916 return rcheckableType.test( target.type ) && 11917 target.click && nodeName( target, "input" ) && 11918 dataPriv.get( target, "click" ) || 11919 nodeName( target, "a" ); 11920 } 11921 }, 11922 11923 beforeunload: { 11924 postDispatch: function( event ) { 11925 11926 // Support: Firefox 20+ 11927 // Firefox doesn't alert if the returnValue field is not set. 11928 if ( event.result !== undefined && event.originalEvent ) { 11929 event.originalEvent.returnValue = event.result; 11930 } 11931 } 11932 } 11933 } 11934}; 11935 11936// Ensure the presence of an event listener that handles manually-triggered 11937// synthetic events by interrupting progress until reinvoked in response to 11938// *native* events that it fires directly, ensuring that state changes have 11939// already occurred before other listeners are invoked. 11940function leverageNative( el, type, expectSync ) { 11941 11942 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 11943 if ( !expectSync ) { 11944 if ( dataPriv.get( el, type ) === undefined ) { 11945 jQuery.event.add( el, type, returnTrue ); 11946 } 11947 return; 11948 } 11949 11950 // Register the controller as a special universal handler for all event namespaces 11951 dataPriv.set( el, type, false ); 11952 jQuery.event.add( el, type, { 11953 namespace: false, 11954 handler: function( event ) { 11955 var notAsync, result, 11956 saved = dataPriv.get( this, type ); 11957 11958 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 11959 11960 // Interrupt processing of the outer synthetic .trigger()ed event 11961 // Saved data should be false in such cases, but might be a leftover capture object 11962 // from an async native handler (gh-4350) 11963 if ( !saved.length ) { 11964 11965 // Store arguments for use when handling the inner native event 11966 // There will always be at least one argument (an event object), so this array 11967 // will not be confused with a leftover capture object. 11968 saved = slice.call( arguments ); 11969 dataPriv.set( this, type, saved ); 11970 11971 // Trigger the native event and capture its result 11972 // Support: IE <=9 - 11+ 11973 // focus() and blur() are asynchronous 11974 notAsync = expectSync( this, type ); 11975 this[ type ](); 11976 result = dataPriv.get( this, type ); 11977 if ( saved !== result || notAsync ) { 11978 dataPriv.set( this, type, false ); 11979 } else { 11980 result = {}; 11981 } 11982 if ( saved !== result ) { 11983 11984 // Cancel the outer synthetic event 11985 event.stopImmediatePropagation(); 11986 event.preventDefault(); 11987 return result.value; 11988 } 11989 11990 // If this is an inner synthetic event for an event with a bubbling surrogate 11991 // (focus or blur), assume that the surrogate already propagated from triggering the 11992 // native event and prevent that from happening again here. 11993 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 11994 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 11995 // less bad than duplication. 11996 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 11997 event.stopPropagation(); 11998 } 11999 12000 // If this is a native event triggered above, everything is now in order 12001 // Fire an inner synthetic event with the original arguments 12002 } else if ( saved.length ) { 12003 12004 // ...and capture the result 12005 dataPriv.set( this, type, { 12006 value: jQuery.event.trigger( 12007 12008 // Support: IE <=9 - 11+ 12009 // Extend with the prototype to reset the above stopImmediatePropagation() 12010 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 12011 saved.slice( 1 ), 12012 this 12013 ) 12014 } ); 12015 12016 // Abort handling of the native event 12017 event.stopImmediatePropagation(); 12018 } 12019 } 12020 } ); 12021} 12022 12023jQuery.removeEvent = function( elem, type, handle ) { 12024 12025 // This "if" is needed for plain objects 12026 if ( elem.removeEventListener ) { 12027 elem.removeEventListener( type, handle ); 12028 } 12029}; 12030 12031jQuery.Event = function( src, props ) { 12032 12033 // Allow instantiation without the 'new' keyword 12034 if ( !( this instanceof jQuery.Event ) ) { 12035 return new jQuery.Event( src, props ); 12036 } 12037 12038 // Event object 12039 if ( src && src.type ) { 12040 this.originalEvent = src; 12041 this.type = src.type; 12042 12043 // Events bubbling up the document may have been marked as prevented 12044 // by a handler lower down the tree; reflect the correct value. 12045 this.isDefaultPrevented = src.defaultPrevented || 12046 src.defaultPrevented === undefined && 12047 12048 // Support: Android <=2.3 only 12049 src.returnValue === false ? 12050 returnTrue : 12051 returnFalse; 12052 12053 // Create target properties 12054 // Support: Safari <=6 - 7 only 12055 // Target should not be a text node (#504, #13143) 12056 this.target = ( src.target && src.target.nodeType === 3 ) ? 12057 src.target.parentNode : 12058 src.target; 12059 12060 this.currentTarget = src.currentTarget; 12061 this.relatedTarget = src.relatedTarget; 12062 12063 // Event type 12064 } else { 12065 this.type = src; 12066 } 12067 12068 // Put explicitly provided properties onto the event object 12069 if ( props ) { 12070 jQuery.extend( this, props ); 12071 } 12072 12073 // Create a timestamp if incoming event doesn't have one 12074 this.timeStamp = src && src.timeStamp || Date.now(); 12075 12076 // Mark it as fixed 12077 this[ jQuery.expando ] = true; 12078}; 12079 12080// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 12081// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 12082jQuery.Event.prototype = { 12083 constructor: jQuery.Event, 12084 isDefaultPrevented: returnFalse, 12085 isPropagationStopped: returnFalse, 12086 isImmediatePropagationStopped: returnFalse, 12087 isSimulated: false, 12088 12089 preventDefault: function() { 12090 var e = this.originalEvent; 12091 12092 this.isDefaultPrevented = returnTrue; 12093 12094 if ( e && !this.isSimulated ) { 12095 e.preventDefault(); 12096 } 12097 }, 12098 stopPropagation: function() { 12099 var e = this.originalEvent; 12100 12101 this.isPropagationStopped = returnTrue; 12102 12103 if ( e && !this.isSimulated ) { 12104 e.stopPropagation(); 12105 } 12106 }, 12107 stopImmediatePropagation: function() { 12108 var e = this.originalEvent; 12109 12110 this.isImmediatePropagationStopped = returnTrue; 12111 12112 if ( e && !this.isSimulated ) { 12113 e.stopImmediatePropagation(); 12114 } 12115 12116 this.stopPropagation(); 12117 } 12118}; 12119 12120// Includes all common event props including KeyEvent and MouseEvent specific props 12121jQuery.each( { 12122 altKey: true, 12123 bubbles: true, 12124 cancelable: true, 12125 changedTouches: true, 12126 ctrlKey: true, 12127 detail: true, 12128 eventPhase: true, 12129 metaKey: true, 12130 pageX: true, 12131 pageY: true, 12132 shiftKey: true, 12133 view: true, 12134 "char": true, 12135 code: true, 12136 charCode: true, 12137 key: true, 12138 keyCode: true, 12139 button: true, 12140 buttons: true, 12141 clientX: true, 12142 clientY: true, 12143 offsetX: true, 12144 offsetY: true, 12145 pointerId: true, 12146 pointerType: true, 12147 screenX: true, 12148 screenY: true, 12149 targetTouches: true, 12150 toElement: true, 12151 touches: true, 12152 12153 which: function( event ) { 12154 var button = event.button; 12155 12156 // Add which for key events 12157 if ( event.which == null && rkeyEvent.test( event.type ) ) { 12158 return event.charCode != null ? event.charCode : event.keyCode; 12159 } 12160 12161 // Add which for click: 1 === left; 2 === middle; 3 === right 12162 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 12163 if ( button & 1 ) { 12164 return 1; 12165 } 12166 12167 if ( button & 2 ) { 12168 return 3; 12169 } 12170 12171 if ( button & 4 ) { 12172 return 2; 12173 } 12174 12175 return 0; 12176 } 12177 12178 return event.which; 12179 } 12180}, jQuery.event.addProp ); 12181 12182jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 12183 jQuery.event.special[ type ] = { 12184 12185 // Utilize native event if possible so blur/focus sequence is correct 12186 setup: function() { 12187 12188 // Claim the first handler 12189 // dataPriv.set( this, "focus", ... ) 12190 // dataPriv.set( this, "blur", ... ) 12191 leverageNative( this, type, expectSync ); 12192 12193 // Return false to allow normal processing in the caller 12194 return false; 12195 }, 12196 trigger: function() { 12197 12198 // Force setup before trigger 12199 leverageNative( this, type ); 12200 12201 // Return non-false to allow normal event-path propagation 12202 return true; 12203 }, 12204 12205 delegateType: delegateType 12206 }; 12207} ); 12208 12209// Create mouseenter/leave events using mouseover/out and event-time checks 12210// so that event delegation works in jQuery. 12211// Do the same for pointerenter/pointerleave and pointerover/pointerout 12212// 12213// Support: Safari 7 only 12214// Safari sends mouseenter too often; see: 12215// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 12216// for the description of the bug (it existed in older Chrome versions as well). 12217jQuery.each( { 12218 mouseenter: "mouseover", 12219 mouseleave: "mouseout", 12220 pointerenter: "pointerover", 12221 pointerleave: "pointerout" 12222}, function( orig, fix ) { 12223 jQuery.event.special[ orig ] = { 12224 delegateType: fix, 12225 bindType: fix, 12226 12227 handle: function( event ) { 12228 var ret, 12229 target = this, 12230 related = event.relatedTarget, 12231 handleObj = event.handleObj; 12232 12233 // For mouseenter/leave call the handler if related is outside the target. 12234 // NB: No relatedTarget if the mouse left/entered the browser window 12235 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 12236 event.type = handleObj.origType; 12237 ret = handleObj.handler.apply( this, arguments ); 12238 event.type = fix; 12239 } 12240 return ret; 12241 } 12242 }; 12243} ); 12244 12245jQuery.fn.extend( { 12246 12247 on: function( types, selector, data, fn ) { 12248 return on( this, types, selector, data, fn ); 12249 }, 12250 one: function( types, selector, data, fn ) { 12251 return on( this, types, selector, data, fn, 1 ); 12252 }, 12253 off: function( types, selector, fn ) { 12254 var handleObj, type; 12255 if ( types && types.preventDefault && types.handleObj ) { 12256 12257 // ( event ) dispatched jQuery.Event 12258 handleObj = types.handleObj; 12259 jQuery( types.delegateTarget ).off( 12260 handleObj.namespace ? 12261 handleObj.origType + "." + handleObj.namespace : 12262 handleObj.origType, 12263 handleObj.selector, 12264 handleObj.handler 12265 ); 12266 return this; 12267 } 12268 if ( typeof types === "object" ) { 12269 12270 // ( types-object [, selector] ) 12271 for ( type in types ) { 12272 this.off( type, selector, types[ type ] ); 12273 } 12274 return this; 12275 } 12276 if ( selector === false || typeof selector === "function" ) { 12277 12278 // ( types [, fn] ) 12279 fn = selector; 12280 selector = undefined; 12281 } 12282 if ( fn === false ) { 12283 fn = returnFalse; 12284 } 12285 return this.each( function() { 12286 jQuery.event.remove( this, types, fn, selector ); 12287 } ); 12288 } 12289} ); 12290 12291 12292var 12293 12294 // Support: IE <=10 - 11, Edge 12 - 13 only 12295 // In IE/Edge using regex groups here causes severe slowdowns. 12296 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 12297 rnoInnerhtml = /<script|<style|<link/i, 12298 12299 // checked="checked" or checked 12300 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 12301 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 12302 12303// Prefer a tbody over its parent table for containing new rows 12304function manipulationTarget( elem, content ) { 12305 if ( nodeName( elem, "table" ) && 12306 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 12307 12308 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 12309 } 12310 12311 return elem; 12312} 12313 12314// Replace/restore the type attribute of script elements for safe DOM manipulation 12315function disableScript( elem ) { 12316 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 12317 return elem; 12318} 12319function restoreScript( elem ) { 12320 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 12321 elem.type = elem.type.slice( 5 ); 12322 } else { 12323 elem.removeAttribute( "type" ); 12324 } 12325 12326 return elem; 12327} 12328 12329function cloneCopyEvent( src, dest ) { 12330 var i, l, type, pdataOld, udataOld, udataCur, events; 12331 12332 if ( dest.nodeType !== 1 ) { 12333 return; 12334 } 12335 12336 // 1. Copy private data: events, handlers, etc. 12337 if ( dataPriv.hasData( src ) ) { 12338 pdataOld = dataPriv.get( src ); 12339 events = pdataOld.events; 12340 12341 if ( events ) { 12342 dataPriv.remove( dest, "handle events" ); 12343 12344 for ( type in events ) { 12345 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 12346 jQuery.event.add( dest, type, events[ type ][ i ] ); 12347 } 12348 } 12349 } 12350 } 12351 12352 // 2. Copy user data 12353 if ( dataUser.hasData( src ) ) { 12354 udataOld = dataUser.access( src ); 12355 udataCur = jQuery.extend( {}, udataOld ); 12356 12357 dataUser.set( dest, udataCur ); 12358 } 12359} 12360 12361// Fix IE bugs, see support tests 12362function fixInput( src, dest ) { 12363 var nodeName = dest.nodeName.toLowerCase(); 12364 12365 // Fails to persist the checked state of a cloned checkbox or radio button. 12366 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 12367 dest.checked = src.checked; 12368 12369 // Fails to return the selected option to the default selected state when cloning options 12370 } else if ( nodeName === "input" || nodeName === "textarea" ) { 12371 dest.defaultValue = src.defaultValue; 12372 } 12373} 12374 12375function domManip( collection, args, callback, ignored ) { 12376 12377 // Flatten any nested arrays 12378 args = flat( args ); 12379 12380 var fragment, first, scripts, hasScripts, node, doc, 12381 i = 0, 12382 l = collection.length, 12383 iNoClone = l - 1, 12384 value = args[ 0 ], 12385 valueIsFunction = isFunction( value ); 12386 12387 // We can't cloneNode fragments that contain checked, in WebKit 12388 if ( valueIsFunction || 12389 ( l > 1 && typeof value === "string" && 12390 !support.checkClone && rchecked.test( value ) ) ) { 12391 return collection.each( function( index ) { 12392 var self = collection.eq( index ); 12393 if ( valueIsFunction ) { 12394 args[ 0 ] = value.call( this, index, self.html() ); 12395 } 12396 domManip( self, args, callback, ignored ); 12397 } ); 12398 } 12399 12400 if ( l ) { 12401 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 12402 first = fragment.firstChild; 12403 12404 if ( fragment.childNodes.length === 1 ) { 12405 fragment = first; 12406 } 12407 12408 // Require either new content or an interest in ignored elements to invoke the callback 12409 if ( first || ignored ) { 12410 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 12411 hasScripts = scripts.length; 12412 12413 // Use the original fragment for the last item 12414 // instead of the first because it can end up 12415 // being emptied incorrectly in certain situations (#8070). 12416 for ( ; i < l; i++ ) { 12417 node = fragment; 12418 12419 if ( i !== iNoClone ) { 12420 node = jQuery.clone( node, true, true ); 12421 12422 // Keep references to cloned scripts for later restoration 12423 if ( hasScripts ) { 12424 12425 // Support: Android <=4.0 only, PhantomJS 1 only 12426 // push.apply(_, arraylike) throws on ancient WebKit 12427 jQuery.merge( scripts, getAll( node, "script" ) ); 12428 } 12429 } 12430 12431 callback.call( collection[ i ], node, i ); 12432 } 12433 12434 if ( hasScripts ) { 12435 doc = scripts[ scripts.length - 1 ].ownerDocument; 12436 12437 // Reenable scripts 12438 jQuery.map( scripts, restoreScript ); 12439 12440 // Evaluate executable scripts on first document insertion 12441 for ( i = 0; i < hasScripts; i++ ) { 12442 node = scripts[ i ]; 12443 if ( rscriptType.test( node.type || "" ) && 12444 !dataPriv.access( node, "globalEval" ) && 12445 jQuery.contains( doc, node ) ) { 12446 12447 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 12448 12449 // Optional AJAX dependency, but won't run scripts if not present 12450 if ( jQuery._evalUrl && !node.noModule ) { 12451 jQuery._evalUrl( node.src, { 12452 nonce: node.nonce || node.getAttribute( "nonce" ) 12453 }, doc ); 12454 } 12455 } else { 12456 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 12457 } 12458 } 12459 } 12460 } 12461 } 12462 } 12463 12464 return collection; 12465} 12466 12467function remove( elem, selector, keepData ) { 12468 var node, 12469 nodes = selector ? jQuery.filter( selector, elem ) : elem, 12470 i = 0; 12471 12472 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 12473 if ( !keepData && node.nodeType === 1 ) { 12474 jQuery.cleanData( getAll( node ) ); 12475 } 12476 12477 if ( node.parentNode ) { 12478 if ( keepData && isAttached( node ) ) { 12479 setGlobalEval( getAll( node, "script" ) ); 12480 } 12481 node.parentNode.removeChild( node ); 12482 } 12483 } 12484 12485 return elem; 12486} 12487 12488jQuery.extend( { 12489 htmlPrefilter: function( html ) { 12490 return html; 12491 }, 12492 12493 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 12494 var i, l, srcElements, destElements, 12495 clone = elem.cloneNode( true ), 12496 inPage = isAttached( elem ); 12497 12498 // Fix IE cloning issues 12499 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 12500 !jQuery.isXMLDoc( elem ) ) { 12501 12502 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 12503 destElements = getAll( clone ); 12504 srcElements = getAll( elem ); 12505 12506 for ( i = 0, l = srcElements.length; i < l; i++ ) { 12507 fixInput( srcElements[ i ], destElements[ i ] ); 12508 } 12509 } 12510 12511 // Copy the events from the original to the clone 12512 if ( dataAndEvents ) { 12513 if ( deepDataAndEvents ) { 12514 srcElements = srcElements || getAll( elem ); 12515 destElements = destElements || getAll( clone ); 12516 12517 for ( i = 0, l = srcElements.length; i < l; i++ ) { 12518 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 12519 } 12520 } else { 12521 cloneCopyEvent( elem, clone ); 12522 } 12523 } 12524 12525 // Preserve script evaluation history 12526 destElements = getAll( clone, "script" ); 12527 if ( destElements.length > 0 ) { 12528 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 12529 } 12530 12531 // Return the cloned set 12532 return clone; 12533 }, 12534 12535 cleanData: function( elems ) { 12536 var data, elem, type, 12537 special = jQuery.event.special, 12538 i = 0; 12539 12540 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 12541 if ( acceptData( elem ) ) { 12542 if ( ( data = elem[ dataPriv.expando ] ) ) { 12543 if ( data.events ) { 12544 for ( type in data.events ) { 12545 if ( special[ type ] ) { 12546 jQuery.event.remove( elem, type ); 12547 12548 // This is a shortcut to avoid jQuery.event.remove's overhead 12549 } else { 12550 jQuery.removeEvent( elem, type, data.handle ); 12551 } 12552 } 12553 } 12554 12555 // Support: Chrome <=35 - 45+ 12556 // Assign undefined instead of using delete, see Data#remove 12557 elem[ dataPriv.expando ] = undefined; 12558 } 12559 if ( elem[ dataUser.expando ] ) { 12560 12561 // Support: Chrome <=35 - 45+ 12562 // Assign undefined instead of using delete, see Data#remove 12563 elem[ dataUser.expando ] = undefined; 12564 } 12565 } 12566 } 12567 } 12568} ); 12569 12570jQuery.fn.extend( { 12571 detach: function( selector ) { 12572 return remove( this, selector, true ); 12573 }, 12574 12575 remove: function( selector ) { 12576 return remove( this, selector ); 12577 }, 12578 12579 text: function( value ) { 12580 return access( this, function( value ) { 12581 return value === undefined ? 12582 jQuery.text( this ) : 12583 this.empty().each( function() { 12584 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 12585 this.textContent = value; 12586 } 12587 } ); 12588 }, null, value, arguments.length ); 12589 }, 12590 12591 append: function() { 12592 return domManip( this, arguments, function( elem ) { 12593 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 12594 var target = manipulationTarget( this, elem ); 12595 target.appendChild( elem ); 12596 } 12597 } ); 12598 }, 12599 12600 prepend: function() { 12601 return domManip( this, arguments, function( elem ) { 12602 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 12603 var target = manipulationTarget( this, elem ); 12604 target.insertBefore( elem, target.firstChild ); 12605 } 12606 } ); 12607 }, 12608 12609 before: function() { 12610 return domManip( this, arguments, function( elem ) { 12611 if ( this.parentNode ) { 12612 this.parentNode.insertBefore( elem, this ); 12613 } 12614 } ); 12615 }, 12616 12617 after: function() { 12618 return domManip( this, arguments, function( elem ) { 12619 if ( this.parentNode ) { 12620 this.parentNode.insertBefore( elem, this.nextSibling ); 12621 } 12622 } ); 12623 }, 12624 12625 empty: function() { 12626 var elem, 12627 i = 0; 12628 12629 for ( ; ( elem = this[ i ] ) != null; i++ ) { 12630 if ( elem.nodeType === 1 ) { 12631 12632 // Prevent memory leaks 12633 jQuery.cleanData( getAll( elem, false ) ); 12634 12635 // Remove any remaining nodes 12636 elem.textContent = ""; 12637 } 12638 } 12639 12640 return this; 12641 }, 12642 12643 clone: function( dataAndEvents, deepDataAndEvents ) { 12644 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 12645 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 12646 12647 return this.map( function() { 12648 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 12649 } ); 12650 }, 12651 12652 html: function( value ) { 12653 return access( this, function( value ) { 12654 var elem = this[ 0 ] || {}, 12655 i = 0, 12656 l = this.length; 12657 12658 if ( value === undefined && elem.nodeType === 1 ) { 12659 return elem.innerHTML; 12660 } 12661 12662 // See if we can take a shortcut and just use innerHTML 12663 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 12664 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 12665 12666 value = jQuery.htmlPrefilter( value ); 12667 12668 try { 12669 for ( ; i < l; i++ ) { 12670 elem = this[ i ] || {}; 12671 12672 // Remove element nodes and prevent memory leaks 12673 if ( elem.nodeType === 1 ) { 12674 jQuery.cleanData( getAll( elem, false ) ); 12675 elem.innerHTML = value; 12676 } 12677 } 12678 12679 elem = 0; 12680 12681 // If using innerHTML throws an exception, use the fallback method 12682 } catch ( e ) {} 12683 } 12684 12685 if ( elem ) { 12686 this.empty().append( value ); 12687 } 12688 }, null, value, arguments.length ); 12689 }, 12690 12691 replaceWith: function() { 12692 var ignored = []; 12693 12694 // Make the changes, replacing each non-ignored context element with the new content 12695 return domManip( this, arguments, function( elem ) { 12696 var parent = this.parentNode; 12697 12698 if ( jQuery.inArray( this, ignored ) < 0 ) { 12699 jQuery.cleanData( getAll( this ) ); 12700 if ( parent ) { 12701 parent.replaceChild( elem, this ); 12702 } 12703 } 12704 12705 // Force callback invocation 12706 }, ignored ); 12707 } 12708} ); 12709 12710jQuery.each( { 12711 appendTo: "append", 12712 prependTo: "prepend", 12713 insertBefore: "before", 12714 insertAfter: "after", 12715 replaceAll: "replaceWith" 12716}, function( name, original ) { 12717 jQuery.fn[ name ] = function( selector ) { 12718 var elems, 12719 ret = [], 12720 insert = jQuery( selector ), 12721 last = insert.length - 1, 12722 i = 0; 12723 12724 for ( ; i <= last; i++ ) { 12725 elems = i === last ? this : this.clone( true ); 12726 jQuery( insert[ i ] )[ original ]( elems ); 12727 12728 // Support: Android <=4.0 only, PhantomJS 1 only 12729 // .get() because push.apply(_, arraylike) throws on ancient WebKit 12730 push.apply( ret, elems.get() ); 12731 } 12732 12733 return this.pushStack( ret ); 12734 }; 12735} ); 12736var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 12737 12738var getStyles = function( elem ) { 12739 12740 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 12741 // IE throws on elements created in popups 12742 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 12743 var view = elem.ownerDocument.defaultView; 12744 12745 if ( !view || !view.opener ) { 12746 view = window; 12747 } 12748 12749 return view.getComputedStyle( elem ); 12750 }; 12751 12752var swap = function( elem, options, callback ) { 12753 var ret, name, 12754 old = {}; 12755 12756 // Remember the old values, and insert the new ones 12757 for ( name in options ) { 12758 old[ name ] = elem.style[ name ]; 12759 elem.style[ name ] = options[ name ]; 12760 } 12761 12762 ret = callback.call( elem ); 12763 12764 // Revert the old values 12765 for ( name in options ) { 12766 elem.style[ name ] = old[ name ]; 12767 } 12768 12769 return ret; 12770}; 12771 12772 12773var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 12774 12775 12776 12777( function() { 12778 12779 // Executing both pixelPosition & boxSizingReliable tests require only one layout 12780 // so they're executed at the same time to save the second computation. 12781 function computeStyleTests() { 12782 12783 // This is a singleton, we need to execute it only once 12784 if ( !div ) { 12785 return; 12786 } 12787 12788 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 12789 "margin-top:1px;padding:0;border:0"; 12790 div.style.cssText = 12791 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 12792 "margin:auto;border:1px;padding:1px;" + 12793 "width:60%;top:1%"; 12794 documentElement.appendChild( container ).appendChild( div ); 12795 12796 var divStyle = window.getComputedStyle( div ); 12797 pixelPositionVal = divStyle.top !== "1%"; 12798 12799 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 12800 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 12801 12802 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 12803 // Some styles come back with percentage values, even though they shouldn't 12804 div.style.right = "60%"; 12805 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 12806 12807 // Support: IE 9 - 11 only 12808 // Detect misreporting of content dimensions for box-sizing:border-box elements 12809 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 12810 12811 // Support: IE 9 only 12812 // Detect overflow:scroll screwiness (gh-3699) 12813 // Support: Chrome <=64 12814 // Don't get tricked when zoom affects offsetWidth (gh-4029) 12815 div.style.position = "absolute"; 12816 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 12817 12818 documentElement.removeChild( container ); 12819 12820 // Nullify the div so it wouldn't be stored in the memory and 12821 // it will also be a sign that checks already performed 12822 div = null; 12823 } 12824 12825 function roundPixelMeasures( measure ) { 12826 return Math.round( parseFloat( measure ) ); 12827 } 12828 12829 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 12830 reliableTrDimensionsVal, reliableMarginLeftVal, 12831 container = document.createElement( "div" ), 12832 div = document.createElement( "div" ); 12833 12834 // Finish early in limited (non-browser) environments 12835 if ( !div.style ) { 12836 return; 12837 } 12838 12839 // Support: IE <=9 - 11 only 12840 // Style of cloned element affects source element cloned (#8908) 12841 div.style.backgroundClip = "content-box"; 12842 div.cloneNode( true ).style.backgroundClip = ""; 12843 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 12844 12845 jQuery.extend( support, { 12846 boxSizingReliable: function() { 12847 computeStyleTests(); 12848 return boxSizingReliableVal; 12849 }, 12850 pixelBoxStyles: function() { 12851 computeStyleTests(); 12852 return pixelBoxStylesVal; 12853 }, 12854 pixelPosition: function() { 12855 computeStyleTests(); 12856 return pixelPositionVal; 12857 }, 12858 reliableMarginLeft: function() { 12859 computeStyleTests(); 12860 return reliableMarginLeftVal; 12861 }, 12862 scrollboxSize: function() { 12863 computeStyleTests(); 12864 return scrollboxSizeVal; 12865 }, 12866 12867 // Support: IE 9 - 11+, Edge 15 - 18+ 12868 // IE/Edge misreport `getComputedStyle` of table rows with width/height 12869 // set in CSS while `offset*` properties report correct values. 12870 // Behavior in IE 9 is more subtle than in newer versions & it passes 12871 // some versions of this test; make sure not to make it pass there! 12872 reliableTrDimensions: function() { 12873 var table, tr, trChild, trStyle; 12874 if ( reliableTrDimensionsVal == null ) { 12875 table = document.createElement( "table" ); 12876 tr = document.createElement( "tr" ); 12877 trChild = document.createElement( "div" ); 12878 12879 table.style.cssText = "position:absolute;left:-11111px"; 12880 tr.style.height = "1px"; 12881 trChild.style.height = "9px"; 12882 12883 documentElement 12884 .appendChild( table ) 12885 .appendChild( tr ) 12886 .appendChild( trChild ); 12887 12888 trStyle = window.getComputedStyle( tr ); 12889 reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; 12890 12891 documentElement.removeChild( table ); 12892 } 12893 return reliableTrDimensionsVal; 12894 } 12895 } ); 12896} )(); 12897 12898 12899function curCSS( elem, name, computed ) { 12900 var width, minWidth, maxWidth, ret, 12901 12902 // Support: Firefox 51+ 12903 // Retrieving style before computed somehow 12904 // fixes an issue with getting wrong values 12905 // on detached elements 12906 style = elem.style; 12907 12908 computed = computed || getStyles( elem ); 12909 12910 // getPropertyValue is needed for: 12911 // .css('filter') (IE 9 only, #12537) 12912 // .css('--customProperty) (#3144) 12913 if ( computed ) { 12914 ret = computed.getPropertyValue( name ) || computed[ name ]; 12915 12916 if ( ret === "" && !isAttached( elem ) ) { 12917 ret = jQuery.style( elem, name ); 12918 } 12919 12920 // A tribute to the "awesome hack by Dean Edwards" 12921 // Android Browser returns percentage for some values, 12922 // but width seems to be reliably pixels. 12923 // This is against the CSSOM draft spec: 12924 // https://drafts.csswg.org/cssom/#resolved-values 12925 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 12926 12927 // Remember the original values 12928 width = style.width; 12929 minWidth = style.minWidth; 12930 maxWidth = style.maxWidth; 12931 12932 // Put in the new values to get a computed value out 12933 style.minWidth = style.maxWidth = style.width = ret; 12934 ret = computed.width; 12935 12936 // Revert the changed values 12937 style.width = width; 12938 style.minWidth = minWidth; 12939 style.maxWidth = maxWidth; 12940 } 12941 } 12942 12943 return ret !== undefined ? 12944 12945 // Support: IE <=9 - 11 only 12946 // IE returns zIndex value as an integer. 12947 ret + "" : 12948 ret; 12949} 12950 12951 12952function addGetHookIf( conditionFn, hookFn ) { 12953 12954 // Define the hook, we'll check on the first run if it's really needed. 12955 return { 12956 get: function() { 12957 if ( conditionFn() ) { 12958 12959 // Hook not needed (or it's not possible to use it due 12960 // to missing dependency), remove it. 12961 delete this.get; 12962 return; 12963 } 12964 12965 // Hook needed; redefine it so that the support test is not executed again. 12966 return ( this.get = hookFn ).apply( this, arguments ); 12967 } 12968 }; 12969} 12970 12971 12972var cssPrefixes = [ "Webkit", "Moz", "ms" ], 12973 emptyStyle = document.createElement( "div" ).style, 12974 vendorProps = {}; 12975 12976// Return a vendor-prefixed property or undefined 12977function vendorPropName( name ) { 12978 12979 // Check for vendor prefixed names 12980 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 12981 i = cssPrefixes.length; 12982 12983 while ( i-- ) { 12984 name = cssPrefixes[ i ] + capName; 12985 if ( name in emptyStyle ) { 12986 return name; 12987 } 12988 } 12989} 12990 12991// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 12992function finalPropName( name ) { 12993 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 12994 12995 if ( final ) { 12996 return final; 12997 } 12998 if ( name in emptyStyle ) { 12999 return name; 13000 } 13001 return vendorProps[ name ] = vendorPropName( name ) || name; 13002} 13003 13004 13005var 13006 13007 // Swappable if display is none or starts with table 13008 // except "table", "table-cell", or "table-caption" 13009 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 13010 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 13011 rcustomProp = /^--/, 13012 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 13013 cssNormalTransform = { 13014 letterSpacing: "0", 13015 fontWeight: "400" 13016 }; 13017 13018function setPositiveNumber( _elem, value, subtract ) { 13019 13020 // Any relative (+/-) values have already been 13021 // normalized at this point 13022 var matches = rcssNum.exec( value ); 13023 return matches ? 13024 13025 // Guard against undefined "subtract", e.g., when used as in cssHooks 13026 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 13027 value; 13028} 13029 13030function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 13031 var i = dimension === "width" ? 1 : 0, 13032 extra = 0, 13033 delta = 0; 13034 13035 // Adjustment may not be necessary 13036 if ( box === ( isBorderBox ? "border" : "content" ) ) { 13037 return 0; 13038 } 13039 13040 for ( ; i < 4; i += 2 ) { 13041 13042 // Both box models exclude margin 13043 if ( box === "margin" ) { 13044 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 13045 } 13046 13047 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 13048 if ( !isBorderBox ) { 13049 13050 // Add padding 13051 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 13052 13053 // For "border" or "margin", add border 13054 if ( box !== "padding" ) { 13055 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 13056 13057 // But still keep track of it otherwise 13058 } else { 13059 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 13060 } 13061 13062 // If we get here with a border-box (content + padding + border), we're seeking "content" or 13063 // "padding" or "margin" 13064 } else { 13065 13066 // For "content", subtract padding 13067 if ( box === "content" ) { 13068 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 13069 } 13070 13071 // For "content" or "padding", subtract border 13072 if ( box !== "margin" ) { 13073 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 13074 } 13075 } 13076 } 13077 13078 // Account for positive content-box scroll gutter when requested by providing computedVal 13079 if ( !isBorderBox && computedVal >= 0 ) { 13080 13081 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 13082 // Assuming integer scroll gutter, subtract the rest and round down 13083 delta += Math.max( 0, Math.ceil( 13084 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 13085 computedVal - 13086 delta - 13087 extra - 13088 0.5 13089 13090 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 13091 // Use an explicit zero to avoid NaN (gh-3964) 13092 ) ) || 0; 13093 } 13094 13095 return delta; 13096} 13097 13098function getWidthOrHeight( elem, dimension, extra ) { 13099 13100 // Start with computed style 13101 var styles = getStyles( elem ), 13102 13103 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 13104 // Fake content-box until we know it's needed to know the true value. 13105 boxSizingNeeded = !support.boxSizingReliable() || extra, 13106 isBorderBox = boxSizingNeeded && 13107 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 13108 valueIsBorderBox = isBorderBox, 13109 13110 val = curCSS( elem, dimension, styles ), 13111 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 13112 13113 // Support: Firefox <=54 13114 // Return a confounding non-pixel value or feign ignorance, as appropriate. 13115 if ( rnumnonpx.test( val ) ) { 13116 if ( !extra ) { 13117 return val; 13118 } 13119 val = "auto"; 13120 } 13121 13122 13123 // Support: IE 9 - 11 only 13124 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 13125 // In those cases, the computed value can be trusted to be border-box. 13126 if ( ( !support.boxSizingReliable() && isBorderBox || 13127 13128 // Support: IE 10 - 11+, Edge 15 - 18+ 13129 // IE/Edge misreport `getComputedStyle` of table rows with width/height 13130 // set in CSS while `offset*` properties report correct values. 13131 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 13132 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 13133 13134 // Fall back to offsetWidth/offsetHeight when value is "auto" 13135 // This happens for inline elements with no explicit setting (gh-3571) 13136 val === "auto" || 13137 13138 // Support: Android <=4.1 - 4.3 only 13139 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 13140 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 13141 13142 // Make sure the element is visible & connected 13143 elem.getClientRects().length ) { 13144 13145 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 13146 13147 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 13148 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 13149 // retrieved value as a content box dimension. 13150 valueIsBorderBox = offsetProp in elem; 13151 if ( valueIsBorderBox ) { 13152 val = elem[ offsetProp ]; 13153 } 13154 } 13155 13156 // Normalize "" and auto 13157 val = parseFloat( val ) || 0; 13158 13159 // Adjust for the element's box model 13160 return ( val + 13161 boxModelAdjustment( 13162 elem, 13163 dimension, 13164 extra || ( isBorderBox ? "border" : "content" ), 13165 valueIsBorderBox, 13166 styles, 13167 13168 // Provide the current computed size to request scroll gutter calculation (gh-3589) 13169 val 13170 ) 13171 ) + "px"; 13172} 13173 13174jQuery.extend( { 13175 13176 // Add in style property hooks for overriding the default 13177 // behavior of getting and setting a style property 13178 cssHooks: { 13179 opacity: { 13180 get: function( elem, computed ) { 13181 if ( computed ) { 13182 13183 // We should always get a number back from opacity 13184 var ret = curCSS( elem, "opacity" ); 13185 return ret === "" ? "1" : ret; 13186 } 13187 } 13188 } 13189 }, 13190 13191 // Don't automatically add "px" to these possibly-unitless properties 13192 cssNumber: { 13193 "animationIterationCount": true, 13194 "columnCount": true, 13195 "fillOpacity": true, 13196 "flexGrow": true, 13197 "flexShrink": true, 13198 "fontWeight": true, 13199 "gridArea": true, 13200 "gridColumn": true, 13201 "gridColumnEnd": true, 13202 "gridColumnStart": true, 13203 "gridRow": true, 13204 "gridRowEnd": true, 13205 "gridRowStart": true, 13206 "lineHeight": true, 13207 "opacity": true, 13208 "order": true, 13209 "orphans": true, 13210 "widows": true, 13211 "zIndex": true, 13212 "zoom": true 13213 }, 13214 13215 // Add in properties whose names you wish to fix before 13216 // setting or getting the value 13217 cssProps: {}, 13218 13219 // Get and set the style property on a DOM Node 13220 style: function( elem, name, value, extra ) { 13221 13222 // Don't set styles on text and comment nodes 13223 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 13224 return; 13225 } 13226 13227 // Make sure that we're working with the right name 13228 var ret, type, hooks, 13229 origName = camelCase( name ), 13230 isCustomProp = rcustomProp.test( name ), 13231 style = elem.style; 13232 13233 // Make sure that we're working with the right name. We don't 13234 // want to query the value if it is a CSS custom property 13235 // since they are user-defined. 13236 if ( !isCustomProp ) { 13237 name = finalPropName( origName ); 13238 } 13239 13240 // Gets hook for the prefixed version, then unprefixed version 13241 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 13242 13243 // Check if we're setting a value 13244 if ( value !== undefined ) { 13245 type = typeof value; 13246 13247 // Convert "+=" or "-=" to relative numbers (#7345) 13248 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 13249 value = adjustCSS( elem, name, ret ); 13250 13251 // Fixes bug #9237 13252 type = "number"; 13253 } 13254 13255 // Make sure that null and NaN values aren't set (#7116) 13256 if ( value == null || value !== value ) { 13257 return; 13258 } 13259 13260 // If a number was passed in, add the unit (except for certain CSS properties) 13261 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 13262 // "px" to a few hardcoded values. 13263 if ( type === "number" && !isCustomProp ) { 13264 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 13265 } 13266 13267 // background-* props affect original clone's values 13268 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 13269 style[ name ] = "inherit"; 13270 } 13271 13272 // If a hook was provided, use that value, otherwise just set the specified value 13273 if ( !hooks || !( "set" in hooks ) || 13274 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 13275 13276 if ( isCustomProp ) { 13277 style.setProperty( name, value ); 13278 } else { 13279 style[ name ] = value; 13280 } 13281 } 13282 13283 } else { 13284 13285 // If a hook was provided get the non-computed value from there 13286 if ( hooks && "get" in hooks && 13287 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 13288 13289 return ret; 13290 } 13291 13292 // Otherwise just get the value from the style object 13293 return style[ name ]; 13294 } 13295 }, 13296 13297 css: function( elem, name, extra, styles ) { 13298 var val, num, hooks, 13299 origName = camelCase( name ), 13300 isCustomProp = rcustomProp.test( name ); 13301 13302 // Make sure that we're working with the right name. We don't 13303 // want to modify the value if it is a CSS custom property 13304 // since they are user-defined. 13305 if ( !isCustomProp ) { 13306 name = finalPropName( origName ); 13307 } 13308 13309 // Try prefixed name followed by the unprefixed name 13310 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 13311 13312 // If a hook was provided get the computed value from there 13313 if ( hooks && "get" in hooks ) { 13314 val = hooks.get( elem, true, extra ); 13315 } 13316 13317 // Otherwise, if a way to get the computed value exists, use that 13318 if ( val === undefined ) { 13319 val = curCSS( elem, name, styles ); 13320 } 13321 13322 // Convert "normal" to computed value 13323 if ( val === "normal" && name in cssNormalTransform ) { 13324 val = cssNormalTransform[ name ]; 13325 } 13326 13327 // Make numeric if forced or a qualifier was provided and val looks numeric 13328 if ( extra === "" || extra ) { 13329 num = parseFloat( val ); 13330 return extra === true || isFinite( num ) ? num || 0 : val; 13331 } 13332 13333 return val; 13334 } 13335} ); 13336 13337jQuery.each( [ "height", "width" ], function( _i, dimension ) { 13338 jQuery.cssHooks[ dimension ] = { 13339 get: function( elem, computed, extra ) { 13340 if ( computed ) { 13341 13342 // Certain elements can have dimension info if we invisibly show them 13343 // but it must have a current display style that would benefit 13344 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 13345 13346 // Support: Safari 8+ 13347 // Table columns in Safari have non-zero offsetWidth & zero 13348 // getBoundingClientRect().width unless display is changed. 13349 // Support: IE <=11 only 13350 // Running getBoundingClientRect on a disconnected node 13351 // in IE throws an error. 13352 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 13353 swap( elem, cssShow, function() { 13354 return getWidthOrHeight( elem, dimension, extra ); 13355 } ) : 13356 getWidthOrHeight( elem, dimension, extra ); 13357 } 13358 }, 13359 13360 set: function( elem, value, extra ) { 13361 var matches, 13362 styles = getStyles( elem ), 13363 13364 // Only read styles.position if the test has a chance to fail 13365 // to avoid forcing a reflow. 13366 scrollboxSizeBuggy = !support.scrollboxSize() && 13367 styles.position === "absolute", 13368 13369 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 13370 boxSizingNeeded = scrollboxSizeBuggy || extra, 13371 isBorderBox = boxSizingNeeded && 13372 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 13373 subtract = extra ? 13374 boxModelAdjustment( 13375 elem, 13376 dimension, 13377 extra, 13378 isBorderBox, 13379 styles 13380 ) : 13381 0; 13382 13383 // Account for unreliable border-box dimensions by comparing offset* to computed and 13384 // faking a content-box to get border and padding (gh-3699) 13385 if ( isBorderBox && scrollboxSizeBuggy ) { 13386 subtract -= Math.ceil( 13387 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 13388 parseFloat( styles[ dimension ] ) - 13389 boxModelAdjustment( elem, dimension, "border", false, styles ) - 13390 0.5 13391 ); 13392 } 13393 13394 // Convert to pixels if value adjustment is needed 13395 if ( subtract && ( matches = rcssNum.exec( value ) ) && 13396 ( matches[ 3 ] || "px" ) !== "px" ) { 13397 13398 elem.style[ dimension ] = value; 13399 value = jQuery.css( elem, dimension ); 13400 } 13401 13402 return setPositiveNumber( elem, value, subtract ); 13403 } 13404 }; 13405} ); 13406 13407jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 13408 function( elem, computed ) { 13409 if ( computed ) { 13410 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 13411 elem.getBoundingClientRect().left - 13412 swap( elem, { marginLeft: 0 }, function() { 13413 return elem.getBoundingClientRect().left; 13414 } ) 13415 ) + "px"; 13416 } 13417 } 13418); 13419 13420// These hooks are used by animate to expand properties 13421jQuery.each( { 13422 margin: "", 13423 padding: "", 13424 border: "Width" 13425}, function( prefix, suffix ) { 13426 jQuery.cssHooks[ prefix + suffix ] = { 13427 expand: function( value ) { 13428 var i = 0, 13429 expanded = {}, 13430 13431 // Assumes a single number if not a string 13432 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 13433 13434 for ( ; i < 4; i++ ) { 13435 expanded[ prefix + cssExpand[ i ] + suffix ] = 13436 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 13437 } 13438 13439 return expanded; 13440 } 13441 }; 13442 13443 if ( prefix !== "margin" ) { 13444 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 13445 } 13446} ); 13447 13448jQuery.fn.extend( { 13449 css: function( name, value ) { 13450 return access( this, function( elem, name, value ) { 13451 var styles, len, 13452 map = {}, 13453 i = 0; 13454 13455 if ( Array.isArray( name ) ) { 13456 styles = getStyles( elem ); 13457 len = name.length; 13458 13459 for ( ; i < len; i++ ) { 13460 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 13461 } 13462 13463 return map; 13464 } 13465 13466 return value !== undefined ? 13467 jQuery.style( elem, name, value ) : 13468 jQuery.css( elem, name ); 13469 }, name, value, arguments.length > 1 ); 13470 } 13471} ); 13472 13473 13474function Tween( elem, options, prop, end, easing ) { 13475 return new Tween.prototype.init( elem, options, prop, end, easing ); 13476} 13477jQuery.Tween = Tween; 13478 13479Tween.prototype = { 13480 constructor: Tween, 13481 init: function( elem, options, prop, end, easing, unit ) { 13482 this.elem = elem; 13483 this.prop = prop; 13484 this.easing = easing || jQuery.easing._default; 13485 this.options = options; 13486 this.start = this.now = this.cur(); 13487 this.end = end; 13488 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 13489 }, 13490 cur: function() { 13491 var hooks = Tween.propHooks[ this.prop ]; 13492 13493 return hooks && hooks.get ? 13494 hooks.get( this ) : 13495 Tween.propHooks._default.get( this ); 13496 }, 13497 run: function( percent ) { 13498 var eased, 13499 hooks = Tween.propHooks[ this.prop ]; 13500 13501 if ( this.options.duration ) { 13502 this.pos = eased = jQuery.easing[ this.easing ]( 13503 percent, this.options.duration * percent, 0, 1, this.options.duration 13504 ); 13505 } else { 13506 this.pos = eased = percent; 13507 } 13508 this.now = ( this.end - this.start ) * eased + this.start; 13509 13510 if ( this.options.step ) { 13511 this.options.step.call( this.elem, this.now, this ); 13512 } 13513 13514 if ( hooks && hooks.set ) { 13515 hooks.set( this ); 13516 } else { 13517 Tween.propHooks._default.set( this ); 13518 } 13519 return this; 13520 } 13521}; 13522 13523Tween.prototype.init.prototype = Tween.prototype; 13524 13525Tween.propHooks = { 13526 _default: { 13527 get: function( tween ) { 13528 var result; 13529 13530 // Use a property on the element directly when it is not a DOM element, 13531 // or when there is no matching style property that exists. 13532 if ( tween.elem.nodeType !== 1 || 13533 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 13534 return tween.elem[ tween.prop ]; 13535 } 13536 13537 // Passing an empty string as a 3rd parameter to .css will automatically 13538 // attempt a parseFloat and fallback to a string if the parse fails. 13539 // Simple values such as "10px" are parsed to Float; 13540 // complex values such as "rotate(1rad)" are returned as-is. 13541 result = jQuery.css( tween.elem, tween.prop, "" ); 13542 13543 // Empty strings, null, undefined and "auto" are converted to 0. 13544 return !result || result === "auto" ? 0 : result; 13545 }, 13546 set: function( tween ) { 13547 13548 // Use step hook for back compat. 13549 // Use cssHook if its there. 13550 // Use .style if available and use plain properties where available. 13551 if ( jQuery.fx.step[ tween.prop ] ) { 13552 jQuery.fx.step[ tween.prop ]( tween ); 13553 } else if ( tween.elem.nodeType === 1 && ( 13554 jQuery.cssHooks[ tween.prop ] || 13555 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 13556 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 13557 } else { 13558 tween.elem[ tween.prop ] = tween.now; 13559 } 13560 } 13561 } 13562}; 13563 13564// Support: IE <=9 only 13565// Panic based approach to setting things on disconnected nodes 13566Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 13567 set: function( tween ) { 13568 if ( tween.elem.nodeType && tween.elem.parentNode ) { 13569 tween.elem[ tween.prop ] = tween.now; 13570 } 13571 } 13572}; 13573 13574jQuery.easing = { 13575 linear: function( p ) { 13576 return p; 13577 }, 13578 swing: function( p ) { 13579 return 0.5 - Math.cos( p * Math.PI ) / 2; 13580 }, 13581 _default: "swing" 13582}; 13583 13584jQuery.fx = Tween.prototype.init; 13585 13586// Back compat <1.8 extension point 13587jQuery.fx.step = {}; 13588 13589 13590 13591 13592var 13593 fxNow, inProgress, 13594 rfxtypes = /^(?:toggle|show|hide)$/, 13595 rrun = /queueHooks$/; 13596 13597function schedule() { 13598 if ( inProgress ) { 13599 if ( document.hidden === false && window.requestAnimationFrame ) { 13600 window.requestAnimationFrame( schedule ); 13601 } else { 13602 window.setTimeout( schedule, jQuery.fx.interval ); 13603 } 13604 13605 jQuery.fx.tick(); 13606 } 13607} 13608 13609// Animations created synchronously will run synchronously 13610function createFxNow() { 13611 window.setTimeout( function() { 13612 fxNow = undefined; 13613 } ); 13614 return ( fxNow = Date.now() ); 13615} 13616 13617// Generate parameters to create a standard animation 13618function genFx( type, includeWidth ) { 13619 var which, 13620 i = 0, 13621 attrs = { height: type }; 13622 13623 // If we include width, step value is 1 to do all cssExpand values, 13624 // otherwise step value is 2 to skip over Left and Right 13625 includeWidth = includeWidth ? 1 : 0; 13626 for ( ; i < 4; i += 2 - includeWidth ) { 13627 which = cssExpand[ i ]; 13628 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 13629 } 13630 13631 if ( includeWidth ) { 13632 attrs.opacity = attrs.width = type; 13633 } 13634 13635 return attrs; 13636} 13637 13638function createTween( value, prop, animation ) { 13639 var tween, 13640 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 13641 index = 0, 13642 length = collection.length; 13643 for ( ; index < length; index++ ) { 13644 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 13645 13646 // We're done with this property 13647 return tween; 13648 } 13649 } 13650} 13651 13652function defaultPrefilter( elem, props, opts ) { 13653 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 13654 isBox = "width" in props || "height" in props, 13655 anim = this, 13656 orig = {}, 13657 style = elem.style, 13658 hidden = elem.nodeType && isHiddenWithinTree( elem ), 13659 dataShow = dataPriv.get( elem, "fxshow" ); 13660 13661 // Queue-skipping animations hijack the fx hooks 13662 if ( !opts.queue ) { 13663 hooks = jQuery._queueHooks( elem, "fx" ); 13664 if ( hooks.unqueued == null ) { 13665 hooks.unqueued = 0; 13666 oldfire = hooks.empty.fire; 13667 hooks.empty.fire = function() { 13668 if ( !hooks.unqueued ) { 13669 oldfire(); 13670 } 13671 }; 13672 } 13673 hooks.unqueued++; 13674 13675 anim.always( function() { 13676 13677 // Ensure the complete handler is called before this completes 13678 anim.always( function() { 13679 hooks.unqueued--; 13680 if ( !jQuery.queue( elem, "fx" ).length ) { 13681 hooks.empty.fire(); 13682 } 13683 } ); 13684 } ); 13685 } 13686 13687 // Detect show/hide animations 13688 for ( prop in props ) { 13689 value = props[ prop ]; 13690 if ( rfxtypes.test( value ) ) { 13691 delete props[ prop ]; 13692 toggle = toggle || value === "toggle"; 13693 if ( value === ( hidden ? "hide" : "show" ) ) { 13694 13695 // Pretend to be hidden if this is a "show" and 13696 // there is still data from a stopped show/hide 13697 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 13698 hidden = true; 13699 13700 // Ignore all other no-op show/hide data 13701 } else { 13702 continue; 13703 } 13704 } 13705 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 13706 } 13707 } 13708 13709 // Bail out if this is a no-op like .hide().hide() 13710 propTween = !jQuery.isEmptyObject( props ); 13711 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 13712 return; 13713 } 13714 13715 // Restrict "overflow" and "display" styles during box animations 13716 if ( isBox && elem.nodeType === 1 ) { 13717 13718 // Support: IE <=9 - 11, Edge 12 - 15 13719 // Record all 3 overflow attributes because IE does not infer the shorthand 13720 // from identically-valued overflowX and overflowY and Edge just mirrors 13721 // the overflowX value there. 13722 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 13723 13724 // Identify a display type, preferring old show/hide data over the CSS cascade 13725 restoreDisplay = dataShow && dataShow.display; 13726 if ( restoreDisplay == null ) { 13727 restoreDisplay = dataPriv.get( elem, "display" ); 13728 } 13729 display = jQuery.css( elem, "display" ); 13730 if ( display === "none" ) { 13731 if ( restoreDisplay ) { 13732 display = restoreDisplay; 13733 } else { 13734 13735 // Get nonempty value(s) by temporarily forcing visibility 13736 showHide( [ elem ], true ); 13737 restoreDisplay = elem.style.display || restoreDisplay; 13738 display = jQuery.css( elem, "display" ); 13739 showHide( [ elem ] ); 13740 } 13741 } 13742 13743 // Animate inline elements as inline-block 13744 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 13745 if ( jQuery.css( elem, "float" ) === "none" ) { 13746 13747 // Restore the original display value at the end of pure show/hide animations 13748 if ( !propTween ) { 13749 anim.done( function() { 13750 style.display = restoreDisplay; 13751 } ); 13752 if ( restoreDisplay == null ) { 13753 display = style.display; 13754 restoreDisplay = display === "none" ? "" : display; 13755 } 13756 } 13757 style.display = "inline-block"; 13758 } 13759 } 13760 } 13761 13762 if ( opts.overflow ) { 13763 style.overflow = "hidden"; 13764 anim.always( function() { 13765 style.overflow = opts.overflow[ 0 ]; 13766 style.overflowX = opts.overflow[ 1 ]; 13767 style.overflowY = opts.overflow[ 2 ]; 13768 } ); 13769 } 13770 13771 // Implement show/hide animations 13772 propTween = false; 13773 for ( prop in orig ) { 13774 13775 // General show/hide setup for this element animation 13776 if ( !propTween ) { 13777 if ( dataShow ) { 13778 if ( "hidden" in dataShow ) { 13779 hidden = dataShow.hidden; 13780 } 13781 } else { 13782 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 13783 } 13784 13785 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 13786 if ( toggle ) { 13787 dataShow.hidden = !hidden; 13788 } 13789 13790 // Show elements before animating them 13791 if ( hidden ) { 13792 showHide( [ elem ], true ); 13793 } 13794 13795 /* eslint-disable no-loop-func */ 13796 13797 anim.done( function() { 13798 13799 /* eslint-enable no-loop-func */ 13800 13801 // The final step of a "hide" animation is actually hiding the element 13802 if ( !hidden ) { 13803 showHide( [ elem ] ); 13804 } 13805 dataPriv.remove( elem, "fxshow" ); 13806 for ( prop in orig ) { 13807 jQuery.style( elem, prop, orig[ prop ] ); 13808 } 13809 } ); 13810 } 13811 13812 // Per-property setup 13813 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 13814 if ( !( prop in dataShow ) ) { 13815 dataShow[ prop ] = propTween.start; 13816 if ( hidden ) { 13817 propTween.end = propTween.start; 13818 propTween.start = 0; 13819 } 13820 } 13821 } 13822} 13823 13824function propFilter( props, specialEasing ) { 13825 var index, name, easing, value, hooks; 13826 13827 // camelCase, specialEasing and expand cssHook pass 13828 for ( index in props ) { 13829 name = camelCase( index ); 13830 easing = specialEasing[ name ]; 13831 value = props[ index ]; 13832 if ( Array.isArray( value ) ) { 13833 easing = value[ 1 ]; 13834 value = props[ index ] = value[ 0 ]; 13835 } 13836 13837 if ( index !== name ) { 13838 props[ name ] = value; 13839 delete props[ index ]; 13840 } 13841 13842 hooks = jQuery.cssHooks[ name ]; 13843 if ( hooks && "expand" in hooks ) { 13844 value = hooks.expand( value ); 13845 delete props[ name ]; 13846 13847 // Not quite $.extend, this won't overwrite existing keys. 13848 // Reusing 'index' because we have the correct "name" 13849 for ( index in value ) { 13850 if ( !( index in props ) ) { 13851 props[ index ] = value[ index ]; 13852 specialEasing[ index ] = easing; 13853 } 13854 } 13855 } else { 13856 specialEasing[ name ] = easing; 13857 } 13858 } 13859} 13860 13861function Animation( elem, properties, options ) { 13862 var result, 13863 stopped, 13864 index = 0, 13865 length = Animation.prefilters.length, 13866 deferred = jQuery.Deferred().always( function() { 13867 13868 // Don't match elem in the :animated selector 13869 delete tick.elem; 13870 } ), 13871 tick = function() { 13872 if ( stopped ) { 13873 return false; 13874 } 13875 var currentTime = fxNow || createFxNow(), 13876 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 13877 13878 // Support: Android 2.3 only 13879 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 13880 temp = remaining / animation.duration || 0, 13881 percent = 1 - temp, 13882 index = 0, 13883 length = animation.tweens.length; 13884 13885 for ( ; index < length; index++ ) { 13886 animation.tweens[ index ].run( percent ); 13887 } 13888 13889 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 13890 13891 // If there's more to do, yield 13892 if ( percent < 1 && length ) { 13893 return remaining; 13894 } 13895 13896 // If this was an empty animation, synthesize a final progress notification 13897 if ( !length ) { 13898 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 13899 } 13900 13901 // Resolve the animation and report its conclusion 13902 deferred.resolveWith( elem, [ animation ] ); 13903 return false; 13904 }, 13905 animation = deferred.promise( { 13906 elem: elem, 13907 props: jQuery.extend( {}, properties ), 13908 opts: jQuery.extend( true, { 13909 specialEasing: {}, 13910 easing: jQuery.easing._default 13911 }, options ), 13912 originalProperties: properties, 13913 originalOptions: options, 13914 startTime: fxNow || createFxNow(), 13915 duration: options.duration, 13916 tweens: [], 13917 createTween: function( prop, end ) { 13918 var tween = jQuery.Tween( elem, animation.opts, prop, end, 13919 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 13920 animation.tweens.push( tween ); 13921 return tween; 13922 }, 13923 stop: function( gotoEnd ) { 13924 var index = 0, 13925 13926 // If we are going to the end, we want to run all the tweens 13927 // otherwise we skip this part 13928 length = gotoEnd ? animation.tweens.length : 0; 13929 if ( stopped ) { 13930 return this; 13931 } 13932 stopped = true; 13933 for ( ; index < length; index++ ) { 13934 animation.tweens[ index ].run( 1 ); 13935 } 13936 13937 // Resolve when we played the last frame; otherwise, reject 13938 if ( gotoEnd ) { 13939 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 13940 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 13941 } else { 13942 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 13943 } 13944 return this; 13945 } 13946 } ), 13947 props = animation.props; 13948 13949 propFilter( props, animation.opts.specialEasing ); 13950 13951 for ( ; index < length; index++ ) { 13952 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 13953 if ( result ) { 13954 if ( isFunction( result.stop ) ) { 13955 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 13956 result.stop.bind( result ); 13957 } 13958 return result; 13959 } 13960 } 13961 13962 jQuery.map( props, createTween, animation ); 13963 13964 if ( isFunction( animation.opts.start ) ) { 13965 animation.opts.start.call( elem, animation ); 13966 } 13967 13968 // Attach callbacks from options 13969 animation 13970 .progress( animation.opts.progress ) 13971 .done( animation.opts.done, animation.opts.complete ) 13972 .fail( animation.opts.fail ) 13973 .always( animation.opts.always ); 13974 13975 jQuery.fx.timer( 13976 jQuery.extend( tick, { 13977 elem: elem, 13978 anim: animation, 13979 queue: animation.opts.queue 13980 } ) 13981 ); 13982 13983 return animation; 13984} 13985 13986jQuery.Animation = jQuery.extend( Animation, { 13987 13988 tweeners: { 13989 "*": [ function( prop, value ) { 13990 var tween = this.createTween( prop, value ); 13991 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 13992 return tween; 13993 } ] 13994 }, 13995 13996 tweener: function( props, callback ) { 13997 if ( isFunction( props ) ) { 13998 callback = props; 13999 props = [ "*" ]; 14000 } else { 14001 props = props.match( rnothtmlwhite ); 14002 } 14003 14004 var prop, 14005 index = 0, 14006 length = props.length; 14007 14008 for ( ; index < length; index++ ) { 14009 prop = props[ index ]; 14010 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 14011 Animation.tweeners[ prop ].unshift( callback ); 14012 } 14013 }, 14014 14015 prefilters: [ defaultPrefilter ], 14016 14017 prefilter: function( callback, prepend ) { 14018 if ( prepend ) { 14019 Animation.prefilters.unshift( callback ); 14020 } else { 14021 Animation.prefilters.push( callback ); 14022 } 14023 } 14024} ); 14025 14026jQuery.speed = function( speed, easing, fn ) { 14027 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 14028 complete: fn || !fn && easing || 14029 isFunction( speed ) && speed, 14030 duration: speed, 14031 easing: fn && easing || easing && !isFunction( easing ) && easing 14032 }; 14033 14034 // Go to the end state if fx are off 14035 if ( jQuery.fx.off ) { 14036 opt.duration = 0; 14037 14038 } else { 14039 if ( typeof opt.duration !== "number" ) { 14040 if ( opt.duration in jQuery.fx.speeds ) { 14041 opt.duration = jQuery.fx.speeds[ opt.duration ]; 14042 14043 } else { 14044 opt.duration = jQuery.fx.speeds._default; 14045 } 14046 } 14047 } 14048 14049 // Normalize opt.queue - true/undefined/null -> "fx" 14050 if ( opt.queue == null || opt.queue === true ) { 14051 opt.queue = "fx"; 14052 } 14053 14054 // Queueing 14055 opt.old = opt.complete; 14056 14057 opt.complete = function() { 14058 if ( isFunction( opt.old ) ) { 14059 opt.old.call( this ); 14060 } 14061 14062 if ( opt.queue ) { 14063 jQuery.dequeue( this, opt.queue ); 14064 } 14065 }; 14066 14067 return opt; 14068}; 14069 14070jQuery.fn.extend( { 14071 fadeTo: function( speed, to, easing, callback ) { 14072 14073 // Show any hidden elements after setting opacity to 0 14074 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 14075 14076 // Animate to the value specified 14077 .end().animate( { opacity: to }, speed, easing, callback ); 14078 }, 14079 animate: function( prop, speed, easing, callback ) { 14080 var empty = jQuery.isEmptyObject( prop ), 14081 optall = jQuery.speed( speed, easing, callback ), 14082 doAnimation = function() { 14083 14084 // Operate on a copy of prop so per-property easing won't be lost 14085 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 14086 14087 // Empty animations, or finishing resolves immediately 14088 if ( empty || dataPriv.get( this, "finish" ) ) { 14089 anim.stop( true ); 14090 } 14091 }; 14092 doAnimation.finish = doAnimation; 14093 14094 return empty || optall.queue === false ? 14095 this.each( doAnimation ) : 14096 this.queue( optall.queue, doAnimation ); 14097 }, 14098 stop: function( type, clearQueue, gotoEnd ) { 14099 var stopQueue = function( hooks ) { 14100 var stop = hooks.stop; 14101 delete hooks.stop; 14102 stop( gotoEnd ); 14103 }; 14104 14105 if ( typeof type !== "string" ) { 14106 gotoEnd = clearQueue; 14107 clearQueue = type; 14108 type = undefined; 14109 } 14110 if ( clearQueue ) { 14111 this.queue( type || "fx", [] ); 14112 } 14113 14114 return this.each( function() { 14115 var dequeue = true, 14116 index = type != null && type + "queueHooks", 14117 timers = jQuery.timers, 14118 data = dataPriv.get( this ); 14119 14120 if ( index ) { 14121 if ( data[ index ] && data[ index ].stop ) { 14122 stopQueue( data[ index ] ); 14123 } 14124 } else { 14125 for ( index in data ) { 14126 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 14127 stopQueue( data[ index ] ); 14128 } 14129 } 14130 } 14131 14132 for ( index = timers.length; index--; ) { 14133 if ( timers[ index ].elem === this && 14134 ( type == null || timers[ index ].queue === type ) ) { 14135 14136 timers[ index ].anim.stop( gotoEnd ); 14137 dequeue = false; 14138 timers.splice( index, 1 ); 14139 } 14140 } 14141 14142 // Start the next in the queue if the last step wasn't forced. 14143 // Timers currently will call their complete callbacks, which 14144 // will dequeue but only if they were gotoEnd. 14145 if ( dequeue || !gotoEnd ) { 14146 jQuery.dequeue( this, type ); 14147 } 14148 } ); 14149 }, 14150 finish: function( type ) { 14151 if ( type !== false ) { 14152 type = type || "fx"; 14153 } 14154 return this.each( function() { 14155 var index, 14156 data = dataPriv.get( this ), 14157 queue = data[ type + "queue" ], 14158 hooks = data[ type + "queueHooks" ], 14159 timers = jQuery.timers, 14160 length = queue ? queue.length : 0; 14161 14162 // Enable finishing flag on private data 14163 data.finish = true; 14164 14165 // Empty the queue first 14166 jQuery.queue( this, type, [] ); 14167 14168 if ( hooks && hooks.stop ) { 14169 hooks.stop.call( this, true ); 14170 } 14171 14172 // Look for any active animations, and finish them 14173 for ( index = timers.length; index--; ) { 14174 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 14175 timers[ index ].anim.stop( true ); 14176 timers.splice( index, 1 ); 14177 } 14178 } 14179 14180 // Look for any animations in the old queue and finish them 14181 for ( index = 0; index < length; index++ ) { 14182 if ( queue[ index ] && queue[ index ].finish ) { 14183 queue[ index ].finish.call( this ); 14184 } 14185 } 14186 14187 // Turn off finishing flag 14188 delete data.finish; 14189 } ); 14190 } 14191} ); 14192 14193jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 14194 var cssFn = jQuery.fn[ name ]; 14195 jQuery.fn[ name ] = function( speed, easing, callback ) { 14196 return speed == null || typeof speed === "boolean" ? 14197 cssFn.apply( this, arguments ) : 14198 this.animate( genFx( name, true ), speed, easing, callback ); 14199 }; 14200} ); 14201 14202// Generate shortcuts for custom animations 14203jQuery.each( { 14204 slideDown: genFx( "show" ), 14205 slideUp: genFx( "hide" ), 14206 slideToggle: genFx( "toggle" ), 14207 fadeIn: { opacity: "show" }, 14208 fadeOut: { opacity: "hide" }, 14209 fadeToggle: { opacity: "toggle" } 14210}, function( name, props ) { 14211 jQuery.fn[ name ] = function( speed, easing, callback ) { 14212 return this.animate( props, speed, easing, callback ); 14213 }; 14214} ); 14215 14216jQuery.timers = []; 14217jQuery.fx.tick = function() { 14218 var timer, 14219 i = 0, 14220 timers = jQuery.timers; 14221 14222 fxNow = Date.now(); 14223 14224 for ( ; i < timers.length; i++ ) { 14225 timer = timers[ i ]; 14226 14227 // Run the timer and safely remove it when done (allowing for external removal) 14228 if ( !timer() && timers[ i ] === timer ) { 14229 timers.splice( i--, 1 ); 14230 } 14231 } 14232 14233 if ( !timers.length ) { 14234 jQuery.fx.stop(); 14235 } 14236 fxNow = undefined; 14237}; 14238 14239jQuery.fx.timer = function( timer ) { 14240 jQuery.timers.push( timer ); 14241 jQuery.fx.start(); 14242}; 14243 14244jQuery.fx.interval = 13; 14245jQuery.fx.start = function() { 14246 if ( inProgress ) { 14247 return; 14248 } 14249 14250 inProgress = true; 14251 schedule(); 14252}; 14253 14254jQuery.fx.stop = function() { 14255 inProgress = null; 14256}; 14257 14258jQuery.fx.speeds = { 14259 slow: 600, 14260 fast: 200, 14261 14262 // Default speed 14263 _default: 400 14264}; 14265 14266 14267// Based off of the plugin by Clint Helfers, with permission. 14268// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 14269jQuery.fn.delay = function( time, type ) { 14270 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 14271 type = type || "fx"; 14272 14273 return this.queue( type, function( next, hooks ) { 14274 var timeout = window.setTimeout( next, time ); 14275 hooks.stop = function() { 14276 window.clearTimeout( timeout ); 14277 }; 14278 } ); 14279}; 14280 14281 14282( function() { 14283 var input = document.createElement( "input" ), 14284 select = document.createElement( "select" ), 14285 opt = select.appendChild( document.createElement( "option" ) ); 14286 14287 input.type = "checkbox"; 14288 14289 // Support: Android <=4.3 only 14290 // Default value for a checkbox should be "on" 14291 support.checkOn = input.value !== ""; 14292 14293 // Support: IE <=11 only 14294 // Must access selectedIndex to make default options select 14295 support.optSelected = opt.selected; 14296 14297 // Support: IE <=11 only 14298 // An input loses its value after becoming a radio 14299 input = document.createElement( "input" ); 14300 input.value = "t"; 14301 input.type = "radio"; 14302 support.radioValue = input.value === "t"; 14303} )(); 14304 14305 14306var boolHook, 14307 attrHandle = jQuery.expr.attrHandle; 14308 14309jQuery.fn.extend( { 14310 attr: function( name, value ) { 14311 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 14312 }, 14313 14314 removeAttr: function( name ) { 14315 return this.each( function() { 14316 jQuery.removeAttr( this, name ); 14317 } ); 14318 } 14319} ); 14320 14321jQuery.extend( { 14322 attr: function( elem, name, value ) { 14323 var ret, hooks, 14324 nType = elem.nodeType; 14325 14326 // Don't get/set attributes on text, comment and attribute nodes 14327 if ( nType === 3 || nType === 8 || nType === 2 ) { 14328 return; 14329 } 14330 14331 // Fallback to prop when attributes are not supported 14332 if ( typeof elem.getAttribute === "undefined" ) { 14333 return jQuery.prop( elem, name, value ); 14334 } 14335 14336 // Attribute hooks are determined by the lowercase version 14337 // Grab necessary hook if one is defined 14338 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 14339 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 14340 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 14341 } 14342 14343 if ( value !== undefined ) { 14344 if ( value === null ) { 14345 jQuery.removeAttr( elem, name ); 14346 return; 14347 } 14348 14349 if ( hooks && "set" in hooks && 14350 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 14351 return ret; 14352 } 14353 14354 elem.setAttribute( name, value + "" ); 14355 return value; 14356 } 14357 14358 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 14359 return ret; 14360 } 14361 14362 ret = jQuery.find.attr( elem, name ); 14363 14364 // Non-existent attributes return null, we normalize to undefined 14365 return ret == null ? undefined : ret; 14366 }, 14367 14368 attrHooks: { 14369 type: { 14370 set: function( elem, value ) { 14371 if ( !support.radioValue && value === "radio" && 14372 nodeName( elem, "input" ) ) { 14373 var val = elem.value; 14374 elem.setAttribute( "type", value ); 14375 if ( val ) { 14376 elem.value = val; 14377 } 14378 return value; 14379 } 14380 } 14381 } 14382 }, 14383 14384 removeAttr: function( elem, value ) { 14385 var name, 14386 i = 0, 14387 14388 // Attribute names can contain non-HTML whitespace characters 14389 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 14390 attrNames = value && value.match( rnothtmlwhite ); 14391 14392 if ( attrNames && elem.nodeType === 1 ) { 14393 while ( ( name = attrNames[ i++ ] ) ) { 14394 elem.removeAttribute( name ); 14395 } 14396 } 14397 } 14398} ); 14399 14400// Hooks for boolean attributes 14401boolHook = { 14402 set: function( elem, value, name ) { 14403 if ( value === false ) { 14404 14405 // Remove boolean attributes when set to false 14406 jQuery.removeAttr( elem, name ); 14407 } else { 14408 elem.setAttribute( name, name ); 14409 } 14410 return name; 14411 } 14412}; 14413 14414jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 14415 var getter = attrHandle[ name ] || jQuery.find.attr; 14416 14417 attrHandle[ name ] = function( elem, name, isXML ) { 14418 var ret, handle, 14419 lowercaseName = name.toLowerCase(); 14420 14421 if ( !isXML ) { 14422 14423 // Avoid an infinite loop by temporarily removing this function from the getter 14424 handle = attrHandle[ lowercaseName ]; 14425 attrHandle[ lowercaseName ] = ret; 14426 ret = getter( elem, name, isXML ) != null ? 14427 lowercaseName : 14428 null; 14429 attrHandle[ lowercaseName ] = handle; 14430 } 14431 return ret; 14432 }; 14433} ); 14434 14435 14436 14437 14438var rfocusable = /^(?:input|select|textarea|button)$/i, 14439 rclickable = /^(?:a|area)$/i; 14440 14441jQuery.fn.extend( { 14442 prop: function( name, value ) { 14443 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 14444 }, 14445 14446 removeProp: function( name ) { 14447 return this.each( function() { 14448 delete this[ jQuery.propFix[ name ] || name ]; 14449 } ); 14450 } 14451} ); 14452 14453jQuery.extend( { 14454 prop: function( elem, name, value ) { 14455 var ret, hooks, 14456 nType = elem.nodeType; 14457 14458 // Don't get/set properties on text, comment and attribute nodes 14459 if ( nType === 3 || nType === 8 || nType === 2 ) { 14460 return; 14461 } 14462 14463 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 14464 14465 // Fix name and attach hooks 14466 name = jQuery.propFix[ name ] || name; 14467 hooks = jQuery.propHooks[ name ]; 14468 } 14469 14470 if ( value !== undefined ) { 14471 if ( hooks && "set" in hooks && 14472 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 14473 return ret; 14474 } 14475 14476 return ( elem[ name ] = value ); 14477 } 14478 14479 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 14480 return ret; 14481 } 14482 14483 return elem[ name ]; 14484 }, 14485 14486 propHooks: { 14487 tabIndex: { 14488 get: function( elem ) { 14489 14490 // Support: IE <=9 - 11 only 14491 // elem.tabIndex doesn't always return the 14492 // correct value when it hasn't been explicitly set 14493 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 14494 // Use proper attribute retrieval(#12072) 14495 var tabindex = jQuery.find.attr( elem, "tabindex" ); 14496 14497 if ( tabindex ) { 14498 return parseInt( tabindex, 10 ); 14499 } 14500 14501 if ( 14502 rfocusable.test( elem.nodeName ) || 14503 rclickable.test( elem.nodeName ) && 14504 elem.href 14505 ) { 14506 return 0; 14507 } 14508 14509 return -1; 14510 } 14511 } 14512 }, 14513 14514 propFix: { 14515 "for": "htmlFor", 14516 "class": "className" 14517 } 14518} ); 14519 14520// Support: IE <=11 only 14521// Accessing the selectedIndex property 14522// forces the browser to respect setting selected 14523// on the option 14524// The getter ensures a default option is selected 14525// when in an optgroup 14526// eslint rule "no-unused-expressions" is disabled for this code 14527// since it considers such accessions noop 14528if ( !support.optSelected ) { 14529 jQuery.propHooks.selected = { 14530 get: function( elem ) { 14531 14532 /* eslint no-unused-expressions: "off" */ 14533 14534 var parent = elem.parentNode; 14535 if ( parent && parent.parentNode ) { 14536 parent.parentNode.selectedIndex; 14537 } 14538 return null; 14539 }, 14540 set: function( elem ) { 14541 14542 /* eslint no-unused-expressions: "off" */ 14543 14544 var parent = elem.parentNode; 14545 if ( parent ) { 14546 parent.selectedIndex; 14547 14548 if ( parent.parentNode ) { 14549 parent.parentNode.selectedIndex; 14550 } 14551 } 14552 } 14553 }; 14554} 14555 14556jQuery.each( [ 14557 "tabIndex", 14558 "readOnly", 14559 "maxLength", 14560 "cellSpacing", 14561 "cellPadding", 14562 "rowSpan", 14563 "colSpan", 14564 "useMap", 14565 "frameBorder", 14566 "contentEditable" 14567], function() { 14568 jQuery.propFix[ this.toLowerCase() ] = this; 14569} ); 14570 14571 14572 14573 14574 // Strip and collapse whitespace according to HTML spec 14575 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 14576 function stripAndCollapse( value ) { 14577 var tokens = value.match( rnothtmlwhite ) || []; 14578 return tokens.join( " " ); 14579 } 14580 14581 14582function getClass( elem ) { 14583 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 14584} 14585 14586function classesToArray( value ) { 14587 if ( Array.isArray( value ) ) { 14588 return value; 14589 } 14590 if ( typeof value === "string" ) { 14591 return value.match( rnothtmlwhite ) || []; 14592 } 14593 return []; 14594} 14595 14596jQuery.fn.extend( { 14597 addClass: function( value ) { 14598 var classes, elem, cur, curValue, clazz, j, finalValue, 14599 i = 0; 14600 14601 if ( isFunction( value ) ) { 14602 return this.each( function( j ) { 14603 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 14604 } ); 14605 } 14606 14607 classes = classesToArray( value ); 14608 14609 if ( classes.length ) { 14610 while ( ( elem = this[ i++ ] ) ) { 14611 curValue = getClass( elem ); 14612 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 14613 14614 if ( cur ) { 14615 j = 0; 14616 while ( ( clazz = classes[ j++ ] ) ) { 14617 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 14618 cur += clazz + " "; 14619 } 14620 } 14621 14622 // Only assign if different to avoid unneeded rendering. 14623 finalValue = stripAndCollapse( cur ); 14624 if ( curValue !== finalValue ) { 14625 elem.setAttribute( "class", finalValue ); 14626 } 14627 } 14628 } 14629 } 14630 14631 return this; 14632 }, 14633 14634 removeClass: function( value ) { 14635 var classes, elem, cur, curValue, clazz, j, finalValue, 14636 i = 0; 14637 14638 if ( isFunction( value ) ) { 14639 return this.each( function( j ) { 14640 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 14641 } ); 14642 } 14643 14644 if ( !arguments.length ) { 14645 return this.attr( "class", "" ); 14646 } 14647 14648 classes = classesToArray( value ); 14649 14650 if ( classes.length ) { 14651 while ( ( elem = this[ i++ ] ) ) { 14652 curValue = getClass( elem ); 14653 14654 // This expression is here for better compressibility (see addClass) 14655 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 14656 14657 if ( cur ) { 14658 j = 0; 14659 while ( ( clazz = classes[ j++ ] ) ) { 14660 14661 // Remove *all* instances 14662 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 14663 cur = cur.replace( " " + clazz + " ", " " ); 14664 } 14665 } 14666 14667 // Only assign if different to avoid unneeded rendering. 14668 finalValue = stripAndCollapse( cur ); 14669 if ( curValue !== finalValue ) { 14670 elem.setAttribute( "class", finalValue ); 14671 } 14672 } 14673 } 14674 } 14675 14676 return this; 14677 }, 14678 14679 toggleClass: function( value, stateVal ) { 14680 var type = typeof value, 14681 isValidValue = type === "string" || Array.isArray( value ); 14682 14683 if ( typeof stateVal === "boolean" && isValidValue ) { 14684 return stateVal ? this.addClass( value ) : this.removeClass( value ); 14685 } 14686 14687 if ( isFunction( value ) ) { 14688 return this.each( function( i ) { 14689 jQuery( this ).toggleClass( 14690 value.call( this, i, getClass( this ), stateVal ), 14691 stateVal 14692 ); 14693 } ); 14694 } 14695 14696 return this.each( function() { 14697 var className, i, self, classNames; 14698 14699 if ( isValidValue ) { 14700 14701 // Toggle individual class names 14702 i = 0; 14703 self = jQuery( this ); 14704 classNames = classesToArray( value ); 14705 14706 while ( ( className = classNames[ i++ ] ) ) { 14707 14708 // Check each className given, space separated list 14709 if ( self.hasClass( className ) ) { 14710 self.removeClass( className ); 14711 } else { 14712 self.addClass( className ); 14713 } 14714 } 14715 14716 // Toggle whole class name 14717 } else if ( value === undefined || type === "boolean" ) { 14718 className = getClass( this ); 14719 if ( className ) { 14720 14721 // Store className if set 14722 dataPriv.set( this, "__className__", className ); 14723 } 14724 14725 // If the element has a class name or if we're passed `false`, 14726 // then remove the whole classname (if there was one, the above saved it). 14727 // Otherwise bring back whatever was previously saved (if anything), 14728 // falling back to the empty string if nothing was stored. 14729 if ( this.setAttribute ) { 14730 this.setAttribute( "class", 14731 className || value === false ? 14732 "" : 14733 dataPriv.get( this, "__className__" ) || "" 14734 ); 14735 } 14736 } 14737 } ); 14738 }, 14739 14740 hasClass: function( selector ) { 14741 var className, elem, 14742 i = 0; 14743 14744 className = " " + selector + " "; 14745 while ( ( elem = this[ i++ ] ) ) { 14746 if ( elem.nodeType === 1 && 14747 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 14748 return true; 14749 } 14750 } 14751 14752 return false; 14753 } 14754} ); 14755 14756 14757 14758 14759var rreturn = /\r/g; 14760 14761jQuery.fn.extend( { 14762 val: function( value ) { 14763 var hooks, ret, valueIsFunction, 14764 elem = this[ 0 ]; 14765 14766 if ( !arguments.length ) { 14767 if ( elem ) { 14768 hooks = jQuery.valHooks[ elem.type ] || 14769 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 14770 14771 if ( hooks && 14772 "get" in hooks && 14773 ( ret = hooks.get( elem, "value" ) ) !== undefined 14774 ) { 14775 return ret; 14776 } 14777 14778 ret = elem.value; 14779 14780 // Handle most common string cases 14781 if ( typeof ret === "string" ) { 14782 return ret.replace( rreturn, "" ); 14783 } 14784 14785 // Handle cases where value is null/undef or number 14786 return ret == null ? "" : ret; 14787 } 14788 14789 return; 14790 } 14791 14792 valueIsFunction = isFunction( value ); 14793 14794 return this.each( function( i ) { 14795 var val; 14796 14797 if ( this.nodeType !== 1 ) { 14798 return; 14799 } 14800 14801 if ( valueIsFunction ) { 14802 val = value.call( this, i, jQuery( this ).val() ); 14803 } else { 14804 val = value; 14805 } 14806 14807 // Treat null/undefined as ""; convert numbers to string 14808 if ( val == null ) { 14809 val = ""; 14810 14811 } else if ( typeof val === "number" ) { 14812 val += ""; 14813 14814 } else if ( Array.isArray( val ) ) { 14815 val = jQuery.map( val, function( value ) { 14816 return value == null ? "" : value + ""; 14817 } ); 14818 } 14819 14820 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 14821 14822 // If set returns undefined, fall back to normal setting 14823 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 14824 this.value = val; 14825 } 14826 } ); 14827 } 14828} ); 14829 14830jQuery.extend( { 14831 valHooks: { 14832 option: { 14833 get: function( elem ) { 14834 14835 var val = jQuery.find.attr( elem, "value" ); 14836 return val != null ? 14837 val : 14838 14839 // Support: IE <=10 - 11 only 14840 // option.text throws exceptions (#14686, #14858) 14841 // Strip and collapse whitespace 14842 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 14843 stripAndCollapse( jQuery.text( elem ) ); 14844 } 14845 }, 14846 select: { 14847 get: function( elem ) { 14848 var value, option, i, 14849 options = elem.options, 14850 index = elem.selectedIndex, 14851 one = elem.type === "select-one", 14852 values = one ? null : [], 14853 max = one ? index + 1 : options.length; 14854 14855 if ( index < 0 ) { 14856 i = max; 14857 14858 } else { 14859 i = one ? index : 0; 14860 } 14861 14862 // Loop through all the selected options 14863 for ( ; i < max; i++ ) { 14864 option = options[ i ]; 14865 14866 // Support: IE <=9 only 14867 // IE8-9 doesn't update selected after form reset (#2551) 14868 if ( ( option.selected || i === index ) && 14869 14870 // Don't return options that are disabled or in a disabled optgroup 14871 !option.disabled && 14872 ( !option.parentNode.disabled || 14873 !nodeName( option.parentNode, "optgroup" ) ) ) { 14874 14875 // Get the specific value for the option 14876 value = jQuery( option ).val(); 14877 14878 // We don't need an array for one selects 14879 if ( one ) { 14880 return value; 14881 } 14882 14883 // Multi-Selects return an array 14884 values.push( value ); 14885 } 14886 } 14887 14888 return values; 14889 }, 14890 14891 set: function( elem, value ) { 14892 var optionSet, option, 14893 options = elem.options, 14894 values = jQuery.makeArray( value ), 14895 i = options.length; 14896 14897 while ( i-- ) { 14898 option = options[ i ]; 14899 14900 /* eslint-disable no-cond-assign */ 14901 14902 if ( option.selected = 14903 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 14904 ) { 14905 optionSet = true; 14906 } 14907 14908 /* eslint-enable no-cond-assign */ 14909 } 14910 14911 // Force browsers to behave consistently when non-matching value is set 14912 if ( !optionSet ) { 14913 elem.selectedIndex = -1; 14914 } 14915 return values; 14916 } 14917 } 14918 } 14919} ); 14920 14921// Radios and checkboxes getter/setter 14922jQuery.each( [ "radio", "checkbox" ], function() { 14923 jQuery.valHooks[ this ] = { 14924 set: function( elem, value ) { 14925 if ( Array.isArray( value ) ) { 14926 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 14927 } 14928 } 14929 }; 14930 if ( !support.checkOn ) { 14931 jQuery.valHooks[ this ].get = function( elem ) { 14932 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 14933 }; 14934 } 14935} ); 14936 14937 14938 14939 14940// Return jQuery for attributes-only inclusion 14941 14942 14943support.focusin = "onfocusin" in window; 14944 14945 14946var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 14947 stopPropagationCallback = function( e ) { 14948 e.stopPropagation(); 14949 }; 14950 14951jQuery.extend( jQuery.event, { 14952 14953 trigger: function( event, data, elem, onlyHandlers ) { 14954 14955 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 14956 eventPath = [ elem || document ], 14957 type = hasOwn.call( event, "type" ) ? event.type : event, 14958 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 14959 14960 cur = lastElement = tmp = elem = elem || document; 14961 14962 // Don't do events on text and comment nodes 14963 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 14964 return; 14965 } 14966 14967 // focus/blur morphs to focusin/out; ensure we're not firing them right now 14968 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 14969 return; 14970 } 14971 14972 if ( type.indexOf( "." ) > -1 ) { 14973 14974 // Namespaced trigger; create a regexp to match event type in handle() 14975 namespaces = type.split( "." ); 14976 type = namespaces.shift(); 14977 namespaces.sort(); 14978 } 14979 ontype = type.indexOf( ":" ) < 0 && "on" + type; 14980 14981 // Caller can pass in a jQuery.Event object, Object, or just an event type string 14982 event = event[ jQuery.expando ] ? 14983 event : 14984 new jQuery.Event( type, typeof event === "object" && event ); 14985 14986 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 14987 event.isTrigger = onlyHandlers ? 2 : 3; 14988 event.namespace = namespaces.join( "." ); 14989 event.rnamespace = event.namespace ? 14990 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 14991 null; 14992 14993 // Clean up the event in case it is being reused 14994 event.result = undefined; 14995 if ( !event.target ) { 14996 event.target = elem; 14997 } 14998 14999 // Clone any incoming data and prepend the event, creating the handler arg list 15000 data = data == null ? 15001 [ event ] : 15002 jQuery.makeArray( data, [ event ] ); 15003 15004 // Allow special events to draw outside the lines 15005 special = jQuery.event.special[ type ] || {}; 15006 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 15007 return; 15008 } 15009 15010 // Determine event propagation path in advance, per W3C events spec (#9951) 15011 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 15012 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 15013 15014 bubbleType = special.delegateType || type; 15015 if ( !rfocusMorph.test( bubbleType + type ) ) { 15016 cur = cur.parentNode; 15017 } 15018 for ( ; cur; cur = cur.parentNode ) { 15019 eventPath.push( cur ); 15020 tmp = cur; 15021 } 15022 15023 // Only add window if we got to document (e.g., not plain obj or detached DOM) 15024 if ( tmp === ( elem.ownerDocument || document ) ) { 15025 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 15026 } 15027 } 15028 15029 // Fire handlers on the event path 15030 i = 0; 15031 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 15032 lastElement = cur; 15033 event.type = i > 1 ? 15034 bubbleType : 15035 special.bindType || type; 15036 15037 // jQuery handler 15038 handle = ( 15039 dataPriv.get( cur, "events" ) || Object.create( null ) 15040 )[ event.type ] && 15041 dataPriv.get( cur, "handle" ); 15042 if ( handle ) { 15043 handle.apply( cur, data ); 15044 } 15045 15046 // Native handler 15047 handle = ontype && cur[ ontype ]; 15048 if ( handle && handle.apply && acceptData( cur ) ) { 15049 event.result = handle.apply( cur, data ); 15050 if ( event.result === false ) { 15051 event.preventDefault(); 15052 } 15053 } 15054 } 15055 event.type = type; 15056 15057 // If nobody prevented the default action, do it now 15058 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 15059 15060 if ( ( !special._default || 15061 special._default.apply( eventPath.pop(), data ) === false ) && 15062 acceptData( elem ) ) { 15063 15064 // Call a native DOM method on the target with the same name as the event. 15065 // Don't do default actions on window, that's where global variables be (#6170) 15066 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 15067 15068 // Don't re-trigger an onFOO event when we call its FOO() method 15069 tmp = elem[ ontype ]; 15070 15071 if ( tmp ) { 15072 elem[ ontype ] = null; 15073 } 15074 15075 // Prevent re-triggering of the same event, since we already bubbled it above 15076 jQuery.event.triggered = type; 15077 15078 if ( event.isPropagationStopped() ) { 15079 lastElement.addEventListener( type, stopPropagationCallback ); 15080 } 15081 15082 elem[ type ](); 15083 15084 if ( event.isPropagationStopped() ) { 15085 lastElement.removeEventListener( type, stopPropagationCallback ); 15086 } 15087 15088 jQuery.event.triggered = undefined; 15089 15090 if ( tmp ) { 15091 elem[ ontype ] = tmp; 15092 } 15093 } 15094 } 15095 } 15096 15097 return event.result; 15098 }, 15099 15100 // Piggyback on a donor event to simulate a different one 15101 // Used only for `focus(in | out)` events 15102 simulate: function( type, elem, event ) { 15103 var e = jQuery.extend( 15104 new jQuery.Event(), 15105 event, 15106 { 15107 type: type, 15108 isSimulated: true 15109 } 15110 ); 15111 15112 jQuery.event.trigger( e, null, elem ); 15113 } 15114 15115} ); 15116 15117jQuery.fn.extend( { 15118 15119 trigger: function( type, data ) { 15120 return this.each( function() { 15121 jQuery.event.trigger( type, data, this ); 15122 } ); 15123 }, 15124 triggerHandler: function( type, data ) { 15125 var elem = this[ 0 ]; 15126 if ( elem ) { 15127 return jQuery.event.trigger( type, data, elem, true ); 15128 } 15129 } 15130} ); 15131 15132 15133// Support: Firefox <=44 15134// Firefox doesn't have focus(in | out) events 15135// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 15136// 15137// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 15138// focus(in | out) events fire after focus & blur events, 15139// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 15140// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 15141if ( !support.focusin ) { 15142 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 15143 15144 // Attach a single capturing handler on the document while someone wants focusin/focusout 15145 var handler = function( event ) { 15146 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 15147 }; 15148 15149 jQuery.event.special[ fix ] = { 15150 setup: function() { 15151 15152 // Handle: regular nodes (via `this.ownerDocument`), window 15153 // (via `this.document`) & document (via `this`). 15154 var doc = this.ownerDocument || this.document || this, 15155 attaches = dataPriv.access( doc, fix ); 15156 15157 if ( !attaches ) { 15158 doc.addEventListener( orig, handler, true ); 15159 } 15160 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 15161 }, 15162 teardown: function() { 15163 var doc = this.ownerDocument || this.document || this, 15164 attaches = dataPriv.access( doc, fix ) - 1; 15165 15166 if ( !attaches ) { 15167 doc.removeEventListener( orig, handler, true ); 15168 dataPriv.remove( doc, fix ); 15169 15170 } else { 15171 dataPriv.access( doc, fix, attaches ); 15172 } 15173 } 15174 }; 15175 } ); 15176} 15177var location = window.location; 15178 15179var nonce = { guid: Date.now() }; 15180 15181var rquery = ( /\?/ ); 15182 15183 15184 15185// Cross-browser xml parsing 15186jQuery.parseXML = function( data ) { 15187 var xml; 15188 if ( !data || typeof data !== "string" ) { 15189 return null; 15190 } 15191 15192 // Support: IE 9 - 11 only 15193 // IE throws on parseFromString with invalid input. 15194 try { 15195 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 15196 } catch ( e ) { 15197 xml = undefined; 15198 } 15199 15200 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 15201 jQuery.error( "Invalid XML: " + data ); 15202 } 15203 return xml; 15204}; 15205 15206 15207var 15208 rbracket = /\[\]$/, 15209 rCRLF = /\r?\n/g, 15210 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 15211 rsubmittable = /^(?:input|select|textarea|keygen)/i; 15212 15213function buildParams( prefix, obj, traditional, add ) { 15214 var name; 15215 15216 if ( Array.isArray( obj ) ) { 15217 15218 // Serialize array item. 15219 jQuery.each( obj, function( i, v ) { 15220 if ( traditional || rbracket.test( prefix ) ) { 15221 15222 // Treat each array item as a scalar. 15223 add( prefix, v ); 15224 15225 } else { 15226 15227 // Item is non-scalar (array or object), encode its numeric index. 15228 buildParams( 15229 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 15230 v, 15231 traditional, 15232 add 15233 ); 15234 } 15235 } ); 15236 15237 } else if ( !traditional && toType( obj ) === "object" ) { 15238 15239 // Serialize object item. 15240 for ( name in obj ) { 15241 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 15242 } 15243 15244 } else { 15245 15246 // Serialize scalar item. 15247 add( prefix, obj ); 15248 } 15249} 15250 15251// Serialize an array of form elements or a set of 15252// key/values into a query string 15253jQuery.param = function( a, traditional ) { 15254 var prefix, 15255 s = [], 15256 add = function( key, valueOrFunction ) { 15257 15258 // If value is a function, invoke it and use its return value 15259 var value = isFunction( valueOrFunction ) ? 15260 valueOrFunction() : 15261 valueOrFunction; 15262 15263 s[ s.length ] = encodeURIComponent( key ) + "=" + 15264 encodeURIComponent( value == null ? "" : value ); 15265 }; 15266 15267 if ( a == null ) { 15268 return ""; 15269 } 15270 15271 // If an array was passed in, assume that it is an array of form elements. 15272 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 15273 15274 // Serialize the form elements 15275 jQuery.each( a, function() { 15276 add( this.name, this.value ); 15277 } ); 15278 15279 } else { 15280 15281 // If traditional, encode the "old" way (the way 1.3.2 or older 15282 // did it), otherwise encode params recursively. 15283 for ( prefix in a ) { 15284 buildParams( prefix, a[ prefix ], traditional, add ); 15285 } 15286 } 15287 15288 // Return the resulting serialization 15289 return s.join( "&" ); 15290}; 15291 15292jQuery.fn.extend( { 15293 serialize: function() { 15294 return jQuery.param( this.serializeArray() ); 15295 }, 15296 serializeArray: function() { 15297 return this.map( function() { 15298 15299 // Can add propHook for "elements" to filter or add form elements 15300 var elements = jQuery.prop( this, "elements" ); 15301 return elements ? jQuery.makeArray( elements ) : this; 15302 } ) 15303 .filter( function() { 15304 var type = this.type; 15305 15306 // Use .is( ":disabled" ) so that fieldset[disabled] works 15307 return this.name && !jQuery( this ).is( ":disabled" ) && 15308 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 15309 ( this.checked || !rcheckableType.test( type ) ); 15310 } ) 15311 .map( function( _i, elem ) { 15312 var val = jQuery( this ).val(); 15313 15314 if ( val == null ) { 15315 return null; 15316 } 15317 15318 if ( Array.isArray( val ) ) { 15319 return jQuery.map( val, function( val ) { 15320 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 15321 } ); 15322 } 15323 15324 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 15325 } ).get(); 15326 } 15327} ); 15328 15329 15330var 15331 r20 = /%20/g, 15332 rhash = /#.*$/, 15333 rantiCache = /([?&])_=[^&]*/, 15334 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 15335 15336 // #7653, #8125, #8152: local protocol detection 15337 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 15338 rnoContent = /^(?:GET|HEAD)$/, 15339 rprotocol = /^\/\//, 15340 15341 /* Prefilters 15342 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 15343 * 2) These are called: 15344 * - BEFORE asking for a transport 15345 * - AFTER param serialization (s.data is a string if s.processData is true) 15346 * 3) key is the dataType 15347 * 4) the catchall symbol "*" can be used 15348 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 15349 */ 15350 prefilters = {}, 15351 15352 /* Transports bindings 15353 * 1) key is the dataType 15354 * 2) the catchall symbol "*" can be used 15355 * 3) selection will start with transport dataType and THEN go to "*" if needed 15356 */ 15357 transports = {}, 15358 15359 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 15360 allTypes = "*/".concat( "*" ), 15361 15362 // Anchor tag for parsing the document origin 15363 originAnchor = document.createElement( "a" ); 15364 originAnchor.href = location.href; 15365 15366// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 15367function addToPrefiltersOrTransports( structure ) { 15368 15369 // dataTypeExpression is optional and defaults to "*" 15370 return function( dataTypeExpression, func ) { 15371 15372 if ( typeof dataTypeExpression !== "string" ) { 15373 func = dataTypeExpression; 15374 dataTypeExpression = "*"; 15375 } 15376 15377 var dataType, 15378 i = 0, 15379 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 15380 15381 if ( isFunction( func ) ) { 15382 15383 // For each dataType in the dataTypeExpression 15384 while ( ( dataType = dataTypes[ i++ ] ) ) { 15385 15386 // Prepend if requested 15387 if ( dataType[ 0 ] === "+" ) { 15388 dataType = dataType.slice( 1 ) || "*"; 15389 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 15390 15391 // Otherwise append 15392 } else { 15393 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 15394 } 15395 } 15396 } 15397 }; 15398} 15399 15400// Base inspection function for prefilters and transports 15401function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 15402 15403 var inspected = {}, 15404 seekingTransport = ( structure === transports ); 15405 15406 function inspect( dataType ) { 15407 var selected; 15408 inspected[ dataType ] = true; 15409 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 15410 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 15411 if ( typeof dataTypeOrTransport === "string" && 15412 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 15413 15414 options.dataTypes.unshift( dataTypeOrTransport ); 15415 inspect( dataTypeOrTransport ); 15416 return false; 15417 } else if ( seekingTransport ) { 15418 return !( selected = dataTypeOrTransport ); 15419 } 15420 } ); 15421 return selected; 15422 } 15423 15424 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 15425} 15426 15427// A special extend for ajax options 15428// that takes "flat" options (not to be deep extended) 15429// Fixes #9887 15430function ajaxExtend( target, src ) { 15431 var key, deep, 15432 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 15433 15434 for ( key in src ) { 15435 if ( src[ key ] !== undefined ) { 15436 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 15437 } 15438 } 15439 if ( deep ) { 15440 jQuery.extend( true, target, deep ); 15441 } 15442 15443 return target; 15444} 15445 15446/* Handles responses to an ajax request: 15447 * - finds the right dataType (mediates between content-type and expected dataType) 15448 * - returns the corresponding response 15449 */ 15450function ajaxHandleResponses( s, jqXHR, responses ) { 15451 15452 var ct, type, finalDataType, firstDataType, 15453 contents = s.contents, 15454 dataTypes = s.dataTypes; 15455 15456 // Remove auto dataType and get content-type in the process 15457 while ( dataTypes[ 0 ] === "*" ) { 15458 dataTypes.shift(); 15459 if ( ct === undefined ) { 15460 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 15461 } 15462 } 15463 15464 // Check if we're dealing with a known content-type 15465 if ( ct ) { 15466 for ( type in contents ) { 15467 if ( contents[ type ] && contents[ type ].test( ct ) ) { 15468 dataTypes.unshift( type ); 15469 break; 15470 } 15471 } 15472 } 15473 15474 // Check to see if we have a response for the expected dataType 15475 if ( dataTypes[ 0 ] in responses ) { 15476 finalDataType = dataTypes[ 0 ]; 15477 } else { 15478 15479 // Try convertible dataTypes 15480 for ( type in responses ) { 15481 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 15482 finalDataType = type; 15483 break; 15484 } 15485 if ( !firstDataType ) { 15486 firstDataType = type; 15487 } 15488 } 15489 15490 // Or just use first one 15491 finalDataType = finalDataType || firstDataType; 15492 } 15493 15494 // If we found a dataType 15495 // We add the dataType to the list if needed 15496 // and return the corresponding response 15497 if ( finalDataType ) { 15498 if ( finalDataType !== dataTypes[ 0 ] ) { 15499 dataTypes.unshift( finalDataType ); 15500 } 15501 return responses[ finalDataType ]; 15502 } 15503} 15504 15505/* Chain conversions given the request and the original response 15506 * Also sets the responseXXX fields on the jqXHR instance 15507 */ 15508function ajaxConvert( s, response, jqXHR, isSuccess ) { 15509 var conv2, current, conv, tmp, prev, 15510 converters = {}, 15511 15512 // Work with a copy of dataTypes in case we need to modify it for conversion 15513 dataTypes = s.dataTypes.slice(); 15514 15515 // Create converters map with lowercased keys 15516 if ( dataTypes[ 1 ] ) { 15517 for ( conv in s.converters ) { 15518 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 15519 } 15520 } 15521 15522 current = dataTypes.shift(); 15523 15524 // Convert to each sequential dataType 15525 while ( current ) { 15526 15527 if ( s.responseFields[ current ] ) { 15528 jqXHR[ s.responseFields[ current ] ] = response; 15529 } 15530 15531 // Apply the dataFilter if provided 15532 if ( !prev && isSuccess && s.dataFilter ) { 15533 response = s.dataFilter( response, s.dataType ); 15534 } 15535 15536 prev = current; 15537 current = dataTypes.shift(); 15538 15539 if ( current ) { 15540 15541 // There's only work to do if current dataType is non-auto 15542 if ( current === "*" ) { 15543 15544 current = prev; 15545 15546 // Convert response if prev dataType is non-auto and differs from current 15547 } else if ( prev !== "*" && prev !== current ) { 15548 15549 // Seek a direct converter 15550 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 15551 15552 // If none found, seek a pair 15553 if ( !conv ) { 15554 for ( conv2 in converters ) { 15555 15556 // If conv2 outputs current 15557 tmp = conv2.split( " " ); 15558 if ( tmp[ 1 ] === current ) { 15559 15560 // If prev can be converted to accepted input 15561 conv = converters[ prev + " " + tmp[ 0 ] ] || 15562 converters[ "* " + tmp[ 0 ] ]; 15563 if ( conv ) { 15564 15565 // Condense equivalence converters 15566 if ( conv === true ) { 15567 conv = converters[ conv2 ]; 15568 15569 // Otherwise, insert the intermediate dataType 15570 } else if ( converters[ conv2 ] !== true ) { 15571 current = tmp[ 0 ]; 15572 dataTypes.unshift( tmp[ 1 ] ); 15573 } 15574 break; 15575 } 15576 } 15577 } 15578 } 15579 15580 // Apply converter (if not an equivalence) 15581 if ( conv !== true ) { 15582 15583 // Unless errors are allowed to bubble, catch and return them 15584 if ( conv && s.throws ) { 15585 response = conv( response ); 15586 } else { 15587 try { 15588 response = conv( response ); 15589 } catch ( e ) { 15590 return { 15591 state: "parsererror", 15592 error: conv ? e : "No conversion from " + prev + " to " + current 15593 }; 15594 } 15595 } 15596 } 15597 } 15598 } 15599 } 15600 15601 return { state: "success", data: response }; 15602} 15603 15604jQuery.extend( { 15605 15606 // Counter for holding the number of active queries 15607 active: 0, 15608 15609 // Last-Modified header cache for next request 15610 lastModified: {}, 15611 etag: {}, 15612 15613 ajaxSettings: { 15614 url: location.href, 15615 type: "GET", 15616 isLocal: rlocalProtocol.test( location.protocol ), 15617 global: true, 15618 processData: true, 15619 async: true, 15620 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 15621 15622 /* 15623 timeout: 0, 15624 data: null, 15625 dataType: null, 15626 username: null, 15627 password: null, 15628 cache: null, 15629 throws: false, 15630 traditional: false, 15631 headers: {}, 15632 */ 15633 15634 accepts: { 15635 "*": allTypes, 15636 text: "text/plain", 15637 html: "text/html", 15638 xml: "application/xml, text/xml", 15639 json: "application/json, text/javascript" 15640 }, 15641 15642 contents: { 15643 xml: /\bxml\b/, 15644 html: /\bhtml/, 15645 json: /\bjson\b/ 15646 }, 15647 15648 responseFields: { 15649 xml: "responseXML", 15650 text: "responseText", 15651 json: "responseJSON" 15652 }, 15653 15654 // Data converters 15655 // Keys separate source (or catchall "*") and destination types with a single space 15656 converters: { 15657 15658 // Convert anything to text 15659 "* text": String, 15660 15661 // Text to html (true = no transformation) 15662 "text html": true, 15663 15664 // Evaluate text as a json expression 15665 "text json": JSON.parse, 15666 15667 // Parse text as xml 15668 "text xml": jQuery.parseXML 15669 }, 15670 15671 // For options that shouldn't be deep extended: 15672 // you can add your own custom options here if 15673 // and when you create one that shouldn't be 15674 // deep extended (see ajaxExtend) 15675 flatOptions: { 15676 url: true, 15677 context: true 15678 } 15679 }, 15680 15681 // Creates a full fledged settings object into target 15682 // with both ajaxSettings and settings fields. 15683 // If target is omitted, writes into ajaxSettings. 15684 ajaxSetup: function( target, settings ) { 15685 return settings ? 15686 15687 // Building a settings object 15688 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 15689 15690 // Extending ajaxSettings 15691 ajaxExtend( jQuery.ajaxSettings, target ); 15692 }, 15693 15694 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 15695 ajaxTransport: addToPrefiltersOrTransports( transports ), 15696 15697 // Main method 15698 ajax: function( url, options ) { 15699 15700 // If url is an object, simulate pre-1.5 signature 15701 if ( typeof url === "object" ) { 15702 options = url; 15703 url = undefined; 15704 } 15705 15706 // Force options to be an object 15707 options = options || {}; 15708 15709 var transport, 15710 15711 // URL without anti-cache param 15712 cacheURL, 15713 15714 // Response headers 15715 responseHeadersString, 15716 responseHeaders, 15717 15718 // timeout handle 15719 timeoutTimer, 15720 15721 // Url cleanup var 15722 urlAnchor, 15723 15724 // Request state (becomes false upon send and true upon completion) 15725 completed, 15726 15727 // To know if global events are to be dispatched 15728 fireGlobals, 15729 15730 // Loop variable 15731 i, 15732 15733 // uncached part of the url 15734 uncached, 15735 15736 // Create the final options object 15737 s = jQuery.ajaxSetup( {}, options ), 15738 15739 // Callbacks context 15740 callbackContext = s.context || s, 15741 15742 // Context for global events is callbackContext if it is a DOM node or jQuery collection 15743 globalEventContext = s.context && 15744 ( callbackContext.nodeType || callbackContext.jquery ) ? 15745 jQuery( callbackContext ) : 15746 jQuery.event, 15747 15748 // Deferreds 15749 deferred = jQuery.Deferred(), 15750 completeDeferred = jQuery.Callbacks( "once memory" ), 15751 15752 // Status-dependent callbacks 15753 statusCode = s.statusCode || {}, 15754 15755 // Headers (they are sent all at once) 15756 requestHeaders = {}, 15757 requestHeadersNames = {}, 15758 15759 // Default abort message 15760 strAbort = "canceled", 15761 15762 // Fake xhr 15763 jqXHR = { 15764 readyState: 0, 15765 15766 // Builds headers hashtable if needed 15767 getResponseHeader: function( key ) { 15768 var match; 15769 if ( completed ) { 15770 if ( !responseHeaders ) { 15771 responseHeaders = {}; 15772 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 15773 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 15774 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 15775 .concat( match[ 2 ] ); 15776 } 15777 } 15778 match = responseHeaders[ key.toLowerCase() + " " ]; 15779 } 15780 return match == null ? null : match.join( ", " ); 15781 }, 15782 15783 // Raw string 15784 getAllResponseHeaders: function() { 15785 return completed ? responseHeadersString : null; 15786 }, 15787 15788 // Caches the header 15789 setRequestHeader: function( name, value ) { 15790 if ( completed == null ) { 15791 name = requestHeadersNames[ name.toLowerCase() ] = 15792 requestHeadersNames[ name.toLowerCase() ] || name; 15793 requestHeaders[ name ] = value; 15794 } 15795 return this; 15796 }, 15797 15798 // Overrides response content-type header 15799 overrideMimeType: function( type ) { 15800 if ( completed == null ) { 15801 s.mimeType = type; 15802 } 15803 return this; 15804 }, 15805 15806 // Status-dependent callbacks 15807 statusCode: function( map ) { 15808 var code; 15809 if ( map ) { 15810 if ( completed ) { 15811 15812 // Execute the appropriate callbacks 15813 jqXHR.always( map[ jqXHR.status ] ); 15814 } else { 15815 15816 // Lazy-add the new callbacks in a way that preserves old ones 15817 for ( code in map ) { 15818 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 15819 } 15820 } 15821 } 15822 return this; 15823 }, 15824 15825 // Cancel the request 15826 abort: function( statusText ) { 15827 var finalText = statusText || strAbort; 15828 if ( transport ) { 15829 transport.abort( finalText ); 15830 } 15831 done( 0, finalText ); 15832 return this; 15833 } 15834 }; 15835 15836 // Attach deferreds 15837 deferred.promise( jqXHR ); 15838 15839 // Add protocol if not provided (prefilters might expect it) 15840 // Handle falsy url in the settings object (#10093: consistency with old signature) 15841 // We also use the url parameter if available 15842 s.url = ( ( url || s.url || location.href ) + "" ) 15843 .replace( rprotocol, location.protocol + "//" ); 15844 15845 // Alias method option to type as per ticket #12004 15846 s.type = options.method || options.type || s.method || s.type; 15847 15848 // Extract dataTypes list 15849 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 15850 15851 // A cross-domain request is in order when the origin doesn't match the current origin. 15852 if ( s.crossDomain == null ) { 15853 urlAnchor = document.createElement( "a" ); 15854 15855 // Support: IE <=8 - 11, Edge 12 - 15 15856 // IE throws exception on accessing the href property if url is malformed, 15857 // e.g. http://example.com:80x/ 15858 try { 15859 urlAnchor.href = s.url; 15860 15861 // Support: IE <=8 - 11 only 15862 // Anchor's host property isn't correctly set when s.url is relative 15863 urlAnchor.href = urlAnchor.href; 15864 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 15865 urlAnchor.protocol + "//" + urlAnchor.host; 15866 } catch ( e ) { 15867 15868 // If there is an error parsing the URL, assume it is crossDomain, 15869 // it can be rejected by the transport if it is invalid 15870 s.crossDomain = true; 15871 } 15872 } 15873 15874 // Convert data if not already a string 15875 if ( s.data && s.processData && typeof s.data !== "string" ) { 15876 s.data = jQuery.param( s.data, s.traditional ); 15877 } 15878 15879 // Apply prefilters 15880 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 15881 15882 // If request was aborted inside a prefilter, stop there 15883 if ( completed ) { 15884 return jqXHR; 15885 } 15886 15887 // We can fire global events as of now if asked to 15888 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 15889 fireGlobals = jQuery.event && s.global; 15890 15891 // Watch for a new set of requests 15892 if ( fireGlobals && jQuery.active++ === 0 ) { 15893 jQuery.event.trigger( "ajaxStart" ); 15894 } 15895 15896 // Uppercase the type 15897 s.type = s.type.toUpperCase(); 15898 15899 // Determine if request has content 15900 s.hasContent = !rnoContent.test( s.type ); 15901 15902 // Save the URL in case we're toying with the If-Modified-Since 15903 // and/or If-None-Match header later on 15904 // Remove hash to simplify url manipulation 15905 cacheURL = s.url.replace( rhash, "" ); 15906 15907 // More options handling for requests with no content 15908 if ( !s.hasContent ) { 15909 15910 // Remember the hash so we can put it back 15911 uncached = s.url.slice( cacheURL.length ); 15912 15913 // If data is available and should be processed, append data to url 15914 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 15915 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 15916 15917 // #9682: remove data so that it's not used in an eventual retry 15918 delete s.data; 15919 } 15920 15921 // Add or update anti-cache param if needed 15922 if ( s.cache === false ) { 15923 cacheURL = cacheURL.replace( rantiCache, "$1" ); 15924 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 15925 uncached; 15926 } 15927 15928 // Put hash and anti-cache on the URL that will be requested (gh-1732) 15929 s.url = cacheURL + uncached; 15930 15931 // Change '%20' to '+' if this is encoded form body content (gh-2658) 15932 } else if ( s.data && s.processData && 15933 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 15934 s.data = s.data.replace( r20, "+" ); 15935 } 15936 15937 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 15938 if ( s.ifModified ) { 15939 if ( jQuery.lastModified[ cacheURL ] ) { 15940 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 15941 } 15942 if ( jQuery.etag[ cacheURL ] ) { 15943 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 15944 } 15945 } 15946 15947 // Set the correct header, if data is being sent 15948 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 15949 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 15950 } 15951 15952 // Set the Accepts header for the server, depending on the dataType 15953 jqXHR.setRequestHeader( 15954 "Accept", 15955 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 15956 s.accepts[ s.dataTypes[ 0 ] ] + 15957 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 15958 s.accepts[ "*" ] 15959 ); 15960 15961 // Check for headers option 15962 for ( i in s.headers ) { 15963 jqXHR.setRequestHeader( i, s.headers[ i ] ); 15964 } 15965 15966 // Allow custom headers/mimetypes and early abort 15967 if ( s.beforeSend && 15968 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 15969 15970 // Abort if not done already and return 15971 return jqXHR.abort(); 15972 } 15973 15974 // Aborting is no longer a cancellation 15975 strAbort = "abort"; 15976 15977 // Install callbacks on deferreds 15978 completeDeferred.add( s.complete ); 15979 jqXHR.done( s.success ); 15980 jqXHR.fail( s.error ); 15981 15982 // Get transport 15983 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 15984 15985 // If no transport, we auto-abort 15986 if ( !transport ) { 15987 done( -1, "No Transport" ); 15988 } else { 15989 jqXHR.readyState = 1; 15990 15991 // Send global event 15992 if ( fireGlobals ) { 15993 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 15994 } 15995 15996 // If request was aborted inside ajaxSend, stop there 15997 if ( completed ) { 15998 return jqXHR; 15999 } 16000 16001 // Timeout 16002 if ( s.async && s.timeout > 0 ) { 16003 timeoutTimer = window.setTimeout( function() { 16004 jqXHR.abort( "timeout" ); 16005 }, s.timeout ); 16006 } 16007 16008 try { 16009 completed = false; 16010 transport.send( requestHeaders, done ); 16011 } catch ( e ) { 16012 16013 // Rethrow post-completion exceptions 16014 if ( completed ) { 16015 throw e; 16016 } 16017 16018 // Propagate others as results 16019 done( -1, e ); 16020 } 16021 } 16022 16023 // Callback for when everything is done 16024 function done( status, nativeStatusText, responses, headers ) { 16025 var isSuccess, success, error, response, modified, 16026 statusText = nativeStatusText; 16027 16028 // Ignore repeat invocations 16029 if ( completed ) { 16030 return; 16031 } 16032 16033 completed = true; 16034 16035 // Clear timeout if it exists 16036 if ( timeoutTimer ) { 16037 window.clearTimeout( timeoutTimer ); 16038 } 16039 16040 // Dereference transport for early garbage collection 16041 // (no matter how long the jqXHR object will be used) 16042 transport = undefined; 16043 16044 // Cache response headers 16045 responseHeadersString = headers || ""; 16046 16047 // Set readyState 16048 jqXHR.readyState = status > 0 ? 4 : 0; 16049 16050 // Determine if successful 16051 isSuccess = status >= 200 && status < 300 || status === 304; 16052 16053 // Get response data 16054 if ( responses ) { 16055 response = ajaxHandleResponses( s, jqXHR, responses ); 16056 } 16057 16058 // Use a noop converter for missing script 16059 if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { 16060 s.converters[ "text script" ] = function() {}; 16061 } 16062 16063 // Convert no matter what (that way responseXXX fields are always set) 16064 response = ajaxConvert( s, response, jqXHR, isSuccess ); 16065 16066 // If successful, handle type chaining 16067 if ( isSuccess ) { 16068 16069 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 16070 if ( s.ifModified ) { 16071 modified = jqXHR.getResponseHeader( "Last-Modified" ); 16072 if ( modified ) { 16073 jQuery.lastModified[ cacheURL ] = modified; 16074 } 16075 modified = jqXHR.getResponseHeader( "etag" ); 16076 if ( modified ) { 16077 jQuery.etag[ cacheURL ] = modified; 16078 } 16079 } 16080 16081 // if no content 16082 if ( status === 204 || s.type === "HEAD" ) { 16083 statusText = "nocontent"; 16084 16085 // if not modified 16086 } else if ( status === 304 ) { 16087 statusText = "notmodified"; 16088 16089 // If we have data, let's convert it 16090 } else { 16091 statusText = response.state; 16092 success = response.data; 16093 error = response.error; 16094 isSuccess = !error; 16095 } 16096 } else { 16097 16098 // Extract error from statusText and normalize for non-aborts 16099 error = statusText; 16100 if ( status || !statusText ) { 16101 statusText = "error"; 16102 if ( status < 0 ) { 16103 status = 0; 16104 } 16105 } 16106 } 16107 16108 // Set data for the fake xhr object 16109 jqXHR.status = status; 16110 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 16111 16112 // Success/Error 16113 if ( isSuccess ) { 16114 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 16115 } else { 16116 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 16117 } 16118 16119 // Status-dependent callbacks 16120 jqXHR.statusCode( statusCode ); 16121 statusCode = undefined; 16122 16123 if ( fireGlobals ) { 16124 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 16125 [ jqXHR, s, isSuccess ? success : error ] ); 16126 } 16127 16128 // Complete 16129 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 16130 16131 if ( fireGlobals ) { 16132 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 16133 16134 // Handle the global AJAX counter 16135 if ( !( --jQuery.active ) ) { 16136 jQuery.event.trigger( "ajaxStop" ); 16137 } 16138 } 16139 } 16140 16141 return jqXHR; 16142 }, 16143 16144 getJSON: function( url, data, callback ) { 16145 return jQuery.get( url, data, callback, "json" ); 16146 }, 16147 16148 getScript: function( url, callback ) { 16149 return jQuery.get( url, undefined, callback, "script" ); 16150 } 16151} ); 16152 16153jQuery.each( [ "get", "post" ], function( _i, method ) { 16154 jQuery[ method ] = function( url, data, callback, type ) { 16155 16156 // Shift arguments if data argument was omitted 16157 if ( isFunction( data ) ) { 16158 type = type || callback; 16159 callback = data; 16160 data = undefined; 16161 } 16162 16163 // The url can be an options object (which then must have .url) 16164 return jQuery.ajax( jQuery.extend( { 16165 url: url, 16166 type: method, 16167 dataType: type, 16168 data: data, 16169 success: callback 16170 }, jQuery.isPlainObject( url ) && url ) ); 16171 }; 16172} ); 16173 16174jQuery.ajaxPrefilter( function( s ) { 16175 var i; 16176 for ( i in s.headers ) { 16177 if ( i.toLowerCase() === "content-type" ) { 16178 s.contentType = s.headers[ i ] || ""; 16179 } 16180 } 16181} ); 16182 16183 16184jQuery._evalUrl = function( url, options, doc ) { 16185 return jQuery.ajax( { 16186 url: url, 16187 16188 // Make this explicit, since user can override this through ajaxSetup (#11264) 16189 type: "GET", 16190 dataType: "script", 16191 cache: true, 16192 async: false, 16193 global: false, 16194 16195 // Only evaluate the response if it is successful (gh-4126) 16196 // dataFilter is not invoked for failure responses, so using it instead 16197 // of the default converter is kludgy but it works. 16198 converters: { 16199 "text script": function() {} 16200 }, 16201 dataFilter: function( response ) { 16202 jQuery.globalEval( response, options, doc ); 16203 } 16204 } ); 16205}; 16206 16207 16208jQuery.fn.extend( { 16209 wrapAll: function( html ) { 16210 var wrap; 16211 16212 if ( this[ 0 ] ) { 16213 if ( isFunction( html ) ) { 16214 html = html.call( this[ 0 ] ); 16215 } 16216 16217 // The elements to wrap the target around 16218 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 16219 16220 if ( this[ 0 ].parentNode ) { 16221 wrap.insertBefore( this[ 0 ] ); 16222 } 16223 16224 wrap.map( function() { 16225 var elem = this; 16226 16227 while ( elem.firstElementChild ) { 16228 elem = elem.firstElementChild; 16229 } 16230 16231 return elem; 16232 } ).append( this ); 16233 } 16234 16235 return this; 16236 }, 16237 16238 wrapInner: function( html ) { 16239 if ( isFunction( html ) ) { 16240 return this.each( function( i ) { 16241 jQuery( this ).wrapInner( html.call( this, i ) ); 16242 } ); 16243 } 16244 16245 return this.each( function() { 16246 var self = jQuery( this ), 16247 contents = self.contents(); 16248 16249 if ( contents.length ) { 16250 contents.wrapAll( html ); 16251 16252 } else { 16253 self.append( html ); 16254 } 16255 } ); 16256 }, 16257 16258 wrap: function( html ) { 16259 var htmlIsFunction = isFunction( html ); 16260 16261 return this.each( function( i ) { 16262 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 16263 } ); 16264 }, 16265 16266 unwrap: function( selector ) { 16267 this.parent( selector ).not( "body" ).each( function() { 16268 jQuery( this ).replaceWith( this.childNodes ); 16269 } ); 16270 return this; 16271 } 16272} ); 16273 16274 16275jQuery.expr.pseudos.hidden = function( elem ) { 16276 return !jQuery.expr.pseudos.visible( elem ); 16277}; 16278jQuery.expr.pseudos.visible = function( elem ) { 16279 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 16280}; 16281 16282 16283 16284 16285jQuery.ajaxSettings.xhr = function() { 16286 try { 16287 return new window.XMLHttpRequest(); 16288 } catch ( e ) {} 16289}; 16290 16291var xhrSuccessStatus = { 16292 16293 // File protocol always yields status code 0, assume 200 16294 0: 200, 16295 16296 // Support: IE <=9 only 16297 // #1450: sometimes IE returns 1223 when it should be 204 16298 1223: 204 16299 }, 16300 xhrSupported = jQuery.ajaxSettings.xhr(); 16301 16302support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 16303support.ajax = xhrSupported = !!xhrSupported; 16304 16305jQuery.ajaxTransport( function( options ) { 16306 var callback, errorCallback; 16307 16308 // Cross domain only allowed if supported through XMLHttpRequest 16309 if ( support.cors || xhrSupported && !options.crossDomain ) { 16310 return { 16311 send: function( headers, complete ) { 16312 var i, 16313 xhr = options.xhr(); 16314 16315 xhr.open( 16316 options.type, 16317 options.url, 16318 options.async, 16319 options.username, 16320 options.password 16321 ); 16322 16323 // Apply custom fields if provided 16324 if ( options.xhrFields ) { 16325 for ( i in options.xhrFields ) { 16326 xhr[ i ] = options.xhrFields[ i ]; 16327 } 16328 } 16329 16330 // Override mime type if needed 16331 if ( options.mimeType && xhr.overrideMimeType ) { 16332 xhr.overrideMimeType( options.mimeType ); 16333 } 16334 16335 // X-Requested-With header 16336 // For cross-domain requests, seeing as conditions for a preflight are 16337 // akin to a jigsaw puzzle, we simply never set it to be sure. 16338 // (it can always be set on a per-request basis or even using ajaxSetup) 16339 // For same-domain requests, won't change header if already provided. 16340 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 16341 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 16342 } 16343 16344 // Set headers 16345 for ( i in headers ) { 16346 xhr.setRequestHeader( i, headers[ i ] ); 16347 } 16348 16349 // Callback 16350 callback = function( type ) { 16351 return function() { 16352 if ( callback ) { 16353 callback = errorCallback = xhr.onload = 16354 xhr.onerror = xhr.onabort = xhr.ontimeout = 16355 xhr.onreadystatechange = null; 16356 16357 if ( type === "abort" ) { 16358 xhr.abort(); 16359 } else if ( type === "error" ) { 16360 16361 // Support: IE <=9 only 16362 // On a manual native abort, IE9 throws 16363 // errors on any property access that is not readyState 16364 if ( typeof xhr.status !== "number" ) { 16365 complete( 0, "error" ); 16366 } else { 16367 complete( 16368 16369 // File: protocol always yields status 0; see #8605, #14207 16370 xhr.status, 16371 xhr.statusText 16372 ); 16373 } 16374 } else { 16375 complete( 16376 xhrSuccessStatus[ xhr.status ] || xhr.status, 16377 xhr.statusText, 16378 16379 // Support: IE <=9 only 16380 // IE9 has no XHR2 but throws on binary (trac-11426) 16381 // For XHR2 non-text, let the caller handle it (gh-2498) 16382 ( xhr.responseType || "text" ) !== "text" || 16383 typeof xhr.responseText !== "string" ? 16384 { binary: xhr.response } : 16385 { text: xhr.responseText }, 16386 xhr.getAllResponseHeaders() 16387 ); 16388 } 16389 } 16390 }; 16391 }; 16392 16393 // Listen to events 16394 xhr.onload = callback(); 16395 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 16396 16397 // Support: IE 9 only 16398 // Use onreadystatechange to replace onabort 16399 // to handle uncaught aborts 16400 if ( xhr.onabort !== undefined ) { 16401 xhr.onabort = errorCallback; 16402 } else { 16403 xhr.onreadystatechange = function() { 16404 16405 // Check readyState before timeout as it changes 16406 if ( xhr.readyState === 4 ) { 16407 16408 // Allow onerror to be called first, 16409 // but that will not handle a native abort 16410 // Also, save errorCallback to a variable 16411 // as xhr.onerror cannot be accessed 16412 window.setTimeout( function() { 16413 if ( callback ) { 16414 errorCallback(); 16415 } 16416 } ); 16417 } 16418 }; 16419 } 16420 16421 // Create the abort callback 16422 callback = callback( "abort" ); 16423 16424 try { 16425 16426 // Do send the request (this may raise an exception) 16427 xhr.send( options.hasContent && options.data || null ); 16428 } catch ( e ) { 16429 16430 // #14683: Only rethrow if this hasn't been notified as an error yet 16431 if ( callback ) { 16432 throw e; 16433 } 16434 } 16435 }, 16436 16437 abort: function() { 16438 if ( callback ) { 16439 callback(); 16440 } 16441 } 16442 }; 16443 } 16444} ); 16445 16446 16447 16448 16449// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 16450jQuery.ajaxPrefilter( function( s ) { 16451 if ( s.crossDomain ) { 16452 s.contents.script = false; 16453 } 16454} ); 16455 16456// Install script dataType 16457jQuery.ajaxSetup( { 16458 accepts: { 16459 script: "text/javascript, application/javascript, " + 16460 "application/ecmascript, application/x-ecmascript" 16461 }, 16462 contents: { 16463 script: /\b(?:java|ecma)script\b/ 16464 }, 16465 converters: { 16466 "text script": function( text ) { 16467 jQuery.globalEval( text ); 16468 return text; 16469 } 16470 } 16471} ); 16472 16473// Handle cache's special case and crossDomain 16474jQuery.ajaxPrefilter( "script", function( s ) { 16475 if ( s.cache === undefined ) { 16476 s.cache = false; 16477 } 16478 if ( s.crossDomain ) { 16479 s.type = "GET"; 16480 } 16481} ); 16482 16483// Bind script tag hack transport 16484jQuery.ajaxTransport( "script", function( s ) { 16485 16486 // This transport only deals with cross domain or forced-by-attrs requests 16487 if ( s.crossDomain || s.scriptAttrs ) { 16488 var script, callback; 16489 return { 16490 send: function( _, complete ) { 16491 script = jQuery( "<script>" ) 16492 .attr( s.scriptAttrs || {} ) 16493 .prop( { charset: s.scriptCharset, src: s.url } ) 16494 .on( "load error", callback = function( evt ) { 16495 script.remove(); 16496 callback = null; 16497 if ( evt ) { 16498 complete( evt.type === "error" ? 404 : 200, evt.type ); 16499 } 16500 } ); 16501 16502 // Use native DOM manipulation to avoid our domManip AJAX trickery 16503 document.head.appendChild( script[ 0 ] ); 16504 }, 16505 abort: function() { 16506 if ( callback ) { 16507 callback(); 16508 } 16509 } 16510 }; 16511 } 16512} ); 16513 16514 16515 16516 16517var oldCallbacks = [], 16518 rjsonp = /(=)\?(?=&|$)|\?\?/; 16519 16520// Default jsonp settings 16521jQuery.ajaxSetup( { 16522 jsonp: "callback", 16523 jsonpCallback: function() { 16524 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 16525 this[ callback ] = true; 16526 return callback; 16527 } 16528} ); 16529 16530// Detect, normalize options and install callbacks for jsonp requests 16531jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 16532 16533 var callbackName, overwritten, responseContainer, 16534 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 16535 "url" : 16536 typeof s.data === "string" && 16537 ( s.contentType || "" ) 16538 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 16539 rjsonp.test( s.data ) && "data" 16540 ); 16541 16542 // Handle iff the expected data type is "jsonp" or we have a parameter to set 16543 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 16544 16545 // Get callback name, remembering preexisting value associated with it 16546 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 16547 s.jsonpCallback() : 16548 s.jsonpCallback; 16549 16550 // Insert callback into url or form data 16551 if ( jsonProp ) { 16552 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 16553 } else if ( s.jsonp !== false ) { 16554 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 16555 } 16556 16557 // Use data converter to retrieve json after script execution 16558 s.converters[ "script json" ] = function() { 16559 if ( !responseContainer ) { 16560 jQuery.error( callbackName + " was not called" ); 16561 } 16562 return responseContainer[ 0 ]; 16563 }; 16564 16565 // Force json dataType 16566 s.dataTypes[ 0 ] = "json"; 16567 16568 // Install callback 16569 overwritten = window[ callbackName ]; 16570 window[ callbackName ] = function() { 16571 responseContainer = arguments; 16572 }; 16573 16574 // Clean-up function (fires after converters) 16575 jqXHR.always( function() { 16576 16577 // If previous value didn't exist - remove it 16578 if ( overwritten === undefined ) { 16579 jQuery( window ).removeProp( callbackName ); 16580 16581 // Otherwise restore preexisting value 16582 } else { 16583 window[ callbackName ] = overwritten; 16584 } 16585 16586 // Save back as free 16587 if ( s[ callbackName ] ) { 16588 16589 // Make sure that re-using the options doesn't screw things around 16590 s.jsonpCallback = originalSettings.jsonpCallback; 16591 16592 // Save the callback name for future use 16593 oldCallbacks.push( callbackName ); 16594 } 16595 16596 // Call if it was a function and we have a response 16597 if ( responseContainer && isFunction( overwritten ) ) { 16598 overwritten( responseContainer[ 0 ] ); 16599 } 16600 16601 responseContainer = overwritten = undefined; 16602 } ); 16603 16604 // Delegate to script 16605 return "script"; 16606 } 16607} ); 16608 16609 16610 16611 16612// Support: Safari 8 only 16613// In Safari 8 documents created via document.implementation.createHTMLDocument 16614// collapse sibling forms: the second one becomes a child of the first one. 16615// Because of that, this security measure has to be disabled in Safari 8. 16616// https://bugs.webkit.org/show_bug.cgi?id=137337 16617support.createHTMLDocument = ( function() { 16618 var body = document.implementation.createHTMLDocument( "" ).body; 16619 body.innerHTML = "<form></form><form></form>"; 16620 return body.childNodes.length === 2; 16621} )(); 16622 16623 16624// Argument "data" should be string of html 16625// context (optional): If specified, the fragment will be created in this context, 16626// defaults to document 16627// keepScripts (optional): If true, will include scripts passed in the html string 16628jQuery.parseHTML = function( data, context, keepScripts ) { 16629 if ( typeof data !== "string" ) { 16630 return []; 16631 } 16632 if ( typeof context === "boolean" ) { 16633 keepScripts = context; 16634 context = false; 16635 } 16636 16637 var base, parsed, scripts; 16638 16639 if ( !context ) { 16640 16641 // Stop scripts or inline event handlers from being executed immediately 16642 // by using document.implementation 16643 if ( support.createHTMLDocument ) { 16644 context = document.implementation.createHTMLDocument( "" ); 16645 16646 // Set the base href for the created document 16647 // so any parsed elements with URLs 16648 // are based on the document's URL (gh-2965) 16649 base = context.createElement( "base" ); 16650 base.href = document.location.href; 16651 context.head.appendChild( base ); 16652 } else { 16653 context = document; 16654 } 16655 } 16656 16657 parsed = rsingleTag.exec( data ); 16658 scripts = !keepScripts && []; 16659 16660 // Single tag 16661 if ( parsed ) { 16662 return [ context.createElement( parsed[ 1 ] ) ]; 16663 } 16664 16665 parsed = buildFragment( [ data ], context, scripts ); 16666 16667 if ( scripts && scripts.length ) { 16668 jQuery( scripts ).remove(); 16669 } 16670 16671 return jQuery.merge( [], parsed.childNodes ); 16672}; 16673 16674 16675/** 16676 * Load a url into a page 16677 */ 16678jQuery.fn.load = function( url, params, callback ) { 16679 var selector, type, response, 16680 self = this, 16681 off = url.indexOf( " " ); 16682 16683 if ( off > -1 ) { 16684 selector = stripAndCollapse( url.slice( off ) ); 16685 url = url.slice( 0, off ); 16686 } 16687 16688 // If it's a function 16689 if ( isFunction( params ) ) { 16690 16691 // We assume that it's the callback 16692 callback = params; 16693 params = undefined; 16694 16695 // Otherwise, build a param string 16696 } else if ( params && typeof params === "object" ) { 16697 type = "POST"; 16698 } 16699 16700 // If we have elements to modify, make the request 16701 if ( self.length > 0 ) { 16702 jQuery.ajax( { 16703 url: url, 16704 16705 // If "type" variable is undefined, then "GET" method will be used. 16706 // Make value of this field explicit since 16707 // user can override it through ajaxSetup method 16708 type: type || "GET", 16709 dataType: "html", 16710 data: params 16711 } ).done( function( responseText ) { 16712 16713 // Save response for use in complete callback 16714 response = arguments; 16715 16716 self.html( selector ? 16717 16718 // If a selector was specified, locate the right elements in a dummy div 16719 // Exclude scripts to avoid IE 'Permission Denied' errors 16720 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 16721 16722 // Otherwise use the full result 16723 responseText ); 16724 16725 // If the request succeeds, this function gets "data", "status", "jqXHR" 16726 // but they are ignored because response was set above. 16727 // If it fails, this function gets "jqXHR", "status", "error" 16728 } ).always( callback && function( jqXHR, status ) { 16729 self.each( function() { 16730 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 16731 } ); 16732 } ); 16733 } 16734 16735 return this; 16736}; 16737 16738 16739 16740 16741jQuery.expr.pseudos.animated = function( elem ) { 16742 return jQuery.grep( jQuery.timers, function( fn ) { 16743 return elem === fn.elem; 16744 } ).length; 16745}; 16746 16747 16748 16749 16750jQuery.offset = { 16751 setOffset: function( elem, options, i ) { 16752 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 16753 position = jQuery.css( elem, "position" ), 16754 curElem = jQuery( elem ), 16755 props = {}; 16756 16757 // Set position first, in-case top/left are set even on static elem 16758 if ( position === "static" ) { 16759 elem.style.position = "relative"; 16760 } 16761 16762 curOffset = curElem.offset(); 16763 curCSSTop = jQuery.css( elem, "top" ); 16764 curCSSLeft = jQuery.css( elem, "left" ); 16765 calculatePosition = ( position === "absolute" || position === "fixed" ) && 16766 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 16767 16768 // Need to be able to calculate position if either 16769 // top or left is auto and position is either absolute or fixed 16770 if ( calculatePosition ) { 16771 curPosition = curElem.position(); 16772 curTop = curPosition.top; 16773 curLeft = curPosition.left; 16774 16775 } else { 16776 curTop = parseFloat( curCSSTop ) || 0; 16777 curLeft = parseFloat( curCSSLeft ) || 0; 16778 } 16779 16780 if ( isFunction( options ) ) { 16781 16782 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 16783 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 16784 } 16785 16786 if ( options.top != null ) { 16787 props.top = ( options.top - curOffset.top ) + curTop; 16788 } 16789 if ( options.left != null ) { 16790 props.left = ( options.left - curOffset.left ) + curLeft; 16791 } 16792 16793 if ( "using" in options ) { 16794 options.using.call( elem, props ); 16795 16796 } else { 16797 if ( typeof props.top === "number" ) { 16798 props.top += "px"; 16799 } 16800 if ( typeof props.left === "number" ) { 16801 props.left += "px"; 16802 } 16803 curElem.css( props ); 16804 } 16805 } 16806}; 16807 16808jQuery.fn.extend( { 16809 16810 // offset() relates an element's border box to the document origin 16811 offset: function( options ) { 16812 16813 // Preserve chaining for setter 16814 if ( arguments.length ) { 16815 return options === undefined ? 16816 this : 16817 this.each( function( i ) { 16818 jQuery.offset.setOffset( this, options, i ); 16819 } ); 16820 } 16821 16822 var rect, win, 16823 elem = this[ 0 ]; 16824 16825 if ( !elem ) { 16826 return; 16827 } 16828 16829 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 16830 // Support: IE <=11 only 16831 // Running getBoundingClientRect on a 16832 // disconnected node in IE throws an error 16833 if ( !elem.getClientRects().length ) { 16834 return { top: 0, left: 0 }; 16835 } 16836 16837 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 16838 rect = elem.getBoundingClientRect(); 16839 win = elem.ownerDocument.defaultView; 16840 return { 16841 top: rect.top + win.pageYOffset, 16842 left: rect.left + win.pageXOffset 16843 }; 16844 }, 16845 16846 // position() relates an element's margin box to its offset parent's padding box 16847 // This corresponds to the behavior of CSS absolute positioning 16848 position: function() { 16849 if ( !this[ 0 ] ) { 16850 return; 16851 } 16852 16853 var offsetParent, offset, doc, 16854 elem = this[ 0 ], 16855 parentOffset = { top: 0, left: 0 }; 16856 16857 // position:fixed elements are offset from the viewport, which itself always has zero offset 16858 if ( jQuery.css( elem, "position" ) === "fixed" ) { 16859 16860 // Assume position:fixed implies availability of getBoundingClientRect 16861 offset = elem.getBoundingClientRect(); 16862 16863 } else { 16864 offset = this.offset(); 16865 16866 // Account for the *real* offset parent, which can be the document or its root element 16867 // when a statically positioned element is identified 16868 doc = elem.ownerDocument; 16869 offsetParent = elem.offsetParent || doc.documentElement; 16870 while ( offsetParent && 16871 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 16872 jQuery.css( offsetParent, "position" ) === "static" ) { 16873 16874 offsetParent = offsetParent.parentNode; 16875 } 16876 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 16877 16878 // Incorporate borders into its offset, since they are outside its content origin 16879 parentOffset = jQuery( offsetParent ).offset(); 16880 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 16881 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 16882 } 16883 } 16884 16885 // Subtract parent offsets and element margins 16886 return { 16887 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 16888 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 16889 }; 16890 }, 16891 16892 // This method will return documentElement in the following cases: 16893 // 1) For the element inside the iframe without offsetParent, this method will return 16894 // documentElement of the parent window 16895 // 2) For the hidden or detached element 16896 // 3) For body or html element, i.e. in case of the html node - it will return itself 16897 // 16898 // but those exceptions were never presented as a real life use-cases 16899 // and might be considered as more preferable results. 16900 // 16901 // This logic, however, is not guaranteed and can change at any point in the future 16902 offsetParent: function() { 16903 return this.map( function() { 16904 var offsetParent = this.offsetParent; 16905 16906 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 16907 offsetParent = offsetParent.offsetParent; 16908 } 16909 16910 return offsetParent || documentElement; 16911 } ); 16912 } 16913} ); 16914 16915// Create scrollLeft and scrollTop methods 16916jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 16917 var top = "pageYOffset" === prop; 16918 16919 jQuery.fn[ method ] = function( val ) { 16920 return access( this, function( elem, method, val ) { 16921 16922 // Coalesce documents and windows 16923 var win; 16924 if ( isWindow( elem ) ) { 16925 win = elem; 16926 } else if ( elem.nodeType === 9 ) { 16927 win = elem.defaultView; 16928 } 16929 16930 if ( val === undefined ) { 16931 return win ? win[ prop ] : elem[ method ]; 16932 } 16933 16934 if ( win ) { 16935 win.scrollTo( 16936 !top ? val : win.pageXOffset, 16937 top ? val : win.pageYOffset 16938 ); 16939 16940 } else { 16941 elem[ method ] = val; 16942 } 16943 }, method, val, arguments.length ); 16944 }; 16945} ); 16946 16947// Support: Safari <=7 - 9.1, Chrome <=37 - 49 16948// Add the top/left cssHooks using jQuery.fn.position 16949// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 16950// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 16951// getComputedStyle returns percent when specified for top/left/bottom/right; 16952// rather than make the css module depend on the offset module, just check for it here 16953jQuery.each( [ "top", "left" ], function( _i, prop ) { 16954 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 16955 function( elem, computed ) { 16956 if ( computed ) { 16957 computed = curCSS( elem, prop ); 16958 16959 // If curCSS returns percentage, fallback to offset 16960 return rnumnonpx.test( computed ) ? 16961 jQuery( elem ).position()[ prop ] + "px" : 16962 computed; 16963 } 16964 } 16965 ); 16966} ); 16967 16968 16969// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 16970jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 16971 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 16972 function( defaultExtra, funcName ) { 16973 16974 // Margin is only for outerHeight, outerWidth 16975 jQuery.fn[ funcName ] = function( margin, value ) { 16976 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 16977 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 16978 16979 return access( this, function( elem, type, value ) { 16980 var doc; 16981 16982 if ( isWindow( elem ) ) { 16983 16984 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 16985 return funcName.indexOf( "outer" ) === 0 ? 16986 elem[ "inner" + name ] : 16987 elem.document.documentElement[ "client" + name ]; 16988 } 16989 16990 // Get document width or height 16991 if ( elem.nodeType === 9 ) { 16992 doc = elem.documentElement; 16993 16994 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 16995 // whichever is greatest 16996 return Math.max( 16997 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 16998 elem.body[ "offset" + name ], doc[ "offset" + name ], 16999 doc[ "client" + name ] 17000 ); 17001 } 17002 17003 return value === undefined ? 17004 17005 // Get width or height on the element, requesting but not forcing parseFloat 17006 jQuery.css( elem, type, extra ) : 17007 17008 // Set width or height on the element 17009 jQuery.style( elem, type, value, extra ); 17010 }, type, chainable ? margin : undefined, chainable ); 17011 }; 17012 } ); 17013} ); 17014 17015 17016jQuery.each( [ 17017 "ajaxStart", 17018 "ajaxStop", 17019 "ajaxComplete", 17020 "ajaxError", 17021 "ajaxSuccess", 17022 "ajaxSend" 17023], function( _i, type ) { 17024 jQuery.fn[ type ] = function( fn ) { 17025 return this.on( type, fn ); 17026 }; 17027} ); 17028 17029 17030 17031 17032jQuery.fn.extend( { 17033 17034 bind: function( types, data, fn ) { 17035 return this.on( types, null, data, fn ); 17036 }, 17037 unbind: function( types, fn ) { 17038 return this.off( types, null, fn ); 17039 }, 17040 17041 delegate: function( selector, types, data, fn ) { 17042 return this.on( types, selector, data, fn ); 17043 }, 17044 undelegate: function( selector, types, fn ) { 17045 17046 // ( namespace ) or ( selector, types [, fn] ) 17047 return arguments.length === 1 ? 17048 this.off( selector, "**" ) : 17049 this.off( types, selector || "**", fn ); 17050 }, 17051 17052 hover: function( fnOver, fnOut ) { 17053 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 17054 } 17055} ); 17056 17057jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 17058 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 17059 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 17060 function( _i, name ) { 17061 17062 // Handle event binding 17063 jQuery.fn[ name ] = function( data, fn ) { 17064 return arguments.length > 0 ? 17065 this.on( name, null, data, fn ) : 17066 this.trigger( name ); 17067 }; 17068 } ); 17069 17070 17071 17072 17073// Support: Android <=4.0 only 17074// Make sure we trim BOM and NBSP 17075var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 17076 17077// Bind a function to a context, optionally partially applying any 17078// arguments. 17079// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 17080// However, it is not slated for removal any time soon 17081jQuery.proxy = function( fn, context ) { 17082 var tmp, args, proxy; 17083 17084 if ( typeof context === "string" ) { 17085 tmp = fn[ context ]; 17086 context = fn; 17087 fn = tmp; 17088 } 17089 17090 // Quick check to determine if target is callable, in the spec 17091 // this throws a TypeError, but we will just return undefined. 17092 if ( !isFunction( fn ) ) { 17093 return undefined; 17094 } 17095 17096 // Simulated bind 17097 args = slice.call( arguments, 2 ); 17098 proxy = function() { 17099 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 17100 }; 17101 17102 // Set the guid of unique handler to the same of original handler, so it can be removed 17103 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 17104 17105 return proxy; 17106}; 17107 17108jQuery.holdReady = function( hold ) { 17109 if ( hold ) { 17110 jQuery.readyWait++; 17111 } else { 17112 jQuery.ready( true ); 17113 } 17114}; 17115jQuery.isArray = Array.isArray; 17116jQuery.parseJSON = JSON.parse; 17117jQuery.nodeName = nodeName; 17118jQuery.isFunction = isFunction; 17119jQuery.isWindow = isWindow; 17120jQuery.camelCase = camelCase; 17121jQuery.type = toType; 17122 17123jQuery.now = Date.now; 17124 17125jQuery.isNumeric = function( obj ) { 17126 17127 // As of jQuery 3.0, isNumeric is limited to 17128 // strings and numbers (primitives or objects) 17129 // that can be coerced to finite numbers (gh-2662) 17130 var type = jQuery.type( obj ); 17131 return ( type === "number" || type === "string" ) && 17132 17133 // parseFloat NaNs numeric-cast false positives ("") 17134 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 17135 // subtraction forces infinities to NaN 17136 !isNaN( obj - parseFloat( obj ) ); 17137}; 17138 17139jQuery.trim = function( text ) { 17140 return text == null ? 17141 "" : 17142 ( text + "" ).replace( rtrim, "" ); 17143}; 17144 17145 17146 17147// Register as a named AMD module, since jQuery can be concatenated with other 17148// files that may use define, but not via a proper concatenation script that 17149// understands anonymous AMD modules. A named AMD is safest and most robust 17150// way to register. Lowercase jquery is used because AMD module names are 17151// derived from file names, and jQuery is normally delivered in a lowercase 17152// file name. Do this after creating the global so that if an AMD module wants 17153// to call noConflict to hide this version of jQuery, it will work. 17154 17155// Note that for maximum portability, libraries that are not jQuery should 17156// declare themselves as anonymous modules, and avoid setting a global if an 17157// AMD loader is present. jQuery is a special case. For more information, see 17158// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 17159 17160if ( true ) { 17161 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 17162 return jQuery; 17163 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 17164 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 17165} 17166 17167 17168 17169 17170var 17171 17172 // Map over jQuery in case of overwrite 17173 _jQuery = window.jQuery, 17174 17175 // Map over the $ in case of overwrite 17176 _$ = window.$; 17177 17178jQuery.noConflict = function( deep ) { 17179 if ( window.$ === jQuery ) { 17180 window.$ = _$; 17181 } 17182 17183 if ( deep && window.jQuery === jQuery ) { 17184 window.jQuery = _jQuery; 17185 } 17186 17187 return jQuery; 17188}; 17189 17190// Expose jQuery and $ identifiers, even in AMD 17191// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 17192// and CommonJS for browser emulators (#13566) 17193if ( typeof noGlobal === "undefined" ) { 17194 window.jQuery = window.$ = jQuery; 17195} 17196 17197 17198 17199 17200return jQuery; 17201} ); 17202 17203 17204/***/ }), 17205
vendor: 543,063 bytes, lines 17206-34370
17206/***/ "./node_modules/lodash/lodash.js": 17207/*!***************************************!*\ 17208 !*** ./node_modules/lodash/lodash.js ***! 17209 \***************************************/ 17210/*! no static exports found */ 17211/***/ (function(module, exports, __webpack_require__) { 17212 17213/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** 17214 * @license 17215 * Lodash <https://lodash.com/> 17216 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 17217 * Released under MIT license <https://lodash.com/license> 17218 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 17219 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 17220 */ 17221;(function() { 17222 17223 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 17224 var undefined; 17225 17226 /** Used as the semantic version number. */ 17227 var VERSION = '4.17.19'; 17228 17229 /** Used as the size to enable large array optimizations. */ 17230 var LARGE_ARRAY_SIZE = 200; 17231 17232 /** Error message constants. */ 17233 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 17234 FUNC_ERROR_TEXT = 'Expected a function'; 17235 17236 /** Used to stand-in for `undefined` hash values. */ 17237 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 17238 17239 /** Used as the maximum memoize cache size. */ 17240 var MAX_MEMOIZE_SIZE = 500; 17241 17242 /** Used as the internal argument placeholder. */ 17243 var PLACEHOLDER = '__lodash_placeholder__'; 17244 17245 /** Used to compose bitmasks for cloning. */ 17246 var CLONE_DEEP_FLAG = 1, 17247 CLONE_FLAT_FLAG = 2, 17248 CLONE_SYMBOLS_FLAG = 4; 17249 17250 /** Used to compose bitmasks for value comparisons. */ 17251 var COMPARE_PARTIAL_FLAG = 1, 17252 COMPARE_UNORDERED_FLAG = 2; 17253 17254 /** Used to compose bitmasks for function metadata. */ 17255 var WRAP_BIND_FLAG = 1, 17256 WRAP_BIND_KEY_FLAG = 2, 17257 WRAP_CURRY_BOUND_FLAG = 4, 17258 WRAP_CURRY_FLAG = 8, 17259 WRAP_CURRY_RIGHT_FLAG = 16, 17260 WRAP_PARTIAL_FLAG = 32, 17261 WRAP_PARTIAL_RIGHT_FLAG = 64, 17262 WRAP_ARY_FLAG = 128, 17263 WRAP_REARG_FLAG = 256, 17264 WRAP_FLIP_FLAG = 512; 17265 17266 /** Used as default options for `_.truncate`. */ 17267 var DEFAULT_TRUNC_LENGTH = 30, 17268 DEFAULT_TRUNC_OMISSION = '...'; 17269 17270 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 17271 var HOT_COUNT = 800, 17272 HOT_SPAN = 16; 17273 17274 /** Used to indicate the type of lazy iteratees. */ 17275 var LAZY_FILTER_FLAG = 1, 17276 LAZY_MAP_FLAG = 2, 17277 LAZY_WHILE_FLAG = 3; 17278 17279 /** Used as references for various `Number` constants. */ 17280 var INFINITY = 1 / 0, 17281 MAX_SAFE_INTEGER = 9007199254740991, 17282 MAX_INTEGER = 1.7976931348623157e+308, 17283 NAN = 0 / 0; 17284 17285 /** Used as references for the maximum length and index of an array. */ 17286 var MAX_ARRAY_LENGTH = 4294967295, 17287 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 17288 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 17289 17290 /** Used to associate wrap methods with their bit flags. */ 17291 var wrapFlags = [ 17292 ['ary', WRAP_ARY_FLAG], 17293 ['bind', WRAP_BIND_FLAG], 17294 ['bindKey', WRAP_BIND_KEY_FLAG], 17295 ['curry', WRAP_CURRY_FLAG], 17296 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 17297 ['flip', WRAP_FLIP_FLAG], 17298 ['partial', WRAP_PARTIAL_FLAG], 17299 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 17300 ['rearg', WRAP_REARG_FLAG] 17301 ]; 17302 17303 /** `Object#toString` result references. */ 17304 var argsTag = '[object Arguments]', 17305 arrayTag = '[object Array]', 17306 asyncTag = '[object AsyncFunction]', 17307 boolTag = '[object Boolean]', 17308 dateTag = '[object Date]', 17309 domExcTag = '[object DOMException]', 17310 errorTag = '[object Error]', 17311 funcTag = '[object Function]', 17312 genTag = '[object GeneratorFunction]', 17313 mapTag = '[object Map]', 17314 numberTag = '[object Number]', 17315 nullTag = '[object Null]', 17316 objectTag = '[object Object]', 17317 promiseTag = '[object Promise]', 17318 proxyTag = '[object Proxy]', 17319 regexpTag = '[object RegExp]', 17320 setTag = '[object Set]', 17321 stringTag = '[object String]', 17322 symbolTag = '[object Symbol]', 17323 undefinedTag = '[object Undefined]', 17324 weakMapTag = '[object WeakMap]', 17325 weakSetTag = '[object WeakSet]'; 17326 17327 var arrayBufferTag = '[object ArrayBuffer]', 17328 dataViewTag = '[object DataView]', 17329 float32Tag = '[object Float32Array]', 17330 float64Tag = '[object Float64Array]', 17331 int8Tag = '[object Int8Array]', 17332 int16Tag = '[object Int16Array]', 17333 int32Tag = '[object Int32Array]', 17334 uint8Tag = '[object Uint8Array]', 17335 uint8ClampedTag = '[object Uint8ClampedArray]', 17336 uint16Tag = '[object Uint16Array]', 17337 uint32Tag = '[object Uint32Array]'; 17338 17339 /** Used to match empty string literals in compiled template source. */ 17340 var reEmptyStringLeading = /\b__p \+= '';/g, 17341 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 17342 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 17343 17344 /** Used to match HTML entities and HTML characters. */ 17345 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 17346 reUnescapedHtml = /[&<>"']/g, 17347 reHasEscapedHtml = RegExp(reEscapedHtml.source), 17348 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 17349 17350 /** Used to match template delimiters. */ 17351 var reEscape = /<%-([\s\S]+?)%>/g, 17352 reEvaluate = /<%([\s\S]+?)%>/g, 17353 reInterpolate = /<%=([\s\S]+?)%>/g; 17354 17355 /** Used to match property names within property paths. */ 17356 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 17357 reIsPlainProp = /^\w*$/, 17358 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 17359 17360 /** 17361 * Used to match `RegExp` 17362 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 17363 */ 17364 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 17365 reHasRegExpChar = RegExp(reRegExpChar.source); 17366 17367 /** Used to match leading and trailing whitespace. */ 17368 var reTrim = /^\s+|\s+$/g, 17369 reTrimStart = /^\s+/, 17370 reTrimEnd = /\s+$/; 17371 17372 /** Used to match wrap detail comments. */ 17373 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 17374 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 17375 reSplitDetails = /,? & /; 17376 17377 /** Used to match words composed of alphanumeric characters. */ 17378 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 17379 17380 /** Used to match backslashes in property paths. */ 17381 var reEscapeChar = /\\(\\)?/g; 17382 17383 /** 17384 * Used to match 17385 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 17386 */ 17387 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 17388 17389 /** Used to match `RegExp` flags from their coerced string values. */ 17390 var reFlags = /\w*$/; 17391 17392 /** Used to detect bad signed hexadecimal string values. */ 17393 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 17394 17395 /** Used to detect binary string values. */ 17396 var reIsBinary = /^0b[01]+$/i; 17397 17398 /** Used to detect host constructors (Safari). */ 17399 var reIsHostCtor = /^\[object .+?Constructor\]$/; 17400 17401 /** Used to detect octal string values. */ 17402 var reIsOctal = /^0o[0-7]+$/i; 17403 17404 /** Used to detect unsigned integer values. */ 17405 var reIsUint = /^(?:0|[1-9]\d*)$/; 17406 17407 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 17408 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 17409 17410 /** Used to ensure capturing order of template delimiters. */ 17411 var reNoMatch = /($^)/; 17412 17413 /** Used to match unescaped characters in compiled string literals. */ 17414 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 17415 17416 /** Used to compose unicode character classes. */ 17417 var rsAstralRange = '\\ud800-\\udfff', 17418 rsComboMarksRange = '\\u0300-\\u036f', 17419 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 17420 rsComboSymbolsRange = '\\u20d0-\\u20ff', 17421 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 17422 rsDingbatRange = '\\u2700-\\u27bf', 17423 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 17424 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 17425 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 17426 rsPunctuationRange = '\\u2000-\\u206f', 17427 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', 17428 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 17429 rsVarRange = '\\ufe0e\\ufe0f', 17430 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 17431 17432 /** Used to compose unicode capture groups. */ 17433 var rsApos = "['\u2019]", 17434 rsAstral = '[' + rsAstralRange + ']', 17435 rsBreak = '[' + rsBreakRange + ']', 17436 rsCombo = '[' + rsComboRange + ']', 17437 rsDigits = '\\d+', 17438 rsDingbat = '[' + rsDingbatRange + ']', 17439 rsLower = '[' + rsLowerRange + ']', 17440 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 17441 rsFitz = '\\ud83c[\\udffb-\\udfff]', 17442 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 17443 rsNonAstral = '[^' + rsAstralRange + ']', 17444 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 17445 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 17446 rsUpper = '[' + rsUpperRange + ']', 17447 rsZWJ = '\\u200d'; 17448 17449 /** Used to compose unicode regexes. */ 17450 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 17451 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 17452 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 17453 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 17454 reOptMod = rsModifier + '?', 17455 rsOptVar = '[' + rsVarRange + ']?', 17456 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 17457 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', 17458 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', 17459 rsSeq = rsOptVar + reOptMod + rsOptJoin, 17460 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 17461 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 17462 17463 /** Used to match apostrophes. */ 17464 var reApos = RegExp(rsApos, 'g'); 17465 17466 /** 17467 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 17468 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 17469 */ 17470 var reComboMark = RegExp(rsCombo, 'g'); 17471 17472 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 17473 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 17474 17475 /** Used to match complex or compound words. */ 17476 var reUnicodeWord = RegExp([ 17477 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 17478 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 17479 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 17480 rsUpper + '+' + rsOptContrUpper, 17481 rsOrdUpper, 17482 rsOrdLower, 17483 rsDigits, 17484 rsEmoji 17485 ].join('|'), 'g'); 17486 17487 /** 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/). */ 17488 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 17489 17490 /** Used to detect strings that need a more robust regexp to match words. */ 17491 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 ]/; 17492 17493 /** Used to assign default `context` object properties. */ 17494 var contextProps = [ 17495 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 17496 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 17497 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 17498 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 17499 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 17500 ]; 17501 17502 /** Used to make template sourceURLs easier to identify. */ 17503 var templateCounter = -1; 17504 17505 /** Used to identify `toStringTag` values of typed arrays. */ 17506 var typedArrayTags = {}; 17507 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 17508 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 17509 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 17510 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 17511 typedArrayTags[uint32Tag] = true; 17512 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 17513 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 17514 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 17515 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 17516 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 17517 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 17518 typedArrayTags[setTag] = typedArrayTags[stringTag] = 17519 typedArrayTags[weakMapTag] = false; 17520 17521 /** Used to identify `toStringTag` values supported by `_.clone`. */ 17522 var cloneableTags = {}; 17523 cloneableTags[argsTag] = cloneableTags[arrayTag] = 17524 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 17525 cloneableTags[boolTag] = cloneableTags[dateTag] = 17526 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 17527 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 17528 cloneableTags[int32Tag] = cloneableTags[mapTag] = 17529 cloneableTags[numberTag] = cloneableTags[objectTag] = 17530 cloneableTags[regexpTag] = cloneableTags[setTag] = 17531 cloneableTags[stringTag] = cloneableTags[symbolTag] = 17532 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 17533 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 17534 cloneableTags[errorTag] = cloneableTags[funcTag] = 17535 cloneableTags[weakMapTag] = false; 17536 17537 /** Used to map Latin Unicode letters to basic Latin letters. */ 17538 var deburredLetters = { 17539 // Latin-1 Supplement block. 17540 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 17541 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 17542 '\xc7': 'C', '\xe7': 'c', 17543 '\xd0': 'D', '\xf0': 'd', 17544 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 17545 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 17546 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 17547 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 17548 '\xd1': 'N', '\xf1': 'n', 17549 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 17550 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 17551 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 17552 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 17553 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 17554 '\xc6': 'Ae', '\xe6': 'ae', 17555 '\xde': 'Th', '\xfe': 'th', 17556 '\xdf': 'ss', 17557 // Latin Extended-A block. 17558 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 17559 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 17560 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 17561 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 17562 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 17563 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 17564 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 17565 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 17566 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 17567 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 17568 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 17569 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 17570 '\u0134': 'J', '\u0135': 'j', 17571 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 17572 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 17573 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 17574 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 17575 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 17576 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 17577 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 17578 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 17579 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 17580 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 17581 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 17582 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 17583 '\u0163': 't', '\u0165': 't', '\u0167': 't', 17584 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 17585 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 17586 '\u0174': 'W', '\u0175': 'w', 17587 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 17588 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 17589 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 17590 '\u0132': 'IJ', '\u0133': 'ij', 17591 '\u0152': 'Oe', '\u0153': 'oe', 17592 '\u0149': "'n", '\u017f': 's' 17593 }; 17594 17595 /** Used to map characters to HTML entities. */ 17596 var htmlEscapes = { 17597 '&': '&', 17598 '<': '<', 17599 '>': '>', 17600 '"': '"', 17601 "'": ''' 17602 }; 17603 17604 /** Used to map HTML entities to characters. */ 17605 var htmlUnescapes = { 17606 '&': '&', 17607 '<': '<', 17608 '>': '>', 17609 '"': '"', 17610 ''': "'" 17611 }; 17612 17613 /** Used to escape characters for inclusion in compiled string literals. */ 17614 var stringEscapes = { 17615 '\\': '\\', 17616 "'": "'", 17617 '\n': 'n', 17618 '\r': 'r', 17619 '\u2028': 'u2028', 17620 '\u2029': 'u2029' 17621 }; 17622 17623 /** Built-in method references without a dependency on `root`. */ 17624 var freeParseFloat = parseFloat, 17625 freeParseInt = parseInt; 17626 17627 /** Detect free variable `global` from Node.js. */ 17628 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 17629 17630 /** Detect free variable `self`. */ 17631 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 17632 17633 /** Used as a reference to the global object. */ 17634 var root = freeGlobal || freeSelf || Function('return this')(); 17635 17636 /** Detect free variable `exports`. */ 17637 var freeExports = true && exports && !exports.nodeType && exports; 17638 17639 /** Detect free variable `module`. */ 17640 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; 17641 17642 /** Detect the popular CommonJS extension `module.exports`. */ 17643 var moduleExports = freeModule && freeModule.exports === freeExports; 17644 17645 /** Detect free variable `process` from Node.js. */ 17646 var freeProcess = moduleExports && freeGlobal.process; 17647 17648 /** Used to access faster Node.js helpers. */ 17649 var nodeUtil = (function() { 17650 try { 17651 // Use `util.types` for Node.js 10+. 17652 var types = freeModule && freeModule.require && freeModule.require('util').types; 17653 17654 if (types) { 17655 return types; 17656 } 17657 17658 // Legacy `process.binding('util')` for Node.js < 10. 17659 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 17660 } catch (e) {} 17661 }()); 17662 17663 /* Node.js helper references. */ 17664 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 17665 nodeIsDate = nodeUtil && nodeUtil.isDate, 17666 nodeIsMap = nodeUtil && nodeUtil.isMap, 17667 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 17668 nodeIsSet = nodeUtil && nodeUtil.isSet, 17669 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 17670 17671 /*--------------------------------------------------------------------------*/ 17672 17673 /** 17674 * A faster alternative to `Function#apply`, this function invokes `func` 17675 * with the `this` binding of `thisArg` and the arguments of `args`. 17676 * 17677 * @private 17678 * @param {Function} func The function to invoke. 17679 * @param {*} thisArg The `this` binding of `func`. 17680 * @param {Array} args The arguments to invoke `func` with. 17681 * @returns {*} Returns the result of `func`. 17682 */ 17683 function apply(func, thisArg, args) { 17684 switch (args.length) { 17685 case 0: return func.call(thisArg); 17686 case 1: return func.call(thisArg, args[0]); 17687 case 2: return func.call(thisArg, args[0], args[1]); 17688 case 3: return func.call(thisArg, args[0], args[1], args[2]); 17689 } 17690 return func.apply(thisArg, args); 17691 } 17692 17693 /** 17694 * A specialized version of `baseAggregator` for arrays. 17695 * 17696 * @private 17697 * @param {Array} [array] The array to iterate over. 17698 * @param {Function} setter The function to set `accumulator` values. 17699 * @param {Function} iteratee The iteratee to transform keys. 17700 * @param {Object} accumulator The initial aggregated object. 17701 * @returns {Function} Returns `accumulator`. 17702 */ 17703 function arrayAggregator(array, setter, iteratee, accumulator) { 17704 var index = -1, 17705 length = array == null ? 0 : array.length; 17706 17707 while (++index < length) { 17708 var value = array[index]; 17709 setter(accumulator, value, iteratee(value), array); 17710 } 17711 return accumulator; 17712 } 17713 17714 /** 17715 * A specialized version of `_.forEach` for arrays without support for 17716 * iteratee shorthands. 17717 * 17718 * @private 17719 * @param {Array} [array] The array to iterate over. 17720 * @param {Function} iteratee The function invoked per iteration. 17721 * @returns {Array} Returns `array`. 17722 */ 17723 function arrayEach(array, iteratee) { 17724 var index = -1, 17725 length = array == null ? 0 : array.length; 17726 17727 while (++index < length) { 17728 if (iteratee(array[index], index, array) === false) { 17729 break; 17730 } 17731 } 17732 return array; 17733 } 17734 17735 /** 17736 * A specialized version of `_.forEachRight` for arrays without support for 17737 * iteratee shorthands. 17738 * 17739 * @private 17740 * @param {Array} [array] The array to iterate over. 17741 * @param {Function} iteratee The function invoked per iteration. 17742 * @returns {Array} Returns `array`. 17743 */ 17744 function arrayEachRight(array, iteratee) { 17745 var length = array == null ? 0 : array.length; 17746 17747 while (length--) { 17748 if (iteratee(array[length], length, array) === false) { 17749 break; 17750 } 17751 } 17752 return array; 17753 } 17754 17755 /** 17756 * A specialized version of `_.every` for arrays without support for 17757 * iteratee shorthands. 17758 * 17759 * @private 17760 * @param {Array} [array] The array to iterate over. 17761 * @param {Function} predicate The function invoked per iteration. 17762 * @returns {boolean} Returns `true` if all elements pass the predicate check, 17763 * else `false`. 17764 */ 17765 function arrayEvery(array, predicate) { 17766 var index = -1, 17767 length = array == null ? 0 : array.length; 17768 17769 while (++index < length) { 17770 if (!predicate(array[index], index, array)) { 17771 return false; 17772 } 17773 } 17774 return true; 17775 } 17776 17777 /** 17778 * A specialized version of `_.filter` for arrays without support for 17779 * iteratee shorthands. 17780 * 17781 * @private 17782 * @param {Array} [array] The array to iterate over. 17783 * @param {Function} predicate The function invoked per iteration. 17784 * @returns {Array} Returns the new filtered array. 17785 */ 17786 function arrayFilter(array, predicate) { 17787 var index = -1, 17788 length = array == null ? 0 : array.length, 17789 resIndex = 0, 17790 result = []; 17791 17792 while (++index < length) { 17793 var value = array[index]; 17794 if (predicate(value, index, array)) { 17795 result[resIndex++] = value; 17796 } 17797 } 17798 return result; 17799 } 17800 17801 /** 17802 * A specialized version of `_.includes` for arrays without support for 17803 * specifying an index to search from. 17804 * 17805 * @private 17806 * @param {Array} [array] The array to inspect. 17807 * @param {*} target The value to search for. 17808 * @returns {boolean} Returns `true` if `target` is found, else `false`. 17809 */ 17810 function arrayIncludes(array, value) { 17811 var length = array == null ? 0 : array.length; 17812 return !!length && baseIndexOf(array, value, 0) > -1; 17813 } 17814 17815 /** 17816 * This function is like `arrayIncludes` except that it accepts a comparator. 17817 * 17818 * @private 17819 * @param {Array} [array] The array to inspect. 17820 * @param {*} target The value to search for. 17821 * @param {Function} comparator The comparator invoked per element. 17822 * @returns {boolean} Returns `true` if `target` is found, else `false`. 17823 */ 17824 function arrayIncludesWith(array, value, comparator) { 17825 var index = -1, 17826 length = array == null ? 0 : array.length; 17827 17828 while (++index < length) { 17829 if (comparator(value, array[index])) { 17830 return true; 17831 } 17832 } 17833 return false; 17834 } 17835 17836 /** 17837 * A specialized version of `_.map` for arrays without support for iteratee 17838 * shorthands. 17839 * 17840 * @private 17841 * @param {Array} [array] The array to iterate over. 17842 * @param {Function} iteratee The function invoked per iteration. 17843 * @returns {Array} Returns the new mapped array. 17844 */ 17845 function arrayMap(array, iteratee) { 17846 var index = -1, 17847 length = array == null ? 0 : array.length, 17848 result = Array(length); 17849 17850 while (++index < length) { 17851 result[index] = iteratee(array[index], index, array); 17852 } 17853 return result; 17854 } 17855 17856 /** 17857 * Appends the elements of `values` to `array`. 17858 * 17859 * @private 17860 * @param {Array} array The array to modify. 17861 * @param {Array} values The values to append. 17862 * @returns {Array} Returns `array`. 17863 */ 17864 function arrayPush(array, values) { 17865 var index = -1, 17866 length = values.length, 17867 offset = array.length; 17868 17869 while (++index < length) { 17870 array[offset + index] = values[index]; 17871 } 17872 return array; 17873 } 17874 17875 /** 17876 * A specialized version of `_.reduce` for arrays without support for 17877 * iteratee shorthands. 17878 * 17879 * @private 17880 * @param {Array} [array] The array to iterate over. 17881 * @param {Function} iteratee The function invoked per iteration. 17882 * @param {*} [accumulator] The initial value. 17883 * @param {boolean} [initAccum] Specify using the first element of `array` as 17884 * the initial value. 17885 * @returns {*} Returns the accumulated value. 17886 */ 17887 function arrayReduce(array, iteratee, accumulator, initAccum) { 17888 var index = -1, 17889 length = array == null ? 0 : array.length; 17890 17891 if (initAccum && length) { 17892 accumulator = array[++index]; 17893 } 17894 while (++index < length) { 17895 accumulator = iteratee(accumulator, array[index], index, array); 17896 } 17897 return accumulator; 17898 } 17899 17900 /** 17901 * A specialized version of `_.reduceRight` for arrays without support for 17902 * iteratee shorthands. 17903 * 17904 * @private 17905 * @param {Array} [array] The array to iterate over. 17906 * @param {Function} iteratee The function invoked per iteration. 17907 * @param {*} [accumulator] The initial value. 17908 * @param {boolean} [initAccum] Specify using the last element of `array` as 17909 * the initial value. 17910 * @returns {*} Returns the accumulated value. 17911 */ 17912 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 17913 var length = array == null ? 0 : array.length; 17914 if (initAccum && length) { 17915 accumulator = array[--length]; 17916 } 17917 while (length--) { 17918 accumulator = iteratee(accumulator, array[length], length, array); 17919 } 17920 return accumulator; 17921 } 17922 17923 /** 17924 * A specialized version of `_.some` for arrays without support for iteratee 17925 * shorthands. 17926 * 17927 * @private 17928 * @param {Array} [array] The array to iterate over. 17929 * @param {Function} predicate The function invoked per iteration. 17930 * @returns {boolean} Returns `true` if any element passes the predicate check, 17931 * else `false`. 17932 */ 17933 function arraySome(array, predicate) { 17934 var index = -1, 17935 length = array == null ? 0 : array.length; 17936 17937 while (++index < length) { 17938 if (predicate(array[index], index, array)) { 17939 return true; 17940 } 17941 } 17942 return false; 17943 } 17944 17945 /** 17946 * Gets the size of an ASCII `string`. 17947 * 17948 * @private 17949 * @param {string} string The string inspect. 17950 * @returns {number} Returns the string size. 17951 */ 17952 var asciiSize = baseProperty('length'); 17953 17954 /** 17955 * Converts an ASCII `string` to an array. 17956 * 17957 * @private 17958 * @param {string} string The string to convert. 17959 * @returns {Array} Returns the converted array. 17960 */ 17961 function asciiToArray(string) { 17962 return string.split(''); 17963 } 17964 17965 /** 17966 * Splits an ASCII `string` into an array of its words. 17967 * 17968 * @private 17969 * @param {string} The string to inspect. 17970 * @returns {Array} Returns the words of `string`. 17971 */ 17972 function asciiWords(string) { 17973 return string.match(reAsciiWord) || []; 17974 } 17975 17976 /** 17977 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 17978 * without support for iteratee shorthands, which iterates over `collection` 17979 * using `eachFunc`. 17980 * 17981 * @private 17982 * @param {Array|Object} collection The collection to inspect. 17983 * @param {Function} predicate The function invoked per iteration. 17984 * @param {Function} eachFunc The function to iterate over `collection`. 17985 * @returns {*} Returns the found element or its key, else `undefined`. 17986 */ 17987 function baseFindKey(collection, predicate, eachFunc) { 17988 var result; 17989 eachFunc(collection, function(value, key, collection) { 17990 if (predicate(value, key, collection)) { 17991 result = key; 17992 return false; 17993 } 17994 }); 17995 return result; 17996 } 17997 17998 /** 17999 * The base implementation of `_.findIndex` and `_.findLastIndex` without 18000 * support for iteratee shorthands. 18001 * 18002 * @private 18003 * @param {Array} array The array to inspect. 18004 * @param {Function} predicate The function invoked per iteration. 18005 * @param {number} fromIndex The index to search from. 18006 * @param {boolean} [fromRight] Specify iterating from right to left. 18007 * @returns {number} Returns the index of the matched value, else `-1`. 18008 */ 18009 function baseFindIndex(array, predicate, fromIndex, fromRight) { 18010 var length = array.length, 18011 index = fromIndex + (fromRight ? 1 : -1); 18012 18013 while ((fromRight ? index-- : ++index < length)) { 18014 if (predicate(array[index], index, array)) { 18015 return index; 18016 } 18017 } 18018 return -1; 18019 } 18020 18021 /** 18022 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 18023 * 18024 * @private 18025 * @param {Array} array The array to inspect. 18026 * @param {*} value The value to search for. 18027 * @param {number} fromIndex The index to search from. 18028 * @returns {number} Returns the index of the matched value, else `-1`. 18029 */ 18030 function baseIndexOf(array, value, fromIndex) { 18031 return value === value 18032 ? strictIndexOf(array, value, fromIndex) 18033 : baseFindIndex(array, baseIsNaN, fromIndex); 18034 } 18035 18036 /** 18037 * This function is like `baseIndexOf` except that it accepts a comparator. 18038 * 18039 * @private 18040 * @param {Array} array The array to inspect. 18041 * @param {*} value The value to search for. 18042 * @param {number} fromIndex The index to search from. 18043 * @param {Function} comparator The comparator invoked per element. 18044 * @returns {number} Returns the index of the matched value, else `-1`. 18045 */ 18046 function baseIndexOfWith(array, value, fromIndex, comparator) { 18047 var index = fromIndex - 1, 18048 length = array.length; 18049 18050 while (++index < length) { 18051 if (comparator(array[index], value)) { 18052 return index; 18053 } 18054 } 18055 return -1; 18056 } 18057 18058 /** 18059 * The base implementation of `_.isNaN` without support for number objects. 18060 * 18061 * @private 18062 * @param {*} value The value to check. 18063 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 18064 */ 18065 function baseIsNaN(value) { 18066 return value !== value; 18067 } 18068 18069 /** 18070 * The base implementation of `_.mean` and `_.meanBy` without support for 18071 * iteratee shorthands. 18072 * 18073 * @private 18074 * @param {Array} array The array to iterate over. 18075 * @param {Function} iteratee The function invoked per iteration. 18076 * @returns {number} Returns the mean. 18077 */ 18078 function baseMean(array, iteratee) { 18079 var length = array == null ? 0 : array.length; 18080 return length ? (baseSum(array, iteratee) / length) : NAN; 18081 } 18082 18083 /** 18084 * The base implementation of `_.property` without support for deep paths. 18085 * 18086 * @private 18087 * @param {string} key The key of the property to get. 18088 * @returns {Function} Returns the new accessor function. 18089 */ 18090 function baseProperty(key) { 18091 return function(object) { 18092 return object == null ? undefined : object[key]; 18093 }; 18094 } 18095 18096 /** 18097 * The base implementation of `_.propertyOf` without support for deep paths. 18098 * 18099 * @private 18100 * @param {Object} object The object to query. 18101 * @returns {Function} Returns the new accessor function. 18102 */ 18103 function basePropertyOf(object) { 18104 return function(key) { 18105 return object == null ? undefined : object[key]; 18106 }; 18107 } 18108 18109 /** 18110 * The base implementation of `_.reduce` and `_.reduceRight`, without support 18111 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 18112 * 18113 * @private 18114 * @param {Array|Object} collection The collection to iterate over. 18115 * @param {Function} iteratee The function invoked per iteration. 18116 * @param {*} accumulator The initial value. 18117 * @param {boolean} initAccum Specify using the first or last element of 18118 * `collection` as the initial value. 18119 * @param {Function} eachFunc The function to iterate over `collection`. 18120 * @returns {*} Returns the accumulated value. 18121 */ 18122 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 18123 eachFunc(collection, function(value, index, collection) { 18124 accumulator = initAccum 18125 ? (initAccum = false, value) 18126 : iteratee(accumulator, value, index, collection); 18127 }); 18128 return accumulator; 18129 } 18130 18131 /** 18132 * The base implementation of `_.sortBy` which uses `comparer` to define the 18133 * sort order of `array` and replaces criteria objects with their corresponding 18134 * values. 18135 * 18136 * @private 18137 * @param {Array} array The array to sort. 18138 * @param {Function} comparer The function to define sort order. 18139 * @returns {Array} Returns `array`. 18140 */ 18141 function baseSortBy(array, comparer) { 18142 var length = array.length; 18143 18144 array.sort(comparer); 18145 while (length--) { 18146 array[length] = array[length].value; 18147 } 18148 return array; 18149 } 18150 18151 /** 18152 * The base implementation of `_.sum` and `_.sumBy` without support for 18153 * iteratee shorthands. 18154 * 18155 * @private 18156 * @param {Array} array The array to iterate over. 18157 * @param {Function} iteratee The function invoked per iteration. 18158 * @returns {number} Returns the sum. 18159 */ 18160 function baseSum(array, iteratee) { 18161 var result, 18162 index = -1, 18163 length = array.length; 18164 18165 while (++index < length) { 18166 var current = iteratee(array[index]); 18167 if (current !== undefined) { 18168 result = result === undefined ? current : (result + current); 18169 } 18170 } 18171 return result; 18172 } 18173 18174 /** 18175 * The base implementation of `_.times` without support for iteratee shorthands 18176 * or max array length checks. 18177 * 18178 * @private 18179 * @param {number} n The number of times to invoke `iteratee`. 18180 * @param {Function} iteratee The function invoked per iteration. 18181 * @returns {Array} Returns the array of results. 18182 */ 18183 function baseTimes(n, iteratee) { 18184 var index = -1, 18185 result = Array(n); 18186 18187 while (++index < n) { 18188 result[index] = iteratee(index); 18189 } 18190 return result; 18191 } 18192 18193 /** 18194 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 18195 * of key-value pairs for `object` corresponding to the property names of `props`. 18196 * 18197 * @private 18198 * @param {Object} object The object to query. 18199 * @param {Array} props The property names to get values for. 18200 * @returns {Object} Returns the key-value pairs. 18201 */ 18202 function baseToPairs(object, props) { 18203 return arrayMap(props, function(key) { 18204 return [key, object[key]]; 18205 }); 18206 } 18207 18208 /** 18209 * The base implementation of `_.unary` without support for storing metadata. 18210 * 18211 * @private 18212 * @param {Function} func The function to cap arguments for. 18213 * @returns {Function} Returns the new capped function. 18214 */ 18215 function baseUnary(func) { 18216 return function(value) { 18217 return func(value); 18218 }; 18219 } 18220 18221 /** 18222 * The base implementation of `_.values` and `_.valuesIn` which creates an 18223 * array of `object` property values corresponding to the property names 18224 * of `props`. 18225 * 18226 * @private 18227 * @param {Object} object The object to query. 18228 * @param {Array} props The property names to get values for. 18229 * @returns {Object} Returns the array of property values. 18230 */ 18231 function baseValues(object, props) { 18232 return arrayMap(props, function(key) { 18233 return object[key]; 18234 }); 18235 } 18236 18237 /** 18238 * Checks if a `cache` value for `key` exists. 18239 * 18240 * @private 18241 * @param {Object} cache The cache to query. 18242 * @param {string} key The key of the entry to check. 18243 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 18244 */ 18245 function cacheHas(cache, key) { 18246 return cache.has(key); 18247 } 18248 18249 /** 18250 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 18251 * that is not found in the character symbols. 18252 * 18253 * @private 18254 * @param {Array} strSymbols The string symbols to inspect. 18255 * @param {Array} chrSymbols The character symbols to find. 18256 * @returns {number} Returns the index of the first unmatched string symbol. 18257 */ 18258 function charsStartIndex(strSymbols, chrSymbols) { 18259 var index = -1, 18260 length = strSymbols.length; 18261 18262 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 18263 return index; 18264 } 18265 18266 /** 18267 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 18268 * that is not found in the character symbols. 18269 * 18270 * @private 18271 * @param {Array} strSymbols The string symbols to inspect. 18272 * @param {Array} chrSymbols The character symbols to find. 18273 * @returns {number} Returns the index of the last unmatched string symbol. 18274 */ 18275 function charsEndIndex(strSymbols, chrSymbols) { 18276 var index = strSymbols.length; 18277 18278 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 18279 return index; 18280 } 18281 18282 /** 18283 * Gets the number of `placeholder` occurrences in `array`. 18284 * 18285 * @private 18286 * @param {Array} array The array to inspect. 18287 * @param {*} placeholder The placeholder to search for. 18288 * @returns {number} Returns the placeholder count. 18289 */ 18290 function countHolders(array, placeholder) { 18291 var length = array.length, 18292 result = 0; 18293 18294 while (length--) { 18295 if (array[length] === placeholder) { 18296 ++result; 18297 } 18298 } 18299 return result; 18300 } 18301 18302 /** 18303 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 18304 * letters to basic Latin letters. 18305 * 18306 * @private 18307 * @param {string} letter The matched letter to deburr. 18308 * @returns {string} Returns the deburred letter. 18309 */ 18310 var deburrLetter = basePropertyOf(deburredLetters); 18311 18312 /** 18313 * Used by `_.escape` to convert characters to HTML entities. 18314 * 18315 * @private 18316 * @param {string} chr The matched character to escape. 18317 * @returns {string} Returns the escaped character. 18318 */ 18319 var escapeHtmlChar = basePropertyOf(htmlEscapes); 18320 18321 /** 18322 * Used by `_.template` to escape characters for inclusion in compiled string literals. 18323 * 18324 * @private 18325 * @param {string} chr The matched character to escape. 18326 * @returns {string} Returns the escaped character. 18327 */ 18328 function escapeStringChar(chr) { 18329 return '\\' + stringEscapes[chr]; 18330 } 18331 18332 /** 18333 * Gets the value at `key` of `object`. 18334 * 18335 * @private 18336 * @param {Object} [object] The object to query. 18337 * @param {string} key The key of the property to get. 18338 * @returns {*} Returns the property value. 18339 */ 18340 function getValue(object, key) { 18341 return object == null ? undefined : object[key]; 18342 } 18343 18344 /** 18345 * Checks if `string` contains Unicode symbols. 18346 * 18347 * @private 18348 * @param {string} string The string to inspect. 18349 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 18350 */ 18351 function hasUnicode(string) { 18352 return reHasUnicode.test(string); 18353 } 18354 18355 /** 18356 * Checks if `string` contains a word composed of Unicode symbols. 18357 * 18358 * @private 18359 * @param {string} string The string to inspect. 18360 * @returns {boolean} Returns `true` if a word is found, else `false`. 18361 */ 18362 function hasUnicodeWord(string) { 18363 return reHasUnicodeWord.test(string); 18364 } 18365 18366 /** 18367 * Converts `iterator` to an array. 18368 * 18369 * @private 18370 * @param {Object} iterator The iterator to convert. 18371 * @returns {Array} Returns the converted array. 18372 */ 18373 function iteratorToArray(iterator) { 18374 var data, 18375 result = []; 18376 18377 while (!(data = iterator.next()).done) { 18378 result.push(data.value); 18379 } 18380 return result; 18381 } 18382 18383 /** 18384 * Converts `map` to its key-value pairs. 18385 * 18386 * @private 18387 * @param {Object} map The map to convert. 18388 * @returns {Array} Returns the key-value pairs. 18389 */ 18390 function mapToArray(map) { 18391 var index = -1, 18392 result = Array(map.size); 18393 18394 map.forEach(function(value, key) { 18395 result[++index] = [key, value]; 18396 }); 18397 return result; 18398 } 18399 18400 /** 18401 * Creates a unary function that invokes `func` with its argument transformed. 18402 * 18403 * @private 18404 * @param {Function} func The function to wrap. 18405 * @param {Function} transform The argument transform. 18406 * @returns {Function} Returns the new function. 18407 */ 18408 function overArg(func, transform) { 18409 return function(arg) { 18410 return func(transform(arg)); 18411 }; 18412 } 18413 18414 /** 18415 * Replaces all `placeholder` elements in `array` with an internal placeholder 18416 * and returns an array of their indexes. 18417 * 18418 * @private 18419 * @param {Array} array The array to modify. 18420 * @param {*} placeholder The placeholder to replace. 18421 * @returns {Array} Returns the new array of placeholder indexes. 18422 */ 18423 function replaceHolders(array, placeholder) { 18424 var index = -1, 18425 length = array.length, 18426 resIndex = 0, 18427 result = []; 18428 18429 while (++index < length) { 18430 var value = array[index]; 18431 if (value === placeholder || value === PLACEHOLDER) { 18432 array[index] = PLACEHOLDER; 18433 result[resIndex++] = index; 18434 } 18435 } 18436 return result; 18437 } 18438 18439 /** 18440 * Converts `set` to an array of its values. 18441 * 18442 * @private 18443 * @param {Object} set The set to convert. 18444 * @returns {Array} Returns the values. 18445 */ 18446 function setToArray(set) { 18447 var index = -1, 18448 result = Array(set.size); 18449 18450 set.forEach(function(value) { 18451 result[++index] = value; 18452 }); 18453 return result; 18454 } 18455 18456 /** 18457 * Converts `set` to its value-value pairs. 18458 * 18459 * @private 18460 * @param {Object} set The set to convert. 18461 * @returns {Array} Returns the value-value pairs. 18462 */ 18463 function setToPairs(set) { 18464 var index = -1, 18465 result = Array(set.size); 18466 18467 set.forEach(function(value) { 18468 result[++index] = [value, value]; 18469 }); 18470 return result; 18471 } 18472 18473 /** 18474 * A specialized version of `_.indexOf` which performs strict equality 18475 * comparisons of values, i.e. `===`. 18476 * 18477 * @private 18478 * @param {Array} array The array to inspect. 18479 * @param {*} value The value to search for. 18480 * @param {number} fromIndex The index to search from. 18481 * @returns {number} Returns the index of the matched value, else `-1`. 18482 */ 18483 function strictIndexOf(array, value, fromIndex) { 18484 var index = fromIndex - 1, 18485 length = array.length; 18486 18487 while (++index < length) { 18488 if (array[index] === value) { 18489 return index; 18490 } 18491 } 18492 return -1; 18493 } 18494 18495 /** 18496 * A specialized version of `_.lastIndexOf` which performs strict equality 18497 * comparisons of values, i.e. `===`. 18498 * 18499 * @private 18500 * @param {Array} array The array to inspect. 18501 * @param {*} value The value to search for. 18502 * @param {number} fromIndex The index to search from. 18503 * @returns {number} Returns the index of the matched value, else `-1`. 18504 */ 18505 function strictLastIndexOf(array, value, fromIndex) { 18506 var index = fromIndex + 1; 18507 while (index--) { 18508 if (array[index] === value) { 18509 return index; 18510 } 18511 } 18512 return index; 18513 } 18514 18515 /** 18516 * Gets the number of symbols in `string`. 18517 * 18518 * @private 18519 * @param {string} string The string to inspect. 18520 * @returns {number} Returns the string size. 18521 */ 18522 function stringSize(string) { 18523 return hasUnicode(string) 18524 ? unicodeSize(string) 18525 : asciiSize(string); 18526 } 18527 18528 /** 18529 * Converts `string` to an array. 18530 * 18531 * @private 18532 * @param {string} string The string to convert. 18533 * @returns {Array} Returns the converted array. 18534 */ 18535 function stringToArray(string) { 18536 return hasUnicode(string) 18537 ? unicodeToArray(string) 18538 : asciiToArray(string); 18539 } 18540 18541 /** 18542 * Used by `_.unescape` to convert HTML entities to characters. 18543 * 18544 * @private 18545 * @param {string} chr The matched character to unescape. 18546 * @returns {string} Returns the unescaped character. 18547 */ 18548 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 18549 18550 /** 18551 * Gets the size of a Unicode `string`. 18552 * 18553 * @private 18554 * @param {string} string The string inspect. 18555 * @returns {number} Returns the string size. 18556 */ 18557 function unicodeSize(string) { 18558 var result = reUnicode.lastIndex = 0; 18559 while (reUnicode.test(string)) { 18560 ++result; 18561 } 18562 return result; 18563 } 18564 18565 /** 18566 * Converts a Unicode `string` to an array. 18567 * 18568 * @private 18569 * @param {string} string The string to convert. 18570 * @returns {Array} Returns the converted array. 18571 */ 18572 function unicodeToArray(string) { 18573 return string.match(reUnicode) || []; 18574 } 18575 18576 /** 18577 * Splits a Unicode `string` into an array of its words. 18578 * 18579 * @private 18580 * @param {string} The string to inspect. 18581 * @returns {Array} Returns the words of `string`. 18582 */ 18583 function unicodeWords(string) { 18584 return string.match(reUnicodeWord) || []; 18585 } 18586 18587 /*--------------------------------------------------------------------------*/ 18588 18589 /** 18590 * Create a new pristine `lodash` function using the `context` object. 18591 * 18592 * @static 18593 * @memberOf _ 18594 * @since 1.1.0 18595 * @category Util 18596 * @param {Object} [context=root] The context object. 18597 * @returns {Function} Returns a new `lodash` function. 18598 * @example 18599 * 18600 * _.mixin({ 'foo': _.constant('foo') }); 18601 * 18602 * var lodash = _.runInContext(); 18603 * lodash.mixin({ 'bar': lodash.constant('bar') }); 18604 * 18605 * _.isFunction(_.foo); 18606 * // => true 18607 * _.isFunction(_.bar); 18608 * // => false 18609 * 18610 * lodash.isFunction(lodash.foo); 18611 * // => false 18612 * lodash.isFunction(lodash.bar); 18613 * // => true 18614 * 18615 * // Create a suped-up `defer` in Node.js. 18616 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 18617 */ 18618 var runInContext = (function runInContext(context) { 18619 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 18620 18621 /** Built-in constructor references. */ 18622 var Array = context.Array, 18623 Date = context.Date, 18624 Error = context.Error, 18625 Function = context.Function, 18626 Math = context.Math, 18627 Object = context.Object, 18628 RegExp = context.RegExp, 18629 String = context.String, 18630 TypeError = context.TypeError; 18631 18632 /** Used for built-in method references. */ 18633 var arrayProto = Array.prototype, 18634 funcProto = Function.prototype, 18635 objectProto = Object.prototype; 18636 18637 /** Used to detect overreaching core-js shims. */ 18638 var coreJsData = context['__core-js_shared__']; 18639 18640 /** Used to resolve the decompiled source of functions. */ 18641 var funcToString = funcProto.toString; 18642 18643 /** Used to check objects for own properties. */ 18644 var hasOwnProperty = objectProto.hasOwnProperty; 18645 18646 /** Used to generate unique IDs. */ 18647 var idCounter = 0; 18648 18649 /** Used to detect methods masquerading as native. */ 18650 var maskSrcKey = (function() { 18651 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 18652 return uid ? ('Symbol(src)_1.' + uid) : ''; 18653 }()); 18654 18655 /** 18656 * Used to resolve the 18657 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 18658 * of values. 18659 */ 18660 var nativeObjectToString = objectProto.toString; 18661 18662 /** Used to infer the `Object` constructor. */ 18663 var objectCtorString = funcToString.call(Object); 18664 18665 /** Used to restore the original `_` reference in `_.noConflict`. */ 18666 var oldDash = root._; 18667 18668 /** Used to detect if a method is native. */ 18669 var reIsNative = RegExp('^' + 18670 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 18671 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 18672 ); 18673 18674 /** Built-in value references. */ 18675 var Buffer = moduleExports ? context.Buffer : undefined, 18676 Symbol = context.Symbol, 18677 Uint8Array = context.Uint8Array, 18678 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 18679 getPrototype = overArg(Object.getPrototypeOf, Object), 18680 objectCreate = Object.create, 18681 propertyIsEnumerable = objectProto.propertyIsEnumerable, 18682 splice = arrayProto.splice, 18683 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 18684 symIterator = Symbol ? Symbol.iterator : undefined, 18685 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 18686 18687 var defineProperty = (function() { 18688 try { 18689 var func = getNative(Object, 'defineProperty'); 18690 func({}, '', {}); 18691 return func; 18692 } catch (e) {} 18693 }()); 18694 18695 /** Mocked built-ins. */ 18696 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 18697 ctxNow = Date && Date.now !== root.Date.now && Date.now, 18698 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 18699 18700 /* Built-in method references for those with the same name as other `lodash` methods. */ 18701 var nativeCeil = Math.ceil, 18702 nativeFloor = Math.floor, 18703 nativeGetSymbols = Object.getOwnPropertySymbols, 18704 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 18705 nativeIsFinite = context.isFinite, 18706 nativeJoin = arrayProto.join, 18707 nativeKeys = overArg(Object.keys, Object), 18708 nativeMax = Math.max, 18709 nativeMin = Math.min, 18710 nativeNow = Date.now, 18711 nativeParseInt = context.parseInt, 18712 nativeRandom = Math.random, 18713 nativeReverse = arrayProto.reverse; 18714 18715 /* Built-in method references that are verified to be native. */ 18716 var DataView = getNative(context, 'DataView'), 18717 Map = getNative(context, 'Map'), 18718 Promise = getNative(context, 'Promise'), 18719 Set = getNative(context, 'Set'), 18720 WeakMap = getNative(context, 'WeakMap'), 18721 nativeCreate = getNative(Object, 'create'); 18722 18723 /** Used to store function metadata. */ 18724 var metaMap = WeakMap && new WeakMap; 18725 18726 /** Used to lookup unminified function names. */ 18727 var realNames = {}; 18728 18729 /** Used to detect maps, sets, and weakmaps. */ 18730 var dataViewCtorString = toSource(DataView), 18731 mapCtorString = toSource(Map), 18732 promiseCtorString = toSource(Promise), 18733 setCtorString = toSource(Set), 18734 weakMapCtorString = toSource(WeakMap); 18735 18736 /** Used to convert symbols to primitives and strings. */ 18737 var symbolProto = Symbol ? Symbol.prototype : undefined, 18738 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 18739 symbolToString = symbolProto ? symbolProto.toString : undefined; 18740 18741 /*------------------------------------------------------------------------*/ 18742 18743 /** 18744 * Creates a `lodash` object which wraps `value` to enable implicit method 18745 * chain sequences. Methods that operate on and return arrays, collections, 18746 * and functions can be chained together. Methods that retrieve a single value 18747 * or may return a primitive value will automatically end the chain sequence 18748 * and return the unwrapped value. Otherwise, the value must be unwrapped 18749 * with `_#value`. 18750 * 18751 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 18752 * enabled using `_.chain`. 18753 * 18754 * The execution of chained methods is lazy, that is, it's deferred until 18755 * `_#value` is implicitly or explicitly called. 18756 * 18757 * Lazy evaluation allows several methods to support shortcut fusion. 18758 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 18759 * the creation of intermediate arrays and can greatly reduce the number of 18760 * iteratee executions. Sections of a chain sequence qualify for shortcut 18761 * fusion if the section is applied to an array and iteratees accept only 18762 * one argument. The heuristic for whether a section qualifies for shortcut 18763 * fusion is subject to change. 18764 * 18765 * Chaining is supported in custom builds as long as the `_#value` method is 18766 * directly or indirectly included in the build. 18767 * 18768 * In addition to lodash methods, wrappers have `Array` and `String` methods. 18769 * 18770 * The wrapper `Array` methods are: 18771 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 18772 * 18773 * The wrapper `String` methods are: 18774 * `replace` and `split` 18775 * 18776 * The wrapper methods that support shortcut fusion are: 18777 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 18778 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 18779 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 18780 * 18781 * The chainable wrapper methods are: 18782 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 18783 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 18784 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 18785 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 18786 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 18787 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 18788 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 18789 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 18790 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 18791 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 18792 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 18793 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 18794 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 18795 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 18796 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 18797 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 18798 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 18799 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 18800 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 18801 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 18802 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 18803 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 18804 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 18805 * `zipObject`, `zipObjectDeep`, and `zipWith` 18806 * 18807 * The wrapper methods that are **not** chainable by default are: 18808 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 18809 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 18810 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 18811 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 18812 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 18813 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 18814 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 18815 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 18816 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 18817 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 18818 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 18819 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 18820 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 18821 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 18822 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 18823 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 18824 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 18825 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 18826 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 18827 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 18828 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 18829 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 18830 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 18831 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 18832 * `upperFirst`, `value`, and `words` 18833 * 18834 * @name _ 18835 * @constructor 18836 * @category Seq 18837 * @param {*} value The value to wrap in a `lodash` instance. 18838 * @returns {Object} Returns the new `lodash` wrapper instance. 18839 * @example 18840 * 18841 * function square(n) { 18842 * return n * n; 18843 * } 18844 * 18845 * var wrapped = _([1, 2, 3]); 18846 * 18847 * // Returns an unwrapped value. 18848 * wrapped.reduce(_.add); 18849 * // => 6 18850 * 18851 * // Returns a wrapped value. 18852 * var squares = wrapped.map(square); 18853 * 18854 * _.isArray(squares); 18855 * // => false 18856 * 18857 * _.isArray(squares.value()); 18858 * // => true 18859 */ 18860 function lodash(value) { 18861 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 18862 if (value instanceof LodashWrapper) { 18863 return value; 18864 } 18865 if (hasOwnProperty.call(value, '__wrapped__')) { 18866 return wrapperClone(value); 18867 } 18868 } 18869 return new LodashWrapper(value); 18870 } 18871 18872 /** 18873 * The base implementation of `_.create` without support for assigning 18874 * properties to the created object. 18875 * 18876 * @private 18877 * @param {Object} proto The object to inherit from. 18878 * @returns {Object} Returns the new object. 18879 */ 18880 var baseCreate = (function() { 18881 function object() {} 18882 return function(proto) { 18883 if (!isObject(proto)) { 18884 return {}; 18885 } 18886 if (objectCreate) { 18887 return objectCreate(proto); 18888 } 18889 object.prototype = proto; 18890 var result = new object; 18891 object.prototype = undefined; 18892 return result; 18893 }; 18894 }()); 18895 18896 /** 18897 * The function whose prototype chain sequence wrappers inherit from. 18898 * 18899 * @private 18900 */ 18901 function baseLodash() { 18902 // No operation performed. 18903 } 18904 18905 /** 18906 * The base constructor for creating `lodash` wrapper objects. 18907 * 18908 * @private 18909 * @param {*} value The value to wrap. 18910 * @param {boolean} [chainAll] Enable explicit method chain sequences. 18911 */ 18912 function LodashWrapper(value, chainAll) { 18913 this.__wrapped__ = value; 18914 this.__actions__ = []; 18915 this.__chain__ = !!chainAll; 18916 this.__index__ = 0; 18917 this.__values__ = undefined; 18918 } 18919 18920 /** 18921 * By default, the template delimiters used by lodash are like those in 18922 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 18923 * following template settings to use alternative delimiters. 18924 * 18925 * @static 18926 * @memberOf _ 18927 * @type {Object} 18928 */ 18929 lodash.templateSettings = { 18930 18931 /** 18932 * Used to detect `data` property values to be HTML-escaped. 18933 * 18934 * @memberOf _.templateSettings 18935 * @type {RegExp} 18936 */ 18937 'escape': reEscape, 18938 18939 /** 18940 * Used to detect code to be evaluated. 18941 * 18942 * @memberOf _.templateSettings 18943 * @type {RegExp} 18944 */ 18945 'evaluate': reEvaluate, 18946 18947 /** 18948 * Used to detect `data` property values to inject. 18949 * 18950 * @memberOf _.templateSettings 18951 * @type {RegExp} 18952 */ 18953 'interpolate': reInterpolate, 18954 18955 /** 18956 * Used to reference the data object in the template text. 18957 * 18958 * @memberOf _.templateSettings 18959 * @type {string} 18960 */ 18961 'variable': '', 18962 18963 /** 18964 * Used to import variables into the compiled template. 18965 * 18966 * @memberOf _.templateSettings 18967 * @type {Object} 18968 */ 18969 'imports': { 18970 18971 /** 18972 * A reference to the `lodash` function. 18973 * 18974 * @memberOf _.templateSettings.imports 18975 * @type {Function} 18976 */ 18977 '_': lodash 18978 } 18979 }; 18980 18981 // Ensure wrappers are instances of `baseLodash`. 18982 lodash.prototype = baseLodash.prototype; 18983 lodash.prototype.constructor = lodash; 18984 18985 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 18986 LodashWrapper.prototype.constructor = LodashWrapper; 18987 18988 /*------------------------------------------------------------------------*/ 18989 18990 /** 18991 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 18992 * 18993 * @private 18994 * @constructor 18995 * @param {*} value The value to wrap. 18996 */ 18997 function LazyWrapper(value) { 18998 this.__wrapped__ = value; 18999 this.__actions__ = []; 19000 this.__dir__ = 1; 19001 this.__filtered__ = false; 19002 this.__iteratees__ = []; 19003 this.__takeCount__ = MAX_ARRAY_LENGTH; 19004 this.__views__ = []; 19005 } 19006 19007 /** 19008 * Creates a clone of the lazy wrapper object. 19009 * 19010 * @private 19011 * @name clone 19012 * @memberOf LazyWrapper 19013 * @returns {Object} Returns the cloned `LazyWrapper` object. 19014 */ 19015 function lazyClone() { 19016 var result = new LazyWrapper(this.__wrapped__); 19017 result.__actions__ = copyArray(this.__actions__); 19018 result.__dir__ = this.__dir__; 19019 result.__filtered__ = this.__filtered__; 19020 result.__iteratees__ = copyArray(this.__iteratees__); 19021 result.__takeCount__ = this.__takeCount__; 19022 result.__views__ = copyArray(this.__views__); 19023 return result; 19024 } 19025 19026 /** 19027 * Reverses the direction of lazy iteration. 19028 * 19029 * @private 19030 * @name reverse 19031 * @memberOf LazyWrapper 19032 * @returns {Object} Returns the new reversed `LazyWrapper` object. 19033 */ 19034 function lazyReverse() { 19035 if (this.__filtered__) { 19036 var result = new LazyWrapper(this); 19037 result.__dir__ = -1; 19038 result.__filtered__ = true; 19039 } else { 19040 result = this.clone(); 19041 result.__dir__ *= -1; 19042 } 19043 return result; 19044 } 19045 19046 /** 19047 * Extracts the unwrapped value from its lazy wrapper. 19048 * 19049 * @private 19050 * @name value 19051 * @memberOf LazyWrapper 19052 * @returns {*} Returns the unwrapped value. 19053 */ 19054 function lazyValue() { 19055 var array = this.__wrapped__.value(), 19056 dir = this.__dir__, 19057 isArr = isArray(array), 19058 isRight = dir < 0, 19059 arrLength = isArr ? array.length : 0, 19060 view = getView(0, arrLength, this.__views__), 19061 start = view.start, 19062 end = view.end, 19063 length = end - start, 19064 index = isRight ? end : (start - 1), 19065 iteratees = this.__iteratees__, 19066 iterLength = iteratees.length, 19067 resIndex = 0, 19068 takeCount = nativeMin(length, this.__takeCount__); 19069 19070 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 19071 return baseWrapperValue(array, this.__actions__); 19072 } 19073 var result = []; 19074 19075 outer: 19076 while (length-- && resIndex < takeCount) { 19077 index += dir; 19078 19079 var iterIndex = -1, 19080 value = array[index]; 19081 19082 while (++iterIndex < iterLength) { 19083 var data = iteratees[iterIndex], 19084 iteratee = data.iteratee, 19085 type = data.type, 19086 computed = iteratee(value); 19087 19088 if (type == LAZY_MAP_FLAG) { 19089 value = computed; 19090 } else if (!computed) { 19091 if (type == LAZY_FILTER_FLAG) { 19092 continue outer; 19093 } else { 19094 break outer; 19095 } 19096 } 19097 } 19098 result[resIndex++] = value; 19099 } 19100 return result; 19101 } 19102 19103 // Ensure `LazyWrapper` is an instance of `baseLodash`. 19104 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 19105 LazyWrapper.prototype.constructor = LazyWrapper; 19106 19107 /*------------------------------------------------------------------------*/ 19108 19109 /** 19110 * Creates a hash object. 19111 * 19112 * @private 19113 * @constructor 19114 * @param {Array} [entries] The key-value pairs to cache. 19115 */ 19116 function Hash(entries) { 19117 var index = -1, 19118 length = entries == null ? 0 : entries.length; 19119 19120 this.clear(); 19121 while (++index < length) { 19122 var entry = entries[index]; 19123 this.set(entry[0], entry[1]); 19124 } 19125 } 19126 19127 /** 19128 * Removes all key-value entries from the hash. 19129 * 19130 * @private 19131 * @name clear 19132 * @memberOf Hash 19133 */ 19134 function hashClear() { 19135 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 19136 this.size = 0; 19137 } 19138 19139 /** 19140 * Removes `key` and its value from the hash. 19141 * 19142 * @private 19143 * @name delete 19144 * @memberOf Hash 19145 * @param {Object} hash The hash to modify. 19146 * @param {string} key The key of the value to remove. 19147 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19148 */ 19149 function hashDelete(key) { 19150 var result = this.has(key) && delete this.__data__[key]; 19151 this.size -= result ? 1 : 0; 19152 return result; 19153 } 19154 19155 /** 19156 * Gets the hash value for `key`. 19157 * 19158 * @private 19159 * @name get 19160 * @memberOf Hash 19161 * @param {string} key The key of the value to get. 19162 * @returns {*} Returns the entry value. 19163 */ 19164 function hashGet(key) { 19165 var data = this.__data__; 19166 if (nativeCreate) { 19167 var result = data[key]; 19168 return result === HASH_UNDEFINED ? undefined : result; 19169 } 19170 return hasOwnProperty.call(data, key) ? data[key] : undefined; 19171 } 19172 19173 /** 19174 * Checks if a hash value for `key` exists. 19175 * 19176 * @private 19177 * @name has 19178 * @memberOf Hash 19179 * @param {string} key The key of the entry to check. 19180 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19181 */ 19182 function hashHas(key) { 19183 var data = this.__data__; 19184 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 19185 } 19186 19187 /** 19188 * Sets the hash `key` to `value`. 19189 * 19190 * @private 19191 * @name set 19192 * @memberOf Hash 19193 * @param {string} key The key of the value to set. 19194 * @param {*} value The value to set. 19195 * @returns {Object} Returns the hash instance. 19196 */ 19197 function hashSet(key, value) { 19198 var data = this.__data__; 19199 this.size += this.has(key) ? 0 : 1; 19200 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 19201 return this; 19202 } 19203 19204 // Add methods to `Hash`. 19205 Hash.prototype.clear = hashClear; 19206 Hash.prototype['delete'] = hashDelete; 19207 Hash.prototype.get = hashGet; 19208 Hash.prototype.has = hashHas; 19209 Hash.prototype.set = hashSet; 19210 19211 /*------------------------------------------------------------------------*/ 19212 19213 /** 19214 * Creates an list cache object. 19215 * 19216 * @private 19217 * @constructor 19218 * @param {Array} [entries] The key-value pairs to cache. 19219 */ 19220 function ListCache(entries) { 19221 var index = -1, 19222 length = entries == null ? 0 : entries.length; 19223 19224 this.clear(); 19225 while (++index < length) { 19226 var entry = entries[index]; 19227 this.set(entry[0], entry[1]); 19228 } 19229 } 19230 19231 /** 19232 * Removes all key-value entries from the list cache. 19233 * 19234 * @private 19235 * @name clear 19236 * @memberOf ListCache 19237 */ 19238 function listCacheClear() { 19239 this.__data__ = []; 19240 this.size = 0; 19241 } 19242 19243 /** 19244 * Removes `key` and its value from the list cache. 19245 * 19246 * @private 19247 * @name delete 19248 * @memberOf ListCache 19249 * @param {string} key The key of the value to remove. 19250 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19251 */ 19252 function listCacheDelete(key) { 19253 var data = this.__data__, 19254 index = assocIndexOf(data, key); 19255 19256 if (index < 0) { 19257 return false; 19258 } 19259 var lastIndex = data.length - 1; 19260 if (index == lastIndex) { 19261 data.pop(); 19262 } else { 19263 splice.call(data, index, 1); 19264 } 19265 --this.size; 19266 return true; 19267 } 19268 19269 /** 19270 * Gets the list cache value for `key`. 19271 * 19272 * @private 19273 * @name get 19274 * @memberOf ListCache 19275 * @param {string} key The key of the value to get. 19276 * @returns {*} Returns the entry value. 19277 */ 19278 function listCacheGet(key) { 19279 var data = this.__data__, 19280 index = assocIndexOf(data, key); 19281 19282 return index < 0 ? undefined : data[index][1]; 19283 } 19284 19285 /** 19286 * Checks if a list cache value for `key` exists. 19287 * 19288 * @private 19289 * @name has 19290 * @memberOf ListCache 19291 * @param {string} key The key of the entry to check. 19292 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19293 */ 19294 function listCacheHas(key) { 19295 return assocIndexOf(this.__data__, key) > -1; 19296 } 19297 19298 /** 19299 * Sets the list cache `key` to `value`. 19300 * 19301 * @private 19302 * @name set 19303 * @memberOf ListCache 19304 * @param {string} key The key of the value to set. 19305 * @param {*} value The value to set. 19306 * @returns {Object} Returns the list cache instance. 19307 */ 19308 function listCacheSet(key, value) { 19309 var data = this.__data__, 19310 index = assocIndexOf(data, key); 19311 19312 if (index < 0) { 19313 ++this.size; 19314 data.push([key, value]); 19315 } else { 19316 data[index][1] = value; 19317 } 19318 return this; 19319 } 19320 19321 // Add methods to `ListCache`. 19322 ListCache.prototype.clear = listCacheClear; 19323 ListCache.prototype['delete'] = listCacheDelete; 19324 ListCache.prototype.get = listCacheGet; 19325 ListCache.prototype.has = listCacheHas; 19326 ListCache.prototype.set = listCacheSet; 19327 19328 /*------------------------------------------------------------------------*/ 19329 19330 /** 19331 * Creates a map cache object to store key-value pairs. 19332 * 19333 * @private 19334 * @constructor 19335 * @param {Array} [entries] The key-value pairs to cache. 19336 */ 19337 function MapCache(entries) { 19338 var index = -1, 19339 length = entries == null ? 0 : entries.length; 19340 19341 this.clear(); 19342 while (++index < length) { 19343 var entry = entries[index]; 19344 this.set(entry[0], entry[1]); 19345 } 19346 } 19347 19348 /** 19349 * Removes all key-value entries from the map. 19350 * 19351 * @private 19352 * @name clear 19353 * @memberOf MapCache 19354 */ 19355 function mapCacheClear() { 19356 this.size = 0; 19357 this.__data__ = { 19358 'hash': new Hash, 19359 'map': new (Map || ListCache), 19360 'string': new Hash 19361 }; 19362 } 19363 19364 /** 19365 * Removes `key` and its value from the map. 19366 * 19367 * @private 19368 * @name delete 19369 * @memberOf MapCache 19370 * @param {string} key The key of the value to remove. 19371 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19372 */ 19373 function mapCacheDelete(key) { 19374 var result = getMapData(this, key)['delete'](key); 19375 this.size -= result ? 1 : 0; 19376 return result; 19377 } 19378 19379 /** 19380 * Gets the map value for `key`. 19381 * 19382 * @private 19383 * @name get 19384 * @memberOf MapCache 19385 * @param {string} key The key of the value to get. 19386 * @returns {*} Returns the entry value. 19387 */ 19388 function mapCacheGet(key) { 19389 return getMapData(this, key).get(key); 19390 } 19391 19392 /** 19393 * Checks if a map value for `key` exists. 19394 * 19395 * @private 19396 * @name has 19397 * @memberOf MapCache 19398 * @param {string} key The key of the entry to check. 19399 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19400 */ 19401 function mapCacheHas(key) { 19402 return getMapData(this, key).has(key); 19403 } 19404 19405 /** 19406 * Sets the map `key` to `value`. 19407 * 19408 * @private 19409 * @name set 19410 * @memberOf MapCache 19411 * @param {string} key The key of the value to set. 19412 * @param {*} value The value to set. 19413 * @returns {Object} Returns the map cache instance. 19414 */ 19415 function mapCacheSet(key, value) { 19416 var data = getMapData(this, key), 19417 size = data.size; 19418 19419 data.set(key, value); 19420 this.size += data.size == size ? 0 : 1; 19421 return this; 19422 } 19423 19424 // Add methods to `MapCache`. 19425 MapCache.prototype.clear = mapCacheClear; 19426 MapCache.prototype['delete'] = mapCacheDelete; 19427 MapCache.prototype.get = mapCacheGet; 19428 MapCache.prototype.has = mapCacheHas; 19429 MapCache.prototype.set = mapCacheSet; 19430 19431 /*------------------------------------------------------------------------*/ 19432 19433 /** 19434 * 19435 * Creates an array cache object to store unique values. 19436 * 19437 * @private 19438 * @constructor 19439 * @param {Array} [values] The values to cache. 19440 */ 19441 function SetCache(values) { 19442 var index = -1, 19443 length = values == null ? 0 : values.length; 19444 19445 this.__data__ = new MapCache; 19446 while (++index < length) { 19447 this.add(values[index]); 19448 } 19449 } 19450 19451 /** 19452 * Adds `value` to the array cache. 19453 * 19454 * @private 19455 * @name add 19456 * @memberOf SetCache 19457 * @alias push 19458 * @param {*} value The value to cache. 19459 * @returns {Object} Returns the cache instance. 19460 */ 19461 function setCacheAdd(value) { 19462 this.__data__.set(value, HASH_UNDEFINED); 19463 return this; 19464 } 19465 19466 /** 19467 * Checks if `value` is in the array cache. 19468 * 19469 * @private 19470 * @name has 19471 * @memberOf SetCache 19472 * @param {*} value The value to search for. 19473 * @returns {number} Returns `true` if `value` is found, else `false`. 19474 */ 19475 function setCacheHas(value) { 19476 return this.__data__.has(value); 19477 } 19478 19479 // Add methods to `SetCache`. 19480 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 19481 SetCache.prototype.has = setCacheHas; 19482 19483 /*------------------------------------------------------------------------*/ 19484 19485 /** 19486 * Creates a stack cache object to store key-value pairs. 19487 * 19488 * @private 19489 * @constructor 19490 * @param {Array} [entries] The key-value pairs to cache. 19491 */ 19492 function Stack(entries) { 19493 var data = this.__data__ = new ListCache(entries); 19494 this.size = data.size; 19495 } 19496 19497 /** 19498 * Removes all key-value entries from the stack. 19499 * 19500 * @private 19501 * @name clear 19502 * @memberOf Stack 19503 */ 19504 function stackClear() { 19505 this.__data__ = new ListCache; 19506 this.size = 0; 19507 } 19508 19509 /** 19510 * Removes `key` and its value from the stack. 19511 * 19512 * @private 19513 * @name delete 19514 * @memberOf Stack 19515 * @param {string} key The key of the value to remove. 19516 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19517 */ 19518 function stackDelete(key) { 19519 var data = this.__data__, 19520 result = data['delete'](key); 19521 19522 this.size = data.size; 19523 return result; 19524 } 19525 19526 /** 19527 * Gets the stack value for `key`. 19528 * 19529 * @private 19530 * @name get 19531 * @memberOf Stack 19532 * @param {string} key The key of the value to get. 19533 * @returns {*} Returns the entry value. 19534 */ 19535 function stackGet(key) { 19536 return this.__data__.get(key); 19537 } 19538 19539 /** 19540 * Checks if a stack value for `key` exists. 19541 * 19542 * @private 19543 * @name has 19544 * @memberOf Stack 19545 * @param {string} key The key of the entry to check. 19546 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19547 */ 19548 function stackHas(key) { 19549 return this.__data__.has(key); 19550 } 19551 19552 /** 19553 * Sets the stack `key` to `value`. 19554 * 19555 * @private 19556 * @name set 19557 * @memberOf Stack 19558 * @param {string} key The key of the value to set. 19559 * @param {*} value The value to set. 19560 * @returns {Object} Returns the stack cache instance. 19561 */ 19562 function stackSet(key, value) { 19563 var data = this.__data__; 19564 if (data instanceof ListCache) { 19565 var pairs = data.__data__; 19566 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 19567 pairs.push([key, value]); 19568 this.size = ++data.size; 19569 return this; 19570 } 19571 data = this.__data__ = new MapCache(pairs); 19572 } 19573 data.set(key, value); 19574 this.size = data.size; 19575 return this; 19576 } 19577 19578 // Add methods to `Stack`. 19579 Stack.prototype.clear = stackClear; 19580 Stack.prototype['delete'] = stackDelete; 19581 Stack.prototype.get = stackGet; 19582 Stack.prototype.has = stackHas; 19583 Stack.prototype.set = stackSet; 19584 19585 /*------------------------------------------------------------------------*/ 19586 19587 /** 19588 * Creates an array of the enumerable property names of the array-like `value`. 19589 * 19590 * @private 19591 * @param {*} value The value to query. 19592 * @param {boolean} inherited Specify returning inherited property names. 19593 * @returns {Array} Returns the array of property names. 19594 */ 19595 function arrayLikeKeys(value, inherited) { 19596 var isArr = isArray(value), 19597 isArg = !isArr && isArguments(value), 19598 isBuff = !isArr && !isArg && isBuffer(value), 19599 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 19600 skipIndexes = isArr || isArg || isBuff || isType, 19601 result = skipIndexes ? baseTimes(value.length, String) : [], 19602 length = result.length; 19603 19604 for (var key in value) { 19605 if ((inherited || hasOwnProperty.call(value, key)) && 19606 !(skipIndexes && ( 19607 // Safari 9 has enumerable `arguments.length` in strict mode. 19608 key == 'length' || 19609 // Node.js 0.10 has enumerable non-index properties on buffers. 19610 (isBuff && (key == 'offset' || key == 'parent')) || 19611 // PhantomJS 2 has enumerable non-index properties on typed arrays. 19612 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 19613 // Skip index properties. 19614 isIndex(key, length) 19615 ))) { 19616 result.push(key); 19617 } 19618 } 19619 return result; 19620 } 19621 19622 /** 19623 * A specialized version of `_.sample` for arrays. 19624 * 19625 * @private 19626 * @param {Array} array The array to sample. 19627 * @returns {*} Returns the random element. 19628 */ 19629 function arraySample(array) { 19630 var length = array.length; 19631 return length ? array[baseRandom(0, length - 1)] : undefined; 19632 } 19633 19634 /** 19635 * A specialized version of `_.sampleSize` for arrays. 19636 * 19637 * @private 19638 * @param {Array} array The array to sample. 19639 * @param {number} n The number of elements to sample. 19640 * @returns {Array} Returns the random elements. 19641 */ 19642 function arraySampleSize(array, n) { 19643 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 19644 } 19645 19646 /** 19647 * A specialized version of `_.shuffle` for arrays. 19648 * 19649 * @private 19650 * @param {Array} array The array to shuffle. 19651 * @returns {Array} Returns the new shuffled array. 19652 */ 19653 function arrayShuffle(array) { 19654 return shuffleSelf(copyArray(array)); 19655 } 19656 19657 /** 19658 * This function is like `assignValue` except that it doesn't assign 19659 * `undefined` values. 19660 * 19661 * @private 19662 * @param {Object} object The object to modify. 19663 * @param {string} key The key of the property to assign. 19664 * @param {*} value The value to assign. 19665 */ 19666 function assignMergeValue(object, key, value) { 19667 if ((value !== undefined && !eq(object[key], value)) || 19668 (value === undefined && !(key in object))) { 19669 baseAssignValue(object, key, value); 19670 } 19671 } 19672 19673 /** 19674 * Assigns `value` to `key` of `object` if the existing value is not equivalent 19675 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 19676 * for equality comparisons. 19677 * 19678 * @private 19679 * @param {Object} object The object to modify. 19680 * @param {string} key The key of the property to assign. 19681 * @param {*} value The value to assign. 19682 */ 19683 function assignValue(object, key, value) { 19684 var objValue = object[key]; 19685 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 19686 (value === undefined && !(key in object))) { 19687 baseAssignValue(object, key, value); 19688 } 19689 } 19690 19691 /** 19692 * Gets the index at which the `key` is found in `array` of key-value pairs. 19693 * 19694 * @private 19695 * @param {Array} array The array to inspect. 19696 * @param {*} key The key to search for. 19697 * @returns {number} Returns the index of the matched value, else `-1`. 19698 */ 19699 function assocIndexOf(array, key) { 19700 var length = array.length; 19701 while (length--) { 19702 if (eq(array[length][0], key)) { 19703 return length; 19704 } 19705 } 19706 return -1; 19707 } 19708 19709 /** 19710 * Aggregates elements of `collection` on `accumulator` with keys transformed 19711 * by `iteratee` and values set by `setter`. 19712 * 19713 * @private 19714 * @param {Array|Object} collection The collection to iterate over. 19715 * @param {Function} setter The function to set `accumulator` values. 19716 * @param {Function} iteratee The iteratee to transform keys. 19717 * @param {Object} accumulator The initial aggregated object. 19718 * @returns {Function} Returns `accumulator`. 19719 */ 19720 function baseAggregator(collection, setter, iteratee, accumulator) { 19721 baseEach(collection, function(value, key, collection) { 19722 setter(accumulator, value, iteratee(value), collection); 19723 }); 19724 return accumulator; 19725 } 19726 19727 /** 19728 * The base implementation of `_.assign` without support for multiple sources 19729 * or `customizer` functions. 19730 * 19731 * @private 19732 * @param {Object} object The destination object. 19733 * @param {Object} source The source object. 19734 * @returns {Object} Returns `object`. 19735 */ 19736 function baseAssign(object, source) { 19737 return object && copyObject(source, keys(source), object); 19738 } 19739 19740 /** 19741 * The base implementation of `_.assignIn` without support for multiple sources 19742 * or `customizer` functions. 19743 * 19744 * @private 19745 * @param {Object} object The destination object. 19746 * @param {Object} source The source object. 19747 * @returns {Object} Returns `object`. 19748 */ 19749 function baseAssignIn(object, source) { 19750 return object && copyObject(source, keysIn(source), object); 19751 } 19752 19753 /** 19754 * The base implementation of `assignValue` and `assignMergeValue` without 19755 * value checks. 19756 * 19757 * @private 19758 * @param {Object} object The object to modify. 19759 * @param {string} key The key of the property to assign. 19760 * @param {*} value The value to assign. 19761 */ 19762 function baseAssignValue(object, key, value) { 19763 if (key == '__proto__' && defineProperty) { 19764 defineProperty(object, key, { 19765 'configurable': true, 19766 'enumerable': true, 19767 'value': value, 19768 'writable': true 19769 }); 19770 } else { 19771 object[key] = value; 19772 } 19773 } 19774 19775 /** 19776 * The base implementation of `_.at` without support for individual paths. 19777 * 19778 * @private 19779 * @param {Object} object The object to iterate over. 19780 * @param {string[]} paths The property paths to pick. 19781 * @returns {Array} Returns the picked elements. 19782 */ 19783 function baseAt(object, paths) { 19784 var index = -1, 19785 length = paths.length, 19786 result = Array(length), 19787 skip = object == null; 19788 19789 while (++index < length) { 19790 result[index] = skip ? undefined : get(object, paths[index]); 19791 } 19792 return result; 19793 } 19794 19795 /** 19796 * The base implementation of `_.clamp` which doesn't coerce arguments. 19797 * 19798 * @private 19799 * @param {number} number The number to clamp. 19800 * @param {number} [lower] The lower bound. 19801 * @param {number} upper The upper bound. 19802 * @returns {number} Returns the clamped number. 19803 */ 19804 function baseClamp(number, lower, upper) { 19805 if (number === number) { 19806 if (upper !== undefined) { 19807 number = number <= upper ? number : upper; 19808 } 19809 if (lower !== undefined) { 19810 number = number >= lower ? number : lower; 19811 } 19812 } 19813 return number; 19814 } 19815 19816 /** 19817 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 19818 * traversed objects. 19819 * 19820 * @private 19821 * @param {*} value The value to clone. 19822 * @param {boolean} bitmask The bitmask flags. 19823 * 1 - Deep clone 19824 * 2 - Flatten inherited properties 19825 * 4 - Clone symbols 19826 * @param {Function} [customizer] The function to customize cloning. 19827 * @param {string} [key] The key of `value`. 19828 * @param {Object} [object] The parent object of `value`. 19829 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 19830 * @returns {*} Returns the cloned value. 19831 */ 19832 function baseClone(value, bitmask, customizer, key, object, stack) { 19833 var result, 19834 isDeep = bitmask & CLONE_DEEP_FLAG, 19835 isFlat = bitmask & CLONE_FLAT_FLAG, 19836 isFull = bitmask & CLONE_SYMBOLS_FLAG; 19837 19838 if (customizer) { 19839 result = object ? customizer(value, key, object, stack) : customizer(value); 19840 } 19841 if (result !== undefined) { 19842 return result; 19843 } 19844 if (!isObject(value)) { 19845 return value; 19846 } 19847 var isArr = isArray(value); 19848 if (isArr) { 19849 result = initCloneArray(value); 19850 if (!isDeep) { 19851 return copyArray(value, result); 19852 } 19853 } else { 19854 var tag = getTag(value), 19855 isFunc = tag == funcTag || tag == genTag; 19856 19857 if (isBuffer(value)) { 19858 return cloneBuffer(value, isDeep); 19859 } 19860 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 19861 result = (isFlat || isFunc) ? {} : initCloneObject(value); 19862 if (!isDeep) { 19863 return isFlat 19864 ? copySymbolsIn(value, baseAssignIn(result, value)) 19865 : copySymbols(value, baseAssign(result, value)); 19866 } 19867 } else { 19868 if (!cloneableTags[tag]) { 19869 return object ? value : {}; 19870 } 19871 result = initCloneByTag(value, tag, isDeep); 19872 } 19873 } 19874 // Check for circular references and return its corresponding clone. 19875 stack || (stack = new Stack); 19876 var stacked = stack.get(value); 19877 if (stacked) { 19878 return stacked; 19879 } 19880 stack.set(value, result); 19881 19882 if (isSet(value)) { 19883 value.forEach(function(subValue) { 19884 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 19885 }); 19886 } else if (isMap(value)) { 19887 value.forEach(function(subValue, key) { 19888 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); 19889 }); 19890 } 19891 19892 var keysFunc = isFull 19893 ? (isFlat ? getAllKeysIn : getAllKeys) 19894 : (isFlat ? keysIn : keys); 19895 19896 var props = isArr ? undefined : keysFunc(value); 19897 arrayEach(props || value, function(subValue, key) { 19898 if (props) { 19899 key = subValue; 19900 subValue = value[key]; 19901 } 19902 // Recursively populate clone (susceptible to call stack limits). 19903 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 19904 }); 19905 return result; 19906 } 19907 19908 /** 19909 * The base implementation of `_.conforms` which doesn't clone `source`. 19910 * 19911 * @private 19912 * @param {Object} source The object of property predicates to conform to. 19913 * @returns {Function} Returns the new spec function. 19914 */ 19915 function baseConforms(source) { 19916 var props = keys(source); 19917 return function(object) { 19918 return baseConformsTo(object, source, props); 19919 }; 19920 } 19921 19922 /** 19923 * The base implementation of `_.conformsTo` which accepts `props` to check. 19924 * 19925 * @private 19926 * @param {Object} object The object to inspect. 19927 * @param {Object} source The object of property predicates to conform to. 19928 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 19929 */ 19930 function baseConformsTo(object, source, props) { 19931 var length = props.length; 19932 if (object == null) { 19933 return !length; 19934 } 19935 object = Object(object); 19936 while (length--) { 19937 var key = props[length], 19938 predicate = source[key], 19939 value = object[key]; 19940 19941 if ((value === undefined && !(key in object)) || !predicate(value)) { 19942 return false; 19943 } 19944 } 19945 return true; 19946 } 19947 19948 /** 19949 * The base implementation of `_.delay` and `_.defer` which accepts `args` 19950 * to provide to `func`. 19951 * 19952 * @private 19953 * @param {Function} func The function to delay. 19954 * @param {number} wait The number of milliseconds to delay invocation. 19955 * @param {Array} args The arguments to provide to `func`. 19956 * @returns {number|Object} Returns the timer id or timeout object. 19957 */ 19958 function baseDelay(func, wait, args) { 19959 if (typeof func != 'function') { 19960 throw new TypeError(FUNC_ERROR_TEXT); 19961 } 19962 return setTimeout(function() { func.apply(undefined, args); }, wait); 19963 } 19964 19965 /** 19966 * The base implementation of methods like `_.difference` without support 19967 * for excluding multiple arrays or iteratee shorthands. 19968 * 19969 * @private 19970 * @param {Array} array The array to inspect. 19971 * @param {Array} values The values to exclude. 19972 * @param {Function} [iteratee] The iteratee invoked per element. 19973 * @param {Function} [comparator] The comparator invoked per element. 19974 * @returns {Array} Returns the new array of filtered values. 19975 */ 19976 function baseDifference(array, values, iteratee, comparator) { 19977 var index = -1, 19978 includes = arrayIncludes, 19979 isCommon = true, 19980 length = array.length, 19981 result = [], 19982 valuesLength = values.length; 19983 19984 if (!length) { 19985 return result; 19986 } 19987 if (iteratee) { 19988 values = arrayMap(values, baseUnary(iteratee)); 19989 } 19990 if (comparator) { 19991 includes = arrayIncludesWith; 19992 isCommon = false; 19993 } 19994 else if (values.length >= LARGE_ARRAY_SIZE) { 19995 includes = cacheHas; 19996 isCommon = false; 19997 values = new SetCache(values); 19998 } 19999 outer: 20000 while (++index < length) { 20001 var value = array[index], 20002 computed = iteratee == null ? value : iteratee(value); 20003 20004 value = (comparator || value !== 0) ? value : 0; 20005 if (isCommon && computed === computed) { 20006 var valuesIndex = valuesLength; 20007 while (valuesIndex--) { 20008 if (values[valuesIndex] === computed) { 20009 continue outer; 20010 } 20011 } 20012 result.push(value); 20013 } 20014 else if (!includes(values, computed, comparator)) { 20015 result.push(value); 20016 } 20017 } 20018 return result; 20019 } 20020 20021 /** 20022 * The base implementation of `_.forEach` without support for iteratee shorthands. 20023 * 20024 * @private 20025 * @param {Array|Object} collection The collection to iterate over. 20026 * @param {Function} iteratee The function invoked per iteration. 20027 * @returns {Array|Object} Returns `collection`. 20028 */ 20029 var baseEach = createBaseEach(baseForOwn); 20030 20031 /** 20032 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 20033 * 20034 * @private 20035 * @param {Array|Object} collection The collection to iterate over. 20036 * @param {Function} iteratee The function invoked per iteration. 20037 * @returns {Array|Object} Returns `collection`. 20038 */ 20039 var baseEachRight = createBaseEach(baseForOwnRight, true); 20040 20041 /** 20042 * The base implementation of `_.every` without support for iteratee shorthands. 20043 * 20044 * @private 20045 * @param {Array|Object} collection The collection to iterate over. 20046 * @param {Function} predicate The function invoked per iteration. 20047 * @returns {boolean} Returns `true` if all elements pass the predicate check, 20048 * else `false` 20049 */ 20050 function baseEvery(collection, predicate) { 20051 var result = true; 20052 baseEach(collection, function(value, index, collection) { 20053 result = !!predicate(value, index, collection); 20054 return result; 20055 }); 20056 return result; 20057 } 20058 20059 /** 20060 * The base implementation of methods like `_.max` and `_.min` which accepts a 20061 * `comparator` to determine the extremum value. 20062 * 20063 * @private 20064 * @param {Array} array The array to iterate over. 20065 * @param {Function} iteratee The iteratee invoked per iteration. 20066 * @param {Function} comparator The comparator used to compare values. 20067 * @returns {*} Returns the extremum value. 20068 */ 20069 function baseExtremum(array, iteratee, comparator) { 20070 var index = -1, 20071 length = array.length; 20072 20073 while (++index < length) { 20074 var value = array[index], 20075 current = iteratee(value); 20076 20077 if (current != null && (computed === undefined 20078 ? (current === current && !isSymbol(current)) 20079 : comparator(current, computed) 20080 )) { 20081 var computed = current, 20082 result = value; 20083 } 20084 } 20085 return result; 20086 } 20087 20088 /** 20089 * The base implementation of `_.fill` without an iteratee call guard. 20090 * 20091 * @private 20092 * @param {Array} array The array to fill. 20093 * @param {*} value The value to fill `array` with. 20094 * @param {number} [start=0] The start position. 20095 * @param {number} [end=array.length] The end position. 20096 * @returns {Array} Returns `array`. 20097 */ 20098 function baseFill(array, value, start, end) { 20099 var length = array.length; 20100 20101 start = toInteger(start); 20102 if (start < 0) { 20103 start = -start > length ? 0 : (length + start); 20104 } 20105 end = (end === undefined || end > length) ? length : toInteger(end); 20106 if (end < 0) { 20107 end += length; 20108 } 20109 end = start > end ? 0 : toLength(end); 20110 while (start < end) { 20111 array[start++] = value; 20112 } 20113 return array; 20114 } 20115 20116 /** 20117 * The base implementation of `_.filter` without support for iteratee shorthands. 20118 * 20119 * @private 20120 * @param {Array|Object} collection The collection to iterate over. 20121 * @param {Function} predicate The function invoked per iteration. 20122 * @returns {Array} Returns the new filtered array. 20123 */ 20124 function baseFilter(collection, predicate) { 20125 var result = []; 20126 baseEach(collection, function(value, index, collection) { 20127 if (predicate(value, index, collection)) { 20128 result.push(value); 20129 } 20130 }); 20131 return result; 20132 } 20133 20134 /** 20135 * The base implementation of `_.flatten` with support for restricting flattening. 20136 * 20137 * @private 20138 * @param {Array} array The array to flatten. 20139 * @param {number} depth The maximum recursion depth. 20140 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 20141 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 20142 * @param {Array} [result=[]] The initial result value. 20143 * @returns {Array} Returns the new flattened array. 20144 */ 20145 function baseFlatten(array, depth, predicate, isStrict, result) { 20146 var index = -1, 20147 length = array.length; 20148 20149 predicate || (predicate = isFlattenable); 20150 result || (result = []); 20151 20152 while (++index < length) { 20153 var value = array[index]; 20154 if (depth > 0 && predicate(value)) { 20155 if (depth > 1) { 20156 // Recursively flatten arrays (susceptible to call stack limits). 20157 baseFlatten(value, depth - 1, predicate, isStrict, result); 20158 } else { 20159 arrayPush(result, value); 20160 } 20161 } else if (!isStrict) { 20162 result[result.length] = value; 20163 } 20164 } 20165 return result; 20166 } 20167 20168 /** 20169 * The base implementation of `baseForOwn` which iterates over `object` 20170 * properties returned by `keysFunc` and invokes `iteratee` for each property. 20171 * Iteratee functions may exit iteration early by explicitly returning `false`. 20172 * 20173 * @private 20174 * @param {Object} object The object to iterate over. 20175 * @param {Function} iteratee The function invoked per iteration. 20176 * @param {Function} keysFunc The function to get the keys of `object`. 20177 * @returns {Object} Returns `object`. 20178 */ 20179 var baseFor = createBaseFor(); 20180 20181 /** 20182 * This function is like `baseFor` except that it iterates over properties 20183 * in the opposite order. 20184 * 20185 * @private 20186 * @param {Object} object The object to iterate over. 20187 * @param {Function} iteratee The function invoked per iteration. 20188 * @param {Function} keysFunc The function to get the keys of `object`. 20189 * @returns {Object} Returns `object`. 20190 */ 20191 var baseForRight = createBaseFor(true); 20192 20193 /** 20194 * The base implementation of `_.forOwn` without support for iteratee shorthands. 20195 * 20196 * @private 20197 * @param {Object} object The object to iterate over. 20198 * @param {Function} iteratee The function invoked per iteration. 20199 * @returns {Object} Returns `object`. 20200 */ 20201 function baseForOwn(object, iteratee) { 20202 return object && baseFor(object, iteratee, keys); 20203 } 20204 20205 /** 20206 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 20207 * 20208 * @private 20209 * @param {Object} object The object to iterate over. 20210 * @param {Function} iteratee The function invoked per iteration. 20211 * @returns {Object} Returns `object`. 20212 */ 20213 function baseForOwnRight(object, iteratee) { 20214 return object && baseForRight(object, iteratee, keys); 20215 } 20216 20217 /** 20218 * The base implementation of `_.functions` which creates an array of 20219 * `object` function property names filtered from `props`. 20220 * 20221 * @private 20222 * @param {Object} object The object to inspect. 20223 * @param {Array} props The property names to filter. 20224 * @returns {Array} Returns the function names. 20225 */ 20226 function baseFunctions(object, props) { 20227 return arrayFilter(props, function(key) { 20228 return isFunction(object[key]); 20229 }); 20230 } 20231 20232 /** 20233 * The base implementation of `_.get` without support for default values. 20234 * 20235 * @private 20236 * @param {Object} object The object to query. 20237 * @param {Array|string} path The path of the property to get. 20238 * @returns {*} Returns the resolved value. 20239 */ 20240 function baseGet(object, path) { 20241 path = castPath(path, object); 20242 20243 var index = 0, 20244 length = path.length; 20245 20246 while (object != null && index < length) { 20247 object = object[toKey(path[index++])]; 20248 } 20249 return (index && index == length) ? object : undefined; 20250 } 20251 20252 /** 20253 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 20254 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 20255 * symbols of `object`. 20256 * 20257 * @private 20258 * @param {Object} object The object to query. 20259 * @param {Function} keysFunc The function to get the keys of `object`. 20260 * @param {Function} symbolsFunc The function to get the symbols of `object`. 20261 * @returns {Array} Returns the array of property names and symbols. 20262 */ 20263 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 20264 var result = keysFunc(object); 20265 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 20266 } 20267 20268 /** 20269 * The base implementation of `getTag` without fallbacks for buggy environments. 20270 * 20271 * @private 20272 * @param {*} value The value to query. 20273 * @returns {string} Returns the `toStringTag`. 20274 */ 20275 function baseGetTag(value) { 20276 if (value == null) { 20277 return value === undefined ? undefinedTag : nullTag; 20278 } 20279 return (symToStringTag && symToStringTag in Object(value)) 20280 ? getRawTag(value) 20281 : objectToString(value); 20282 } 20283 20284 /** 20285 * The base implementation of `_.gt` which doesn't coerce arguments. 20286 * 20287 * @private 20288 * @param {*} value The value to compare. 20289 * @param {*} other The other value to compare. 20290 * @returns {boolean} Returns `true` if `value` is greater than `other`, 20291 * else `false`. 20292 */ 20293 function baseGt(value, other) { 20294 return value > other; 20295 } 20296 20297 /** 20298 * The base implementation of `_.has` without support for deep paths. 20299 * 20300 * @private 20301 * @param {Object} [object] The object to query. 20302 * @param {Array|string} key The key to check. 20303 * @returns {boolean} Returns `true` if `key` exists, else `false`. 20304 */ 20305 function baseHas(object, key) { 20306 return object != null && hasOwnProperty.call(object, key); 20307 } 20308 20309 /** 20310 * The base implementation of `_.hasIn` without support for deep paths. 20311 * 20312 * @private 20313 * @param {Object} [object] The object to query. 20314 * @param {Array|string} key The key to check. 20315 * @returns {boolean} Returns `true` if `key` exists, else `false`. 20316 */ 20317 function baseHasIn(object, key) { 20318 return object != null && key in Object(object); 20319 } 20320 20321 /** 20322 * The base implementation of `_.inRange` which doesn't coerce arguments. 20323 * 20324 * @private 20325 * @param {number} number The number to check. 20326 * @param {number} start The start of the range. 20327 * @param {number} end The end of the range. 20328 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 20329 */ 20330 function baseInRange(number, start, end) { 20331 return number >= nativeMin(start, end) && number < nativeMax(start, end); 20332 } 20333 20334 /** 20335 * The base implementation of methods like `_.intersection`, without support 20336 * for iteratee shorthands, that accepts an array of arrays to inspect. 20337 * 20338 * @private 20339 * @param {Array} arrays The arrays to inspect. 20340 * @param {Function} [iteratee] The iteratee invoked per element. 20341 * @param {Function} [comparator] The comparator invoked per element. 20342 * @returns {Array} Returns the new array of shared values. 20343 */ 20344 function baseIntersection(arrays, iteratee, comparator) { 20345 var includes = comparator ? arrayIncludesWith : arrayIncludes, 20346 length = arrays[0].length, 20347 othLength = arrays.length, 20348 othIndex = othLength, 20349 caches = Array(othLength), 20350 maxLength = Infinity, 20351 result = []; 20352 20353 while (othIndex--) { 20354 var array = arrays[othIndex]; 20355 if (othIndex && iteratee) { 20356 array = arrayMap(array, baseUnary(iteratee)); 20357 } 20358 maxLength = nativeMin(array.length, maxLength); 20359 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 20360 ? new SetCache(othIndex && array) 20361 : undefined; 20362 } 20363 array = arrays[0]; 20364 20365 var index = -1, 20366 seen = caches[0]; 20367 20368 outer: 20369 while (++index < length && result.length < maxLength) { 20370 var value = array[index], 20371 computed = iteratee ? iteratee(value) : value; 20372 20373 value = (comparator || value !== 0) ? value : 0; 20374 if (!(seen 20375 ? cacheHas(seen, computed) 20376 : includes(result, computed, comparator) 20377 )) { 20378 othIndex = othLength; 20379 while (--othIndex) { 20380 var cache = caches[othIndex]; 20381 if (!(cache 20382 ? cacheHas(cache, computed) 20383 : includes(arrays[othIndex], computed, comparator)) 20384 ) { 20385 continue outer; 20386 } 20387 } 20388 if (seen) { 20389 seen.push(computed); 20390 } 20391 result.push(value); 20392 } 20393 } 20394 return result; 20395 } 20396 20397 /** 20398 * The base implementation of `_.invert` and `_.invertBy` which inverts 20399 * `object` with values transformed by `iteratee` and set by `setter`. 20400 * 20401 * @private 20402 * @param {Object} object The object to iterate over. 20403 * @param {Function} setter The function to set `accumulator` values. 20404 * @param {Function} iteratee The iteratee to transform values. 20405 * @param {Object} accumulator The initial inverted object. 20406 * @returns {Function} Returns `accumulator`. 20407 */ 20408 function baseInverter(object, setter, iteratee, accumulator) { 20409 baseForOwn(object, function(value, key, object) { 20410 setter(accumulator, iteratee(value), key, object); 20411 }); 20412 return accumulator; 20413 } 20414 20415 /** 20416 * The base implementation of `_.invoke` without support for individual 20417 * method arguments. 20418 * 20419 * @private 20420 * @param {Object} object The object to query. 20421 * @param {Array|string} path The path of the method to invoke. 20422 * @param {Array} args The arguments to invoke the method with. 20423 * @returns {*} Returns the result of the invoked method. 20424 */ 20425 function baseInvoke(object, path, args) { 20426 path = castPath(path, object); 20427 object = parent(object, path); 20428 var func = object == null ? object : object[toKey(last(path))]; 20429 return func == null ? undefined : apply(func, object, args); 20430 } 20431 20432 /** 20433 * The base implementation of `_.isArguments`. 20434 * 20435 * @private 20436 * @param {*} value The value to check. 20437 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 20438 */ 20439 function baseIsArguments(value) { 20440 return isObjectLike(value) && baseGetTag(value) == argsTag; 20441 } 20442 20443 /** 20444 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 20445 * 20446 * @private 20447 * @param {*} value The value to check. 20448 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 20449 */ 20450 function baseIsArrayBuffer(value) { 20451 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 20452 } 20453 20454 /** 20455 * The base implementation of `_.isDate` without Node.js optimizations. 20456 * 20457 * @private 20458 * @param {*} value The value to check. 20459 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 20460 */ 20461 function baseIsDate(value) { 20462 return isObjectLike(value) && baseGetTag(value) == dateTag; 20463 } 20464 20465 /** 20466 * The base implementation of `_.isEqual` which supports partial comparisons 20467 * and tracks traversed objects. 20468 * 20469 * @private 20470 * @param {*} value The value to compare. 20471 * @param {*} other The other value to compare. 20472 * @param {boolean} bitmask The bitmask flags. 20473 * 1 - Unordered comparison 20474 * 2 - Partial comparison 20475 * @param {Function} [customizer] The function to customize comparisons. 20476 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 20477 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 20478 */ 20479 function baseIsEqual(value, other, bitmask, customizer, stack) { 20480 if (value === other) { 20481 return true; 20482 } 20483 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 20484 return value !== value && other !== other; 20485 } 20486 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 20487 } 20488 20489 /** 20490 * A specialized version of `baseIsEqual` for arrays and objects which performs 20491 * deep comparisons and tracks traversed objects enabling objects with circular 20492 * references to be compared. 20493 * 20494 * @private 20495 * @param {Object} object The object to compare. 20496 * @param {Object} other The other object to compare. 20497 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 20498 * @param {Function} customizer The function to customize comparisons. 20499 * @param {Function} equalFunc The function to determine equivalents of values. 20500 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 20501 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 20502 */ 20503 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 20504 var objIsArr = isArray(object), 20505 othIsArr = isArray(other), 20506 objTag = objIsArr ? arrayTag : getTag(object), 20507 othTag = othIsArr ? arrayTag : getTag(other); 20508 20509 objTag = objTag == argsTag ? objectTag : objTag; 20510 othTag = othTag == argsTag ? objectTag : othTag; 20511 20512 var objIsObj = objTag == objectTag, 20513 othIsObj = othTag == objectTag, 20514 isSameTag = objTag == othTag; 20515 20516 if (isSameTag && isBuffer(object)) { 20517 if (!isBuffer(other)) { 20518 return false; 20519 } 20520 objIsArr = true; 20521 objIsObj = false; 20522 } 20523 if (isSameTag && !objIsObj) { 20524 stack || (stack = new Stack); 20525 return (objIsArr || isTypedArray(object)) 20526 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 20527 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 20528 } 20529 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 20530 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 20531 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 20532 20533 if (objIsWrapped || othIsWrapped) { 20534 var objUnwrapped = objIsWrapped ? object.value() : object, 20535 othUnwrapped = othIsWrapped ? other.value() : other; 20536 20537 stack || (stack = new Stack); 20538 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 20539 } 20540 } 20541 if (!isSameTag) { 20542 return false; 20543 } 20544 stack || (stack = new Stack); 20545 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 20546 } 20547 20548 /** 20549 * The base implementation of `_.isMap` without Node.js optimizations. 20550 * 20551 * @private 20552 * @param {*} value The value to check. 20553 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 20554 */ 20555 function baseIsMap(value) { 20556 return isObjectLike(value) && getTag(value) == mapTag; 20557 } 20558 20559 /** 20560 * The base implementation of `_.isMatch` without support for iteratee shorthands. 20561 * 20562 * @private 20563 * @param {Object} object The object to inspect. 20564 * @param {Object} source The object of property values to match. 20565 * @param {Array} matchData The property names, values, and compare flags to match. 20566 * @param {Function} [customizer] The function to customize comparisons. 20567 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 20568 */ 20569 function baseIsMatch(object, source, matchData, customizer) { 20570 var index = matchData.length, 20571 length = index, 20572 noCustomizer = !customizer; 20573 20574 if (object == null) { 20575 return !length; 20576 } 20577 object = Object(object); 20578 while (index--) { 20579 var data = matchData[index]; 20580 if ((noCustomizer && data[2]) 20581 ? data[1] !== object[data[0]] 20582 : !(data[0] in object) 20583 ) { 20584 return false; 20585 } 20586 } 20587 while (++index < length) { 20588 data = matchData[index]; 20589 var key = data[0], 20590 objValue = object[key], 20591 srcValue = data[1]; 20592 20593 if (noCustomizer && data[2]) { 20594 if (objValue === undefined && !(key in object)) { 20595 return false; 20596 } 20597 } else { 20598 var stack = new Stack; 20599 if (customizer) { 20600 var result = customizer(objValue, srcValue, key, object, source, stack); 20601 } 20602 if (!(result === undefined 20603 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 20604 : result 20605 )) { 20606 return false; 20607 } 20608 } 20609 } 20610 return true; 20611 } 20612 20613 /** 20614 * The base implementation of `_.isNative` without bad shim checks. 20615 * 20616 * @private 20617 * @param {*} value The value to check. 20618 * @returns {boolean} Returns `true` if `value` is a native function, 20619 * else `false`. 20620 */ 20621 function baseIsNative(value) { 20622 if (!isObject(value) || isMasked(value)) { 20623 return false; 20624 } 20625 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 20626 return pattern.test(toSource(value)); 20627 } 20628 20629 /** 20630 * The base implementation of `_.isRegExp` without Node.js optimizations. 20631 * 20632 * @private 20633 * @param {*} value The value to check. 20634 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 20635 */ 20636 function baseIsRegExp(value) { 20637 return isObjectLike(value) && baseGetTag(value) == regexpTag; 20638 } 20639 20640 /** 20641 * The base implementation of `_.isSet` without Node.js optimizations. 20642 * 20643 * @private 20644 * @param {*} value The value to check. 20645 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 20646 */ 20647 function baseIsSet(value) { 20648 return isObjectLike(value) && getTag(value) == setTag; 20649 } 20650 20651 /** 20652 * The base implementation of `_.isTypedArray` without Node.js optimizations. 20653 * 20654 * @private 20655 * @param {*} value The value to check. 20656 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 20657 */ 20658 function baseIsTypedArray(value) { 20659 return isObjectLike(value) && 20660 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 20661 } 20662 20663 /** 20664 * The base implementation of `_.iteratee`. 20665 * 20666 * @private 20667 * @param {*} [value=_.identity] The value to convert to an iteratee. 20668 * @returns {Function} Returns the iteratee. 20669 */ 20670 function baseIteratee(value) { 20671 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 20672 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 20673 if (typeof value == 'function') { 20674 return value; 20675 } 20676 if (value == null) { 20677 return identity; 20678 } 20679 if (typeof value == 'object') { 20680 return isArray(value) 20681 ? baseMatchesProperty(value[0], value[1]) 20682 : baseMatches(value); 20683 } 20684 return property(value); 20685 } 20686 20687 /** 20688 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 20689 * 20690 * @private 20691 * @param {Object} object The object to query. 20692 * @returns {Array} Returns the array of property names. 20693 */ 20694 function baseKeys(object) { 20695 if (!isPrototype(object)) { 20696 return nativeKeys(object); 20697 } 20698 var result = []; 20699 for (var key in Object(object)) { 20700 if (hasOwnProperty.call(object, key) && key != 'constructor') { 20701 result.push(key); 20702 } 20703 } 20704 return result; 20705 } 20706 20707 /** 20708 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 20709 * 20710 * @private 20711 * @param {Object} object The object to query. 20712 * @returns {Array} Returns the array of property names. 20713 */ 20714 function baseKeysIn(object) { 20715 if (!isObject(object)) { 20716 return nativeKeysIn(object); 20717 } 20718 var isProto = isPrototype(object), 20719 result = []; 20720 20721 for (var key in object) { 20722 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 20723 result.push(key); 20724 } 20725 } 20726 return result; 20727 } 20728 20729 /** 20730 * The base implementation of `_.lt` which doesn't coerce arguments. 20731 * 20732 * @private 20733 * @param {*} value The value to compare. 20734 * @param {*} other The other value to compare. 20735 * @returns {boolean} Returns `true` if `value` is less than `other`, 20736 * else `false`. 20737 */ 20738 function baseLt(value, other) { 20739 return value < other; 20740 } 20741 20742 /** 20743 * The base implementation of `_.map` without support for iteratee shorthands. 20744 * 20745 * @private 20746 * @param {Array|Object} collection The collection to iterate over. 20747 * @param {Function} iteratee The function invoked per iteration. 20748 * @returns {Array} Returns the new mapped array. 20749 */ 20750 function baseMap(collection, iteratee) { 20751 var index = -1, 20752 result = isArrayLike(collection) ? Array(collection.length) : []; 20753 20754 baseEach(collection, function(value, key, collection) { 20755 result[++index] = iteratee(value, key, collection); 20756 }); 20757 return result; 20758 } 20759 20760 /** 20761 * The base implementation of `_.matches` which doesn't clone `source`. 20762 * 20763 * @private 20764 * @param {Object} source The object of property values to match. 20765 * @returns {Function} Returns the new spec function. 20766 */ 20767 function baseMatches(source) { 20768 var matchData = getMatchData(source); 20769 if (matchData.length == 1 && matchData[0][2]) { 20770 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 20771 } 20772 return function(object) { 20773 return object === source || baseIsMatch(object, source, matchData); 20774 }; 20775 } 20776 20777 /** 20778 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 20779 * 20780 * @private 20781 * @param {string} path The path of the property to get. 20782 * @param {*} srcValue The value to match. 20783 * @returns {Function} Returns the new spec function. 20784 */ 20785 function baseMatchesProperty(path, srcValue) { 20786 if (isKey(path) && isStrictComparable(srcValue)) { 20787 return matchesStrictComparable(toKey(path), srcValue); 20788 } 20789 return function(object) { 20790 var objValue = get(object, path); 20791 return (objValue === undefined && objValue === srcValue) 20792 ? hasIn(object, path) 20793 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 20794 }; 20795 } 20796 20797 /** 20798 * The base implementation of `_.merge` without support for multiple sources. 20799 * 20800 * @private 20801 * @param {Object} object The destination object. 20802 * @param {Object} source The source object. 20803 * @param {number} srcIndex The index of `source`. 20804 * @param {Function} [customizer] The function to customize merged values. 20805 * @param {Object} [stack] Tracks traversed source values and their merged 20806 * counterparts. 20807 */ 20808 function baseMerge(object, source, srcIndex, customizer, stack) { 20809 if (object === source) { 20810 return; 20811 } 20812 baseFor(source, function(srcValue, key) { 20813 stack || (stack = new Stack); 20814 if (isObject(srcValue)) { 20815 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 20816 } 20817 else { 20818 var newValue = customizer 20819 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) 20820 : undefined; 20821 20822 if (newValue === undefined) { 20823 newValue = srcValue; 20824 } 20825 assignMergeValue(object, key, newValue); 20826 } 20827 }, keysIn); 20828 } 20829 20830 /** 20831 * A specialized version of `baseMerge` for arrays and objects which performs 20832 * deep merges and tracks traversed objects enabling objects with circular 20833 * references to be merged. 20834 * 20835 * @private 20836 * @param {Object} object The destination object. 20837 * @param {Object} source The source object. 20838 * @param {string} key The key of the value to merge. 20839 * @param {number} srcIndex The index of `source`. 20840 * @param {Function} mergeFunc The function to merge values. 20841 * @param {Function} [customizer] The function to customize assigned values. 20842 * @param {Object} [stack] Tracks traversed source values and their merged 20843 * counterparts. 20844 */ 20845 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 20846 var objValue = safeGet(object, key), 20847 srcValue = safeGet(source, key), 20848 stacked = stack.get(srcValue); 20849 20850 if (stacked) { 20851 assignMergeValue(object, key, stacked); 20852 return; 20853 } 20854 var newValue = customizer 20855 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 20856 : undefined; 20857 20858 var isCommon = newValue === undefined; 20859 20860 if (isCommon) { 20861 var isArr = isArray(srcValue), 20862 isBuff = !isArr && isBuffer(srcValue), 20863 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 20864 20865 newValue = srcValue; 20866 if (isArr || isBuff || isTyped) { 20867 if (isArray(objValue)) { 20868 newValue = objValue; 20869 } 20870 else if (isArrayLikeObject(objValue)) { 20871 newValue = copyArray(objValue); 20872 } 20873 else if (isBuff) { 20874 isCommon = false; 20875 newValue = cloneBuffer(srcValue, true); 20876 } 20877 else if (isTyped) { 20878 isCommon = false; 20879 newValue = cloneTypedArray(srcValue, true); 20880 } 20881 else { 20882 newValue = []; 20883 } 20884 } 20885 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 20886 newValue = objValue; 20887 if (isArguments(objValue)) { 20888 newValue = toPlainObject(objValue); 20889 } 20890 else if (!isObject(objValue) || isFunction(objValue)) { 20891 newValue = initCloneObject(srcValue); 20892 } 20893 } 20894 else { 20895 isCommon = false; 20896 } 20897 } 20898 if (isCommon) { 20899 // Recursively merge objects and arrays (susceptible to call stack limits). 20900 stack.set(srcValue, newValue); 20901 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 20902 stack['delete'](srcValue); 20903 } 20904 assignMergeValue(object, key, newValue); 20905 } 20906 20907 /** 20908 * The base implementation of `_.nth` which doesn't coerce arguments. 20909 * 20910 * @private 20911 * @param {Array} array The array to query. 20912 * @param {number} n The index of the element to return. 20913 * @returns {*} Returns the nth element of `array`. 20914 */ 20915 function baseNth(array, n) { 20916 var length = array.length; 20917 if (!length) { 20918 return; 20919 } 20920 n += n < 0 ? length : 0; 20921 return isIndex(n, length) ? array[n] : undefined; 20922 } 20923 20924 /** 20925 * The base implementation of `_.orderBy` without param guards. 20926 * 20927 * @private 20928 * @param {Array|Object} collection The collection to iterate over. 20929 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 20930 * @param {string[]} orders The sort orders of `iteratees`. 20931 * @returns {Array} Returns the new sorted array. 20932 */ 20933 function baseOrderBy(collection, iteratees, orders) { 20934 if (iteratees.length) { 20935 iteratees = arrayMap(iteratees, function(iteratee) { 20936 if (isArray(iteratee)) { 20937 return function(value) { 20938 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); 20939 } 20940 } 20941 return iteratee; 20942 }); 20943 } else { 20944 iteratees = [identity]; 20945 } 20946 20947 var index = -1; 20948 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 20949 20950 var result = baseMap(collection, function(value, key, collection) { 20951 var criteria = arrayMap(iteratees, function(iteratee) { 20952 return iteratee(value); 20953 }); 20954 return { 'criteria': criteria, 'index': ++index, 'value': value }; 20955 }); 20956 20957 return baseSortBy(result, function(object, other) { 20958 return compareMultiple(object, other, orders); 20959 }); 20960 } 20961 20962 /** 20963 * The base implementation of `_.pick` without support for individual 20964 * property identifiers. 20965 * 20966 * @private 20967 * @param {Object} object The source object. 20968 * @param {string[]} paths The property paths to pick. 20969 * @returns {Object} Returns the new object. 20970 */ 20971 function basePick(object, paths) { 20972 return basePickBy(object, paths, function(value, path) { 20973 return hasIn(object, path); 20974 }); 20975 } 20976 20977 /** 20978 * The base implementation of `_.pickBy` without support for iteratee shorthands. 20979 * 20980 * @private 20981 * @param {Object} object The source object. 20982 * @param {string[]} paths The property paths to pick. 20983 * @param {Function} predicate The function invoked per property. 20984 * @returns {Object} Returns the new object. 20985 */ 20986 function basePickBy(object, paths, predicate) { 20987 var index = -1, 20988 length = paths.length, 20989 result = {}; 20990 20991 while (++index < length) { 20992 var path = paths[index], 20993 value = baseGet(object, path); 20994 20995 if (predicate(value, path)) { 20996 baseSet(result, castPath(path, object), value); 20997 } 20998 } 20999 return result; 21000 } 21001 21002 /** 21003 * A specialized version of `baseProperty` which supports deep paths. 21004 * 21005 * @private 21006 * @param {Array|string} path The path of the property to get. 21007 * @returns {Function} Returns the new accessor function. 21008 */ 21009 function basePropertyDeep(path) { 21010 return function(object) { 21011 return baseGet(object, path); 21012 }; 21013 } 21014 21015 /** 21016 * The base implementation of `_.pullAllBy` without support for iteratee 21017 * shorthands. 21018 * 21019 * @private 21020 * @param {Array} array The array to modify. 21021 * @param {Array} values The values to remove. 21022 * @param {Function} [iteratee] The iteratee invoked per element. 21023 * @param {Function} [comparator] The comparator invoked per element. 21024 * @returns {Array} Returns `array`. 21025 */ 21026 function basePullAll(array, values, iteratee, comparator) { 21027 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 21028 index = -1, 21029 length = values.length, 21030 seen = array; 21031 21032 if (array === values) { 21033 values = copyArray(values); 21034 } 21035 if (iteratee) { 21036 seen = arrayMap(array, baseUnary(iteratee)); 21037 } 21038 while (++index < length) { 21039 var fromIndex = 0, 21040 value = values[index], 21041 computed = iteratee ? iteratee(value) : value; 21042 21043 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 21044 if (seen !== array) { 21045 splice.call(seen, fromIndex, 1); 21046 } 21047 splice.call(array, fromIndex, 1); 21048 } 21049 } 21050 return array; 21051 } 21052 21053 /** 21054 * The base implementation of `_.pullAt` without support for individual 21055 * indexes or capturing the removed elements. 21056 * 21057 * @private 21058 * @param {Array} array The array to modify. 21059 * @param {number[]} indexes The indexes of elements to remove. 21060 * @returns {Array} Returns `array`. 21061 */ 21062 function basePullAt(array, indexes) { 21063 var length = array ? indexes.length : 0, 21064 lastIndex = length - 1; 21065 21066 while (length--) { 21067 var index = indexes[length]; 21068 if (length == lastIndex || index !== previous) { 21069 var previous = index; 21070 if (isIndex(index)) { 21071 splice.call(array, index, 1); 21072 } else { 21073 baseUnset(array, index); 21074 } 21075 } 21076 } 21077 return array; 21078 } 21079 21080 /** 21081 * The base implementation of `_.random` without support for returning 21082 * floating-point numbers. 21083 * 21084 * @private 21085 * @param {number} lower The lower bound. 21086 * @param {number} upper The upper bound. 21087 * @returns {number} Returns the random number. 21088 */ 21089 function baseRandom(lower, upper) { 21090 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 21091 } 21092 21093 /** 21094 * The base implementation of `_.range` and `_.rangeRight` which doesn't 21095 * coerce arguments. 21096 * 21097 * @private 21098 * @param {number} start The start of the range. 21099 * @param {number} end The end of the range. 21100 * @param {number} step The value to increment or decrement by. 21101 * @param {boolean} [fromRight] Specify iterating from right to left. 21102 * @returns {Array} Returns the range of numbers. 21103 */ 21104 function baseRange(start, end, step, fromRight) { 21105 var index = -1, 21106 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 21107 result = Array(length); 21108 21109 while (length--) { 21110 result[fromRight ? length : ++index] = start; 21111 start += step; 21112 } 21113 return result; 21114 } 21115 21116 /** 21117 * The base implementation of `_.repeat` which doesn't coerce arguments. 21118 * 21119 * @private 21120 * @param {string} string The string to repeat. 21121 * @param {number} n The number of times to repeat the string. 21122 * @returns {string} Returns the repeated string. 21123 */ 21124 function baseRepeat(string, n) { 21125 var result = ''; 21126 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 21127 return result; 21128 } 21129 // Leverage the exponentiation by squaring algorithm for a faster repeat. 21130 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 21131 do { 21132 if (n % 2) { 21133 result += string; 21134 } 21135 n = nativeFloor(n / 2); 21136 if (n) { 21137 string += string; 21138 } 21139 } while (n); 21140 21141 return result; 21142 } 21143 21144 /** 21145 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 21146 * 21147 * @private 21148 * @param {Function} func The function to apply a rest parameter to. 21149 * @param {number} [start=func.length-1] The start position of the rest parameter. 21150 * @returns {Function} Returns the new function. 21151 */ 21152 function baseRest(func, start) { 21153 return setToString(overRest(func, start, identity), func + ''); 21154 } 21155 21156 /** 21157 * The base implementation of `_.sample`. 21158 * 21159 * @private 21160 * @param {Array|Object} collection The collection to sample. 21161 * @returns {*} Returns the random element. 21162 */ 21163 function baseSample(collection) { 21164 return arraySample(values(collection)); 21165 } 21166 21167 /** 21168 * The base implementation of `_.sampleSize` without param guards. 21169 * 21170 * @private 21171 * @param {Array|Object} collection The collection to sample. 21172 * @param {number} n The number of elements to sample. 21173 * @returns {Array} Returns the random elements. 21174 */ 21175 function baseSampleSize(collection, n) { 21176 var array = values(collection); 21177 return shuffleSelf(array, baseClamp(n, 0, array.length)); 21178 } 21179 21180 /** 21181 * The base implementation of `_.set`. 21182 * 21183 * @private 21184 * @param {Object} object The object to modify. 21185 * @param {Array|string} path The path of the property to set. 21186 * @param {*} value The value to set. 21187 * @param {Function} [customizer] The function to customize path creation. 21188 * @returns {Object} Returns `object`. 21189 */ 21190 function baseSet(object, path, value, customizer) { 21191 if (!isObject(object)) { 21192 return object; 21193 } 21194 path = castPath(path, object); 21195 21196 var index = -1, 21197 length = path.length, 21198 lastIndex = length - 1, 21199 nested = object; 21200 21201 while (nested != null && ++index < length) { 21202 var key = toKey(path[index]), 21203 newValue = value; 21204 21205 if (key === '__proto__' || key === 'constructor' || key === 'prototype') { 21206 return object; 21207 } 21208 21209 if (index != lastIndex) { 21210 var objValue = nested[key]; 21211 newValue = customizer ? customizer(objValue, key, nested) : undefined; 21212 if (newValue === undefined) { 21213 newValue = isObject(objValue) 21214 ? objValue 21215 : (isIndex(path[index + 1]) ? [] : {}); 21216 } 21217 } 21218 assignValue(nested, key, newValue); 21219 nested = nested[key]; 21220 } 21221 return object; 21222 } 21223 21224 /** 21225 * The base implementation of `setData` without support for hot loop shorting. 21226 * 21227 * @private 21228 * @param {Function} func The function to associate metadata with. 21229 * @param {*} data The metadata. 21230 * @returns {Function} Returns `func`. 21231 */ 21232 var baseSetData = !metaMap ? identity : function(func, data) { 21233 metaMap.set(func, data); 21234 return func; 21235 }; 21236 21237 /** 21238 * The base implementation of `setToString` without support for hot loop shorting. 21239 * 21240 * @private 21241 * @param {Function} func The function to modify. 21242 * @param {Function} string The `toString` result. 21243 * @returns {Function} Returns `func`. 21244 */ 21245 var baseSetToString = !defineProperty ? identity : function(func, string) { 21246 return defineProperty(func, 'toString', { 21247 'configurable': true, 21248 'enumerable': false, 21249 'value': constant(string), 21250 'writable': true 21251 }); 21252 }; 21253 21254 /** 21255 * The base implementation of `_.shuffle`. 21256 * 21257 * @private 21258 * @param {Array|Object} collection The collection to shuffle. 21259 * @returns {Array} Returns the new shuffled array. 21260 */ 21261 function baseShuffle(collection) { 21262 return shuffleSelf(values(collection)); 21263 } 21264 21265 /** 21266 * The base implementation of `_.slice` without an iteratee call guard. 21267 * 21268 * @private 21269 * @param {Array} array The array to slice. 21270 * @param {number} [start=0] The start position. 21271 * @param {number} [end=array.length] The end position. 21272 * @returns {Array} Returns the slice of `array`. 21273 */ 21274 function baseSlice(array, start, end) { 21275 var index = -1, 21276 length = array.length; 21277 21278 if (start < 0) { 21279 start = -start > length ? 0 : (length + start); 21280 } 21281 end = end > length ? length : end; 21282 if (end < 0) { 21283 end += length; 21284 } 21285 length = start > end ? 0 : ((end - start) >>> 0); 21286 start >>>= 0; 21287 21288 var result = Array(length); 21289 while (++index < length) { 21290 result[index] = array[index + start]; 21291 } 21292 return result; 21293 } 21294 21295 /** 21296 * The base implementation of `_.some` without support for iteratee shorthands. 21297 * 21298 * @private 21299 * @param {Array|Object} collection The collection to iterate over. 21300 * @param {Function} predicate The function invoked per iteration. 21301 * @returns {boolean} Returns `true` if any element passes the predicate check, 21302 * else `false`. 21303 */ 21304 function baseSome(collection, predicate) { 21305 var result; 21306 21307 baseEach(collection, function(value, index, collection) { 21308 result = predicate(value, index, collection); 21309 return !result; 21310 }); 21311 return !!result; 21312 } 21313 21314 /** 21315 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 21316 * performs a binary search of `array` to determine the index at which `value` 21317 * should be inserted into `array` in order to maintain its sort order. 21318 * 21319 * @private 21320 * @param {Array} array The sorted array to inspect. 21321 * @param {*} value The value to evaluate. 21322 * @param {boolean} [retHighest] Specify returning the highest qualified index. 21323 * @returns {number} Returns the index at which `value` should be inserted 21324 * into `array`. 21325 */ 21326 function baseSortedIndex(array, value, retHighest) { 21327 var low = 0, 21328 high = array == null ? low : array.length; 21329 21330 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 21331 while (low < high) { 21332 var mid = (low + high) >>> 1, 21333 computed = array[mid]; 21334 21335 if (computed !== null && !isSymbol(computed) && 21336 (retHighest ? (computed <= value) : (computed < value))) { 21337 low = mid + 1; 21338 } else { 21339 high = mid; 21340 } 21341 } 21342 return high; 21343 } 21344 return baseSortedIndexBy(array, value, identity, retHighest); 21345 } 21346 21347 /** 21348 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 21349 * which invokes `iteratee` for `value` and each element of `array` to compute 21350 * their sort ranking. The iteratee is invoked with one argument; (value). 21351 * 21352 * @private 21353 * @param {Array} array The sorted array to inspect. 21354 * @param {*} value The value to evaluate. 21355 * @param {Function} iteratee The iteratee invoked per element. 21356 * @param {boolean} [retHighest] Specify returning the highest qualified index. 21357 * @returns {number} Returns the index at which `value` should be inserted 21358 * into `array`. 21359 */ 21360 function baseSortedIndexBy(array, value, iteratee, retHighest) { 21361 var low = 0, 21362 high = array == null ? 0 : array.length; 21363 if (high === 0) { 21364 return 0; 21365 } 21366 21367 value = iteratee(value); 21368 var valIsNaN = value !== value, 21369 valIsNull = value === null, 21370 valIsSymbol = isSymbol(value), 21371 valIsUndefined = value === undefined; 21372 21373 while (low < high) { 21374 var mid = nativeFloor((low + high) / 2), 21375 computed = iteratee(array[mid]), 21376 othIsDefined = computed !== undefined, 21377 othIsNull = computed === null, 21378 othIsReflexive = computed === computed, 21379 othIsSymbol = isSymbol(computed); 21380 21381 if (valIsNaN) { 21382 var setLow = retHighest || othIsReflexive; 21383 } else if (valIsUndefined) { 21384 setLow = othIsReflexive && (retHighest || othIsDefined); 21385 } else if (valIsNull) { 21386 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 21387 } else if (valIsSymbol) { 21388 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 21389 } else if (othIsNull || othIsSymbol) { 21390 setLow = false; 21391 } else { 21392 setLow = retHighest ? (computed <= value) : (computed < value); 21393 } 21394 if (setLow) { 21395 low = mid + 1; 21396 } else { 21397 high = mid; 21398 } 21399 } 21400 return nativeMin(high, MAX_ARRAY_INDEX); 21401 } 21402 21403 /** 21404 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 21405 * support for iteratee shorthands. 21406 * 21407 * @private 21408 * @param {Array} array The array to inspect. 21409 * @param {Function} [iteratee] The iteratee invoked per element. 21410 * @returns {Array} Returns the new duplicate free array. 21411 */ 21412 function baseSortedUniq(array, iteratee) { 21413 var index = -1, 21414 length = array.length, 21415 resIndex = 0, 21416 result = []; 21417 21418 while (++index < length) { 21419 var value = array[index], 21420 computed = iteratee ? iteratee(value) : value; 21421 21422 if (!index || !eq(computed, seen)) { 21423 var seen = computed; 21424 result[resIndex++] = value === 0 ? 0 : value; 21425 } 21426 } 21427 return result; 21428 } 21429 21430 /** 21431 * The base implementation of `_.toNumber` which doesn't ensure correct 21432 * conversions of binary, hexadecimal, or octal string values. 21433 * 21434 * @private 21435 * @param {*} value The value to process. 21436 * @returns {number} Returns the number. 21437 */ 21438 function baseToNumber(value) { 21439 if (typeof value == 'number') { 21440 return value; 21441 } 21442 if (isSymbol(value)) { 21443 return NAN; 21444 } 21445 return +value; 21446 } 21447 21448 /** 21449 * The base implementation of `_.toString` which doesn't convert nullish 21450 * values to empty strings. 21451 * 21452 * @private 21453 * @param {*} value The value to process. 21454 * @returns {string} Returns the string. 21455 */ 21456 function baseToString(value) { 21457 // Exit early for strings to avoid a performance hit in some environments. 21458 if (typeof value == 'string') { 21459 return value; 21460 } 21461 if (isArray(value)) { 21462 // Recursively convert values (susceptible to call stack limits). 21463 return arrayMap(value, baseToString) + ''; 21464 } 21465 if (isSymbol(value)) { 21466 return symbolToString ? symbolToString.call(value) : ''; 21467 } 21468 var result = (value + ''); 21469 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 21470 } 21471 21472 /** 21473 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 21474 * 21475 * @private 21476 * @param {Array} array The array to inspect. 21477 * @param {Function} [iteratee] The iteratee invoked per element. 21478 * @param {Function} [comparator] The comparator invoked per element. 21479 * @returns {Array} Returns the new duplicate free array. 21480 */ 21481 function baseUniq(array, iteratee, comparator) { 21482 var index = -1, 21483 includes = arrayIncludes, 21484 length = array.length, 21485 isCommon = true, 21486 result = [], 21487 seen = result; 21488 21489 if (comparator) { 21490 isCommon = false; 21491 includes = arrayIncludesWith; 21492 } 21493 else if (length >= LARGE_ARRAY_SIZE) { 21494 var set = iteratee ? null : createSet(array); 21495 if (set) { 21496 return setToArray(set); 21497 } 21498 isCommon = false; 21499 includes = cacheHas; 21500 seen = new SetCache; 21501 } 21502 else { 21503 seen = iteratee ? [] : result; 21504 } 21505 outer: 21506 while (++index < length) { 21507 var value = array[index], 21508 computed = iteratee ? iteratee(value) : value; 21509 21510 value = (comparator || value !== 0) ? value : 0; 21511 if (isCommon && computed === computed) { 21512 var seenIndex = seen.length; 21513 while (seenIndex--) { 21514 if (seen[seenIndex] === computed) { 21515 continue outer; 21516 } 21517 } 21518 if (iteratee) { 21519 seen.push(computed); 21520 } 21521 result.push(value); 21522 } 21523 else if (!includes(seen, computed, comparator)) { 21524 if (seen !== result) { 21525 seen.push(computed); 21526 } 21527 result.push(value); 21528 } 21529 } 21530 return result; 21531 } 21532 21533 /** 21534 * The base implementation of `_.unset`. 21535 * 21536 * @private 21537 * @param {Object} object The object to modify. 21538 * @param {Array|string} path The property path to unset. 21539 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 21540 */ 21541 function baseUnset(object, path) { 21542 path = castPath(path, object); 21543 object = parent(object, path); 21544 return object == null || delete object[toKey(last(path))]; 21545 } 21546 21547 /** 21548 * The base implementation of `_.update`. 21549 * 21550 * @private 21551 * @param {Object} object The object to modify. 21552 * @param {Array|string} path The path of the property to update. 21553 * @param {Function} updater The function to produce the updated value. 21554 * @param {Function} [customizer] The function to customize path creation. 21555 * @returns {Object} Returns `object`. 21556 */ 21557 function baseUpdate(object, path, updater, customizer) { 21558 return baseSet(object, path, updater(baseGet(object, path)), customizer); 21559 } 21560 21561 /** 21562 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 21563 * without support for iteratee shorthands. 21564 * 21565 * @private 21566 * @param {Array} array The array to query. 21567 * @param {Function} predicate The function invoked per iteration. 21568 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 21569 * @param {boolean} [fromRight] Specify iterating from right to left. 21570 * @returns {Array} Returns the slice of `array`. 21571 */ 21572 function baseWhile(array, predicate, isDrop, fromRight) { 21573 var length = array.length, 21574 index = fromRight ? length : -1; 21575 21576 while ((fromRight ? index-- : ++index < length) && 21577 predicate(array[index], index, array)) {} 21578 21579 return isDrop 21580 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 21581 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 21582 } 21583 21584 /** 21585 * The base implementation of `wrapperValue` which returns the result of 21586 * performing a sequence of actions on the unwrapped `value`, where each 21587 * successive action is supplied the return value of the previous. 21588 * 21589 * @private 21590 * @param {*} value The unwrapped value. 21591 * @param {Array} actions Actions to perform to resolve the unwrapped value. 21592 * @returns {*} Returns the resolved value. 21593 */ 21594 function baseWrapperValue(value, actions) { 21595 var result = value; 21596 if (result instanceof LazyWrapper) { 21597 result = result.value(); 21598 } 21599 return arrayReduce(actions, function(result, action) { 21600 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 21601 }, result); 21602 } 21603 21604 /** 21605 * The base implementation of methods like `_.xor`, without support for 21606 * iteratee shorthands, that accepts an array of arrays to inspect. 21607 * 21608 * @private 21609 * @param {Array} arrays The arrays to inspect. 21610 * @param {Function} [iteratee] The iteratee invoked per element. 21611 * @param {Function} [comparator] The comparator invoked per element. 21612 * @returns {Array} Returns the new array of values. 21613 */ 21614 function baseXor(arrays, iteratee, comparator) { 21615 var length = arrays.length; 21616 if (length < 2) { 21617 return length ? baseUniq(arrays[0]) : []; 21618 } 21619 var index = -1, 21620 result = Array(length); 21621 21622 while (++index < length) { 21623 var array = arrays[index], 21624 othIndex = -1; 21625 21626 while (++othIndex < length) { 21627 if (othIndex != index) { 21628 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 21629 } 21630 } 21631 } 21632 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 21633 } 21634 21635 /** 21636 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 21637 * 21638 * @private 21639 * @param {Array} props The property identifiers. 21640 * @param {Array} values The property values. 21641 * @param {Function} assignFunc The function to assign values. 21642 * @returns {Object} Returns the new object. 21643 */ 21644 function baseZipObject(props, values, assignFunc) { 21645 var index = -1, 21646 length = props.length, 21647 valsLength = values.length, 21648 result = {}; 21649 21650 while (++index < length) { 21651 var value = index < valsLength ? values[index] : undefined; 21652 assignFunc(result, props[index], value); 21653 } 21654 return result; 21655 } 21656 21657 /** 21658 * Casts `value` to an empty array if it's not an array like object. 21659 * 21660 * @private 21661 * @param {*} value The value to inspect. 21662 * @returns {Array|Object} Returns the cast array-like object. 21663 */ 21664 function castArrayLikeObject(value) { 21665 return isArrayLikeObject(value) ? value : []; 21666 } 21667 21668 /** 21669 * Casts `value` to `identity` if it's not a function. 21670 * 21671 * @private 21672 * @param {*} value The value to inspect. 21673 * @returns {Function} Returns cast function. 21674 */ 21675 function castFunction(value) { 21676 return typeof value == 'function' ? value : identity; 21677 } 21678 21679 /** 21680 * Casts `value` to a path array if it's not one. 21681 * 21682 * @private 21683 * @param {*} value The value to inspect. 21684 * @param {Object} [object] The object to query keys on. 21685 * @returns {Array} Returns the cast property path array. 21686 */ 21687 function castPath(value, object) { 21688 if (isArray(value)) { 21689 return value; 21690 } 21691 return isKey(value, object) ? [value] : stringToPath(toString(value)); 21692 } 21693 21694 /** 21695 * A `baseRest` alias which can be replaced with `identity` by module 21696 * replacement plugins. 21697 * 21698 * @private 21699 * @type {Function} 21700 * @param {Function} func The function to apply a rest parameter to. 21701 * @returns {Function} Returns the new function. 21702 */ 21703 var castRest = baseRest; 21704 21705 /** 21706 * Casts `array` to a slice if it's needed. 21707 * 21708 * @private 21709 * @param {Array} array The array to inspect. 21710 * @param {number} start The start position. 21711 * @param {number} [end=array.length] The end position. 21712 * @returns {Array} Returns the cast slice. 21713 */ 21714 function castSlice(array, start, end) { 21715 var length = array.length; 21716 end = end === undefined ? length : end; 21717 return (!start && end >= length) ? array : baseSlice(array, start, end); 21718 } 21719 21720 /** 21721 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 21722 * 21723 * @private 21724 * @param {number|Object} id The timer id or timeout object of the timer to clear. 21725 */ 21726 var clearTimeout = ctxClearTimeout || function(id) { 21727 return root.clearTimeout(id); 21728 }; 21729 21730 /** 21731 * Creates a clone of `buffer`. 21732 * 21733 * @private 21734 * @param {Buffer} buffer The buffer to clone. 21735 * @param {boolean} [isDeep] Specify a deep clone. 21736 * @returns {Buffer} Returns the cloned buffer. 21737 */ 21738 function cloneBuffer(buffer, isDeep) { 21739 if (isDeep) { 21740 return buffer.slice(); 21741 } 21742 var length = buffer.length, 21743 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 21744 21745 buffer.copy(result); 21746 return result; 21747 } 21748 21749 /** 21750 * Creates a clone of `arrayBuffer`. 21751 * 21752 * @private 21753 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 21754 * @returns {ArrayBuffer} Returns the cloned array buffer. 21755 */ 21756 function cloneArrayBuffer(arrayBuffer) { 21757 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 21758 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 21759 return result; 21760 } 21761 21762 /** 21763 * Creates a clone of `dataView`. 21764 * 21765 * @private 21766 * @param {Object} dataView The data view to clone. 21767 * @param {boolean} [isDeep] Specify a deep clone. 21768 * @returns {Object} Returns the cloned data view. 21769 */ 21770 function cloneDataView(dataView, isDeep) { 21771 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 21772 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 21773 } 21774 21775 /** 21776 * Creates a clone of `regexp`. 21777 * 21778 * @private 21779 * @param {Object} regexp The regexp to clone. 21780 * @returns {Object} Returns the cloned regexp. 21781 */ 21782 function cloneRegExp(regexp) { 21783 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 21784 result.lastIndex = regexp.lastIndex; 21785 return result; 21786 } 21787 21788 /** 21789 * Creates a clone of the `symbol` object. 21790 * 21791 * @private 21792 * @param {Object} symbol The symbol object to clone. 21793 * @returns {Object} Returns the cloned symbol object. 21794 */ 21795 function cloneSymbol(symbol) { 21796 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 21797 } 21798 21799 /** 21800 * Creates a clone of `typedArray`. 21801 * 21802 * @private 21803 * @param {Object} typedArray The typed array to clone. 21804 * @param {boolean} [isDeep] Specify a deep clone. 21805 * @returns {Object} Returns the cloned typed array. 21806 */ 21807 function cloneTypedArray(typedArray, isDeep) { 21808 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 21809 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 21810 } 21811 21812 /** 21813 * Compares values to sort them in ascending order. 21814 * 21815 * @private 21816 * @param {*} value The value to compare. 21817 * @param {*} other The other value to compare. 21818 * @returns {number} Returns the sort order indicator for `value`. 21819 */ 21820 function compareAscending(value, other) { 21821 if (value !== other) { 21822 var valIsDefined = value !== undefined, 21823 valIsNull = value === null, 21824 valIsReflexive = value === value, 21825 valIsSymbol = isSymbol(value); 21826 21827 var othIsDefined = other !== undefined, 21828 othIsNull = other === null, 21829 othIsReflexive = other === other, 21830 othIsSymbol = isSymbol(other); 21831 21832 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 21833 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 21834 (valIsNull && othIsDefined && othIsReflexive) || 21835 (!valIsDefined && othIsReflexive) || 21836 !valIsReflexive) { 21837 return 1; 21838 } 21839 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 21840 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 21841 (othIsNull && valIsDefined && valIsReflexive) || 21842 (!othIsDefined && valIsReflexive) || 21843 !othIsReflexive) { 21844 return -1; 21845 } 21846 } 21847 return 0; 21848 } 21849 21850 /** 21851 * Used by `_.orderBy` to compare multiple properties of a value to another 21852 * and stable sort them. 21853 * 21854 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 21855 * specify an order of "desc" for descending or "asc" for ascending sort order 21856 * of corresponding values. 21857 * 21858 * @private 21859 * @param {Object} object The object to compare. 21860 * @param {Object} other The other object to compare. 21861 * @param {boolean[]|string[]} orders The order to sort by for each property. 21862 * @returns {number} Returns the sort order indicator for `object`. 21863 */ 21864 function compareMultiple(object, other, orders) { 21865 var index = -1, 21866 objCriteria = object.criteria, 21867 othCriteria = other.criteria, 21868 length = objCriteria.length, 21869 ordersLength = orders.length; 21870 21871 while (++index < length) { 21872 var result = compareAscending(objCriteria[index], othCriteria[index]); 21873 if (result) { 21874 if (index >= ordersLength) { 21875 return result; 21876 } 21877 var order = orders[index]; 21878 return result * (order == 'desc' ? -1 : 1); 21879 } 21880 } 21881 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 21882 // that causes it, under certain circumstances, to provide the same value for 21883 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 21884 // for more details. 21885 // 21886 // This also ensures a stable sort in V8 and other engines. 21887 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 21888 return object.index - other.index; 21889 } 21890 21891 /** 21892 * Creates an array that is the composition of partially applied arguments, 21893 * placeholders, and provided arguments into a single array of arguments. 21894 * 21895 * @private 21896 * @param {Array} args The provided arguments. 21897 * @param {Array} partials The arguments to prepend to those provided. 21898 * @param {Array} holders The `partials` placeholder indexes. 21899 * @params {boolean} [isCurried] Specify composing for a curried function. 21900 * @returns {Array} Returns the new array of composed arguments. 21901 */ 21902 function composeArgs(args, partials, holders, isCurried) { 21903 var argsIndex = -1, 21904 argsLength = args.length, 21905 holdersLength = holders.length, 21906 leftIndex = -1, 21907 leftLength = partials.length, 21908 rangeLength = nativeMax(argsLength - holdersLength, 0), 21909 result = Array(leftLength + rangeLength), 21910 isUncurried = !isCurried; 21911 21912 while (++leftIndex < leftLength) { 21913 result[leftIndex] = partials[leftIndex]; 21914 } 21915 while (++argsIndex < holdersLength) { 21916 if (isUncurried || argsIndex < argsLength) { 21917 result[holders[argsIndex]] = args[argsIndex]; 21918 } 21919 } 21920 while (rangeLength--) { 21921 result[leftIndex++] = args[argsIndex++]; 21922 } 21923 return result; 21924 } 21925 21926 /** 21927 * This function is like `composeArgs` except that the arguments composition 21928 * is tailored for `_.partialRight`. 21929 * 21930 * @private 21931 * @param {Array} args The provided arguments. 21932 * @param {Array} partials The arguments to append to those provided. 21933 * @param {Array} holders The `partials` placeholder indexes. 21934 * @params {boolean} [isCurried] Specify composing for a curried function. 21935 * @returns {Array} Returns the new array of composed arguments. 21936 */ 21937 function composeArgsRight(args, partials, holders, isCurried) { 21938 var argsIndex = -1, 21939 argsLength = args.length, 21940 holdersIndex = -1, 21941 holdersLength = holders.length, 21942 rightIndex = -1, 21943 rightLength = partials.length, 21944 rangeLength = nativeMax(argsLength - holdersLength, 0), 21945 result = Array(rangeLength + rightLength), 21946 isUncurried = !isCurried; 21947 21948 while (++argsIndex < rangeLength) { 21949 result[argsIndex] = args[argsIndex]; 21950 } 21951 var offset = argsIndex; 21952 while (++rightIndex < rightLength) { 21953 result[offset + rightIndex] = partials[rightIndex]; 21954 } 21955 while (++holdersIndex < holdersLength) { 21956 if (isUncurried || argsIndex < argsLength) { 21957 result[offset + holders[holdersIndex]] = args[argsIndex++]; 21958 } 21959 } 21960 return result; 21961 } 21962 21963 /** 21964 * Copies the values of `source` to `array`. 21965 * 21966 * @private 21967 * @param {Array} source The array to copy values from. 21968 * @param {Array} [array=[]] The array to copy values to. 21969 * @returns {Array} Returns `array`. 21970 */ 21971 function copyArray(source, array) { 21972 var index = -1, 21973 length = source.length; 21974 21975 array || (array = Array(length)); 21976 while (++index < length) { 21977 array[index] = source[index]; 21978 } 21979 return array; 21980 } 21981 21982 /** 21983 * Copies properties of `source` to `object`. 21984 * 21985 * @private 21986 * @param {Object} source The object to copy properties from. 21987 * @param {Array} props The property identifiers to copy. 21988 * @param {Object} [object={}] The object to copy properties to. 21989 * @param {Function} [customizer] The function to customize copied values. 21990 * @returns {Object} Returns `object`. 21991 */ 21992 function copyObject(source, props, object, customizer) { 21993 var isNew = !object; 21994 object || (object = {}); 21995 21996 var index = -1, 21997 length = props.length; 21998 21999 while (++index < length) { 22000 var key = props[index]; 22001 22002 var newValue = customizer 22003 ? customizer(object[key], source[key], key, object, source) 22004 : undefined; 22005 22006 if (newValue === undefined) { 22007 newValue = source[key]; 22008 } 22009 if (isNew) { 22010 baseAssignValue(object, key, newValue); 22011 } else { 22012 assignValue(object, key, newValue); 22013 } 22014 } 22015 return object; 22016 } 22017 22018 /** 22019 * Copies own symbols of `source` to `object`. 22020 * 22021 * @private 22022 * @param {Object} source The object to copy symbols from. 22023 * @param {Object} [object={}] The object to copy symbols to. 22024 * @returns {Object} Returns `object`. 22025 */ 22026 function copySymbols(source, object) { 22027 return copyObject(source, getSymbols(source), object); 22028 } 22029 22030 /** 22031 * Copies own and inherited symbols of `source` to `object`. 22032 * 22033 * @private 22034 * @param {Object} source The object to copy symbols from. 22035 * @param {Object} [object={}] The object to copy symbols to. 22036 * @returns {Object} Returns `object`. 22037 */ 22038 function copySymbolsIn(source, object) { 22039 return copyObject(source, getSymbolsIn(source), object); 22040 } 22041 22042 /** 22043 * Creates a function like `_.groupBy`. 22044 * 22045 * @private 22046 * @param {Function} setter The function to set accumulator values. 22047 * @param {Function} [initializer] The accumulator object initializer. 22048 * @returns {Function} Returns the new aggregator function. 22049 */ 22050 function createAggregator(setter, initializer) { 22051 return function(collection, iteratee) { 22052 var func = isArray(collection) ? arrayAggregator : baseAggregator, 22053 accumulator = initializer ? initializer() : {}; 22054 22055 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 22056 }; 22057 } 22058 22059 /** 22060 * Creates a function like `_.assign`. 22061 * 22062 * @private 22063 * @param {Function} assigner The function to assign values. 22064 * @returns {Function} Returns the new assigner function. 22065 */ 22066 function createAssigner(assigner) { 22067 return baseRest(function(object, sources) { 22068 var index = -1, 22069 length = sources.length, 22070 customizer = length > 1 ? sources[length - 1] : undefined, 22071 guard = length > 2 ? sources[2] : undefined; 22072 22073 customizer = (assigner.length > 3 && typeof customizer == 'function') 22074 ? (length--, customizer) 22075 : undefined; 22076 22077 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 22078 customizer = length < 3 ? undefined : customizer; 22079 length = 1; 22080 } 22081 object = Object(object); 22082 while (++index < length) { 22083 var source = sources[index]; 22084 if (source) { 22085 assigner(object, source, index, customizer); 22086 } 22087 } 22088 return object; 22089 }); 22090 } 22091 22092 /** 22093 * Creates a `baseEach` or `baseEachRight` function. 22094 * 22095 * @private 22096 * @param {Function} eachFunc The function to iterate over a collection. 22097 * @param {boolean} [fromRight] Specify iterating from right to left. 22098 * @returns {Function} Returns the new base function. 22099 */ 22100 function createBaseEach(eachFunc, fromRight) { 22101 return function(collection, iteratee) { 22102 if (collection == null) { 22103 return collection; 22104 } 22105 if (!isArrayLike(collection)) { 22106 return eachFunc(collection, iteratee); 22107 } 22108 var length = collection.length, 22109 index = fromRight ? length : -1, 22110 iterable = Object(collection); 22111 22112 while ((fromRight ? index-- : ++index < length)) { 22113 if (iteratee(iterable[index], index, iterable) === false) { 22114 break; 22115 } 22116 } 22117 return collection; 22118 }; 22119 } 22120 22121 /** 22122 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 22123 * 22124 * @private 22125 * @param {boolean} [fromRight] Specify iterating from right to left. 22126 * @returns {Function} Returns the new base function. 22127 */ 22128 function createBaseFor(fromRight) { 22129 return function(object, iteratee, keysFunc) { 22130 var index = -1, 22131 iterable = Object(object), 22132 props = keysFunc(object), 22133 length = props.length; 22134 22135 while (length--) { 22136 var key = props[fromRight ? length : ++index]; 22137 if (iteratee(iterable[key], key, iterable) === false) { 22138 break; 22139 } 22140 } 22141 return object; 22142 }; 22143 } 22144 22145 /** 22146 * Creates a function that wraps `func` to invoke it with the optional `this` 22147 * binding of `thisArg`. 22148 * 22149 * @private 22150 * @param {Function} func The function to wrap. 22151 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22152 * @param {*} [thisArg] The `this` binding of `func`. 22153 * @returns {Function} Returns the new wrapped function. 22154 */ 22155 function createBind(func, bitmask, thisArg) { 22156 var isBind = bitmask & WRAP_BIND_FLAG, 22157 Ctor = createCtor(func); 22158 22159 function wrapper() { 22160 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 22161 return fn.apply(isBind ? thisArg : this, arguments); 22162 } 22163 return wrapper; 22164 } 22165 22166 /** 22167 * Creates a function like `_.lowerFirst`. 22168 * 22169 * @private 22170 * @param {string} methodName The name of the `String` case method to use. 22171 * @returns {Function} Returns the new case function. 22172 */ 22173 function createCaseFirst(methodName) { 22174 return function(string) { 22175 string = toString(string); 22176 22177 var strSymbols = hasUnicode(string) 22178 ? stringToArray(string) 22179 : undefined; 22180 22181 var chr = strSymbols 22182 ? strSymbols[0] 22183 : string.charAt(0); 22184 22185 var trailing = strSymbols 22186 ? castSlice(strSymbols, 1).join('') 22187 : string.slice(1); 22188 22189 return chr[methodName]() + trailing; 22190 }; 22191 } 22192 22193 /** 22194 * Creates a function like `_.camelCase`. 22195 * 22196 * @private 22197 * @param {Function} callback The function to combine each word. 22198 * @returns {Function} Returns the new compounder function. 22199 */ 22200 function createCompounder(callback) { 22201 return function(string) { 22202 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 22203 }; 22204 } 22205 22206 /** 22207 * Creates a function that produces an instance of `Ctor` regardless of 22208 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 22209 * 22210 * @private 22211 * @param {Function} Ctor The constructor to wrap. 22212 * @returns {Function} Returns the new wrapped function. 22213 */ 22214 function createCtor(Ctor) { 22215 return function() { 22216 // Use a `switch` statement to work with class constructors. See 22217 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 22218 // for more details. 22219 var args = arguments; 22220 switch (args.length) { 22221 case 0: return new Ctor; 22222 case 1: return new Ctor(args[0]); 22223 case 2: return new Ctor(args[0], args[1]); 22224 case 3: return new Ctor(args[0], args[1], args[2]); 22225 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 22226 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 22227 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 22228 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 22229 } 22230 var thisBinding = baseCreate(Ctor.prototype), 22231 result = Ctor.apply(thisBinding, args); 22232 22233 // Mimic the constructor's `return` behavior. 22234 // See https://es5.github.io/#x13.2.2 for more details. 22235 return isObject(result) ? result : thisBinding; 22236 }; 22237 } 22238 22239 /** 22240 * Creates a function that wraps `func` to enable currying. 22241 * 22242 * @private 22243 * @param {Function} func The function to wrap. 22244 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22245 * @param {number} arity The arity of `func`. 22246 * @returns {Function} Returns the new wrapped function. 22247 */ 22248 function createCurry(func, bitmask, arity) { 22249 var Ctor = createCtor(func); 22250 22251 function wrapper() { 22252 var length = arguments.length, 22253 args = Array(length), 22254 index = length, 22255 placeholder = getHolder(wrapper); 22256 22257 while (index--) { 22258 args[index] = arguments[index]; 22259 } 22260 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 22261 ? [] 22262 : replaceHolders(args, placeholder); 22263 22264 length -= holders.length; 22265 if (length < arity) { 22266 return createRecurry( 22267 func, bitmask, createHybrid, wrapper.placeholder, undefined, 22268 args, holders, undefined, undefined, arity - length); 22269 } 22270 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 22271 return apply(fn, this, args); 22272 } 22273 return wrapper; 22274 } 22275 22276 /** 22277 * Creates a `_.find` or `_.findLast` function. 22278 * 22279 * @private 22280 * @param {Function} findIndexFunc The function to find the collection index. 22281 * @returns {Function} Returns the new find function. 22282 */ 22283 function createFind(findIndexFunc) { 22284 return function(collection, predicate, fromIndex) { 22285 var iterable = Object(collection); 22286 if (!isArrayLike(collection)) { 22287 var iteratee = getIteratee(predicate, 3); 22288 collection = keys(collection); 22289 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 22290 } 22291 var index = findIndexFunc(collection, predicate, fromIndex); 22292 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 22293 }; 22294 } 22295 22296 /** 22297 * Creates a `_.flow` or `_.flowRight` function. 22298 * 22299 * @private 22300 * @param {boolean} [fromRight] Specify iterating from right to left. 22301 * @returns {Function} Returns the new flow function. 22302 */ 22303 function createFlow(fromRight) { 22304 return flatRest(function(funcs) { 22305 var length = funcs.length, 22306 index = length, 22307 prereq = LodashWrapper.prototype.thru; 22308 22309 if (fromRight) { 22310 funcs.reverse(); 22311 } 22312 while (index--) { 22313 var func = funcs[index]; 22314 if (typeof func != 'function') { 22315 throw new TypeError(FUNC_ERROR_TEXT); 22316 } 22317 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 22318 var wrapper = new LodashWrapper([], true); 22319 } 22320 } 22321 index = wrapper ? index : length; 22322 while (++index < length) { 22323 func = funcs[index]; 22324 22325 var funcName = getFuncName(func), 22326 data = funcName == 'wrapper' ? getData(func) : undefined; 22327 22328 if (data && isLaziable(data[0]) && 22329 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 22330 !data[4].length && data[9] == 1 22331 ) { 22332 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 22333 } else { 22334 wrapper = (func.length == 1 && isLaziable(func)) 22335 ? wrapper[funcName]() 22336 : wrapper.thru(func); 22337 } 22338 } 22339 return function() { 22340 var args = arguments, 22341 value = args[0]; 22342 22343 if (wrapper && args.length == 1 && isArray(value)) { 22344 return wrapper.plant(value).value(); 22345 } 22346 var index = 0, 22347 result = length ? funcs[index].apply(this, args) : value; 22348 22349 while (++index < length) { 22350 result = funcs[index].call(this, result); 22351 } 22352 return result; 22353 }; 22354 }); 22355 } 22356 22357 /** 22358 * Creates a function that wraps `func` to invoke it with optional `this` 22359 * binding of `thisArg`, partial application, and currying. 22360 * 22361 * @private 22362 * @param {Function|string} func The function or method name to wrap. 22363 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22364 * @param {*} [thisArg] The `this` binding of `func`. 22365 * @param {Array} [partials] The arguments to prepend to those provided to 22366 * the new function. 22367 * @param {Array} [holders] The `partials` placeholder indexes. 22368 * @param {Array} [partialsRight] The arguments to append to those provided 22369 * to the new function. 22370 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 22371 * @param {Array} [argPos] The argument positions of the new function. 22372 * @param {number} [ary] The arity cap of `func`. 22373 * @param {number} [arity] The arity of `func`. 22374 * @returns {Function} Returns the new wrapped function. 22375 */ 22376 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 22377 var isAry = bitmask & WRAP_ARY_FLAG, 22378 isBind = bitmask & WRAP_BIND_FLAG, 22379 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 22380 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 22381 isFlip = bitmask & WRAP_FLIP_FLAG, 22382 Ctor = isBindKey ? undefined : createCtor(func); 22383 22384 function wrapper() { 22385 var length = arguments.length, 22386 args = Array(length), 22387 index = length; 22388 22389 while (index--) { 22390 args[index] = arguments[index]; 22391 } 22392 if (isCurried) { 22393 var placeholder = getHolder(wrapper), 22394 holdersCount = countHolders(args, placeholder); 22395 } 22396 if (partials) { 22397 args = composeArgs(args, partials, holders, isCurried); 22398 } 22399 if (partialsRight) { 22400 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 22401 } 22402 length -= holdersCount; 22403 if (isCurried && length < arity) { 22404 var newHolders = replaceHolders(args, placeholder); 22405 return createRecurry( 22406 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 22407 args, newHolders, argPos, ary, arity - length 22408 ); 22409 } 22410 var thisBinding = isBind ? thisArg : this, 22411 fn = isBindKey ? thisBinding[func] : func; 22412 22413 length = args.length; 22414 if (argPos) { 22415 args = reorder(args, argPos); 22416 } else if (isFlip && length > 1) { 22417 args.reverse(); 22418 } 22419 if (isAry && ary < length) { 22420 args.length = ary; 22421 } 22422 if (this && this !== root && this instanceof wrapper) { 22423 fn = Ctor || createCtor(fn); 22424 } 22425 return fn.apply(thisBinding, args); 22426 } 22427 return wrapper; 22428 } 22429 22430 /** 22431 * Creates a function like `_.invertBy`. 22432 * 22433 * @private 22434 * @param {Function} setter The function to set accumulator values. 22435 * @param {Function} toIteratee The function to resolve iteratees. 22436 * @returns {Function} Returns the new inverter function. 22437 */ 22438 function createInverter(setter, toIteratee) { 22439 return function(object, iteratee) { 22440 return baseInverter(object, setter, toIteratee(iteratee), {}); 22441 }; 22442 } 22443 22444 /** 22445 * Creates a function that performs a mathematical operation on two values. 22446 * 22447 * @private 22448 * @param {Function} operator The function to perform the operation. 22449 * @param {number} [defaultValue] The value used for `undefined` arguments. 22450 * @returns {Function} Returns the new mathematical operation function. 22451 */ 22452 function createMathOperation(operator, defaultValue) { 22453 return function(value, other) { 22454 var result; 22455 if (value === undefined && other === undefined) { 22456 return defaultValue; 22457 } 22458 if (value !== undefined) { 22459 result = value; 22460 } 22461 if (other !== undefined) { 22462 if (result === undefined) { 22463 return other; 22464 } 22465 if (typeof value == 'string' || typeof other == 'string') { 22466 value = baseToString(value); 22467 other = baseToString(other); 22468 } else { 22469 value = baseToNumber(value); 22470 other = baseToNumber(other); 22471 } 22472 result = operator(value, other); 22473 } 22474 return result; 22475 }; 22476 } 22477 22478 /** 22479 * Creates a function like `_.over`. 22480 * 22481 * @private 22482 * @param {Function} arrayFunc The function to iterate over iteratees. 22483 * @returns {Function} Returns the new over function. 22484 */ 22485 function createOver(arrayFunc) { 22486 return flatRest(function(iteratees) { 22487 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 22488 return baseRest(function(args) { 22489 var thisArg = this; 22490 return arrayFunc(iteratees, function(iteratee) { 22491 return apply(iteratee, thisArg, args); 22492 }); 22493 }); 22494 }); 22495 } 22496 22497 /** 22498 * Creates the padding for `string` based on `length`. The `chars` string 22499 * is truncated if the number of characters exceeds `length`. 22500 * 22501 * @private 22502 * @param {number} length The padding length. 22503 * @param {string} [chars=' '] The string used as padding. 22504 * @returns {string} Returns the padding for `string`. 22505 */ 22506 function createPadding(length, chars) { 22507 chars = chars === undefined ? ' ' : baseToString(chars); 22508 22509 var charsLength = chars.length; 22510 if (charsLength < 2) { 22511 return charsLength ? baseRepeat(chars, length) : chars; 22512 } 22513 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 22514 return hasUnicode(chars) 22515 ? castSlice(stringToArray(result), 0, length).join('') 22516 : result.slice(0, length); 22517 } 22518 22519 /** 22520 * Creates a function that wraps `func` to invoke it with the `this` binding 22521 * of `thisArg` and `partials` prepended to the arguments it receives. 22522 * 22523 * @private 22524 * @param {Function} func The function to wrap. 22525 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22526 * @param {*} thisArg The `this` binding of `func`. 22527 * @param {Array} partials The arguments to prepend to those provided to 22528 * the new function. 22529 * @returns {Function} Returns the new wrapped function. 22530 */ 22531 function createPartial(func, bitmask, thisArg, partials) { 22532 var isBind = bitmask & WRAP_BIND_FLAG, 22533 Ctor = createCtor(func); 22534 22535 function wrapper() { 22536 var argsIndex = -1, 22537 argsLength = arguments.length, 22538 leftIndex = -1, 22539 leftLength = partials.length, 22540 args = Array(leftLength + argsLength), 22541 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 22542 22543 while (++leftIndex < leftLength) { 22544 args[leftIndex] = partials[leftIndex]; 22545 } 22546 while (argsLength--) { 22547 args[leftIndex++] = arguments[++argsIndex]; 22548 } 22549 return apply(fn, isBind ? thisArg : this, args); 22550 } 22551 return wrapper; 22552 } 22553 22554 /** 22555 * Creates a `_.range` or `_.rangeRight` function. 22556 * 22557 * @private 22558 * @param {boolean} [fromRight] Specify iterating from right to left. 22559 * @returns {Function} Returns the new range function. 22560 */ 22561 function createRange(fromRight) { 22562 return function(start, end, step) { 22563 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 22564 end = step = undefined; 22565 } 22566 // Ensure the sign of `-0` is preserved. 22567 start = toFinite(start); 22568 if (end === undefined) { 22569 end = start; 22570 start = 0; 22571 } else { 22572 end = toFinite(end); 22573 } 22574 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 22575 return baseRange(start, end, step, fromRight); 22576 }; 22577 } 22578 22579 /** 22580 * Creates a function that performs a relational operation on two values. 22581 * 22582 * @private 22583 * @param {Function} operator The function to perform the operation. 22584 * @returns {Function} Returns the new relational operation function. 22585 */ 22586 function createRelationalOperation(operator) { 22587 return function(value, other) { 22588 if (!(typeof value == 'string' && typeof other == 'string')) { 22589 value = toNumber(value); 22590 other = toNumber(other); 22591 } 22592 return operator(value, other); 22593 }; 22594 } 22595 22596 /** 22597 * Creates a function that wraps `func` to continue currying. 22598 * 22599 * @private 22600 * @param {Function} func The function to wrap. 22601 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22602 * @param {Function} wrapFunc The function to create the `func` wrapper. 22603 * @param {*} placeholder The placeholder value. 22604 * @param {*} [thisArg] The `this` binding of `func`. 22605 * @param {Array} [partials] The arguments to prepend to those provided to 22606 * the new function. 22607 * @param {Array} [holders] The `partials` placeholder indexes. 22608 * @param {Array} [argPos] The argument positions of the new function. 22609 * @param {number} [ary] The arity cap of `func`. 22610 * @param {number} [arity] The arity of `func`. 22611 * @returns {Function} Returns the new wrapped function. 22612 */ 22613 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 22614 var isCurry = bitmask & WRAP_CURRY_FLAG, 22615 newHolders = isCurry ? holders : undefined, 22616 newHoldersRight = isCurry ? undefined : holders, 22617 newPartials = isCurry ? partials : undefined, 22618 newPartialsRight = isCurry ? undefined : partials; 22619 22620 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 22621 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 22622 22623 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 22624 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 22625 } 22626 var newData = [ 22627 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 22628 newHoldersRight, argPos, ary, arity 22629 ]; 22630 22631 var result = wrapFunc.apply(undefined, newData); 22632 if (isLaziable(func)) { 22633 setData(result, newData); 22634 } 22635 result.placeholder = placeholder; 22636 return setWrapToString(result, func, bitmask); 22637 } 22638 22639 /** 22640 * Creates a function like `_.round`. 22641 * 22642 * @private 22643 * @param {string} methodName The name of the `Math` method to use when rounding. 22644 * @returns {Function} Returns the new round function. 22645 */ 22646 function createRound(methodName) { 22647 var func = Math[methodName]; 22648 return function(number, precision) { 22649 number = toNumber(number); 22650 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 22651 if (precision && nativeIsFinite(number)) { 22652 // Shift with exponential notation to avoid floating-point issues. 22653 // See [MDN](https://mdn.io/round#Examples) for more details. 22654 var pair = (toString(number) + 'e').split('e'), 22655 value = func(pair[0] + 'e' + (+pair[1] + precision)); 22656 22657 pair = (toString(value) + 'e').split('e'); 22658 return +(pair[0] + 'e' + (+pair[1] - precision)); 22659 } 22660 return func(number); 22661 }; 22662 } 22663 22664 /** 22665 * Creates a set object of `values`. 22666 * 22667 * @private 22668 * @param {Array} values The values to add to the set. 22669 * @returns {Object} Returns the new set. 22670 */ 22671 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 22672 return new Set(values); 22673 }; 22674 22675 /** 22676 * Creates a `_.toPairs` or `_.toPairsIn` function. 22677 * 22678 * @private 22679 * @param {Function} keysFunc The function to get the keys of a given object. 22680 * @returns {Function} Returns the new pairs function. 22681 */ 22682 function createToPairs(keysFunc) { 22683 return function(object) { 22684 var tag = getTag(object); 22685 if (tag == mapTag) { 22686 return mapToArray(object); 22687 } 22688 if (tag == setTag) { 22689 return setToPairs(object); 22690 } 22691 return baseToPairs(object, keysFunc(object)); 22692 }; 22693 } 22694 22695 /** 22696 * Creates a function that either curries or invokes `func` with optional 22697 * `this` binding and partially applied arguments. 22698 * 22699 * @private 22700 * @param {Function|string} func The function or method name to wrap. 22701 * @param {number} bitmask The bitmask flags. 22702 * 1 - `_.bind` 22703 * 2 - `_.bindKey` 22704 * 4 - `_.curry` or `_.curryRight` of a bound function 22705 * 8 - `_.curry` 22706 * 16 - `_.curryRight` 22707 * 32 - `_.partial` 22708 * 64 - `_.partialRight` 22709 * 128 - `_.rearg` 22710 * 256 - `_.ary` 22711 * 512 - `_.flip` 22712 * @param {*} [thisArg] The `this` binding of `func`. 22713 * @param {Array} [partials] The arguments to be partially applied. 22714 * @param {Array} [holders] The `partials` placeholder indexes. 22715 * @param {Array} [argPos] The argument positions of the new function. 22716 * @param {number} [ary] The arity cap of `func`. 22717 * @param {number} [arity] The arity of `func`. 22718 * @returns {Function} Returns the new wrapped function. 22719 */ 22720 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 22721 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 22722 if (!isBindKey && typeof func != 'function') { 22723 throw new TypeError(FUNC_ERROR_TEXT); 22724 } 22725 var length = partials ? partials.length : 0; 22726 if (!length) { 22727 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 22728 partials = holders = undefined; 22729 } 22730 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 22731 arity = arity === undefined ? arity : toInteger(arity); 22732 length -= holders ? holders.length : 0; 22733 22734 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 22735 var partialsRight = partials, 22736 holdersRight = holders; 22737 22738 partials = holders = undefined; 22739 } 22740 var data = isBindKey ? undefined : getData(func); 22741 22742 var newData = [ 22743 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 22744 argPos, ary, arity 22745 ]; 22746 22747 if (data) { 22748 mergeData(newData, data); 22749 } 22750 func = newData[0]; 22751 bitmask = newData[1]; 22752 thisArg = newData[2]; 22753 partials = newData[3]; 22754 holders = newData[4]; 22755 arity = newData[9] = newData[9] === undefined 22756 ? (isBindKey ? 0 : func.length) 22757 : nativeMax(newData[9] - length, 0); 22758 22759 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 22760 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 22761 } 22762 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 22763 var result = createBind(func, bitmask, thisArg); 22764 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 22765 result = createCurry(func, bitmask, arity); 22766 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 22767 result = createPartial(func, bitmask, thisArg, partials); 22768 } else { 22769 result = createHybrid.apply(undefined, newData); 22770 } 22771 var setter = data ? baseSetData : setData; 22772 return setWrapToString(setter(result, newData), func, bitmask); 22773 } 22774 22775 /** 22776 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 22777 * of source objects to the destination object for all destination properties 22778 * that resolve to `undefined`. 22779 * 22780 * @private 22781 * @param {*} objValue The destination value. 22782 * @param {*} srcValue The source value. 22783 * @param {string} key The key of the property to assign. 22784 * @param {Object} object The parent object of `objValue`. 22785 * @returns {*} Returns the value to assign. 22786 */ 22787 function customDefaultsAssignIn(objValue, srcValue, key, object) { 22788 if (objValue === undefined || 22789 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 22790 return srcValue; 22791 } 22792 return objValue; 22793 } 22794 22795 /** 22796 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 22797 * objects into destination objects that are passed thru. 22798 * 22799 * @private 22800 * @param {*} objValue The destination value. 22801 * @param {*} srcValue The source value. 22802 * @param {string} key The key of the property to merge. 22803 * @param {Object} object The parent object of `objValue`. 22804 * @param {Object} source The parent object of `srcValue`. 22805 * @param {Object} [stack] Tracks traversed source values and their merged 22806 * counterparts. 22807 * @returns {*} Returns the value to assign. 22808 */ 22809 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 22810 if (isObject(objValue) && isObject(srcValue)) { 22811 // Recursively merge objects and arrays (susceptible to call stack limits). 22812 stack.set(srcValue, objValue); 22813 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 22814 stack['delete'](srcValue); 22815 } 22816 return objValue; 22817 } 22818 22819 /** 22820 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 22821 * objects. 22822 * 22823 * @private 22824 * @param {*} value The value to inspect. 22825 * @param {string} key The key of the property to inspect. 22826 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 22827 */ 22828 function customOmitClone(value) { 22829 return isPlainObject(value) ? undefined : value; 22830 } 22831 22832 /** 22833 * A specialized version of `baseIsEqualDeep` for arrays with support for 22834 * partial deep comparisons. 22835 * 22836 * @private 22837 * @param {Array} array The array to compare. 22838 * @param {Array} other The other array to compare. 22839 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22840 * @param {Function} customizer The function to customize comparisons. 22841 * @param {Function} equalFunc The function to determine equivalents of values. 22842 * @param {Object} stack Tracks traversed `array` and `other` objects. 22843 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 22844 */ 22845 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 22846 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 22847 arrLength = array.length, 22848 othLength = other.length; 22849 22850 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 22851 return false; 22852 } 22853 // Check that cyclic values are equal. 22854 var arrStacked = stack.get(array); 22855 var othStacked = stack.get(other); 22856 if (arrStacked && othStacked) { 22857 return arrStacked == other && othStacked == array; 22858 } 22859 var index = -1, 22860 result = true, 22861 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 22862 22863 stack.set(array, other); 22864 stack.set(other, array); 22865 22866 // Ignore non-index properties. 22867 while (++index < arrLength) { 22868 var arrValue = array[index], 22869 othValue = other[index]; 22870 22871 if (customizer) { 22872 var compared = isPartial 22873 ? customizer(othValue, arrValue, index, other, array, stack) 22874 : customizer(arrValue, othValue, index, array, other, stack); 22875 } 22876 if (compared !== undefined) { 22877 if (compared) { 22878 continue; 22879 } 22880 result = false; 22881 break; 22882 } 22883 // Recursively compare arrays (susceptible to call stack limits). 22884 if (seen) { 22885 if (!arraySome(other, function(othValue, othIndex) { 22886 if (!cacheHas(seen, othIndex) && 22887 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 22888 return seen.push(othIndex); 22889 } 22890 })) { 22891 result = false; 22892 break; 22893 } 22894 } else if (!( 22895 arrValue === othValue || 22896 equalFunc(arrValue, othValue, bitmask, customizer, stack) 22897 )) { 22898 result = false; 22899 break; 22900 } 22901 } 22902 stack['delete'](array); 22903 stack['delete'](other); 22904 return result; 22905 } 22906 22907 /** 22908 * A specialized version of `baseIsEqualDeep` for comparing objects of 22909 * the same `toStringTag`. 22910 * 22911 * **Note:** This function only supports comparing values with tags of 22912 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 22913 * 22914 * @private 22915 * @param {Object} object The object to compare. 22916 * @param {Object} other The other object to compare. 22917 * @param {string} tag The `toStringTag` of the objects to compare. 22918 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22919 * @param {Function} customizer The function to customize comparisons. 22920 * @param {Function} equalFunc The function to determine equivalents of values. 22921 * @param {Object} stack Tracks traversed `object` and `other` objects. 22922 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 22923 */ 22924 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 22925 switch (tag) { 22926 case dataViewTag: 22927 if ((object.byteLength != other.byteLength) || 22928 (object.byteOffset != other.byteOffset)) { 22929 return false; 22930 } 22931 object = object.buffer; 22932 other = other.buffer; 22933 22934 case arrayBufferTag: 22935 if ((object.byteLength != other.byteLength) || 22936 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 22937 return false; 22938 } 22939 return true; 22940 22941 case boolTag: 22942 case dateTag: 22943 case numberTag: 22944 // Coerce booleans to `1` or `0` and dates to milliseconds. 22945 // Invalid dates are coerced to `NaN`. 22946 return eq(+object, +other); 22947 22948 case errorTag: 22949 return object.name == other.name && object.message == other.message; 22950 22951 case regexpTag: 22952 case stringTag: 22953 // Coerce regexes to strings and treat strings, primitives and objects, 22954 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 22955 // for more details. 22956 return object == (other + ''); 22957 22958 case mapTag: 22959 var convert = mapToArray; 22960 22961 case setTag: 22962 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 22963 convert || (convert = setToArray); 22964 22965 if (object.size != other.size && !isPartial) { 22966 return false; 22967 } 22968 // Assume cyclic values are equal. 22969 var stacked = stack.get(object); 22970 if (stacked) { 22971 return stacked == other; 22972 } 22973 bitmask |= COMPARE_UNORDERED_FLAG; 22974 22975 // Recursively compare objects (susceptible to call stack limits). 22976 stack.set(object, other); 22977 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 22978 stack['delete'](object); 22979 return result; 22980 22981 case symbolTag: 22982 if (symbolValueOf) { 22983 return symbolValueOf.call(object) == symbolValueOf.call(other); 22984 } 22985 } 22986 return false; 22987 } 22988 22989 /** 22990 * A specialized version of `baseIsEqualDeep` for objects with support for 22991 * partial deep comparisons. 22992 * 22993 * @private 22994 * @param {Object} object The object to compare. 22995 * @param {Object} other The other object to compare. 22996 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22997 * @param {Function} customizer The function to customize comparisons. 22998 * @param {Function} equalFunc The function to determine equivalents of values. 22999 * @param {Object} stack Tracks traversed `object` and `other` objects. 23000 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 23001 */ 23002 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 23003 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 23004 objProps = getAllKeys(object), 23005 objLength = objProps.length, 23006 othProps = getAllKeys(other), 23007 othLength = othProps.length; 23008 23009 if (objLength != othLength && !isPartial) { 23010 return false; 23011 } 23012 var index = objLength; 23013 while (index--) { 23014 var key = objProps[index]; 23015 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 23016 return false; 23017 } 23018 } 23019 // Check that cyclic values are equal. 23020 var objStacked = stack.get(object); 23021 var othStacked = stack.get(other); 23022 if (objStacked && othStacked) { 23023 return objStacked == other && othStacked == object; 23024 } 23025 var result = true; 23026 stack.set(object, other); 23027 stack.set(other, object); 23028 23029 var skipCtor = isPartial; 23030 while (++index < objLength) { 23031 key = objProps[index]; 23032 var objValue = object[key], 23033 othValue = other[key]; 23034 23035 if (customizer) { 23036 var compared = isPartial 23037 ? customizer(othValue, objValue, key, other, object, stack) 23038 : customizer(objValue, othValue, key, object, other, stack); 23039 } 23040 // Recursively compare objects (susceptible to call stack limits). 23041 if (!(compared === undefined 23042 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 23043 : compared 23044 )) { 23045 result = false; 23046 break; 23047 } 23048 skipCtor || (skipCtor = key == 'constructor'); 23049 } 23050 if (result && !skipCtor) { 23051 var objCtor = object.constructor, 23052 othCtor = other.constructor; 23053 23054 // Non `Object` object instances with different constructors are not equal. 23055 if (objCtor != othCtor && 23056 ('constructor' in object && 'constructor' in other) && 23057 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 23058 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 23059 result = false; 23060 } 23061 } 23062 stack['delete'](object); 23063 stack['delete'](other); 23064 return result; 23065 } 23066 23067 /** 23068 * A specialized version of `baseRest` which flattens the rest array. 23069 * 23070 * @private 23071 * @param {Function} func The function to apply a rest parameter to. 23072 * @returns {Function} Returns the new function. 23073 */ 23074 function flatRest(func) { 23075 return setToString(overRest(func, undefined, flatten), func + ''); 23076 } 23077 23078 /** 23079 * Creates an array of own enumerable property names and symbols of `object`. 23080 * 23081 * @private 23082 * @param {Object} object The object to query. 23083 * @returns {Array} Returns the array of property names and symbols. 23084 */ 23085 function getAllKeys(object) { 23086 return baseGetAllKeys(object, keys, getSymbols); 23087 } 23088 23089 /** 23090 * Creates an array of own and inherited enumerable property names and 23091 * symbols of `object`. 23092 * 23093 * @private 23094 * @param {Object} object The object to query. 23095 * @returns {Array} Returns the array of property names and symbols. 23096 */ 23097 function getAllKeysIn(object) { 23098 return baseGetAllKeys(object, keysIn, getSymbolsIn); 23099 } 23100 23101 /** 23102 * Gets metadata for `func`. 23103 * 23104 * @private 23105 * @param {Function} func The function to query. 23106 * @returns {*} Returns the metadata for `func`. 23107 */ 23108 var getData = !metaMap ? noop : function(func) { 23109 return metaMap.get(func); 23110 }; 23111 23112 /** 23113 * Gets the name of `func`. 23114 * 23115 * @private 23116 * @param {Function} func The function to query. 23117 * @returns {string} Returns the function name. 23118 */ 23119 function getFuncName(func) { 23120 var result = (func.name + ''), 23121 array = realNames[result], 23122 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 23123 23124 while (length--) { 23125 var data = array[length], 23126 otherFunc = data.func; 23127 if (otherFunc == null || otherFunc == func) { 23128 return data.name; 23129 } 23130 } 23131 return result; 23132 } 23133 23134 /** 23135 * Gets the argument placeholder value for `func`. 23136 * 23137 * @private 23138 * @param {Function} func The function to inspect. 23139 * @returns {*} Returns the placeholder value. 23140 */ 23141 function getHolder(func) { 23142 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 23143 return object.placeholder; 23144 } 23145 23146 /** 23147 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 23148 * this function returns the custom method, otherwise it returns `baseIteratee`. 23149 * If arguments are provided, the chosen function is invoked with them and 23150 * its result is returned. 23151 * 23152 * @private 23153 * @param {*} [value] The value to convert to an iteratee. 23154 * @param {number} [arity] The arity of the created iteratee. 23155 * @returns {Function} Returns the chosen function or its result. 23156 */ 23157 function getIteratee() { 23158 var result = lodash.iteratee || iteratee; 23159 result = result === iteratee ? baseIteratee : result; 23160 return arguments.length ? result(arguments[0], arguments[1]) : result; 23161 } 23162 23163 /** 23164 * Gets the data for `map`. 23165 * 23166 * @private 23167 * @param {Object} map The map to query. 23168 * @param {string} key The reference key. 23169 * @returns {*} Returns the map data. 23170 */ 23171 function getMapData(map, key) { 23172 var data = map.__data__; 23173 return isKeyable(key) 23174 ? data[typeof key == 'string' ? 'string' : 'hash'] 23175 : data.map; 23176 } 23177 23178 /** 23179 * Gets the property names, values, and compare flags of `object`. 23180 * 23181 * @private 23182 * @param {Object} object The object to query. 23183 * @returns {Array} Returns the match data of `object`. 23184 */ 23185 function getMatchData(object) { 23186 var result = keys(object), 23187 length = result.length; 23188 23189 while (length--) { 23190 var key = result[length], 23191 value = object[key]; 23192 23193 result[length] = [key, value, isStrictComparable(value)]; 23194 } 23195 return result; 23196 } 23197 23198 /** 23199 * Gets the native function at `key` of `object`. 23200 * 23201 * @private 23202 * @param {Object} object The object to query. 23203 * @param {string} key The key of the method to get. 23204 * @returns {*} Returns the function if it's native, else `undefined`. 23205 */ 23206 function getNative(object, key) { 23207 var value = getValue(object, key); 23208 return baseIsNative(value) ? value : undefined; 23209 } 23210 23211 /** 23212 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 23213 * 23214 * @private 23215 * @param {*} value The value to query. 23216 * @returns {string} Returns the raw `toStringTag`. 23217 */ 23218 function getRawTag(value) { 23219 var isOwn = hasOwnProperty.call(value, symToStringTag), 23220 tag = value[symToStringTag]; 23221 23222 try { 23223 value[symToStringTag] = undefined; 23224 var unmasked = true; 23225 } catch (e) {} 23226 23227 var result = nativeObjectToString.call(value); 23228 if (unmasked) { 23229 if (isOwn) { 23230 value[symToStringTag] = tag; 23231 } else { 23232 delete value[symToStringTag]; 23233 } 23234 } 23235 return result; 23236 } 23237 23238 /** 23239 * Creates an array of the own enumerable symbols of `object`. 23240 * 23241 * @private 23242 * @param {Object} object The object to query. 23243 * @returns {Array} Returns the array of symbols. 23244 */ 23245 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 23246 if (object == null) { 23247 return []; 23248 } 23249 object = Object(object); 23250 return arrayFilter(nativeGetSymbols(object), function(symbol) { 23251 return propertyIsEnumerable.call(object, symbol); 23252 }); 23253 }; 23254 23255 /** 23256 * Creates an array of the own and inherited enumerable symbols of `object`. 23257 * 23258 * @private 23259 * @param {Object} object The object to query. 23260 * @returns {Array} Returns the array of symbols. 23261 */ 23262 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 23263 var result = []; 23264 while (object) { 23265 arrayPush(result, getSymbols(object)); 23266 object = getPrototype(object); 23267 } 23268 return result; 23269 }; 23270 23271 /** 23272 * Gets the `toStringTag` of `value`. 23273 * 23274 * @private 23275 * @param {*} value The value to query. 23276 * @returns {string} Returns the `toStringTag`. 23277 */ 23278 var getTag = baseGetTag; 23279 23280 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 23281 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 23282 (Map && getTag(new Map) != mapTag) || 23283 (Promise && getTag(Promise.resolve()) != promiseTag) || 23284 (Set && getTag(new Set) != setTag) || 23285 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 23286 getTag = function(value) { 23287 var result = baseGetTag(value), 23288 Ctor = result == objectTag ? value.constructor : undefined, 23289 ctorString = Ctor ? toSource(Ctor) : ''; 23290 23291 if (ctorString) { 23292 switch (ctorString) { 23293 case dataViewCtorString: return dataViewTag; 23294 case mapCtorString: return mapTag; 23295 case promiseCtorString: return promiseTag; 23296 case setCtorString: return setTag; 23297 case weakMapCtorString: return weakMapTag; 23298 } 23299 } 23300 return result; 23301 }; 23302 } 23303 23304 /** 23305 * Gets the view, applying any `transforms` to the `start` and `end` positions. 23306 * 23307 * @private 23308 * @param {number} start The start of the view. 23309 * @param {number} end The end of the view. 23310 * @param {Array} transforms The transformations to apply to the view. 23311 * @returns {Object} Returns an object containing the `start` and `end` 23312 * positions of the view. 23313 */ 23314 function getView(start, end, transforms) { 23315 var index = -1, 23316 length = transforms.length; 23317 23318 while (++index < length) { 23319 var data = transforms[index], 23320 size = data.size; 23321 23322 switch (data.type) { 23323 case 'drop': start += size; break; 23324 case 'dropRight': end -= size; break; 23325 case 'take': end = nativeMin(end, start + size); break; 23326 case 'takeRight': start = nativeMax(start, end - size); break; 23327 } 23328 } 23329 return { 'start': start, 'end': end }; 23330 } 23331 23332 /** 23333 * Extracts wrapper details from the `source` body comment. 23334 * 23335 * @private 23336 * @param {string} source The source to inspect. 23337 * @returns {Array} Returns the wrapper details. 23338 */ 23339 function getWrapDetails(source) { 23340 var match = source.match(reWrapDetails); 23341 return match ? match[1].split(reSplitDetails) : []; 23342 } 23343 23344 /** 23345 * Checks if `path` exists on `object`. 23346 * 23347 * @private 23348 * @param {Object} object The object to query. 23349 * @param {Array|string} path The path to check. 23350 * @param {Function} hasFunc The function to check properties. 23351 * @returns {boolean} Returns `true` if `path` exists, else `false`. 23352 */ 23353 function hasPath(object, path, hasFunc) { 23354 path = castPath(path, object); 23355 23356 var index = -1, 23357 length = path.length, 23358 result = false; 23359 23360 while (++index < length) { 23361 var key = toKey(path[index]); 23362 if (!(result = object != null && hasFunc(object, key))) { 23363 break; 23364 } 23365 object = object[key]; 23366 } 23367 if (result || ++index != length) { 23368 return result; 23369 } 23370 length = object == null ? 0 : object.length; 23371 return !!length && isLength(length) && isIndex(key, length) && 23372 (isArray(object) || isArguments(object)); 23373 } 23374 23375 /** 23376 * Initializes an array clone. 23377 * 23378 * @private 23379 * @param {Array} array The array to clone. 23380 * @returns {Array} Returns the initialized clone. 23381 */ 23382 function initCloneArray(array) { 23383 var length = array.length, 23384 result = new array.constructor(length); 23385 23386 // Add properties assigned by `RegExp#exec`. 23387 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 23388 result.index = array.index; 23389 result.input = array.input; 23390 } 23391 return result; 23392 } 23393 23394 /** 23395 * Initializes an object clone. 23396 * 23397 * @private 23398 * @param {Object} object The object to clone. 23399 * @returns {Object} Returns the initialized clone. 23400 */ 23401 function initCloneObject(object) { 23402 return (typeof object.constructor == 'function' && !isPrototype(object)) 23403 ? baseCreate(getPrototype(object)) 23404 : {}; 23405 } 23406 23407 /** 23408 * Initializes an object clone based on its `toStringTag`. 23409 * 23410 * **Note:** This function only supports cloning values with tags of 23411 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. 23412 * 23413 * @private 23414 * @param {Object} object The object to clone. 23415 * @param {string} tag The `toStringTag` of the object to clone. 23416 * @param {boolean} [isDeep] Specify a deep clone. 23417 * @returns {Object} Returns the initialized clone. 23418 */ 23419 function initCloneByTag(object, tag, isDeep) { 23420 var Ctor = object.constructor; 23421 switch (tag) { 23422 case arrayBufferTag: 23423 return cloneArrayBuffer(object); 23424 23425 case boolTag: 23426 case dateTag: 23427 return new Ctor(+object); 23428 23429 case dataViewTag: 23430 return cloneDataView(object, isDeep); 23431 23432 case float32Tag: case float64Tag: 23433 case int8Tag: case int16Tag: case int32Tag: 23434 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 23435 return cloneTypedArray(object, isDeep); 23436 23437 case mapTag: 23438 return new Ctor; 23439 23440 case numberTag: 23441 case stringTag: 23442 return new Ctor(object); 23443 23444 case regexpTag: 23445 return cloneRegExp(object); 23446 23447 case setTag: 23448 return new Ctor; 23449 23450 case symbolTag: 23451 return cloneSymbol(object); 23452 } 23453 } 23454 23455 /** 23456 * Inserts wrapper `details` in a comment at the top of the `source` body. 23457 * 23458 * @private 23459 * @param {string} source The source to modify. 23460 * @returns {Array} details The details to insert. 23461 * @returns {string} Returns the modified source. 23462 */ 23463 function insertWrapDetails(source, details) { 23464 var length = details.length; 23465 if (!length) { 23466 return source; 23467 } 23468 var lastIndex = length - 1; 23469 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 23470 details = details.join(length > 2 ? ', ' : ' '); 23471 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 23472 } 23473 23474 /** 23475 * Checks if `value` is a flattenable `arguments` object or array. 23476 * 23477 * @private 23478 * @param {*} value The value to check. 23479 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 23480 */ 23481 function isFlattenable(value) { 23482 return isArray(value) || isArguments(value) || 23483 !!(spreadableSymbol && value && value[spreadableSymbol]); 23484 } 23485 23486 /** 23487 * Checks if `value` is a valid array-like index. 23488 * 23489 * @private 23490 * @param {*} value The value to check. 23491 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 23492 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 23493 */ 23494 function isIndex(value, length) { 23495 var type = typeof value; 23496 length = length == null ? MAX_SAFE_INTEGER : length; 23497 23498 return !!length && 23499 (type == 'number' || 23500 (type != 'symbol' && reIsUint.test(value))) && 23501 (value > -1 && value % 1 == 0 && value < length); 23502 } 23503 23504 /** 23505 * Checks if the given arguments are from an iteratee call. 23506 * 23507 * @private 23508 * @param {*} value The potential iteratee value argument. 23509 * @param {*} index The potential iteratee index or key argument. 23510 * @param {*} object The potential iteratee object argument. 23511 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 23512 * else `false`. 23513 */ 23514 function isIterateeCall(value, index, object) { 23515 if (!isObject(object)) { 23516 return false; 23517 } 23518 var type = typeof index; 23519 if (type == 'number' 23520 ? (isArrayLike(object) && isIndex(index, object.length)) 23521 : (type == 'string' && index in object) 23522 ) { 23523 return eq(object[index], value); 23524 } 23525 return false; 23526 } 23527 23528 /** 23529 * Checks if `value` is a property name and not a property path. 23530 * 23531 * @private 23532 * @param {*} value The value to check. 23533 * @param {Object} [object] The object to query keys on. 23534 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 23535 */ 23536 function isKey(value, object) { 23537 if (isArray(value)) { 23538 return false; 23539 } 23540 var type = typeof value; 23541 if (type == 'number' || type == 'symbol' || type == 'boolean' || 23542 value == null || isSymbol(value)) { 23543 return true; 23544 } 23545 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 23546 (object != null && value in Object(object)); 23547 } 23548 23549 /** 23550 * Checks if `value` is suitable for use as unique object key. 23551 * 23552 * @private 23553 * @param {*} value The value to check. 23554 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 23555 */ 23556 function isKeyable(value) { 23557 var type = typeof value; 23558 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 23559 ? (value !== '__proto__') 23560 : (value === null); 23561 } 23562 23563 /** 23564 * Checks if `func` has a lazy counterpart. 23565 * 23566 * @private 23567 * @param {Function} func The function to check. 23568 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 23569 * else `false`. 23570 */ 23571 function isLaziable(func) { 23572 var funcName = getFuncName(func), 23573 other = lodash[funcName]; 23574 23575 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 23576 return false; 23577 } 23578 if (func === other) { 23579 return true; 23580 } 23581 var data = getData(other); 23582 return !!data && func === data[0]; 23583 } 23584 23585 /** 23586 * Checks if `func` has its source masked. 23587 * 23588 * @private 23589 * @param {Function} func The function to check. 23590 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 23591 */ 23592 function isMasked(func) { 23593 return !!maskSrcKey && (maskSrcKey in func); 23594 } 23595 23596 /** 23597 * Checks if `func` is capable of being masked. 23598 * 23599 * @private 23600 * @param {*} value The value to check. 23601 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 23602 */ 23603 var isMaskable = coreJsData ? isFunction : stubFalse; 23604 23605 /** 23606 * Checks if `value` is likely a prototype object. 23607 * 23608 * @private 23609 * @param {*} value The value to check. 23610 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 23611 */ 23612 function isPrototype(value) { 23613 var Ctor = value && value.constructor, 23614 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 23615 23616 return value === proto; 23617 } 23618 23619 /** 23620 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 23621 * 23622 * @private 23623 * @param {*} value The value to check. 23624 * @returns {boolean} Returns `true` if `value` if suitable for strict 23625 * equality comparisons, else `false`. 23626 */ 23627 function isStrictComparable(value) { 23628 return value === value && !isObject(value); 23629 } 23630 23631 /** 23632 * A specialized version of `matchesProperty` for source values suitable 23633 * for strict equality comparisons, i.e. `===`. 23634 * 23635 * @private 23636 * @param {string} key The key of the property to get. 23637 * @param {*} srcValue The value to match. 23638 * @returns {Function} Returns the new spec function. 23639 */ 23640 function matchesStrictComparable(key, srcValue) { 23641 return function(object) { 23642 if (object == null) { 23643 return false; 23644 } 23645 return object[key] === srcValue && 23646 (srcValue !== undefined || (key in Object(object))); 23647 }; 23648 } 23649 23650 /** 23651 * A specialized version of `_.memoize` which clears the memoized function's 23652 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 23653 * 23654 * @private 23655 * @param {Function} func The function to have its output memoized. 23656 * @returns {Function} Returns the new memoized function. 23657 */ 23658 function memoizeCapped(func) { 23659 var result = memoize(func, function(key) { 23660 if (cache.size === MAX_MEMOIZE_SIZE) { 23661 cache.clear(); 23662 } 23663 return key; 23664 }); 23665 23666 var cache = result.cache; 23667 return result; 23668 } 23669 23670 /** 23671 * Merges the function metadata of `source` into `data`. 23672 * 23673 * Merging metadata reduces the number of wrappers used to invoke a function. 23674 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 23675 * may be applied regardless of execution order. Methods like `_.ary` and 23676 * `_.rearg` modify function arguments, making the order in which they are 23677 * executed important, preventing the merging of metadata. However, we make 23678 * an exception for a safe combined case where curried functions have `_.ary` 23679 * and or `_.rearg` applied. 23680 * 23681 * @private 23682 * @param {Array} data The destination metadata. 23683 * @param {Array} source The source metadata. 23684 * @returns {Array} Returns `data`. 23685 */ 23686 function mergeData(data, source) { 23687 var bitmask = data[1], 23688 srcBitmask = source[1], 23689 newBitmask = bitmask | srcBitmask, 23690 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 23691 23692 var isCombo = 23693 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 23694 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 23695 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 23696 23697 // Exit early if metadata can't be merged. 23698 if (!(isCommon || isCombo)) { 23699 return data; 23700 } 23701 // Use source `thisArg` if available. 23702 if (srcBitmask & WRAP_BIND_FLAG) { 23703 data[2] = source[2]; 23704 // Set when currying a bound function. 23705 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 23706 } 23707 // Compose partial arguments. 23708 var value = source[3]; 23709 if (value) { 23710 var partials = data[3]; 23711 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 23712 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 23713 } 23714 // Compose partial right arguments. 23715 value = source[5]; 23716 if (value) { 23717 partials = data[5]; 23718 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 23719 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 23720 } 23721 // Use source `argPos` if available. 23722 value = source[7]; 23723 if (value) { 23724 data[7] = value; 23725 } 23726 // Use source `ary` if it's smaller. 23727 if (srcBitmask & WRAP_ARY_FLAG) { 23728 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 23729 } 23730 // Use source `arity` if one is not provided. 23731 if (data[9] == null) { 23732 data[9] = source[9]; 23733 } 23734 // Use source `func` and merge bitmasks. 23735 data[0] = source[0]; 23736 data[1] = newBitmask; 23737 23738 return data; 23739 } 23740 23741 /** 23742 * This function is like 23743 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 23744 * except that it includes inherited enumerable properties. 23745 * 23746 * @private 23747 * @param {Object} object The object to query. 23748 * @returns {Array} Returns the array of property names. 23749 */ 23750 function nativeKeysIn(object) { 23751 var result = []; 23752 if (object != null) { 23753 for (var key in Object(object)) { 23754 result.push(key); 23755 } 23756 } 23757 return result; 23758 } 23759 23760 /** 23761 * Converts `value` to a string using `Object.prototype.toString`. 23762 * 23763 * @private 23764 * @param {*} value The value to convert. 23765 * @returns {string} Returns the converted string. 23766 */ 23767 function objectToString(value) { 23768 return nativeObjectToString.call(value); 23769 } 23770 23771 /** 23772 * A specialized version of `baseRest` which transforms the rest array. 23773 * 23774 * @private 23775 * @param {Function} func The function to apply a rest parameter to. 23776 * @param {number} [start=func.length-1] The start position of the rest parameter. 23777 * @param {Function} transform The rest array transform. 23778 * @returns {Function} Returns the new function. 23779 */ 23780 function overRest(func, start, transform) { 23781 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 23782 return function() { 23783 var args = arguments, 23784 index = -1, 23785 length = nativeMax(args.length - start, 0), 23786 array = Array(length); 23787 23788 while (++index < length) { 23789 array[index] = args[start + index]; 23790 } 23791 index = -1; 23792 var otherArgs = Array(start + 1); 23793 while (++index < start) { 23794 otherArgs[index] = args[index]; 23795 } 23796 otherArgs[start] = transform(array); 23797 return apply(func, this, otherArgs); 23798 }; 23799 } 23800 23801 /** 23802 * Gets the parent value at `path` of `object`. 23803 * 23804 * @private 23805 * @param {Object} object The object to query. 23806 * @param {Array} path The path to get the parent value of. 23807 * @returns {*} Returns the parent value. 23808 */ 23809 function parent(object, path) { 23810 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 23811 } 23812 23813 /** 23814 * Reorder `array` according to the specified indexes where the element at 23815 * the first index is assigned as the first element, the element at 23816 * the second index is assigned as the second element, and so on. 23817 * 23818 * @private 23819 * @param {Array} array The array to reorder. 23820 * @param {Array} indexes The arranged array indexes. 23821 * @returns {Array} Returns `array`. 23822 */ 23823 function reorder(array, indexes) { 23824 var arrLength = array.length, 23825 length = nativeMin(indexes.length, arrLength), 23826 oldArray = copyArray(array); 23827 23828 while (length--) { 23829 var index = indexes[length]; 23830 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 23831 } 23832 return array; 23833 } 23834 23835 /** 23836 * Gets the value at `key`, unless `key` is "__proto__" or "constructor". 23837 * 23838 * @private 23839 * @param {Object} object The object to query. 23840 * @param {string} key The key of the property to get. 23841 * @returns {*} Returns the property value. 23842 */ 23843 function safeGet(object, key) { 23844 if (key === 'constructor' && typeof object[key] === 'function') { 23845 return; 23846 } 23847 23848 if (key == '__proto__') { 23849 return; 23850 } 23851 23852 return object[key]; 23853 } 23854 23855 /** 23856 * Sets metadata for `func`. 23857 * 23858 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 23859 * period of time, it will trip its breaker and transition to an identity 23860 * function to avoid garbage collection pauses in V8. See 23861 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 23862 * for more details. 23863 * 23864 * @private 23865 * @param {Function} func The function to associate metadata with. 23866 * @param {*} data The metadata. 23867 * @returns {Function} Returns `func`. 23868 */ 23869 var setData = shortOut(baseSetData); 23870 23871 /** 23872 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 23873 * 23874 * @private 23875 * @param {Function} func The function to delay. 23876 * @param {number} wait The number of milliseconds to delay invocation. 23877 * @returns {number|Object} Returns the timer id or timeout object. 23878 */ 23879 var setTimeout = ctxSetTimeout || function(func, wait) { 23880 return root.setTimeout(func, wait); 23881 }; 23882 23883 /** 23884 * Sets the `toString` method of `func` to return `string`. 23885 * 23886 * @private 23887 * @param {Function} func The function to modify. 23888 * @param {Function} string The `toString` result. 23889 * @returns {Function} Returns `func`. 23890 */ 23891 var setToString = shortOut(baseSetToString); 23892 23893 /** 23894 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 23895 * with wrapper details in a comment at the top of the source body. 23896 * 23897 * @private 23898 * @param {Function} wrapper The function to modify. 23899 * @param {Function} reference The reference function. 23900 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 23901 * @returns {Function} Returns `wrapper`. 23902 */ 23903 function setWrapToString(wrapper, reference, bitmask) { 23904 var source = (reference + ''); 23905 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 23906 } 23907 23908 /** 23909 * Creates a function that'll short out and invoke `identity` instead 23910 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 23911 * milliseconds. 23912 * 23913 * @private 23914 * @param {Function} func The function to restrict. 23915 * @returns {Function} Returns the new shortable function. 23916 */ 23917 function shortOut(func) { 23918 var count = 0, 23919 lastCalled = 0; 23920 23921 return function() { 23922 var stamp = nativeNow(), 23923 remaining = HOT_SPAN - (stamp - lastCalled); 23924 23925 lastCalled = stamp; 23926 if (remaining > 0) { 23927 if (++count >= HOT_COUNT) { 23928 return arguments[0]; 23929 } 23930 } else { 23931 count = 0; 23932 } 23933 return func.apply(undefined, arguments); 23934 }; 23935 } 23936 23937 /** 23938 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 23939 * 23940 * @private 23941 * @param {Array} array The array to shuffle. 23942 * @param {number} [size=array.length] The size of `array`. 23943 * @returns {Array} Returns `array`. 23944 */ 23945 function shuffleSelf(array, size) { 23946 var index = -1, 23947 length = array.length, 23948 lastIndex = length - 1; 23949 23950 size = size === undefined ? length : size; 23951 while (++index < size) { 23952 var rand = baseRandom(index, lastIndex), 23953 value = array[rand]; 23954 23955 array[rand] = array[index]; 23956 array[index] = value; 23957 } 23958 array.length = size; 23959 return array; 23960 } 23961 23962 /** 23963 * Converts `string` to a property path array. 23964 * 23965 * @private 23966 * @param {string} string The string to convert. 23967 * @returns {Array} Returns the property path array. 23968 */ 23969 var stringToPath = memoizeCapped(function(string) { 23970 var result = []; 23971 if (string.charCodeAt(0) === 46 /* . */) { 23972 result.push(''); 23973 } 23974 string.replace(rePropName, function(match, number, quote, subString) { 23975 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); 23976 }); 23977 return result; 23978 }); 23979 23980 /** 23981 * Converts `value` to a string key if it's not a string or symbol. 23982 * 23983 * @private 23984 * @param {*} value The value to inspect. 23985 * @returns {string|symbol} Returns the key. 23986 */ 23987 function toKey(value) { 23988 if (typeof value == 'string' || isSymbol(value)) { 23989 return value; 23990 } 23991 var result = (value + ''); 23992 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 23993 } 23994 23995 /** 23996 * Converts `func` to its source code. 23997 * 23998 * @private 23999 * @param {Function} func The function to convert. 24000 * @returns {string} Returns the source code. 24001 */ 24002 function toSource(func) { 24003 if (func != null) { 24004 try { 24005 return funcToString.call(func); 24006 } catch (e) {} 24007 try { 24008 return (func + ''); 24009 } catch (e) {} 24010 } 24011 return ''; 24012 } 24013 24014 /** 24015 * Updates wrapper `details` based on `bitmask` flags. 24016 * 24017 * @private 24018 * @returns {Array} details The details to modify. 24019 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24020 * @returns {Array} Returns `details`. 24021 */ 24022 function updateWrapDetails(details, bitmask) { 24023 arrayEach(wrapFlags, function(pair) { 24024 var value = '_.' + pair[0]; 24025 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 24026 details.push(value); 24027 } 24028 }); 24029 return details.sort(); 24030 } 24031 24032 /** 24033 * Creates a clone of `wrapper`. 24034 * 24035 * @private 24036 * @param {Object} wrapper The wrapper to clone. 24037 * @returns {Object} Returns the cloned wrapper. 24038 */ 24039 function wrapperClone(wrapper) { 24040 if (wrapper instanceof LazyWrapper) { 24041 return wrapper.clone(); 24042 } 24043 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 24044 result.__actions__ = copyArray(wrapper.__actions__); 24045 result.__index__ = wrapper.__index__; 24046 result.__values__ = wrapper.__values__; 24047 return result; 24048 } 24049 24050 /*------------------------------------------------------------------------*/ 24051 24052 /** 24053 * Creates an array of elements split into groups the length of `size`. 24054 * If `array` can't be split evenly, the final chunk will be the remaining 24055 * elements. 24056 * 24057 * @static 24058 * @memberOf _ 24059 * @since 3.0.0 24060 * @category Array 24061 * @param {Array} array The array to process. 24062 * @param {number} [size=1] The length of each chunk 24063 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 24064 * @returns {Array} Returns the new array of chunks. 24065 * @example 24066 * 24067 * _.chunk(['a', 'b', 'c', 'd'], 2); 24068 * // => [['a', 'b'], ['c', 'd']] 24069 * 24070 * _.chunk(['a', 'b', 'c', 'd'], 3); 24071 * // => [['a', 'b', 'c'], ['d']] 24072 */ 24073 function chunk(array, size, guard) { 24074 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 24075 size = 1; 24076 } else { 24077 size = nativeMax(toInteger(size), 0); 24078 } 24079 var length = array == null ? 0 : array.length; 24080 if (!length || size < 1) { 24081 return []; 24082 } 24083 var index = 0, 24084 resIndex = 0, 24085 result = Array(nativeCeil(length / size)); 24086 24087 while (index < length) { 24088 result[resIndex++] = baseSlice(array, index, (index += size)); 24089 } 24090 return result; 24091 } 24092 24093 /** 24094 * Creates an array with all falsey values removed. The values `false`, `null`, 24095 * `0`, `""`, `undefined`, and `NaN` are falsey. 24096 * 24097 * @static 24098 * @memberOf _ 24099 * @since 0.1.0 24100 * @category Array 24101 * @param {Array} array The array to compact. 24102 * @returns {Array} Returns the new array of filtered values. 24103 * @example 24104 * 24105 * _.compact([0, 1, false, 2, '', 3]); 24106 * // => [1, 2, 3] 24107 */ 24108 function compact(array) { 24109 var index = -1, 24110 length = array == null ? 0 : array.length, 24111 resIndex = 0, 24112 result = []; 24113 24114 while (++index < length) { 24115 var value = array[index]; 24116 if (value) { 24117 result[resIndex++] = value; 24118 } 24119 } 24120 return result; 24121 } 24122 24123 /** 24124 * Creates a new array concatenating `array` with any additional arrays 24125 * and/or values. 24126 * 24127 * @static 24128 * @memberOf _ 24129 * @since 4.0.0 24130 * @category Array 24131 * @param {Array} array The array to concatenate. 24132 * @param {...*} [values] The values to concatenate. 24133 * @returns {Array} Returns the new concatenated array. 24134 * @example 24135 * 24136 * var array = [1]; 24137 * var other = _.concat(array, 2, [3], [[4]]); 24138 * 24139 * console.log(other); 24140 * // => [1, 2, 3, [4]] 24141 * 24142 * console.log(array); 24143 * // => [1] 24144 */ 24145 function concat() { 24146 var length = arguments.length; 24147 if (!length) { 24148 return []; 24149 } 24150 var args = Array(length - 1), 24151 array = arguments[0], 24152 index = length; 24153 24154 while (index--) { 24155 args[index - 1] = arguments[index]; 24156 } 24157 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 24158 } 24159 24160 /** 24161 * Creates an array of `array` values not included in the other given arrays 24162 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24163 * for equality comparisons. The order and references of result values are 24164 * determined by the first array. 24165 * 24166 * **Note:** Unlike `_.pullAll`, this method returns a new array. 24167 * 24168 * @static 24169 * @memberOf _ 24170 * @since 0.1.0 24171 * @category Array 24172 * @param {Array} array The array to inspect. 24173 * @param {...Array} [values] The values to exclude. 24174 * @returns {Array} Returns the new array of filtered values. 24175 * @see _.without, _.xor 24176 * @example 24177 * 24178 * _.difference([2, 1], [2, 3]); 24179 * // => [1] 24180 */ 24181 var difference = baseRest(function(array, values) { 24182 return isArrayLikeObject(array) 24183 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 24184 : []; 24185 }); 24186 24187 /** 24188 * This method is like `_.difference` except that it accepts `iteratee` which 24189 * is invoked for each element of `array` and `values` to generate the criterion 24190 * by which they're compared. The order and references of result values are 24191 * determined by the first array. The iteratee is invoked with one argument: 24192 * (value). 24193 * 24194 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 24195 * 24196 * @static 24197 * @memberOf _ 24198 * @since 4.0.0 24199 * @category Array 24200 * @param {Array} array The array to inspect. 24201 * @param {...Array} [values] The values to exclude. 24202 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24203 * @returns {Array} Returns the new array of filtered values. 24204 * @example 24205 * 24206 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 24207 * // => [1.2] 24208 * 24209 * // The `_.property` iteratee shorthand. 24210 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 24211 * // => [{ 'x': 2 }] 24212 */ 24213 var differenceBy = baseRest(function(array, values) { 24214 var iteratee = last(values); 24215 if (isArrayLikeObject(iteratee)) { 24216 iteratee = undefined; 24217 } 24218 return isArrayLikeObject(array) 24219 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 24220 : []; 24221 }); 24222 24223 /** 24224 * This method is like `_.difference` except that it accepts `comparator` 24225 * which is invoked to compare elements of `array` to `values`. The order and 24226 * references of result values are determined by the first array. The comparator 24227 * is invoked with two arguments: (arrVal, othVal). 24228 * 24229 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 24230 * 24231 * @static 24232 * @memberOf _ 24233 * @since 4.0.0 24234 * @category Array 24235 * @param {Array} array The array to inspect. 24236 * @param {...Array} [values] The values to exclude. 24237 * @param {Function} [comparator] The comparator invoked per element. 24238 * @returns {Array} Returns the new array of filtered values. 24239 * @example 24240 * 24241 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 24242 * 24243 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 24244 * // => [{ 'x': 2, 'y': 1 }] 24245 */ 24246 var differenceWith = baseRest(function(array, values) { 24247 var comparator = last(values); 24248 if (isArrayLikeObject(comparator)) { 24249 comparator = undefined; 24250 } 24251 return isArrayLikeObject(array) 24252 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 24253 : []; 24254 }); 24255 24256 /** 24257 * Creates a slice of `array` with `n` elements dropped from the beginning. 24258 * 24259 * @static 24260 * @memberOf _ 24261 * @since 0.5.0 24262 * @category Array 24263 * @param {Array} array The array to query. 24264 * @param {number} [n=1] The number of elements to drop. 24265 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 24266 * @returns {Array} Returns the slice of `array`. 24267 * @example 24268 * 24269 * _.drop([1, 2, 3]); 24270 * // => [2, 3] 24271 * 24272 * _.drop([1, 2, 3], 2); 24273 * // => [3] 24274 * 24275 * _.drop([1, 2, 3], 5); 24276 * // => [] 24277 * 24278 * _.drop([1, 2, 3], 0); 24279 * // => [1, 2, 3] 24280 */ 24281 function drop(array, n, guard) { 24282 var length = array == null ? 0 : array.length; 24283 if (!length) { 24284 return []; 24285 } 24286 n = (guard || n === undefined) ? 1 : toInteger(n); 24287 return baseSlice(array, n < 0 ? 0 : n, length); 24288 } 24289 24290 /** 24291 * Creates a slice of `array` with `n` elements dropped from the end. 24292 * 24293 * @static 24294 * @memberOf _ 24295 * @since 3.0.0 24296 * @category Array 24297 * @param {Array} array The array to query. 24298 * @param {number} [n=1] The number of elements to drop. 24299 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 24300 * @returns {Array} Returns the slice of `array`. 24301 * @example 24302 * 24303 * _.dropRight([1, 2, 3]); 24304 * // => [1, 2] 24305 * 24306 * _.dropRight([1, 2, 3], 2); 24307 * // => [1] 24308 * 24309 * _.dropRight([1, 2, 3], 5); 24310 * // => [] 24311 * 24312 * _.dropRight([1, 2, 3], 0); 24313 * // => [1, 2, 3] 24314 */ 24315 function dropRight(array, n, guard) { 24316 var length = array == null ? 0 : array.length; 24317 if (!length) { 24318 return []; 24319 } 24320 n = (guard || n === undefined) ? 1 : toInteger(n); 24321 n = length - n; 24322 return baseSlice(array, 0, n < 0 ? 0 : n); 24323 } 24324 24325 /** 24326 * Creates a slice of `array` excluding elements dropped from the end. 24327 * Elements are dropped until `predicate` returns falsey. The predicate is 24328 * invoked with three arguments: (value, index, array). 24329 * 24330 * @static 24331 * @memberOf _ 24332 * @since 3.0.0 24333 * @category Array 24334 * @param {Array} array The array to query. 24335 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24336 * @returns {Array} Returns the slice of `array`. 24337 * @example 24338 * 24339 * var users = [ 24340 * { 'user': 'barney', 'active': true }, 24341 * { 'user': 'fred', 'active': false }, 24342 * { 'user': 'pebbles', 'active': false } 24343 * ]; 24344 * 24345 * _.dropRightWhile(users, function(o) { return !o.active; }); 24346 * // => objects for ['barney'] 24347 * 24348 * // The `_.matches` iteratee shorthand. 24349 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 24350 * // => objects for ['barney', 'fred'] 24351 * 24352 * // The `_.matchesProperty` iteratee shorthand. 24353 * _.dropRightWhile(users, ['active', false]); 24354 * // => objects for ['barney'] 24355 * 24356 * // The `_.property` iteratee shorthand. 24357 * _.dropRightWhile(users, 'active'); 24358 * // => objects for ['barney', 'fred', 'pebbles'] 24359 */ 24360 function dropRightWhile(array, predicate) { 24361 return (array && array.length) 24362 ? baseWhile(array, getIteratee(predicate, 3), true, true) 24363 : []; 24364 } 24365 24366 /** 24367 * Creates a slice of `array` excluding elements dropped from the beginning. 24368 * Elements are dropped until `predicate` returns falsey. The predicate is 24369 * invoked with three arguments: (value, index, array). 24370 * 24371 * @static 24372 * @memberOf _ 24373 * @since 3.0.0 24374 * @category Array 24375 * @param {Array} array The array to query. 24376 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24377 * @returns {Array} Returns the slice of `array`. 24378 * @example 24379 * 24380 * var users = [ 24381 * { 'user': 'barney', 'active': false }, 24382 * { 'user': 'fred', 'active': false }, 24383 * { 'user': 'pebbles', 'active': true } 24384 * ]; 24385 * 24386 * _.dropWhile(users, function(o) { return !o.active; }); 24387 * // => objects for ['pebbles'] 24388 * 24389 * // The `_.matches` iteratee shorthand. 24390 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 24391 * // => objects for ['fred', 'pebbles'] 24392 * 24393 * // The `_.matchesProperty` iteratee shorthand. 24394 * _.dropWhile(users, ['active', false]); 24395 * // => objects for ['pebbles'] 24396 * 24397 * // The `_.property` iteratee shorthand. 24398 * _.dropWhile(users, 'active'); 24399 * // => objects for ['barney', 'fred', 'pebbles'] 24400 */ 24401 function dropWhile(array, predicate) { 24402 return (array && array.length) 24403 ? baseWhile(array, getIteratee(predicate, 3), true) 24404 : []; 24405 } 24406 24407 /** 24408 * Fills elements of `array` with `value` from `start` up to, but not 24409 * including, `end`. 24410 * 24411 * **Note:** This method mutates `array`. 24412 * 24413 * @static 24414 * @memberOf _ 24415 * @since 3.2.0 24416 * @category Array 24417 * @param {Array} array The array to fill. 24418 * @param {*} value The value to fill `array` with. 24419 * @param {number} [start=0] The start position. 24420 * @param {number} [end=array.length] The end position. 24421 * @returns {Array} Returns `array`. 24422 * @example 24423 * 24424 * var array = [1, 2, 3]; 24425 * 24426 * _.fill(array, 'a'); 24427 * console.log(array); 24428 * // => ['a', 'a', 'a'] 24429 * 24430 * _.fill(Array(3), 2); 24431 * // => [2, 2, 2] 24432 * 24433 * _.fill([4, 6, 8, 10], '*', 1, 3); 24434 * // => [4, '*', '*', 10] 24435 */ 24436 function fill(array, value, start, end) { 24437 var length = array == null ? 0 : array.length; 24438 if (!length) { 24439 return []; 24440 } 24441 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 24442 start = 0; 24443 end = length; 24444 } 24445 return baseFill(array, value, start, end); 24446 } 24447 24448 /** 24449 * This method is like `_.find` except that it returns the index of the first 24450 * element `predicate` returns truthy for instead of the element itself. 24451 * 24452 * @static 24453 * @memberOf _ 24454 * @since 1.1.0 24455 * @category Array 24456 * @param {Array} array The array to inspect. 24457 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24458 * @param {number} [fromIndex=0] The index to search from. 24459 * @returns {number} Returns the index of the found element, else `-1`. 24460 * @example 24461 * 24462 * var users = [ 24463 * { 'user': 'barney', 'active': false }, 24464 * { 'user': 'fred', 'active': false }, 24465 * { 'user': 'pebbles', 'active': true } 24466 * ]; 24467 * 24468 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 24469 * // => 0 24470 * 24471 * // The `_.matches` iteratee shorthand. 24472 * _.findIndex(users, { 'user': 'fred', 'active': false }); 24473 * // => 1 24474 * 24475 * // The `_.matchesProperty` iteratee shorthand. 24476 * _.findIndex(users, ['active', false]); 24477 * // => 0 24478 * 24479 * // The `_.property` iteratee shorthand. 24480 * _.findIndex(users, 'active'); 24481 * // => 2 24482 */ 24483 function findIndex(array, predicate, fromIndex) { 24484 var length = array == null ? 0 : array.length; 24485 if (!length) { 24486 return -1; 24487 } 24488 var index = fromIndex == null ? 0 : toInteger(fromIndex); 24489 if (index < 0) { 24490 index = nativeMax(length + index, 0); 24491 } 24492 return baseFindIndex(array, getIteratee(predicate, 3), index); 24493 } 24494 24495 /** 24496 * This method is like `_.findIndex` except that it iterates over elements 24497 * of `collection` from right to left. 24498 * 24499 * @static 24500 * @memberOf _ 24501 * @since 2.0.0 24502 * @category Array 24503 * @param {Array} array The array to inspect. 24504 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24505 * @param {number} [fromIndex=array.length-1] The index to search from. 24506 * @returns {number} Returns the index of the found element, else `-1`. 24507 * @example 24508 * 24509 * var users = [ 24510 * { 'user': 'barney', 'active': true }, 24511 * { 'user': 'fred', 'active': false }, 24512 * { 'user': 'pebbles', 'active': false } 24513 * ]; 24514 * 24515 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 24516 * // => 2 24517 * 24518 * // The `_.matches` iteratee shorthand. 24519 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 24520 * // => 0 24521 * 24522 * // The `_.matchesProperty` iteratee shorthand. 24523 * _.findLastIndex(users, ['active', false]); 24524 * // => 2 24525 * 24526 * // The `_.property` iteratee shorthand. 24527 * _.findLastIndex(users, 'active'); 24528 * // => 0 24529 */ 24530 function findLastIndex(array, predicate, fromIndex) { 24531 var length = array == null ? 0 : array.length; 24532 if (!length) { 24533 return -1; 24534 } 24535 var index = length - 1; 24536 if (fromIndex !== undefined) { 24537 index = toInteger(fromIndex); 24538 index = fromIndex < 0 24539 ? nativeMax(length + index, 0) 24540 : nativeMin(index, length - 1); 24541 } 24542 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 24543 } 24544 24545 /** 24546 * Flattens `array` a single level deep. 24547 * 24548 * @static 24549 * @memberOf _ 24550 * @since 0.1.0 24551 * @category Array 24552 * @param {Array} array The array to flatten. 24553 * @returns {Array} Returns the new flattened array. 24554 * @example 24555 * 24556 * _.flatten([1, [2, [3, [4]], 5]]); 24557 * // => [1, 2, [3, [4]], 5] 24558 */ 24559 function flatten(array) { 24560 var length = array == null ? 0 : array.length; 24561 return length ? baseFlatten(array, 1) : []; 24562 } 24563 24564 /** 24565 * Recursively flattens `array`. 24566 * 24567 * @static 24568 * @memberOf _ 24569 * @since 3.0.0 24570 * @category Array 24571 * @param {Array} array The array to flatten. 24572 * @returns {Array} Returns the new flattened array. 24573 * @example 24574 * 24575 * _.flattenDeep([1, [2, [3, [4]], 5]]); 24576 * // => [1, 2, 3, 4, 5] 24577 */ 24578 function flattenDeep(array) { 24579 var length = array == null ? 0 : array.length; 24580 return length ? baseFlatten(array, INFINITY) : []; 24581 } 24582 24583 /** 24584 * Recursively flatten `array` up to `depth` times. 24585 * 24586 * @static 24587 * @memberOf _ 24588 * @since 4.4.0 24589 * @category Array 24590 * @param {Array} array The array to flatten. 24591 * @param {number} [depth=1] The maximum recursion depth. 24592 * @returns {Array} Returns the new flattened array. 24593 * @example 24594 * 24595 * var array = [1, [2, [3, [4]], 5]]; 24596 * 24597 * _.flattenDepth(array, 1); 24598 * // => [1, 2, [3, [4]], 5] 24599 * 24600 * _.flattenDepth(array, 2); 24601 * // => [1, 2, 3, [4], 5] 24602 */ 24603 function flattenDepth(array, depth) { 24604 var length = array == null ? 0 : array.length; 24605 if (!length) { 24606 return []; 24607 } 24608 depth = depth === undefined ? 1 : toInteger(depth); 24609 return baseFlatten(array, depth); 24610 } 24611 24612 /** 24613 * The inverse of `_.toPairs`; this method returns an object composed 24614 * from key-value `pairs`. 24615 * 24616 * @static 24617 * @memberOf _ 24618 * @since 4.0.0 24619 * @category Array 24620 * @param {Array} pairs The key-value pairs. 24621 * @returns {Object} Returns the new object. 24622 * @example 24623 * 24624 * _.fromPairs([['a', 1], ['b', 2]]); 24625 * // => { 'a': 1, 'b': 2 } 24626 */ 24627 function fromPairs(pairs) { 24628 var index = -1, 24629 length = pairs == null ? 0 : pairs.length, 24630 result = {}; 24631 24632 while (++index < length) { 24633 var pair = pairs[index]; 24634 result[pair[0]] = pair[1]; 24635 } 24636 return result; 24637 } 24638 24639 /** 24640 * Gets the first element of `array`. 24641 * 24642 * @static 24643 * @memberOf _ 24644 * @since 0.1.0 24645 * @alias first 24646 * @category Array 24647 * @param {Array} array The array to query. 24648 * @returns {*} Returns the first element of `array`. 24649 * @example 24650 * 24651 * _.head([1, 2, 3]); 24652 * // => 1 24653 * 24654 * _.head([]); 24655 * // => undefined 24656 */ 24657 function head(array) { 24658 return (array && array.length) ? array[0] : undefined; 24659 } 24660 24661 /** 24662 * Gets the index at which the first occurrence of `value` is found in `array` 24663 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24664 * for equality comparisons. If `fromIndex` is negative, it's used as the 24665 * offset from the end of `array`. 24666 * 24667 * @static 24668 * @memberOf _ 24669 * @since 0.1.0 24670 * @category Array 24671 * @param {Array} array The array to inspect. 24672 * @param {*} value The value to search for. 24673 * @param {number} [fromIndex=0] The index to search from. 24674 * @returns {number} Returns the index of the matched value, else `-1`. 24675 * @example 24676 * 24677 * _.indexOf([1, 2, 1, 2], 2); 24678 * // => 1 24679 * 24680 * // Search from the `fromIndex`. 24681 * _.indexOf([1, 2, 1, 2], 2, 2); 24682 * // => 3 24683 */ 24684 function indexOf(array, value, fromIndex) { 24685 var length = array == null ? 0 : array.length; 24686 if (!length) { 24687 return -1; 24688 } 24689 var index = fromIndex == null ? 0 : toInteger(fromIndex); 24690 if (index < 0) { 24691 index = nativeMax(length + index, 0); 24692 } 24693 return baseIndexOf(array, value, index); 24694 } 24695 24696 /** 24697 * Gets all but the last element of `array`. 24698 * 24699 * @static 24700 * @memberOf _ 24701 * @since 0.1.0 24702 * @category Array 24703 * @param {Array} array The array to query. 24704 * @returns {Array} Returns the slice of `array`. 24705 * @example 24706 * 24707 * _.initial([1, 2, 3]); 24708 * // => [1, 2] 24709 */ 24710 function initial(array) { 24711 var length = array == null ? 0 : array.length; 24712 return length ? baseSlice(array, 0, -1) : []; 24713 } 24714 24715 /** 24716 * Creates an array of unique values that are included in all given arrays 24717 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24718 * for equality comparisons. The order and references of result values are 24719 * determined by the first array. 24720 * 24721 * @static 24722 * @memberOf _ 24723 * @since 0.1.0 24724 * @category Array 24725 * @param {...Array} [arrays] The arrays to inspect. 24726 * @returns {Array} Returns the new array of intersecting values. 24727 * @example 24728 * 24729 * _.intersection([2, 1], [2, 3]); 24730 * // => [2] 24731 */ 24732 var intersection = baseRest(function(arrays) { 24733 var mapped = arrayMap(arrays, castArrayLikeObject); 24734 return (mapped.length && mapped[0] === arrays[0]) 24735 ? baseIntersection(mapped) 24736 : []; 24737 }); 24738 24739 /** 24740 * This method is like `_.intersection` except that it accepts `iteratee` 24741 * which is invoked for each element of each `arrays` to generate the criterion 24742 * by which they're compared. The order and references of result values are 24743 * determined by the first array. The iteratee is invoked with one argument: 24744 * (value). 24745 * 24746 * @static 24747 * @memberOf _ 24748 * @since 4.0.0 24749 * @category Array 24750 * @param {...Array} [arrays] The arrays to inspect. 24751 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24752 * @returns {Array} Returns the new array of intersecting values. 24753 * @example 24754 * 24755 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 24756 * // => [2.1] 24757 * 24758 * // The `_.property` iteratee shorthand. 24759 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 24760 * // => [{ 'x': 1 }] 24761 */ 24762 var intersectionBy = baseRest(function(arrays) { 24763 var iteratee = last(arrays), 24764 mapped = arrayMap(arrays, castArrayLikeObject); 24765 24766 if (iteratee === last(mapped)) { 24767 iteratee = undefined; 24768 } else { 24769 mapped.pop(); 24770 } 24771 return (mapped.length && mapped[0] === arrays[0]) 24772 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 24773 : []; 24774 }); 24775 24776 /** 24777 * This method is like `_.intersection` except that it accepts `comparator` 24778 * which is invoked to compare elements of `arrays`. The order and references 24779 * of result values are determined by the first array. The comparator is 24780 * invoked with two arguments: (arrVal, othVal). 24781 * 24782 * @static 24783 * @memberOf _ 24784 * @since 4.0.0 24785 * @category Array 24786 * @param {...Array} [arrays] The arrays to inspect. 24787 * @param {Function} [comparator] The comparator invoked per element. 24788 * @returns {Array} Returns the new array of intersecting values. 24789 * @example 24790 * 24791 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 24792 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 24793 * 24794 * _.intersectionWith(objects, others, _.isEqual); 24795 * // => [{ 'x': 1, 'y': 2 }] 24796 */ 24797 var intersectionWith = baseRest(function(arrays) { 24798 var comparator = last(arrays), 24799 mapped = arrayMap(arrays, castArrayLikeObject); 24800 24801 comparator = typeof comparator == 'function' ? comparator : undefined; 24802 if (comparator) { 24803 mapped.pop(); 24804 } 24805 return (mapped.length && mapped[0] === arrays[0]) 24806 ? baseIntersection(mapped, undefined, comparator) 24807 : []; 24808 }); 24809 24810 /** 24811 * Converts all elements in `array` into a string separated by `separator`. 24812 * 24813 * @static 24814 * @memberOf _ 24815 * @since 4.0.0 24816 * @category Array 24817 * @param {Array} array The array to convert. 24818 * @param {string} [separator=','] The element separator. 24819 * @returns {string} Returns the joined string. 24820 * @example 24821 * 24822 * _.join(['a', 'b', 'c'], '~'); 24823 * // => 'a~b~c' 24824 */ 24825 function join(array, separator) { 24826 return array == null ? '' : nativeJoin.call(array, separator); 24827 } 24828 24829 /** 24830 * Gets the last element of `array`. 24831 * 24832 * @static 24833 * @memberOf _ 24834 * @since 0.1.0 24835 * @category Array 24836 * @param {Array} array The array to query. 24837 * @returns {*} Returns the last element of `array`. 24838 * @example 24839 * 24840 * _.last([1, 2, 3]); 24841 * // => 3 24842 */ 24843 function last(array) { 24844 var length = array == null ? 0 : array.length; 24845 return length ? array[length - 1] : undefined; 24846 } 24847 24848 /** 24849 * This method is like `_.indexOf` except that it iterates over elements of 24850 * `array` from right to left. 24851 * 24852 * @static 24853 * @memberOf _ 24854 * @since 0.1.0 24855 * @category Array 24856 * @param {Array} array The array to inspect. 24857 * @param {*} value The value to search for. 24858 * @param {number} [fromIndex=array.length-1] The index to search from. 24859 * @returns {number} Returns the index of the matched value, else `-1`. 24860 * @example 24861 * 24862 * _.lastIndexOf([1, 2, 1, 2], 2); 24863 * // => 3 24864 * 24865 * // Search from the `fromIndex`. 24866 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 24867 * // => 1 24868 */ 24869 function lastIndexOf(array, value, fromIndex) { 24870 var length = array == null ? 0 : array.length; 24871 if (!length) { 24872 return -1; 24873 } 24874 var index = length; 24875 if (fromIndex !== undefined) { 24876 index = toInteger(fromIndex); 24877 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 24878 } 24879 return value === value 24880 ? strictLastIndexOf(array, value, index) 24881 : baseFindIndex(array, baseIsNaN, index, true); 24882 } 24883 24884 /** 24885 * Gets the element at index `n` of `array`. If `n` is negative, the nth 24886 * element from the end is returned. 24887 * 24888 * @static 24889 * @memberOf _ 24890 * @since 4.11.0 24891 * @category Array 24892 * @param {Array} array The array to query. 24893 * @param {number} [n=0] The index of the element to return. 24894 * @returns {*} Returns the nth element of `array`. 24895 * @example 24896 * 24897 * var array = ['a', 'b', 'c', 'd']; 24898 * 24899 * _.nth(array, 1); 24900 * // => 'b' 24901 * 24902 * _.nth(array, -2); 24903 * // => 'c'; 24904 */ 24905 function nth(array, n) { 24906 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 24907 } 24908 24909 /** 24910 * Removes all given values from `array` using 24911 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24912 * for equality comparisons. 24913 * 24914 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 24915 * to remove elements from an array by predicate. 24916 * 24917 * @static 24918 * @memberOf _ 24919 * @since 2.0.0 24920 * @category Array 24921 * @param {Array} array The array to modify. 24922 * @param {...*} [values] The values to remove. 24923 * @returns {Array} Returns `array`. 24924 * @example 24925 * 24926 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 24927 * 24928 * _.pull(array, 'a', 'c'); 24929 * console.log(array); 24930 * // => ['b', 'b'] 24931 */ 24932 var pull = baseRest(pullAll); 24933 24934 /** 24935 * This method is like `_.pull` except that it accepts an array of values to remove. 24936 * 24937 * **Note:** Unlike `_.difference`, this method mutates `array`. 24938 * 24939 * @static 24940 * @memberOf _ 24941 * @since 4.0.0 24942 * @category Array 24943 * @param {Array} array The array to modify. 24944 * @param {Array} values The values to remove. 24945 * @returns {Array} Returns `array`. 24946 * @example 24947 * 24948 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 24949 * 24950 * _.pullAll(array, ['a', 'c']); 24951 * console.log(array); 24952 * // => ['b', 'b'] 24953 */ 24954 function pullAll(array, values) { 24955 return (array && array.length && values && values.length) 24956 ? basePullAll(array, values) 24957 : array; 24958 } 24959 24960 /** 24961 * This method is like `_.pullAll` except that it accepts `iteratee` which is 24962 * invoked for each element of `array` and `values` to generate the criterion 24963 * by which they're compared. The iteratee is invoked with one argument: (value). 24964 * 24965 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 24966 * 24967 * @static 24968 * @memberOf _ 24969 * @since 4.0.0 24970 * @category Array 24971 * @param {Array} array The array to modify. 24972 * @param {Array} values The values to remove. 24973 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24974 * @returns {Array} Returns `array`. 24975 * @example 24976 * 24977 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 24978 * 24979 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 24980 * console.log(array); 24981 * // => [{ 'x': 2 }] 24982 */ 24983 function pullAllBy(array, values, iteratee) { 24984 return (array && array.length && values && values.length) 24985 ? basePullAll(array, values, getIteratee(iteratee, 2)) 24986 : array; 24987 } 24988 24989 /** 24990 * This method is like `_.pullAll` except that it accepts `comparator` which 24991 * is invoked to compare elements of `array` to `values`. The comparator is 24992 * invoked with two arguments: (arrVal, othVal). 24993 * 24994 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 24995 * 24996 * @static 24997 * @memberOf _ 24998 * @since 4.6.0 24999 * @category Array 25000 * @param {Array} array The array to modify. 25001 * @param {Array} values The values to remove. 25002 * @param {Function} [comparator] The comparator invoked per element. 25003 * @returns {Array} Returns `array`. 25004 * @example 25005 * 25006 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 25007 * 25008 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 25009 * console.log(array); 25010 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 25011 */ 25012 function pullAllWith(array, values, comparator) { 25013 return (array && array.length && values && values.length) 25014 ? basePullAll(array, values, undefined, comparator) 25015 : array; 25016 } 25017 25018 /** 25019 * Removes elements from `array` corresponding to `indexes` and returns an 25020 * array of removed elements. 25021 * 25022 * **Note:** Unlike `_.at`, this method mutates `array`. 25023 * 25024 * @static 25025 * @memberOf _ 25026 * @since 3.0.0 25027 * @category Array 25028 * @param {Array} array The array to modify. 25029 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 25030 * @returns {Array} Returns the new array of removed elements. 25031 * @example 25032 * 25033 * var array = ['a', 'b', 'c', 'd']; 25034 * var pulled = _.pullAt(array, [1, 3]); 25035 * 25036 * console.log(array); 25037 * // => ['a', 'c'] 25038 * 25039 * console.log(pulled); 25040 * // => ['b', 'd'] 25041 */ 25042 var pullAt = flatRest(function(array, indexes) { 25043 var length = array == null ? 0 : array.length, 25044 result = baseAt(array, indexes); 25045 25046 basePullAt(array, arrayMap(indexes, function(index) { 25047 return isIndex(index, length) ? +index : index; 25048 }).sort(compareAscending)); 25049 25050 return result; 25051 }); 25052 25053 /** 25054 * Removes all elements from `array` that `predicate` returns truthy for 25055 * and returns an array of the removed elements. The predicate is invoked 25056 * with three arguments: (value, index, array). 25057 * 25058 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 25059 * to pull elements from an array by value. 25060 * 25061 * @static 25062 * @memberOf _ 25063 * @since 2.0.0 25064 * @category Array 25065 * @param {Array} array The array to modify. 25066 * @param {Function} [predicate=_.identity] The function invoked per iteration. 25067 * @returns {Array} Returns the new array of removed elements. 25068 * @example 25069 * 25070 * var array = [1, 2, 3, 4]; 25071 * var evens = _.remove(array, function(n) { 25072 * return n % 2 == 0; 25073 * }); 25074 * 25075 * console.log(array); 25076 * // => [1, 3] 25077 * 25078 * console.log(evens); 25079 * // => [2, 4] 25080 */ 25081 function remove(array, predicate) { 25082 var result = []; 25083 if (!(array && array.length)) { 25084 return result; 25085 } 25086 var index = -1, 25087 indexes = [], 25088 length = array.length; 25089 25090 predicate = getIteratee(predicate, 3); 25091 while (++index < length) { 25092 var value = array[index]; 25093 if (predicate(value, index, array)) { 25094 result.push(value); 25095 indexes.push(index); 25096 } 25097 } 25098 basePullAt(array, indexes); 25099 return result; 25100 } 25101 25102 /** 25103 * Reverses `array` so that the first element becomes the last, the second 25104 * element becomes the second to last, and so on. 25105 * 25106 * **Note:** This method mutates `array` and is based on 25107 * [`Array#reverse`](https://mdn.io/Array/reverse). 25108 * 25109 * @static 25110 * @memberOf _ 25111 * @since 4.0.0 25112 * @category Array 25113 * @param {Array} array The array to modify. 25114 * @returns {Array} Returns `array`. 25115 * @example 25116 * 25117 * var array = [1, 2, 3]; 25118 * 25119 * _.reverse(array); 25120 * // => [3, 2, 1] 25121 * 25122 * console.log(array); 25123 * // => [3, 2, 1] 25124 */ 25125 function reverse(array) { 25126 return array == null ? array : nativeReverse.call(array); 25127 } 25128 25129 /** 25130 * Creates a slice of `array` from `start` up to, but not including, `end`. 25131 * 25132 * **Note:** This method is used instead of 25133 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 25134 * returned. 25135 * 25136 * @static 25137 * @memberOf _ 25138 * @since 3.0.0 25139 * @category Array 25140 * @param {Array} array The array to slice. 25141 * @param {number} [start=0] The start position. 25142 * @param {number} [end=array.length] The end position. 25143 * @returns {Array} Returns the slice of `array`. 25144 */ 25145 function slice(array, start, end) { 25146 var length = array == null ? 0 : array.length; 25147 if (!length) { 25148 return []; 25149 } 25150 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 25151 start = 0; 25152 end = length; 25153 } 25154 else { 25155 start = start == null ? 0 : toInteger(start); 25156 end = end === undefined ? length : toInteger(end); 25157 } 25158 return baseSlice(array, start, end); 25159 } 25160 25161 /** 25162 * Uses a binary search to determine the lowest index at which `value` 25163 * should be inserted into `array` in order to maintain its sort order. 25164 * 25165 * @static 25166 * @memberOf _ 25167 * @since 0.1.0 25168 * @category Array 25169 * @param {Array} array The sorted array to inspect. 25170 * @param {*} value The value to evaluate. 25171 * @returns {number} Returns the index at which `value` should be inserted 25172 * into `array`. 25173 * @example 25174 * 25175 * _.sortedIndex([30, 50], 40); 25176 * // => 1 25177 */ 25178 function sortedIndex(array, value) { 25179 return baseSortedIndex(array, value); 25180 } 25181 25182 /** 25183 * This method is like `_.sortedIndex` except that it accepts `iteratee` 25184 * which is invoked for `value` and each element of `array` to compute their 25185 * sort ranking. The iteratee is invoked with one argument: (value). 25186 * 25187 * @static 25188 * @memberOf _ 25189 * @since 4.0.0 25190 * @category Array 25191 * @param {Array} array The sorted array to inspect. 25192 * @param {*} value The value to evaluate. 25193 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25194 * @returns {number} Returns the index at which `value` should be inserted 25195 * into `array`. 25196 * @example 25197 * 25198 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 25199 * 25200 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 25201 * // => 0 25202 * 25203 * // The `_.property` iteratee shorthand. 25204 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 25205 * // => 0 25206 */ 25207 function sortedIndexBy(array, value, iteratee) { 25208 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 25209 } 25210 25211 /** 25212 * This method is like `_.indexOf` except that it performs a binary 25213 * search on a sorted `array`. 25214 * 25215 * @static 25216 * @memberOf _ 25217 * @since 4.0.0 25218 * @category Array 25219 * @param {Array} array The array to inspect. 25220 * @param {*} value The value to search for. 25221 * @returns {number} Returns the index of the matched value, else `-1`. 25222 * @example 25223 * 25224 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 25225 * // => 1 25226 */ 25227 function sortedIndexOf(array, value) { 25228 var length = array == null ? 0 : array.length; 25229 if (length) { 25230 var index = baseSortedIndex(array, value); 25231 if (index < length && eq(array[index], value)) { 25232 return index; 25233 } 25234 } 25235 return -1; 25236 } 25237 25238 /** 25239 * This method is like `_.sortedIndex` except that it returns the highest 25240 * index at which `value` should be inserted into `array` in order to 25241 * maintain its sort order. 25242 * 25243 * @static 25244 * @memberOf _ 25245 * @since 3.0.0 25246 * @category Array 25247 * @param {Array} array The sorted array to inspect. 25248 * @param {*} value The value to evaluate. 25249 * @returns {number} Returns the index at which `value` should be inserted 25250 * into `array`. 25251 * @example 25252 * 25253 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 25254 * // => 4 25255 */ 25256 function sortedLastIndex(array, value) { 25257 return baseSortedIndex(array, value, true); 25258 } 25259 25260 /** 25261 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 25262 * which is invoked for `value` and each element of `array` to compute their 25263 * sort ranking. The iteratee is invoked with one argument: (value). 25264 * 25265 * @static 25266 * @memberOf _ 25267 * @since 4.0.0 25268 * @category Array 25269 * @param {Array} array The sorted array to inspect. 25270 * @param {*} value The value to evaluate. 25271 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25272 * @returns {number} Returns the index at which `value` should be inserted 25273 * into `array`. 25274 * @example 25275 * 25276 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 25277 * 25278 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 25279 * // => 1 25280 * 25281 * // The `_.property` iteratee shorthand. 25282 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 25283 * // => 1 25284 */ 25285 function sortedLastIndexBy(array, value, iteratee) { 25286 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 25287 } 25288 25289 /** 25290 * This method is like `_.lastIndexOf` except that it performs a binary 25291 * search on a sorted `array`. 25292 * 25293 * @static 25294 * @memberOf _ 25295 * @since 4.0.0 25296 * @category Array 25297 * @param {Array} array The array to inspect. 25298 * @param {*} value The value to search for. 25299 * @returns {number} Returns the index of the matched value, else `-1`. 25300 * @example 25301 * 25302 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 25303 * // => 3 25304 */ 25305 function sortedLastIndexOf(array, value) { 25306 var length = array == null ? 0 : array.length; 25307 if (length) { 25308 var index = baseSortedIndex(array, value, true) - 1; 25309 if (eq(array[index], value)) { 25310 return index; 25311 } 25312 } 25313 return -1; 25314 } 25315 25316 /** 25317 * This method is like `_.uniq` except that it's designed and optimized 25318 * for sorted arrays. 25319 * 25320 * @static 25321 * @memberOf _ 25322 * @since 4.0.0 25323 * @category Array 25324 * @param {Array} array The array to inspect. 25325 * @returns {Array} Returns the new duplicate free array. 25326 * @example 25327 * 25328 * _.sortedUniq([1, 1, 2]); 25329 * // => [1, 2] 25330 */ 25331 function sortedUniq(array) { 25332 return (array && array.length) 25333 ? baseSortedUniq(array) 25334 : []; 25335 } 25336 25337 /** 25338 * This method is like `_.uniqBy` except that it's designed and optimized 25339 * for sorted arrays. 25340 * 25341 * @static 25342 * @memberOf _ 25343 * @since 4.0.0 25344 * @category Array 25345 * @param {Array} array The array to inspect. 25346 * @param {Function} [iteratee] The iteratee invoked per element. 25347 * @returns {Array} Returns the new duplicate free array. 25348 * @example 25349 * 25350 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 25351 * // => [1.1, 2.3] 25352 */ 25353 function sortedUniqBy(array, iteratee) { 25354 return (array && array.length) 25355 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 25356 : []; 25357 } 25358 25359 /** 25360 * Gets all but the first element of `array`. 25361 * 25362 * @static 25363 * @memberOf _ 25364 * @since 4.0.0 25365 * @category Array 25366 * @param {Array} array The array to query. 25367 * @returns {Array} Returns the slice of `array`. 25368 * @example 25369 * 25370 * _.tail([1, 2, 3]); 25371 * // => [2, 3] 25372 */ 25373 function tail(array) { 25374 var length = array == null ? 0 : array.length; 25375 return length ? baseSlice(array, 1, length) : []; 25376 } 25377 25378 /** 25379 * Creates a slice of `array` with `n` elements taken from the beginning. 25380 * 25381 * @static 25382 * @memberOf _ 25383 * @since 0.1.0 25384 * @category Array 25385 * @param {Array} array The array to query. 25386 * @param {number} [n=1] The number of elements to take. 25387 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 25388 * @returns {Array} Returns the slice of `array`. 25389 * @example 25390 * 25391 * _.take([1, 2, 3]); 25392 * // => [1] 25393 * 25394 * _.take([1, 2, 3], 2); 25395 * // => [1, 2] 25396 * 25397 * _.take([1, 2, 3], 5); 25398 * // => [1, 2, 3] 25399 * 25400 * _.take([1, 2, 3], 0); 25401 * // => [] 25402 */ 25403 function take(array, n, guard) { 25404 if (!(array && array.length)) { 25405 return []; 25406 } 25407 n = (guard || n === undefined) ? 1 : toInteger(n); 25408 return baseSlice(array, 0, n < 0 ? 0 : n); 25409 } 25410 25411 /** 25412 * Creates a slice of `array` with `n` elements taken from the end. 25413 * 25414 * @static 25415 * @memberOf _ 25416 * @since 3.0.0 25417 * @category Array 25418 * @param {Array} array The array to query. 25419 * @param {number} [n=1] The number of elements to take. 25420 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 25421 * @returns {Array} Returns the slice of `array`. 25422 * @example 25423 * 25424 * _.takeRight([1, 2, 3]); 25425 * // => [3] 25426 * 25427 * _.takeRight([1, 2, 3], 2); 25428 * // => [2, 3] 25429 * 25430 * _.takeRight([1, 2, 3], 5); 25431 * // => [1, 2, 3] 25432 * 25433 * _.takeRight([1, 2, 3], 0); 25434 * // => [] 25435 */ 25436 function takeRight(array, n, guard) { 25437 var length = array == null ? 0 : array.length; 25438 if (!length) { 25439 return []; 25440 } 25441 n = (guard || n === undefined) ? 1 : toInteger(n); 25442 n = length - n; 25443 return baseSlice(array, n < 0 ? 0 : n, length); 25444 } 25445 25446 /** 25447 * Creates a slice of `array` with elements taken from the end. Elements are 25448 * taken until `predicate` returns falsey. The predicate is invoked with 25449 * three arguments: (value, index, array). 25450 * 25451 * @static 25452 * @memberOf _ 25453 * @since 3.0.0 25454 * @category Array 25455 * @param {Array} array The array to query. 25456 * @param {Function} [predicate=_.identity] The function invoked per iteration. 25457 * @returns {Array} Returns the slice of `array`. 25458 * @example 25459 * 25460 * var users = [ 25461 * { 'user': 'barney', 'active': true }, 25462 * { 'user': 'fred', 'active': false }, 25463 * { 'user': 'pebbles', 'active': false } 25464 * ]; 25465 * 25466 * _.takeRightWhile(users, function(o) { return !o.active; }); 25467 * // => objects for ['fred', 'pebbles'] 25468 * 25469 * // The `_.matches` iteratee shorthand. 25470 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 25471 * // => objects for ['pebbles'] 25472 * 25473 * // The `_.matchesProperty` iteratee shorthand. 25474 * _.takeRightWhile(users, ['active', false]); 25475 * // => objects for ['fred', 'pebbles'] 25476 * 25477 * // The `_.property` iteratee shorthand. 25478 * _.takeRightWhile(users, 'active'); 25479 * // => [] 25480 */ 25481 function takeRightWhile(array, predicate) { 25482 return (array && array.length) 25483 ? baseWhile(array, getIteratee(predicate, 3), false, true) 25484 : []; 25485 } 25486 25487 /** 25488 * Creates a slice of `array` with elements taken from the beginning. Elements 25489 * are taken until `predicate` returns falsey. The predicate is invoked with 25490 * three arguments: (value, index, array). 25491 * 25492 * @static 25493 * @memberOf _ 25494 * @since 3.0.0 25495 * @category Array 25496 * @param {Array} array The array to query. 25497 * @param {Function} [predicate=_.identity] The function invoked per iteration. 25498 * @returns {Array} Returns the slice of `array`. 25499 * @example 25500 * 25501 * var users = [ 25502 * { 'user': 'barney', 'active': false }, 25503 * { 'user': 'fred', 'active': false }, 25504 * { 'user': 'pebbles', 'active': true } 25505 * ]; 25506 * 25507 * _.takeWhile(users, function(o) { return !o.active; }); 25508 * // => objects for ['barney', 'fred'] 25509 * 25510 * // The `_.matches` iteratee shorthand. 25511 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 25512 * // => objects for ['barney'] 25513 * 25514 * // The `_.matchesProperty` iteratee shorthand. 25515 * _.takeWhile(users, ['active', false]); 25516 * // => objects for ['barney', 'fred'] 25517 * 25518 * // The `_.property` iteratee shorthand. 25519 * _.takeWhile(users, 'active'); 25520 * // => [] 25521 */ 25522 function takeWhile(array, predicate) { 25523 return (array && array.length) 25524 ? baseWhile(array, getIteratee(predicate, 3)) 25525 : []; 25526 } 25527 25528 /** 25529 * Creates an array of unique values, in order, from all given arrays using 25530 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25531 * for equality comparisons. 25532 * 25533 * @static 25534 * @memberOf _ 25535 * @since 0.1.0 25536 * @category Array 25537 * @param {...Array} [arrays] The arrays to inspect. 25538 * @returns {Array} Returns the new array of combined values. 25539 * @example 25540 * 25541 * _.union([2], [1, 2]); 25542 * // => [2, 1] 25543 */ 25544 var union = baseRest(function(arrays) { 25545 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 25546 }); 25547 25548 /** 25549 * This method is like `_.union` except that it accepts `iteratee` which is 25550 * invoked for each element of each `arrays` to generate the criterion by 25551 * which uniqueness is computed. Result values are chosen from the first 25552 * array in which the value occurs. The iteratee is invoked with one argument: 25553 * (value). 25554 * 25555 * @static 25556 * @memberOf _ 25557 * @since 4.0.0 25558 * @category Array 25559 * @param {...Array} [arrays] The arrays to inspect. 25560 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25561 * @returns {Array} Returns the new array of combined values. 25562 * @example 25563 * 25564 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 25565 * // => [2.1, 1.2] 25566 * 25567 * // The `_.property` iteratee shorthand. 25568 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 25569 * // => [{ 'x': 1 }, { 'x': 2 }] 25570 */ 25571 var unionBy = baseRest(function(arrays) { 25572 var iteratee = last(arrays); 25573 if (isArrayLikeObject(iteratee)) { 25574 iteratee = undefined; 25575 } 25576 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 25577 }); 25578 25579 /** 25580 * This method is like `_.union` except that it accepts `comparator` which 25581 * is invoked to compare elements of `arrays`. Result values are chosen from 25582 * the first array in which the value occurs. The comparator is invoked 25583 * with two arguments: (arrVal, othVal). 25584 * 25585 * @static 25586 * @memberOf _ 25587 * @since 4.0.0 25588 * @category Array 25589 * @param {...Array} [arrays] The arrays to inspect. 25590 * @param {Function} [comparator] The comparator invoked per element. 25591 * @returns {Array} Returns the new array of combined values. 25592 * @example 25593 * 25594 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 25595 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 25596 * 25597 * _.unionWith(objects, others, _.isEqual); 25598 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 25599 */ 25600 var unionWith = baseRest(function(arrays) { 25601 var comparator = last(arrays); 25602 comparator = typeof comparator == 'function' ? comparator : undefined; 25603 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 25604 }); 25605 25606 /** 25607 * Creates a duplicate-free version of an array, using 25608 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25609 * for equality comparisons, in which only the first occurrence of each element 25610 * is kept. The order of result values is determined by the order they occur 25611 * in the array. 25612 * 25613 * @static 25614 * @memberOf _ 25615 * @since 0.1.0 25616 * @category Array 25617 * @param {Array} array The array to inspect. 25618 * @returns {Array} Returns the new duplicate free array. 25619 * @example 25620 * 25621 * _.uniq([2, 1, 2]); 25622 * // => [2, 1] 25623 */ 25624 function uniq(array) { 25625 return (array && array.length) ? baseUniq(array) : []; 25626 } 25627 25628 /** 25629 * This method is like `_.uniq` except that it accepts `iteratee` which is 25630 * invoked for each element in `array` to generate the criterion by which 25631 * uniqueness is computed. The order of result values is determined by the 25632 * order they occur in the array. The iteratee is invoked with one argument: 25633 * (value). 25634 * 25635 * @static 25636 * @memberOf _ 25637 * @since 4.0.0 25638 * @category Array 25639 * @param {Array} array The array to inspect. 25640 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25641 * @returns {Array} Returns the new duplicate free array. 25642 * @example 25643 * 25644 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 25645 * // => [2.1, 1.2] 25646 * 25647 * // The `_.property` iteratee shorthand. 25648 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 25649 * // => [{ 'x': 1 }, { 'x': 2 }] 25650 */ 25651 function uniqBy(array, iteratee) { 25652 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 25653 } 25654 25655 /** 25656 * This method is like `_.uniq` except that it accepts `comparator` which 25657 * is invoked to compare elements of `array`. The order of result values is 25658 * determined by the order they occur in the array.The comparator is invoked 25659 * with two arguments: (arrVal, othVal). 25660 * 25661 * @static 25662 * @memberOf _ 25663 * @since 4.0.0 25664 * @category Array 25665 * @param {Array} array The array to inspect. 25666 * @param {Function} [comparator] The comparator invoked per element. 25667 * @returns {Array} Returns the new duplicate free array. 25668 * @example 25669 * 25670 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 25671 * 25672 * _.uniqWith(objects, _.isEqual); 25673 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 25674 */ 25675 function uniqWith(array, comparator) { 25676 comparator = typeof comparator == 'function' ? comparator : undefined; 25677 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 25678 } 25679 25680 /** 25681 * This method is like `_.zip` except that it accepts an array of grouped 25682 * elements and creates an array regrouping the elements to their pre-zip 25683 * configuration. 25684 * 25685 * @static 25686 * @memberOf _ 25687 * @since 1.2.0 25688 * @category Array 25689 * @param {Array} array The array of grouped elements to process. 25690 * @returns {Array} Returns the new array of regrouped elements. 25691 * @example 25692 * 25693 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 25694 * // => [['a', 1, true], ['b', 2, false]] 25695 * 25696 * _.unzip(zipped); 25697 * // => [['a', 'b'], [1, 2], [true, false]] 25698 */ 25699 function unzip(array) { 25700 if (!(array && array.length)) { 25701 return []; 25702 } 25703 var length = 0; 25704 array = arrayFilter(array, function(group) { 25705 if (isArrayLikeObject(group)) { 25706 length = nativeMax(group.length, length); 25707 return true; 25708 } 25709 }); 25710 return baseTimes(length, function(index) { 25711 return arrayMap(array, baseProperty(index)); 25712 }); 25713 } 25714 25715 /** 25716 * This method is like `_.unzip` except that it accepts `iteratee` to specify 25717 * how regrouped values should be combined. The iteratee is invoked with the 25718 * elements of each group: (...group). 25719 * 25720 * @static 25721 * @memberOf _ 25722 * @since 3.8.0 25723 * @category Array 25724 * @param {Array} array The array of grouped elements to process. 25725 * @param {Function} [iteratee=_.identity] The function to combine 25726 * regrouped values. 25727 * @returns {Array} Returns the new array of regrouped elements. 25728 * @example 25729 * 25730 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 25731 * // => [[1, 10, 100], [2, 20, 200]] 25732 * 25733 * _.unzipWith(zipped, _.add); 25734 * // => [3, 30, 300] 25735 */ 25736 function unzipWith(array, iteratee) { 25737 if (!(array && array.length)) { 25738 return []; 25739 } 25740 var result = unzip(array); 25741 if (iteratee == null) { 25742 return result; 25743 } 25744 return arrayMap(result, function(group) { 25745 return apply(iteratee, undefined, group); 25746 }); 25747 } 25748 25749 /** 25750 * Creates an array excluding all given values using 25751 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25752 * for equality comparisons. 25753 * 25754 * **Note:** Unlike `_.pull`, this method returns a new array. 25755 * 25756 * @static 25757 * @memberOf _ 25758 * @since 0.1.0 25759 * @category Array 25760 * @param {Array} array The array to inspect. 25761 * @param {...*} [values] The values to exclude. 25762 * @returns {Array} Returns the new array of filtered values. 25763 * @see _.difference, _.xor 25764 * @example 25765 * 25766 * _.without([2, 1, 2, 3], 1, 2); 25767 * // => [3] 25768 */ 25769 var without = baseRest(function(array, values) { 25770 return isArrayLikeObject(array) 25771 ? baseDifference(array, values) 25772 : []; 25773 }); 25774 25775 /** 25776 * Creates an array of unique values that is the 25777 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 25778 * of the given arrays. The order of result values is determined by the order 25779 * they occur in the arrays. 25780 * 25781 * @static 25782 * @memberOf _ 25783 * @since 2.4.0 25784 * @category Array 25785 * @param {...Array} [arrays] The arrays to inspect. 25786 * @returns {Array} Returns the new array of filtered values. 25787 * @see _.difference, _.without 25788 * @example 25789 * 25790 * _.xor([2, 1], [2, 3]); 25791 * // => [1, 3] 25792 */ 25793 var xor = baseRest(function(arrays) { 25794 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 25795 }); 25796 25797 /** 25798 * This method is like `_.xor` except that it accepts `iteratee` which is 25799 * invoked for each element of each `arrays` to generate the criterion by 25800 * which by which they're compared. The order of result values is determined 25801 * by the order they occur in the arrays. The iteratee is invoked with one 25802 * argument: (value). 25803 * 25804 * @static 25805 * @memberOf _ 25806 * @since 4.0.0 25807 * @category Array 25808 * @param {...Array} [arrays] The arrays to inspect. 25809 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25810 * @returns {Array} Returns the new array of filtered values. 25811 * @example 25812 * 25813 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 25814 * // => [1.2, 3.4] 25815 * 25816 * // The `_.property` iteratee shorthand. 25817 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 25818 * // => [{ 'x': 2 }] 25819 */ 25820 var xorBy = baseRest(function(arrays) { 25821 var iteratee = last(arrays); 25822 if (isArrayLikeObject(iteratee)) { 25823 iteratee = undefined; 25824 } 25825 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 25826 }); 25827 25828 /** 25829 * This method is like `_.xor` except that it accepts `comparator` which is 25830 * invoked to compare elements of `arrays`. The order of result values is 25831 * determined by the order they occur in the arrays. The comparator is invoked 25832 * with two arguments: (arrVal, othVal). 25833 * 25834 * @static 25835 * @memberOf _ 25836 * @since 4.0.0 25837 * @category Array 25838 * @param {...Array} [arrays] The arrays to inspect. 25839 * @param {Function} [comparator] The comparator invoked per element. 25840 * @returns {Array} Returns the new array of filtered values. 25841 * @example 25842 * 25843 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 25844 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 25845 * 25846 * _.xorWith(objects, others, _.isEqual); 25847 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 25848 */ 25849 var xorWith = baseRest(function(arrays) { 25850 var comparator = last(arrays); 25851 comparator = typeof comparator == 'function' ? comparator : undefined; 25852 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 25853 }); 25854 25855 /** 25856 * Creates an array of grouped elements, the first of which contains the 25857 * first elements of the given arrays, the second of which contains the 25858 * second elements of the given arrays, and so on. 25859 * 25860 * @static 25861 * @memberOf _ 25862 * @since 0.1.0 25863 * @category Array 25864 * @param {...Array} [arrays] The arrays to process. 25865 * @returns {Array} Returns the new array of grouped elements. 25866 * @example 25867 * 25868 * _.zip(['a', 'b'], [1, 2], [true, false]); 25869 * // => [['a', 1, true], ['b', 2, false]] 25870 */ 25871 var zip = baseRest(unzip); 25872 25873 /** 25874 * This method is like `_.fromPairs` except that it accepts two arrays, 25875 * one of property identifiers and one of corresponding values. 25876 * 25877 * @static 25878 * @memberOf _ 25879 * @since 0.4.0 25880 * @category Array 25881 * @param {Array} [props=[]] The property identifiers. 25882 * @param {Array} [values=[]] The property values. 25883 * @returns {Object} Returns the new object. 25884 * @example 25885 * 25886 * _.zipObject(['a', 'b'], [1, 2]); 25887 * // => { 'a': 1, 'b': 2 } 25888 */ 25889 function zipObject(props, values) { 25890 return baseZipObject(props || [], values || [], assignValue); 25891 } 25892 25893 /** 25894 * This method is like `_.zipObject` except that it supports property paths. 25895 * 25896 * @static 25897 * @memberOf _ 25898 * @since 4.1.0 25899 * @category Array 25900 * @param {Array} [props=[]] The property identifiers. 25901 * @param {Array} [values=[]] The property values. 25902 * @returns {Object} Returns the new object. 25903 * @example 25904 * 25905 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 25906 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 25907 */ 25908 function zipObjectDeep(props, values) { 25909 return baseZipObject(props || [], values || [], baseSet); 25910 } 25911 25912 /** 25913 * This method is like `_.zip` except that it accepts `iteratee` to specify 25914 * how grouped values should be combined. The iteratee is invoked with the 25915 * elements of each group: (...group). 25916 * 25917 * @static 25918 * @memberOf _ 25919 * @since 3.8.0 25920 * @category Array 25921 * @param {...Array} [arrays] The arrays to process. 25922 * @param {Function} [iteratee=_.identity] The function to combine 25923 * grouped values. 25924 * @returns {Array} Returns the new array of grouped elements. 25925 * @example 25926 * 25927 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 25928 * return a + b + c; 25929 * }); 25930 * // => [111, 222] 25931 */ 25932 var zipWith = baseRest(function(arrays) { 25933 var length = arrays.length, 25934 iteratee = length > 1 ? arrays[length - 1] : undefined; 25935 25936 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 25937 return unzipWith(arrays, iteratee); 25938 }); 25939 25940 /*------------------------------------------------------------------------*/ 25941 25942 /** 25943 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 25944 * chain sequences enabled. The result of such sequences must be unwrapped 25945 * with `_#value`. 25946 * 25947 * @static 25948 * @memberOf _ 25949 * @since 1.3.0 25950 * @category Seq 25951 * @param {*} value The value to wrap. 25952 * @returns {Object} Returns the new `lodash` wrapper instance. 25953 * @example 25954 * 25955 * var users = [ 25956 * { 'user': 'barney', 'age': 36 }, 25957 * { 'user': 'fred', 'age': 40 }, 25958 * { 'user': 'pebbles', 'age': 1 } 25959 * ]; 25960 * 25961 * var youngest = _ 25962 * .chain(users) 25963 * .sortBy('age') 25964 * .map(function(o) { 25965 * return o.user + ' is ' + o.age; 25966 * }) 25967 * .head() 25968 * .value(); 25969 * // => 'pebbles is 1' 25970 */ 25971 function chain(value) { 25972 var result = lodash(value); 25973 result.__chain__ = true; 25974 return result; 25975 } 25976 25977 /** 25978 * This method invokes `interceptor` and returns `value`. The interceptor 25979 * is invoked with one argument; (value). The purpose of this method is to 25980 * "tap into" a method chain sequence in order to modify intermediate results. 25981 * 25982 * @static 25983 * @memberOf _ 25984 * @since 0.1.0 25985 * @category Seq 25986 * @param {*} value The value to provide to `interceptor`. 25987 * @param {Function} interceptor The function to invoke. 25988 * @returns {*} Returns `value`. 25989 * @example 25990 * 25991 * _([1, 2, 3]) 25992 * .tap(function(array) { 25993 * // Mutate input array. 25994 * array.pop(); 25995 * }) 25996 * .reverse() 25997 * .value(); 25998 * // => [2, 1] 25999 */ 26000 function tap(value, interceptor) { 26001 interceptor(value); 26002 return value; 26003 } 26004 26005 /** 26006 * This method is like `_.tap` except that it returns the result of `interceptor`. 26007 * The purpose of this method is to "pass thru" values replacing intermediate 26008 * results in a method chain sequence. 26009 * 26010 * @static 26011 * @memberOf _ 26012 * @since 3.0.0 26013 * @category Seq 26014 * @param {*} value The value to provide to `interceptor`. 26015 * @param {Function} interceptor The function to invoke. 26016 * @returns {*} Returns the result of `interceptor`. 26017 * @example 26018 * 26019 * _(' abc ') 26020 * .chain() 26021 * .trim() 26022 * .thru(function(value) { 26023 * return [value]; 26024 * }) 26025 * .value(); 26026 * // => ['abc'] 26027 */ 26028 function thru(value, interceptor) { 26029 return interceptor(value); 26030 } 26031 26032 /** 26033 * This method is the wrapper version of `_.at`. 26034 * 26035 * @name at 26036 * @memberOf _ 26037 * @since 1.0.0 26038 * @category Seq 26039 * @param {...(string|string[])} [paths] The property paths to pick. 26040 * @returns {Object} Returns the new `lodash` wrapper instance. 26041 * @example 26042 * 26043 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 26044 * 26045 * _(object).at(['a[0].b.c', 'a[1]']).value(); 26046 * // => [3, 4] 26047 */ 26048 var wrapperAt = flatRest(function(paths) { 26049 var length = paths.length, 26050 start = length ? paths[0] : 0, 26051 value = this.__wrapped__, 26052 interceptor = function(object) { return baseAt(object, paths); }; 26053 26054 if (length > 1 || this.__actions__.length || 26055 !(value instanceof LazyWrapper) || !isIndex(start)) { 26056 return this.thru(interceptor); 26057 } 26058 value = value.slice(start, +start + (length ? 1 : 0)); 26059 value.__actions__.push({ 26060 'func': thru, 26061 'args': [interceptor], 26062 'thisArg': undefined 26063 }); 26064 return new LodashWrapper(value, this.__chain__).thru(function(array) { 26065 if (length && !array.length) { 26066 array.push(undefined); 26067 } 26068 return array; 26069 }); 26070 }); 26071 26072 /** 26073 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 26074 * 26075 * @name chain 26076 * @memberOf _ 26077 * @since 0.1.0 26078 * @category Seq 26079 * @returns {Object} Returns the new `lodash` wrapper instance. 26080 * @example 26081 * 26082 * var users = [ 26083 * { 'user': 'barney', 'age': 36 }, 26084 * { 'user': 'fred', 'age': 40 } 26085 * ]; 26086 * 26087 * // A sequence without explicit chaining. 26088 * _(users).head(); 26089 * // => { 'user': 'barney', 'age': 36 } 26090 * 26091 * // A sequence with explicit chaining. 26092 * _(users) 26093 * .chain() 26094 * .head() 26095 * .pick('user') 26096 * .value(); 26097 * // => { 'user': 'barney' } 26098 */ 26099 function wrapperChain() { 26100 return chain(this); 26101 } 26102 26103 /** 26104 * Executes the chain sequence and returns the wrapped result. 26105 * 26106 * @name commit 26107 * @memberOf _ 26108 * @since 3.2.0 26109 * @category Seq 26110 * @returns {Object} Returns the new `lodash` wrapper instance. 26111 * @example 26112 * 26113 * var array = [1, 2]; 26114 * var wrapped = _(array).push(3); 26115 * 26116 * console.log(array); 26117 * // => [1, 2] 26118 * 26119 * wrapped = wrapped.commit(); 26120 * console.log(array); 26121 * // => [1, 2, 3] 26122 * 26123 * wrapped.last(); 26124 * // => 3 26125 * 26126 * console.log(array); 26127 * // => [1, 2, 3] 26128 */ 26129 function wrapperCommit() { 26130 return new LodashWrapper(this.value(), this.__chain__); 26131 } 26132 26133 /** 26134 * Gets the next value on a wrapped object following the 26135 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 26136 * 26137 * @name next 26138 * @memberOf _ 26139 * @since 4.0.0 26140 * @category Seq 26141 * @returns {Object} Returns the next iterator value. 26142 * @example 26143 * 26144 * var wrapped = _([1, 2]); 26145 * 26146 * wrapped.next(); 26147 * // => { 'done': false, 'value': 1 } 26148 * 26149 * wrapped.next(); 26150 * // => { 'done': false, 'value': 2 } 26151 * 26152 * wrapped.next(); 26153 * // => { 'done': true, 'value': undefined } 26154 */ 26155 function wrapperNext() { 26156 if (this.__values__ === undefined) { 26157 this.__values__ = toArray(this.value()); 26158 } 26159 var done = this.__index__ >= this.__values__.length, 26160 value = done ? undefined : this.__values__[this.__index__++]; 26161 26162 return { 'done': done, 'value': value }; 26163 } 26164 26165 /** 26166 * Enables the wrapper to be iterable. 26167 * 26168 * @name Symbol.iterator 26169 * @memberOf _ 26170 * @since 4.0.0 26171 * @category Seq 26172 * @returns {Object} Returns the wrapper object. 26173 * @example 26174 * 26175 * var wrapped = _([1, 2]); 26176 * 26177 * wrapped[Symbol.iterator]() === wrapped; 26178 * // => true 26179 * 26180 * Array.from(wrapped); 26181 * // => [1, 2] 26182 */ 26183 function wrapperToIterator() { 26184 return this; 26185 } 26186 26187 /** 26188 * Creates a clone of the chain sequence planting `value` as the wrapped value. 26189 * 26190 * @name plant 26191 * @memberOf _ 26192 * @since 3.2.0 26193 * @category Seq 26194 * @param {*} value The value to plant. 26195 * @returns {Object} Returns the new `lodash` wrapper instance. 26196 * @example 26197 * 26198 * function square(n) { 26199 * return n * n; 26200 * } 26201 * 26202 * var wrapped = _([1, 2]).map(square); 26203 * var other = wrapped.plant([3, 4]); 26204 * 26205 * other.value(); 26206 * // => [9, 16] 26207 * 26208 * wrapped.value(); 26209 * // => [1, 4] 26210 */ 26211 function wrapperPlant(value) { 26212 var result, 26213 parent = this; 26214 26215 while (parent instanceof baseLodash) { 26216 var clone = wrapperClone(parent); 26217 clone.__index__ = 0; 26218 clone.__values__ = undefined; 26219 if (result) { 26220 previous.__wrapped__ = clone; 26221 } else { 26222 result = clone; 26223 } 26224 var previous = clone; 26225 parent = parent.__wrapped__; 26226 } 26227 previous.__wrapped__ = value; 26228 return result; 26229 } 26230 26231 /** 26232 * This method is the wrapper version of `_.reverse`. 26233 * 26234 * **Note:** This method mutates the wrapped array. 26235 * 26236 * @name reverse 26237 * @memberOf _ 26238 * @since 0.1.0 26239 * @category Seq 26240 * @returns {Object} Returns the new `lodash` wrapper instance. 26241 * @example 26242 * 26243 * var array = [1, 2, 3]; 26244 * 26245 * _(array).reverse().value() 26246 * // => [3, 2, 1] 26247 * 26248 * console.log(array); 26249 * // => [3, 2, 1] 26250 */ 26251 function wrapperReverse() { 26252 var value = this.__wrapped__; 26253 if (value instanceof LazyWrapper) { 26254 var wrapped = value; 26255 if (this.__actions__.length) { 26256 wrapped = new LazyWrapper(this); 26257 } 26258 wrapped = wrapped.reverse(); 26259 wrapped.__actions__.push({ 26260 'func': thru, 26261 'args': [reverse], 26262 'thisArg': undefined 26263 }); 26264 return new LodashWrapper(wrapped, this.__chain__); 26265 } 26266 return this.thru(reverse); 26267 } 26268 26269 /** 26270 * Executes the chain sequence to resolve the unwrapped value. 26271 * 26272 * @name value 26273 * @memberOf _ 26274 * @since 0.1.0 26275 * @alias toJSON, valueOf 26276 * @category Seq 26277 * @returns {*} Returns the resolved unwrapped value. 26278 * @example 26279 * 26280 * _([1, 2, 3]).value(); 26281 * // => [1, 2, 3] 26282 */ 26283 function wrapperValue() { 26284 return baseWrapperValue(this.__wrapped__, this.__actions__); 26285 } 26286 26287 /*------------------------------------------------------------------------*/ 26288 26289 /** 26290 * Creates an object composed of keys generated from the results of running 26291 * each element of `collection` thru `iteratee`. The corresponding value of 26292 * each key is the number of times the key was returned by `iteratee`. The 26293 * iteratee is invoked with one argument: (value). 26294 * 26295 * @static 26296 * @memberOf _ 26297 * @since 0.5.0 26298 * @category Collection 26299 * @param {Array|Object} collection The collection to iterate over. 26300 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 26301 * @returns {Object} Returns the composed aggregate object. 26302 * @example 26303 * 26304 * _.countBy([6.1, 4.2, 6.3], Math.floor); 26305 * // => { '4': 1, '6': 2 } 26306 * 26307 * // The `_.property` iteratee shorthand. 26308 * _.countBy(['one', 'two', 'three'], 'length'); 26309 * // => { '3': 2, '5': 1 } 26310 */ 26311 var countBy = createAggregator(function(result, value, key) { 26312 if (hasOwnProperty.call(result, key)) { 26313 ++result[key]; 26314 } else { 26315 baseAssignValue(result, key, 1); 26316 } 26317 }); 26318 26319 /** 26320 * Checks if `predicate` returns truthy for **all** elements of `collection`. 26321 * Iteration is stopped once `predicate` returns falsey. The predicate is 26322 * invoked with three arguments: (value, index|key, collection). 26323 * 26324 * **Note:** This method returns `true` for 26325 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 26326 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 26327 * elements of empty collections. 26328 * 26329 * @static 26330 * @memberOf _ 26331 * @since 0.1.0 26332 * @category Collection 26333 * @param {Array|Object} collection The collection to iterate over. 26334 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26335 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26336 * @returns {boolean} Returns `true` if all elements pass the predicate check, 26337 * else `false`. 26338 * @example 26339 * 26340 * _.every([true, 1, null, 'yes'], Boolean); 26341 * // => false 26342 * 26343 * var users = [ 26344 * { 'user': 'barney', 'age': 36, 'active': false }, 26345 * { 'user': 'fred', 'age': 40, 'active': false } 26346 * ]; 26347 * 26348 * // The `_.matches` iteratee shorthand. 26349 * _.every(users, { 'user': 'barney', 'active': false }); 26350 * // => false 26351 * 26352 * // The `_.matchesProperty` iteratee shorthand. 26353 * _.every(users, ['active', false]); 26354 * // => true 26355 * 26356 * // The `_.property` iteratee shorthand. 26357 * _.every(users, 'active'); 26358 * // => false 26359 */ 26360 function every(collection, predicate, guard) { 26361 var func = isArray(collection) ? arrayEvery : baseEvery; 26362 if (guard && isIterateeCall(collection, predicate, guard)) { 26363 predicate = undefined; 26364 } 26365 return func(collection, getIteratee(predicate, 3)); 26366 } 26367 26368 /** 26369 * Iterates over elements of `collection`, returning an array of all elements 26370 * `predicate` returns truthy for. The predicate is invoked with three 26371 * arguments: (value, index|key, collection). 26372 * 26373 * **Note:** Unlike `_.remove`, this method returns a new array. 26374 * 26375 * @static 26376 * @memberOf _ 26377 * @since 0.1.0 26378 * @category Collection 26379 * @param {Array|Object} collection The collection to iterate over. 26380 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26381 * @returns {Array} Returns the new filtered array. 26382 * @see _.reject 26383 * @example 26384 * 26385 * var users = [ 26386 * { 'user': 'barney', 'age': 36, 'active': true }, 26387 * { 'user': 'fred', 'age': 40, 'active': false } 26388 * ]; 26389 * 26390 * _.filter(users, function(o) { return !o.active; }); 26391 * // => objects for ['fred'] 26392 * 26393 * // The `_.matches` iteratee shorthand. 26394 * _.filter(users, { 'age': 36, 'active': true }); 26395 * // => objects for ['barney'] 26396 * 26397 * // The `_.matchesProperty` iteratee shorthand. 26398 * _.filter(users, ['active', false]); 26399 * // => objects for ['fred'] 26400 * 26401 * // The `_.property` iteratee shorthand. 26402 * _.filter(users, 'active'); 26403 * // => objects for ['barney'] 26404 * 26405 * // Combining several predicates using `_.overEvery` or `_.overSome`. 26406 * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); 26407 * // => objects for ['fred', 'barney'] 26408 */ 26409 function filter(collection, predicate) { 26410 var func = isArray(collection) ? arrayFilter : baseFilter; 26411 return func(collection, getIteratee(predicate, 3)); 26412 } 26413 26414 /** 26415 * Iterates over elements of `collection`, returning the first element 26416 * `predicate` returns truthy for. The predicate is invoked with three 26417 * arguments: (value, index|key, collection). 26418 * 26419 * @static 26420 * @memberOf _ 26421 * @since 0.1.0 26422 * @category Collection 26423 * @param {Array|Object} collection The collection to inspect. 26424 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26425 * @param {number} [fromIndex=0] The index to search from. 26426 * @returns {*} Returns the matched element, else `undefined`. 26427 * @example 26428 * 26429 * var users = [ 26430 * { 'user': 'barney', 'age': 36, 'active': true }, 26431 * { 'user': 'fred', 'age': 40, 'active': false }, 26432 * { 'user': 'pebbles', 'age': 1, 'active': true } 26433 * ]; 26434 * 26435 * _.find(users, function(o) { return o.age < 40; }); 26436 * // => object for 'barney' 26437 * 26438 * // The `_.matches` iteratee shorthand. 26439 * _.find(users, { 'age': 1, 'active': true }); 26440 * // => object for 'pebbles' 26441 * 26442 * // The `_.matchesProperty` iteratee shorthand. 26443 * _.find(users, ['active', false]); 26444 * // => object for 'fred' 26445 * 26446 * // The `_.property` iteratee shorthand. 26447 * _.find(users, 'active'); 26448 * // => object for 'barney' 26449 */ 26450 var find = createFind(findIndex); 26451 26452 /** 26453 * This method is like `_.find` except that it iterates over elements of 26454 * `collection` from right to left. 26455 * 26456 * @static 26457 * @memberOf _ 26458 * @since 2.0.0 26459 * @category Collection 26460 * @param {Array|Object} collection The collection to inspect. 26461 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26462 * @param {number} [fromIndex=collection.length-1] The index to search from. 26463 * @returns {*} Returns the matched element, else `undefined`. 26464 * @example 26465 * 26466 * _.findLast([1, 2, 3, 4], function(n) { 26467 * return n % 2 == 1; 26468 * }); 26469 * // => 3 26470 */ 26471 var findLast = createFind(findLastIndex); 26472 26473 /** 26474 * Creates a flattened array of values by running each element in `collection` 26475 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 26476 * with three arguments: (value, index|key, collection). 26477 * 26478 * @static 26479 * @memberOf _ 26480 * @since 4.0.0 26481 * @category Collection 26482 * @param {Array|Object} collection The collection to iterate over. 26483 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26484 * @returns {Array} Returns the new flattened array. 26485 * @example 26486 * 26487 * function duplicate(n) { 26488 * return [n, n]; 26489 * } 26490 * 26491 * _.flatMap([1, 2], duplicate); 26492 * // => [1, 1, 2, 2] 26493 */ 26494 function flatMap(collection, iteratee) { 26495 return baseFlatten(map(collection, iteratee), 1); 26496 } 26497 26498 /** 26499 * This method is like `_.flatMap` except that it recursively flattens the 26500 * mapped results. 26501 * 26502 * @static 26503 * @memberOf _ 26504 * @since 4.7.0 26505 * @category Collection 26506 * @param {Array|Object} collection The collection to iterate over. 26507 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26508 * @returns {Array} Returns the new flattened array. 26509 * @example 26510 * 26511 * function duplicate(n) { 26512 * return [[[n, n]]]; 26513 * } 26514 * 26515 * _.flatMapDeep([1, 2], duplicate); 26516 * // => [1, 1, 2, 2] 26517 */ 26518 function flatMapDeep(collection, iteratee) { 26519 return baseFlatten(map(collection, iteratee), INFINITY); 26520 } 26521 26522 /** 26523 * This method is like `_.flatMap` except that it recursively flattens the 26524 * mapped results up to `depth` times. 26525 * 26526 * @static 26527 * @memberOf _ 26528 * @since 4.7.0 26529 * @category Collection 26530 * @param {Array|Object} collection The collection to iterate over. 26531 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26532 * @param {number} [depth=1] The maximum recursion depth. 26533 * @returns {Array} Returns the new flattened array. 26534 * @example 26535 * 26536 * function duplicate(n) { 26537 * return [[[n, n]]]; 26538 * } 26539 * 26540 * _.flatMapDepth([1, 2], duplicate, 2); 26541 * // => [[1, 1], [2, 2]] 26542 */ 26543 function flatMapDepth(collection, iteratee, depth) { 26544 depth = depth === undefined ? 1 : toInteger(depth); 26545 return baseFlatten(map(collection, iteratee), depth); 26546 } 26547 26548 /** 26549 * Iterates over elements of `collection` and invokes `iteratee` for each element. 26550 * The iteratee is invoked with three arguments: (value, index|key, collection). 26551 * Iteratee functions may exit iteration early by explicitly returning `false`. 26552 * 26553 * **Note:** As with other "Collections" methods, objects with a "length" 26554 * property are iterated like arrays. To avoid this behavior use `_.forIn` 26555 * or `_.forOwn` for object iteration. 26556 * 26557 * @static 26558 * @memberOf _ 26559 * @since 0.1.0 26560 * @alias each 26561 * @category Collection 26562 * @param {Array|Object} collection The collection to iterate over. 26563 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26564 * @returns {Array|Object} Returns `collection`. 26565 * @see _.forEachRight 26566 * @example 26567 * 26568 * _.forEach([1, 2], function(value) { 26569 * console.log(value); 26570 * }); 26571 * // => Logs `1` then `2`. 26572 * 26573 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 26574 * console.log(key); 26575 * }); 26576 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 26577 */ 26578 function forEach(collection, iteratee) { 26579 var func = isArray(collection) ? arrayEach : baseEach; 26580 return func(collection, getIteratee(iteratee, 3)); 26581 } 26582 26583 /** 26584 * This method is like `_.forEach` except that it iterates over elements of 26585 * `collection` from right to left. 26586 * 26587 * @static 26588 * @memberOf _ 26589 * @since 2.0.0 26590 * @alias eachRight 26591 * @category Collection 26592 * @param {Array|Object} collection The collection to iterate over. 26593 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26594 * @returns {Array|Object} Returns `collection`. 26595 * @see _.forEach 26596 * @example 26597 * 26598 * _.forEachRight([1, 2], function(value) { 26599 * console.log(value); 26600 * }); 26601 * // => Logs `2` then `1`. 26602 */ 26603 function forEachRight(collection, iteratee) { 26604 var func = isArray(collection) ? arrayEachRight : baseEachRight; 26605 return func(collection, getIteratee(iteratee, 3)); 26606 } 26607 26608 /** 26609 * Creates an object composed of keys generated from the results of running 26610 * each element of `collection` thru `iteratee`. The order of grouped values 26611 * is determined by the order they occur in `collection`. The corresponding 26612 * value of each key is an array of elements responsible for generating the 26613 * key. The iteratee is invoked with one argument: (value). 26614 * 26615 * @static 26616 * @memberOf _ 26617 * @since 0.1.0 26618 * @category Collection 26619 * @param {Array|Object} collection The collection to iterate over. 26620 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 26621 * @returns {Object} Returns the composed aggregate object. 26622 * @example 26623 * 26624 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 26625 * // => { '4': [4.2], '6': [6.1, 6.3] } 26626 * 26627 * // The `_.property` iteratee shorthand. 26628 * _.groupBy(['one', 'two', 'three'], 'length'); 26629 * // => { '3': ['one', 'two'], '5': ['three'] } 26630 */ 26631 var groupBy = createAggregator(function(result, value, key) { 26632 if (hasOwnProperty.call(result, key)) { 26633 result[key].push(value); 26634 } else { 26635 baseAssignValue(result, key, [value]); 26636 } 26637 }); 26638 26639 /** 26640 * Checks if `value` is in `collection`. If `collection` is a string, it's 26641 * checked for a substring of `value`, otherwise 26642 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 26643 * is used for equality comparisons. If `fromIndex` is negative, it's used as 26644 * the offset from the end of `collection`. 26645 * 26646 * @static 26647 * @memberOf _ 26648 * @since 0.1.0 26649 * @category Collection 26650 * @param {Array|Object|string} collection The collection to inspect. 26651 * @param {*} value The value to search for. 26652 * @param {number} [fromIndex=0] The index to search from. 26653 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 26654 * @returns {boolean} Returns `true` if `value` is found, else `false`. 26655 * @example 26656 * 26657 * _.includes([1, 2, 3], 1); 26658 * // => true 26659 * 26660 * _.includes([1, 2, 3], 1, 2); 26661 * // => false 26662 * 26663 * _.includes({ 'a': 1, 'b': 2 }, 1); 26664 * // => true 26665 * 26666 * _.includes('abcd', 'bc'); 26667 * // => true 26668 */ 26669 function includes(collection, value, fromIndex, guard) { 26670 collection = isArrayLike(collection) ? collection : values(collection); 26671 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 26672 26673 var length = collection.length; 26674 if (fromIndex < 0) { 26675 fromIndex = nativeMax(length + fromIndex, 0); 26676 } 26677 return isString(collection) 26678 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 26679 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 26680 } 26681 26682 /** 26683 * Invokes the method at `path` of each element in `collection`, returning 26684 * an array of the results of each invoked method. Any additional arguments 26685 * are provided to each invoked method. If `path` is a function, it's invoked 26686 * for, and `this` bound to, each element in `collection`. 26687 * 26688 * @static 26689 * @memberOf _ 26690 * @since 4.0.0 26691 * @category Collection 26692 * @param {Array|Object} collection The collection to iterate over. 26693 * @param {Array|Function|string} path The path of the method to invoke or 26694 * the function invoked per iteration. 26695 * @param {...*} [args] The arguments to invoke each method with. 26696 * @returns {Array} Returns the array of results. 26697 * @example 26698 * 26699 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 26700 * // => [[1, 5, 7], [1, 2, 3]] 26701 * 26702 * _.invokeMap([123, 456], String.prototype.split, ''); 26703 * // => [['1', '2', '3'], ['4', '5', '6']] 26704 */ 26705 var invokeMap = baseRest(function(collection, path, args) { 26706 var index = -1, 26707 isFunc = typeof path == 'function', 26708 result = isArrayLike(collection) ? Array(collection.length) : []; 26709 26710 baseEach(collection, function(value) { 26711 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 26712 }); 26713 return result; 26714 }); 26715 26716 /** 26717 * Creates an object composed of keys generated from the results of running 26718 * each element of `collection` thru `iteratee`. The corresponding value of 26719 * each key is the last element responsible for generating the key. The 26720 * iteratee is invoked with one argument: (value). 26721 * 26722 * @static 26723 * @memberOf _ 26724 * @since 4.0.0 26725 * @category Collection 26726 * @param {Array|Object} collection The collection to iterate over. 26727 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 26728 * @returns {Object} Returns the composed aggregate object. 26729 * @example 26730 * 26731 * var array = [ 26732 * { 'dir': 'left', 'code': 97 }, 26733 * { 'dir': 'right', 'code': 100 } 26734 * ]; 26735 * 26736 * _.keyBy(array, function(o) { 26737 * return String.fromCharCode(o.code); 26738 * }); 26739 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 26740 * 26741 * _.keyBy(array, 'dir'); 26742 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 26743 */ 26744 var keyBy = createAggregator(function(result, value, key) { 26745 baseAssignValue(result, key, value); 26746 }); 26747 26748 /** 26749 * Creates an array of values by running each element in `collection` thru 26750 * `iteratee`. The iteratee is invoked with three arguments: 26751 * (value, index|key, collection). 26752 * 26753 * Many lodash methods are guarded to work as iteratees for methods like 26754 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 26755 * 26756 * The guarded methods are: 26757 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 26758 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 26759 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 26760 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 26761 * 26762 * @static 26763 * @memberOf _ 26764 * @since 0.1.0 26765 * @category Collection 26766 * @param {Array|Object} collection The collection to iterate over. 26767 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26768 * @returns {Array} Returns the new mapped array. 26769 * @example 26770 * 26771 * function square(n) { 26772 * return n * n; 26773 * } 26774 * 26775 * _.map([4, 8], square); 26776 * // => [16, 64] 26777 * 26778 * _.map({ 'a': 4, 'b': 8 }, square); 26779 * // => [16, 64] (iteration order is not guaranteed) 26780 * 26781 * var users = [ 26782 * { 'user': 'barney' }, 26783 * { 'user': 'fred' } 26784 * ]; 26785 * 26786 * // The `_.property` iteratee shorthand. 26787 * _.map(users, 'user'); 26788 * // => ['barney', 'fred'] 26789 */ 26790 function map(collection, iteratee) { 26791 var func = isArray(collection) ? arrayMap : baseMap; 26792 return func(collection, getIteratee(iteratee, 3)); 26793 } 26794 26795 /** 26796 * This method is like `_.sortBy` except that it allows specifying the sort 26797 * orders of the iteratees to sort by. If `orders` is unspecified, all values 26798 * are sorted in ascending order. Otherwise, specify an order of "desc" for 26799 * descending or "asc" for ascending sort order of corresponding values. 26800 * 26801 * @static 26802 * @memberOf _ 26803 * @since 4.0.0 26804 * @category Collection 26805 * @param {Array|Object} collection The collection to iterate over. 26806 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 26807 * The iteratees to sort by. 26808 * @param {string[]} [orders] The sort orders of `iteratees`. 26809 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 26810 * @returns {Array} Returns the new sorted array. 26811 * @example 26812 * 26813 * var users = [ 26814 * { 'user': 'fred', 'age': 48 }, 26815 * { 'user': 'barney', 'age': 34 }, 26816 * { 'user': 'fred', 'age': 40 }, 26817 * { 'user': 'barney', 'age': 36 } 26818 * ]; 26819 * 26820 * // Sort by `user` in ascending order and by `age` in descending order. 26821 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 26822 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 26823 */ 26824 function orderBy(collection, iteratees, orders, guard) { 26825 if (collection == null) { 26826 return []; 26827 } 26828 if (!isArray(iteratees)) { 26829 iteratees = iteratees == null ? [] : [iteratees]; 26830 } 26831 orders = guard ? undefined : orders; 26832 if (!isArray(orders)) { 26833 orders = orders == null ? [] : [orders]; 26834 } 26835 return baseOrderBy(collection, iteratees, orders); 26836 } 26837 26838 /** 26839 * Creates an array of elements split into two groups, the first of which 26840 * contains elements `predicate` returns truthy for, the second of which 26841 * contains elements `predicate` returns falsey for. The predicate is 26842 * invoked with one argument: (value). 26843 * 26844 * @static 26845 * @memberOf _ 26846 * @since 3.0.0 26847 * @category Collection 26848 * @param {Array|Object} collection The collection to iterate over. 26849 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26850 * @returns {Array} Returns the array of grouped elements. 26851 * @example 26852 * 26853 * var users = [ 26854 * { 'user': 'barney', 'age': 36, 'active': false }, 26855 * { 'user': 'fred', 'age': 40, 'active': true }, 26856 * { 'user': 'pebbles', 'age': 1, 'active': false } 26857 * ]; 26858 * 26859 * _.partition(users, function(o) { return o.active; }); 26860 * // => objects for [['fred'], ['barney', 'pebbles']] 26861 * 26862 * // The `_.matches` iteratee shorthand. 26863 * _.partition(users, { 'age': 1, 'active': false }); 26864 * // => objects for [['pebbles'], ['barney', 'fred']] 26865 * 26866 * // The `_.matchesProperty` iteratee shorthand. 26867 * _.partition(users, ['active', false]); 26868 * // => objects for [['barney', 'pebbles'], ['fred']] 26869 * 26870 * // The `_.property` iteratee shorthand. 26871 * _.partition(users, 'active'); 26872 * // => objects for [['fred'], ['barney', 'pebbles']] 26873 */ 26874 var partition = createAggregator(function(result, value, key) { 26875 result[key ? 0 : 1].push(value); 26876 }, function() { return [[], []]; }); 26877 26878 /** 26879 * Reduces `collection` to a value which is the accumulated result of running 26880 * each element in `collection` thru `iteratee`, where each successive 26881 * invocation is supplied the return value of the previous. If `accumulator` 26882 * is not given, the first element of `collection` is used as the initial 26883 * value. The iteratee is invoked with four arguments: 26884 * (accumulator, value, index|key, collection). 26885 * 26886 * Many lodash methods are guarded to work as iteratees for methods like 26887 * `_.reduce`, `_.reduceRight`, and `_.transform`. 26888 * 26889 * The guarded methods are: 26890 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 26891 * and `sortBy` 26892 * 26893 * @static 26894 * @memberOf _ 26895 * @since 0.1.0 26896 * @category Collection 26897 * @param {Array|Object} collection The collection to iterate over. 26898 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26899 * @param {*} [accumulator] The initial value. 26900 * @returns {*} Returns the accumulated value. 26901 * @see _.reduceRight 26902 * @example 26903 * 26904 * _.reduce([1, 2], function(sum, n) { 26905 * return sum + n; 26906 * }, 0); 26907 * // => 3 26908 * 26909 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 26910 * (result[value] || (result[value] = [])).push(key); 26911 * return result; 26912 * }, {}); 26913 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 26914 */ 26915 function reduce(collection, iteratee, accumulator) { 26916 var func = isArray(collection) ? arrayReduce : baseReduce, 26917 initAccum = arguments.length < 3; 26918 26919 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 26920 } 26921 26922 /** 26923 * This method is like `_.reduce` except that it iterates over elements of 26924 * `collection` from right to left. 26925 * 26926 * @static 26927 * @memberOf _ 26928 * @since 0.1.0 26929 * @category Collection 26930 * @param {Array|Object} collection The collection to iterate over. 26931 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26932 * @param {*} [accumulator] The initial value. 26933 * @returns {*} Returns the accumulated value. 26934 * @see _.reduce 26935 * @example 26936 * 26937 * var array = [[0, 1], [2, 3], [4, 5]]; 26938 * 26939 * _.reduceRight(array, function(flattened, other) { 26940 * return flattened.concat(other); 26941 * }, []); 26942 * // => [4, 5, 2, 3, 0, 1] 26943 */ 26944 function reduceRight(collection, iteratee, accumulator) { 26945 var func = isArray(collection) ? arrayReduceRight : baseReduce, 26946 initAccum = arguments.length < 3; 26947 26948 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 26949 } 26950 26951 /** 26952 * The opposite of `_.filter`; this method returns the elements of `collection` 26953 * that `predicate` does **not** return truthy for. 26954 * 26955 * @static 26956 * @memberOf _ 26957 * @since 0.1.0 26958 * @category Collection 26959 * @param {Array|Object} collection The collection to iterate over. 26960 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26961 * @returns {Array} Returns the new filtered array. 26962 * @see _.filter 26963 * @example 26964 * 26965 * var users = [ 26966 * { 'user': 'barney', 'age': 36, 'active': false }, 26967 * { 'user': 'fred', 'age': 40, 'active': true } 26968 * ]; 26969 * 26970 * _.reject(users, function(o) { return !o.active; }); 26971 * // => objects for ['fred'] 26972 * 26973 * // The `_.matches` iteratee shorthand. 26974 * _.reject(users, { 'age': 40, 'active': true }); 26975 * // => objects for ['barney'] 26976 * 26977 * // The `_.matchesProperty` iteratee shorthand. 26978 * _.reject(users, ['active', false]); 26979 * // => objects for ['fred'] 26980 * 26981 * // The `_.property` iteratee shorthand. 26982 * _.reject(users, 'active'); 26983 * // => objects for ['barney'] 26984 */ 26985 function reject(collection, predicate) { 26986 var func = isArray(collection) ? arrayFilter : baseFilter; 26987 return func(collection, negate(getIteratee(predicate, 3))); 26988 } 26989 26990 /** 26991 * Gets a random element from `collection`. 26992 * 26993 * @static 26994 * @memberOf _ 26995 * @since 2.0.0 26996 * @category Collection 26997 * @param {Array|Object} collection The collection to sample. 26998 * @returns {*} Returns the random element. 26999 * @example 27000 * 27001 * _.sample([1, 2, 3, 4]); 27002 * // => 2 27003 */ 27004 function sample(collection) { 27005 var func = isArray(collection) ? arraySample : baseSample; 27006 return func(collection); 27007 } 27008 27009 /** 27010 * Gets `n` random elements at unique keys from `collection` up to the 27011 * size of `collection`. 27012 * 27013 * @static 27014 * @memberOf _ 27015 * @since 4.0.0 27016 * @category Collection 27017 * @param {Array|Object} collection The collection to sample. 27018 * @param {number} [n=1] The number of elements to sample. 27019 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27020 * @returns {Array} Returns the random elements. 27021 * @example 27022 * 27023 * _.sampleSize([1, 2, 3], 2); 27024 * // => [3, 1] 27025 * 27026 * _.sampleSize([1, 2, 3], 4); 27027 * // => [2, 3, 1] 27028 */ 27029 function sampleSize(collection, n, guard) { 27030 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 27031 n = 1; 27032 } else { 27033 n = toInteger(n); 27034 } 27035 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 27036 return func(collection, n); 27037 } 27038 27039 /** 27040 * Creates an array of shuffled values, using a version of the 27041 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 27042 * 27043 * @static 27044 * @memberOf _ 27045 * @since 0.1.0 27046 * @category Collection 27047 * @param {Array|Object} collection The collection to shuffle. 27048 * @returns {Array} Returns the new shuffled array. 27049 * @example 27050 * 27051 * _.shuffle([1, 2, 3, 4]); 27052 * // => [4, 1, 3, 2] 27053 */ 27054 function shuffle(collection) { 27055 var func = isArray(collection) ? arrayShuffle : baseShuffle; 27056 return func(collection); 27057 } 27058 27059 /** 27060 * Gets the size of `collection` by returning its length for array-like 27061 * values or the number of own enumerable string keyed properties for objects. 27062 * 27063 * @static 27064 * @memberOf _ 27065 * @since 0.1.0 27066 * @category Collection 27067 * @param {Array|Object|string} collection The collection to inspect. 27068 * @returns {number} Returns the collection size. 27069 * @example 27070 * 27071 * _.size([1, 2, 3]); 27072 * // => 3 27073 * 27074 * _.size({ 'a': 1, 'b': 2 }); 27075 * // => 2 27076 * 27077 * _.size('pebbles'); 27078 * // => 7 27079 */ 27080 function size(collection) { 27081 if (collection == null) { 27082 return 0; 27083 } 27084 if (isArrayLike(collection)) { 27085 return isString(collection) ? stringSize(collection) : collection.length; 27086 } 27087 var tag = getTag(collection); 27088 if (tag == mapTag || tag == setTag) { 27089 return collection.size; 27090 } 27091 return baseKeys(collection).length; 27092 } 27093 27094 /** 27095 * Checks if `predicate` returns truthy for **any** element of `collection`. 27096 * Iteration is stopped once `predicate` returns truthy. The predicate is 27097 * invoked with three arguments: (value, index|key, collection). 27098 * 27099 * @static 27100 * @memberOf _ 27101 * @since 0.1.0 27102 * @category Collection 27103 * @param {Array|Object} collection The collection to iterate over. 27104 * @param {Function} [predicate=_.identity] The function invoked per iteration. 27105 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27106 * @returns {boolean} Returns `true` if any element passes the predicate check, 27107 * else `false`. 27108 * @example 27109 * 27110 * _.some([null, 0, 'yes', false], Boolean); 27111 * // => true 27112 * 27113 * var users = [ 27114 * { 'user': 'barney', 'active': true }, 27115 * { 'user': 'fred', 'active': false } 27116 * ]; 27117 * 27118 * // The `_.matches` iteratee shorthand. 27119 * _.some(users, { 'user': 'barney', 'active': false }); 27120 * // => false 27121 * 27122 * // The `_.matchesProperty` iteratee shorthand. 27123 * _.some(users, ['active', false]); 27124 * // => true 27125 * 27126 * // The `_.property` iteratee shorthand. 27127 * _.some(users, 'active'); 27128 * // => true 27129 */ 27130 function some(collection, predicate, guard) { 27131 var func = isArray(collection) ? arraySome : baseSome; 27132 if (guard && isIterateeCall(collection, predicate, guard)) { 27133 predicate = undefined; 27134 } 27135 return func(collection, getIteratee(predicate, 3)); 27136 } 27137 27138 /** 27139 * Creates an array of elements, sorted in ascending order by the results of 27140 * running each element in a collection thru each iteratee. This method 27141 * performs a stable sort, that is, it preserves the original sort order of 27142 * equal elements. The iteratees are invoked with one argument: (value). 27143 * 27144 * @static 27145 * @memberOf _ 27146 * @since 0.1.0 27147 * @category Collection 27148 * @param {Array|Object} collection The collection to iterate over. 27149 * @param {...(Function|Function[])} [iteratees=[_.identity]] 27150 * The iteratees to sort by. 27151 * @returns {Array} Returns the new sorted array. 27152 * @example 27153 * 27154 * var users = [ 27155 * { 'user': 'fred', 'age': 48 }, 27156 * { 'user': 'barney', 'age': 36 }, 27157 * { 'user': 'fred', 'age': 30 }, 27158 * { 'user': 'barney', 'age': 34 } 27159 * ]; 27160 * 27161 * _.sortBy(users, [function(o) { return o.user; }]); 27162 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] 27163 * 27164 * _.sortBy(users, ['user', 'age']); 27165 * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] 27166 */ 27167 var sortBy = baseRest(function(collection, iteratees) { 27168 if (collection == null) { 27169 return []; 27170 } 27171 var length = iteratees.length; 27172 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 27173 iteratees = []; 27174 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 27175 iteratees = [iteratees[0]]; 27176 } 27177 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 27178 }); 27179 27180 /*------------------------------------------------------------------------*/ 27181 27182 /** 27183 * Gets the timestamp of the number of milliseconds that have elapsed since 27184 * the Unix epoch (1 January 1970 00:00:00 UTC). 27185 * 27186 * @static 27187 * @memberOf _ 27188 * @since 2.4.0 27189 * @category Date 27190 * @returns {number} Returns the timestamp. 27191 * @example 27192 * 27193 * _.defer(function(stamp) { 27194 * console.log(_.now() - stamp); 27195 * }, _.now()); 27196 * // => Logs the number of milliseconds it took for the deferred invocation. 27197 */ 27198 var now = ctxNow || function() { 27199 return root.Date.now(); 27200 }; 27201 27202 /*------------------------------------------------------------------------*/ 27203 27204 /** 27205 * The opposite of `_.before`; this method creates a function that invokes 27206 * `func` once it's called `n` or more times. 27207 * 27208 * @static 27209 * @memberOf _ 27210 * @since 0.1.0 27211 * @category Function 27212 * @param {number} n The number of calls before `func` is invoked. 27213 * @param {Function} func The function to restrict. 27214 * @returns {Function} Returns the new restricted function. 27215 * @example 27216 * 27217 * var saves = ['profile', 'settings']; 27218 * 27219 * var done = _.after(saves.length, function() { 27220 * console.log('done saving!'); 27221 * }); 27222 * 27223 * _.forEach(saves, function(type) { 27224 * asyncSave({ 'type': type, 'complete': done }); 27225 * }); 27226 * // => Logs 'done saving!' after the two async saves have completed. 27227 */ 27228 function after(n, func) { 27229 if (typeof func != 'function') { 27230 throw new TypeError(FUNC_ERROR_TEXT); 27231 } 27232 n = toInteger(n); 27233 return function() { 27234 if (--n < 1) { 27235 return func.apply(this, arguments); 27236 } 27237 }; 27238 } 27239 27240 /** 27241 * Creates a function that invokes `func`, with up to `n` arguments, 27242 * ignoring any additional arguments. 27243 * 27244 * @static 27245 * @memberOf _ 27246 * @since 3.0.0 27247 * @category Function 27248 * @param {Function} func The function to cap arguments for. 27249 * @param {number} [n=func.length] The arity cap. 27250 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27251 * @returns {Function} Returns the new capped function. 27252 * @example 27253 * 27254 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 27255 * // => [6, 8, 10] 27256 */ 27257 function ary(func, n, guard) { 27258 n = guard ? undefined : n; 27259 n = (func && n == null) ? func.length : n; 27260 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 27261 } 27262 27263 /** 27264 * Creates a function that invokes `func`, with the `this` binding and arguments 27265 * of the created function, while it's called less than `n` times. Subsequent 27266 * calls to the created function return the result of the last `func` invocation. 27267 * 27268 * @static 27269 * @memberOf _ 27270 * @since 3.0.0 27271 * @category Function 27272 * @param {number} n The number of calls at which `func` is no longer invoked. 27273 * @param {Function} func The function to restrict. 27274 * @returns {Function} Returns the new restricted function. 27275 * @example 27276 * 27277 * jQuery(element).on('click', _.before(5, addContactToList)); 27278 * // => Allows adding up to 4 contacts to the list. 27279 */ 27280 function before(n, func) { 27281 var result; 27282 if (typeof func != 'function') { 27283 throw new TypeError(FUNC_ERROR_TEXT); 27284 } 27285 n = toInteger(n); 27286 return function() { 27287 if (--n > 0) { 27288 result = func.apply(this, arguments); 27289 } 27290 if (n <= 1) { 27291 func = undefined; 27292 } 27293 return result; 27294 }; 27295 } 27296 27297 /** 27298 * Creates a function that invokes `func` with the `this` binding of `thisArg` 27299 * and `partials` prepended to the arguments it receives. 27300 * 27301 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 27302 * may be used as a placeholder for partially applied arguments. 27303 * 27304 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 27305 * property of bound functions. 27306 * 27307 * @static 27308 * @memberOf _ 27309 * @since 0.1.0 27310 * @category Function 27311 * @param {Function} func The function to bind. 27312 * @param {*} thisArg The `this` binding of `func`. 27313 * @param {...*} [partials] The arguments to be partially applied. 27314 * @returns {Function} Returns the new bound function. 27315 * @example 27316 * 27317 * function greet(greeting, punctuation) { 27318 * return greeting + ' ' + this.user + punctuation; 27319 * } 27320 * 27321 * var object = { 'user': 'fred' }; 27322 * 27323 * var bound = _.bind(greet, object, 'hi'); 27324 * bound('!'); 27325 * // => 'hi fred!' 27326 * 27327 * // Bound with placeholders. 27328 * var bound = _.bind(greet, object, _, '!'); 27329 * bound('hi'); 27330 * // => 'hi fred!' 27331 */ 27332 var bind = baseRest(function(func, thisArg, partials) { 27333 var bitmask = WRAP_BIND_FLAG; 27334 if (partials.length) { 27335 var holders = replaceHolders(partials, getHolder(bind)); 27336 bitmask |= WRAP_PARTIAL_FLAG; 27337 } 27338 return createWrap(func, bitmask, thisArg, partials, holders); 27339 }); 27340 27341 /** 27342 * Creates a function that invokes the method at `object[key]` with `partials` 27343 * prepended to the arguments it receives. 27344 * 27345 * This method differs from `_.bind` by allowing bound functions to reference 27346 * methods that may be redefined or don't yet exist. See 27347 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 27348 * for more details. 27349 * 27350 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 27351 * builds, may be used as a placeholder for partially applied arguments. 27352 * 27353 * @static 27354 * @memberOf _ 27355 * @since 0.10.0 27356 * @category Function 27357 * @param {Object} object The object to invoke the method on. 27358 * @param {string} key The key of the method. 27359 * @param {...*} [partials] The arguments to be partially applied. 27360 * @returns {Function} Returns the new bound function. 27361 * @example 27362 * 27363 * var object = { 27364 * 'user': 'fred', 27365 * 'greet': function(greeting, punctuation) { 27366 * return greeting + ' ' + this.user + punctuation; 27367 * } 27368 * }; 27369 * 27370 * var bound = _.bindKey(object, 'greet', 'hi'); 27371 * bound('!'); 27372 * // => 'hi fred!' 27373 * 27374 * object.greet = function(greeting, punctuation) { 27375 * return greeting + 'ya ' + this.user + punctuation; 27376 * }; 27377 * 27378 * bound('!'); 27379 * // => 'hiya fred!' 27380 * 27381 * // Bound with placeholders. 27382 * var bound = _.bindKey(object, 'greet', _, '!'); 27383 * bound('hi'); 27384 * // => 'hiya fred!' 27385 */ 27386 var bindKey = baseRest(function(object, key, partials) { 27387 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 27388 if (partials.length) { 27389 var holders = replaceHolders(partials, getHolder(bindKey)); 27390 bitmask |= WRAP_PARTIAL_FLAG; 27391 } 27392 return createWrap(key, bitmask, object, partials, holders); 27393 }); 27394 27395 /** 27396 * Creates a function that accepts arguments of `func` and either invokes 27397 * `func` returning its result, if at least `arity` number of arguments have 27398 * been provided, or returns a function that accepts the remaining `func` 27399 * arguments, and so on. The arity of `func` may be specified if `func.length` 27400 * is not sufficient. 27401 * 27402 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 27403 * may be used as a placeholder for provided arguments. 27404 * 27405 * **Note:** This method doesn't set the "length" property of curried functions. 27406 * 27407 * @static 27408 * @memberOf _ 27409 * @since 2.0.0 27410 * @category Function 27411 * @param {Function} func The function to curry. 27412 * @param {number} [arity=func.length] The arity of `func`. 27413 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27414 * @returns {Function} Returns the new curried function. 27415 * @example 27416 * 27417 * var abc = function(a, b, c) { 27418 * return [a, b, c]; 27419 * }; 27420 * 27421 * var curried = _.curry(abc); 27422 * 27423 * curried(1)(2)(3); 27424 * // => [1, 2, 3] 27425 * 27426 * curried(1, 2)(3); 27427 * // => [1, 2, 3] 27428 * 27429 * curried(1, 2, 3); 27430 * // => [1, 2, 3] 27431 * 27432 * // Curried with placeholders. 27433 * curried(1)(_, 3)(2); 27434 * // => [1, 2, 3] 27435 */ 27436 function curry(func, arity, guard) { 27437 arity = guard ? undefined : arity; 27438 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 27439 result.placeholder = curry.placeholder; 27440 return result; 27441 } 27442 27443 /** 27444 * This method is like `_.curry` except that arguments are applied to `func` 27445 * in the manner of `_.partialRight` instead of `_.partial`. 27446 * 27447 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 27448 * builds, may be used as a placeholder for provided arguments. 27449 * 27450 * **Note:** This method doesn't set the "length" property of curried functions. 27451 * 27452 * @static 27453 * @memberOf _ 27454 * @since 3.0.0 27455 * @category Function 27456 * @param {Function} func The function to curry. 27457 * @param {number} [arity=func.length] The arity of `func`. 27458 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27459 * @returns {Function} Returns the new curried function. 27460 * @example 27461 * 27462 * var abc = function(a, b, c) { 27463 * return [a, b, c]; 27464 * }; 27465 * 27466 * var curried = _.curryRight(abc); 27467 * 27468 * curried(3)(2)(1); 27469 * // => [1, 2, 3] 27470 * 27471 * curried(2, 3)(1); 27472 * // => [1, 2, 3] 27473 * 27474 * curried(1, 2, 3); 27475 * // => [1, 2, 3] 27476 * 27477 * // Curried with placeholders. 27478 * curried(3)(1, _)(2); 27479 * // => [1, 2, 3] 27480 */ 27481 function curryRight(func, arity, guard) { 27482 arity = guard ? undefined : arity; 27483 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 27484 result.placeholder = curryRight.placeholder; 27485 return result; 27486 } 27487 27488 /** 27489 * Creates a debounced function that delays invoking `func` until after `wait` 27490 * milliseconds have elapsed since the last time the debounced function was 27491 * invoked. The debounced function comes with a `cancel` method to cancel 27492 * delayed `func` invocations and a `flush` method to immediately invoke them. 27493 * Provide `options` to indicate whether `func` should be invoked on the 27494 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 27495 * with the last arguments provided to the debounced function. Subsequent 27496 * calls to the debounced function return the result of the last `func` 27497 * invocation. 27498 * 27499 * **Note:** If `leading` and `trailing` options are `true`, `func` is 27500 * invoked on the trailing edge of the timeout only if the debounced function 27501 * is invoked more than once during the `wait` timeout. 27502 * 27503 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 27504 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 27505 * 27506 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 27507 * for details over the differences between `_.debounce` and `_.throttle`. 27508 * 27509 * @static 27510 * @memberOf _ 27511 * @since 0.1.0 27512 * @category Function 27513 * @param {Function} func The function to debounce. 27514 * @param {number} [wait=0] The number of milliseconds to delay. 27515 * @param {Object} [options={}] The options object. 27516 * @param {boolean} [options.leading=false] 27517 * Specify invoking on the leading edge of the timeout. 27518 * @param {number} [options.maxWait] 27519 * The maximum time `func` is allowed to be delayed before it's invoked. 27520 * @param {boolean} [options.trailing=true] 27521 * Specify invoking on the trailing edge of the timeout. 27522 * @returns {Function} Returns the new debounced function. 27523 * @example 27524 * 27525 * // Avoid costly calculations while the window size is in flux. 27526 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 27527 * 27528 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 27529 * jQuery(element).on('click', _.debounce(sendMail, 300, { 27530 * 'leading': true, 27531 * 'trailing': false 27532 * })); 27533 * 27534 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 27535 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 27536 * var source = new EventSource('/stream'); 27537 * jQuery(source).on('message', debounced); 27538 * 27539 * // Cancel the trailing debounced invocation. 27540 * jQuery(window).on('popstate', debounced.cancel); 27541 */ 27542 function debounce(func, wait, options) { 27543 var lastArgs, 27544 lastThis, 27545 maxWait, 27546 result, 27547 timerId, 27548 lastCallTime, 27549 lastInvokeTime = 0, 27550 leading = false, 27551 maxing = false, 27552 trailing = true; 27553 27554 if (typeof func != 'function') { 27555 throw new TypeError(FUNC_ERROR_TEXT); 27556 } 27557 wait = toNumber(wait) || 0; 27558 if (isObject(options)) { 27559 leading = !!options.leading; 27560 maxing = 'maxWait' in options; 27561 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 27562 trailing = 'trailing' in options ? !!options.trailing : trailing; 27563 } 27564 27565 function invokeFunc(time) { 27566 var args = lastArgs, 27567 thisArg = lastThis; 27568 27569 lastArgs = lastThis = undefined; 27570 lastInvokeTime = time; 27571 result = func.apply(thisArg, args); 27572 return result; 27573 } 27574 27575 function leadingEdge(time) { 27576 // Reset any `maxWait` timer. 27577 lastInvokeTime = time; 27578 // Start the timer for the trailing edge. 27579 timerId = setTimeout(timerExpired, wait); 27580 // Invoke the leading edge. 27581 return leading ? invokeFunc(time) : result; 27582 } 27583 27584 function remainingWait(time) { 27585 var timeSinceLastCall = time - lastCallTime, 27586 timeSinceLastInvoke = time - lastInvokeTime, 27587 timeWaiting = wait - timeSinceLastCall; 27588 27589 return maxing 27590 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 27591 : timeWaiting; 27592 } 27593 27594 function shouldInvoke(time) { 27595 var timeSinceLastCall = time - lastCallTime, 27596 timeSinceLastInvoke = time - lastInvokeTime; 27597 27598 // Either this is the first call, activity has stopped and we're at the 27599 // trailing edge, the system time has gone backwards and we're treating 27600 // it as the trailing edge, or we've hit the `maxWait` limit. 27601 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 27602 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 27603 } 27604 27605 function timerExpired() { 27606 var time = now(); 27607 if (shouldInvoke(time)) { 27608 return trailingEdge(time); 27609 } 27610 // Restart the timer. 27611 timerId = setTimeout(timerExpired, remainingWait(time)); 27612 } 27613 27614 function trailingEdge(time) { 27615 timerId = undefined; 27616 27617 // Only invoke if we have `lastArgs` which means `func` has been 27618 // debounced at least once. 27619 if (trailing && lastArgs) { 27620 return invokeFunc(time); 27621 } 27622 lastArgs = lastThis = undefined; 27623 return result; 27624 } 27625 27626 function cancel() { 27627 if (timerId !== undefined) { 27628 clearTimeout(timerId); 27629 } 27630 lastInvokeTime = 0; 27631 lastArgs = lastCallTime = lastThis = timerId = undefined; 27632 } 27633 27634 function flush() { 27635 return timerId === undefined ? result : trailingEdge(now()); 27636 } 27637 27638 function debounced() { 27639 var time = now(), 27640 isInvoking = shouldInvoke(time); 27641 27642 lastArgs = arguments; 27643 lastThis = this; 27644 lastCallTime = time; 27645 27646 if (isInvoking) { 27647 if (timerId === undefined) { 27648 return leadingEdge(lastCallTime); 27649 } 27650 if (maxing) { 27651 // Handle invocations in a tight loop. 27652 clearTimeout(timerId); 27653 timerId = setTimeout(timerExpired, wait); 27654 return invokeFunc(lastCallTime); 27655 } 27656 } 27657 if (timerId === undefined) { 27658 timerId = setTimeout(timerExpired, wait); 27659 } 27660 return result; 27661 } 27662 debounced.cancel = cancel; 27663 debounced.flush = flush; 27664 return debounced; 27665 } 27666 27667 /** 27668 * Defers invoking the `func` until the current call stack has cleared. Any 27669 * additional arguments are provided to `func` when it's invoked. 27670 * 27671 * @static 27672 * @memberOf _ 27673 * @since 0.1.0 27674 * @category Function 27675 * @param {Function} func The function to defer. 27676 * @param {...*} [args] The arguments to invoke `func` with. 27677 * @returns {number} Returns the timer id. 27678 * @example 27679 * 27680 * _.defer(function(text) { 27681 * console.log(text); 27682 * }, 'deferred'); 27683 * // => Logs 'deferred' after one millisecond. 27684 */ 27685 var defer = baseRest(function(func, args) { 27686 return baseDelay(func, 1, args); 27687 }); 27688 27689 /** 27690 * Invokes `func` after `wait` milliseconds. Any additional arguments are 27691 * provided to `func` when it's invoked. 27692 * 27693 * @static 27694 * @memberOf _ 27695 * @since 0.1.0 27696 * @category Function 27697 * @param {Function} func The function to delay. 27698 * @param {number} wait The number of milliseconds to delay invocation. 27699 * @param {...*} [args] The arguments to invoke `func` with. 27700 * @returns {number} Returns the timer id. 27701 * @example 27702 * 27703 * _.delay(function(text) { 27704 * console.log(text); 27705 * }, 1000, 'later'); 27706 * // => Logs 'later' after one second. 27707 */ 27708 var delay = baseRest(function(func, wait, args) { 27709 return baseDelay(func, toNumber(wait) || 0, args); 27710 }); 27711 27712 /** 27713 * Creates a function that invokes `func` with arguments reversed. 27714 * 27715 * @static 27716 * @memberOf _ 27717 * @since 4.0.0 27718 * @category Function 27719 * @param {Function} func The function to flip arguments for. 27720 * @returns {Function} Returns the new flipped function. 27721 * @example 27722 * 27723 * var flipped = _.flip(function() { 27724 * return _.toArray(arguments); 27725 * }); 27726 * 27727 * flipped('a', 'b', 'c', 'd'); 27728 * // => ['d', 'c', 'b', 'a'] 27729 */ 27730 function flip(func) { 27731 return createWrap(func, WRAP_FLIP_FLAG); 27732 } 27733 27734 /** 27735 * Creates a function that memoizes the result of `func`. If `resolver` is 27736 * provided, it determines the cache key for storing the result based on the 27737 * arguments provided to the memoized function. By default, the first argument 27738 * provided to the memoized function is used as the map cache key. The `func` 27739 * is invoked with the `this` binding of the memoized function. 27740 * 27741 * **Note:** The cache is exposed as the `cache` property on the memoized 27742 * function. Its creation may be customized by replacing the `_.memoize.Cache` 27743 * constructor with one whose instances implement the 27744 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 27745 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 27746 * 27747 * @static 27748 * @memberOf _ 27749 * @since 0.1.0 27750 * @category Function 27751 * @param {Function} func The function to have its output memoized. 27752 * @param {Function} [resolver] The function to resolve the cache key. 27753 * @returns {Function} Returns the new memoized function. 27754 * @example 27755 * 27756 * var object = { 'a': 1, 'b': 2 }; 27757 * var other = { 'c': 3, 'd': 4 }; 27758 * 27759 * var values = _.memoize(_.values); 27760 * values(object); 27761 * // => [1, 2] 27762 * 27763 * values(other); 27764 * // => [3, 4] 27765 * 27766 * object.a = 2; 27767 * values(object); 27768 * // => [1, 2] 27769 * 27770 * // Modify the result cache. 27771 * values.cache.set(object, ['a', 'b']); 27772 * values(object); 27773 * // => ['a', 'b'] 27774 * 27775 * // Replace `_.memoize.Cache`. 27776 * _.memoize.Cache = WeakMap; 27777 */ 27778 function memoize(func, resolver) { 27779 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 27780 throw new TypeError(FUNC_ERROR_TEXT); 27781 } 27782 var memoized = function() { 27783 var args = arguments, 27784 key = resolver ? resolver.apply(this, args) : args[0], 27785 cache = memoized.cache; 27786 27787 if (cache.has(key)) { 27788 return cache.get(key); 27789 } 27790 var result = func.apply(this, args); 27791 memoized.cache = cache.set(key, result) || cache; 27792 return result; 27793 }; 27794 memoized.cache = new (memoize.Cache || MapCache); 27795 return memoized; 27796 } 27797 27798 // Expose `MapCache`. 27799 memoize.Cache = MapCache; 27800 27801 /** 27802 * Creates a function that negates the result of the predicate `func`. The 27803 * `func` predicate is invoked with the `this` binding and arguments of the 27804 * created function. 27805 * 27806 * @static 27807 * @memberOf _ 27808 * @since 3.0.0 27809 * @category Function 27810 * @param {Function} predicate The predicate to negate. 27811 * @returns {Function} Returns the new negated function. 27812 * @example 27813 * 27814 * function isEven(n) { 27815 * return n % 2 == 0; 27816 * } 27817 * 27818 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 27819 * // => [1, 3, 5] 27820 */ 27821 function negate(predicate) { 27822 if (typeof predicate != 'function') { 27823 throw new TypeError(FUNC_ERROR_TEXT); 27824 } 27825 return function() { 27826 var args = arguments; 27827 switch (args.length) { 27828 case 0: return !predicate.call(this); 27829 case 1: return !predicate.call(this, args[0]); 27830 case 2: return !predicate.call(this, args[0], args[1]); 27831 case 3: return !predicate.call(this, args[0], args[1], args[2]); 27832 } 27833 return !predicate.apply(this, args); 27834 }; 27835 } 27836 27837 /** 27838 * Creates a function that is restricted to invoking `func` once. Repeat calls 27839 * to the function return the value of the first invocation. The `func` is 27840 * invoked with the `this` binding and arguments of the created function. 27841 * 27842 * @static 27843 * @memberOf _ 27844 * @since 0.1.0 27845 * @category Function 27846 * @param {Function} func The function to restrict. 27847 * @returns {Function} Returns the new restricted function. 27848 * @example 27849 * 27850 * var initialize = _.once(createApplication); 27851 * initialize(); 27852 * initialize(); 27853 * // => `createApplication` is invoked once 27854 */ 27855 function once(func) { 27856 return before(2, func); 27857 } 27858 27859 /** 27860 * Creates a function that invokes `func` with its arguments transformed. 27861 * 27862 * @static 27863 * @since 4.0.0 27864 * @memberOf _ 27865 * @category Function 27866 * @param {Function} func The function to wrap. 27867 * @param {...(Function|Function[])} [transforms=[_.identity]] 27868 * The argument transforms. 27869 * @returns {Function} Returns the new function. 27870 * @example 27871 * 27872 * function doubled(n) { 27873 * return n * 2; 27874 * } 27875 * 27876 * function square(n) { 27877 * return n * n; 27878 * } 27879 * 27880 * var func = _.overArgs(function(x, y) { 27881 * return [x, y]; 27882 * }, [square, doubled]); 27883 * 27884 * func(9, 3); 27885 * // => [81, 6] 27886 * 27887 * func(10, 5); 27888 * // => [100, 10] 27889 */ 27890 var overArgs = castRest(function(func, transforms) { 27891 transforms = (transforms.length == 1 && isArray(transforms[0])) 27892 ? arrayMap(transforms[0], baseUnary(getIteratee())) 27893 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 27894 27895 var funcsLength = transforms.length; 27896 return baseRest(function(args) { 27897 var index = -1, 27898 length = nativeMin(args.length, funcsLength); 27899 27900 while (++index < length) { 27901 args[index] = transforms[index].call(this, args[index]); 27902 } 27903 return apply(func, this, args); 27904 }); 27905 }); 27906 27907 /** 27908 * Creates a function that invokes `func` with `partials` prepended to the 27909 * arguments it receives. This method is like `_.bind` except it does **not** 27910 * alter the `this` binding. 27911 * 27912 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 27913 * builds, may be used as a placeholder for partially applied arguments. 27914 * 27915 * **Note:** This method doesn't set the "length" property of partially 27916 * applied functions. 27917 * 27918 * @static 27919 * @memberOf _ 27920 * @since 0.2.0 27921 * @category Function 27922 * @param {Function} func The function to partially apply arguments to. 27923 * @param {...*} [partials] The arguments to be partially applied. 27924 * @returns {Function} Returns the new partially applied function. 27925 * @example 27926 * 27927 * function greet(greeting, name) { 27928 * return greeting + ' ' + name; 27929 * } 27930 * 27931 * var sayHelloTo = _.partial(greet, 'hello'); 27932 * sayHelloTo('fred'); 27933 * // => 'hello fred' 27934 * 27935 * // Partially applied with placeholders. 27936 * var greetFred = _.partial(greet, _, 'fred'); 27937 * greetFred('hi'); 27938 * // => 'hi fred' 27939 */ 27940 var partial = baseRest(function(func, partials) { 27941 var holders = replaceHolders(partials, getHolder(partial)); 27942 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 27943 }); 27944 27945 /** 27946 * This method is like `_.partial` except that partially applied arguments 27947 * are appended to the arguments it receives. 27948 * 27949 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 27950 * builds, may be used as a placeholder for partially applied arguments. 27951 * 27952 * **Note:** This method doesn't set the "length" property of partially 27953 * applied functions. 27954 * 27955 * @static 27956 * @memberOf _ 27957 * @since 1.0.0 27958 * @category Function 27959 * @param {Function} func The function to partially apply arguments to. 27960 * @param {...*} [partials] The arguments to be partially applied. 27961 * @returns {Function} Returns the new partially applied function. 27962 * @example 27963 * 27964 * function greet(greeting, name) { 27965 * return greeting + ' ' + name; 27966 * } 27967 * 27968 * var greetFred = _.partialRight(greet, 'fred'); 27969 * greetFred('hi'); 27970 * // => 'hi fred' 27971 * 27972 * // Partially applied with placeholders. 27973 * var sayHelloTo = _.partialRight(greet, 'hello', _); 27974 * sayHelloTo('fred'); 27975 * // => 'hello fred' 27976 */ 27977 var partialRight = baseRest(function(func, partials) { 27978 var holders = replaceHolders(partials, getHolder(partialRight)); 27979 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 27980 }); 27981 27982 /** 27983 * Creates a function that invokes `func` with arguments arranged according 27984 * to the specified `indexes` where the argument value at the first index is 27985 * provided as the first argument, the argument value at the second index is 27986 * provided as the second argument, and so on. 27987 * 27988 * @static 27989 * @memberOf _ 27990 * @since 3.0.0 27991 * @category Function 27992 * @param {Function} func The function to rearrange arguments for. 27993 * @param {...(number|number[])} indexes The arranged argument indexes. 27994 * @returns {Function} Returns the new function. 27995 * @example 27996 * 27997 * var rearged = _.rearg(function(a, b, c) { 27998 * return [a, b, c]; 27999 * }, [2, 0, 1]); 28000 * 28001 * rearged('b', 'c', 'a') 28002 * // => ['a', 'b', 'c'] 28003 */ 28004 var rearg = flatRest(function(func, indexes) { 28005 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 28006 }); 28007 28008 /** 28009 * Creates a function that invokes `func` with the `this` binding of the 28010 * created function and arguments from `start` and beyond provided as 28011 * an array. 28012 * 28013 * **Note:** This method is based on the 28014 * [rest parameter](https://mdn.io/rest_parameters). 28015 * 28016 * @static 28017 * @memberOf _ 28018 * @since 4.0.0 28019 * @category Function 28020 * @param {Function} func The function to apply a rest parameter to. 28021 * @param {number} [start=func.length-1] The start position of the rest parameter. 28022 * @returns {Function} Returns the new function. 28023 * @example 28024 * 28025 * var say = _.rest(function(what, names) { 28026 * return what + ' ' + _.initial(names).join(', ') + 28027 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 28028 * }); 28029 * 28030 * say('hello', 'fred', 'barney', 'pebbles'); 28031 * // => 'hello fred, barney, & pebbles' 28032 */ 28033 function rest(func, start) { 28034 if (typeof func != 'function') { 28035 throw new TypeError(FUNC_ERROR_TEXT); 28036 } 28037 start = start === undefined ? start : toInteger(start); 28038 return baseRest(func, start); 28039 } 28040 28041 /** 28042 * Creates a function that invokes `func` with the `this` binding of the 28043 * create function and an array of arguments much like 28044 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 28045 * 28046 * **Note:** This method is based on the 28047 * [spread operator](https://mdn.io/spread_operator). 28048 * 28049 * @static 28050 * @memberOf _ 28051 * @since 3.2.0 28052 * @category Function 28053 * @param {Function} func The function to spread arguments over. 28054 * @param {number} [start=0] The start position of the spread. 28055 * @returns {Function} Returns the new function. 28056 * @example 28057 * 28058 * var say = _.spread(function(who, what) { 28059 * return who + ' says ' + what; 28060 * }); 28061 * 28062 * say(['fred', 'hello']); 28063 * // => 'fred says hello' 28064 * 28065 * var numbers = Promise.all([ 28066 * Promise.resolve(40), 28067 * Promise.resolve(36) 28068 * ]); 28069 * 28070 * numbers.then(_.spread(function(x, y) { 28071 * return x + y; 28072 * })); 28073 * // => a Promise of 76 28074 */ 28075 function spread(func, start) { 28076 if (typeof func != 'function') { 28077 throw new TypeError(FUNC_ERROR_TEXT); 28078 } 28079 start = start == null ? 0 : nativeMax(toInteger(start), 0); 28080 return baseRest(function(args) { 28081 var array = args[start], 28082 otherArgs = castSlice(args, 0, start); 28083 28084 if (array) { 28085 arrayPush(otherArgs, array); 28086 } 28087 return apply(func, this, otherArgs); 28088 }); 28089 } 28090 28091 /** 28092 * Creates a throttled function that only invokes `func` at most once per 28093 * every `wait` milliseconds. The throttled function comes with a `cancel` 28094 * method to cancel delayed `func` invocations and a `flush` method to 28095 * immediately invoke them. Provide `options` to indicate whether `func` 28096 * should be invoked on the leading and/or trailing edge of the `wait` 28097 * timeout. The `func` is invoked with the last arguments provided to the 28098 * throttled function. Subsequent calls to the throttled function return the 28099 * result of the last `func` invocation. 28100 * 28101 * **Note:** If `leading` and `trailing` options are `true`, `func` is 28102 * invoked on the trailing edge of the timeout only if the throttled function 28103 * is invoked more than once during the `wait` timeout. 28104 * 28105 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 28106 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 28107 * 28108 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 28109 * for details over the differences between `_.throttle` and `_.debounce`. 28110 * 28111 * @static 28112 * @memberOf _ 28113 * @since 0.1.0 28114 * @category Function 28115 * @param {Function} func The function to throttle. 28116 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 28117 * @param {Object} [options={}] The options object. 28118 * @param {boolean} [options.leading=true] 28119 * Specify invoking on the leading edge of the timeout. 28120 * @param {boolean} [options.trailing=true] 28121 * Specify invoking on the trailing edge of the timeout. 28122 * @returns {Function} Returns the new throttled function. 28123 * @example 28124 * 28125 * // Avoid excessively updating the position while scrolling. 28126 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 28127 * 28128 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 28129 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 28130 * jQuery(element).on('click', throttled); 28131 * 28132 * // Cancel the trailing throttled invocation. 28133 * jQuery(window).on('popstate', throttled.cancel); 28134 */ 28135 function throttle(func, wait, options) { 28136 var leading = true, 28137 trailing = true; 28138 28139 if (typeof func != 'function') { 28140 throw new TypeError(FUNC_ERROR_TEXT); 28141 } 28142 if (isObject(options)) { 28143 leading = 'leading' in options ? !!options.leading : leading; 28144 trailing = 'trailing' in options ? !!options.trailing : trailing; 28145 } 28146 return debounce(func, wait, { 28147 'leading': leading, 28148 'maxWait': wait, 28149 'trailing': trailing 28150 }); 28151 } 28152 28153 /** 28154 * Creates a function that accepts up to one argument, ignoring any 28155 * additional arguments. 28156 * 28157 * @static 28158 * @memberOf _ 28159 * @since 4.0.0 28160 * @category Function 28161 * @param {Function} func The function to cap arguments for. 28162 * @returns {Function} Returns the new capped function. 28163 * @example 28164 * 28165 * _.map(['6', '8', '10'], _.unary(parseInt)); 28166 * // => [6, 8, 10] 28167 */ 28168 function unary(func) { 28169 return ary(func, 1); 28170 } 28171 28172 /** 28173 * Creates a function that provides `value` to `wrapper` as its first 28174 * argument. Any additional arguments provided to the function are appended 28175 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 28176 * binding of the created function. 28177 * 28178 * @static 28179 * @memberOf _ 28180 * @since 0.1.0 28181 * @category Function 28182 * @param {*} value The value to wrap. 28183 * @param {Function} [wrapper=identity] The wrapper function. 28184 * @returns {Function} Returns the new function. 28185 * @example 28186 * 28187 * var p = _.wrap(_.escape, function(func, text) { 28188 * return '<p>' + func(text) + '</p>'; 28189 * }); 28190 * 28191 * p('fred, barney, & pebbles'); 28192 * // => '<p>fred, barney, & pebbles</p>' 28193 */ 28194 function wrap(value, wrapper) { 28195 return partial(castFunction(wrapper), value); 28196 } 28197 28198 /*------------------------------------------------------------------------*/ 28199 28200 /** 28201 * Casts `value` as an array if it's not one. 28202 * 28203 * @static 28204 * @memberOf _ 28205 * @since 4.4.0 28206 * @category Lang 28207 * @param {*} value The value to inspect. 28208 * @returns {Array} Returns the cast array. 28209 * @example 28210 * 28211 * _.castArray(1); 28212 * // => [1] 28213 * 28214 * _.castArray({ 'a': 1 }); 28215 * // => [{ 'a': 1 }] 28216 * 28217 * _.castArray('abc'); 28218 * // => ['abc'] 28219 * 28220 * _.castArray(null); 28221 * // => [null] 28222 * 28223 * _.castArray(undefined); 28224 * // => [undefined] 28225 * 28226 * _.castArray(); 28227 * // => [] 28228 * 28229 * var array = [1, 2, 3]; 28230 * console.log(_.castArray(array) === array); 28231 * // => true 28232 */ 28233 function castArray() { 28234 if (!arguments.length) { 28235 return []; 28236 } 28237 var value = arguments[0]; 28238 return isArray(value) ? value : [value]; 28239 } 28240 28241 /** 28242 * Creates a shallow clone of `value`. 28243 * 28244 * **Note:** This method is loosely based on the 28245 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 28246 * and supports cloning arrays, array buffers, booleans, date objects, maps, 28247 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 28248 * arrays. The own enumerable properties of `arguments` objects are cloned 28249 * as plain objects. An empty object is returned for uncloneable values such 28250 * as error objects, functions, DOM nodes, and WeakMaps. 28251 * 28252 * @static 28253 * @memberOf _ 28254 * @since 0.1.0 28255 * @category Lang 28256 * @param {*} value The value to clone. 28257 * @returns {*} Returns the cloned value. 28258 * @see _.cloneDeep 28259 * @example 28260 * 28261 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 28262 * 28263 * var shallow = _.clone(objects); 28264 * console.log(shallow[0] === objects[0]); 28265 * // => true 28266 */ 28267 function clone(value) { 28268 return baseClone(value, CLONE_SYMBOLS_FLAG); 28269 } 28270 28271 /** 28272 * This method is like `_.clone` except that it accepts `customizer` which 28273 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 28274 * cloning is handled by the method instead. The `customizer` is invoked with 28275 * up to four arguments; (value [, index|key, object, stack]). 28276 * 28277 * @static 28278 * @memberOf _ 28279 * @since 4.0.0 28280 * @category Lang 28281 * @param {*} value The value to clone. 28282 * @param {Function} [customizer] The function to customize cloning. 28283 * @returns {*} Returns the cloned value. 28284 * @see _.cloneDeepWith 28285 * @example 28286 * 28287 * function customizer(value) { 28288 * if (_.isElement(value)) { 28289 * return value.cloneNode(false); 28290 * } 28291 * } 28292 * 28293 * var el = _.cloneWith(document.body, customizer); 28294 * 28295 * console.log(el === document.body); 28296 * // => false 28297 * console.log(el.nodeName); 28298 * // => 'BODY' 28299 * console.log(el.childNodes.length); 28300 * // => 0 28301 */ 28302 function cloneWith(value, customizer) { 28303 customizer = typeof customizer == 'function' ? customizer : undefined; 28304 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 28305 } 28306 28307 /** 28308 * This method is like `_.clone` except that it recursively clones `value`. 28309 * 28310 * @static 28311 * @memberOf _ 28312 * @since 1.0.0 28313 * @category Lang 28314 * @param {*} value The value to recursively clone. 28315 * @returns {*} Returns the deep cloned value. 28316 * @see _.clone 28317 * @example 28318 * 28319 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 28320 * 28321 * var deep = _.cloneDeep(objects); 28322 * console.log(deep[0] === objects[0]); 28323 * // => false 28324 */ 28325 function cloneDeep(value) { 28326 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 28327 } 28328 28329 /** 28330 * This method is like `_.cloneWith` except that it recursively clones `value`. 28331 * 28332 * @static 28333 * @memberOf _ 28334 * @since 4.0.0 28335 * @category Lang 28336 * @param {*} value The value to recursively clone. 28337 * @param {Function} [customizer] The function to customize cloning. 28338 * @returns {*} Returns the deep cloned value. 28339 * @see _.cloneWith 28340 * @example 28341 * 28342 * function customizer(value) { 28343 * if (_.isElement(value)) { 28344 * return value.cloneNode(true); 28345 * } 28346 * } 28347 * 28348 * var el = _.cloneDeepWith(document.body, customizer); 28349 * 28350 * console.log(el === document.body); 28351 * // => false 28352 * console.log(el.nodeName); 28353 * // => 'BODY' 28354 * console.log(el.childNodes.length); 28355 * // => 20 28356 */ 28357 function cloneDeepWith(value, customizer) { 28358 customizer = typeof customizer == 'function' ? customizer : undefined; 28359 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 28360 } 28361 28362 /** 28363 * Checks if `object` conforms to `source` by invoking the predicate 28364 * properties of `source` with the corresponding property values of `object`. 28365 * 28366 * **Note:** This method is equivalent to `_.conforms` when `source` is 28367 * partially applied. 28368 * 28369 * @static 28370 * @memberOf _ 28371 * @since 4.14.0 28372 * @category Lang 28373 * @param {Object} object The object to inspect. 28374 * @param {Object} source The object of property predicates to conform to. 28375 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 28376 * @example 28377 * 28378 * var object = { 'a': 1, 'b': 2 }; 28379 * 28380 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 28381 * // => true 28382 * 28383 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 28384 * // => false 28385 */ 28386 function conformsTo(object, source) { 28387 return source == null || baseConformsTo(object, source, keys(source)); 28388 } 28389 28390 /** 28391 * Performs a 28392 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 28393 * comparison between two values to determine if they are equivalent. 28394 * 28395 * @static 28396 * @memberOf _ 28397 * @since 4.0.0 28398 * @category Lang 28399 * @param {*} value The value to compare. 28400 * @param {*} other The other value to compare. 28401 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 28402 * @example 28403 * 28404 * var object = { 'a': 1 }; 28405 * var other = { 'a': 1 }; 28406 * 28407 * _.eq(object, object); 28408 * // => true 28409 * 28410 * _.eq(object, other); 28411 * // => false 28412 * 28413 * _.eq('a', 'a'); 28414 * // => true 28415 * 28416 * _.eq('a', Object('a')); 28417 * // => false 28418 * 28419 * _.eq(NaN, NaN); 28420 * // => true 28421 */ 28422 function eq(value, other) { 28423 return value === other || (value !== value && other !== other); 28424 } 28425 28426 /** 28427 * Checks if `value` is greater than `other`. 28428 * 28429 * @static 28430 * @memberOf _ 28431 * @since 3.9.0 28432 * @category Lang 28433 * @param {*} value The value to compare. 28434 * @param {*} other The other value to compare. 28435 * @returns {boolean} Returns `true` if `value` is greater than `other`, 28436 * else `false`. 28437 * @see _.lt 28438 * @example 28439 * 28440 * _.gt(3, 1); 28441 * // => true 28442 * 28443 * _.gt(3, 3); 28444 * // => false 28445 * 28446 * _.gt(1, 3); 28447 * // => false 28448 */ 28449 var gt = createRelationalOperation(baseGt); 28450 28451 /** 28452 * Checks if `value` is greater than or equal to `other`. 28453 * 28454 * @static 28455 * @memberOf _ 28456 * @since 3.9.0 28457 * @category Lang 28458 * @param {*} value The value to compare. 28459 * @param {*} other The other value to compare. 28460 * @returns {boolean} Returns `true` if `value` is greater than or equal to 28461 * `other`, else `false`. 28462 * @see _.lte 28463 * @example 28464 * 28465 * _.gte(3, 1); 28466 * // => true 28467 * 28468 * _.gte(3, 3); 28469 * // => true 28470 * 28471 * _.gte(1, 3); 28472 * // => false 28473 */ 28474 var gte = createRelationalOperation(function(value, other) { 28475 return value >= other; 28476 }); 28477 28478 /** 28479 * Checks if `value` is likely an `arguments` object. 28480 * 28481 * @static 28482 * @memberOf _ 28483 * @since 0.1.0 28484 * @category Lang 28485 * @param {*} value The value to check. 28486 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 28487 * else `false`. 28488 * @example 28489 * 28490 * _.isArguments(function() { return arguments; }()); 28491 * // => true 28492 * 28493 * _.isArguments([1, 2, 3]); 28494 * // => false 28495 */ 28496 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 28497 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 28498 !propertyIsEnumerable.call(value, 'callee'); 28499 }; 28500 28501 /** 28502 * Checks if `value` is classified as an `Array` object. 28503 * 28504 * @static 28505 * @memberOf _ 28506 * @since 0.1.0 28507 * @category Lang 28508 * @param {*} value The value to check. 28509 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 28510 * @example 28511 * 28512 * _.isArray([1, 2, 3]); 28513 * // => true 28514 * 28515 * _.isArray(document.body.children); 28516 * // => false 28517 * 28518 * _.isArray('abc'); 28519 * // => false 28520 * 28521 * _.isArray(_.noop); 28522 * // => false 28523 */ 28524 var isArray = Array.isArray; 28525 28526 /** 28527 * Checks if `value` is classified as an `ArrayBuffer` object. 28528 * 28529 * @static 28530 * @memberOf _ 28531 * @since 4.3.0 28532 * @category Lang 28533 * @param {*} value The value to check. 28534 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 28535 * @example 28536 * 28537 * _.isArrayBuffer(new ArrayBuffer(2)); 28538 * // => true 28539 * 28540 * _.isArrayBuffer(new Array(2)); 28541 * // => false 28542 */ 28543 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 28544 28545 /** 28546 * Checks if `value` is array-like. A value is considered array-like if it's 28547 * not a function and has a `value.length` that's an integer greater than or 28548 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 28549 * 28550 * @static 28551 * @memberOf _ 28552 * @since 4.0.0 28553 * @category Lang 28554 * @param {*} value The value to check. 28555 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 28556 * @example 28557 * 28558 * _.isArrayLike([1, 2, 3]); 28559 * // => true 28560 * 28561 * _.isArrayLike(document.body.children); 28562 * // => true 28563 * 28564 * _.isArrayLike('abc'); 28565 * // => true 28566 * 28567 * _.isArrayLike(_.noop); 28568 * // => false 28569 */ 28570 function isArrayLike(value) { 28571 return value != null && isLength(value.length) && !isFunction(value); 28572 } 28573 28574 /** 28575 * This method is like `_.isArrayLike` except that it also checks if `value` 28576 * is an object. 28577 * 28578 * @static 28579 * @memberOf _ 28580 * @since 4.0.0 28581 * @category Lang 28582 * @param {*} value The value to check. 28583 * @returns {boolean} Returns `true` if `value` is an array-like object, 28584 * else `false`. 28585 * @example 28586 * 28587 * _.isArrayLikeObject([1, 2, 3]); 28588 * // => true 28589 * 28590 * _.isArrayLikeObject(document.body.children); 28591 * // => true 28592 * 28593 * _.isArrayLikeObject('abc'); 28594 * // => false 28595 * 28596 * _.isArrayLikeObject(_.noop); 28597 * // => false 28598 */ 28599 function isArrayLikeObject(value) { 28600 return isObjectLike(value) && isArrayLike(value); 28601 } 28602 28603 /** 28604 * Checks if `value` is classified as a boolean primitive or object. 28605 * 28606 * @static 28607 * @memberOf _ 28608 * @since 0.1.0 28609 * @category Lang 28610 * @param {*} value The value to check. 28611 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 28612 * @example 28613 * 28614 * _.isBoolean(false); 28615 * // => true 28616 * 28617 * _.isBoolean(null); 28618 * // => false 28619 */ 28620 function isBoolean(value) { 28621 return value === true || value === false || 28622 (isObjectLike(value) && baseGetTag(value) == boolTag); 28623 } 28624 28625 /** 28626 * Checks if `value` is a buffer. 28627 * 28628 * @static 28629 * @memberOf _ 28630 * @since 4.3.0 28631 * @category Lang 28632 * @param {*} value The value to check. 28633 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 28634 * @example 28635 * 28636 * _.isBuffer(new Buffer(2)); 28637 * // => true 28638 * 28639 * _.isBuffer(new Uint8Array(2)); 28640 * // => false 28641 */ 28642 var isBuffer = nativeIsBuffer || stubFalse; 28643 28644 /** 28645 * Checks if `value` is classified as a `Date` object. 28646 * 28647 * @static 28648 * @memberOf _ 28649 * @since 0.1.0 28650 * @category Lang 28651 * @param {*} value The value to check. 28652 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 28653 * @example 28654 * 28655 * _.isDate(new Date); 28656 * // => true 28657 * 28658 * _.isDate('Mon April 23 2012'); 28659 * // => false 28660 */ 28661 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 28662 28663 /** 28664 * Checks if `value` is likely a DOM element. 28665 * 28666 * @static 28667 * @memberOf _ 28668 * @since 0.1.0 28669 * @category Lang 28670 * @param {*} value The value to check. 28671 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 28672 * @example 28673 * 28674 * _.isElement(document.body); 28675 * // => true 28676 * 28677 * _.isElement('<body>'); 28678 * // => false 28679 */ 28680 function isElement(value) { 28681 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 28682 } 28683 28684 /** 28685 * Checks if `value` is an empty object, collection, map, or set. 28686 * 28687 * Objects are considered empty if they have no own enumerable string keyed 28688 * properties. 28689 * 28690 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 28691 * jQuery-like collections are considered empty if they have a `length` of `0`. 28692 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 28693 * 28694 * @static 28695 * @memberOf _ 28696 * @since 0.1.0 28697 * @category Lang 28698 * @param {*} value The value to check. 28699 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 28700 * @example 28701 * 28702 * _.isEmpty(null); 28703 * // => true 28704 * 28705 * _.isEmpty(true); 28706 * // => true 28707 * 28708 * _.isEmpty(1); 28709 * // => true 28710 * 28711 * _.isEmpty([1, 2, 3]); 28712 * // => false 28713 * 28714 * _.isEmpty({ 'a': 1 }); 28715 * // => false 28716 */ 28717 function isEmpty(value) { 28718 if (value == null) { 28719 return true; 28720 } 28721 if (isArrayLike(value) && 28722 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 28723 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 28724 return !value.length; 28725 } 28726 var tag = getTag(value); 28727 if (tag == mapTag || tag == setTag) { 28728 return !value.size; 28729 } 28730 if (isPrototype(value)) { 28731 return !baseKeys(value).length; 28732 } 28733 for (var key in value) { 28734 if (hasOwnProperty.call(value, key)) { 28735 return false; 28736 } 28737 } 28738 return true; 28739 } 28740 28741 /** 28742 * Performs a deep comparison between two values to determine if they are 28743 * equivalent. 28744 * 28745 * **Note:** This method supports comparing arrays, array buffers, booleans, 28746 * date objects, error objects, maps, numbers, `Object` objects, regexes, 28747 * sets, strings, symbols, and typed arrays. `Object` objects are compared 28748 * by their own, not inherited, enumerable properties. Functions and DOM 28749 * nodes are compared by strict equality, i.e. `===`. 28750 * 28751 * @static 28752 * @memberOf _ 28753 * @since 0.1.0 28754 * @category Lang 28755 * @param {*} value The value to compare. 28756 * @param {*} other The other value to compare. 28757 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 28758 * @example 28759 * 28760 * var object = { 'a': 1 }; 28761 * var other = { 'a': 1 }; 28762 * 28763 * _.isEqual(object, other); 28764 * // => true 28765 * 28766 * object === other; 28767 * // => false 28768 */ 28769 function isEqual(value, other) { 28770 return baseIsEqual(value, other); 28771 } 28772 28773 /** 28774 * This method is like `_.isEqual` except that it accepts `customizer` which 28775 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 28776 * are handled by the method instead. The `customizer` is invoked with up to 28777 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 28778 * 28779 * @static 28780 * @memberOf _ 28781 * @since 4.0.0 28782 * @category Lang 28783 * @param {*} value The value to compare. 28784 * @param {*} other The other value to compare. 28785 * @param {Function} [customizer] The function to customize comparisons. 28786 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 28787 * @example 28788 * 28789 * function isGreeting(value) { 28790 * return /^h(?:i|ello)$/.test(value); 28791 * } 28792 * 28793 * function customizer(objValue, othValue) { 28794 * if (isGreeting(objValue) && isGreeting(othValue)) { 28795 * return true; 28796 * } 28797 * } 28798 * 28799 * var array = ['hello', 'goodbye']; 28800 * var other = ['hi', 'goodbye']; 28801 * 28802 * _.isEqualWith(array, other, customizer); 28803 * // => true 28804 */ 28805 function isEqualWith(value, other, customizer) { 28806 customizer = typeof customizer == 'function' ? customizer : undefined; 28807 var result = customizer ? customizer(value, other) : undefined; 28808 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; 28809 } 28810 28811 /** 28812 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 28813 * `SyntaxError`, `TypeError`, or `URIError` object. 28814 * 28815 * @static 28816 * @memberOf _ 28817 * @since 3.0.0 28818 * @category Lang 28819 * @param {*} value The value to check. 28820 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 28821 * @example 28822 * 28823 * _.isError(new Error); 28824 * // => true 28825 * 28826 * _.isError(Error); 28827 * // => false 28828 */ 28829 function isError(value) { 28830 if (!isObjectLike(value)) { 28831 return false; 28832 } 28833 var tag = baseGetTag(value); 28834 return tag == errorTag || tag == domExcTag || 28835 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 28836 } 28837 28838 /** 28839 * Checks if `value` is a finite primitive number. 28840 * 28841 * **Note:** This method is based on 28842 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 28843 * 28844 * @static 28845 * @memberOf _ 28846 * @since 0.1.0 28847 * @category Lang 28848 * @param {*} value The value to check. 28849 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 28850 * @example 28851 * 28852 * _.isFinite(3); 28853 * // => true 28854 * 28855 * _.isFinite(Number.MIN_VALUE); 28856 * // => true 28857 * 28858 * _.isFinite(Infinity); 28859 * // => false 28860 * 28861 * _.isFinite('3'); 28862 * // => false 28863 */ 28864 function isFinite(value) { 28865 return typeof value == 'number' && nativeIsFinite(value); 28866 } 28867 28868 /** 28869 * Checks if `value` is classified as a `Function` object. 28870 * 28871 * @static 28872 * @memberOf _ 28873 * @since 0.1.0 28874 * @category Lang 28875 * @param {*} value The value to check. 28876 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 28877 * @example 28878 * 28879 * _.isFunction(_); 28880 * // => true 28881 * 28882 * _.isFunction(/abc/); 28883 * // => false 28884 */ 28885 function isFunction(value) { 28886 if (!isObject(value)) { 28887 return false; 28888 } 28889 // The use of `Object#toString` avoids issues with the `typeof` operator 28890 // in Safari 9 which returns 'object' for typed arrays and other constructors. 28891 var tag = baseGetTag(value); 28892 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 28893 } 28894 28895 /** 28896 * Checks if `value` is an integer. 28897 * 28898 * **Note:** This method is based on 28899 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 28900 * 28901 * @static 28902 * @memberOf _ 28903 * @since 4.0.0 28904 * @category Lang 28905 * @param {*} value The value to check. 28906 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 28907 * @example 28908 * 28909 * _.isInteger(3); 28910 * // => true 28911 * 28912 * _.isInteger(Number.MIN_VALUE); 28913 * // => false 28914 * 28915 * _.isInteger(Infinity); 28916 * // => false 28917 * 28918 * _.isInteger('3'); 28919 * // => false 28920 */ 28921 function isInteger(value) { 28922 return typeof value == 'number' && value == toInteger(value); 28923 } 28924 28925 /** 28926 * Checks if `value` is a valid array-like length. 28927 * 28928 * **Note:** This method is loosely based on 28929 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 28930 * 28931 * @static 28932 * @memberOf _ 28933 * @since 4.0.0 28934 * @category Lang 28935 * @param {*} value The value to check. 28936 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 28937 * @example 28938 * 28939 * _.isLength(3); 28940 * // => true 28941 * 28942 * _.isLength(Number.MIN_VALUE); 28943 * // => false 28944 * 28945 * _.isLength(Infinity); 28946 * // => false 28947 * 28948 * _.isLength('3'); 28949 * // => false 28950 */ 28951 function isLength(value) { 28952 return typeof value == 'number' && 28953 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 28954 } 28955 28956 /** 28957 * Checks if `value` is the 28958 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 28959 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 28960 * 28961 * @static 28962 * @memberOf _ 28963 * @since 0.1.0 28964 * @category Lang 28965 * @param {*} value The value to check. 28966 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 28967 * @example 28968 * 28969 * _.isObject({}); 28970 * // => true 28971 * 28972 * _.isObject([1, 2, 3]); 28973 * // => true 28974 * 28975 * _.isObject(_.noop); 28976 * // => true 28977 * 28978 * _.isObject(null); 28979 * // => false 28980 */ 28981 function isObject(value) { 28982 var type = typeof value; 28983 return value != null && (type == 'object' || type == 'function'); 28984 } 28985 28986 /** 28987 * Checks if `value` is object-like. A value is object-like if it's not `null` 28988 * and has a `typeof` result of "object". 28989 * 28990 * @static 28991 * @memberOf _ 28992 * @since 4.0.0 28993 * @category Lang 28994 * @param {*} value The value to check. 28995 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 28996 * @example 28997 * 28998 * _.isObjectLike({}); 28999 * // => true 29000 * 29001 * _.isObjectLike([1, 2, 3]); 29002 * // => true 29003 * 29004 * _.isObjectLike(_.noop); 29005 * // => false 29006 * 29007 * _.isObjectLike(null); 29008 * // => false 29009 */ 29010 function isObjectLike(value) { 29011 return value != null && typeof value == 'object'; 29012 } 29013 29014 /** 29015 * Checks if `value` is classified as a `Map` object. 29016 * 29017 * @static 29018 * @memberOf _ 29019 * @since 4.3.0 29020 * @category Lang 29021 * @param {*} value The value to check. 29022 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 29023 * @example 29024 * 29025 * _.isMap(new Map); 29026 * // => true 29027 * 29028 * _.isMap(new WeakMap); 29029 * // => false 29030 */ 29031 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 29032 29033 /** 29034 * Performs a partial deep comparison between `object` and `source` to 29035 * determine if `object` contains equivalent property values. 29036 * 29037 * **Note:** This method is equivalent to `_.matches` when `source` is 29038 * partially applied. 29039 * 29040 * Partial comparisons will match empty array and empty object `source` 29041 * values against any array or object value, respectively. See `_.isEqual` 29042 * for a list of supported value comparisons. 29043 * 29044 * @static 29045 * @memberOf _ 29046 * @since 3.0.0 29047 * @category Lang 29048 * @param {Object} object The object to inspect. 29049 * @param {Object} source The object of property values to match. 29050 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 29051 * @example 29052 * 29053 * var object = { 'a': 1, 'b': 2 }; 29054 * 29055 * _.isMatch(object, { 'b': 2 }); 29056 * // => true 29057 * 29058 * _.isMatch(object, { 'b': 1 }); 29059 * // => false 29060 */ 29061 function isMatch(object, source) { 29062 return object === source || baseIsMatch(object, source, getMatchData(source)); 29063 } 29064 29065 /** 29066 * This method is like `_.isMatch` except that it accepts `customizer` which 29067 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 29068 * are handled by the method instead. The `customizer` is invoked with five 29069 * arguments: (objValue, srcValue, index|key, object, source). 29070 * 29071 * @static 29072 * @memberOf _ 29073 * @since 4.0.0 29074 * @category Lang 29075 * @param {Object} object The object to inspect. 29076 * @param {Object} source The object of property values to match. 29077 * @param {Function} [customizer] The function to customize comparisons. 29078 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 29079 * @example 29080 * 29081 * function isGreeting(value) { 29082 * return /^h(?:i|ello)$/.test(value); 29083 * } 29084 * 29085 * function customizer(objValue, srcValue) { 29086 * if (isGreeting(objValue) && isGreeting(srcValue)) { 29087 * return true; 29088 * } 29089 * } 29090 * 29091 * var object = { 'greeting': 'hello' }; 29092 * var source = { 'greeting': 'hi' }; 29093 * 29094 * _.isMatchWith(object, source, customizer); 29095 * // => true 29096 */ 29097 function isMatchWith(object, source, customizer) { 29098 customizer = typeof customizer == 'function' ? customizer : undefined; 29099 return baseIsMatch(object, source, getMatchData(source), customizer); 29100 } 29101 29102 /** 29103 * Checks if `value` is `NaN`. 29104 * 29105 * **Note:** This method is based on 29106 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 29107 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 29108 * `undefined` and other non-number values. 29109 * 29110 * @static 29111 * @memberOf _ 29112 * @since 0.1.0 29113 * @category Lang 29114 * @param {*} value The value to check. 29115 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 29116 * @example 29117 * 29118 * _.isNaN(NaN); 29119 * // => true 29120 * 29121 * _.isNaN(new Number(NaN)); 29122 * // => true 29123 * 29124 * isNaN(undefined); 29125 * // => true 29126 * 29127 * _.isNaN(undefined); 29128 * // => false 29129 */ 29130 function isNaN(value) { 29131 // An `NaN` primitive is the only value that is not equal to itself. 29132 // Perform the `toStringTag` check first to avoid errors with some 29133 // ActiveX objects in IE. 29134 return isNumber(value) && value != +value; 29135 } 29136 29137 /** 29138 * Checks if `value` is a pristine native function. 29139 * 29140 * **Note:** This method can't reliably detect native functions in the presence 29141 * of the core-js package because core-js circumvents this kind of detection. 29142 * Despite multiple requests, the core-js maintainer has made it clear: any 29143 * attempt to fix the detection will be obstructed. As a result, we're left 29144 * with little choice but to throw an error. Unfortunately, this also affects 29145 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 29146 * which rely on core-js. 29147 * 29148 * @static 29149 * @memberOf _ 29150 * @since 3.0.0 29151 * @category Lang 29152 * @param {*} value The value to check. 29153 * @returns {boolean} Returns `true` if `value` is a native function, 29154 * else `false`. 29155 * @example 29156 * 29157 * _.isNative(Array.prototype.push); 29158 * // => true 29159 * 29160 * _.isNative(_); 29161 * // => false 29162 */ 29163 function isNative(value) { 29164 if (isMaskable(value)) { 29165 throw new Error(CORE_ERROR_TEXT); 29166 } 29167 return baseIsNative(value); 29168 } 29169 29170 /** 29171 * Checks if `value` is `null`. 29172 * 29173 * @static 29174 * @memberOf _ 29175 * @since 0.1.0 29176 * @category Lang 29177 * @param {*} value The value to check. 29178 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 29179 * @example 29180 * 29181 * _.isNull(null); 29182 * // => true 29183 * 29184 * _.isNull(void 0); 29185 * // => false 29186 */ 29187 function isNull(value) { 29188 return value === null; 29189 } 29190 29191 /** 29192 * Checks if `value` is `null` or `undefined`. 29193 * 29194 * @static 29195 * @memberOf _ 29196 * @since 4.0.0 29197 * @category Lang 29198 * @param {*} value The value to check. 29199 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 29200 * @example 29201 * 29202 * _.isNil(null); 29203 * // => true 29204 * 29205 * _.isNil(void 0); 29206 * // => true 29207 * 29208 * _.isNil(NaN); 29209 * // => false 29210 */ 29211 function isNil(value) { 29212 return value == null; 29213 } 29214 29215 /** 29216 * Checks if `value` is classified as a `Number` primitive or object. 29217 * 29218 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 29219 * classified as numbers, use the `_.isFinite` method. 29220 * 29221 * @static 29222 * @memberOf _ 29223 * @since 0.1.0 29224 * @category Lang 29225 * @param {*} value The value to check. 29226 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 29227 * @example 29228 * 29229 * _.isNumber(3); 29230 * // => true 29231 * 29232 * _.isNumber(Number.MIN_VALUE); 29233 * // => true 29234 * 29235 * _.isNumber(Infinity); 29236 * // => true 29237 * 29238 * _.isNumber('3'); 29239 * // => false 29240 */ 29241 function isNumber(value) { 29242 return typeof value == 'number' || 29243 (isObjectLike(value) && baseGetTag(value) == numberTag); 29244 } 29245 29246 /** 29247 * Checks if `value` is a plain object, that is, an object created by the 29248 * `Object` constructor or one with a `[[Prototype]]` of `null`. 29249 * 29250 * @static 29251 * @memberOf _ 29252 * @since 0.8.0 29253 * @category Lang 29254 * @param {*} value The value to check. 29255 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 29256 * @example 29257 * 29258 * function Foo() { 29259 * this.a = 1; 29260 * } 29261 * 29262 * _.isPlainObject(new Foo); 29263 * // => false 29264 * 29265 * _.isPlainObject([1, 2, 3]); 29266 * // => false 29267 * 29268 * _.isPlainObject({ 'x': 0, 'y': 0 }); 29269 * // => true 29270 * 29271 * _.isPlainObject(Object.create(null)); 29272 * // => true 29273 */ 29274 function isPlainObject(value) { 29275 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 29276 return false; 29277 } 29278 var proto = getPrototype(value); 29279 if (proto === null) { 29280 return true; 29281 } 29282 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 29283 return typeof Ctor == 'function' && Ctor instanceof Ctor && 29284 funcToString.call(Ctor) == objectCtorString; 29285 } 29286 29287 /** 29288 * Checks if `value` is classified as a `RegExp` object. 29289 * 29290 * @static 29291 * @memberOf _ 29292 * @since 0.1.0 29293 * @category Lang 29294 * @param {*} value The value to check. 29295 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 29296 * @example 29297 * 29298 * _.isRegExp(/abc/); 29299 * // => true 29300 * 29301 * _.isRegExp('/abc/'); 29302 * // => false 29303 */ 29304 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 29305 29306 /** 29307 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 29308 * double precision number which isn't the result of a rounded unsafe integer. 29309 * 29310 * **Note:** This method is based on 29311 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 29312 * 29313 * @static 29314 * @memberOf _ 29315 * @since 4.0.0 29316 * @category Lang 29317 * @param {*} value The value to check. 29318 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 29319 * @example 29320 * 29321 * _.isSafeInteger(3); 29322 * // => true 29323 * 29324 * _.isSafeInteger(Number.MIN_VALUE); 29325 * // => false 29326 * 29327 * _.isSafeInteger(Infinity); 29328 * // => false 29329 * 29330 * _.isSafeInteger('3'); 29331 * // => false 29332 */ 29333 function isSafeInteger(value) { 29334 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 29335 } 29336 29337 /** 29338 * Checks if `value` is classified as a `Set` object. 29339 * 29340 * @static 29341 * @memberOf _ 29342 * @since 4.3.0 29343 * @category Lang 29344 * @param {*} value The value to check. 29345 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 29346 * @example 29347 * 29348 * _.isSet(new Set); 29349 * // => true 29350 * 29351 * _.isSet(new WeakSet); 29352 * // => false 29353 */ 29354 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 29355 29356 /** 29357 * Checks if `value` is classified as a `String` primitive or object. 29358 * 29359 * @static 29360 * @since 0.1.0 29361 * @memberOf _ 29362 * @category Lang 29363 * @param {*} value The value to check. 29364 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 29365 * @example 29366 * 29367 * _.isString('abc'); 29368 * // => true 29369 * 29370 * _.isString(1); 29371 * // => false 29372 */ 29373 function isString(value) { 29374 return typeof value == 'string' || 29375 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 29376 } 29377 29378 /** 29379 * Checks if `value` is classified as a `Symbol` primitive or object. 29380 * 29381 * @static 29382 * @memberOf _ 29383 * @since 4.0.0 29384 * @category Lang 29385 * @param {*} value The value to check. 29386 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 29387 * @example 29388 * 29389 * _.isSymbol(Symbol.iterator); 29390 * // => true 29391 * 29392 * _.isSymbol('abc'); 29393 * // => false 29394 */ 29395 function isSymbol(value) { 29396 return typeof value == 'symbol' || 29397 (isObjectLike(value) && baseGetTag(value) == symbolTag); 29398 } 29399 29400 /** 29401 * Checks if `value` is classified as a typed array. 29402 * 29403 * @static 29404 * @memberOf _ 29405 * @since 3.0.0 29406 * @category Lang 29407 * @param {*} value The value to check. 29408 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 29409 * @example 29410 * 29411 * _.isTypedArray(new Uint8Array); 29412 * // => true 29413 * 29414 * _.isTypedArray([]); 29415 * // => false 29416 */ 29417 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 29418 29419 /** 29420 * Checks if `value` is `undefined`. 29421 * 29422 * @static 29423 * @since 0.1.0 29424 * @memberOf _ 29425 * @category Lang 29426 * @param {*} value The value to check. 29427 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 29428 * @example 29429 * 29430 * _.isUndefined(void 0); 29431 * // => true 29432 * 29433 * _.isUndefined(null); 29434 * // => false 29435 */ 29436 function isUndefined(value) { 29437 return value === undefined; 29438 } 29439 29440 /** 29441 * Checks if `value` is classified as a `WeakMap` object. 29442 * 29443 * @static 29444 * @memberOf _ 29445 * @since 4.3.0 29446 * @category Lang 29447 * @param {*} value The value to check. 29448 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 29449 * @example 29450 * 29451 * _.isWeakMap(new WeakMap); 29452 * // => true 29453 * 29454 * _.isWeakMap(new Map); 29455 * // => false 29456 */ 29457 function isWeakMap(value) { 29458 return isObjectLike(value) && getTag(value) == weakMapTag; 29459 } 29460 29461 /** 29462 * Checks if `value` is classified as a `WeakSet` object. 29463 * 29464 * @static 29465 * @memberOf _ 29466 * @since 4.3.0 29467 * @category Lang 29468 * @param {*} value The value to check. 29469 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 29470 * @example 29471 * 29472 * _.isWeakSet(new WeakSet); 29473 * // => true 29474 * 29475 * _.isWeakSet(new Set); 29476 * // => false 29477 */ 29478 function isWeakSet(value) { 29479 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 29480 } 29481 29482 /** 29483 * Checks if `value` is less than `other`. 29484 * 29485 * @static 29486 * @memberOf _ 29487 * @since 3.9.0 29488 * @category Lang 29489 * @param {*} value The value to compare. 29490 * @param {*} other The other value to compare. 29491 * @returns {boolean} Returns `true` if `value` is less than `other`, 29492 * else `false`. 29493 * @see _.gt 29494 * @example 29495 * 29496 * _.lt(1, 3); 29497 * // => true 29498 * 29499 * _.lt(3, 3); 29500 * // => false 29501 * 29502 * _.lt(3, 1); 29503 * // => false 29504 */ 29505 var lt = createRelationalOperation(baseLt); 29506 29507 /** 29508 * Checks if `value` is less than or equal to `other`. 29509 * 29510 * @static 29511 * @memberOf _ 29512 * @since 3.9.0 29513 * @category Lang 29514 * @param {*} value The value to compare. 29515 * @param {*} other The other value to compare. 29516 * @returns {boolean} Returns `true` if `value` is less than or equal to 29517 * `other`, else `false`. 29518 * @see _.gte 29519 * @example 29520 * 29521 * _.lte(1, 3); 29522 * // => true 29523 * 29524 * _.lte(3, 3); 29525 * // => true 29526 * 29527 * _.lte(3, 1); 29528 * // => false 29529 */ 29530 var lte = createRelationalOperation(function(value, other) { 29531 return value <= other; 29532 }); 29533 29534 /** 29535 * Converts `value` to an array. 29536 * 29537 * @static 29538 * @since 0.1.0 29539 * @memberOf _ 29540 * @category Lang 29541 * @param {*} value The value to convert. 29542 * @returns {Array} Returns the converted array. 29543 * @example 29544 * 29545 * _.toArray({ 'a': 1, 'b': 2 }); 29546 * // => [1, 2] 29547 * 29548 * _.toArray('abc'); 29549 * // => ['a', 'b', 'c'] 29550 * 29551 * _.toArray(1); 29552 * // => [] 29553 * 29554 * _.toArray(null); 29555 * // => [] 29556 */ 29557 function toArray(value) { 29558 if (!value) { 29559 return []; 29560 } 29561 if (isArrayLike(value)) { 29562 return isString(value) ? stringToArray(value) : copyArray(value); 29563 } 29564 if (symIterator && value[symIterator]) { 29565 return iteratorToArray(value[symIterator]()); 29566 } 29567 var tag = getTag(value), 29568 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 29569 29570 return func(value); 29571 } 29572 29573 /** 29574 * Converts `value` to a finite number. 29575 * 29576 * @static 29577 * @memberOf _ 29578 * @since 4.12.0 29579 * @category Lang 29580 * @param {*} value The value to convert. 29581 * @returns {number} Returns the converted number. 29582 * @example 29583 * 29584 * _.toFinite(3.2); 29585 * // => 3.2 29586 * 29587 * _.toFinite(Number.MIN_VALUE); 29588 * // => 5e-324 29589 * 29590 * _.toFinite(Infinity); 29591 * // => 1.7976931348623157e+308 29592 * 29593 * _.toFinite('3.2'); 29594 * // => 3.2 29595 */ 29596 function toFinite(value) { 29597 if (!value) { 29598 return value === 0 ? value : 0; 29599 } 29600 value = toNumber(value); 29601 if (value === INFINITY || value === -INFINITY) { 29602 var sign = (value < 0 ? -1 : 1); 29603 return sign * MAX_INTEGER; 29604 } 29605 return value === value ? value : 0; 29606 } 29607 29608 /** 29609 * Converts `value` to an integer. 29610 * 29611 * **Note:** This method is loosely based on 29612 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 29613 * 29614 * @static 29615 * @memberOf _ 29616 * @since 4.0.0 29617 * @category Lang 29618 * @param {*} value The value to convert. 29619 * @returns {number} Returns the converted integer. 29620 * @example 29621 * 29622 * _.toInteger(3.2); 29623 * // => 3 29624 * 29625 * _.toInteger(Number.MIN_VALUE); 29626 * // => 0 29627 * 29628 * _.toInteger(Infinity); 29629 * // => 1.7976931348623157e+308 29630 * 29631 * _.toInteger('3.2'); 29632 * // => 3 29633 */ 29634 function toInteger(value) { 29635 var result = toFinite(value), 29636 remainder = result % 1; 29637 29638 return result === result ? (remainder ? result - remainder : result) : 0; 29639 } 29640 29641 /** 29642 * Converts `value` to an integer suitable for use as the length of an 29643 * array-like object. 29644 * 29645 * **Note:** This method is based on 29646 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 29647 * 29648 * @static 29649 * @memberOf _ 29650 * @since 4.0.0 29651 * @category Lang 29652 * @param {*} value The value to convert. 29653 * @returns {number} Returns the converted integer. 29654 * @example 29655 * 29656 * _.toLength(3.2); 29657 * // => 3 29658 * 29659 * _.toLength(Number.MIN_VALUE); 29660 * // => 0 29661 * 29662 * _.toLength(Infinity); 29663 * // => 4294967295 29664 * 29665 * _.toLength('3.2'); 29666 * // => 3 29667 */ 29668 function toLength(value) { 29669 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 29670 } 29671 29672 /** 29673 * Converts `value` to a number. 29674 * 29675 * @static 29676 * @memberOf _ 29677 * @since 4.0.0 29678 * @category Lang 29679 * @param {*} value The value to process. 29680 * @returns {number} Returns the number. 29681 * @example 29682 * 29683 * _.toNumber(3.2); 29684 * // => 3.2 29685 * 29686 * _.toNumber(Number.MIN_VALUE); 29687 * // => 5e-324 29688 * 29689 * _.toNumber(Infinity); 29690 * // => Infinity 29691 * 29692 * _.toNumber('3.2'); 29693 * // => 3.2 29694 */ 29695 function toNumber(value) { 29696 if (typeof value == 'number') { 29697 return value; 29698 } 29699 if (isSymbol(value)) { 29700 return NAN; 29701 } 29702 if (isObject(value)) { 29703 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 29704 value = isObject(other) ? (other + '') : other; 29705 } 29706 if (typeof value != 'string') { 29707 return value === 0 ? value : +value; 29708 } 29709 value = value.replace(reTrim, ''); 29710 var isBinary = reIsBinary.test(value); 29711 return (isBinary || reIsOctal.test(value)) 29712 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 29713 : (reIsBadHex.test(value) ? NAN : +value); 29714 } 29715 29716 /** 29717 * Converts `value` to a plain object flattening inherited enumerable string 29718 * keyed properties of `value` to own properties of the plain object. 29719 * 29720 * @static 29721 * @memberOf _ 29722 * @since 3.0.0 29723 * @category Lang 29724 * @param {*} value The value to convert. 29725 * @returns {Object} Returns the converted plain object. 29726 * @example 29727 * 29728 * function Foo() { 29729 * this.b = 2; 29730 * } 29731 * 29732 * Foo.prototype.c = 3; 29733 * 29734 * _.assign({ 'a': 1 }, new Foo); 29735 * // => { 'a': 1, 'b': 2 } 29736 * 29737 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 29738 * // => { 'a': 1, 'b': 2, 'c': 3 } 29739 */ 29740 function toPlainObject(value) { 29741 return copyObject(value, keysIn(value)); 29742 } 29743 29744 /** 29745 * Converts `value` to a safe integer. A safe integer can be compared and 29746 * represented correctly. 29747 * 29748 * @static 29749 * @memberOf _ 29750 * @since 4.0.0 29751 * @category Lang 29752 * @param {*} value The value to convert. 29753 * @returns {number} Returns the converted integer. 29754 * @example 29755 * 29756 * _.toSafeInteger(3.2); 29757 * // => 3 29758 * 29759 * _.toSafeInteger(Number.MIN_VALUE); 29760 * // => 0 29761 * 29762 * _.toSafeInteger(Infinity); 29763 * // => 9007199254740991 29764 * 29765 * _.toSafeInteger('3.2'); 29766 * // => 3 29767 */ 29768 function toSafeInteger(value) { 29769 return value 29770 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 29771 : (value === 0 ? value : 0); 29772 } 29773 29774 /** 29775 * Converts `value` to a string. An empty string is returned for `null` 29776 * and `undefined` values. The sign of `-0` is preserved. 29777 * 29778 * @static 29779 * @memberOf _ 29780 * @since 4.0.0 29781 * @category Lang 29782 * @param {*} value The value to convert. 29783 * @returns {string} Returns the converted string. 29784 * @example 29785 * 29786 * _.toString(null); 29787 * // => '' 29788 * 29789 * _.toString(-0); 29790 * // => '-0' 29791 * 29792 * _.toString([1, 2, 3]); 29793 * // => '1,2,3' 29794 */ 29795 function toString(value) { 29796 return value == null ? '' : baseToString(value); 29797 } 29798 29799 /*------------------------------------------------------------------------*/ 29800 29801 /** 29802 * Assigns own enumerable string keyed properties of source objects to the 29803 * destination object. Source objects are applied from left to right. 29804 * Subsequent sources overwrite property assignments of previous sources. 29805 * 29806 * **Note:** This method mutates `object` and is loosely based on 29807 * [`Object.assign`](https://mdn.io/Object/assign). 29808 * 29809 * @static 29810 * @memberOf _ 29811 * @since 0.10.0 29812 * @category Object 29813 * @param {Object} object The destination object. 29814 * @param {...Object} [sources] The source objects. 29815 * @returns {Object} Returns `object`. 29816 * @see _.assignIn 29817 * @example 29818 * 29819 * function Foo() { 29820 * this.a = 1; 29821 * } 29822 * 29823 * function Bar() { 29824 * this.c = 3; 29825 * } 29826 * 29827 * Foo.prototype.b = 2; 29828 * Bar.prototype.d = 4; 29829 * 29830 * _.assign({ 'a': 0 }, new Foo, new Bar); 29831 * // => { 'a': 1, 'c': 3 } 29832 */ 29833 var assign = createAssigner(function(object, source) { 29834 if (isPrototype(source) || isArrayLike(source)) { 29835 copyObject(source, keys(source), object); 29836 return; 29837 } 29838 for (var key in source) { 29839 if (hasOwnProperty.call(source, key)) { 29840 assignValue(object, key, source[key]); 29841 } 29842 } 29843 }); 29844 29845 /** 29846 * This method is like `_.assign` except that it iterates over own and 29847 * inherited source properties. 29848 * 29849 * **Note:** This method mutates `object`. 29850 * 29851 * @static 29852 * @memberOf _ 29853 * @since 4.0.0 29854 * @alias extend 29855 * @category Object 29856 * @param {Object} object The destination object. 29857 * @param {...Object} [sources] The source objects. 29858 * @returns {Object} Returns `object`. 29859 * @see _.assign 29860 * @example 29861 * 29862 * function Foo() { 29863 * this.a = 1; 29864 * } 29865 * 29866 * function Bar() { 29867 * this.c = 3; 29868 * } 29869 * 29870 * Foo.prototype.b = 2; 29871 * Bar.prototype.d = 4; 29872 * 29873 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 29874 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 29875 */ 29876 var assignIn = createAssigner(function(object, source) { 29877 copyObject(source, keysIn(source), object); 29878 }); 29879 29880 /** 29881 * This method is like `_.assignIn` except that it accepts `customizer` 29882 * which is invoked to produce the assigned values. If `customizer` returns 29883 * `undefined`, assignment is handled by the method instead. The `customizer` 29884 * is invoked with five arguments: (objValue, srcValue, key, object, source). 29885 * 29886 * **Note:** This method mutates `object`. 29887 * 29888 * @static 29889 * @memberOf _ 29890 * @since 4.0.0 29891 * @alias extendWith 29892 * @category Object 29893 * @param {Object} object The destination object. 29894 * @param {...Object} sources The source objects. 29895 * @param {Function} [customizer] The function to customize assigned values. 29896 * @returns {Object} Returns `object`. 29897 * @see _.assignWith 29898 * @example 29899 * 29900 * function customizer(objValue, srcValue) { 29901 * return _.isUndefined(objValue) ? srcValue : objValue; 29902 * } 29903 * 29904 * var defaults = _.partialRight(_.assignInWith, customizer); 29905 * 29906 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 29907 * // => { 'a': 1, 'b': 2 } 29908 */ 29909 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 29910 copyObject(source, keysIn(source), object, customizer); 29911 }); 29912 29913 /** 29914 * This method is like `_.assign` except that it accepts `customizer` 29915 * which is invoked to produce the assigned values. If `customizer` returns 29916 * `undefined`, assignment is handled by the method instead. The `customizer` 29917 * is invoked with five arguments: (objValue, srcValue, key, object, source). 29918 * 29919 * **Note:** This method mutates `object`. 29920 * 29921 * @static 29922 * @memberOf _ 29923 * @since 4.0.0 29924 * @category Object 29925 * @param {Object} object The destination object. 29926 * @param {...Object} sources The source objects. 29927 * @param {Function} [customizer] The function to customize assigned values. 29928 * @returns {Object} Returns `object`. 29929 * @see _.assignInWith 29930 * @example 29931 * 29932 * function customizer(objValue, srcValue) { 29933 * return _.isUndefined(objValue) ? srcValue : objValue; 29934 * } 29935 * 29936 * var defaults = _.partialRight(_.assignWith, customizer); 29937 * 29938 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 29939 * // => { 'a': 1, 'b': 2 } 29940 */ 29941 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 29942 copyObject(source, keys(source), object, customizer); 29943 }); 29944 29945 /** 29946 * Creates an array of values corresponding to `paths` of `object`. 29947 * 29948 * @static 29949 * @memberOf _ 29950 * @since 1.0.0 29951 * @category Object 29952 * @param {Object} object The object to iterate over. 29953 * @param {...(string|string[])} [paths] The property paths to pick. 29954 * @returns {Array} Returns the picked values. 29955 * @example 29956 * 29957 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 29958 * 29959 * _.at(object, ['a[0].b.c', 'a[1]']); 29960 * // => [3, 4] 29961 */ 29962 var at = flatRest(baseAt); 29963 29964 /** 29965 * Creates an object that inherits from the `prototype` object. If a 29966 * `properties` object is given, its own enumerable string keyed properties 29967 * are assigned to the created object. 29968 * 29969 * @static 29970 * @memberOf _ 29971 * @since 2.3.0 29972 * @category Object 29973 * @param {Object} prototype The object to inherit from. 29974 * @param {Object} [properties] The properties to assign to the object. 29975 * @returns {Object} Returns the new object. 29976 * @example 29977 * 29978 * function Shape() { 29979 * this.x = 0; 29980 * this.y = 0; 29981 * } 29982 * 29983 * function Circle() { 29984 * Shape.call(this); 29985 * } 29986 * 29987 * Circle.prototype = _.create(Shape.prototype, { 29988 * 'constructor': Circle 29989 * }); 29990 * 29991 * var circle = new Circle; 29992 * circle instanceof Circle; 29993 * // => true 29994 * 29995 * circle instanceof Shape; 29996 * // => true 29997 */ 29998 function create(prototype, properties) { 29999 var result = baseCreate(prototype); 30000 return properties == null ? result : baseAssign(result, properties); 30001 } 30002 30003 /** 30004 * Assigns own and inherited enumerable string keyed properties of source 30005 * objects to the destination object for all destination properties that 30006 * resolve to `undefined`. Source objects are applied from left to right. 30007 * Once a property is set, additional values of the same property are ignored. 30008 * 30009 * **Note:** This method mutates `object`. 30010 * 30011 * @static 30012 * @since 0.1.0 30013 * @memberOf _ 30014 * @category Object 30015 * @param {Object} object The destination object. 30016 * @param {...Object} [sources] The source objects. 30017 * @returns {Object} Returns `object`. 30018 * @see _.defaultsDeep 30019 * @example 30020 * 30021 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 30022 * // => { 'a': 1, 'b': 2 } 30023 */ 30024 var defaults = baseRest(function(object, sources) { 30025 object = Object(object); 30026 30027 var index = -1; 30028 var length = sources.length; 30029 var guard = length > 2 ? sources[2] : undefined; 30030 30031 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 30032 length = 1; 30033 } 30034 30035 while (++index < length) { 30036 var source = sources[index]; 30037 var props = keysIn(source); 30038 var propsIndex = -1; 30039 var propsLength = props.length; 30040 30041 while (++propsIndex < propsLength) { 30042 var key = props[propsIndex]; 30043 var value = object[key]; 30044 30045 if (value === undefined || 30046 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { 30047 object[key] = source[key]; 30048 } 30049 } 30050 } 30051 30052 return object; 30053 }); 30054 30055 /** 30056 * This method is like `_.defaults` except that it recursively assigns 30057 * default properties. 30058 * 30059 * **Note:** This method mutates `object`. 30060 * 30061 * @static 30062 * @memberOf _ 30063 * @since 3.10.0 30064 * @category Object 30065 * @param {Object} object The destination object. 30066 * @param {...Object} [sources] The source objects. 30067 * @returns {Object} Returns `object`. 30068 * @see _.defaults 30069 * @example 30070 * 30071 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 30072 * // => { 'a': { 'b': 2, 'c': 3 } } 30073 */ 30074 var defaultsDeep = baseRest(function(args) { 30075 args.push(undefined, customDefaultsMerge); 30076 return apply(mergeWith, undefined, args); 30077 }); 30078 30079 /** 30080 * This method is like `_.find` except that it returns the key of the first 30081 * element `predicate` returns truthy for instead of the element itself. 30082 * 30083 * @static 30084 * @memberOf _ 30085 * @since 1.1.0 30086 * @category Object 30087 * @param {Object} object The object to inspect. 30088 * @param {Function} [predicate=_.identity] The function invoked per iteration. 30089 * @returns {string|undefined} Returns the key of the matched element, 30090 * else `undefined`. 30091 * @example 30092 * 30093 * var users = { 30094 * 'barney': { 'age': 36, 'active': true }, 30095 * 'fred': { 'age': 40, 'active': false }, 30096 * 'pebbles': { 'age': 1, 'active': true } 30097 * }; 30098 * 30099 * _.findKey(users, function(o) { return o.age < 40; }); 30100 * // => 'barney' (iteration order is not guaranteed) 30101 * 30102 * // The `_.matches` iteratee shorthand. 30103 * _.findKey(users, { 'age': 1, 'active': true }); 30104 * // => 'pebbles' 30105 * 30106 * // The `_.matchesProperty` iteratee shorthand. 30107 * _.findKey(users, ['active', false]); 30108 * // => 'fred' 30109 * 30110 * // The `_.property` iteratee shorthand. 30111 * _.findKey(users, 'active'); 30112 * // => 'barney' 30113 */ 30114 function findKey(object, predicate) { 30115 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 30116 } 30117 30118 /** 30119 * This method is like `_.findKey` except that it iterates over elements of 30120 * a collection in the opposite order. 30121 * 30122 * @static 30123 * @memberOf _ 30124 * @since 2.0.0 30125 * @category Object 30126 * @param {Object} object The object to inspect. 30127 * @param {Function} [predicate=_.identity] The function invoked per iteration. 30128 * @returns {string|undefined} Returns the key of the matched element, 30129 * else `undefined`. 30130 * @example 30131 * 30132 * var users = { 30133 * 'barney': { 'age': 36, 'active': true }, 30134 * 'fred': { 'age': 40, 'active': false }, 30135 * 'pebbles': { 'age': 1, 'active': true } 30136 * }; 30137 * 30138 * _.findLastKey(users, function(o) { return o.age < 40; }); 30139 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 30140 * 30141 * // The `_.matches` iteratee shorthand. 30142 * _.findLastKey(users, { 'age': 36, 'active': true }); 30143 * // => 'barney' 30144 * 30145 * // The `_.matchesProperty` iteratee shorthand. 30146 * _.findLastKey(users, ['active', false]); 30147 * // => 'fred' 30148 * 30149 * // The `_.property` iteratee shorthand. 30150 * _.findLastKey(users, 'active'); 30151 * // => 'pebbles' 30152 */ 30153 function findLastKey(object, predicate) { 30154 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 30155 } 30156 30157 /** 30158 * Iterates over own and inherited enumerable string keyed properties of an 30159 * object and invokes `iteratee` for each property. The iteratee is invoked 30160 * with three arguments: (value, key, object). Iteratee functions may exit 30161 * iteration early by explicitly returning `false`. 30162 * 30163 * @static 30164 * @memberOf _ 30165 * @since 0.3.0 30166 * @category Object 30167 * @param {Object} object The object to iterate over. 30168 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30169 * @returns {Object} Returns `object`. 30170 * @see _.forInRight 30171 * @example 30172 * 30173 * function Foo() { 30174 * this.a = 1; 30175 * this.b = 2; 30176 * } 30177 * 30178 * Foo.prototype.c = 3; 30179 * 30180 * _.forIn(new Foo, function(value, key) { 30181 * console.log(key); 30182 * }); 30183 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 30184 */ 30185 function forIn(object, iteratee) { 30186 return object == null 30187 ? object 30188 : baseFor(object, getIteratee(iteratee, 3), keysIn); 30189 } 30190 30191 /** 30192 * This method is like `_.forIn` except that it iterates over properties of 30193 * `object` in the opposite order. 30194 * 30195 * @static 30196 * @memberOf _ 30197 * @since 2.0.0 30198 * @category Object 30199 * @param {Object} object The object to iterate over. 30200 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30201 * @returns {Object} Returns `object`. 30202 * @see _.forIn 30203 * @example 30204 * 30205 * function Foo() { 30206 * this.a = 1; 30207 * this.b = 2; 30208 * } 30209 * 30210 * Foo.prototype.c = 3; 30211 * 30212 * _.forInRight(new Foo, function(value, key) { 30213 * console.log(key); 30214 * }); 30215 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 30216 */ 30217 function forInRight(object, iteratee) { 30218 return object == null 30219 ? object 30220 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 30221 } 30222 30223 /** 30224 * Iterates over own enumerable string keyed properties of an object and 30225 * invokes `iteratee` for each property. The iteratee is invoked with three 30226 * arguments: (value, key, object). Iteratee functions may exit iteration 30227 * early by explicitly returning `false`. 30228 * 30229 * @static 30230 * @memberOf _ 30231 * @since 0.3.0 30232 * @category Object 30233 * @param {Object} object The object to iterate over. 30234 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30235 * @returns {Object} Returns `object`. 30236 * @see _.forOwnRight 30237 * @example 30238 * 30239 * function Foo() { 30240 * this.a = 1; 30241 * this.b = 2; 30242 * } 30243 * 30244 * Foo.prototype.c = 3; 30245 * 30246 * _.forOwn(new Foo, function(value, key) { 30247 * console.log(key); 30248 * }); 30249 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 30250 */ 30251 function forOwn(object, iteratee) { 30252 return object && baseForOwn(object, getIteratee(iteratee, 3)); 30253 } 30254 30255 /** 30256 * This method is like `_.forOwn` except that it iterates over properties of 30257 * `object` in the opposite order. 30258 * 30259 * @static 30260 * @memberOf _ 30261 * @since 2.0.0 30262 * @category Object 30263 * @param {Object} object The object to iterate over. 30264 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30265 * @returns {Object} Returns `object`. 30266 * @see _.forOwn 30267 * @example 30268 * 30269 * function Foo() { 30270 * this.a = 1; 30271 * this.b = 2; 30272 * } 30273 * 30274 * Foo.prototype.c = 3; 30275 * 30276 * _.forOwnRight(new Foo, function(value, key) { 30277 * console.log(key); 30278 * }); 30279 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 30280 */ 30281 function forOwnRight(object, iteratee) { 30282 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 30283 } 30284 30285 /** 30286 * Creates an array of function property names from own enumerable properties 30287 * of `object`. 30288 * 30289 * @static 30290 * @since 0.1.0 30291 * @memberOf _ 30292 * @category Object 30293 * @param {Object} object The object to inspect. 30294 * @returns {Array} Returns the function names. 30295 * @see _.functionsIn 30296 * @example 30297 * 30298 * function Foo() { 30299 * this.a = _.constant('a'); 30300 * this.b = _.constant('b'); 30301 * } 30302 * 30303 * Foo.prototype.c = _.constant('c'); 30304 * 30305 * _.functions(new Foo); 30306 * // => ['a', 'b'] 30307 */ 30308 function functions(object) { 30309 return object == null ? [] : baseFunctions(object, keys(object)); 30310 } 30311 30312 /** 30313 * Creates an array of function property names from own and inherited 30314 * enumerable properties of `object`. 30315 * 30316 * @static 30317 * @memberOf _ 30318 * @since 4.0.0 30319 * @category Object 30320 * @param {Object} object The object to inspect. 30321 * @returns {Array} Returns the function names. 30322 * @see _.functions 30323 * @example 30324 * 30325 * function Foo() { 30326 * this.a = _.constant('a'); 30327 * this.b = _.constant('b'); 30328 * } 30329 * 30330 * Foo.prototype.c = _.constant('c'); 30331 * 30332 * _.functionsIn(new Foo); 30333 * // => ['a', 'b', 'c'] 30334 */ 30335 function functionsIn(object) { 30336 return object == null ? [] : baseFunctions(object, keysIn(object)); 30337 } 30338 30339 /** 30340 * Gets the value at `path` of `object`. If the resolved value is 30341 * `undefined`, the `defaultValue` is returned in its place. 30342 * 30343 * @static 30344 * @memberOf _ 30345 * @since 3.7.0 30346 * @category Object 30347 * @param {Object} object The object to query. 30348 * @param {Array|string} path The path of the property to get. 30349 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 30350 * @returns {*} Returns the resolved value. 30351 * @example 30352 * 30353 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 30354 * 30355 * _.get(object, 'a[0].b.c'); 30356 * // => 3 30357 * 30358 * _.get(object, ['a', '0', 'b', 'c']); 30359 * // => 3 30360 * 30361 * _.get(object, 'a.b.c', 'default'); 30362 * // => 'default' 30363 */ 30364 function get(object, path, defaultValue) { 30365 var result = object == null ? undefined : baseGet(object, path); 30366 return result === undefined ? defaultValue : result; 30367 } 30368 30369 /** 30370 * Checks if `path` is a direct property of `object`. 30371 * 30372 * @static 30373 * @since 0.1.0 30374 * @memberOf _ 30375 * @category Object 30376 * @param {Object} object The object to query. 30377 * @param {Array|string} path The path to check. 30378 * @returns {boolean} Returns `true` if `path` exists, else `false`. 30379 * @example 30380 * 30381 * var object = { 'a': { 'b': 2 } }; 30382 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 30383 * 30384 * _.has(object, 'a'); 30385 * // => true 30386 * 30387 * _.has(object, 'a.b'); 30388 * // => true 30389 * 30390 * _.has(object, ['a', 'b']); 30391 * // => true 30392 * 30393 * _.has(other, 'a'); 30394 * // => false 30395 */ 30396 function has(object, path) { 30397 return object != null && hasPath(object, path, baseHas); 30398 } 30399 30400 /** 30401 * Checks if `path` is a direct or inherited property of `object`. 30402 * 30403 * @static 30404 * @memberOf _ 30405 * @since 4.0.0 30406 * @category Object 30407 * @param {Object} object The object to query. 30408 * @param {Array|string} path The path to check. 30409 * @returns {boolean} Returns `true` if `path` exists, else `false`. 30410 * @example 30411 * 30412 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 30413 * 30414 * _.hasIn(object, 'a'); 30415 * // => true 30416 * 30417 * _.hasIn(object, 'a.b'); 30418 * // => true 30419 * 30420 * _.hasIn(object, ['a', 'b']); 30421 * // => true 30422 * 30423 * _.hasIn(object, 'b'); 30424 * // => false 30425 */ 30426 function hasIn(object, path) { 30427 return object != null && hasPath(object, path, baseHasIn); 30428 } 30429 30430 /** 30431 * Creates an object composed of the inverted keys and values of `object`. 30432 * If `object` contains duplicate values, subsequent values overwrite 30433 * property assignments of previous values. 30434 * 30435 * @static 30436 * @memberOf _ 30437 * @since 0.7.0 30438 * @category Object 30439 * @param {Object} object The object to invert. 30440 * @returns {Object} Returns the new inverted object. 30441 * @example 30442 * 30443 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 30444 * 30445 * _.invert(object); 30446 * // => { '1': 'c', '2': 'b' } 30447 */ 30448 var invert = createInverter(function(result, value, key) { 30449 if (value != null && 30450 typeof value.toString != 'function') { 30451 value = nativeObjectToString.call(value); 30452 } 30453 30454 result[value] = key; 30455 }, constant(identity)); 30456 30457 /** 30458 * This method is like `_.invert` except that the inverted object is generated 30459 * from the results of running each element of `object` thru `iteratee`. The 30460 * corresponding inverted value of each inverted key is an array of keys 30461 * responsible for generating the inverted value. The iteratee is invoked 30462 * with one argument: (value). 30463 * 30464 * @static 30465 * @memberOf _ 30466 * @since 4.1.0 30467 * @category Object 30468 * @param {Object} object The object to invert. 30469 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 30470 * @returns {Object} Returns the new inverted object. 30471 * @example 30472 * 30473 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 30474 * 30475 * _.invertBy(object); 30476 * // => { '1': ['a', 'c'], '2': ['b'] } 30477 * 30478 * _.invertBy(object, function(value) { 30479 * return 'group' + value; 30480 * }); 30481 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 30482 */ 30483 var invertBy = createInverter(function(result, value, key) { 30484 if (value != null && 30485 typeof value.toString != 'function') { 30486 value = nativeObjectToString.call(value); 30487 } 30488 30489 if (hasOwnProperty.call(result, value)) { 30490 result[value].push(key); 30491 } else { 30492 result[value] = [key]; 30493 } 30494 }, getIteratee); 30495 30496 /** 30497 * Invokes the method at `path` of `object`. 30498 * 30499 * @static 30500 * @memberOf _ 30501 * @since 4.0.0 30502 * @category Object 30503 * @param {Object} object The object to query. 30504 * @param {Array|string} path The path of the method to invoke. 30505 * @param {...*} [args] The arguments to invoke the method with. 30506 * @returns {*} Returns the result of the invoked method. 30507 * @example 30508 * 30509 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 30510 * 30511 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 30512 * // => [2, 3] 30513 */ 30514 var invoke = baseRest(baseInvoke); 30515 30516 /** 30517 * Creates an array of the own enumerable property names of `object`. 30518 * 30519 * **Note:** Non-object values are coerced to objects. See the 30520 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 30521 * for more details. 30522 * 30523 * @static 30524 * @since 0.1.0 30525 * @memberOf _ 30526 * @category Object 30527 * @param {Object} object The object to query. 30528 * @returns {Array} Returns the array of property names. 30529 * @example 30530 * 30531 * function Foo() { 30532 * this.a = 1; 30533 * this.b = 2; 30534 * } 30535 * 30536 * Foo.prototype.c = 3; 30537 * 30538 * _.keys(new Foo); 30539 * // => ['a', 'b'] (iteration order is not guaranteed) 30540 * 30541 * _.keys('hi'); 30542 * // => ['0', '1'] 30543 */ 30544 function keys(object) { 30545 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 30546 } 30547 30548 /** 30549 * Creates an array of the own and inherited enumerable property names of `object`. 30550 * 30551 * **Note:** Non-object values are coerced to objects. 30552 * 30553 * @static 30554 * @memberOf _ 30555 * @since 3.0.0 30556 * @category Object 30557 * @param {Object} object The object to query. 30558 * @returns {Array} Returns the array of property names. 30559 * @example 30560 * 30561 * function Foo() { 30562 * this.a = 1; 30563 * this.b = 2; 30564 * } 30565 * 30566 * Foo.prototype.c = 3; 30567 * 30568 * _.keysIn(new Foo); 30569 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 30570 */ 30571 function keysIn(object) { 30572 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 30573 } 30574 30575 /** 30576 * The opposite of `_.mapValues`; this method creates an object with the 30577 * same values as `object` and keys generated by running each own enumerable 30578 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 30579 * with three arguments: (value, key, object). 30580 * 30581 * @static 30582 * @memberOf _ 30583 * @since 3.8.0 30584 * @category Object 30585 * @param {Object} object The object to iterate over. 30586 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30587 * @returns {Object} Returns the new mapped object. 30588 * @see _.mapValues 30589 * @example 30590 * 30591 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 30592 * return key + value; 30593 * }); 30594 * // => { 'a1': 1, 'b2': 2 } 30595 */ 30596 function mapKeys(object, iteratee) { 30597 var result = {}; 30598 iteratee = getIteratee(iteratee, 3); 30599 30600 baseForOwn(object, function(value, key, object) { 30601 baseAssignValue(result, iteratee(value, key, object), value); 30602 }); 30603 return result; 30604 } 30605 30606 /** 30607 * Creates an object with the same keys as `object` and values generated 30608 * by running each own enumerable string keyed property of `object` thru 30609 * `iteratee`. The iteratee is invoked with three arguments: 30610 * (value, key, object). 30611 * 30612 * @static 30613 * @memberOf _ 30614 * @since 2.4.0 30615 * @category Object 30616 * @param {Object} object The object to iterate over. 30617 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30618 * @returns {Object} Returns the new mapped object. 30619 * @see _.mapKeys 30620 * @example 30621 * 30622 * var users = { 30623 * 'fred': { 'user': 'fred', 'age': 40 }, 30624 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 30625 * }; 30626 * 30627 * _.mapValues(users, function(o) { return o.age; }); 30628 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 30629 * 30630 * // The `_.property` iteratee shorthand. 30631 * _.mapValues(users, 'age'); 30632 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 30633 */ 30634 function mapValues(object, iteratee) { 30635 var result = {}; 30636 iteratee = getIteratee(iteratee, 3); 30637 30638 baseForOwn(object, function(value, key, object) { 30639 baseAssignValue(result, key, iteratee(value, key, object)); 30640 }); 30641 return result; 30642 } 30643 30644 /** 30645 * This method is like `_.assign` except that it recursively merges own and 30646 * inherited enumerable string keyed properties of source objects into the 30647 * destination object. Source properties that resolve to `undefined` are 30648 * skipped if a destination value exists. Array and plain object properties 30649 * are merged recursively. Other objects and value types are overridden by 30650 * assignment. Source objects are applied from left to right. Subsequent 30651 * sources overwrite property assignments of previous sources. 30652 * 30653 * **Note:** This method mutates `object`. 30654 * 30655 * @static 30656 * @memberOf _ 30657 * @since 0.5.0 30658 * @category Object 30659 * @param {Object} object The destination object. 30660 * @param {...Object} [sources] The source objects. 30661 * @returns {Object} Returns `object`. 30662 * @example 30663 * 30664 * var object = { 30665 * 'a': [{ 'b': 2 }, { 'd': 4 }] 30666 * }; 30667 * 30668 * var other = { 30669 * 'a': [{ 'c': 3 }, { 'e': 5 }] 30670 * }; 30671 * 30672 * _.merge(object, other); 30673 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 30674 */ 30675 var merge = createAssigner(function(object, source, srcIndex) { 30676 baseMerge(object, source, srcIndex); 30677 }); 30678 30679 /** 30680 * This method is like `_.merge` except that it accepts `customizer` which 30681 * is invoked to produce the merged values of the destination and source 30682 * properties. If `customizer` returns `undefined`, merging is handled by the 30683 * method instead. The `customizer` is invoked with six arguments: 30684 * (objValue, srcValue, key, object, source, stack). 30685 * 30686 * **Note:** This method mutates `object`. 30687 * 30688 * @static 30689 * @memberOf _ 30690 * @since 4.0.0 30691 * @category Object 30692 * @param {Object} object The destination object. 30693 * @param {...Object} sources The source objects. 30694 * @param {Function} customizer The function to customize assigned values. 30695 * @returns {Object} Returns `object`. 30696 * @example 30697 * 30698 * function customizer(objValue, srcValue) { 30699 * if (_.isArray(objValue)) { 30700 * return objValue.concat(srcValue); 30701 * } 30702 * } 30703 * 30704 * var object = { 'a': [1], 'b': [2] }; 30705 * var other = { 'a': [3], 'b': [4] }; 30706 * 30707 * _.mergeWith(object, other, customizer); 30708 * // => { 'a': [1, 3], 'b': [2, 4] } 30709 */ 30710 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 30711 baseMerge(object, source, srcIndex, customizer); 30712 }); 30713 30714 /** 30715 * The opposite of `_.pick`; this method creates an object composed of the 30716 * own and inherited enumerable property paths of `object` that are not omitted. 30717 * 30718 * **Note:** This method is considerably slower than `_.pick`. 30719 * 30720 * @static 30721 * @since 0.1.0 30722 * @memberOf _ 30723 * @category Object 30724 * @param {Object} object The source object. 30725 * @param {...(string|string[])} [paths] The property paths to omit. 30726 * @returns {Object} Returns the new object. 30727 * @example 30728 * 30729 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30730 * 30731 * _.omit(object, ['a', 'c']); 30732 * // => { 'b': '2' } 30733 */ 30734 var omit = flatRest(function(object, paths) { 30735 var result = {}; 30736 if (object == null) { 30737 return result; 30738 } 30739 var isDeep = false; 30740 paths = arrayMap(paths, function(path) { 30741 path = castPath(path, object); 30742 isDeep || (isDeep = path.length > 1); 30743 return path; 30744 }); 30745 copyObject(object, getAllKeysIn(object), result); 30746 if (isDeep) { 30747 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 30748 } 30749 var length = paths.length; 30750 while (length--) { 30751 baseUnset(result, paths[length]); 30752 } 30753 return result; 30754 }); 30755 30756 /** 30757 * The opposite of `_.pickBy`; this method creates an object composed of 30758 * the own and inherited enumerable string keyed properties of `object` that 30759 * `predicate` doesn't return truthy for. The predicate is invoked with two 30760 * arguments: (value, key). 30761 * 30762 * @static 30763 * @memberOf _ 30764 * @since 4.0.0 30765 * @category Object 30766 * @param {Object} object The source object. 30767 * @param {Function} [predicate=_.identity] The function invoked per property. 30768 * @returns {Object} Returns the new object. 30769 * @example 30770 * 30771 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30772 * 30773 * _.omitBy(object, _.isNumber); 30774 * // => { 'b': '2' } 30775 */ 30776 function omitBy(object, predicate) { 30777 return pickBy(object, negate(getIteratee(predicate))); 30778 } 30779 30780 /** 30781 * Creates an object composed of the picked `object` properties. 30782 * 30783 * @static 30784 * @since 0.1.0 30785 * @memberOf _ 30786 * @category Object 30787 * @param {Object} object The source object. 30788 * @param {...(string|string[])} [paths] The property paths to pick. 30789 * @returns {Object} Returns the new object. 30790 * @example 30791 * 30792 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30793 * 30794 * _.pick(object, ['a', 'c']); 30795 * // => { 'a': 1, 'c': 3 } 30796 */ 30797 var pick = flatRest(function(object, paths) { 30798 return object == null ? {} : basePick(object, paths); 30799 }); 30800 30801 /** 30802 * Creates an object composed of the `object` properties `predicate` returns 30803 * truthy for. The predicate is invoked with two arguments: (value, key). 30804 * 30805 * @static 30806 * @memberOf _ 30807 * @since 4.0.0 30808 * @category Object 30809 * @param {Object} object The source object. 30810 * @param {Function} [predicate=_.identity] The function invoked per property. 30811 * @returns {Object} Returns the new object. 30812 * @example 30813 * 30814 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30815 * 30816 * _.pickBy(object, _.isNumber); 30817 * // => { 'a': 1, 'c': 3 } 30818 */ 30819 function pickBy(object, predicate) { 30820 if (object == null) { 30821 return {}; 30822 } 30823 var props = arrayMap(getAllKeysIn(object), function(prop) { 30824 return [prop]; 30825 }); 30826 predicate = getIteratee(predicate); 30827 return basePickBy(object, props, function(value, path) { 30828 return predicate(value, path[0]); 30829 }); 30830 } 30831 30832 /** 30833 * This method is like `_.get` except that if the resolved value is a 30834 * function it's invoked with the `this` binding of its parent object and 30835 * its result is returned. 30836 * 30837 * @static 30838 * @since 0.1.0 30839 * @memberOf _ 30840 * @category Object 30841 * @param {Object} object The object to query. 30842 * @param {Array|string} path The path of the property to resolve. 30843 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 30844 * @returns {*} Returns the resolved value. 30845 * @example 30846 * 30847 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 30848 * 30849 * _.result(object, 'a[0].b.c1'); 30850 * // => 3 30851 * 30852 * _.result(object, 'a[0].b.c2'); 30853 * // => 4 30854 * 30855 * _.result(object, 'a[0].b.c3', 'default'); 30856 * // => 'default' 30857 * 30858 * _.result(object, 'a[0].b.c3', _.constant('default')); 30859 * // => 'default' 30860 */ 30861 function result(object, path, defaultValue) { 30862 path = castPath(path, object); 30863 30864 var index = -1, 30865 length = path.length; 30866 30867 // Ensure the loop is entered when path is empty. 30868 if (!length) { 30869 length = 1; 30870 object = undefined; 30871 } 30872 while (++index < length) { 30873 var value = object == null ? undefined : object[toKey(path[index])]; 30874 if (value === undefined) { 30875 index = length; 30876 value = defaultValue; 30877 } 30878 object = isFunction(value) ? value.call(object) : value; 30879 } 30880 return object; 30881 } 30882 30883 /** 30884 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 30885 * it's created. Arrays are created for missing index properties while objects 30886 * are created for all other missing properties. Use `_.setWith` to customize 30887 * `path` creation. 30888 * 30889 * **Note:** This method mutates `object`. 30890 * 30891 * @static 30892 * @memberOf _ 30893 * @since 3.7.0 30894 * @category Object 30895 * @param {Object} object The object to modify. 30896 * @param {Array|string} path The path of the property to set. 30897 * @param {*} value The value to set. 30898 * @returns {Object} Returns `object`. 30899 * @example 30900 * 30901 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 30902 * 30903 * _.set(object, 'a[0].b.c', 4); 30904 * console.log(object.a[0].b.c); 30905 * // => 4 30906 * 30907 * _.set(object, ['x', '0', 'y', 'z'], 5); 30908 * console.log(object.x[0].y.z); 30909 * // => 5 30910 */ 30911 function set(object, path, value) { 30912 return object == null ? object : baseSet(object, path, value); 30913 } 30914 30915 /** 30916 * This method is like `_.set` except that it accepts `customizer` which is 30917 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 30918 * path creation is handled by the method instead. The `customizer` is invoked 30919 * with three arguments: (nsValue, key, nsObject). 30920 * 30921 * **Note:** This method mutates `object`. 30922 * 30923 * @static 30924 * @memberOf _ 30925 * @since 4.0.0 30926 * @category Object 30927 * @param {Object} object The object to modify. 30928 * @param {Array|string} path The path of the property to set. 30929 * @param {*} value The value to set. 30930 * @param {Function} [customizer] The function to customize assigned values. 30931 * @returns {Object} Returns `object`. 30932 * @example 30933 * 30934 * var object = {}; 30935 * 30936 * _.setWith(object, '[0][1]', 'a', Object); 30937 * // => { '0': { '1': 'a' } } 30938 */ 30939 function setWith(object, path, value, customizer) { 30940 customizer = typeof customizer == 'function' ? customizer : undefined; 30941 return object == null ? object : baseSet(object, path, value, customizer); 30942 } 30943 30944 /** 30945 * Creates an array of own enumerable string keyed-value pairs for `object` 30946 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 30947 * entries are returned. 30948 * 30949 * @static 30950 * @memberOf _ 30951 * @since 4.0.0 30952 * @alias entries 30953 * @category Object 30954 * @param {Object} object The object to query. 30955 * @returns {Array} Returns the key-value pairs. 30956 * @example 30957 * 30958 * function Foo() { 30959 * this.a = 1; 30960 * this.b = 2; 30961 * } 30962 * 30963 * Foo.prototype.c = 3; 30964 * 30965 * _.toPairs(new Foo); 30966 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 30967 */ 30968 var toPairs = createToPairs(keys); 30969 30970 /** 30971 * Creates an array of own and inherited enumerable string keyed-value pairs 30972 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 30973 * or set, its entries are returned. 30974 * 30975 * @static 30976 * @memberOf _ 30977 * @since 4.0.0 30978 * @alias entriesIn 30979 * @category Object 30980 * @param {Object} object The object to query. 30981 * @returns {Array} Returns the key-value pairs. 30982 * @example 30983 * 30984 * function Foo() { 30985 * this.a = 1; 30986 * this.b = 2; 30987 * } 30988 * 30989 * Foo.prototype.c = 3; 30990 * 30991 * _.toPairsIn(new Foo); 30992 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 30993 */ 30994 var toPairsIn = createToPairs(keysIn); 30995 30996 /** 30997 * An alternative to `_.reduce`; this method transforms `object` to a new 30998 * `accumulator` object which is the result of running each of its own 30999 * enumerable string keyed properties thru `iteratee`, with each invocation 31000 * potentially mutating the `accumulator` object. If `accumulator` is not 31001 * provided, a new object with the same `[[Prototype]]` will be used. The 31002 * iteratee is invoked with four arguments: (accumulator, value, key, object). 31003 * Iteratee functions may exit iteration early by explicitly returning `false`. 31004 * 31005 * @static 31006 * @memberOf _ 31007 * @since 1.3.0 31008 * @category Object 31009 * @param {Object} object The object to iterate over. 31010 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 31011 * @param {*} [accumulator] The custom accumulator value. 31012 * @returns {*} Returns the accumulated value. 31013 * @example 31014 * 31015 * _.transform([2, 3, 4], function(result, n) { 31016 * result.push(n *= n); 31017 * return n % 2 == 0; 31018 * }, []); 31019 * // => [4, 9] 31020 * 31021 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 31022 * (result[value] || (result[value] = [])).push(key); 31023 * }, {}); 31024 * // => { '1': ['a', 'c'], '2': ['b'] } 31025 */ 31026 function transform(object, iteratee, accumulator) { 31027 var isArr = isArray(object), 31028 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 31029 31030 iteratee = getIteratee(iteratee, 4); 31031 if (accumulator == null) { 31032 var Ctor = object && object.constructor; 31033 if (isArrLike) { 31034 accumulator = isArr ? new Ctor : []; 31035 } 31036 else if (isObject(object)) { 31037 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 31038 } 31039 else { 31040 accumulator = {}; 31041 } 31042 } 31043 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 31044 return iteratee(accumulator, value, index, object); 31045 }); 31046 return accumulator; 31047 } 31048 31049 /** 31050 * Removes the property at `path` of `object`. 31051 * 31052 * **Note:** This method mutates `object`. 31053 * 31054 * @static 31055 * @memberOf _ 31056 * @since 4.0.0 31057 * @category Object 31058 * @param {Object} object The object to modify. 31059 * @param {Array|string} path The path of the property to unset. 31060 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 31061 * @example 31062 * 31063 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 31064 * _.unset(object, 'a[0].b.c'); 31065 * // => true 31066 * 31067 * console.log(object); 31068 * // => { 'a': [{ 'b': {} }] }; 31069 * 31070 * _.unset(object, ['a', '0', 'b', 'c']); 31071 * // => true 31072 * 31073 * console.log(object); 31074 * // => { 'a': [{ 'b': {} }] }; 31075 */ 31076 function unset(object, path) { 31077 return object == null ? true : baseUnset(object, path); 31078 } 31079 31080 /** 31081 * This method is like `_.set` except that accepts `updater` to produce the 31082 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 31083 * is invoked with one argument: (value). 31084 * 31085 * **Note:** This method mutates `object`. 31086 * 31087 * @static 31088 * @memberOf _ 31089 * @since 4.6.0 31090 * @category Object 31091 * @param {Object} object The object to modify. 31092 * @param {Array|string} path The path of the property to set. 31093 * @param {Function} updater The function to produce the updated value. 31094 * @returns {Object} Returns `object`. 31095 * @example 31096 * 31097 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 31098 * 31099 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 31100 * console.log(object.a[0].b.c); 31101 * // => 9 31102 * 31103 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 31104 * console.log(object.x[0].y.z); 31105 * // => 0 31106 */ 31107 function update(object, path, updater) { 31108 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 31109 } 31110 31111 /** 31112 * This method is like `_.update` except that it accepts `customizer` which is 31113 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 31114 * path creation is handled by the method instead. The `customizer` is invoked 31115 * with three arguments: (nsValue, key, nsObject). 31116 * 31117 * **Note:** This method mutates `object`. 31118 * 31119 * @static 31120 * @memberOf _ 31121 * @since 4.6.0 31122 * @category Object 31123 * @param {Object} object The object to modify. 31124 * @param {Array|string} path The path of the property to set. 31125 * @param {Function} updater The function to produce the updated value. 31126 * @param {Function} [customizer] The function to customize assigned values. 31127 * @returns {Object} Returns `object`. 31128 * @example 31129 * 31130 * var object = {}; 31131 * 31132 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 31133 * // => { '0': { '1': 'a' } } 31134 */ 31135 function updateWith(object, path, updater, customizer) { 31136 customizer = typeof customizer == 'function' ? customizer : undefined; 31137 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 31138 } 31139 31140 /** 31141 * Creates an array of the own enumerable string keyed property values of `object`. 31142 * 31143 * **Note:** Non-object values are coerced to objects. 31144 * 31145 * @static 31146 * @since 0.1.0 31147 * @memberOf _ 31148 * @category Object 31149 * @param {Object} object The object to query. 31150 * @returns {Array} Returns the array of property values. 31151 * @example 31152 * 31153 * function Foo() { 31154 * this.a = 1; 31155 * this.b = 2; 31156 * } 31157 * 31158 * Foo.prototype.c = 3; 31159 * 31160 * _.values(new Foo); 31161 * // => [1, 2] (iteration order is not guaranteed) 31162 * 31163 * _.values('hi'); 31164 * // => ['h', 'i'] 31165 */ 31166 function values(object) { 31167 return object == null ? [] : baseValues(object, keys(object)); 31168 } 31169 31170 /** 31171 * Creates an array of the own and inherited enumerable string keyed property 31172 * values of `object`. 31173 * 31174 * **Note:** Non-object values are coerced to objects. 31175 * 31176 * @static 31177 * @memberOf _ 31178 * @since 3.0.0 31179 * @category Object 31180 * @param {Object} object The object to query. 31181 * @returns {Array} Returns the array of property values. 31182 * @example 31183 * 31184 * function Foo() { 31185 * this.a = 1; 31186 * this.b = 2; 31187 * } 31188 * 31189 * Foo.prototype.c = 3; 31190 * 31191 * _.valuesIn(new Foo); 31192 * // => [1, 2, 3] (iteration order is not guaranteed) 31193 */ 31194 function valuesIn(object) { 31195 return object == null ? [] : baseValues(object, keysIn(object)); 31196 } 31197 31198 /*------------------------------------------------------------------------*/ 31199 31200 /** 31201 * Clamps `number` within the inclusive `lower` and `upper` bounds. 31202 * 31203 * @static 31204 * @memberOf _ 31205 * @since 4.0.0 31206 * @category Number 31207 * @param {number} number The number to clamp. 31208 * @param {number} [lower] The lower bound. 31209 * @param {number} upper The upper bound. 31210 * @returns {number} Returns the clamped number. 31211 * @example 31212 * 31213 * _.clamp(-10, -5, 5); 31214 * // => -5 31215 * 31216 * _.clamp(10, -5, 5); 31217 * // => 5 31218 */ 31219 function clamp(number, lower, upper) { 31220 if (upper === undefined) { 31221 upper = lower; 31222 lower = undefined; 31223 } 31224 if (upper !== undefined) { 31225 upper = toNumber(upper); 31226 upper = upper === upper ? upper : 0; 31227 } 31228 if (lower !== undefined) { 31229 lower = toNumber(lower); 31230 lower = lower === lower ? lower : 0; 31231 } 31232 return baseClamp(toNumber(number), lower, upper); 31233 } 31234 31235 /** 31236 * Checks if `n` is between `start` and up to, but not including, `end`. If 31237 * `end` is not specified, it's set to `start` with `start` then set to `0`. 31238 * If `start` is greater than `end` the params are swapped to support 31239 * negative ranges. 31240 * 31241 * @static 31242 * @memberOf _ 31243 * @since 3.3.0 31244 * @category Number 31245 * @param {number} number The number to check. 31246 * @param {number} [start=0] The start of the range. 31247 * @param {number} end The end of the range. 31248 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 31249 * @see _.range, _.rangeRight 31250 * @example 31251 * 31252 * _.inRange(3, 2, 4); 31253 * // => true 31254 * 31255 * _.inRange(4, 8); 31256 * // => true 31257 * 31258 * _.inRange(4, 2); 31259 * // => false 31260 * 31261 * _.inRange(2, 2); 31262 * // => false 31263 * 31264 * _.inRange(1.2, 2); 31265 * // => true 31266 * 31267 * _.inRange(5.2, 4); 31268 * // => false 31269 * 31270 * _.inRange(-3, -2, -6); 31271 * // => true 31272 */ 31273 function inRange(number, start, end) { 31274 start = toFinite(start); 31275 if (end === undefined) { 31276 end = start; 31277 start = 0; 31278 } else { 31279 end = toFinite(end); 31280 } 31281 number = toNumber(number); 31282 return baseInRange(number, start, end); 31283 } 31284 31285 /** 31286 * Produces a random number between the inclusive `lower` and `upper` bounds. 31287 * If only one argument is provided a number between `0` and the given number 31288 * is returned. If `floating` is `true`, or either `lower` or `upper` are 31289 * floats, a floating-point number is returned instead of an integer. 31290 * 31291 * **Note:** JavaScript follows the IEEE-754 standard for resolving 31292 * floating-point values which can produce unexpected results. 31293 * 31294 * @static 31295 * @memberOf _ 31296 * @since 0.7.0 31297 * @category Number 31298 * @param {number} [lower=0] The lower bound. 31299 * @param {number} [upper=1] The upper bound. 31300 * @param {boolean} [floating] Specify returning a floating-point number. 31301 * @returns {number} Returns the random number. 31302 * @example 31303 * 31304 * _.random(0, 5); 31305 * // => an integer between 0 and 5 31306 * 31307 * _.random(5); 31308 * // => also an integer between 0 and 5 31309 * 31310 * _.random(5, true); 31311 * // => a floating-point number between 0 and 5 31312 * 31313 * _.random(1.2, 5.2); 31314 * // => a floating-point number between 1.2 and 5.2 31315 */ 31316 function random(lower, upper, floating) { 31317 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 31318 upper = floating = undefined; 31319 } 31320 if (floating === undefined) { 31321 if (typeof upper == 'boolean') { 31322 floating = upper; 31323 upper = undefined; 31324 } 31325 else if (typeof lower == 'boolean') { 31326 floating = lower; 31327 lower = undefined; 31328 } 31329 } 31330 if (lower === undefined && upper === undefined) { 31331 lower = 0; 31332 upper = 1; 31333 } 31334 else { 31335 lower = toFinite(lower); 31336 if (upper === undefined) { 31337 upper = lower; 31338 lower = 0; 31339 } else { 31340 upper = toFinite(upper); 31341 } 31342 } 31343 if (lower > upper) { 31344 var temp = lower; 31345 lower = upper; 31346 upper = temp; 31347 } 31348 if (floating || lower % 1 || upper % 1) { 31349 var rand = nativeRandom(); 31350 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 31351 } 31352 return baseRandom(lower, upper); 31353 } 31354 31355 /*------------------------------------------------------------------------*/ 31356 31357 /** 31358 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 31359 * 31360 * @static 31361 * @memberOf _ 31362 * @since 3.0.0 31363 * @category String 31364 * @param {string} [string=''] The string to convert. 31365 * @returns {string} Returns the camel cased string. 31366 * @example 31367 * 31368 * _.camelCase('Foo Bar'); 31369 * // => 'fooBar' 31370 * 31371 * _.camelCase('--foo-bar--'); 31372 * // => 'fooBar' 31373 * 31374 * _.camelCase('__FOO_BAR__'); 31375 * // => 'fooBar' 31376 */ 31377 var camelCase = createCompounder(function(result, word, index) { 31378 word = word.toLowerCase(); 31379 return result + (index ? capitalize(word) : word); 31380 }); 31381 31382 /** 31383 * Converts the first character of `string` to upper case and the remaining 31384 * to lower case. 31385 * 31386 * @static 31387 * @memberOf _ 31388 * @since 3.0.0 31389 * @category String 31390 * @param {string} [string=''] The string to capitalize. 31391 * @returns {string} Returns the capitalized string. 31392 * @example 31393 * 31394 * _.capitalize('FRED'); 31395 * // => 'Fred' 31396 */ 31397 function capitalize(string) { 31398 return upperFirst(toString(string).toLowerCase()); 31399 } 31400 31401 /** 31402 * Deburrs `string` by converting 31403 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 31404 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 31405 * letters to basic Latin letters and removing 31406 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 31407 * 31408 * @static 31409 * @memberOf _ 31410 * @since 3.0.0 31411 * @category String 31412 * @param {string} [string=''] The string to deburr. 31413 * @returns {string} Returns the deburred string. 31414 * @example 31415 * 31416 * _.deburr('déjàvu'); 31417 * // => 'deja vu' 31418 */ 31419 function deburr(string) { 31420 string = toString(string); 31421 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 31422 } 31423 31424 /** 31425 * Checks if `string` ends with the given target string. 31426 * 31427 * @static 31428 * @memberOf _ 31429 * @since 3.0.0 31430 * @category String 31431 * @param {string} [string=''] The string to inspect. 31432 * @param {string} [target] The string to search for. 31433 * @param {number} [position=string.length] The position to search up to. 31434 * @returns {boolean} Returns `true` if `string` ends with `target`, 31435 * else `false`. 31436 * @example 31437 * 31438 * _.endsWith('abc', 'c'); 31439 * // => true 31440 * 31441 * _.endsWith('abc', 'b'); 31442 * // => false 31443 * 31444 * _.endsWith('abc', 'b', 2); 31445 * // => true 31446 */ 31447 function endsWith(string, target, position) { 31448 string = toString(string); 31449 target = baseToString(target); 31450 31451 var length = string.length; 31452 position = position === undefined 31453 ? length 31454 : baseClamp(toInteger(position), 0, length); 31455 31456 var end = position; 31457 position -= target.length; 31458 return position >= 0 && string.slice(position, end) == target; 31459 } 31460 31461 /** 31462 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 31463 * corresponding HTML entities. 31464 * 31465 * **Note:** No other characters are escaped. To escape additional 31466 * characters use a third-party library like [_he_](https://mths.be/he). 31467 * 31468 * Though the ">" character is escaped for symmetry, characters like 31469 * ">" and "/" don't need escaping in HTML and have no special meaning 31470 * unless they're part of a tag or unquoted attribute value. See 31471 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 31472 * (under "semi-related fun fact") for more details. 31473 * 31474 * When working with HTML you should always 31475 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 31476 * XSS vectors. 31477 * 31478 * @static 31479 * @since 0.1.0 31480 * @memberOf _ 31481 * @category String 31482 * @param {string} [string=''] The string to escape. 31483 * @returns {string} Returns the escaped string. 31484 * @example 31485 * 31486 * _.escape('fred, barney, & pebbles'); 31487 * // => 'fred, barney, & pebbles' 31488 */ 31489 function escape(string) { 31490 string = toString(string); 31491 return (string && reHasUnescapedHtml.test(string)) 31492 ? string.replace(reUnescapedHtml, escapeHtmlChar) 31493 : string; 31494 } 31495 31496 /** 31497 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 31498 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 31499 * 31500 * @static 31501 * @memberOf _ 31502 * @since 3.0.0 31503 * @category String 31504 * @param {string} [string=''] The string to escape. 31505 * @returns {string} Returns the escaped string. 31506 * @example 31507 * 31508 * _.escapeRegExp('[lodash](https://lodash.com/)'); 31509 * // => '\[lodash\]\(https://lodash\.com/\)' 31510 */ 31511 function escapeRegExp(string) { 31512 string = toString(string); 31513 return (string && reHasRegExpChar.test(string)) 31514 ? string.replace(reRegExpChar, '\\$&') 31515 : string; 31516 } 31517 31518 /** 31519 * Converts `string` to 31520 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 31521 * 31522 * @static 31523 * @memberOf _ 31524 * @since 3.0.0 31525 * @category String 31526 * @param {string} [string=''] The string to convert. 31527 * @returns {string} Returns the kebab cased string. 31528 * @example 31529 * 31530 * _.kebabCase('Foo Bar'); 31531 * // => 'foo-bar' 31532 * 31533 * _.kebabCase('fooBar'); 31534 * // => 'foo-bar' 31535 * 31536 * _.kebabCase('__FOO_BAR__'); 31537 * // => 'foo-bar' 31538 */ 31539 var kebabCase = createCompounder(function(result, word, index) { 31540 return result + (index ? '-' : '') + word.toLowerCase(); 31541 }); 31542 31543 /** 31544 * Converts `string`, as space separated words, to lower case. 31545 * 31546 * @static 31547 * @memberOf _ 31548 * @since 4.0.0 31549 * @category String 31550 * @param {string} [string=''] The string to convert. 31551 * @returns {string} Returns the lower cased string. 31552 * @example 31553 * 31554 * _.lowerCase('--Foo-Bar--'); 31555 * // => 'foo bar' 31556 * 31557 * _.lowerCase('fooBar'); 31558 * // => 'foo bar' 31559 * 31560 * _.lowerCase('__FOO_BAR__'); 31561 * // => 'foo bar' 31562 */ 31563 var lowerCase = createCompounder(function(result, word, index) { 31564 return result + (index ? ' ' : '') + word.toLowerCase(); 31565 }); 31566 31567 /** 31568 * Converts the first character of `string` to lower case. 31569 * 31570 * @static 31571 * @memberOf _ 31572 * @since 4.0.0 31573 * @category String 31574 * @param {string} [string=''] The string to convert. 31575 * @returns {string} Returns the converted string. 31576 * @example 31577 * 31578 * _.lowerFirst('Fred'); 31579 * // => 'fred' 31580 * 31581 * _.lowerFirst('FRED'); 31582 * // => 'fRED' 31583 */ 31584 var lowerFirst = createCaseFirst('toLowerCase'); 31585 31586 /** 31587 * Pads `string` on the left and right sides if it's shorter than `length`. 31588 * Padding characters are truncated if they can't be evenly divided by `length`. 31589 * 31590 * @static 31591 * @memberOf _ 31592 * @since 3.0.0 31593 * @category String 31594 * @param {string} [string=''] The string to pad. 31595 * @param {number} [length=0] The padding length. 31596 * @param {string} [chars=' '] The string used as padding. 31597 * @returns {string} Returns the padded string. 31598 * @example 31599 * 31600 * _.pad('abc', 8); 31601 * // => ' abc ' 31602 * 31603 * _.pad('abc', 8, '_-'); 31604 * // => '_-abc_-_' 31605 * 31606 * _.pad('abc', 3); 31607 * // => 'abc' 31608 */ 31609 function pad(string, length, chars) { 31610 string = toString(string); 31611 length = toInteger(length); 31612 31613 var strLength = length ? stringSize(string) : 0; 31614 if (!length || strLength >= length) { 31615 return string; 31616 } 31617 var mid = (length - strLength) / 2; 31618 return ( 31619 createPadding(nativeFloor(mid), chars) + 31620 string + 31621 createPadding(nativeCeil(mid), chars) 31622 ); 31623 } 31624 31625 /** 31626 * Pads `string` on the right side if it's shorter than `length`. Padding 31627 * characters are truncated if they exceed `length`. 31628 * 31629 * @static 31630 * @memberOf _ 31631 * @since 4.0.0 31632 * @category String 31633 * @param {string} [string=''] The string to pad. 31634 * @param {number} [length=0] The padding length. 31635 * @param {string} [chars=' '] The string used as padding. 31636 * @returns {string} Returns the padded string. 31637 * @example 31638 * 31639 * _.padEnd('abc', 6); 31640 * // => 'abc ' 31641 * 31642 * _.padEnd('abc', 6, '_-'); 31643 * // => 'abc_-_' 31644 * 31645 * _.padEnd('abc', 3); 31646 * // => 'abc' 31647 */ 31648 function padEnd(string, length, chars) { 31649 string = toString(string); 31650 length = toInteger(length); 31651 31652 var strLength = length ? stringSize(string) : 0; 31653 return (length && strLength < length) 31654 ? (string + createPadding(length - strLength, chars)) 31655 : string; 31656 } 31657 31658 /** 31659 * Pads `string` on the left side if it's shorter than `length`. Padding 31660 * characters are truncated if they exceed `length`. 31661 * 31662 * @static 31663 * @memberOf _ 31664 * @since 4.0.0 31665 * @category String 31666 * @param {string} [string=''] The string to pad. 31667 * @param {number} [length=0] The padding length. 31668 * @param {string} [chars=' '] The string used as padding. 31669 * @returns {string} Returns the padded string. 31670 * @example 31671 * 31672 * _.padStart('abc', 6); 31673 * // => ' abc' 31674 * 31675 * _.padStart('abc', 6, '_-'); 31676 * // => '_-_abc' 31677 * 31678 * _.padStart('abc', 3); 31679 * // => 'abc' 31680 */ 31681 function padStart(string, length, chars) { 31682 string = toString(string); 31683 length = toInteger(length); 31684 31685 var strLength = length ? stringSize(string) : 0; 31686 return (length && strLength < length) 31687 ? (createPadding(length - strLength, chars) + string) 31688 : string; 31689 } 31690 31691 /** 31692 * Converts `string` to an integer of the specified radix. If `radix` is 31693 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 31694 * hexadecimal, in which case a `radix` of `16` is used. 31695 * 31696 * **Note:** This method aligns with the 31697 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 31698 * 31699 * @static 31700 * @memberOf _ 31701 * @since 1.1.0 31702 * @category String 31703 * @param {string} string The string to convert. 31704 * @param {number} [radix=10] The radix to interpret `value` by. 31705 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31706 * @returns {number} Returns the converted integer. 31707 * @example 31708 * 31709 * _.parseInt('08'); 31710 * // => 8 31711 * 31712 * _.map(['6', '08', '10'], _.parseInt); 31713 * // => [6, 8, 10] 31714 */ 31715 function parseInt(string, radix, guard) { 31716 if (guard || radix == null) { 31717 radix = 0; 31718 } else if (radix) { 31719 radix = +radix; 31720 } 31721 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 31722 } 31723 31724 /** 31725 * Repeats the given string `n` times. 31726 * 31727 * @static 31728 * @memberOf _ 31729 * @since 3.0.0 31730 * @category String 31731 * @param {string} [string=''] The string to repeat. 31732 * @param {number} [n=1] The number of times to repeat the string. 31733 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31734 * @returns {string} Returns the repeated string. 31735 * @example 31736 * 31737 * _.repeat('*', 3); 31738 * // => '***' 31739 * 31740 * _.repeat('abc', 2); 31741 * // => 'abcabc' 31742 * 31743 * _.repeat('abc', 0); 31744 * // => '' 31745 */ 31746 function repeat(string, n, guard) { 31747 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { 31748 n = 1; 31749 } else { 31750 n = toInteger(n); 31751 } 31752 return baseRepeat(toString(string), n); 31753 } 31754 31755 /** 31756 * Replaces matches for `pattern` in `string` with `replacement`. 31757 * 31758 * **Note:** This method is based on 31759 * [`String#replace`](https://mdn.io/String/replace). 31760 * 31761 * @static 31762 * @memberOf _ 31763 * @since 4.0.0 31764 * @category String 31765 * @param {string} [string=''] The string to modify. 31766 * @param {RegExp|string} pattern The pattern to replace. 31767 * @param {Function|string} replacement The match replacement. 31768 * @returns {string} Returns the modified string. 31769 * @example 31770 * 31771 * _.replace('Hi Fred', 'Fred', 'Barney'); 31772 * // => 'Hi Barney' 31773 */ 31774 function replace() { 31775 var args = arguments, 31776 string = toString(args[0]); 31777 31778 return args.length < 3 ? string : string.replace(args[1], args[2]); 31779 } 31780 31781 /** 31782 * Converts `string` to 31783 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 31784 * 31785 * @static 31786 * @memberOf _ 31787 * @since 3.0.0 31788 * @category String 31789 * @param {string} [string=''] The string to convert. 31790 * @returns {string} Returns the snake cased string. 31791 * @example 31792 * 31793 * _.snakeCase('Foo Bar'); 31794 * // => 'foo_bar' 31795 * 31796 * _.snakeCase('fooBar'); 31797 * // => 'foo_bar' 31798 * 31799 * _.snakeCase('--FOO-BAR--'); 31800 * // => 'foo_bar' 31801 */ 31802 var snakeCase = createCompounder(function(result, word, index) { 31803 return result + (index ? '_' : '') + word.toLowerCase(); 31804 }); 31805 31806 /** 31807 * Splits `string` by `separator`. 31808 * 31809 * **Note:** This method is based on 31810 * [`String#split`](https://mdn.io/String/split). 31811 * 31812 * @static 31813 * @memberOf _ 31814 * @since 4.0.0 31815 * @category String 31816 * @param {string} [string=''] The string to split. 31817 * @param {RegExp|string} separator The separator pattern to split by. 31818 * @param {number} [limit] The length to truncate results to. 31819 * @returns {Array} Returns the string segments. 31820 * @example 31821 * 31822 * _.split('a-b-c', '-', 2); 31823 * // => ['a', 'b'] 31824 */ 31825 function split(string, separator, limit) { 31826 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 31827 separator = limit = undefined; 31828 } 31829 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 31830 if (!limit) { 31831 return []; 31832 } 31833 string = toString(string); 31834 if (string && ( 31835 typeof separator == 'string' || 31836 (separator != null && !isRegExp(separator)) 31837 )) { 31838 separator = baseToString(separator); 31839 if (!separator && hasUnicode(string)) { 31840 return castSlice(stringToArray(string), 0, limit); 31841 } 31842 } 31843 return string.split(separator, limit); 31844 } 31845 31846 /** 31847 * Converts `string` to 31848 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 31849 * 31850 * @static 31851 * @memberOf _ 31852 * @since 3.1.0 31853 * @category String 31854 * @param {string} [string=''] The string to convert. 31855 * @returns {string} Returns the start cased string. 31856 * @example 31857 * 31858 * _.startCase('--foo-bar--'); 31859 * // => 'Foo Bar' 31860 * 31861 * _.startCase('fooBar'); 31862 * // => 'Foo Bar' 31863 * 31864 * _.startCase('__FOO_BAR__'); 31865 * // => 'FOO BAR' 31866 */ 31867 var startCase = createCompounder(function(result, word, index) { 31868 return result + (index ? ' ' : '') + upperFirst(word); 31869 }); 31870 31871 /** 31872 * Checks if `string` starts with the given target string. 31873 * 31874 * @static 31875 * @memberOf _ 31876 * @since 3.0.0 31877 * @category String 31878 * @param {string} [string=''] The string to inspect. 31879 * @param {string} [target] The string to search for. 31880 * @param {number} [position=0] The position to search from. 31881 * @returns {boolean} Returns `true` if `string` starts with `target`, 31882 * else `false`. 31883 * @example 31884 * 31885 * _.startsWith('abc', 'a'); 31886 * // => true 31887 * 31888 * _.startsWith('abc', 'b'); 31889 * // => false 31890 * 31891 * _.startsWith('abc', 'b', 1); 31892 * // => true 31893 */ 31894 function startsWith(string, target, position) { 31895 string = toString(string); 31896 position = position == null 31897 ? 0 31898 : baseClamp(toInteger(position), 0, string.length); 31899 31900 target = baseToString(target); 31901 return string.slice(position, position + target.length) == target; 31902 } 31903 31904 /** 31905 * Creates a compiled template function that can interpolate data properties 31906 * in "interpolate" delimiters, HTML-escape interpolated data properties in 31907 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 31908 * properties may be accessed as free variables in the template. If a setting 31909 * object is given, it takes precedence over `_.templateSettings` values. 31910 * 31911 * **Note:** In the development build `_.template` utilizes 31912 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 31913 * for easier debugging. 31914 * 31915 * For more information on precompiling templates see 31916 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 31917 * 31918 * For more information on Chrome extension sandboxes see 31919 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 31920 * 31921 * @static 31922 * @since 0.1.0 31923 * @memberOf _ 31924 * @category String 31925 * @param {string} [string=''] The template string. 31926 * @param {Object} [options={}] The options object. 31927 * @param {RegExp} [options.escape=_.templateSettings.escape] 31928 * The HTML "escape" delimiter. 31929 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 31930 * The "evaluate" delimiter. 31931 * @param {Object} [options.imports=_.templateSettings.imports] 31932 * An object to import into the template as free variables. 31933 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 31934 * The "interpolate" delimiter. 31935 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 31936 * The sourceURL of the compiled template. 31937 * @param {string} [options.variable='obj'] 31938 * The data object variable name. 31939 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31940 * @returns {Function} Returns the compiled template function. 31941 * @example 31942 * 31943 * // Use the "interpolate" delimiter to create a compiled template. 31944 * var compiled = _.template('hello <%= user %>!'); 31945 * compiled({ 'user': 'fred' }); 31946 * // => 'hello fred!' 31947 * 31948 * // Use the HTML "escape" delimiter to escape data property values. 31949 * var compiled = _.template('<b><%- value %></b>'); 31950 * compiled({ 'value': '<script>' }); 31951 * // => '<b><script></b>' 31952 * 31953 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 31954 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 31955 * compiled({ 'users': ['fred', 'barney'] }); 31956 * // => '<li>fred</li><li>barney</li>' 31957 * 31958 * // Use the internal `print` function in "evaluate" delimiters. 31959 * var compiled = _.template('<% print("hello " + user); %>!'); 31960 * compiled({ 'user': 'barney' }); 31961 * // => 'hello barney!' 31962 * 31963 * // Use the ES template literal delimiter as an "interpolate" delimiter. 31964 * // Disable support by replacing the "interpolate" delimiter. 31965 * var compiled = _.template('hello ${ user }!'); 31966 * compiled({ 'user': 'pebbles' }); 31967 * // => 'hello pebbles!' 31968 * 31969 * // Use backslashes to treat delimiters as plain text. 31970 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 31971 * compiled({ 'value': 'ignored' }); 31972 * // => '<%- value %>' 31973 * 31974 * // Use the `imports` option to import `jQuery` as `jq`. 31975 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 31976 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 31977 * compiled({ 'users': ['fred', 'barney'] }); 31978 * // => '<li>fred</li><li>barney</li>' 31979 * 31980 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 31981 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 31982 * compiled(data); 31983 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 31984 * 31985 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 31986 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 31987 * compiled.source; 31988 * // => function(data) { 31989 * // var __t, __p = ''; 31990 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 31991 * // return __p; 31992 * // } 31993 * 31994 * // Use custom template delimiters. 31995 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 31996 * var compiled = _.template('hello {{ user }}!'); 31997 * compiled({ 'user': 'mustache' }); 31998 * // => 'hello mustache!' 31999 * 32000 * // Use the `source` property to inline compiled templates for meaningful 32001 * // line numbers in error messages and stack traces. 32002 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 32003 * var JST = {\ 32004 * "main": ' + _.template(mainText).source + '\ 32005 * };\ 32006 * '); 32007 */ 32008 function template(string, options, guard) { 32009 // Based on John Resig's `tmpl` implementation 32010 // (http://ejohn.org/blog/javascript-micro-templating/) 32011 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 32012 var settings = lodash.templateSettings; 32013 32014 if (guard && isIterateeCall(string, options, guard)) { 32015 options = undefined; 32016 } 32017 string = toString(string); 32018 options = assignInWith({}, options, settings, customDefaultsAssignIn); 32019 32020 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 32021 importsKeys = keys(imports), 32022 importsValues = baseValues(imports, importsKeys); 32023 32024 var isEscaping, 32025 isEvaluating, 32026 index = 0, 32027 interpolate = options.interpolate || reNoMatch, 32028 source = "__p += '"; 32029 32030 // Compile the regexp to match each delimiter. 32031 var reDelimiters = RegExp( 32032 (options.escape || reNoMatch).source + '|' + 32033 interpolate.source + '|' + 32034 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 32035 (options.evaluate || reNoMatch).source + '|$' 32036 , 'g'); 32037 32038 // Use a sourceURL for easier debugging. 32039 // The sourceURL gets injected into the source that's eval-ed, so be careful 32040 // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in 32041 // and escape the comment, thus injecting code that gets evaled. 32042 var sourceURL = '//# sourceURL=' + 32043 (hasOwnProperty.call(options, 'sourceURL') 32044 ? (options.sourceURL + '').replace(/\s/g, ' ') 32045 : ('lodash.templateSources[' + (++templateCounter) + ']') 32046 ) + '\n'; 32047 32048 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 32049 interpolateValue || (interpolateValue = esTemplateValue); 32050 32051 // Escape characters that can't be included in string literals. 32052 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 32053 32054 // Replace delimiters with snippets. 32055 if (escapeValue) { 32056 isEscaping = true; 32057 source += "' +\n__e(" + escapeValue + ") +\n'"; 32058 } 32059 if (evaluateValue) { 32060 isEvaluating = true; 32061 source += "';\n" + evaluateValue + ";\n__p += '"; 32062 } 32063 if (interpolateValue) { 32064 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 32065 } 32066 index = offset + match.length; 32067 32068 // The JS engine embedded in Adobe products needs `match` returned in 32069 // order to produce the correct `offset` value. 32070 return match; 32071 }); 32072 32073 source += "';\n"; 32074 32075 // If `variable` is not specified wrap a with-statement around the generated 32076 // code to add the data object to the top of the scope chain. 32077 var variable = hasOwnProperty.call(options, 'variable') && options.variable; 32078 if (!variable) { 32079 source = 'with (obj) {\n' + source + '\n}\n'; 32080 } 32081 // Cleanup code by stripping empty strings. 32082 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 32083 .replace(reEmptyStringMiddle, '$1') 32084 .replace(reEmptyStringTrailing, '$1;'); 32085 32086 // Frame code as the function body. 32087 source = 'function(' + (variable || 'obj') + ') {\n' + 32088 (variable 32089 ? '' 32090 : 'obj || (obj = {});\n' 32091 ) + 32092 "var __t, __p = ''" + 32093 (isEscaping 32094 ? ', __e = _.escape' 32095 : '' 32096 ) + 32097 (isEvaluating 32098 ? ', __j = Array.prototype.join;\n' + 32099 "function print() { __p += __j.call(arguments, '') }\n" 32100 : ';\n' 32101 ) + 32102 source + 32103 'return __p\n}'; 32104 32105 var result = attempt(function() { 32106 return Function(importsKeys, sourceURL + 'return ' + source) 32107 .apply(undefined, importsValues); 32108 }); 32109 32110 // Provide the compiled function's source by its `toString` method or 32111 // the `source` property as a convenience for inlining compiled templates. 32112 result.source = source; 32113 if (isError(result)) { 32114 throw result; 32115 } 32116 return result; 32117 } 32118 32119 /** 32120 * Converts `string`, as a whole, to lower case just like 32121 * [String#toLowerCase](https://mdn.io/toLowerCase). 32122 * 32123 * @static 32124 * @memberOf _ 32125 * @since 4.0.0 32126 * @category String 32127 * @param {string} [string=''] The string to convert. 32128 * @returns {string} Returns the lower cased string. 32129 * @example 32130 * 32131 * _.toLower('--Foo-Bar--'); 32132 * // => '--foo-bar--' 32133 * 32134 * _.toLower('fooBar'); 32135 * // => 'foobar' 32136 * 32137 * _.toLower('__FOO_BAR__'); 32138 * // => '__foo_bar__' 32139 */ 32140 function toLower(value) { 32141 return toString(value).toLowerCase(); 32142 } 32143 32144 /** 32145 * Converts `string`, as a whole, to upper case just like 32146 * [String#toUpperCase](https://mdn.io/toUpperCase). 32147 * 32148 * @static 32149 * @memberOf _ 32150 * @since 4.0.0 32151 * @category String 32152 * @param {string} [string=''] The string to convert. 32153 * @returns {string} Returns the upper cased string. 32154 * @example 32155 * 32156 * _.toUpper('--foo-bar--'); 32157 * // => '--FOO-BAR--' 32158 * 32159 * _.toUpper('fooBar'); 32160 * // => 'FOOBAR' 32161 * 32162 * _.toUpper('__foo_bar__'); 32163 * // => '__FOO_BAR__' 32164 */ 32165 function toUpper(value) { 32166 return toString(value).toUpperCase(); 32167 } 32168 32169 /** 32170 * Removes leading and trailing whitespace or specified characters from `string`. 32171 * 32172 * @static 32173 * @memberOf _ 32174 * @since 3.0.0 32175 * @category String 32176 * @param {string} [string=''] The string to trim. 32177 * @param {string} [chars=whitespace] The characters to trim. 32178 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32179 * @returns {string} Returns the trimmed string. 32180 * @example 32181 * 32182 * _.trim(' abc '); 32183 * // => 'abc' 32184 * 32185 * _.trim('-_-abc-_-', '_-'); 32186 * // => 'abc' 32187 * 32188 * _.map([' foo ', ' bar '], _.trim); 32189 * // => ['foo', 'bar'] 32190 */ 32191 function trim(string, chars, guard) { 32192 string = toString(string); 32193 if (string && (guard || chars === undefined)) { 32194 return string.replace(reTrim, ''); 32195 } 32196 if (!string || !(chars = baseToString(chars))) { 32197 return string; 32198 } 32199 var strSymbols = stringToArray(string), 32200 chrSymbols = stringToArray(chars), 32201 start = charsStartIndex(strSymbols, chrSymbols), 32202 end = charsEndIndex(strSymbols, chrSymbols) + 1; 32203 32204 return castSlice(strSymbols, start, end).join(''); 32205 } 32206 32207 /** 32208 * Removes trailing whitespace or specified characters from `string`. 32209 * 32210 * @static 32211 * @memberOf _ 32212 * @since 4.0.0 32213 * @category String 32214 * @param {string} [string=''] The string to trim. 32215 * @param {string} [chars=whitespace] The characters to trim. 32216 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32217 * @returns {string} Returns the trimmed string. 32218 * @example 32219 * 32220 * _.trimEnd(' abc '); 32221 * // => ' abc' 32222 * 32223 * _.trimEnd('-_-abc-_-', '_-'); 32224 * // => '-_-abc' 32225 */ 32226 function trimEnd(string, chars, guard) { 32227 string = toString(string); 32228 if (string && (guard || chars === undefined)) { 32229 return string.replace(reTrimEnd, ''); 32230 } 32231 if (!string || !(chars = baseToString(chars))) { 32232 return string; 32233 } 32234 var strSymbols = stringToArray(string), 32235 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 32236 32237 return castSlice(strSymbols, 0, end).join(''); 32238 } 32239 32240 /** 32241 * Removes leading whitespace or specified characters from `string`. 32242 * 32243 * @static 32244 * @memberOf _ 32245 * @since 4.0.0 32246 * @category String 32247 * @param {string} [string=''] The string to trim. 32248 * @param {string} [chars=whitespace] The characters to trim. 32249 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32250 * @returns {string} Returns the trimmed string. 32251 * @example 32252 * 32253 * _.trimStart(' abc '); 32254 * // => 'abc ' 32255 * 32256 * _.trimStart('-_-abc-_-', '_-'); 32257 * // => 'abc-_-' 32258 */ 32259 function trimStart(string, chars, guard) { 32260 string = toString(string); 32261 if (string && (guard || chars === undefined)) { 32262 return string.replace(reTrimStart, ''); 32263 } 32264 if (!string || !(chars = baseToString(chars))) { 32265 return string; 32266 } 32267 var strSymbols = stringToArray(string), 32268 start = charsStartIndex(strSymbols, stringToArray(chars)); 32269 32270 return castSlice(strSymbols, start).join(''); 32271 } 32272 32273 /** 32274 * Truncates `string` if it's longer than the given maximum string length. 32275 * The last characters of the truncated string are replaced with the omission 32276 * string which defaults to "...". 32277 * 32278 * @static 32279 * @memberOf _ 32280 * @since 4.0.0 32281 * @category String 32282 * @param {string} [string=''] The string to truncate. 32283 * @param {Object} [options={}] The options object. 32284 * @param {number} [options.length=30] The maximum string length. 32285 * @param {string} [options.omission='...'] The string to indicate text is omitted. 32286 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 32287 * @returns {string} Returns the truncated string. 32288 * @example 32289 * 32290 * _.truncate('hi-diddly-ho there, neighborino'); 32291 * // => 'hi-diddly-ho there, neighbo...' 32292 * 32293 * _.truncate('hi-diddly-ho there, neighborino', { 32294 * 'length': 24, 32295 * 'separator': ' ' 32296 * }); 32297 * // => 'hi-diddly-ho there,...' 32298 * 32299 * _.truncate('hi-diddly-ho there, neighborino', { 32300 * 'length': 24, 32301 * 'separator': /,? +/ 32302 * }); 32303 * // => 'hi-diddly-ho there...' 32304 * 32305 * _.truncate('hi-diddly-ho there, neighborino', { 32306 * 'omission': ' [...]' 32307 * }); 32308 * // => 'hi-diddly-ho there, neig [...]' 32309 */ 32310 function truncate(string, options) { 32311 var length = DEFAULT_TRUNC_LENGTH, 32312 omission = DEFAULT_TRUNC_OMISSION; 32313 32314 if (isObject(options)) { 32315 var separator = 'separator' in options ? options.separator : separator; 32316 length = 'length' in options ? toInteger(options.length) : length; 32317 omission = 'omission' in options ? baseToString(options.omission) : omission; 32318 } 32319 string = toString(string); 32320 32321 var strLength = string.length; 32322 if (hasUnicode(string)) { 32323 var strSymbols = stringToArray(string); 32324 strLength = strSymbols.length; 32325 } 32326 if (length >= strLength) { 32327 return string; 32328 } 32329 var end = length - stringSize(omission); 32330 if (end < 1) { 32331 return omission; 32332 } 32333 var result = strSymbols 32334 ? castSlice(strSymbols, 0, end).join('') 32335 : string.slice(0, end); 32336 32337 if (separator === undefined) { 32338 return result + omission; 32339 } 32340 if (strSymbols) { 32341 end += (result.length - end); 32342 } 32343 if (isRegExp(separator)) { 32344 if (string.slice(end).search(separator)) { 32345 var match, 32346 substring = result; 32347 32348 if (!separator.global) { 32349 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 32350 } 32351 separator.lastIndex = 0; 32352 while ((match = separator.exec(substring))) { 32353 var newEnd = match.index; 32354 } 32355 result = result.slice(0, newEnd === undefined ? end : newEnd); 32356 } 32357 } else if (string.indexOf(baseToString(separator), end) != end) { 32358 var index = result.lastIndexOf(separator); 32359 if (index > -1) { 32360 result = result.slice(0, index); 32361 } 32362 } 32363 return result + omission; 32364 } 32365 32366 /** 32367 * The inverse of `_.escape`; this method converts the HTML entities 32368 * `&`, `<`, `>`, `"`, and `'` in `string` to 32369 * their corresponding characters. 32370 * 32371 * **Note:** No other HTML entities are unescaped. To unescape additional 32372 * HTML entities use a third-party library like [_he_](https://mths.be/he). 32373 * 32374 * @static 32375 * @memberOf _ 32376 * @since 0.6.0 32377 * @category String 32378 * @param {string} [string=''] The string to unescape. 32379 * @returns {string} Returns the unescaped string. 32380 * @example 32381 * 32382 * _.unescape('fred, barney, & pebbles'); 32383 * // => 'fred, barney, & pebbles' 32384 */ 32385 function unescape(string) { 32386 string = toString(string); 32387 return (string && reHasEscapedHtml.test(string)) 32388 ? string.replace(reEscapedHtml, unescapeHtmlChar) 32389 : string; 32390 } 32391 32392 /** 32393 * Converts `string`, as space separated words, to upper case. 32394 * 32395 * @static 32396 * @memberOf _ 32397 * @since 4.0.0 32398 * @category String 32399 * @param {string} [string=''] The string to convert. 32400 * @returns {string} Returns the upper cased string. 32401 * @example 32402 * 32403 * _.upperCase('--foo-bar'); 32404 * // => 'FOO BAR' 32405 * 32406 * _.upperCase('fooBar'); 32407 * // => 'FOO BAR' 32408 * 32409 * _.upperCase('__foo_bar__'); 32410 * // => 'FOO BAR' 32411 */ 32412 var upperCase = createCompounder(function(result, word, index) { 32413 return result + (index ? ' ' : '') + word.toUpperCase(); 32414 }); 32415 32416 /** 32417 * Converts the first character of `string` to upper case. 32418 * 32419 * @static 32420 * @memberOf _ 32421 * @since 4.0.0 32422 * @category String 32423 * @param {string} [string=''] The string to convert. 32424 * @returns {string} Returns the converted string. 32425 * @example 32426 * 32427 * _.upperFirst('fred'); 32428 * // => 'Fred' 32429 * 32430 * _.upperFirst('FRED'); 32431 * // => 'FRED' 32432 */ 32433 var upperFirst = createCaseFirst('toUpperCase'); 32434 32435 /** 32436 * Splits `string` into an array of its words. 32437 * 32438 * @static 32439 * @memberOf _ 32440 * @since 3.0.0 32441 * @category String 32442 * @param {string} [string=''] The string to inspect. 32443 * @param {RegExp|string} [pattern] The pattern to match words. 32444 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32445 * @returns {Array} Returns the words of `string`. 32446 * @example 32447 * 32448 * _.words('fred, barney, & pebbles'); 32449 * // => ['fred', 'barney', 'pebbles'] 32450 * 32451 * _.words('fred, barney, & pebbles', /[^, ]+/g); 32452 * // => ['fred', 'barney', '&', 'pebbles'] 32453 */ 32454 function words(string, pattern, guard) { 32455 string = toString(string); 32456 pattern = guard ? undefined : pattern; 32457 32458 if (pattern === undefined) { 32459 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 32460 } 32461 return string.match(pattern) || []; 32462 } 32463 32464 /*------------------------------------------------------------------------*/ 32465 32466 /** 32467 * Attempts to invoke `func`, returning either the result or the caught error 32468 * object. Any additional arguments are provided to `func` when it's invoked. 32469 * 32470 * @static 32471 * @memberOf _ 32472 * @since 3.0.0 32473 * @category Util 32474 * @param {Function} func The function to attempt. 32475 * @param {...*} [args] The arguments to invoke `func` with. 32476 * @returns {*} Returns the `func` result or error object. 32477 * @example 32478 * 32479 * // Avoid throwing errors for invalid selectors. 32480 * var elements = _.attempt(function(selector) { 32481 * return document.querySelectorAll(selector); 32482 * }, '>_>'); 32483 * 32484 * if (_.isError(elements)) { 32485 * elements = []; 32486 * } 32487 */ 32488 var attempt = baseRest(function(func, args) { 32489 try { 32490 return apply(func, undefined, args); 32491 } catch (e) { 32492 return isError(e) ? e : new Error(e); 32493 } 32494 }); 32495 32496 /** 32497 * Binds methods of an object to the object itself, overwriting the existing 32498 * method. 32499 * 32500 * **Note:** This method doesn't set the "length" property of bound functions. 32501 * 32502 * @static 32503 * @since 0.1.0 32504 * @memberOf _ 32505 * @category Util 32506 * @param {Object} object The object to bind and assign the bound methods to. 32507 * @param {...(string|string[])} methodNames The object method names to bind. 32508 * @returns {Object} Returns `object`. 32509 * @example 32510 * 32511 * var view = { 32512 * 'label': 'docs', 32513 * 'click': function() { 32514 * console.log('clicked ' + this.label); 32515 * } 32516 * }; 32517 * 32518 * _.bindAll(view, ['click']); 32519 * jQuery(element).on('click', view.click); 32520 * // => Logs 'clicked docs' when clicked. 32521 */ 32522 var bindAll = flatRest(function(object, methodNames) { 32523 arrayEach(methodNames, function(key) { 32524 key = toKey(key); 32525 baseAssignValue(object, key, bind(object[key], object)); 32526 }); 32527 return object; 32528 }); 32529 32530 /** 32531 * Creates a function that iterates over `pairs` and invokes the corresponding 32532 * function of the first predicate to return truthy. The predicate-function 32533 * pairs are invoked with the `this` binding and arguments of the created 32534 * function. 32535 * 32536 * @static 32537 * @memberOf _ 32538 * @since 4.0.0 32539 * @category Util 32540 * @param {Array} pairs The predicate-function pairs. 32541 * @returns {Function} Returns the new composite function. 32542 * @example 32543 * 32544 * var func = _.cond([ 32545 * [_.matches({ 'a': 1 }), _.constant('matches A')], 32546 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 32547 * [_.stubTrue, _.constant('no match')] 32548 * ]); 32549 * 32550 * func({ 'a': 1, 'b': 2 }); 32551 * // => 'matches A' 32552 * 32553 * func({ 'a': 0, 'b': 1 }); 32554 * // => 'matches B' 32555 * 32556 * func({ 'a': '1', 'b': '2' }); 32557 * // => 'no match' 32558 */ 32559 function cond(pairs) { 32560 var length = pairs == null ? 0 : pairs.length, 32561 toIteratee = getIteratee(); 32562 32563 pairs = !length ? [] : arrayMap(pairs, function(pair) { 32564 if (typeof pair[1] != 'function') { 32565 throw new TypeError(FUNC_ERROR_TEXT); 32566 } 32567 return [toIteratee(pair[0]), pair[1]]; 32568 }); 32569 32570 return baseRest(function(args) { 32571 var index = -1; 32572 while (++index < length) { 32573 var pair = pairs[index]; 32574 if (apply(pair[0], this, args)) { 32575 return apply(pair[1], this, args); 32576 } 32577 } 32578 }); 32579 } 32580 32581 /** 32582 * Creates a function that invokes the predicate properties of `source` with 32583 * the corresponding property values of a given object, returning `true` if 32584 * all predicates return truthy, else `false`. 32585 * 32586 * **Note:** The created function is equivalent to `_.conformsTo` with 32587 * `source` partially applied. 32588 * 32589 * @static 32590 * @memberOf _ 32591 * @since 4.0.0 32592 * @category Util 32593 * @param {Object} source The object of property predicates to conform to. 32594 * @returns {Function} Returns the new spec function. 32595 * @example 32596 * 32597 * var objects = [ 32598 * { 'a': 2, 'b': 1 }, 32599 * { 'a': 1, 'b': 2 } 32600 * ]; 32601 * 32602 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 32603 * // => [{ 'a': 1, 'b': 2 }] 32604 */ 32605 function conforms(source) { 32606 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 32607 } 32608 32609 /** 32610 * Creates a function that returns `value`. 32611 * 32612 * @static 32613 * @memberOf _ 32614 * @since 2.4.0 32615 * @category Util 32616 * @param {*} value The value to return from the new function. 32617 * @returns {Function} Returns the new constant function. 32618 * @example 32619 * 32620 * var objects = _.times(2, _.constant({ 'a': 1 })); 32621 * 32622 * console.log(objects); 32623 * // => [{ 'a': 1 }, { 'a': 1 }] 32624 * 32625 * console.log(objects[0] === objects[1]); 32626 * // => true 32627 */ 32628 function constant(value) { 32629 return function() { 32630 return value; 32631 }; 32632 } 32633 32634 /** 32635 * Checks `value` to determine whether a default value should be returned in 32636 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 32637 * or `undefined`. 32638 * 32639 * @static 32640 * @memberOf _ 32641 * @since 4.14.0 32642 * @category Util 32643 * @param {*} value The value to check. 32644 * @param {*} defaultValue The default value. 32645 * @returns {*} Returns the resolved value. 32646 * @example 32647 * 32648 * _.defaultTo(1, 10); 32649 * // => 1 32650 * 32651 * _.defaultTo(undefined, 10); 32652 * // => 10 32653 */ 32654 function defaultTo(value, defaultValue) { 32655 return (value == null || value !== value) ? defaultValue : value; 32656 } 32657 32658 /** 32659 * Creates a function that returns the result of invoking the given functions 32660 * with the `this` binding of the created function, where each successive 32661 * invocation is supplied the return value of the previous. 32662 * 32663 * @static 32664 * @memberOf _ 32665 * @since 3.0.0 32666 * @category Util 32667 * @param {...(Function|Function[])} [funcs] The functions to invoke. 32668 * @returns {Function} Returns the new composite function. 32669 * @see _.flowRight 32670 * @example 32671 * 32672 * function square(n) { 32673 * return n * n; 32674 * } 32675 * 32676 * var addSquare = _.flow([_.add, square]); 32677 * addSquare(1, 2); 32678 * // => 9 32679 */ 32680 var flow = createFlow(); 32681 32682 /** 32683 * This method is like `_.flow` except that it creates a function that 32684 * invokes the given functions from right to left. 32685 * 32686 * @static 32687 * @since 3.0.0 32688 * @memberOf _ 32689 * @category Util 32690 * @param {...(Function|Function[])} [funcs] The functions to invoke. 32691 * @returns {Function} Returns the new composite function. 32692 * @see _.flow 32693 * @example 32694 * 32695 * function square(n) { 32696 * return n * n; 32697 * } 32698 * 32699 * var addSquare = _.flowRight([square, _.add]); 32700 * addSquare(1, 2); 32701 * // => 9 32702 */ 32703 var flowRight = createFlow(true); 32704 32705 /** 32706 * This method returns the first argument it receives. 32707 * 32708 * @static 32709 * @since 0.1.0 32710 * @memberOf _ 32711 * @category Util 32712 * @param {*} value Any value. 32713 * @returns {*} Returns `value`. 32714 * @example 32715 * 32716 * var object = { 'a': 1 }; 32717 * 32718 * console.log(_.identity(object) === object); 32719 * // => true 32720 */ 32721 function identity(value) { 32722 return value; 32723 } 32724 32725 /** 32726 * Creates a function that invokes `func` with the arguments of the created 32727 * function. If `func` is a property name, the created function returns the 32728 * property value for a given element. If `func` is an array or object, the 32729 * created function returns `true` for elements that contain the equivalent 32730 * source properties, otherwise it returns `false`. 32731 * 32732 * @static 32733 * @since 4.0.0 32734 * @memberOf _ 32735 * @category Util 32736 * @param {*} [func=_.identity] The value to convert to a callback. 32737 * @returns {Function} Returns the callback. 32738 * @example 32739 * 32740 * var users = [ 32741 * { 'user': 'barney', 'age': 36, 'active': true }, 32742 * { 'user': 'fred', 'age': 40, 'active': false } 32743 * ]; 32744 * 32745 * // The `_.matches` iteratee shorthand. 32746 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 32747 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 32748 * 32749 * // The `_.matchesProperty` iteratee shorthand. 32750 * _.filter(users, _.iteratee(['user', 'fred'])); 32751 * // => [{ 'user': 'fred', 'age': 40 }] 32752 * 32753 * // The `_.property` iteratee shorthand. 32754 * _.map(users, _.iteratee('user')); 32755 * // => ['barney', 'fred'] 32756 * 32757 * // Create custom iteratee shorthands. 32758 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 32759 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 32760 * return func.test(string); 32761 * }; 32762 * }); 32763 * 32764 * _.filter(['abc', 'def'], /ef/); 32765 * // => ['def'] 32766 */ 32767 function iteratee(func) { 32768 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 32769 } 32770 32771 /** 32772 * Creates a function that performs a partial deep comparison between a given 32773 * object and `source`, returning `true` if the given object has equivalent 32774 * property values, else `false`. 32775 * 32776 * **Note:** The created function is equivalent to `_.isMatch` with `source` 32777 * partially applied. 32778 * 32779 * Partial comparisons will match empty array and empty object `source` 32780 * values against any array or object value, respectively. See `_.isEqual` 32781 * for a list of supported value comparisons. 32782 * 32783 * **Note:** Multiple values can be checked by combining several matchers 32784 * using `_.overSome` 32785 * 32786 * @static 32787 * @memberOf _ 32788 * @since 3.0.0 32789 * @category Util 32790 * @param {Object} source The object of property values to match. 32791 * @returns {Function} Returns the new spec function. 32792 * @example 32793 * 32794 * var objects = [ 32795 * { 'a': 1, 'b': 2, 'c': 3 }, 32796 * { 'a': 4, 'b': 5, 'c': 6 } 32797 * ]; 32798 * 32799 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 32800 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 32801 * 32802 * // Checking for several possible values 32803 * _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); 32804 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 32805 */ 32806 function matches(source) { 32807 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 32808 } 32809 32810 /** 32811 * Creates a function that performs a partial deep comparison between the 32812 * value at `path` of a given object to `srcValue`, returning `true` if the 32813 * object value is equivalent, else `false`. 32814 * 32815 * **Note:** Partial comparisons will match empty array and empty object 32816 * `srcValue` values against any array or object value, respectively. See 32817 * `_.isEqual` for a list of supported value comparisons. 32818 * 32819 * **Note:** Multiple values can be checked by combining several matchers 32820 * using `_.overSome` 32821 * 32822 * @static 32823 * @memberOf _ 32824 * @since 3.2.0 32825 * @category Util 32826 * @param {Array|string} path The path of the property to get. 32827 * @param {*} srcValue The value to match. 32828 * @returns {Function} Returns the new spec function. 32829 * @example 32830 * 32831 * var objects = [ 32832 * { 'a': 1, 'b': 2, 'c': 3 }, 32833 * { 'a': 4, 'b': 5, 'c': 6 } 32834 * ]; 32835 * 32836 * _.find(objects, _.matchesProperty('a', 4)); 32837 * // => { 'a': 4, 'b': 5, 'c': 6 } 32838 * 32839 * // Checking for several possible values 32840 * _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); 32841 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 32842 */ 32843 function matchesProperty(path, srcValue) { 32844 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 32845 } 32846 32847 /** 32848 * Creates a function that invokes the method at `path` of a given object. 32849 * Any additional arguments are provided to the invoked method. 32850 * 32851 * @static 32852 * @memberOf _ 32853 * @since 3.7.0 32854 * @category Util 32855 * @param {Array|string} path The path of the method to invoke. 32856 * @param {...*} [args] The arguments to invoke the method with. 32857 * @returns {Function} Returns the new invoker function. 32858 * @example 32859 * 32860 * var objects = [ 32861 * { 'a': { 'b': _.constant(2) } }, 32862 * { 'a': { 'b': _.constant(1) } } 32863 * ]; 32864 * 32865 * _.map(objects, _.method('a.b')); 32866 * // => [2, 1] 32867 * 32868 * _.map(objects, _.method(['a', 'b'])); 32869 * // => [2, 1] 32870 */ 32871 var method = baseRest(function(path, args) { 32872 return function(object) { 32873 return baseInvoke(object, path, args); 32874 }; 32875 }); 32876 32877 /** 32878 * The opposite of `_.method`; this method creates a function that invokes 32879 * the method at a given path of `object`. Any additional arguments are 32880 * provided to the invoked method. 32881 * 32882 * @static 32883 * @memberOf _ 32884 * @since 3.7.0 32885 * @category Util 32886 * @param {Object} object The object to query. 32887 * @param {...*} [args] The arguments to invoke the method with. 32888 * @returns {Function} Returns the new invoker function. 32889 * @example 32890 * 32891 * var array = _.times(3, _.constant), 32892 * object = { 'a': array, 'b': array, 'c': array }; 32893 * 32894 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 32895 * // => [2, 0] 32896 * 32897 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 32898 * // => [2, 0] 32899 */ 32900 var methodOf = baseRest(function(object, args) { 32901 return function(path) { 32902 return baseInvoke(object, path, args); 32903 }; 32904 }); 32905 32906 /** 32907 * Adds all own enumerable string keyed function properties of a source 32908 * object to the destination object. If `object` is a function, then methods 32909 * are added to its prototype as well. 32910 * 32911 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 32912 * avoid conflicts caused by modifying the original. 32913 * 32914 * @static 32915 * @since 0.1.0 32916 * @memberOf _ 32917 * @category Util 32918 * @param {Function|Object} [object=lodash] The destination object. 32919 * @param {Object} source The object of functions to add. 32920 * @param {Object} [options={}] The options object. 32921 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 32922 * @returns {Function|Object} Returns `object`. 32923 * @example 32924 * 32925 * function vowels(string) { 32926 * return _.filter(string, function(v) { 32927 * return /[aeiou]/i.test(v); 32928 * }); 32929 * } 32930 * 32931 * _.mixin({ 'vowels': vowels }); 32932 * _.vowels('fred'); 32933 * // => ['e'] 32934 * 32935 * _('fred').vowels().value(); 32936 * // => ['e'] 32937 * 32938 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 32939 * _('fred').vowels(); 32940 * // => ['e'] 32941 */ 32942 function mixin(object, source, options) { 32943 var props = keys(source), 32944 methodNames = baseFunctions(source, props); 32945 32946 if (options == null && 32947 !(isObject(source) && (methodNames.length || !props.length))) { 32948 options = source; 32949 source = object; 32950 object = this; 32951 methodNames = baseFunctions(source, keys(source)); 32952 } 32953 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 32954 isFunc = isFunction(object); 32955 32956 arrayEach(methodNames, function(methodName) { 32957 var func = source[methodName]; 32958 object[methodName] = func; 32959 if (isFunc) { 32960 object.prototype[methodName] = function() { 32961 var chainAll = this.__chain__; 32962 if (chain || chainAll) { 32963 var result = object(this.__wrapped__), 32964 actions = result.__actions__ = copyArray(this.__actions__); 32965 32966 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 32967 result.__chain__ = chainAll; 32968 return result; 32969 } 32970 return func.apply(object, arrayPush([this.value()], arguments)); 32971 }; 32972 } 32973 }); 32974 32975 return object; 32976 } 32977 32978 /** 32979 * Reverts the `_` variable to its previous value and returns a reference to 32980 * the `lodash` function. 32981 * 32982 * @static 32983 * @since 0.1.0 32984 * @memberOf _ 32985 * @category Util 32986 * @returns {Function} Returns the `lodash` function. 32987 * @example 32988 * 32989 * var lodash = _.noConflict(); 32990 */ 32991 function noConflict() { 32992 if (root._ === this) { 32993 root._ = oldDash; 32994 } 32995 return this; 32996 } 32997 32998 /** 32999 * This method returns `undefined`. 33000 * 33001 * @static 33002 * @memberOf _ 33003 * @since 2.3.0 33004 * @category Util 33005 * @example 33006 * 33007 * _.times(2, _.noop); 33008 * // => [undefined, undefined] 33009 */ 33010 function noop() { 33011 // No operation performed. 33012 } 33013 33014 /** 33015 * Creates a function that gets the argument at index `n`. If `n` is negative, 33016 * the nth argument from the end is returned. 33017 * 33018 * @static 33019 * @memberOf _ 33020 * @since 4.0.0 33021 * @category Util 33022 * @param {number} [n=0] The index of the argument to return. 33023 * @returns {Function} Returns the new pass-thru function. 33024 * @example 33025 * 33026 * var func = _.nthArg(1); 33027 * func('a', 'b', 'c', 'd'); 33028 * // => 'b' 33029 * 33030 * var func = _.nthArg(-2); 33031 * func('a', 'b', 'c', 'd'); 33032 * // => 'c' 33033 */ 33034 function nthArg(n) { 33035 n = toInteger(n); 33036 return baseRest(function(args) { 33037 return baseNth(args, n); 33038 }); 33039 } 33040 33041 /** 33042 * Creates a function that invokes `iteratees` with the arguments it receives 33043 * and returns their results. 33044 * 33045 * @static 33046 * @memberOf _ 33047 * @since 4.0.0 33048 * @category Util 33049 * @param {...(Function|Function[])} [iteratees=[_.identity]] 33050 * The iteratees to invoke. 33051 * @returns {Function} Returns the new function. 33052 * @example 33053 * 33054 * var func = _.over([Math.max, Math.min]); 33055 * 33056 * func(1, 2, 3, 4); 33057 * // => [4, 1] 33058 */ 33059 var over = createOver(arrayMap); 33060 33061 /** 33062 * Creates a function that checks if **all** of the `predicates` return 33063 * truthy when invoked with the arguments it receives. 33064 * 33065 * Following shorthands are possible for providing predicates. 33066 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 33067 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 33068 * 33069 * @static 33070 * @memberOf _ 33071 * @since 4.0.0 33072 * @category Util 33073 * @param {...(Function|Function[])} [predicates=[_.identity]] 33074 * The predicates to check. 33075 * @returns {Function} Returns the new function. 33076 * @example 33077 * 33078 * var func = _.overEvery([Boolean, isFinite]); 33079 * 33080 * func('1'); 33081 * // => true 33082 * 33083 * func(null); 33084 * // => false 33085 * 33086 * func(NaN); 33087 * // => false 33088 */ 33089 var overEvery = createOver(arrayEvery); 33090 33091 /** 33092 * Creates a function that checks if **any** of the `predicates` return 33093 * truthy when invoked with the arguments it receives. 33094 * 33095 * Following shorthands are possible for providing predicates. 33096 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 33097 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 33098 * 33099 * @static 33100 * @memberOf _ 33101 * @since 4.0.0 33102 * @category Util 33103 * @param {...(Function|Function[])} [predicates=[_.identity]] 33104 * The predicates to check. 33105 * @returns {Function} Returns the new function. 33106 * @example 33107 * 33108 * var func = _.overSome([Boolean, isFinite]); 33109 * 33110 * func('1'); 33111 * // => true 33112 * 33113 * func(null); 33114 * // => true 33115 * 33116 * func(NaN); 33117 * // => false 33118 * 33119 * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) 33120 * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) 33121 */ 33122 var overSome = createOver(arraySome); 33123 33124 /** 33125 * Creates a function that returns the value at `path` of a given object. 33126 * 33127 * @static 33128 * @memberOf _ 33129 * @since 2.4.0 33130 * @category Util 33131 * @param {Array|string} path The path of the property to get. 33132 * @returns {Function} Returns the new accessor function. 33133 * @example 33134 * 33135 * var objects = [ 33136 * { 'a': { 'b': 2 } }, 33137 * { 'a': { 'b': 1 } } 33138 * ]; 33139 * 33140 * _.map(objects, _.property('a.b')); 33141 * // => [2, 1] 33142 * 33143 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 33144 * // => [1, 2] 33145 */ 33146 function property(path) { 33147 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 33148 } 33149 33150 /** 33151 * The opposite of `_.property`; this method creates a function that returns 33152 * the value at a given path of `object`. 33153 * 33154 * @static 33155 * @memberOf _ 33156 * @since 3.0.0 33157 * @category Util 33158 * @param {Object} object The object to query. 33159 * @returns {Function} Returns the new accessor function. 33160 * @example 33161 * 33162 * var array = [0, 1, 2], 33163 * object = { 'a': array, 'b': array, 'c': array }; 33164 * 33165 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 33166 * // => [2, 0] 33167 * 33168 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 33169 * // => [2, 0] 33170 */ 33171 function propertyOf(object) { 33172 return function(path) { 33173 return object == null ? undefined : baseGet(object, path); 33174 }; 33175 } 33176 33177 /** 33178 * Creates an array of numbers (positive and/or negative) progressing from 33179 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 33180 * `start` is specified without an `end` or `step`. If `end` is not specified, 33181 * it's set to `start` with `start` then set to `0`. 33182 * 33183 * **Note:** JavaScript follows the IEEE-754 standard for resolving 33184 * floating-point values which can produce unexpected results. 33185 * 33186 * @static 33187 * @since 0.1.0 33188 * @memberOf _ 33189 * @category Util 33190 * @param {number} [start=0] The start of the range. 33191 * @param {number} end The end of the range. 33192 * @param {number} [step=1] The value to increment or decrement by. 33193 * @returns {Array} Returns the range of numbers. 33194 * @see _.inRange, _.rangeRight 33195 * @example 33196 * 33197 * _.range(4); 33198 * // => [0, 1, 2, 3] 33199 * 33200 * _.range(-4); 33201 * // => [0, -1, -2, -3] 33202 * 33203 * _.range(1, 5); 33204 * // => [1, 2, 3, 4] 33205 * 33206 * _.range(0, 20, 5); 33207 * // => [0, 5, 10, 15] 33208 * 33209 * _.range(0, -4, -1); 33210 * // => [0, -1, -2, -3] 33211 * 33212 * _.range(1, 4, 0); 33213 * // => [1, 1, 1] 33214 * 33215 * _.range(0); 33216 * // => [] 33217 */ 33218 var range = createRange(); 33219 33220 /** 33221 * This method is like `_.range` except that it populates values in 33222 * descending order. 33223 * 33224 * @static 33225 * @memberOf _ 33226 * @since 4.0.0 33227 * @category Util 33228 * @param {number} [start=0] The start of the range. 33229 * @param {number} end The end of the range. 33230 * @param {number} [step=1] The value to increment or decrement by. 33231 * @returns {Array} Returns the range of numbers. 33232 * @see _.inRange, _.range 33233 * @example 33234 * 33235 * _.rangeRight(4); 33236 * // => [3, 2, 1, 0] 33237 * 33238 * _.rangeRight(-4); 33239 * // => [-3, -2, -1, 0] 33240 * 33241 * _.rangeRight(1, 5); 33242 * // => [4, 3, 2, 1] 33243 * 33244 * _.rangeRight(0, 20, 5); 33245 * // => [15, 10, 5, 0] 33246 * 33247 * _.rangeRight(0, -4, -1); 33248 * // => [-3, -2, -1, 0] 33249 * 33250 * _.rangeRight(1, 4, 0); 33251 * // => [1, 1, 1] 33252 * 33253 * _.rangeRight(0); 33254 * // => [] 33255 */ 33256 var rangeRight = createRange(true); 33257 33258 /** 33259 * This method returns a new empty array. 33260 * 33261 * @static 33262 * @memberOf _ 33263 * @since 4.13.0 33264 * @category Util 33265 * @returns {Array} Returns the new empty array. 33266 * @example 33267 * 33268 * var arrays = _.times(2, _.stubArray); 33269 * 33270 * console.log(arrays); 33271 * // => [[], []] 33272 * 33273 * console.log(arrays[0] === arrays[1]); 33274 * // => false 33275 */ 33276 function stubArray() { 33277 return []; 33278 } 33279 33280 /** 33281 * This method returns `false`. 33282 * 33283 * @static 33284 * @memberOf _ 33285 * @since 4.13.0 33286 * @category Util 33287 * @returns {boolean} Returns `false`. 33288 * @example 33289 * 33290 * _.times(2, _.stubFalse); 33291 * // => [false, false] 33292 */ 33293 function stubFalse() { 33294 return false; 33295 } 33296 33297 /** 33298 * This method returns a new empty object. 33299 * 33300 * @static 33301 * @memberOf _ 33302 * @since 4.13.0 33303 * @category Util 33304 * @returns {Object} Returns the new empty object. 33305 * @example 33306 * 33307 * var objects = _.times(2, _.stubObject); 33308 * 33309 * console.log(objects); 33310 * // => [{}, {}] 33311 * 33312 * console.log(objects[0] === objects[1]); 33313 * // => false 33314 */ 33315 function stubObject() { 33316 return {}; 33317 } 33318 33319 /** 33320 * This method returns an empty string. 33321 * 33322 * @static 33323 * @memberOf _ 33324 * @since 4.13.0 33325 * @category Util 33326 * @returns {string} Returns the empty string. 33327 * @example 33328 * 33329 * _.times(2, _.stubString); 33330 * // => ['', ''] 33331 */ 33332 function stubString() { 33333 return ''; 33334 } 33335 33336 /** 33337 * This method returns `true`. 33338 * 33339 * @static 33340 * @memberOf _ 33341 * @since 4.13.0 33342 * @category Util 33343 * @returns {boolean} Returns `true`. 33344 * @example 33345 * 33346 * _.times(2, _.stubTrue); 33347 * // => [true, true] 33348 */ 33349 function stubTrue() { 33350 return true; 33351 } 33352 33353 /** 33354 * Invokes the iteratee `n` times, returning an array of the results of 33355 * each invocation. The iteratee is invoked with one argument; (index). 33356 * 33357 * @static 33358 * @since 0.1.0 33359 * @memberOf _ 33360 * @category Util 33361 * @param {number} n The number of times to invoke `iteratee`. 33362 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 33363 * @returns {Array} Returns the array of results. 33364 * @example 33365 * 33366 * _.times(3, String); 33367 * // => ['0', '1', '2'] 33368 * 33369 * _.times(4, _.constant(0)); 33370 * // => [0, 0, 0, 0] 33371 */ 33372 function times(n, iteratee) { 33373 n = toInteger(n); 33374 if (n < 1 || n > MAX_SAFE_INTEGER) { 33375 return []; 33376 } 33377 var index = MAX_ARRAY_LENGTH, 33378 length = nativeMin(n, MAX_ARRAY_LENGTH); 33379 33380 iteratee = getIteratee(iteratee); 33381 n -= MAX_ARRAY_LENGTH; 33382 33383 var result = baseTimes(length, iteratee); 33384 while (++index < n) { 33385 iteratee(index); 33386 } 33387 return result; 33388 } 33389 33390 /** 33391 * Converts `value` to a property path array. 33392 * 33393 * @static 33394 * @memberOf _ 33395 * @since 4.0.0 33396 * @category Util 33397 * @param {*} value The value to convert. 33398 * @returns {Array} Returns the new property path array. 33399 * @example 33400 * 33401 * _.toPath('a.b.c'); 33402 * // => ['a', 'b', 'c'] 33403 * 33404 * _.toPath('a[0].b.c'); 33405 * // => ['a', '0', 'b', 'c'] 33406 */ 33407 function toPath(value) { 33408 if (isArray(value)) { 33409 return arrayMap(value, toKey); 33410 } 33411 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 33412 } 33413 33414 /** 33415 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 33416 * 33417 * @static 33418 * @since 0.1.0 33419 * @memberOf _ 33420 * @category Util 33421 * @param {string} [prefix=''] The value to prefix the ID with. 33422 * @returns {string} Returns the unique ID. 33423 * @example 33424 * 33425 * _.uniqueId('contact_'); 33426 * // => 'contact_104' 33427 * 33428 * _.uniqueId(); 33429 * // => '105' 33430 */ 33431 function uniqueId(prefix) { 33432 var id = ++idCounter; 33433 return toString(prefix) + id; 33434 } 33435 33436 /*------------------------------------------------------------------------*/ 33437 33438 /** 33439 * Adds two numbers. 33440 * 33441 * @static 33442 * @memberOf _ 33443 * @since 3.4.0 33444 * @category Math 33445 * @param {number} augend The first number in an addition. 33446 * @param {number} addend The second number in an addition. 33447 * @returns {number} Returns the total. 33448 * @example 33449 * 33450 * _.add(6, 4); 33451 * // => 10 33452 */ 33453 var add = createMathOperation(function(augend, addend) { 33454 return augend + addend; 33455 }, 0); 33456 33457 /** 33458 * Computes `number` rounded up to `precision`. 33459 * 33460 * @static 33461 * @memberOf _ 33462 * @since 3.10.0 33463 * @category Math 33464 * @param {number} number The number to round up. 33465 * @param {number} [precision=0] The precision to round up to. 33466 * @returns {number} Returns the rounded up number. 33467 * @example 33468 * 33469 * _.ceil(4.006); 33470 * // => 5 33471 * 33472 * _.ceil(6.004, 2); 33473 * // => 6.01 33474 * 33475 * _.ceil(6040, -2); 33476 * // => 6100 33477 */ 33478 var ceil = createRound('ceil'); 33479 33480 /** 33481 * Divide two numbers. 33482 * 33483 * @static 33484 * @memberOf _ 33485 * @since 4.7.0 33486 * @category Math 33487 * @param {number} dividend The first number in a division. 33488 * @param {number} divisor The second number in a division. 33489 * @returns {number} Returns the quotient. 33490 * @example 33491 * 33492 * _.divide(6, 4); 33493 * // => 1.5 33494 */ 33495 var divide = createMathOperation(function(dividend, divisor) { 33496 return dividend / divisor; 33497 }, 1); 33498 33499 /** 33500 * Computes `number` rounded down to `precision`. 33501 * 33502 * @static 33503 * @memberOf _ 33504 * @since 3.10.0 33505 * @category Math 33506 * @param {number} number The number to round down. 33507 * @param {number} [precision=0] The precision to round down to. 33508 * @returns {number} Returns the rounded down number. 33509 * @example 33510 * 33511 * _.floor(4.006); 33512 * // => 4 33513 * 33514 * _.floor(0.046, 2); 33515 * // => 0.04 33516 * 33517 * _.floor(4060, -2); 33518 * // => 4000 33519 */ 33520 var floor = createRound('floor'); 33521 33522 /** 33523 * Computes the maximum value of `array`. If `array` is empty or falsey, 33524 * `undefined` is returned. 33525 * 33526 * @static 33527 * @since 0.1.0 33528 * @memberOf _ 33529 * @category Math 33530 * @param {Array} array The array to iterate over. 33531 * @returns {*} Returns the maximum value. 33532 * @example 33533 * 33534 * _.max([4, 2, 8, 6]); 33535 * // => 8 33536 * 33537 * _.max([]); 33538 * // => undefined 33539 */ 33540 function max(array) { 33541 return (array && array.length) 33542 ? baseExtremum(array, identity, baseGt) 33543 : undefined; 33544 } 33545 33546 /** 33547 * This method is like `_.max` except that it accepts `iteratee` which is 33548 * invoked for each element in `array` to generate the criterion by which 33549 * the value is ranked. The iteratee is invoked with one argument: (value). 33550 * 33551 * @static 33552 * @memberOf _ 33553 * @since 4.0.0 33554 * @category Math 33555 * @param {Array} array The array to iterate over. 33556 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33557 * @returns {*} Returns the maximum value. 33558 * @example 33559 * 33560 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 33561 * 33562 * _.maxBy(objects, function(o) { return o.n; }); 33563 * // => { 'n': 2 } 33564 * 33565 * // The `_.property` iteratee shorthand. 33566 * _.maxBy(objects, 'n'); 33567 * // => { 'n': 2 } 33568 */ 33569 function maxBy(array, iteratee) { 33570 return (array && array.length) 33571 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 33572 : undefined; 33573 } 33574 33575 /** 33576 * Computes the mean of the values in `array`. 33577 * 33578 * @static 33579 * @memberOf _ 33580 * @since 4.0.0 33581 * @category Math 33582 * @param {Array} array The array to iterate over. 33583 * @returns {number} Returns the mean. 33584 * @example 33585 * 33586 * _.mean([4, 2, 8, 6]); 33587 * // => 5 33588 */ 33589 function mean(array) { 33590 return baseMean(array, identity); 33591 } 33592 33593 /** 33594 * This method is like `_.mean` except that it accepts `iteratee` which is 33595 * invoked for each element in `array` to generate the value to be averaged. 33596 * The iteratee is invoked with one argument: (value). 33597 * 33598 * @static 33599 * @memberOf _ 33600 * @since 4.7.0 33601 * @category Math 33602 * @param {Array} array The array to iterate over. 33603 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33604 * @returns {number} Returns the mean. 33605 * @example 33606 * 33607 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 33608 * 33609 * _.meanBy(objects, function(o) { return o.n; }); 33610 * // => 5 33611 * 33612 * // The `_.property` iteratee shorthand. 33613 * _.meanBy(objects, 'n'); 33614 * // => 5 33615 */ 33616 function meanBy(array, iteratee) { 33617 return baseMean(array, getIteratee(iteratee, 2)); 33618 } 33619 33620 /** 33621 * Computes the minimum value of `array`. If `array` is empty or falsey, 33622 * `undefined` is returned. 33623 * 33624 * @static 33625 * @since 0.1.0 33626 * @memberOf _ 33627 * @category Math 33628 * @param {Array} array The array to iterate over. 33629 * @returns {*} Returns the minimum value. 33630 * @example 33631 * 33632 * _.min([4, 2, 8, 6]); 33633 * // => 2 33634 * 33635 * _.min([]); 33636 * // => undefined 33637 */ 33638 function min(array) { 33639 return (array && array.length) 33640 ? baseExtremum(array, identity, baseLt) 33641 : undefined; 33642 } 33643 33644 /** 33645 * This method is like `_.min` except that it accepts `iteratee` which is 33646 * invoked for each element in `array` to generate the criterion by which 33647 * the value is ranked. The iteratee is invoked with one argument: (value). 33648 * 33649 * @static 33650 * @memberOf _ 33651 * @since 4.0.0 33652 * @category Math 33653 * @param {Array} array The array to iterate over. 33654 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33655 * @returns {*} Returns the minimum value. 33656 * @example 33657 * 33658 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 33659 * 33660 * _.minBy(objects, function(o) { return o.n; }); 33661 * // => { 'n': 1 } 33662 * 33663 * // The `_.property` iteratee shorthand. 33664 * _.minBy(objects, 'n'); 33665 * // => { 'n': 1 } 33666 */ 33667 function minBy(array, iteratee) { 33668 return (array && array.length) 33669 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 33670 : undefined; 33671 } 33672 33673 /** 33674 * Multiply two numbers. 33675 * 33676 * @static 33677 * @memberOf _ 33678 * @since 4.7.0 33679 * @category Math 33680 * @param {number} multiplier The first number in a multiplication. 33681 * @param {number} multiplicand The second number in a multiplication. 33682 * @returns {number} Returns the product. 33683 * @example 33684 * 33685 * _.multiply(6, 4); 33686 * // => 24 33687 */ 33688 var multiply = createMathOperation(function(multiplier, multiplicand) { 33689 return multiplier * multiplicand; 33690 }, 1); 33691 33692 /** 33693 * Computes `number` rounded to `precision`. 33694 * 33695 * @static 33696 * @memberOf _ 33697 * @since 3.10.0 33698 * @category Math 33699 * @param {number} number The number to round. 33700 * @param {number} [precision=0] The precision to round to. 33701 * @returns {number} Returns the rounded number. 33702 * @example 33703 * 33704 * _.round(4.006); 33705 * // => 4 33706 * 33707 * _.round(4.006, 2); 33708 * // => 4.01 33709 * 33710 * _.round(4060, -2); 33711 * // => 4100 33712 */ 33713 var round = createRound('round'); 33714 33715 /** 33716 * Subtract two numbers. 33717 * 33718 * @static 33719 * @memberOf _ 33720 * @since 4.0.0 33721 * @category Math 33722 * @param {number} minuend The first number in a subtraction. 33723 * @param {number} subtrahend The second number in a subtraction. 33724 * @returns {number} Returns the difference. 33725 * @example 33726 * 33727 * _.subtract(6, 4); 33728 * // => 2 33729 */ 33730 var subtract = createMathOperation(function(minuend, subtrahend) { 33731 return minuend - subtrahend; 33732 }, 0); 33733 33734 /** 33735 * Computes the sum of the values in `array`. 33736 * 33737 * @static 33738 * @memberOf _ 33739 * @since 3.4.0 33740 * @category Math 33741 * @param {Array} array The array to iterate over. 33742 * @returns {number} Returns the sum. 33743 * @example 33744 * 33745 * _.sum([4, 2, 8, 6]); 33746 * // => 20 33747 */ 33748 function sum(array) { 33749 return (array && array.length) 33750 ? baseSum(array, identity) 33751 : 0; 33752 } 33753 33754 /** 33755 * This method is like `_.sum` except that it accepts `iteratee` which is 33756 * invoked for each element in `array` to generate the value to be summed. 33757 * The iteratee is invoked with one argument: (value). 33758 * 33759 * @static 33760 * @memberOf _ 33761 * @since 4.0.0 33762 * @category Math 33763 * @param {Array} array The array to iterate over. 33764 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33765 * @returns {number} Returns the sum. 33766 * @example 33767 * 33768 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 33769 * 33770 * _.sumBy(objects, function(o) { return o.n; }); 33771 * // => 20 33772 * 33773 * // The `_.property` iteratee shorthand. 33774 * _.sumBy(objects, 'n'); 33775 * // => 20 33776 */ 33777 function sumBy(array, iteratee) { 33778 return (array && array.length) 33779 ? baseSum(array, getIteratee(iteratee, 2)) 33780 : 0; 33781 } 33782 33783 /*------------------------------------------------------------------------*/ 33784 33785 // Add methods that return wrapped values in chain sequences. 33786 lodash.after = after; 33787 lodash.ary = ary; 33788 lodash.assign = assign; 33789 lodash.assignIn = assignIn; 33790 lodash.assignInWith = assignInWith; 33791 lodash.assignWith = assignWith; 33792 lodash.at = at; 33793 lodash.before = before; 33794 lodash.bind = bind; 33795 lodash.bindAll = bindAll; 33796 lodash.bindKey = bindKey; 33797 lodash.castArray = castArray; 33798 lodash.chain = chain; 33799 lodash.chunk = chunk; 33800 lodash.compact = compact; 33801 lodash.concat = concat; 33802 lodash.cond = cond; 33803 lodash.conforms = conforms; 33804 lodash.constant = constant; 33805 lodash.countBy = countBy; 33806 lodash.create = create; 33807 lodash.curry = curry; 33808 lodash.curryRight = curryRight; 33809 lodash.debounce = debounce; 33810 lodash.defaults = defaults; 33811 lodash.defaultsDeep = defaultsDeep; 33812 lodash.defer = defer; 33813 lodash.delay = delay; 33814 lodash.difference = difference; 33815 lodash.differenceBy = differenceBy; 33816 lodash.differenceWith = differenceWith; 33817 lodash.drop = drop; 33818 lodash.dropRight = dropRight; 33819 lodash.dropRightWhile = dropRightWhile; 33820 lodash.dropWhile = dropWhile; 33821 lodash.fill = fill; 33822 lodash.filter = filter; 33823 lodash.flatMap = flatMap; 33824 lodash.flatMapDeep = flatMapDeep; 33825 lodash.flatMapDepth = flatMapDepth; 33826 lodash.flatten = flatten; 33827 lodash.flattenDeep = flattenDeep; 33828 lodash.flattenDepth = flattenDepth; 33829 lodash.flip = flip; 33830 lodash.flow = flow; 33831 lodash.flowRight = flowRight; 33832 lodash.fromPairs = fromPairs; 33833 lodash.functions = functions; 33834 lodash.functionsIn = functionsIn; 33835 lodash.groupBy = groupBy; 33836 lodash.initial = initial; 33837 lodash.intersection = intersection; 33838 lodash.intersectionBy = intersectionBy; 33839 lodash.intersectionWith = intersectionWith; 33840 lodash.invert = invert; 33841 lodash.invertBy = invertBy; 33842 lodash.invokeMap = invokeMap; 33843 lodash.iteratee = iteratee; 33844 lodash.keyBy = keyBy; 33845 lodash.keys = keys; 33846 lodash.keysIn = keysIn; 33847 lodash.map = map; 33848 lodash.mapKeys = mapKeys; 33849 lodash.mapValues = mapValues; 33850 lodash.matches = matches; 33851 lodash.matchesProperty = matchesProperty; 33852 lodash.memoize = memoize; 33853 lodash.merge = merge; 33854 lodash.mergeWith = mergeWith; 33855 lodash.method = method; 33856 lodash.methodOf = methodOf; 33857 lodash.mixin = mixin; 33858 lodash.negate = negate; 33859 lodash.nthArg = nthArg; 33860 lodash.omit = omit; 33861 lodash.omitBy = omitBy; 33862 lodash.once = once; 33863 lodash.orderBy = orderBy; 33864 lodash.over = over; 33865 lodash.overArgs = overArgs; 33866 lodash.overEvery = overEvery; 33867 lodash.overSome = overSome; 33868 lodash.partial = partial; 33869 lodash.partialRight = partialRight; 33870 lodash.partition = partition; 33871 lodash.pick = pick; 33872 lodash.pickBy = pickBy; 33873 lodash.property = property; 33874 lodash.propertyOf = propertyOf; 33875 lodash.pull = pull; 33876 lodash.pullAll = pullAll; 33877 lodash.pullAllBy = pullAllBy; 33878 lodash.pullAllWith = pullAllWith; 33879 lodash.pullAt = pullAt; 33880 lodash.range = range; 33881 lodash.rangeRight = rangeRight; 33882 lodash.rearg = rearg; 33883 lodash.reject = reject; 33884 lodash.remove = remove; 33885 lodash.rest = rest; 33886 lodash.reverse = reverse; 33887 lodash.sampleSize = sampleSize; 33888 lodash.set = set; 33889 lodash.setWith = setWith; 33890 lodash.shuffle = shuffle; 33891 lodash.slice = slice; 33892 lodash.sortBy = sortBy; 33893 lodash.sortedUniq = sortedUniq; 33894 lodash.sortedUniqBy = sortedUniqBy; 33895 lodash.split = split; 33896 lodash.spread = spread; 33897 lodash.tail = tail; 33898 lodash.take = take; 33899 lodash.takeRight = takeRight; 33900 lodash.takeRightWhile = takeRightWhile; 33901 lodash.takeWhile = takeWhile; 33902 lodash.tap = tap; 33903 lodash.throttle = throttle; 33904 lodash.thru = thru; 33905 lodash.toArray = toArray; 33906 lodash.toPairs = toPairs; 33907 lodash.toPairsIn = toPairsIn; 33908 lodash.toPath = toPath; 33909 lodash.toPlainObject = toPlainObject; 33910 lodash.transform = transform; 33911 lodash.unary = unary; 33912 lodash.union = union; 33913 lodash.unionBy = unionBy; 33914 lodash.unionWith = unionWith; 33915 lodash.uniq = uniq; 33916 lodash.uniqBy = uniqBy; 33917 lodash.uniqWith = uniqWith; 33918 lodash.unset = unset; 33919 lodash.unzip = unzip; 33920 lodash.unzipWith = unzipWith; 33921 lodash.update = update; 33922 lodash.updateWith = updateWith; 33923 lodash.values = values; 33924 lodash.valuesIn = valuesIn; 33925 lodash.without = without; 33926 lodash.words = words; 33927 lodash.wrap = wrap; 33928 lodash.xor = xor; 33929 lodash.xorBy = xorBy; 33930 lodash.xorWith = xorWith; 33931 lodash.zip = zip; 33932 lodash.zipObject = zipObject; 33933 lodash.zipObjectDeep = zipObjectDeep; 33934 lodash.zipWith = zipWith; 33935 33936 // Add aliases. 33937 lodash.entries = toPairs; 33938 lodash.entriesIn = toPairsIn; 33939 lodash.extend = assignIn; 33940 lodash.extendWith = assignInWith; 33941 33942 // Add methods to `lodash.prototype`. 33943 mixin(lodash, lodash); 33944 33945 /*------------------------------------------------------------------------*/ 33946 33947 // Add methods that return unwrapped values in chain sequences. 33948 lodash.add = add; 33949 lodash.attempt = attempt; 33950 lodash.camelCase = camelCase; 33951 lodash.capitalize = capitalize; 33952 lodash.ceil = ceil; 33953 lodash.clamp = clamp; 33954 lodash.clone = clone; 33955 lodash.cloneDeep = cloneDeep; 33956 lodash.cloneDeepWith = cloneDeepWith; 33957 lodash.cloneWith = cloneWith; 33958 lodash.conformsTo = conformsTo; 33959 lodash.deburr = deburr; 33960 lodash.defaultTo = defaultTo; 33961 lodash.divide = divide; 33962 lodash.endsWith = endsWith; 33963 lodash.eq = eq; 33964 lodash.escape = escape; 33965 lodash.escapeRegExp = escapeRegExp; 33966 lodash.every = every; 33967 lodash.find = find; 33968 lodash.findIndex = findIndex; 33969 lodash.findKey = findKey; 33970 lodash.findLast = findLast; 33971 lodash.findLastIndex = findLastIndex; 33972 lodash.findLastKey = findLastKey; 33973 lodash.floor = floor; 33974 lodash.forEach = forEach; 33975 lodash.forEachRight = forEachRight; 33976 lodash.forIn = forIn; 33977 lodash.forInRight = forInRight; 33978 lodash.forOwn = forOwn; 33979 lodash.forOwnRight = forOwnRight; 33980 lodash.get = get; 33981 lodash.gt = gt; 33982 lodash.gte = gte; 33983 lodash.has = has; 33984 lodash.hasIn = hasIn; 33985 lodash.head = head; 33986 lodash.identity = identity; 33987 lodash.includes = includes; 33988 lodash.indexOf = indexOf; 33989 lodash.inRange = inRange; 33990 lodash.invoke = invoke; 33991 lodash.isArguments = isArguments; 33992 lodash.isArray = isArray; 33993 lodash.isArrayBuffer = isArrayBuffer; 33994 lodash.isArrayLike = isArrayLike; 33995 lodash.isArrayLikeObject = isArrayLikeObject; 33996 lodash.isBoolean = isBoolean; 33997 lodash.isBuffer = isBuffer; 33998 lodash.isDate = isDate; 33999 lodash.isElement = isElement; 34000 lodash.isEmpty = isEmpty; 34001 lodash.isEqual = isEqual; 34002 lodash.isEqualWith = isEqualWith; 34003 lodash.isError = isError; 34004 lodash.isFinite = isFinite; 34005 lodash.isFunction = isFunction; 34006 lodash.isInteger = isInteger; 34007 lodash.isLength = isLength; 34008 lodash.isMap = isMap; 34009 lodash.isMatch = isMatch; 34010 lodash.isMatchWith = isMatchWith; 34011 lodash.isNaN = isNaN; 34012 lodash.isNative = isNative; 34013 lodash.isNil = isNil; 34014 lodash.isNull = isNull; 34015 lodash.isNumber = isNumber; 34016 lodash.isObject = isObject; 34017 lodash.isObjectLike = isObjectLike; 34018 lodash.isPlainObject = isPlainObject; 34019 lodash.isRegExp = isRegExp; 34020 lodash.isSafeInteger = isSafeInteger; 34021 lodash.isSet = isSet; 34022 lodash.isString = isString; 34023 lodash.isSymbol = isSymbol; 34024 lodash.isTypedArray = isTypedArray; 34025 lodash.isUndefined = isUndefined; 34026 lodash.isWeakMap = isWeakMap; 34027 lodash.isWeakSet = isWeakSet; 34028 lodash.join = join; 34029 lodash.kebabCase = kebabCase; 34030 lodash.last = last; 34031 lodash.lastIndexOf = lastIndexOf; 34032 lodash.lowerCase = lowerCase; 34033 lodash.lowerFirst = lowerFirst; 34034 lodash.lt = lt; 34035 lodash.lte = lte; 34036 lodash.max = max; 34037 lodash.maxBy = maxBy; 34038 lodash.mean = mean; 34039 lodash.meanBy = meanBy; 34040 lodash.min = min; 34041 lodash.minBy = minBy; 34042 lodash.stubArray = stubArray; 34043 lodash.stubFalse = stubFalse; 34044 lodash.stubObject = stubObject; 34045 lodash.stubString = stubString; 34046 lodash.stubTrue = stubTrue; 34047 lodash.multiply = multiply; 34048 lodash.nth = nth; 34049 lodash.noConflict = noConflict; 34050 lodash.noop = noop; 34051 lodash.now = now; 34052 lodash.pad = pad; 34053 lodash.padEnd = padEnd; 34054 lodash.padStart = padStart; 34055 lodash.parseInt = parseInt; 34056 lodash.random = random; 34057 lodash.reduce = reduce; 34058 lodash.reduceRight = reduceRight; 34059 lodash.repeat = repeat; 34060 lodash.replace = replace; 34061 lodash.result = result; 34062 lodash.round = round; 34063 lodash.runInContext = runInContext; 34064 lodash.sample = sample; 34065 lodash.size = size; 34066 lodash.snakeCase = snakeCase; 34067 lodash.some = some; 34068 lodash.sortedIndex = sortedIndex; 34069 lodash.sortedIndexBy = sortedIndexBy; 34070 lodash.sortedIndexOf = sortedIndexOf; 34071 lodash.sortedLastIndex = sortedLastIndex; 34072 lodash.sortedLastIndexBy = sortedLastIndexBy; 34073 lodash.sortedLastIndexOf = sortedLastIndexOf; 34074 lodash.startCase = startCase; 34075 lodash.startsWith = startsWith; 34076 lodash.subtract = subtract; 34077 lodash.sum = sum; 34078 lodash.sumBy = sumBy; 34079 lodash.template = template; 34080 lodash.times = times; 34081 lodash.toFinite = toFinite; 34082 lodash.toInteger = toInteger; 34083 lodash.toLength = toLength; 34084 lodash.toLower = toLower; 34085 lodash.toNumber = toNumber; 34086 lodash.toSafeInteger = toSafeInteger; 34087 lodash.toString = toString; 34088 lodash.toUpper = toUpper; 34089 lodash.trim = trim; 34090 lodash.trimEnd = trimEnd; 34091 lodash.trimStart = trimStart; 34092 lodash.truncate = truncate; 34093 lodash.unescape = unescape; 34094 lodash.uniqueId = uniqueId; 34095 lodash.upperCase = upperCase; 34096 lodash.upperFirst = upperFirst; 34097 34098 // Add aliases. 34099 lodash.each = forEach; 34100 lodash.eachRight = forEachRight; 34101 lodash.first = head; 34102 34103 mixin(lodash, (function() { 34104 var source = {}; 34105 baseForOwn(lodash, function(func, methodName) { 34106 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 34107 source[methodName] = func; 34108 } 34109 }); 34110 return source; 34111 }()), { 'chain': false }); 34112 34113 /*------------------------------------------------------------------------*/ 34114 34115 /** 34116 * The semantic version number. 34117 * 34118 * @static 34119 * @memberOf _ 34120 * @type {string} 34121 */ 34122 lodash.VERSION = VERSION; 34123 34124 // Assign default placeholders. 34125 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 34126 lodash[methodName].placeholder = lodash; 34127 }); 34128 34129 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 34130 arrayEach(['drop', 'take'], function(methodName, index) { 34131 LazyWrapper.prototype[methodName] = function(n) { 34132 n = n === undefined ? 1 : nativeMax(toInteger(n), 0); 34133 34134 var result = (this.__filtered__ && !index) 34135 ? new LazyWrapper(this) 34136 : this.clone(); 34137 34138 if (result.__filtered__) { 34139 result.__takeCount__ = nativeMin(n, result.__takeCount__); 34140 } else { 34141 result.__views__.push({ 34142 'size': nativeMin(n, MAX_ARRAY_LENGTH), 34143 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 34144 }); 34145 } 34146 return result; 34147 }; 34148 34149 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 34150 return this.reverse()[methodName](n).reverse(); 34151 }; 34152 }); 34153 34154 // Add `LazyWrapper` methods that accept an `iteratee` value. 34155 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 34156 var type = index + 1, 34157 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 34158 34159 LazyWrapper.prototype[methodName] = function(iteratee) { 34160 var result = this.clone(); 34161 result.__iteratees__.push({ 34162 'iteratee': getIteratee(iteratee, 3), 34163 'type': type 34164 }); 34165 result.__filtered__ = result.__filtered__ || isFilter; 34166 return result; 34167 }; 34168 }); 34169 34170 // Add `LazyWrapper` methods for `_.head` and `_.last`. 34171 arrayEach(['head', 'last'], function(methodName, index) { 34172 var takeName = 'take' + (index ? 'Right' : ''); 34173 34174 LazyWrapper.prototype[methodName] = function() { 34175 return this[takeName](1).value()[0]; 34176 }; 34177 }); 34178 34179 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 34180 arrayEach(['initial', 'tail'], function(methodName, index) { 34181 var dropName = 'drop' + (index ? '' : 'Right'); 34182 34183 LazyWrapper.prototype[methodName] = function() { 34184 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 34185 }; 34186 }); 34187 34188 LazyWrapper.prototype.compact = function() { 34189 return this.filter(identity); 34190 }; 34191 34192 LazyWrapper.prototype.find = function(predicate) { 34193 return this.filter(predicate).head(); 34194 }; 34195 34196 LazyWrapper.prototype.findLast = function(predicate) { 34197 return this.reverse().find(predicate); 34198 }; 34199 34200 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 34201 if (typeof path == 'function') { 34202 return new LazyWrapper(this); 34203 } 34204 return this.map(function(value) { 34205 return baseInvoke(value, path, args); 34206 }); 34207 }); 34208 34209 LazyWrapper.prototype.reject = function(predicate) { 34210 return this.filter(negate(getIteratee(predicate))); 34211 }; 34212 34213 LazyWrapper.prototype.slice = function(start, end) { 34214 start = toInteger(start); 34215 34216 var result = this; 34217 if (result.__filtered__ && (start > 0 || end < 0)) { 34218 return new LazyWrapper(result); 34219 } 34220 if (start < 0) { 34221 result = result.takeRight(-start); 34222 } else if (start) { 34223 result = result.drop(start); 34224 } 34225 if (end !== undefined) { 34226 end = toInteger(end); 34227 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 34228 } 34229 return result; 34230 }; 34231 34232 LazyWrapper.prototype.takeRightWhile = function(predicate) { 34233 return this.reverse().takeWhile(predicate).reverse(); 34234 }; 34235 34236 LazyWrapper.prototype.toArray = function() { 34237 return this.take(MAX_ARRAY_LENGTH); 34238 }; 34239 34240 // Add `LazyWrapper` methods to `lodash.prototype`. 34241 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 34242 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 34243 isTaker = /^(?:head|last)$/.test(methodName), 34244 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 34245 retUnwrapped = isTaker || /^find/.test(methodName); 34246 34247 if (!lodashFunc) { 34248 return; 34249 } 34250 lodash.prototype[methodName] = function() { 34251 var value = this.__wrapped__, 34252 args = isTaker ? [1] : arguments, 34253 isLazy = value instanceof LazyWrapper, 34254 iteratee = args[0], 34255 useLazy = isLazy || isArray(value); 34256 34257 var interceptor = function(value) { 34258 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 34259 return (isTaker && chainAll) ? result[0] : result; 34260 }; 34261 34262 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 34263 // Avoid lazy use if the iteratee has a "length" value other than `1`. 34264 isLazy = useLazy = false; 34265 } 34266 var chainAll = this.__chain__, 34267 isHybrid = !!this.__actions__.length, 34268 isUnwrapped = retUnwrapped && !chainAll, 34269 onlyLazy = isLazy && !isHybrid; 34270 34271 if (!retUnwrapped && useLazy) { 34272 value = onlyLazy ? value : new LazyWrapper(this); 34273 var result = func.apply(value, args); 34274 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 34275 return new LodashWrapper(result, chainAll); 34276 } 34277 if (isUnwrapped && onlyLazy) { 34278 return func.apply(this, args); 34279 } 34280 result = this.thru(interceptor); 34281 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 34282 }; 34283 }); 34284 34285 // Add `Array` methods to `lodash.prototype`. 34286 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 34287 var func = arrayProto[methodName], 34288 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 34289 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 34290 34291 lodash.prototype[methodName] = function() { 34292 var args = arguments; 34293 if (retUnwrapped && !this.__chain__) { 34294 var value = this.value(); 34295 return func.apply(isArray(value) ? value : [], args); 34296 } 34297 return this[chainName](function(value) { 34298 return func.apply(isArray(value) ? value : [], args); 34299 }); 34300 }; 34301 }); 34302 34303 // Map minified method names to their real names. 34304 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 34305 var lodashFunc = lodash[methodName]; 34306 if (lodashFunc) { 34307 var key = lodashFunc.name + ''; 34308 if (!hasOwnProperty.call(realNames, key)) { 34309 realNames[key] = []; 34310 } 34311 realNames[key].push({ 'name': methodName, 'func': lodashFunc }); 34312 } 34313 }); 34314 34315 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 34316 'name': 'wrapper', 34317 'func': undefined 34318 }]; 34319 34320 // Add methods to `LazyWrapper`. 34321 LazyWrapper.prototype.clone = lazyClone; 34322 LazyWrapper.prototype.reverse = lazyReverse; 34323 LazyWrapper.prototype.value = lazyValue; 34324 34325 // Add chain sequence methods to the `lodash` wrapper. 34326 lodash.prototype.at = wrapperAt; 34327 lodash.prototype.chain = wrapperChain; 34328 lodash.prototype.commit = wrapperCommit; 34329 lodash.prototype.next = wrapperNext; 34330 lodash.prototype.plant = wrapperPlant; 34331 lodash.prototype.reverse = wrapperReverse; 34332 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 34333 34334 // Add lazy aliases. 34335 lodash.prototype.first = lodash.prototype.head; 34336 34337 if (symIterator) { 34338 lodash.prototype[symIterator] = wrapperToIterator; 34339 } 34340 return lodash; 34341 }); 34342 34343 /*--------------------------------------------------------------------------*/ 34344 34345 // Export lodash. 34346 var _ = runInContext(); 34347 34348 // Some AMD build optimizers, like r.js, check for condition patterns like: 34349 if (true) { 34350 // Expose Lodash on the global object to prevent errors when Lodash is 34351 // loaded by a script tag in the presence of an AMD loader. 34352 // See http://requirejs.org/docs/errors.html#mismatch for more details. 34353 // Use `_.noConflict` to remove Lodash from the global object. 34354 root._ = _; 34355 34356 // Define as an anonymous module so, through path mapping, it can be 34357 // referenced as the "underscore" module. 34358 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 34359 return _; 34360 }).call(exports, __webpack_require__, exports, module), 34361 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 34362 } 34363 // Check for `exports` after `define` in case a build optimizer adds it. 34364 else {} 34365}.call(this)); 34366 34367/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) 34368 34369/***/ }), 34370
vendor: 89,123 bytes, lines 34371-37000
34371/***/ "./node_modules/popper.js/dist/esm/popper.js": 34372/*!***************************************************!*\ 34373 !*** ./node_modules/popper.js/dist/esm/popper.js ***! 34374 \***************************************************/ 34375/*! exports provided: default */ 34376/***/ (function(module, __webpack_exports__, __webpack_require__) { 34377 34378"use strict"; 34379__webpack_require__.r(__webpack_exports__); 34380/* WEBPACK VAR INJECTION */(function(global) {/**! 34381 * @fileOverview Kickass library to create and place poppers near their reference elements. 34382 * @version 1.16.1 34383 * @license 34384 * Copyright (c) 2016 Federico Zivolo and contributors 34385 * 34386 * Permission is hereby granted, free of charge, to any person obtaining a copy 34387 * of this software and associated documentation files (the "Software"), to deal 34388 * in the Software without restriction, including without limitation the rights 34389 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 34390 * copies of the Software, and to permit persons to whom the Software is 34391 * furnished to do so, subject to the following conditions: 34392 * 34393 * The above copyright notice and this permission notice shall be included in all 34394 * copies or substantial portions of the Software. 34395 * 34396 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34397 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34398 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34399 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34400 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34401 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34402 * SOFTWARE. 34403 */ 34404var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 34405 34406var timeoutDuration = function () { 34407 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 34408 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 34409 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 34410 return 1; 34411 } 34412 } 34413 return 0; 34414}(); 34415 34416function microtaskDebounce(fn) { 34417 var called = false; 34418 return function () { 34419 if (called) { 34420 return; 34421 } 34422 called = true; 34423 window.Promise.resolve().then(function () { 34424 called = false; 34425 fn(); 34426 }); 34427 }; 34428} 34429 34430function taskDebounce(fn) { 34431 var scheduled = false; 34432 return function () { 34433 if (!scheduled) { 34434 scheduled = true; 34435 setTimeout(function () { 34436 scheduled = false; 34437 fn(); 34438 }, timeoutDuration); 34439 } 34440 }; 34441} 34442 34443var supportsMicroTasks = isBrowser && window.Promise; 34444 34445/** 34446* Create a debounced version of a method, that's asynchronously deferred 34447* but called in the minimum time possible. 34448* 34449* @method 34450* @memberof Popper.Utils 34451* @argument {Function} fn 34452* @returns {Function} 34453*/ 34454var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 34455 34456/** 34457 * Check if the given variable is a function 34458 * @method 34459 * @memberof Popper.Utils 34460 * @argument {Any} functionToCheck - variable to check 34461 * @returns {Boolean} answer to: is a function? 34462 */ 34463function isFunction(functionToCheck) { 34464 var getType = {}; 34465 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 34466} 34467 34468/** 34469 * Get CSS computed property of the given element 34470 * @method 34471 * @memberof Popper.Utils 34472 * @argument {Eement} element 34473 * @argument {String} property 34474 */ 34475function getStyleComputedProperty(element, property) { 34476 if (element.nodeType !== 1) { 34477 return []; 34478 } 34479 // NOTE: 1 DOM access here 34480 var window = element.ownerDocument.defaultView; 34481 var css = window.getComputedStyle(element, null); 34482 return property ? css[property] : css; 34483} 34484 34485/** 34486 * Returns the parentNode or the host of the element 34487 * @method 34488 * @memberof Popper.Utils 34489 * @argument {Element} element 34490 * @returns {Element} parent 34491 */ 34492function getParentNode(element) { 34493 if (element.nodeName === 'HTML') { 34494 return element; 34495 } 34496 return element.parentNode || element.host; 34497} 34498 34499/** 34500 * Returns the scrolling parent of the given element 34501 * @method 34502 * @memberof Popper.Utils 34503 * @argument {Element} element 34504 * @returns {Element} scroll parent 34505 */ 34506function getScrollParent(element) { 34507 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 34508 if (!element) { 34509 return document.body; 34510 } 34511 34512 switch (element.nodeName) { 34513 case 'HTML': 34514 case 'BODY': 34515 return element.ownerDocument.body; 34516 case '#document': 34517 return element.body; 34518 } 34519 34520 // Firefox want us to check `-x` and `-y` variations as well 34521 34522 var _getStyleComputedProp = getStyleComputedProperty(element), 34523 overflow = _getStyleComputedProp.overflow, 34524 overflowX = _getStyleComputedProp.overflowX, 34525 overflowY = _getStyleComputedProp.overflowY; 34526 34527 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 34528 return element; 34529 } 34530 34531 return getScrollParent(getParentNode(element)); 34532} 34533 34534/** 34535 * Returns the reference node of the reference object, or the reference object itself. 34536 * @method 34537 * @memberof Popper.Utils 34538 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 34539 * @returns {Element} parent 34540 */ 34541function getReferenceNode(reference) { 34542 return reference && reference.referenceNode ? reference.referenceNode : reference; 34543} 34544 34545var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 34546var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 34547 34548/** 34549 * Determines if the browser is Internet Explorer 34550 * @method 34551 * @memberof Popper.Utils 34552 * @param {Number} version to check 34553 * @returns {Boolean} isIE 34554 */ 34555function isIE(version) { 34556 if (version === 11) { 34557 return isIE11; 34558 } 34559 if (version === 10) { 34560 return isIE10; 34561 } 34562 return isIE11 || isIE10; 34563} 34564 34565/** 34566 * Returns the offset parent of the given element 34567 * @method 34568 * @memberof Popper.Utils 34569 * @argument {Element} element 34570 * @returns {Element} offset parent 34571 */ 34572function getOffsetParent(element) { 34573 if (!element) { 34574 return document.documentElement; 34575 } 34576 34577 var noOffsetParent = isIE(10) ? document.body : null; 34578 34579 // NOTE: 1 DOM access here 34580 var offsetParent = element.offsetParent || null; 34581 // Skip hidden elements which don't have an offsetParent 34582 while (offsetParent === noOffsetParent && element.nextElementSibling) { 34583 offsetParent = (element = element.nextElementSibling).offsetParent; 34584 } 34585 34586 var nodeName = offsetParent && offsetParent.nodeName; 34587 34588 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 34589 return element ? element.ownerDocument.documentElement : document.documentElement; 34590 } 34591 34592 // .offsetParent will return the closest TH, TD or TABLE in case 34593 // no offsetParent is present, I hate this job... 34594 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 34595 return getOffsetParent(offsetParent); 34596 } 34597 34598 return offsetParent; 34599} 34600 34601function isOffsetContainer(element) { 34602 var nodeName = element.nodeName; 34603 34604 if (nodeName === 'BODY') { 34605 return false; 34606 } 34607 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 34608} 34609 34610/** 34611 * Finds the root node (document, shadowDOM root) of the given element 34612 * @method 34613 * @memberof Popper.Utils 34614 * @argument {Element} node 34615 * @returns {Element} root node 34616 */ 34617function getRoot(node) { 34618 if (node.parentNode !== null) { 34619 return getRoot(node.parentNode); 34620 } 34621 34622 return node; 34623} 34624 34625/** 34626 * Finds the offset parent common to the two provided nodes 34627 * @method 34628 * @memberof Popper.Utils 34629 * @argument {Element} element1 34630 * @argument {Element} element2 34631 * @returns {Element} common offset parent 34632 */ 34633function findCommonOffsetParent(element1, element2) { 34634 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 34635 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 34636 return document.documentElement; 34637 } 34638 34639 // Here we make sure to give as "start" the element that comes first in the DOM 34640 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 34641 var start = order ? element1 : element2; 34642 var end = order ? element2 : element1; 34643 34644 // Get common ancestor container 34645 var range = document.createRange(); 34646 range.setStart(start, 0); 34647 range.setEnd(end, 0); 34648 var commonAncestorContainer = range.commonAncestorContainer; 34649 34650 // Both nodes are inside #document 34651 34652 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 34653 if (isOffsetContainer(commonAncestorContainer)) { 34654 return commonAncestorContainer; 34655 } 34656 34657 return getOffsetParent(commonAncestorContainer); 34658 } 34659 34660 // one of the nodes is inside shadowDOM, find which one 34661 var element1root = getRoot(element1); 34662 if (element1root.host) { 34663 return findCommonOffsetParent(element1root.host, element2); 34664 } else { 34665 return findCommonOffsetParent(element1, getRoot(element2).host); 34666 } 34667} 34668 34669/** 34670 * Gets the scroll value of the given element in the given side (top and left) 34671 * @method 34672 * @memberof Popper.Utils 34673 * @argument {Element} element 34674 * @argument {String} side `top` or `left` 34675 * @returns {number} amount of scrolled pixels 34676 */ 34677function getScroll(element) { 34678 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 34679 34680 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 34681 var nodeName = element.nodeName; 34682 34683 if (nodeName === 'BODY' || nodeName === 'HTML') { 34684 var html = element.ownerDocument.documentElement; 34685 var scrollingElement = element.ownerDocument.scrollingElement || html; 34686 return scrollingElement[upperSide]; 34687 } 34688 34689 return element[upperSide]; 34690} 34691 34692/* 34693 * Sum or subtract the element scroll values (left and top) from a given rect object 34694 * @method 34695 * @memberof Popper.Utils 34696 * @param {Object} rect - Rect object you want to change 34697 * @param {HTMLElement} element - The element from the function reads the scroll values 34698 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 34699 * @return {Object} rect - The modifier rect object 34700 */ 34701function includeScroll(rect, element) { 34702 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 34703 34704 var scrollTop = getScroll(element, 'top'); 34705 var scrollLeft = getScroll(element, 'left'); 34706 var modifier = subtract ? -1 : 1; 34707 rect.top += scrollTop * modifier; 34708 rect.bottom += scrollTop * modifier; 34709 rect.left += scrollLeft * modifier; 34710 rect.right += scrollLeft * modifier; 34711 return rect; 34712} 34713 34714/* 34715 * Helper to detect borders of a given element 34716 * @method 34717 * @memberof Popper.Utils 34718 * @param {CSSStyleDeclaration} styles 34719 * Result of `getStyleComputedProperty` on the given element 34720 * @param {String} axis - `x` or `y` 34721 * @return {number} borders - The borders size of the given axis 34722 */ 34723 34724function getBordersSize(styles, axis) { 34725 var sideA = axis === 'x' ? 'Left' : 'Top'; 34726 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 34727 34728 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 34729} 34730 34731function getSize(axis, body, html, computedStyle) { 34732 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); 34733} 34734 34735function getWindowSizes(document) { 34736 var body = document.body; 34737 var html = document.documentElement; 34738 var computedStyle = isIE(10) && getComputedStyle(html); 34739 34740 return { 34741 height: getSize('Height', body, html, computedStyle), 34742 width: getSize('Width', body, html, computedStyle) 34743 }; 34744} 34745 34746var classCallCheck = function (instance, Constructor) { 34747 if (!(instance instanceof Constructor)) { 34748 throw new TypeError("Cannot call a class as a function"); 34749 } 34750}; 34751 34752var createClass = function () { 34753 function defineProperties(target, props) { 34754 for (var i = 0; i < props.length; i++) { 34755 var descriptor = props[i]; 34756 descriptor.enumerable = descriptor.enumerable || false; 34757 descriptor.configurable = true; 34758 if ("value" in descriptor) descriptor.writable = true; 34759 Object.defineProperty(target, descriptor.key, descriptor); 34760 } 34761 } 34762 34763 return function (Constructor, protoProps, staticProps) { 34764 if (protoProps) defineProperties(Constructor.prototype, protoProps); 34765 if (staticProps) defineProperties(Constructor, staticProps); 34766 return Constructor; 34767 }; 34768}(); 34769 34770 34771 34772 34773 34774var defineProperty = function (obj, key, value) { 34775 if (key in obj) { 34776 Object.defineProperty(obj, key, { 34777 value: value, 34778 enumerable: true, 34779 configurable: true, 34780 writable: true 34781 }); 34782 } else { 34783 obj[key] = value; 34784 } 34785 34786 return obj; 34787}; 34788 34789var _extends = Object.assign || function (target) { 34790 for (var i = 1; i < arguments.length; i++) { 34791 var source = arguments[i]; 34792 34793 for (var key in source) { 34794 if (Object.prototype.hasOwnProperty.call(source, key)) { 34795 target[key] = source[key]; 34796 } 34797 } 34798 } 34799 34800 return target; 34801}; 34802 34803/** 34804 * Given element offsets, generate an output similar to getBoundingClientRect 34805 * @method 34806 * @memberof Popper.Utils 34807 * @argument {Object} offsets 34808 * @returns {Object} ClientRect like output 34809 */ 34810function getClientRect(offsets) { 34811 return _extends({}, offsets, { 34812 right: offsets.left + offsets.width, 34813 bottom: offsets.top + offsets.height 34814 }); 34815} 34816 34817/** 34818 * Get bounding client rect of given element 34819 * @method 34820 * @memberof Popper.Utils 34821 * @param {HTMLElement} element 34822 * @return {Object} client rect 34823 */ 34824function getBoundingClientRect(element) { 34825 var rect = {}; 34826 34827 // IE10 10 FIX: Please, don't ask, the element isn't 34828 // considered in DOM in some circumstances... 34829 // This isn't reproducible in IE10 compatibility mode of IE11 34830 try { 34831 if (isIE(10)) { 34832 rect = element.getBoundingClientRect(); 34833 var scrollTop = getScroll(element, 'top'); 34834 var scrollLeft = getScroll(element, 'left'); 34835 rect.top += scrollTop; 34836 rect.left += scrollLeft; 34837 rect.bottom += scrollTop; 34838 rect.right += scrollLeft; 34839 } else { 34840 rect = element.getBoundingClientRect(); 34841 } 34842 } catch (e) {} 34843 34844 var result = { 34845 left: rect.left, 34846 top: rect.top, 34847 width: rect.right - rect.left, 34848 height: rect.bottom - rect.top 34849 }; 34850 34851 // subtract scrollbar size from sizes 34852 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 34853 var width = sizes.width || element.clientWidth || result.width; 34854 var height = sizes.height || element.clientHeight || result.height; 34855 34856 var horizScrollbar = element.offsetWidth - width; 34857 var vertScrollbar = element.offsetHeight - height; 34858 34859 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 34860 // we make this check conditional for performance reasons 34861 if (horizScrollbar || vertScrollbar) { 34862 var styles = getStyleComputedProperty(element); 34863 horizScrollbar -= getBordersSize(styles, 'x'); 34864 vertScrollbar -= getBordersSize(styles, 'y'); 34865 34866 result.width -= horizScrollbar; 34867 result.height -= vertScrollbar; 34868 } 34869 34870 return getClientRect(result); 34871} 34872 34873function getOffsetRectRelativeToArbitraryNode(children, parent) { 34874 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 34875 34876 var isIE10 = isIE(10); 34877 var isHTML = parent.nodeName === 'HTML'; 34878 var childrenRect = getBoundingClientRect(children); 34879 var parentRect = getBoundingClientRect(parent); 34880 var scrollParent = getScrollParent(children); 34881 34882 var styles = getStyleComputedProperty(parent); 34883 var borderTopWidth = parseFloat(styles.borderTopWidth); 34884 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 34885 34886 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 34887 if (fixedPosition && isHTML) { 34888 parentRect.top = Math.max(parentRect.top, 0); 34889 parentRect.left = Math.max(parentRect.left, 0); 34890 } 34891 var offsets = getClientRect({ 34892 top: childrenRect.top - parentRect.top - borderTopWidth, 34893 left: childrenRect.left - parentRect.left - borderLeftWidth, 34894 width: childrenRect.width, 34895 height: childrenRect.height 34896 }); 34897 offsets.marginTop = 0; 34898 offsets.marginLeft = 0; 34899 34900 // Subtract margins of documentElement in case it's being used as parent 34901 // we do this only on HTML because it's the only element that behaves 34902 // differently when margins are applied to it. The margins are included in 34903 // the box of the documentElement, in the other cases not. 34904 if (!isIE10 && isHTML) { 34905 var marginTop = parseFloat(styles.marginTop); 34906 var marginLeft = parseFloat(styles.marginLeft); 34907 34908 offsets.top -= borderTopWidth - marginTop; 34909 offsets.bottom -= borderTopWidth - marginTop; 34910 offsets.left -= borderLeftWidth - marginLeft; 34911 offsets.right -= borderLeftWidth - marginLeft; 34912 34913 // Attach marginTop and marginLeft because in some circumstances we may need them 34914 offsets.marginTop = marginTop; 34915 offsets.marginLeft = marginLeft; 34916 } 34917 34918 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 34919 offsets = includeScroll(offsets, parent); 34920 } 34921 34922 return offsets; 34923} 34924 34925function getViewportOffsetRectRelativeToArtbitraryNode(element) { 34926 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 34927 34928 var html = element.ownerDocument.documentElement; 34929 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 34930 var width = Math.max(html.clientWidth, window.innerWidth || 0); 34931 var height = Math.max(html.clientHeight, window.innerHeight || 0); 34932 34933 var scrollTop = !excludeScroll ? getScroll(html) : 0; 34934 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 34935 34936 var offset = { 34937 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 34938 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 34939 width: width, 34940 height: height 34941 }; 34942 34943 return getClientRect(offset); 34944} 34945 34946/** 34947 * Check if the given element is fixed or is inside a fixed parent 34948 * @method 34949 * @memberof Popper.Utils 34950 * @argument {Element} element 34951 * @argument {Element} customContainer 34952 * @returns {Boolean} answer to "isFixed?" 34953 */ 34954function isFixed(element) { 34955 var nodeName = element.nodeName; 34956 if (nodeName === 'BODY' || nodeName === 'HTML') { 34957 return false; 34958 } 34959 if (getStyleComputedProperty(element, 'position') === 'fixed') { 34960 return true; 34961 } 34962 var parentNode = getParentNode(element); 34963 if (!parentNode) { 34964 return false; 34965 } 34966 return isFixed(parentNode); 34967} 34968 34969/** 34970 * Finds the first parent of an element that has a transformed property defined 34971 * @method 34972 * @memberof Popper.Utils 34973 * @argument {Element} element 34974 * @returns {Element} first transformed parent or documentElement 34975 */ 34976 34977function getFixedPositionOffsetParent(element) { 34978 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 34979 if (!element || !element.parentElement || isIE()) { 34980 return document.documentElement; 34981 } 34982 var el = element.parentElement; 34983 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 34984 el = el.parentElement; 34985 } 34986 return el || document.documentElement; 34987} 34988 34989/** 34990 * Computed the boundaries limits and return them 34991 * @method 34992 * @memberof Popper.Utils 34993 * @param {HTMLElement} popper 34994 * @param {HTMLElement} reference 34995 * @param {number} padding 34996 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 34997 * @param {Boolean} fixedPosition - Is in fixed position mode 34998 * @returns {Object} Coordinates of the boundaries 34999 */ 35000function getBoundaries(popper, reference, padding, boundariesElement) { 35001 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 35002 35003 // NOTE: 1 DOM access here 35004 35005 var boundaries = { top: 0, left: 0 }; 35006 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 35007 35008 // Handle viewport case 35009 if (boundariesElement === 'viewport') { 35010 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 35011 } else { 35012 // Handle other cases based on DOM element used as boundaries 35013 var boundariesNode = void 0; 35014 if (boundariesElement === 'scrollParent') { 35015 boundariesNode = getScrollParent(getParentNode(reference)); 35016 if (boundariesNode.nodeName === 'BODY') { 35017 boundariesNode = popper.ownerDocument.documentElement; 35018 } 35019 } else if (boundariesElement === 'window') { 35020 boundariesNode = popper.ownerDocument.documentElement; 35021 } else { 35022 boundariesNode = boundariesElement; 35023 } 35024 35025 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 35026 35027 // In case of HTML, we need a different computation 35028 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 35029 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 35030 height = _getWindowSizes.height, 35031 width = _getWindowSizes.width; 35032 35033 boundaries.top += offsets.top - offsets.marginTop; 35034 boundaries.bottom = height + offsets.top; 35035 boundaries.left += offsets.left - offsets.marginLeft; 35036 boundaries.right = width + offsets.left; 35037 } else { 35038 // for all the other DOM elements, this one is good 35039 boundaries = offsets; 35040 } 35041 } 35042 35043 // Add paddings 35044 padding = padding || 0; 35045 var isPaddingNumber = typeof padding === 'number'; 35046 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 35047 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 35048 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 35049 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 35050 35051 return boundaries; 35052} 35053 35054function getArea(_ref) { 35055 var width = _ref.width, 35056 height = _ref.height; 35057 35058 return width * height; 35059} 35060 35061/** 35062 * Utility used to transform the `auto` placement to the placement with more 35063 * available space. 35064 * @method 35065 * @memberof Popper.Utils 35066 * @argument {Object} data - The data object generated by update method 35067 * @argument {Object} options - Modifiers configuration and options 35068 * @returns {Object} The data object, properly modified 35069 */ 35070function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 35071 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 35072 35073 if (placement.indexOf('auto') === -1) { 35074 return placement; 35075 } 35076 35077 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 35078 35079 var rects = { 35080 top: { 35081 width: boundaries.width, 35082 height: refRect.top - boundaries.top 35083 }, 35084 right: { 35085 width: boundaries.right - refRect.right, 35086 height: boundaries.height 35087 }, 35088 bottom: { 35089 width: boundaries.width, 35090 height: boundaries.bottom - refRect.bottom 35091 }, 35092 left: { 35093 width: refRect.left - boundaries.left, 35094 height: boundaries.height 35095 } 35096 }; 35097 35098 var sortedAreas = Object.keys(rects).map(function (key) { 35099 return _extends({ 35100 key: key 35101 }, rects[key], { 35102 area: getArea(rects[key]) 35103 }); 35104 }).sort(function (a, b) { 35105 return b.area - a.area; 35106 }); 35107 35108 var filteredAreas = sortedAreas.filter(function (_ref2) { 35109 var width = _ref2.width, 35110 height = _ref2.height; 35111 return width >= popper.clientWidth && height >= popper.clientHeight; 35112 }); 35113 35114 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 35115 35116 var variation = placement.split('-')[1]; 35117 35118 return computedPlacement + (variation ? '-' + variation : ''); 35119} 35120 35121/** 35122 * Get offsets to the reference element 35123 * @method 35124 * @memberof Popper.Utils 35125 * @param {Object} state 35126 * @param {Element} popper - the popper element 35127 * @param {Element} reference - the reference element (the popper will be relative to this) 35128 * @param {Element} fixedPosition - is in fixed position mode 35129 * @returns {Object} An object containing the offsets which will be applied to the popper 35130 */ 35131function getReferenceOffsets(state, popper, reference) { 35132 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 35133 35134 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 35135 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 35136} 35137 35138/** 35139 * Get the outer sizes of the given element (offset size + margins) 35140 * @method 35141 * @memberof Popper.Utils 35142 * @argument {Element} element 35143 * @returns {Object} object containing width and height properties 35144 */ 35145function getOuterSizes(element) { 35146 var window = element.ownerDocument.defaultView; 35147 var styles = window.getComputedStyle(element); 35148 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 35149 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 35150 var result = { 35151 width: element.offsetWidth + y, 35152 height: element.offsetHeight + x 35153 }; 35154 return result; 35155} 35156 35157/** 35158 * Get the opposite placement of the given one 35159 * @method 35160 * @memberof Popper.Utils 35161 * @argument {String} placement 35162 * @returns {String} flipped placement 35163 */ 35164function getOppositePlacement(placement) { 35165 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 35166 return placement.replace(/left|right|bottom|top/g, function (matched) { 35167 return hash[matched]; 35168 }); 35169} 35170 35171/** 35172 * Get offsets to the popper 35173 * @method 35174 * @memberof Popper.Utils 35175 * @param {Object} position - CSS position the Popper will get applied 35176 * @param {HTMLElement} popper - the popper element 35177 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 35178 * @param {String} placement - one of the valid placement options 35179 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 35180 */ 35181function getPopperOffsets(popper, referenceOffsets, placement) { 35182 placement = placement.split('-')[0]; 35183 35184 // Get popper node sizes 35185 var popperRect = getOuterSizes(popper); 35186 35187 // Add position, width and height to our offsets object 35188 var popperOffsets = { 35189 width: popperRect.width, 35190 height: popperRect.height 35191 }; 35192 35193 // depending by the popper placement we have to compute its offsets slightly differently 35194 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 35195 var mainSide = isHoriz ? 'top' : 'left'; 35196 var secondarySide = isHoriz ? 'left' : 'top'; 35197 var measurement = isHoriz ? 'height' : 'width'; 35198 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 35199 35200 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 35201 if (placement === secondarySide) { 35202 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 35203 } else { 35204 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 35205 } 35206 35207 return popperOffsets; 35208} 35209 35210/** 35211 * Mimics the `find` method of Array 35212 * @method 35213 * @memberof Popper.Utils 35214 * @argument {Array} arr 35215 * @argument prop 35216 * @argument value 35217 * @returns index or -1 35218 */ 35219function find(arr, check) { 35220 // use native find if supported 35221 if (Array.prototype.find) { 35222 return arr.find(check); 35223 } 35224 35225 // use `filter` to obtain the same behavior of `find` 35226 return arr.filter(check)[0]; 35227} 35228 35229/** 35230 * Return the index of the matching object 35231 * @method 35232 * @memberof Popper.Utils 35233 * @argument {Array} arr 35234 * @argument prop 35235 * @argument value 35236 * @returns index or -1 35237 */ 35238function findIndex(arr, prop, value) { 35239 // use native findIndex if supported 35240 if (Array.prototype.findIndex) { 35241 return arr.findIndex(function (cur) { 35242 return cur[prop] === value; 35243 }); 35244 } 35245 35246 // use `find` + `indexOf` if `findIndex` isn't supported 35247 var match = find(arr, function (obj) { 35248 return obj[prop] === value; 35249 }); 35250 return arr.indexOf(match); 35251} 35252 35253/** 35254 * Loop trough the list of modifiers and run them in order, 35255 * each of them will then edit the data object. 35256 * @method 35257 * @memberof Popper.Utils 35258 * @param {dataObject} data 35259 * @param {Array} modifiers 35260 * @param {String} ends - Optional modifier name used as stopper 35261 * @returns {dataObject} 35262 */ 35263function runModifiers(modifiers, data, ends) { 35264 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 35265 35266 modifiersToRun.forEach(function (modifier) { 35267 if (modifier['function']) { 35268 // eslint-disable-line dot-notation 35269 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 35270 } 35271 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 35272 if (modifier.enabled && isFunction(fn)) { 35273 // Add properties to offsets to make them a complete clientRect object 35274 // we do this before each modifier to make sure the previous one doesn't 35275 // mess with these values 35276 data.offsets.popper = getClientRect(data.offsets.popper); 35277 data.offsets.reference = getClientRect(data.offsets.reference); 35278 35279 data = fn(data, modifier); 35280 } 35281 }); 35282 35283 return data; 35284} 35285 35286/** 35287 * Updates the position of the popper, computing the new offsets and applying 35288 * the new style.<br /> 35289 * Prefer `scheduleUpdate` over `update` because of performance reasons. 35290 * @method 35291 * @memberof Popper 35292 */ 35293function update() { 35294 // if popper is destroyed, don't perform any further update 35295 if (this.state.isDestroyed) { 35296 return; 35297 } 35298 35299 var data = { 35300 instance: this, 35301 styles: {}, 35302 arrowStyles: {}, 35303 attributes: {}, 35304 flipped: false, 35305 offsets: {} 35306 }; 35307 35308 // compute reference element offsets 35309 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 35310 35311 // compute auto placement, store placement inside the data object, 35312 // modifiers will be able to edit `placement` if needed 35313 // and refer to originalPlacement to know the original value 35314 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 35315 35316 // store the computed placement inside `originalPlacement` 35317 data.originalPlacement = data.placement; 35318 35319 data.positionFixed = this.options.positionFixed; 35320 35321 // compute the popper offsets 35322 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 35323 35324 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 35325 35326 // run the modifiers 35327 data = runModifiers(this.modifiers, data); 35328 35329 // the first `update` will call `onCreate` callback 35330 // the other ones will call `onUpdate` callback 35331 if (!this.state.isCreated) { 35332 this.state.isCreated = true; 35333 this.options.onCreate(data); 35334 } else { 35335 this.options.onUpdate(data); 35336 } 35337} 35338 35339/** 35340 * Helper used to know if the given modifier is enabled. 35341 * @method 35342 * @memberof Popper.Utils 35343 * @returns {Boolean} 35344 */ 35345function isModifierEnabled(modifiers, modifierName) { 35346 return modifiers.some(function (_ref) { 35347 var name = _ref.name, 35348 enabled = _ref.enabled; 35349 return enabled && name === modifierName; 35350 }); 35351} 35352 35353/** 35354 * Get the prefixed supported property name 35355 * @method 35356 * @memberof Popper.Utils 35357 * @argument {String} property (camelCase) 35358 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 35359 */ 35360function getSupportedPropertyName(property) { 35361 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 35362 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 35363 35364 for (var i = 0; i < prefixes.length; i++) { 35365 var prefix = prefixes[i]; 35366 var toCheck = prefix ? '' + prefix + upperProp : property; 35367 if (typeof document.body.style[toCheck] !== 'undefined') { 35368 return toCheck; 35369 } 35370 } 35371 return null; 35372} 35373 35374/** 35375 * Destroys the popper. 35376 * @method 35377 * @memberof Popper 35378 */ 35379function destroy() { 35380 this.state.isDestroyed = true; 35381 35382 // touch DOM only if `applyStyle` modifier is enabled 35383 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 35384 this.popper.removeAttribute('x-placement'); 35385 this.popper.style.position = ''; 35386 this.popper.style.top = ''; 35387 this.popper.style.left = ''; 35388 this.popper.style.right = ''; 35389 this.popper.style.bottom = ''; 35390 this.popper.style.willChange = ''; 35391 this.popper.style[getSupportedPropertyName('transform')] = ''; 35392 } 35393 35394 this.disableEventListeners(); 35395 35396 // remove the popper if user explicitly asked for the deletion on destroy 35397 // do not use `remove` because IE11 doesn't support it 35398 if (this.options.removeOnDestroy) { 35399 this.popper.parentNode.removeChild(this.popper); 35400 } 35401 return this; 35402} 35403 35404/** 35405 * Get the window associated with the element 35406 * @argument {Element} element 35407 * @returns {Window} 35408 */ 35409function getWindow(element) { 35410 var ownerDocument = element.ownerDocument; 35411 return ownerDocument ? ownerDocument.defaultView : window; 35412} 35413 35414function attachToScrollParents(scrollParent, event, callback, scrollParents) { 35415 var isBody = scrollParent.nodeName === 'BODY'; 35416 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 35417 target.addEventListener(event, callback, { passive: true }); 35418 35419 if (!isBody) { 35420 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 35421 } 35422 scrollParents.push(target); 35423} 35424 35425/** 35426 * Setup needed event listeners used to update the popper position 35427 * @method 35428 * @memberof Popper.Utils 35429 * @private 35430 */ 35431function setupEventListeners(reference, options, state, updateBound) { 35432 // Resize event listener on window 35433 state.updateBound = updateBound; 35434 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 35435 35436 // Scroll event listener on scroll parents 35437 var scrollElement = getScrollParent(reference); 35438 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 35439 state.scrollElement = scrollElement; 35440 state.eventsEnabled = true; 35441 35442 return state; 35443} 35444 35445/** 35446 * It will add resize/scroll events and start recalculating 35447 * position of the popper element when they are triggered. 35448 * @method 35449 * @memberof Popper 35450 */ 35451function enableEventListeners() { 35452 if (!this.state.eventsEnabled) { 35453 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 35454 } 35455} 35456 35457/** 35458 * Remove event listeners used to update the popper position 35459 * @method 35460 * @memberof Popper.Utils 35461 * @private 35462 */ 35463function removeEventListeners(reference, state) { 35464 // Remove resize event listener on window 35465 getWindow(reference).removeEventListener('resize', state.updateBound); 35466 35467 // Remove scroll event listener on scroll parents 35468 state.scrollParents.forEach(function (target) { 35469 target.removeEventListener('scroll', state.updateBound); 35470 }); 35471 35472 // Reset state 35473 state.updateBound = null; 35474 state.scrollParents = []; 35475 state.scrollElement = null; 35476 state.eventsEnabled = false; 35477 return state; 35478} 35479 35480/** 35481 * It will remove resize/scroll events and won't recalculate popper position 35482 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 35483 * unless you call `update` method manually. 35484 * @method 35485 * @memberof Popper 35486 */ 35487function disableEventListeners() { 35488 if (this.state.eventsEnabled) { 35489 cancelAnimationFrame(this.scheduleUpdate); 35490 this.state = removeEventListeners(this.reference, this.state); 35491 } 35492} 35493 35494/** 35495 * Tells if a given input is a number 35496 * @method 35497 * @memberof Popper.Utils 35498 * @param {*} input to check 35499 * @return {Boolean} 35500 */ 35501function isNumeric(n) { 35502 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 35503} 35504 35505/** 35506 * Set the style to the given popper 35507 * @method 35508 * @memberof Popper.Utils 35509 * @argument {Element} element - Element to apply the style to 35510 * @argument {Object} styles 35511 * Object with a list of properties and values which will be applied to the element 35512 */ 35513function setStyles(element, styles) { 35514 Object.keys(styles).forEach(function (prop) { 35515 var unit = ''; 35516 // add unit if the value is numeric and is one of the following 35517 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 35518 unit = 'px'; 35519 } 35520 element.style[prop] = styles[prop] + unit; 35521 }); 35522} 35523 35524/** 35525 * Set the attributes to the given popper 35526 * @method 35527 * @memberof Popper.Utils 35528 * @argument {Element} element - Element to apply the attributes to 35529 * @argument {Object} styles 35530 * Object with a list of properties and values which will be applied to the element 35531 */ 35532function setAttributes(element, attributes) { 35533 Object.keys(attributes).forEach(function (prop) { 35534 var value = attributes[prop]; 35535 if (value !== false) { 35536 element.setAttribute(prop, attributes[prop]); 35537 } else { 35538 element.removeAttribute(prop); 35539 } 35540 }); 35541} 35542 35543/** 35544 * @function 35545 * @memberof Modifiers 35546 * @argument {Object} data - The data object generated by `update` method 35547 * @argument {Object} data.styles - List of style properties - values to apply to popper element 35548 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 35549 * @argument {Object} options - Modifiers configuration and options 35550 * @returns {Object} The same data object 35551 */ 35552function applyStyle(data) { 35553 // any property present in `data.styles` will be applied to the popper, 35554 // in this way we can make the 3rd party modifiers add custom styles to it 35555 // Be aware, modifiers could override the properties defined in the previous 35556 // lines of this modifier! 35557 setStyles(data.instance.popper, data.styles); 35558 35559 // any property present in `data.attributes` will be applied to the popper, 35560 // they will be set as HTML attributes of the element 35561 setAttributes(data.instance.popper, data.attributes); 35562 35563 // if arrowElement is defined and arrowStyles has some properties 35564 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 35565 setStyles(data.arrowElement, data.arrowStyles); 35566 } 35567 35568 return data; 35569} 35570 35571/** 35572 * Set the x-placement attribute before everything else because it could be used 35573 * to add margins to the popper margins needs to be calculated to get the 35574 * correct popper offsets. 35575 * @method 35576 * @memberof Popper.modifiers 35577 * @param {HTMLElement} reference - The reference element used to position the popper 35578 * @param {HTMLElement} popper - The HTML element used as popper 35579 * @param {Object} options - Popper.js options 35580 */ 35581function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 35582 // compute reference element offsets 35583 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 35584 35585 // compute auto placement, store placement inside the data object, 35586 // modifiers will be able to edit `placement` if needed 35587 // and refer to originalPlacement to know the original value 35588 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 35589 35590 popper.setAttribute('x-placement', placement); 35591 35592 // Apply `position` to popper before anything else because 35593 // without the position applied we can't guarantee correct computations 35594 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 35595 35596 return options; 35597} 35598 35599/** 35600 * @function 35601 * @memberof Popper.Utils 35602 * @argument {Object} data - The data object generated by `update` method 35603 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 35604 * @returns {Object} The popper's position offsets rounded 35605 * 35606 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 35607 * good as it can be within reason. 35608 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 35609 * 35610 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 35611 * as well on High DPI screens). 35612 * 35613 * Firefox prefers no rounding for positioning and does not have blurriness on 35614 * high DPI screens. 35615 * 35616 * Only horizontal placement and left/right values need to be considered. 35617 */ 35618function getRoundedOffsets(data, shouldRound) { 35619 var _data$offsets = data.offsets, 35620 popper = _data$offsets.popper, 35621 reference = _data$offsets.reference; 35622 var round = Math.round, 35623 floor = Math.floor; 35624 35625 var noRound = function noRound(v) { 35626 return v; 35627 }; 35628 35629 var referenceWidth = round(reference.width); 35630 var popperWidth = round(popper.width); 35631 35632 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 35633 var isVariation = data.placement.indexOf('-') !== -1; 35634 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 35635 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 35636 35637 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 35638 var verticalToInteger = !shouldRound ? noRound : round; 35639 35640 return { 35641 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 35642 top: verticalToInteger(popper.top), 35643 bottom: verticalToInteger(popper.bottom), 35644 right: horizontalToInteger(popper.right) 35645 }; 35646} 35647 35648var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 35649 35650/** 35651 * @function 35652 * @memberof Modifiers 35653 * @argument {Object} data - The data object generated by `update` method 35654 * @argument {Object} options - Modifiers configuration and options 35655 * @returns {Object} The data object, properly modified 35656 */ 35657function computeStyle(data, options) { 35658 var x = options.x, 35659 y = options.y; 35660 var popper = data.offsets.popper; 35661 35662 // Remove this legacy support in Popper.js v2 35663 35664 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 35665 return modifier.name === 'applyStyle'; 35666 }).gpuAcceleration; 35667 if (legacyGpuAccelerationOption !== undefined) { 35668 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 35669 } 35670 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 35671 35672 var offsetParent = getOffsetParent(data.instance.popper); 35673 var offsetParentRect = getBoundingClientRect(offsetParent); 35674 35675 // Styles 35676 var styles = { 35677 position: popper.position 35678 }; 35679 35680 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 35681 35682 var sideA = x === 'bottom' ? 'top' : 'bottom'; 35683 var sideB = y === 'right' ? 'left' : 'right'; 35684 35685 // if gpuAcceleration is set to `true` and transform is supported, 35686 // we use `translate3d` to apply the position to the popper we 35687 // automatically use the supported prefixed version if needed 35688 var prefixedProperty = getSupportedPropertyName('transform'); 35689 35690 // now, let's make a step back and look at this code closely (wtf?) 35691 // If the content of the popper grows once it's been positioned, it 35692 // may happen that the popper gets misplaced because of the new content 35693 // overflowing its reference element 35694 // To avoid this problem, we provide two options (x and y), which allow 35695 // the consumer to define the offset origin. 35696 // If we position a popper on top of a reference element, we can set 35697 // `x` to `top` to make the popper grow towards its top instead of 35698 // its bottom. 35699 var left = void 0, 35700 top = void 0; 35701 if (sideA === 'bottom') { 35702 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 35703 // and not the bottom of the html element 35704 if (offsetParent.nodeName === 'HTML') { 35705 top = -offsetParent.clientHeight + offsets.bottom; 35706 } else { 35707 top = -offsetParentRect.height + offsets.bottom; 35708 } 35709 } else { 35710 top = offsets.top; 35711 } 35712 if (sideB === 'right') { 35713 if (offsetParent.nodeName === 'HTML') { 35714 left = -offsetParent.clientWidth + offsets.right; 35715 } else { 35716 left = -offsetParentRect.width + offsets.right; 35717 } 35718 } else { 35719 left = offsets.left; 35720 } 35721 if (gpuAcceleration && prefixedProperty) { 35722 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 35723 styles[sideA] = 0; 35724 styles[sideB] = 0; 35725 styles.willChange = 'transform'; 35726 } else { 35727 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 35728 var invertTop = sideA === 'bottom' ? -1 : 1; 35729 var invertLeft = sideB === 'right' ? -1 : 1; 35730 styles[sideA] = top * invertTop; 35731 styles[sideB] = left * invertLeft; 35732 styles.willChange = sideA + ', ' + sideB; 35733 } 35734 35735 // Attributes 35736 var attributes = { 35737 'x-placement': data.placement 35738 }; 35739 35740 // Update `data` attributes, styles and arrowStyles 35741 data.attributes = _extends({}, attributes, data.attributes); 35742 data.styles = _extends({}, styles, data.styles); 35743 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 35744 35745 return data; 35746} 35747 35748/** 35749 * Helper used to know if the given modifier depends from another one.<br /> 35750 * It checks if the needed modifier is listed and enabled. 35751 * @method 35752 * @memberof Popper.Utils 35753 * @param {Array} modifiers - list of modifiers 35754 * @param {String} requestingName - name of requesting modifier 35755 * @param {String} requestedName - name of requested modifier 35756 * @returns {Boolean} 35757 */ 35758function isModifierRequired(modifiers, requestingName, requestedName) { 35759 var requesting = find(modifiers, function (_ref) { 35760 var name = _ref.name; 35761 return name === requestingName; 35762 }); 35763 35764 var isRequired = !!requesting && modifiers.some(function (modifier) { 35765 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 35766 }); 35767 35768 if (!isRequired) { 35769 var _requesting = '`' + requestingName + '`'; 35770 var requested = '`' + requestedName + '`'; 35771 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 35772 } 35773 return isRequired; 35774} 35775 35776/** 35777 * @function 35778 * @memberof Modifiers 35779 * @argument {Object} data - The data object generated by update method 35780 * @argument {Object} options - Modifiers configuration and options 35781 * @returns {Object} The data object, properly modified 35782 */ 35783function arrow(data, options) { 35784 var _data$offsets$arrow; 35785 35786 // arrow depends on keepTogether in order to work 35787 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 35788 return data; 35789 } 35790 35791 var arrowElement = options.element; 35792 35793 // if arrowElement is a string, suppose it's a CSS selector 35794 if (typeof arrowElement === 'string') { 35795 arrowElement = data.instance.popper.querySelector(arrowElement); 35796 35797 // if arrowElement is not found, don't run the modifier 35798 if (!arrowElement) { 35799 return data; 35800 } 35801 } else { 35802 // if the arrowElement isn't a query selector we must check that the 35803 // provided DOM node is child of its popper node 35804 if (!data.instance.popper.contains(arrowElement)) { 35805 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 35806 return data; 35807 } 35808 } 35809 35810 var placement = data.placement.split('-')[0]; 35811 var _data$offsets = data.offsets, 35812 popper = _data$offsets.popper, 35813 reference = _data$offsets.reference; 35814 35815 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 35816 35817 var len = isVertical ? 'height' : 'width'; 35818 var sideCapitalized = isVertical ? 'Top' : 'Left'; 35819 var side = sideCapitalized.toLowerCase(); 35820 var altSide = isVertical ? 'left' : 'top'; 35821 var opSide = isVertical ? 'bottom' : 'right'; 35822 var arrowElementSize = getOuterSizes(arrowElement)[len]; 35823 35824 // 35825 // extends keepTogether behavior making sure the popper and its 35826 // reference have enough pixels in conjunction 35827 // 35828 35829 // top/left side 35830 if (reference[opSide] - arrowElementSize < popper[side]) { 35831 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 35832 } 35833 // bottom/right side 35834 if (reference[side] + arrowElementSize > popper[opSide]) { 35835 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 35836 } 35837 data.offsets.popper = getClientRect(data.offsets.popper); 35838 35839 // compute center of the popper 35840 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 35841 35842 // Compute the sideValue using the updated popper offsets 35843 // take popper margin in account because we don't have this info available 35844 var css = getStyleComputedProperty(data.instance.popper); 35845 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 35846 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 35847 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 35848 35849 // prevent arrowElement from being placed not contiguously to its popper 35850 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 35851 35852 data.arrowElement = arrowElement; 35853 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 35854 35855 return data; 35856} 35857 35858/** 35859 * Get the opposite placement variation of the given one 35860 * @method 35861 * @memberof Popper.Utils 35862 * @argument {String} placement variation 35863 * @returns {String} flipped placement variation 35864 */ 35865function getOppositeVariation(variation) { 35866 if (variation === 'end') { 35867 return 'start'; 35868 } else if (variation === 'start') { 35869 return 'end'; 35870 } 35871 return variation; 35872} 35873 35874/** 35875 * List of accepted placements to use as values of the `placement` option.<br /> 35876 * Valid placements are: 35877 * - `auto` 35878 * - `top` 35879 * - `right` 35880 * - `bottom` 35881 * - `left` 35882 * 35883 * Each placement can have a variation from this list: 35884 * - `-start` 35885 * - `-end` 35886 * 35887 * Variations are interpreted easily if you think of them as the left to right 35888 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 35889 * is right.<br /> 35890 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 35891 * 35892 * Some valid examples are: 35893 * - `top-end` (on top of reference, right aligned) 35894 * - `right-start` (on right of reference, top aligned) 35895 * - `bottom` (on bottom, centered) 35896 * - `auto-end` (on the side with more space available, alignment depends by placement) 35897 * 35898 * @static 35899 * @type {Array} 35900 * @enum {String} 35901 * @readonly 35902 * @method placements 35903 * @memberof Popper 35904 */ 35905var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 35906 35907// Get rid of `auto` `auto-start` and `auto-end` 35908var validPlacements = placements.slice(3); 35909 35910/** 35911 * Given an initial placement, returns all the subsequent placements 35912 * clockwise (or counter-clockwise). 35913 * 35914 * @method 35915 * @memberof Popper.Utils 35916 * @argument {String} placement - A valid placement (it accepts variations) 35917 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 35918 * @returns {Array} placements including their variations 35919 */ 35920function clockwise(placement) { 35921 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 35922 35923 var index = validPlacements.indexOf(placement); 35924 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 35925 return counter ? arr.reverse() : arr; 35926} 35927 35928var BEHAVIORS = { 35929 FLIP: 'flip', 35930 CLOCKWISE: 'clockwise', 35931 COUNTERCLOCKWISE: 'counterclockwise' 35932}; 35933 35934/** 35935 * @function 35936 * @memberof Modifiers 35937 * @argument {Object} data - The data object generated by update method 35938 * @argument {Object} options - Modifiers configuration and options 35939 * @returns {Object} The data object, properly modified 35940 */ 35941function flip(data, options) { 35942 // if `inner` modifier is enabled, we can't use the `flip` modifier 35943 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 35944 return data; 35945 } 35946 35947 if (data.flipped && data.placement === data.originalPlacement) { 35948 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 35949 return data; 35950 } 35951 35952 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 35953 35954 var placement = data.placement.split('-')[0]; 35955 var placementOpposite = getOppositePlacement(placement); 35956 var variation = data.placement.split('-')[1] || ''; 35957 35958 var flipOrder = []; 35959 35960 switch (options.behavior) { 35961 case BEHAVIORS.FLIP: 35962 flipOrder = [placement, placementOpposite]; 35963 break; 35964 case BEHAVIORS.CLOCKWISE: 35965 flipOrder = clockwise(placement); 35966 break; 35967 case BEHAVIORS.COUNTERCLOCKWISE: 35968 flipOrder = clockwise(placement, true); 35969 break; 35970 default: 35971 flipOrder = options.behavior; 35972 } 35973 35974 flipOrder.forEach(function (step, index) { 35975 if (placement !== step || flipOrder.length === index + 1) { 35976 return data; 35977 } 35978 35979 placement = data.placement.split('-')[0]; 35980 placementOpposite = getOppositePlacement(placement); 35981 35982 var popperOffsets = data.offsets.popper; 35983 var refOffsets = data.offsets.reference; 35984 35985 // using floor because the reference offsets may contain decimals we are not going to consider here 35986 var floor = Math.floor; 35987 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 35988 35989 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 35990 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 35991 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 35992 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 35993 35994 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 35995 35996 // flip the variation if required 35997 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 35998 35999 // flips variation if reference element overflows boundaries 36000 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 36001 36002 // flips variation if popper content overflows boundaries 36003 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 36004 36005 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 36006 36007 if (overlapsRef || overflowsBoundaries || flippedVariation) { 36008 // this boolean to detect any flip loop 36009 data.flipped = true; 36010 36011 if (overlapsRef || overflowsBoundaries) { 36012 placement = flipOrder[index + 1]; 36013 } 36014 36015 if (flippedVariation) { 36016 variation = getOppositeVariation(variation); 36017 } 36018 36019 data.placement = placement + (variation ? '-' + variation : ''); 36020 36021 // this object contains `position`, we want to preserve it along with 36022 // any additional property we may add in the future 36023 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 36024 36025 data = runModifiers(data.instance.modifiers, data, 'flip'); 36026 } 36027 }); 36028 return data; 36029} 36030 36031/** 36032 * @function 36033 * @memberof Modifiers 36034 * @argument {Object} data - The data object generated by update method 36035 * @argument {Object} options - Modifiers configuration and options 36036 * @returns {Object} The data object, properly modified 36037 */ 36038function keepTogether(data) { 36039 var _data$offsets = data.offsets, 36040 popper = _data$offsets.popper, 36041 reference = _data$offsets.reference; 36042 36043 var placement = data.placement.split('-')[0]; 36044 var floor = Math.floor; 36045 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 36046 var side = isVertical ? 'right' : 'bottom'; 36047 var opSide = isVertical ? 'left' : 'top'; 36048 var measurement = isVertical ? 'width' : 'height'; 36049 36050 if (popper[side] < floor(reference[opSide])) { 36051 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 36052 } 36053 if (popper[opSide] > floor(reference[side])) { 36054 data.offsets.popper[opSide] = floor(reference[side]); 36055 } 36056 36057 return data; 36058} 36059 36060/** 36061 * Converts a string containing value + unit into a px value number 36062 * @function 36063 * @memberof {modifiers~offset} 36064 * @private 36065 * @argument {String} str - Value + unit string 36066 * @argument {String} measurement - `height` or `width` 36067 * @argument {Object} popperOffsets 36068 * @argument {Object} referenceOffsets 36069 * @returns {Number|String} 36070 * Value in pixels, or original string if no values were extracted 36071 */ 36072function toValue(str, measurement, popperOffsets, referenceOffsets) { 36073 // separate value from unit 36074 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 36075 var value = +split[1]; 36076 var unit = split[2]; 36077 36078 // If it's not a number it's an operator, I guess 36079 if (!value) { 36080 return str; 36081 } 36082 36083 if (unit.indexOf('%') === 0) { 36084 var element = void 0; 36085 switch (unit) { 36086 case '%p': 36087 element = popperOffsets; 36088 break; 36089 case '%': 36090 case '%r': 36091 default: 36092 element = referenceOffsets; 36093 } 36094 36095 var rect = getClientRect(element); 36096 return rect[measurement] / 100 * value; 36097 } else if (unit === 'vh' || unit === 'vw') { 36098 // if is a vh or vw, we calculate the size based on the viewport 36099 var size = void 0; 36100 if (unit === 'vh') { 36101 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 36102 } else { 36103 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 36104 } 36105 return size / 100 * value; 36106 } else { 36107 // if is an explicit pixel unit, we get rid of the unit and keep the value 36108 // if is an implicit unit, it's px, and we return just the value 36109 return value; 36110 } 36111} 36112 36113/** 36114 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 36115 * @function 36116 * @memberof {modifiers~offset} 36117 * @private 36118 * @argument {String} offset 36119 * @argument {Object} popperOffsets 36120 * @argument {Object} referenceOffsets 36121 * @argument {String} basePlacement 36122 * @returns {Array} a two cells array with x and y offsets in numbers 36123 */ 36124function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 36125 var offsets = [0, 0]; 36126 36127 // Use height if placement is left or right and index is 0 otherwise use width 36128 // in this way the first offset will use an axis and the second one 36129 // will use the other one 36130 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 36131 36132 // Split the offset string to obtain a list of values and operands 36133 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 36134 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 36135 return frag.trim(); 36136 }); 36137 36138 // Detect if the offset string contains a pair of values or a single one 36139 // they could be separated by comma or space 36140 var divider = fragments.indexOf(find(fragments, function (frag) { 36141 return frag.search(/,|\s/) !== -1; 36142 })); 36143 36144 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 36145 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 36146 } 36147 36148 // If divider is found, we divide the list of values and operands to divide 36149 // them by ofset X and Y. 36150 var splitRegex = /\s*,\s*|\s+/; 36151 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 36152 36153 // Convert the values with units to absolute pixels to allow our computations 36154 ops = ops.map(function (op, index) { 36155 // Most of the units rely on the orientation of the popper 36156 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 36157 var mergeWithPrevious = false; 36158 return op 36159 // This aggregates any `+` or `-` sign that aren't considered operators 36160 // e.g.: 10 + +5 => [10, +, +5] 36161 .reduce(function (a, b) { 36162 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 36163 a[a.length - 1] = b; 36164 mergeWithPrevious = true; 36165 return a; 36166 } else if (mergeWithPrevious) { 36167 a[a.length - 1] += b; 36168 mergeWithPrevious = false; 36169 return a; 36170 } else { 36171 return a.concat(b); 36172 } 36173 }, []) 36174 // Here we convert the string values into number values (in px) 36175 .map(function (str) { 36176 return toValue(str, measurement, popperOffsets, referenceOffsets); 36177 }); 36178 }); 36179 36180 // Loop trough the offsets arrays and execute the operations 36181 ops.forEach(function (op, index) { 36182 op.forEach(function (frag, index2) { 36183 if (isNumeric(frag)) { 36184 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 36185 } 36186 }); 36187 }); 36188 return offsets; 36189} 36190 36191/** 36192 * @function 36193 * @memberof Modifiers 36194 * @argument {Object} data - The data object generated by update method 36195 * @argument {Object} options - Modifiers configuration and options 36196 * @argument {Number|String} options.offset=0 36197 * The offset value as described in the modifier description 36198 * @returns {Object} The data object, properly modified 36199 */ 36200function offset(data, _ref) { 36201 var offset = _ref.offset; 36202 var placement = data.placement, 36203 _data$offsets = data.offsets, 36204 popper = _data$offsets.popper, 36205 reference = _data$offsets.reference; 36206 36207 var basePlacement = placement.split('-')[0]; 36208 36209 var offsets = void 0; 36210 if (isNumeric(+offset)) { 36211 offsets = [+offset, 0]; 36212 } else { 36213 offsets = parseOffset(offset, popper, reference, basePlacement); 36214 } 36215 36216 if (basePlacement === 'left') { 36217 popper.top += offsets[0]; 36218 popper.left -= offsets[1]; 36219 } else if (basePlacement === 'right') { 36220 popper.top += offsets[0]; 36221 popper.left += offsets[1]; 36222 } else if (basePlacement === 'top') { 36223 popper.left += offsets[0]; 36224 popper.top -= offsets[1]; 36225 } else if (basePlacement === 'bottom') { 36226 popper.left += offsets[0]; 36227 popper.top += offsets[1]; 36228 } 36229 36230 data.popper = popper; 36231 return data; 36232} 36233 36234/** 36235 * @function 36236 * @memberof Modifiers 36237 * @argument {Object} data - The data object generated by `update` method 36238 * @argument {Object} options - Modifiers configuration and options 36239 * @returns {Object} The data object, properly modified 36240 */ 36241function preventOverflow(data, options) { 36242 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 36243 36244 // If offsetParent is the reference element, we really want to 36245 // go one step up and use the next offsetParent as reference to 36246 // avoid to make this modifier completely useless and look like broken 36247 if (data.instance.reference === boundariesElement) { 36248 boundariesElement = getOffsetParent(boundariesElement); 36249 } 36250 36251 // NOTE: DOM access here 36252 // resets the popper's position so that the document size can be calculated excluding 36253 // the size of the popper element itself 36254 var transformProp = getSupportedPropertyName('transform'); 36255 var popperStyles = data.instance.popper.style; // assignment to help minification 36256 var top = popperStyles.top, 36257 left = popperStyles.left, 36258 transform = popperStyles[transformProp]; 36259 36260 popperStyles.top = ''; 36261 popperStyles.left = ''; 36262 popperStyles[transformProp] = ''; 36263 36264 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 36265 36266 // NOTE: DOM access here 36267 // restores the original style properties after the offsets have been computed 36268 popperStyles.top = top; 36269 popperStyles.left = left; 36270 popperStyles[transformProp] = transform; 36271 36272 options.boundaries = boundaries; 36273 36274 var order = options.priority; 36275 var popper = data.offsets.popper; 36276 36277 var check = { 36278 primary: function primary(placement) { 36279 var value = popper[placement]; 36280 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 36281 value = Math.max(popper[placement], boundaries[placement]); 36282 } 36283 return defineProperty({}, placement, value); 36284 }, 36285 secondary: function secondary(placement) { 36286 var mainSide = placement === 'right' ? 'left' : 'top'; 36287 var value = popper[mainSide]; 36288 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 36289 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 36290 } 36291 return defineProperty({}, mainSide, value); 36292 } 36293 }; 36294 36295 order.forEach(function (placement) { 36296 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 36297 popper = _extends({}, popper, check[side](placement)); 36298 }); 36299 36300 data.offsets.popper = popper; 36301 36302 return data; 36303} 36304 36305/** 36306 * @function 36307 * @memberof Modifiers 36308 * @argument {Object} data - The data object generated by `update` method 36309 * @argument {Object} options - Modifiers configuration and options 36310 * @returns {Object} The data object, properly modified 36311 */ 36312function shift(data) { 36313 var placement = data.placement; 36314 var basePlacement = placement.split('-')[0]; 36315 var shiftvariation = placement.split('-')[1]; 36316 36317 // if shift shiftvariation is specified, run the modifier 36318 if (shiftvariation) { 36319 var _data$offsets = data.offsets, 36320 reference = _data$offsets.reference, 36321 popper = _data$offsets.popper; 36322 36323 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 36324 var side = isVertical ? 'left' : 'top'; 36325 var measurement = isVertical ? 'width' : 'height'; 36326 36327 var shiftOffsets = { 36328 start: defineProperty({}, side, reference[side]), 36329 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 36330 }; 36331 36332 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 36333 } 36334 36335 return data; 36336} 36337 36338/** 36339 * @function 36340 * @memberof Modifiers 36341 * @argument {Object} data - The data object generated by update method 36342 * @argument {Object} options - Modifiers configuration and options 36343 * @returns {Object} The data object, properly modified 36344 */ 36345function hide(data) { 36346 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 36347 return data; 36348 } 36349 36350 var refRect = data.offsets.reference; 36351 var bound = find(data.instance.modifiers, function (modifier) { 36352 return modifier.name === 'preventOverflow'; 36353 }).boundaries; 36354 36355 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 36356 // Avoid unnecessary DOM access if visibility hasn't changed 36357 if (data.hide === true) { 36358 return data; 36359 } 36360 36361 data.hide = true; 36362 data.attributes['x-out-of-boundaries'] = ''; 36363 } else { 36364 // Avoid unnecessary DOM access if visibility hasn't changed 36365 if (data.hide === false) { 36366 return data; 36367 } 36368 36369 data.hide = false; 36370 data.attributes['x-out-of-boundaries'] = false; 36371 } 36372 36373 return data; 36374} 36375 36376/** 36377 * @function 36378 * @memberof Modifiers 36379 * @argument {Object} data - The data object generated by `update` method 36380 * @argument {Object} options - Modifiers configuration and options 36381 * @returns {Object} The data object, properly modified 36382 */ 36383function inner(data) { 36384 var placement = data.placement; 36385 var basePlacement = placement.split('-')[0]; 36386 var _data$offsets = data.offsets, 36387 popper = _data$offsets.popper, 36388 reference = _data$offsets.reference; 36389 36390 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 36391 36392 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 36393 36394 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 36395 36396 data.placement = getOppositePlacement(placement); 36397 data.offsets.popper = getClientRect(popper); 36398 36399 return data; 36400} 36401 36402/** 36403 * Modifier function, each modifier can have a function of this type assigned 36404 * to its `fn` property.<br /> 36405 * These functions will be called on each update, this means that you must 36406 * make sure they are performant enough to avoid performance bottlenecks. 36407 * 36408 * @function ModifierFn 36409 * @argument {dataObject} data - The data object generated by `update` method 36410 * @argument {Object} options - Modifiers configuration and options 36411 * @returns {dataObject} The data object, properly modified 36412 */ 36413 36414/** 36415 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 36416 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 36417 * needed by the library. 36418 * 36419 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 36420 * All the other properties are configurations that could be tweaked. 36421 * @namespace modifiers 36422 */ 36423var modifiers = { 36424 /** 36425 * Modifier used to shift the popper on the start or end of its reference 36426 * element.<br /> 36427 * It will read the variation of the `placement` property.<br /> 36428 * It can be one either `-end` or `-start`. 36429 * @memberof modifiers 36430 * @inner 36431 */ 36432 shift: { 36433 /** @prop {number} order=100 - Index used to define the order of execution */ 36434 order: 100, 36435 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36436 enabled: true, 36437 /** @prop {ModifierFn} */ 36438 fn: shift 36439 }, 36440 36441 /** 36442 * The `offset` modifier can shift your popper on both its axis. 36443 * 36444 * It accepts the following units: 36445 * - `px` or unit-less, interpreted as pixels 36446 * - `%` or `%r`, percentage relative to the length of the reference element 36447 * - `%p`, percentage relative to the length of the popper element 36448 * - `vw`, CSS viewport width unit 36449 * - `vh`, CSS viewport height unit 36450 * 36451 * For length is intended the main axis relative to the placement of the popper.<br /> 36452 * This means that if the placement is `top` or `bottom`, the length will be the 36453 * `width`. In case of `left` or `right`, it will be the `height`. 36454 * 36455 * You can provide a single value (as `Number` or `String`), or a pair of values 36456 * as `String` divided by a comma or one (or more) white spaces.<br /> 36457 * The latter is a deprecated method because it leads to confusion and will be 36458 * removed in v2.<br /> 36459 * Additionally, it accepts additions and subtractions between different units. 36460 * Note that multiplications and divisions aren't supported. 36461 * 36462 * Valid examples are: 36463 * ``` 36464 * 10 36465 * '10%' 36466 * '10, 10' 36467 * '10%, 10' 36468 * '10 + 10%' 36469 * '10 - 5vh + 3%' 36470 * '-10px + 5vh, 5px - 6%' 36471 * ``` 36472 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 36473 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 36474 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 36475 * 36476 * @memberof modifiers 36477 * @inner 36478 */ 36479 offset: { 36480 /** @prop {number} order=200 - Index used to define the order of execution */ 36481 order: 200, 36482 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36483 enabled: true, 36484 /** @prop {ModifierFn} */ 36485 fn: offset, 36486 /** @prop {Number|String} offset=0 36487 * The offset value as described in the modifier description 36488 */ 36489 offset: 0 36490 }, 36491 36492 /** 36493 * Modifier used to prevent the popper from being positioned outside the boundary. 36494 * 36495 * A scenario exists where the reference itself is not within the boundaries.<br /> 36496 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 36497 * In this case we need to decide whether the popper should either: 36498 * 36499 * - detach from the reference and remain "trapped" in the boundaries, or 36500 * - if it should ignore the boundary and "escape with its reference" 36501 * 36502 * When `escapeWithReference` is set to`true` and reference is completely 36503 * outside its boundaries, the popper will overflow (or completely leave) 36504 * the boundaries in order to remain attached to the edge of the reference. 36505 * 36506 * @memberof modifiers 36507 * @inner 36508 */ 36509 preventOverflow: { 36510 /** @prop {number} order=300 - Index used to define the order of execution */ 36511 order: 300, 36512 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36513 enabled: true, 36514 /** @prop {ModifierFn} */ 36515 fn: preventOverflow, 36516 /** 36517 * @prop {Array} [priority=['left','right','top','bottom']] 36518 * Popper will try to prevent overflow following these priorities by default, 36519 * then, it could overflow on the left and on top of the `boundariesElement` 36520 */ 36521 priority: ['left', 'right', 'top', 'bottom'], 36522 /** 36523 * @prop {number} padding=5 36524 * Amount of pixel used to define a minimum distance between the boundaries 36525 * and the popper. This makes sure the popper always has a little padding 36526 * between the edges of its container 36527 */ 36528 padding: 5, 36529 /** 36530 * @prop {String|HTMLElement} boundariesElement='scrollParent' 36531 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 36532 * `viewport` or any DOM element. 36533 */ 36534 boundariesElement: 'scrollParent' 36535 }, 36536 36537 /** 36538 * Modifier used to make sure the reference and its popper stay near each other 36539 * without leaving any gap between the two. Especially useful when the arrow is 36540 * enabled and you want to ensure that it points to its reference element. 36541 * It cares only about the first axis. You can still have poppers with margin 36542 * between the popper and its reference element. 36543 * @memberof modifiers 36544 * @inner 36545 */ 36546 keepTogether: { 36547 /** @prop {number} order=400 - Index used to define the order of execution */ 36548 order: 400, 36549 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36550 enabled: true, 36551 /** @prop {ModifierFn} */ 36552 fn: keepTogether 36553 }, 36554 36555 /** 36556 * This modifier is used to move the `arrowElement` of the popper to make 36557 * sure it is positioned between the reference element and its popper element. 36558 * It will read the outer size of the `arrowElement` node to detect how many 36559 * pixels of conjunction are needed. 36560 * 36561 * It has no effect if no `arrowElement` is provided. 36562 * @memberof modifiers 36563 * @inner 36564 */ 36565 arrow: { 36566 /** @prop {number} order=500 - Index used to define the order of execution */ 36567 order: 500, 36568 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36569 enabled: true, 36570 /** @prop {ModifierFn} */ 36571 fn: arrow, 36572 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 36573 element: '[x-arrow]' 36574 }, 36575 36576 /** 36577 * Modifier used to flip the popper's placement when it starts to overlap its 36578 * reference element. 36579 * 36580 * Requires the `preventOverflow` modifier before it in order to work. 36581 * 36582 * **NOTE:** this modifier will interrupt the current update cycle and will 36583 * restart it if it detects the need to flip the placement. 36584 * @memberof modifiers 36585 * @inner 36586 */ 36587 flip: { 36588 /** @prop {number} order=600 - Index used to define the order of execution */ 36589 order: 600, 36590 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36591 enabled: true, 36592 /** @prop {ModifierFn} */ 36593 fn: flip, 36594 /** 36595 * @prop {String|Array} behavior='flip' 36596 * The behavior used to change the popper's placement. It can be one of 36597 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 36598 * placements (with optional variations) 36599 */ 36600 behavior: 'flip', 36601 /** 36602 * @prop {number} padding=5 36603 * The popper will flip if it hits the edges of the `boundariesElement` 36604 */ 36605 padding: 5, 36606 /** 36607 * @prop {String|HTMLElement} boundariesElement='viewport' 36608 * The element which will define the boundaries of the popper position. 36609 * The popper will never be placed outside of the defined boundaries 36610 * (except if `keepTogether` is enabled) 36611 */ 36612 boundariesElement: 'viewport', 36613 /** 36614 * @prop {Boolean} flipVariations=false 36615 * The popper will switch placement variation between `-start` and `-end` when 36616 * the reference element overlaps its boundaries. 36617 * 36618 * The original placement should have a set variation. 36619 */ 36620 flipVariations: false, 36621 /** 36622 * @prop {Boolean} flipVariationsByContent=false 36623 * The popper will switch placement variation between `-start` and `-end` when 36624 * the popper element overlaps its reference boundaries. 36625 * 36626 * The original placement should have a set variation. 36627 */ 36628 flipVariationsByContent: false 36629 }, 36630 36631 /** 36632 * Modifier used to make the popper flow toward the inner of the reference element. 36633 * By default, when this modifier is disabled, the popper will be placed outside 36634 * the reference element. 36635 * @memberof modifiers 36636 * @inner 36637 */ 36638 inner: { 36639 /** @prop {number} order=700 - Index used to define the order of execution */ 36640 order: 700, 36641 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 36642 enabled: false, 36643 /** @prop {ModifierFn} */ 36644 fn: inner 36645 }, 36646 36647 /** 36648 * Modifier used to hide the popper when its reference element is outside of the 36649 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 36650 * be used to hide with a CSS selector the popper when its reference is 36651 * out of boundaries. 36652 * 36653 * Requires the `preventOverflow` modifier before it in order to work. 36654 * @memberof modifiers 36655 * @inner 36656 */ 36657 hide: { 36658 /** @prop {number} order=800 - Index used to define the order of execution */ 36659 order: 800, 36660 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36661 enabled: true, 36662 /** @prop {ModifierFn} */ 36663 fn: hide 36664 }, 36665 36666 /** 36667 * Computes the style that will be applied to the popper element to gets 36668 * properly positioned. 36669 * 36670 * Note that this modifier will not touch the DOM, it just prepares the styles 36671 * so that `applyStyle` modifier can apply it. This separation is useful 36672 * in case you need to replace `applyStyle` with a custom implementation. 36673 * 36674 * This modifier has `850` as `order` value to maintain backward compatibility 36675 * with previous versions of Popper.js. Expect the modifiers ordering method 36676 * to change in future major versions of the library. 36677 * 36678 * @memberof modifiers 36679 * @inner 36680 */ 36681 computeStyle: { 36682 /** @prop {number} order=850 - Index used to define the order of execution */ 36683 order: 850, 36684 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36685 enabled: true, 36686 /** @prop {ModifierFn} */ 36687 fn: computeStyle, 36688 /** 36689 * @prop {Boolean} gpuAcceleration=true 36690 * If true, it uses the CSS 3D transformation to position the popper. 36691 * Otherwise, it will use the `top` and `left` properties 36692 */ 36693 gpuAcceleration: true, 36694 /** 36695 * @prop {string} [x='bottom'] 36696 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 36697 * Change this if your popper should grow in a direction different from `bottom` 36698 */ 36699 x: 'bottom', 36700 /** 36701 * @prop {string} [x='left'] 36702 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 36703 * Change this if your popper should grow in a direction different from `right` 36704 */ 36705 y: 'right' 36706 }, 36707 36708 /** 36709 * Applies the computed styles to the popper element. 36710 * 36711 * All the DOM manipulations are limited to this modifier. This is useful in case 36712 * you want to integrate Popper.js inside a framework or view library and you 36713 * want to delegate all the DOM manipulations to it. 36714 * 36715 * Note that if you disable this modifier, you must make sure the popper element 36716 * has its position set to `absolute` before Popper.js can do its work! 36717 * 36718 * Just disable this modifier and define your own to achieve the desired effect. 36719 * 36720 * @memberof modifiers 36721 * @inner 36722 */ 36723 applyStyle: { 36724 /** @prop {number} order=900 - Index used to define the order of execution */ 36725 order: 900, 36726 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36727 enabled: true, 36728 /** @prop {ModifierFn} */ 36729 fn: applyStyle, 36730 /** @prop {Function} */ 36731 onLoad: applyStyleOnLoad, 36732 /** 36733 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 36734 * @prop {Boolean} gpuAcceleration=true 36735 * If true, it uses the CSS 3D transformation to position the popper. 36736 * Otherwise, it will use the `top` and `left` properties 36737 */ 36738 gpuAcceleration: undefined 36739 } 36740}; 36741 36742/** 36743 * The `dataObject` is an object containing all the information used by Popper.js. 36744 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 36745 * @name dataObject 36746 * @property {Object} data.instance The Popper.js instance 36747 * @property {String} data.placement Placement applied to popper 36748 * @property {String} data.originalPlacement Placement originally defined on init 36749 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 36750 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 36751 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 36752 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 36753 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 36754 * @property {Object} data.boundaries Offsets of the popper boundaries 36755 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 36756 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 36757 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 36758 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 36759 */ 36760 36761/** 36762 * Default options provided to Popper.js constructor.<br /> 36763 * These can be overridden using the `options` argument of Popper.js.<br /> 36764 * To override an option, simply pass an object with the same 36765 * structure of the `options` object, as the 3rd argument. For example: 36766 * ``` 36767 * new Popper(ref, pop, { 36768 * modifiers: { 36769 * preventOverflow: { enabled: false } 36770 * } 36771 * }) 36772 * ``` 36773 * @type {Object} 36774 * @static 36775 * @memberof Popper 36776 */ 36777var Defaults = { 36778 /** 36779 * Popper's placement. 36780 * @prop {Popper.placements} placement='bottom' 36781 */ 36782 placement: 'bottom', 36783 36784 /** 36785 * Set this to true if you want popper to position it self in 'fixed' mode 36786 * @prop {Boolean} positionFixed=false 36787 */ 36788 positionFixed: false, 36789 36790 /** 36791 * Whether events (resize, scroll) are initially enabled. 36792 * @prop {Boolean} eventsEnabled=true 36793 */ 36794 eventsEnabled: true, 36795 36796 /** 36797 * Set to true if you want to automatically remove the popper when 36798 * you call the `destroy` method. 36799 * @prop {Boolean} removeOnDestroy=false 36800 */ 36801 removeOnDestroy: false, 36802 36803 /** 36804 * Callback called when the popper is created.<br /> 36805 * By default, it is set to no-op.<br /> 36806 * Access Popper.js instance with `data.instance`. 36807 * @prop {onCreate} 36808 */ 36809 onCreate: function onCreate() {}, 36810 36811 /** 36812 * Callback called when the popper is updated. This callback is not called 36813 * on the initialization/creation of the popper, but only on subsequent 36814 * updates.<br /> 36815 * By default, it is set to no-op.<br /> 36816 * Access Popper.js instance with `data.instance`. 36817 * @prop {onUpdate} 36818 */ 36819 onUpdate: function onUpdate() {}, 36820 36821 /** 36822 * List of modifiers used to modify the offsets before they are applied to the popper. 36823 * They provide most of the functionalities of Popper.js. 36824 * @prop {modifiers} 36825 */ 36826 modifiers: modifiers 36827}; 36828 36829/** 36830 * @callback onCreate 36831 * @param {dataObject} data 36832 */ 36833 36834/** 36835 * @callback onUpdate 36836 * @param {dataObject} data 36837 */ 36838 36839// Utils 36840// Methods 36841var Popper = function () { 36842 /** 36843 * Creates a new Popper.js instance. 36844 * @class Popper 36845 * @param {Element|referenceObject} reference - The reference element used to position the popper 36846 * @param {Element} popper - The HTML / XML element used as the popper 36847 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 36848 * @return {Object} instance - The generated Popper.js instance 36849 */ 36850 function Popper(reference, popper) { 36851 var _this = this; 36852 36853 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 36854 classCallCheck(this, Popper); 36855 36856 this.scheduleUpdate = function () { 36857 return requestAnimationFrame(_this.update); 36858 }; 36859 36860 // make update() debounced, so that it only runs at most once-per-tick 36861 this.update = debounce(this.update.bind(this)); 36862 36863 // with {} we create a new object with the options inside it 36864 this.options = _extends({}, Popper.Defaults, options); 36865 36866 // init state 36867 this.state = { 36868 isDestroyed: false, 36869 isCreated: false, 36870 scrollParents: [] 36871 }; 36872 36873 // get reference and popper elements (allow jQuery wrappers) 36874 this.reference = reference && reference.jquery ? reference[0] : reference; 36875 this.popper = popper && popper.jquery ? popper[0] : popper; 36876 36877 // Deep merge modifiers options 36878 this.options.modifiers = {}; 36879 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 36880 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 36881 }); 36882 36883 // Refactoring modifiers' list (Object => Array) 36884 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 36885 return _extends({ 36886 name: name 36887 }, _this.options.modifiers[name]); 36888 }) 36889 // sort the modifiers by order 36890 .sort(function (a, b) { 36891 return a.order - b.order; 36892 }); 36893 36894 // modifiers have the ability to execute arbitrary code when Popper.js get inited 36895 // such code is executed in the same order of its modifier 36896 // they could add new properties to their options configuration 36897 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 36898 this.modifiers.forEach(function (modifierOptions) { 36899 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 36900 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 36901 } 36902 }); 36903 36904 // fire the first update to position the popper in the right place 36905 this.update(); 36906 36907 var eventsEnabled = this.options.eventsEnabled; 36908 if (eventsEnabled) { 36909 // setup event listeners, they will take care of update the position in specific situations 36910 this.enableEventListeners(); 36911 } 36912 36913 this.state.eventsEnabled = eventsEnabled; 36914 } 36915 36916 // We can't use class properties because they don't get listed in the 36917 // class prototype and break stuff like Sinon stubs 36918 36919 36920 createClass(Popper, [{ 36921 key: 'update', 36922 value: function update$$1() { 36923 return update.call(this); 36924 } 36925 }, { 36926 key: 'destroy', 36927 value: function destroy$$1() { 36928 return destroy.call(this); 36929 } 36930 }, { 36931 key: 'enableEventListeners', 36932 value: function enableEventListeners$$1() { 36933 return enableEventListeners.call(this); 36934 } 36935 }, { 36936 key: 'disableEventListeners', 36937 value: function disableEventListeners$$1() { 36938 return disableEventListeners.call(this); 36939 } 36940 36941 /** 36942 * Schedules an update. It will run on the next UI update available. 36943 * @method scheduleUpdate 36944 * @memberof Popper 36945 */ 36946 36947 36948 /** 36949 * Collection of utilities useful when writing custom modifiers. 36950 * Starting from version 1.7, this method is available only if you 36951 * include `popper-utils.js` before `popper.js`. 36952 * 36953 * **DEPRECATION**: This way to access PopperUtils is deprecated 36954 * and will be removed in v2! Use the PopperUtils module directly instead. 36955 * Due to the high instability of the methods contained in Utils, we can't 36956 * guarantee them to follow semver. Use them at your own risk! 36957 * @static 36958 * @private 36959 * @type {Object} 36960 * @deprecated since version 1.8 36961 * @member Utils 36962 * @memberof Popper 36963 */ 36964 36965 }]); 36966 return Popper; 36967}(); 36968 36969/** 36970 * The `referenceObject` is an object that provides an interface compatible with Popper.js 36971 * and lets you use it as replacement of a real DOM node.<br /> 36972 * You can use this method to position a popper relatively to a set of coordinates 36973 * in case you don't have a DOM node to use as reference. 36974 * 36975 * ``` 36976 * new Popper(referenceObject, popperNode); 36977 * ``` 36978 * 36979 * NB: This feature isn't supported in Internet Explorer 10. 36980 * @name referenceObject 36981 * @property {Function} data.getBoundingClientRect 36982 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 36983 * @property {number} data.clientWidth 36984 * An ES6 getter that will return the width of the virtual reference element. 36985 * @property {number} data.clientHeight 36986 * An ES6 getter that will return the height of the virtual reference element. 36987 */ 36988 36989 36990Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 36991Popper.placements = placements; 36992Popper.Defaults = Defaults; 36993 36994/* harmony default export */ __webpack_exports__["default"] = (Popper); 36995//# sourceMappingURL=popper.js.map 36996 36997/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) 36998 36999/***/ }), 37000
vendor: 5,681 bytes, lines 37001-37195
37001/***/ "./node_modules/process/browser.js": 37002/*!*****************************************!*\ 37003 !*** ./node_modules/process/browser.js ***! 37004 \*****************************************/ 37005/*! no static exports found */ 37006/***/ (function(module, exports) { 37007 37008// shim for using process in browser 37009var process = module.exports = {}; 37010 37011// cached from whatever global is present so that test runners that stub it 37012// don't break things. But we need to wrap it in a try catch in case it is 37013// wrapped in strict mode code which doesn't define any globals. It's inside a 37014// function because try/catches deoptimize in certain engines. 37015 37016var cachedSetTimeout; 37017var cachedClearTimeout; 37018 37019function defaultSetTimout() { 37020 throw new Error('setTimeout has not been defined'); 37021} 37022function defaultClearTimeout () { 37023 throw new Error('clearTimeout has not been defined'); 37024} 37025(function () { 37026 try { 37027 if (typeof setTimeout === 'function') { 37028 cachedSetTimeout = setTimeout; 37029 } else { 37030 cachedSetTimeout = defaultSetTimout; 37031 } 37032 } catch (e) { 37033 cachedSetTimeout = defaultSetTimout; 37034 } 37035 try { 37036 if (typeof clearTimeout === 'function') { 37037 cachedClearTimeout = clearTimeout; 37038 } else { 37039 cachedClearTimeout = defaultClearTimeout; 37040 } 37041 } catch (e) { 37042 cachedClearTimeout = defaultClearTimeout; 37043 } 37044} ()) 37045function runTimeout(fun) { 37046 if (cachedSetTimeout === setTimeout) { 37047 //normal enviroments in sane situations 37048 return setTimeout(fun, 0); 37049 } 37050 // if setTimeout wasn't available but was latter defined 37051 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 37052 cachedSetTimeout = setTimeout; 37053 return setTimeout(fun, 0); 37054 } 37055 try { 37056 // when when somebody has screwed with setTimeout but no I.E. maddness 37057 return cachedSetTimeout(fun, 0); 37058 } catch(e){ 37059 try { 37060 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 37061 return cachedSetTimeout.call(null, fun, 0); 37062 } catch(e){ 37063 // 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 37064 return cachedSetTimeout.call(this, fun, 0); 37065 } 37066 } 37067 37068 37069} 37070function runClearTimeout(marker) { 37071 if (cachedClearTimeout === clearTimeout) { 37072 //normal enviroments in sane situations 37073 return clearTimeout(marker); 37074 } 37075 // if clearTimeout wasn't available but was latter defined 37076 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 37077 cachedClearTimeout = clearTimeout; 37078 return clearTimeout(marker); 37079 } 37080 try { 37081 // when when somebody has screwed with setTimeout but no I.E. maddness 37082 return cachedClearTimeout(marker); 37083 } catch (e){ 37084 try { 37085 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 37086 return cachedClearTimeout.call(null, marker); 37087 } catch (e){ 37088 // 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. 37089 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 37090 return cachedClearTimeout.call(this, marker); 37091 } 37092 } 37093 37094 37095 37096} 37097var queue = []; 37098var draining = false; 37099var currentQueue; 37100var queueIndex = -1; 37101 37102function cleanUpNextTick() { 37103 if (!draining || !currentQueue) { 37104 return; 37105 } 37106 draining = false; 37107 if (currentQueue.length) { 37108 queue = currentQueue.concat(queue); 37109 } else { 37110 queueIndex = -1; 37111 } 37112 if (queue.length) { 37113 drainQueue(); 37114 } 37115} 37116 37117function drainQueue() { 37118 if (draining) { 37119 return; 37120 } 37121 var timeout = runTimeout(cleanUpNextTick); 37122 draining = true; 37123 37124 var len = queue.length; 37125 while(len) { 37126 currentQueue = queue; 37127 queue = []; 37128 while (++queueIndex < len) { 37129 if (currentQueue) { 37130 currentQueue[queueIndex].run(); 37131 } 37132 } 37133 queueIndex = -1; 37134 len = queue.length; 37135 } 37136 currentQueue = null; 37137 draining = false; 37138 runClearTimeout(timeout); 37139} 37140 37141process.nextTick = function (fun) { 37142 var args = new Array(arguments.length - 1); 37143 if (arguments.length > 1) { 37144 for (var i = 1; i < arguments.length; i++) { 37145 args[i - 1] = arguments[i]; 37146 } 37147 } 37148 queue.push(new Item(fun, args)); 37149 if (queue.length === 1 && !draining) { 37150 runTimeout(drainQueue); 37151 } 37152}; 37153 37154// v8 likes predictible objects 37155function Item(fun, array) { 37156 this.fun = fun; 37157 this.array = array; 37158} 37159Item.prototype.run = function () { 37160 this.fun.apply(null, this.array); 37161}; 37162process.title = 'browser'; 37163process.browser = true; 37164process.env = {}; 37165process.argv = []; 37166process.version = ''; // empty string to avoid regexp issues 37167process.versions = {}; 37168 37169function noop() {} 37170 37171process.on = noop; 37172process.addListener = noop; 37173process.once = noop; 37174process.off = noop; 37175process.removeListener = noop; 37176process.removeAllListeners = noop; 37177process.emit = noop; 37178process.prependListener = noop; 37179process.prependOnceListener = noop; 37180 37181process.listeners = function (name) { return [] } 37182 37183process.binding = function (name) { 37184 throw new Error('process.binding is not supported'); 37185}; 37186 37187process.cwd = function () { return '/' }; 37188process.chdir = function (dir) { 37189 throw new Error('process.chdir is not supported'); 37190}; 37191process.umask = function() { return 0; }; 37192 37193 37194/***/ }), 37195
vendor: 724 bytes, lines 37196-37226
37196/***/ "./node_modules/webpack/buildin/global.js": 37197/*!***********************************!*\ 37198 !*** (webpack)/buildin/global.js ***! 37199 \***********************************/ 37200/*! no static exports found */ 37201/***/ (function(module, exports) { 37202 37203var g; 37204 37205// This works in non-strict mode 37206g = (function() { 37207 return this; 37208})(); 37209 37210try { 37211 // This works if eval is allowed (see CSP) 37212 g = g || new Function("return this")(); 37213} catch (e) { 37214 // This works if the window reference is available 37215 if (typeof window === "object") g = window; 37216} 37217 37218// g can still be undefined, but nothing to do about it... 37219// We return undefined, instead of nothing here, so it's 37220// easier to handle this case. if(!global) { ...} 37221 37222module.exports = g; 37223 37224 37225/***/ }), 37226
vendor: 749 bytes, lines 37227-37259
37227/***/ "./node_modules/webpack/buildin/module.js": 37228/*!***********************************!*\ 37229 !*** (webpack)/buildin/module.js ***! 37230 \***********************************/ 37231/*! no static exports found */ 37232/***/ (function(module, exports) { 37233 37234module.exports = function(module) { 37235 if (!module.webpackPolyfill) { 37236 module.deprecate = function() {}; 37237 module.paths = []; 37238 // module.parent = undefined by default 37239 if (!module.children) module.children = []; 37240 Object.defineProperty(module, "loaded", { 37241 enumerable: true, 37242 get: function() { 37243 return module.l; 37244 } 37245 }); 37246 Object.defineProperty(module, "id", { 37247 enumerable: true, 37248 get: function() { 37249 return module.i; 37250 } 37251 }); 37252 module.webpackPolyfill = 1; 37253 } 37254 return module; 37255}; 37256 37257 37258/***/ }), 37259
37260/***/ "./resources/js/app.js": 37261/*!*****************************!*\ 37262 !*** ./resources/js/app.js ***! 37263 \*****************************/ 37264/*! no static exports found */ 37265/***/ (function(module, exports, __webpack_require__) { 37266 37267__webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js"); 37268 37269/***/ }), 37270
37271/***/ "./resources/js/bootstrap.js": 37272/*!***********************************!*\ 37273 !*** ./resources/js/bootstrap.js ***! 37274 \***********************************/ 37275/*! no static exports found */ 37276/***/ (function(module, exports, __webpack_require__) { 37277 37278window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 37279/** 37280 * We'll load jQuery and the Bootstrap jQuery plugin which provides support 37281 * for JavaScript based Bootstrap features such as modals and tabs. This 37282 * code may be modified to fit the specific needs of your application. 37283 */ 37284 37285try { 37286 window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"]; 37287 window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 37288 37289 __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js"); 37290} catch (e) {} 37291/** 37292 * We'll load the axios HTTP library which allows us to easily issue requests 37293 * to our Laravel back-end. This library automatically handles sending the 37294 * CSRF token as a header based on the value of the "XSRF" token cookie. 37295 */ 37296 37297 37298window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 37299window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 37300/** 37301 * Echo exposes an expressive API for subscribing to channels and listening 37302 * for events that are broadcast by Laravel. Echo and event broadcasting 37303 * allows your team to easily build robust real-time web applications. 37304 */ 37305// import Echo from 'laravel-echo'; 37306// window.Pusher = require('pusher-js'); 37307// window.Echo = new Echo({ 37308// broadcaster: 'pusher', 37309// key: process.env.MIX_PUSHER_APP_KEY, 37310// cluster: process.env.MIX_PUSHER_APP_CLUSTER, 37311// forceTLS: true 37312// }); 37313 37314/***/ }), 37315
37316/***/ "./resources/sass/app.scss": 37317/*!*********************************!*\ 37318 !*** ./resources/sass/app.scss ***! 37319 \*********************************/ 37320/*! no static exports found */ 37321/***/ (function(module, exports) { 37322 37323// removed by extract-text-webpack-plugin 37324 37325/***/ })
37325, 37326 37327/***/ 0: 37328/*!*************************************************************!*\ 37329 !*** multi ./resources/js/app.js ./resources/sass/app.scss ***! 37330 \*************************************************************/ 37331/*! no static exports found */ 37332/***/ (function(module, exports, __webpack_require__) { 37333 37334__webpack_require__(/*! /work/resources/js/app.js */"./resources/js/app.js"); 37335module.exports = __webpack_require__(/*! /work/resources/sass/app.scss */"./resources/sass/app.scss"); 37336 37337 37338/***/ }) 37339 37340/******/ });
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.